@dckj-npm/dc-material 0.1.361 → 0.1.362
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.a2a18b22.css → umi.6743fcd4.css} +2 -2
- package/build/docs/umi.b6edaa19.js +1 -0
- 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 +176 -35
- package/lowcode_es/meta.js +1 -1
- package/lowcode_es/teletext-list/meta.d.ts +2 -2
- package/lowcode_es/teletext-list/meta.js +185 -22
- package/lowcode_lib/meta.js +1 -1
- package/lowcode_lib/teletext-list/meta.d.ts +2 -2
- package/lowcode_lib/teletext-list/meta.js +187 -24
- package/package.json +3 -3
- package/build/docs/umi.e8fefa28.js +0 -1
|
@@ -5,6 +5,13 @@ exports.__esModule = true;
|
|
|
5
5
|
exports.convertChildren = convertChildren;
|
|
6
6
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var normalizeNodeKey = function normalizeNodeKey(rawKey) {
|
|
9
|
+
if (rawKey === undefined || rawKey === null) {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
return String(rawKey).replace(/^\.?\$?/, '');
|
|
13
|
+
};
|
|
14
|
+
|
|
8
15
|
/**
|
|
9
16
|
* 从children数组中获取指定组件
|
|
10
17
|
* @author ZhuGangMin
|
|
@@ -15,17 +22,16 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
22
|
*/
|
|
16
23
|
function convertChildren(children, key, props) {
|
|
17
24
|
var node;
|
|
25
|
+
var targetKey = normalizeNodeKey(key);
|
|
18
26
|
if (Array.isArray(children)) {
|
|
19
27
|
for (var i = 0; i < children.length; i++) {
|
|
28
|
+
var _child$props;
|
|
20
29
|
var child = children[i];
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
var childKey = normalizeNodeKey(child === null || child === void 0 ? void 0 : child.key);
|
|
31
|
+
var childPropsKey = normalizeNodeKey(child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.key);
|
|
32
|
+
if (childKey === targetKey || childPropsKey === targetKey) {
|
|
23
33
|
// 属性融合
|
|
24
34
|
var propsContact = props ? (0, _extends2["default"])({}, child.props, props) : child.props;
|
|
25
|
-
// 样式融合
|
|
26
|
-
if (props !== null && props !== void 0 && props.style && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.style) {
|
|
27
|
-
propsContact.style = (0, _extends2["default"])({}, child.props.style, props.style);
|
|
28
|
-
}
|
|
29
35
|
node = /*#__PURE__*/_react["default"].cloneElement(child, propsContact);
|
|
30
36
|
break;
|
|
31
37
|
}
|
|
@@ -1,9 +1,87 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IPublicTypeComponentMetadata,
|
|
3
3
|
IPublicTypeSnippet,
|
|
4
|
-
IPublicTypeConfigure,
|
|
5
4
|
} from '@alilc/lowcode-types'
|
|
6
5
|
|
|
6
|
+
const IMAGE_KEY = 'image'
|
|
7
|
+
|
|
8
|
+
const normalizeNodeKey = (rawKey: any): string => {
|
|
9
|
+
if (rawKey === undefined || rawKey === null) return ''
|
|
10
|
+
return String(rawKey).replace(/^\.?\$?/, '')
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const parsePxNumber = (value: any): number | undefined => {
|
|
14
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
15
|
+
return value
|
|
16
|
+
}
|
|
17
|
+
if (typeof value === 'string') {
|
|
18
|
+
const numberLike = Number(value.trim())
|
|
19
|
+
if (Number.isFinite(numberLike)) {
|
|
20
|
+
return numberLike
|
|
21
|
+
}
|
|
22
|
+
const matched = value.match(/^\s*(\d+(?:\.\d+)?)\s*px\s*$/i)
|
|
23
|
+
if (!matched) return undefined
|
|
24
|
+
const parsed = Number(matched[1])
|
|
25
|
+
return Number.isFinite(parsed) ? parsed : undefined
|
|
26
|
+
}
|
|
27
|
+
return undefined
|
|
28
|
+
}
|
|
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
|
+
const getImageStyleNumber = (target: any, styleKey: 'width' | 'height'): number | undefined => {
|
|
45
|
+
const imageChildSchema = findImageChildSchema(target)
|
|
46
|
+
const childStyleValue = imageChildSchema?.props?.style?.[styleKey]
|
|
47
|
+
return parsePxNumber(childStyleValue)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const syncImageStyleValue = (target: any, styleKey: 'width' | 'height', value: number) => {
|
|
51
|
+
const imageChildSchema = findImageChildSchema(target)
|
|
52
|
+
if (!imageChildSchema) {
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
if (!imageChildSchema.props) {
|
|
56
|
+
imageChildSchema.props = {}
|
|
57
|
+
}
|
|
58
|
+
const currentStyle = imageChildSchema.props.style || {}
|
|
59
|
+
imageChildSchema.props.style = {
|
|
60
|
+
...currentStyle,
|
|
61
|
+
[styleKey]: `${value}px`,
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const syncImageDimensionPropsFromChild = (target: any) => {
|
|
66
|
+
const widthFromChild = getImageStyleNumber(target, 'width')
|
|
67
|
+
const heightFromChild = getImageStyleNumber(target, 'height')
|
|
68
|
+
const propsApi = target?.getProps?.()
|
|
69
|
+
|
|
70
|
+
if (propsApi && widthFromChild !== undefined) {
|
|
71
|
+
const currentWidth = parsePxNumber(propsApi.getPropValue?.('imgWidth'))
|
|
72
|
+
if (currentWidth !== widthFromChild) {
|
|
73
|
+
propsApi.setPropValue('imgWidth', widthFromChild)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (propsApi && heightFromChild !== undefined) {
|
|
78
|
+
const currentHeight = parsePxNumber(propsApi.getPropValue?.('imgHeight'))
|
|
79
|
+
if (currentHeight !== heightFromChild) {
|
|
80
|
+
propsApi.setPropValue('imgHeight', heightFromChild)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
7
85
|
const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
8
86
|
group: '低代码组件',
|
|
9
87
|
componentName: 'TeletextList',
|
|
@@ -130,6 +208,8 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
130
208
|
extraProps: {
|
|
131
209
|
setValue: (target, value) => {
|
|
132
210
|
target.getProps().setPropValue('imagePlacement', value)
|
|
211
|
+
// 切换图片布局时同步一次子图片尺寸,避免面板回退到默认值
|
|
212
|
+
syncImageDimensionPropsFromChild(target)
|
|
133
213
|
},
|
|
134
214
|
},
|
|
135
215
|
},
|
|
@@ -140,8 +220,43 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
140
220
|
setter: {
|
|
141
221
|
componentName: 'NumberSetter',
|
|
142
222
|
isRequired: false,
|
|
143
|
-
initialValue:
|
|
144
|
-
|
|
223
|
+
initialValue: (target) => {
|
|
224
|
+
const styleWidth = getImageStyleNumber(target, 'width')
|
|
225
|
+
if (styleWidth !== undefined) {
|
|
226
|
+
return styleWidth
|
|
227
|
+
}
|
|
228
|
+
const propValue = target?.getProps()?.getPropValue?.('imgWidth')
|
|
229
|
+
const parsedPropValue = parsePxNumber(propValue)
|
|
230
|
+
if (parsedPropValue !== undefined) return parsedPropValue
|
|
231
|
+
return getImageStyleNumber(target, 'width') ?? 100
|
|
232
|
+
},
|
|
233
|
+
defaultValue: (target) => getImageStyleNumber(target, 'width') ?? 100,
|
|
234
|
+
},
|
|
235
|
+
extraProps: {
|
|
236
|
+
getValue: (target) => {
|
|
237
|
+
const styleWidth = getImageStyleNumber(target, 'width')
|
|
238
|
+
if (styleWidth !== undefined) {
|
|
239
|
+
const currentWidth = parsePxNumber(target?.getProps()?.getPropValue?.('imgWidth'))
|
|
240
|
+
if (currentWidth !== styleWidth) {
|
|
241
|
+
target?.getProps()?.setPropValue?.('imgWidth', styleWidth)
|
|
242
|
+
}
|
|
243
|
+
return styleWidth
|
|
244
|
+
}
|
|
245
|
+
const propValue = target?.getProps()?.getPropValue?.('imgWidth')
|
|
246
|
+
const parsedPropValue = parsePxNumber(propValue)
|
|
247
|
+
if (parsedPropValue !== undefined) {
|
|
248
|
+
return parsedPropValue
|
|
249
|
+
}
|
|
250
|
+
return getImageStyleNumber(target, 'width') ?? 100
|
|
251
|
+
},
|
|
252
|
+
setValue: (target, value) => {
|
|
253
|
+
const parsedValue = parsePxNumber(value)
|
|
254
|
+
if (parsedValue === undefined) {
|
|
255
|
+
return
|
|
256
|
+
}
|
|
257
|
+
target.getProps().setPropValue('imgWidth', parsedValue)
|
|
258
|
+
syncImageStyleValue(target, 'width', parsedValue)
|
|
259
|
+
},
|
|
145
260
|
},
|
|
146
261
|
},
|
|
147
262
|
{
|
|
@@ -151,8 +266,43 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
151
266
|
setter: {
|
|
152
267
|
componentName: 'NumberSetter',
|
|
153
268
|
isRequired: false,
|
|
154
|
-
initialValue:
|
|
155
|
-
|
|
269
|
+
initialValue: (target) => {
|
|
270
|
+
const styleHeight = getImageStyleNumber(target, 'height')
|
|
271
|
+
if (styleHeight !== undefined) {
|
|
272
|
+
return styleHeight
|
|
273
|
+
}
|
|
274
|
+
const propValue = target?.getProps()?.getPropValue?.('imgHeight')
|
|
275
|
+
const parsedPropValue = parsePxNumber(propValue)
|
|
276
|
+
if (parsedPropValue !== undefined) return parsedPropValue
|
|
277
|
+
return getImageStyleNumber(target, 'height') ?? 100
|
|
278
|
+
},
|
|
279
|
+
defaultValue: (target) => getImageStyleNumber(target, 'height') ?? 100,
|
|
280
|
+
},
|
|
281
|
+
extraProps: {
|
|
282
|
+
getValue: (target) => {
|
|
283
|
+
const styleHeight = getImageStyleNumber(target, 'height')
|
|
284
|
+
if (styleHeight !== undefined) {
|
|
285
|
+
const currentHeight = parsePxNumber(target?.getProps()?.getPropValue?.('imgHeight'))
|
|
286
|
+
if (currentHeight !== styleHeight) {
|
|
287
|
+
target?.getProps()?.setPropValue?.('imgHeight', styleHeight)
|
|
288
|
+
}
|
|
289
|
+
return styleHeight
|
|
290
|
+
}
|
|
291
|
+
const propValue = target?.getProps()?.getPropValue?.('imgHeight')
|
|
292
|
+
const parsedPropValue = parsePxNumber(propValue)
|
|
293
|
+
if (parsedPropValue !== undefined) {
|
|
294
|
+
return parsedPropValue
|
|
295
|
+
}
|
|
296
|
+
return getImageStyleNumber(target, 'height') ?? 100
|
|
297
|
+
},
|
|
298
|
+
setValue: (target, value) => {
|
|
299
|
+
const parsedValue = parsePxNumber(value)
|
|
300
|
+
if (parsedValue === undefined) {
|
|
301
|
+
return
|
|
302
|
+
}
|
|
303
|
+
target.getProps().setPropValue('imgHeight', parsedValue)
|
|
304
|
+
syncImageStyleValue(target, 'height', parsedValue)
|
|
305
|
+
},
|
|
156
306
|
},
|
|
157
307
|
},
|
|
158
308
|
{
|
|
@@ -177,7 +327,7 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
177
327
|
},
|
|
178
328
|
extraProps: {
|
|
179
329
|
setValue: (target, value) => {
|
|
180
|
-
|
|
330
|
+
target.getProps().setPropValue('dataListBind', value)
|
|
181
331
|
},
|
|
182
332
|
},
|
|
183
333
|
},
|
|
@@ -225,14 +375,15 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
225
375
|
extraProps: {
|
|
226
376
|
setValue(target, value) {
|
|
227
377
|
target.getProps().setPropValue('textLines', value)
|
|
228
|
-
const schema = target?.node?.schema
|
|
229
|
-
const node = target?.node
|
|
378
|
+
const schema: any = target?.node?.schema
|
|
379
|
+
const node: any = target?.node
|
|
380
|
+
const schemaChildren: any[] = Array.isArray(schema?.children) ? schema.children : []
|
|
230
381
|
|
|
231
382
|
// 获取当前文本组件数量
|
|
232
383
|
const currentLength =
|
|
233
|
-
|
|
384
|
+
schemaChildren.filter(
|
|
234
385
|
(child) =>
|
|
235
|
-
child.componentName === 'NextText' && child
|
|
386
|
+
child.componentName === 'NextText' && child?.props?.key?.startsWith('text-'),
|
|
236
387
|
)?.length || 0
|
|
237
388
|
|
|
238
389
|
if (value > currentLength) {
|
|
@@ -246,23 +397,28 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
246
397
|
key: `text-${i}`,
|
|
247
398
|
},
|
|
248
399
|
}
|
|
249
|
-
console.log('node', node, 'node-children', node?.children)
|
|
250
400
|
node?.children?.push(newChild)
|
|
251
401
|
}
|
|
252
402
|
} else if (value < currentLength) {
|
|
253
403
|
// 需要移除多余的文本组件
|
|
254
|
-
node?.children
|
|
255
|
-
(child) =>
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
)
|
|
404
|
+
const filteredChildren = (Array.isArray(node?.children) ? node.children : []).filter(
|
|
405
|
+
(child: any) => {
|
|
406
|
+
if (child.componentName !== 'NextText') {
|
|
407
|
+
return true
|
|
408
|
+
}
|
|
409
|
+
const key = child?.props?.key
|
|
410
|
+
if (!key?.startsWith('text-')) {
|
|
411
|
+
return true
|
|
412
|
+
}
|
|
413
|
+
const order = Number(key.split('-')[1])
|
|
414
|
+
return Number.isNaN(order) || order <= value
|
|
415
|
+
},
|
|
261
416
|
)
|
|
417
|
+
node.children = filteredChildren
|
|
262
418
|
}
|
|
263
419
|
|
|
264
420
|
// 更新数据源绑定的配置
|
|
265
|
-
const dataListBindProp = target
|
|
421
|
+
const dataListBindProp = (target?.parent as any)?.items?.find(
|
|
266
422
|
(item) => item.name === 'dataListBind',
|
|
267
423
|
)
|
|
268
424
|
if (dataListBindProp && dataListBindProp.setter) {
|
|
@@ -288,17 +444,6 @@ const TeletextListMeta: IPublicTypeComponentMetadata = {
|
|
|
288
444
|
...textChildren,
|
|
289
445
|
]
|
|
290
446
|
}
|
|
291
|
-
|
|
292
|
-
console.log(
|
|
293
|
-
'文字行数',
|
|
294
|
-
target,
|
|
295
|
-
value,
|
|
296
|
-
schema,
|
|
297
|
-
target.node,
|
|
298
|
-
target.parent,
|
|
299
|
-
target.parent.getPropValue('dataListBind'),
|
|
300
|
-
target.parent.node?.getProp('dataListBind'),
|
|
301
|
-
)
|
|
302
447
|
},
|
|
303
448
|
},
|
|
304
449
|
},
|
|
@@ -838,9 +983,5 @@ const getSnippets = (textLines = 2): IPublicTypeSnippet[] => [
|
|
|
838
983
|
|
|
839
984
|
export default {
|
|
840
985
|
...TeletextListMeta,
|
|
841
|
-
snippets: getSnippets(
|
|
842
|
-
(TeletextListMeta.configure as IPublicTypeConfigure).props
|
|
843
|
-
?.find((prop) => prop.name === 'textLines')
|
|
844
|
-
?.setter?.getValue?.() || 2,
|
|
845
|
-
),
|
|
986
|
+
snippets: getSnippets(2),
|
|
846
987
|
}
|
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.362';
|
|
121
121
|
}
|
|
122
122
|
if (basicLibraryVersion === void 0) {
|
|
123
123
|
basicLibraryVersion = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPublicTypeSnippet
|
|
1
|
+
import { IPublicTypeSnippet } from '@alilc/lowcode-types';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
snippets: IPublicTypeSnippet[];
|
|
4
4
|
componentName: string;
|
|
@@ -12,7 +12,7 @@ declare const _default: {
|
|
|
12
12
|
devMode?: "proCode" | "lowCode";
|
|
13
13
|
npm?: import("@alilc/lowcode-types").IPublicTypeNpmInfo;
|
|
14
14
|
props?: import("@alilc/lowcode-types").IPublicTypePropConfig[];
|
|
15
|
-
configure?: import("@alilc/lowcode-types").IPublicTypeFieldConfig[] | IPublicTypeConfigure;
|
|
15
|
+
configure?: import("@alilc/lowcode-types").IPublicTypeFieldConfig[] | import("@alilc/lowcode-types").IPublicTypeConfigure;
|
|
16
16
|
experimental?: import("@alilc/lowcode-types").IPublicTypeAdvanced;
|
|
17
17
|
schema?: import("@alilc/lowcode-types").IPublicTypeComponentSchema;
|
|
18
18
|
group?: string | import("@alilc/lowcode-types").IPublicTypeI18nData;
|
|
@@ -1,5 +1,77 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
var
|
|
2
|
+
var IMAGE_KEY = 'image';
|
|
3
|
+
var normalizeNodeKey = function normalizeNodeKey(rawKey) {
|
|
4
|
+
if (rawKey === undefined || rawKey === null) return '';
|
|
5
|
+
return String(rawKey).replace(/^\.?\$?/, '');
|
|
6
|
+
};
|
|
7
|
+
var parsePxNumber = function parsePxNumber(value) {
|
|
8
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
if (typeof value === 'string') {
|
|
12
|
+
var numberLike = Number(value.trim());
|
|
13
|
+
if (Number.isFinite(numberLike)) {
|
|
14
|
+
return numberLike;
|
|
15
|
+
}
|
|
16
|
+
var matched = value.match(/^\s*(\d+(?:\.\d+)?)\s*px\s*$/i);
|
|
17
|
+
if (!matched) return undefined;
|
|
18
|
+
var parsed = Number(matched[1]);
|
|
19
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
};
|
|
23
|
+
var getSchemaChildren = function getSchemaChildren(target) {
|
|
24
|
+
var _target$node;
|
|
25
|
+
var nodeSchema = target === null || target === void 0 ? void 0 : (_target$node = target.node) === null || _target$node === void 0 ? void 0 : _target$node.schema;
|
|
26
|
+
return Array.isArray(nodeSchema === null || nodeSchema === void 0 ? void 0 : nodeSchema.children) ? nodeSchema.children : [];
|
|
27
|
+
};
|
|
28
|
+
var findImageChildSchema = function findImageChildSchema(target) {
|
|
29
|
+
var schemaChildren = getSchemaChildren(target);
|
|
30
|
+
return schemaChildren.find(function (child) {
|
|
31
|
+
var _child$props;
|
|
32
|
+
var keyFromProps = normalizeNodeKey(child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.key);
|
|
33
|
+
var keyFromNode = normalizeNodeKey(child === null || child === void 0 ? void 0 : child.key);
|
|
34
|
+
return keyFromProps === IMAGE_KEY || keyFromNode === IMAGE_KEY;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var getImageStyleNumber = function getImageStyleNumber(target, styleKey) {
|
|
38
|
+
var _imageChildSchema$pro, _imageChildSchema$pro2;
|
|
39
|
+
var imageChildSchema = findImageChildSchema(target);
|
|
40
|
+
var childStyleValue = 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];
|
|
41
|
+
return parsePxNumber(childStyleValue);
|
|
42
|
+
};
|
|
43
|
+
var syncImageStyleValue = function syncImageStyleValue(target, styleKey, value) {
|
|
44
|
+
var _extends2;
|
|
45
|
+
var imageChildSchema = findImageChildSchema(target);
|
|
46
|
+
if (!imageChildSchema) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!imageChildSchema.props) {
|
|
50
|
+
imageChildSchema.props = {};
|
|
51
|
+
}
|
|
52
|
+
var currentStyle = imageChildSchema.props.style || {};
|
|
53
|
+
imageChildSchema.props.style = _extends({}, currentStyle, (_extends2 = {}, _extends2[styleKey] = value + "px", _extends2));
|
|
54
|
+
};
|
|
55
|
+
var syncImageDimensionPropsFromChild = function syncImageDimensionPropsFromChild(target) {
|
|
56
|
+
var _target$getProps;
|
|
57
|
+
var widthFromChild = getImageStyleNumber(target, 'width');
|
|
58
|
+
var heightFromChild = getImageStyleNumber(target, 'height');
|
|
59
|
+
var propsApi = target === null || target === void 0 ? void 0 : (_target$getProps = target.getProps) === null || _target$getProps === void 0 ? void 0 : _target$getProps.call(target);
|
|
60
|
+
if (propsApi && widthFromChild !== undefined) {
|
|
61
|
+
var _propsApi$getPropValu;
|
|
62
|
+
var currentWidth = parsePxNumber((_propsApi$getPropValu = propsApi.getPropValue) === null || _propsApi$getPropValu === void 0 ? void 0 : _propsApi$getPropValu.call(propsApi, 'imgWidth'));
|
|
63
|
+
if (currentWidth !== widthFromChild) {
|
|
64
|
+
propsApi.setPropValue('imgWidth', widthFromChild);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (propsApi && heightFromChild !== undefined) {
|
|
68
|
+
var _propsApi$getPropValu2;
|
|
69
|
+
var currentHeight = parsePxNumber((_propsApi$getPropValu2 = propsApi.getPropValue) === null || _propsApi$getPropValu2 === void 0 ? void 0 : _propsApi$getPropValu2.call(propsApi, 'imgHeight'));
|
|
70
|
+
if (currentHeight !== heightFromChild) {
|
|
71
|
+
propsApi.setPropValue('imgHeight', heightFromChild);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
3
75
|
var TeletextListMeta = {
|
|
4
76
|
group: '低代码组件',
|
|
5
77
|
componentName: 'TeletextList',
|
|
@@ -104,6 +176,8 @@ var TeletextListMeta = {
|
|
|
104
176
|
extraProps: {
|
|
105
177
|
setValue: function setValue(target, value) {
|
|
106
178
|
target.getProps().setPropValue('imagePlacement', value);
|
|
179
|
+
// 切换图片布局时同步一次子图片尺寸,避免面板回退到默认值
|
|
180
|
+
syncImageDimensionPropsFromChild(target);
|
|
107
181
|
}
|
|
108
182
|
}
|
|
109
183
|
}, {
|
|
@@ -113,8 +187,50 @@ var TeletextListMeta = {
|
|
|
113
187
|
setter: {
|
|
114
188
|
componentName: 'NumberSetter',
|
|
115
189
|
isRequired: false,
|
|
116
|
-
initialValue:
|
|
117
|
-
|
|
190
|
+
initialValue: function initialValue(target) {
|
|
191
|
+
var _target$getProps2, _target$getProps2$get, _getImageStyleNumber;
|
|
192
|
+
var styleWidth = getImageStyleNumber(target, 'width');
|
|
193
|
+
if (styleWidth !== undefined) {
|
|
194
|
+
return styleWidth;
|
|
195
|
+
}
|
|
196
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps2 = target.getProps()) === null || _target$getProps2 === void 0 ? void 0 : (_target$getProps2$get = _target$getProps2.getPropValue) === null || _target$getProps2$get === void 0 ? void 0 : _target$getProps2$get.call(_target$getProps2, 'imgWidth');
|
|
197
|
+
var parsedPropValue = parsePxNumber(propValue);
|
|
198
|
+
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
199
|
+
return (_getImageStyleNumber = getImageStyleNumber(target, 'width')) !== null && _getImageStyleNumber !== void 0 ? _getImageStyleNumber : 100;
|
|
200
|
+
},
|
|
201
|
+
defaultValue: function defaultValue(target) {
|
|
202
|
+
var _getImageStyleNumber2;
|
|
203
|
+
return (_getImageStyleNumber2 = getImageStyleNumber(target, 'width')) !== null && _getImageStyleNumber2 !== void 0 ? _getImageStyleNumber2 : 100;
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
extraProps: {
|
|
207
|
+
getValue: function getValue(target) {
|
|
208
|
+
var _target$getProps5, _target$getProps5$get, _getImageStyleNumber3;
|
|
209
|
+
var styleWidth = getImageStyleNumber(target, 'width');
|
|
210
|
+
if (styleWidth !== undefined) {
|
|
211
|
+
var _target$getProps3, _target$getProps3$get;
|
|
212
|
+
var currentWidth = parsePxNumber(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'));
|
|
213
|
+
if (currentWidth !== styleWidth) {
|
|
214
|
+
var _target$getProps4, _target$getProps4$set;
|
|
215
|
+
target === null || target === void 0 ? void 0 : (_target$getProps4 = target.getProps()) === null || _target$getProps4 === void 0 ? void 0 : (_target$getProps4$set = _target$getProps4.setPropValue) === null || _target$getProps4$set === void 0 ? void 0 : _target$getProps4$set.call(_target$getProps4, 'imgWidth', styleWidth);
|
|
216
|
+
}
|
|
217
|
+
return styleWidth;
|
|
218
|
+
}
|
|
219
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps5 = target.getProps()) === null || _target$getProps5 === void 0 ? void 0 : (_target$getProps5$get = _target$getProps5.getPropValue) === null || _target$getProps5$get === void 0 ? void 0 : _target$getProps5$get.call(_target$getProps5, 'imgWidth');
|
|
220
|
+
var parsedPropValue = parsePxNumber(propValue);
|
|
221
|
+
if (parsedPropValue !== undefined) {
|
|
222
|
+
return parsedPropValue;
|
|
223
|
+
}
|
|
224
|
+
return (_getImageStyleNumber3 = getImageStyleNumber(target, 'width')) !== null && _getImageStyleNumber3 !== void 0 ? _getImageStyleNumber3 : 100;
|
|
225
|
+
},
|
|
226
|
+
setValue: function setValue(target, value) {
|
|
227
|
+
var parsedValue = parsePxNumber(value);
|
|
228
|
+
if (parsedValue === undefined) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
target.getProps().setPropValue('imgWidth', parsedValue);
|
|
232
|
+
syncImageStyleValue(target, 'width', parsedValue);
|
|
233
|
+
}
|
|
118
234
|
}
|
|
119
235
|
}, {
|
|
120
236
|
title: '图片高度',
|
|
@@ -123,8 +239,50 @@ var TeletextListMeta = {
|
|
|
123
239
|
setter: {
|
|
124
240
|
componentName: 'NumberSetter',
|
|
125
241
|
isRequired: false,
|
|
126
|
-
initialValue:
|
|
127
|
-
|
|
242
|
+
initialValue: function initialValue(target) {
|
|
243
|
+
var _target$getProps6, _target$getProps6$get, _getImageStyleNumber4;
|
|
244
|
+
var styleHeight = getImageStyleNumber(target, 'height');
|
|
245
|
+
if (styleHeight !== undefined) {
|
|
246
|
+
return styleHeight;
|
|
247
|
+
}
|
|
248
|
+
var propValue = target === null || target === void 0 ? void 0 : (_target$getProps6 = target.getProps()) === null || _target$getProps6 === void 0 ? void 0 : (_target$getProps6$get = _target$getProps6.getPropValue) === null || _target$getProps6$get === void 0 ? void 0 : _target$getProps6$get.call(_target$getProps6, 'imgHeight');
|
|
249
|
+
var parsedPropValue = parsePxNumber(propValue);
|
|
250
|
+
if (parsedPropValue !== undefined) return parsedPropValue;
|
|
251
|
+
return (_getImageStyleNumber4 = getImageStyleNumber(target, 'height')) !== null && _getImageStyleNumber4 !== void 0 ? _getImageStyleNumber4 : 100;
|
|
252
|
+
},
|
|
253
|
+
defaultValue: function defaultValue(target) {
|
|
254
|
+
var _getImageStyleNumber5;
|
|
255
|
+
return (_getImageStyleNumber5 = getImageStyleNumber(target, 'height')) !== null && _getImageStyleNumber5 !== void 0 ? _getImageStyleNumber5 : 100;
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
extraProps: {
|
|
259
|
+
getValue: function getValue(target) {
|
|
260
|
+
var _target$getProps9, _target$getProps9$get, _getImageStyleNumber6;
|
|
261
|
+
var styleHeight = getImageStyleNumber(target, 'height');
|
|
262
|
+
if (styleHeight !== undefined) {
|
|
263
|
+
var _target$getProps7, _target$getProps7$get;
|
|
264
|
+
var currentHeight = parsePxNumber(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, 'imgHeight'));
|
|
265
|
+
if (currentHeight !== styleHeight) {
|
|
266
|
+
var _target$getProps8, _target$getProps8$set;
|
|
267
|
+
target === null || target === void 0 ? void 0 : (_target$getProps8 = target.getProps()) === null || _target$getProps8 === void 0 ? void 0 : (_target$getProps8$set = _target$getProps8.setPropValue) === null || _target$getProps8$set === void 0 ? void 0 : _target$getProps8$set.call(_target$getProps8, 'imgHeight', styleHeight);
|
|
268
|
+
}
|
|
269
|
+
return styleHeight;
|
|
270
|
+
}
|
|
271
|
+
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');
|
|
272
|
+
var parsedPropValue = parsePxNumber(propValue);
|
|
273
|
+
if (parsedPropValue !== undefined) {
|
|
274
|
+
return parsedPropValue;
|
|
275
|
+
}
|
|
276
|
+
return (_getImageStyleNumber6 = getImageStyleNumber(target, 'height')) !== null && _getImageStyleNumber6 !== void 0 ? _getImageStyleNumber6 : 100;
|
|
277
|
+
},
|
|
278
|
+
setValue: function setValue(target, value) {
|
|
279
|
+
var parsedValue = parsePxNumber(value);
|
|
280
|
+
if (parsedValue === undefined) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
target.getProps().setPropValue('imgHeight', parsedValue);
|
|
284
|
+
syncImageStyleValue(target, 'height', parsedValue);
|
|
285
|
+
}
|
|
128
286
|
}
|
|
129
287
|
}, {
|
|
130
288
|
title: '数据源绑定',
|
|
@@ -153,7 +311,7 @@ var TeletextListMeta = {
|
|
|
153
311
|
},
|
|
154
312
|
extraProps: {
|
|
155
313
|
setValue: function setValue(target, value) {
|
|
156
|
-
|
|
314
|
+
target.getProps().setPropValue('dataListBind', value);
|
|
157
315
|
}
|
|
158
316
|
}
|
|
159
317
|
}, {
|
|
@@ -197,16 +355,17 @@ var TeletextListMeta = {
|
|
|
197
355
|
},
|
|
198
356
|
extraProps: {
|
|
199
357
|
setValue: function setValue(target, value) {
|
|
200
|
-
var _target$
|
|
358
|
+
var _target$node2, _schemaChildren$filte, _target$parent, _target$parent$items;
|
|
201
359
|
target.getProps().setPropValue('textLines', value);
|
|
202
|
-
var schema = target === null || target === void 0 ? void 0 : (_target$
|
|
360
|
+
var schema = target === null || target === void 0 ? void 0 : (_target$node2 = target.node) === null || _target$node2 === void 0 ? void 0 : _target$node2.schema;
|
|
203
361
|
var node = target === null || target === void 0 ? void 0 : target.node;
|
|
362
|
+
var schemaChildren = Array.isArray(schema === null || schema === void 0 ? void 0 : schema.children) ? schema.children : [];
|
|
204
363
|
|
|
205
364
|
// 获取当前文本组件数量
|
|
206
|
-
var currentLength = (
|
|
207
|
-
var _child$
|
|
208
|
-
return child.componentName === 'NextText' && ((_child$props$key =
|
|
209
|
-
})) === null ||
|
|
365
|
+
var currentLength = ((_schemaChildren$filte = schemaChildren.filter(function (child) {
|
|
366
|
+
var _child$props2, _child$props2$key;
|
|
367
|
+
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-'));
|
|
368
|
+
})) === null || _schemaChildren$filte === void 0 ? void 0 : _schemaChildren$filte.length) || 0;
|
|
210
369
|
if (value > currentLength) {
|
|
211
370
|
// 需要添加新的文本组件
|
|
212
371
|
for (var i = currentLength + 1; i <= value; i++) {
|
|
@@ -219,20 +378,27 @@ var TeletextListMeta = {
|
|
|
219
378
|
key: "text-" + i
|
|
220
379
|
}
|
|
221
380
|
};
|
|
222
|
-
console.log('node', node, 'node-children', node === null || node === void 0 ? void 0 : node.children);
|
|
223
381
|
node === null || node === void 0 ? void 0 : (_node$children = node.children) === null || _node$children === void 0 ? void 0 : _node$children.push(newChild);
|
|
224
382
|
}
|
|
225
383
|
} else if (value < currentLength) {
|
|
226
|
-
var _node$children2;
|
|
227
384
|
// 需要移除多余的文本组件
|
|
228
|
-
node === null || node === void 0 ? void 0 :
|
|
229
|
-
var _child$
|
|
230
|
-
|
|
385
|
+
var filteredChildren = (Array.isArray(node === null || node === void 0 ? void 0 : node.children) ? node.children : []).filter(function (child) {
|
|
386
|
+
var _child$props3;
|
|
387
|
+
if (child.componentName !== 'NextText') {
|
|
388
|
+
return true;
|
|
389
|
+
}
|
|
390
|
+
var key = child === null || child === void 0 ? void 0 : (_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.key;
|
|
391
|
+
if (!(key !== null && key !== void 0 && key.startsWith('text-'))) {
|
|
392
|
+
return true;
|
|
393
|
+
}
|
|
394
|
+
var order = Number(key.split('-')[1]);
|
|
395
|
+
return Number.isNaN(order) || order <= value;
|
|
231
396
|
});
|
|
397
|
+
node.children = filteredChildren;
|
|
232
398
|
}
|
|
233
399
|
|
|
234
400
|
// 更新数据源绑定的配置
|
|
235
|
-
var dataListBindProp = target.parent.items.find(function (item) {
|
|
401
|
+
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) {
|
|
236
402
|
return item.name === 'dataListBind';
|
|
237
403
|
});
|
|
238
404
|
if (dataListBindProp && dataListBindProp.setter) {
|
|
@@ -263,7 +429,6 @@ var TeletextListMeta = {
|
|
|
263
429
|
// 更新setter的attributes
|
|
264
430
|
dataListBindProp.setter.props.attributes[0].children = [].concat(baseChildren, textChildren);
|
|
265
431
|
}
|
|
266
|
-
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'));
|
|
267
432
|
}
|
|
268
433
|
}
|
|
269
434
|
}, {
|
|
@@ -726,7 +891,5 @@ var getSnippets = function getSnippets(textLines) {
|
|
|
726
891
|
}];
|
|
727
892
|
};
|
|
728
893
|
export default _extends({}, TeletextListMeta, {
|
|
729
|
-
snippets: getSnippets(
|
|
730
|
-
return prop.name === 'textLines';
|
|
731
|
-
})) === 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)
|
|
894
|
+
snippets: getSnippets(2)
|
|
732
895
|
});
|
package/lowcode_lib/meta.js
CHANGED
|
@@ -122,7 +122,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
|
|
|
122
122
|
packageName = '@dckj-npm/dc-material';
|
|
123
123
|
}
|
|
124
124
|
if (version === void 0) {
|
|
125
|
-
version = '0.1.
|
|
125
|
+
version = '0.1.362';
|
|
126
126
|
}
|
|
127
127
|
if (basicLibraryVersion === void 0) {
|
|
128
128
|
basicLibraryVersion = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPublicTypeSnippet
|
|
1
|
+
import { IPublicTypeSnippet } from '@alilc/lowcode-types';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
snippets: IPublicTypeSnippet[];
|
|
4
4
|
componentName: string;
|
|
@@ -12,7 +12,7 @@ declare const _default: {
|
|
|
12
12
|
devMode?: "proCode" | "lowCode";
|
|
13
13
|
npm?: import("@alilc/lowcode-types").IPublicTypeNpmInfo;
|
|
14
14
|
props?: import("@alilc/lowcode-types").IPublicTypePropConfig[];
|
|
15
|
-
configure?: import("@alilc/lowcode-types").IPublicTypeFieldConfig[] | IPublicTypeConfigure;
|
|
15
|
+
configure?: import("@alilc/lowcode-types").IPublicTypeFieldConfig[] | import("@alilc/lowcode-types").IPublicTypeConfigure;
|
|
16
16
|
experimental?: import("@alilc/lowcode-types").IPublicTypeAdvanced;
|
|
17
17
|
schema?: import("@alilc/lowcode-types").IPublicTypeComponentSchema;
|
|
18
18
|
group?: string | import("@alilc/lowcode-types").IPublicTypeI18nData;
|