@dckj-npm/dc-material 0.1.360 → 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 +48 -0
- package/build/docs/colorful-input.html +48 -0
- package/build/docs/index.html +48 -0
- package/build/docs/teletext-list.html +48 -0
- package/build/docs/umi.6743fcd4.css +8 -0
- package/build/docs/umi.b6edaa19.js +1 -0
- package/build/docs/~demos/colorful-button-demo.html +47 -0
- package/build/docs/~demos/colorful-input-demo.html +47 -0
- 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/schema.json +1278 -0
- package/es/components/teletext-list/teletext-list-item.d.ts +5 -1
- package/es/components/teletext-list/teletext-list-item.js +33 -21
- 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/schema.json +1278 -0
- package/lib/components/teletext-list/teletext-list-item.d.ts +5 -1
- package/lib/components/teletext-list/teletext-list-item.js +34 -21
- 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
|
@@ -16,7 +16,7 @@ export interface TeletextListItemProps {
|
|
|
16
16
|
/**
|
|
17
17
|
* 图片地址
|
|
18
18
|
*/
|
|
19
|
-
image?: string[];
|
|
19
|
+
image?: string | string[];
|
|
20
20
|
/**
|
|
21
21
|
* 图片位置
|
|
22
22
|
*/
|
|
@@ -97,6 +97,10 @@ export interface TeletextListItemProps {
|
|
|
97
97
|
* 图文间距
|
|
98
98
|
*/
|
|
99
99
|
textImgGap?: number;
|
|
100
|
+
/**
|
|
101
|
+
* 子节点
|
|
102
|
+
*/
|
|
103
|
+
children?: React.ReactNode;
|
|
100
104
|
}
|
|
101
105
|
declare const TeletextListItem: React.FC<TeletextListItemProps>;
|
|
102
106
|
export default TeletextListItem;
|
|
@@ -5,11 +5,12 @@ exports.__esModule = true;
|
|
|
5
5
|
exports["default"] = void 0;
|
|
6
6
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
7
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
require("./teletext-list-item.scss");
|
|
10
10
|
var _childrenNodeHandle = require("../../utils/children-node-handle");
|
|
11
11
|
var _lowcodeMaterials = require("@alilc/lowcode-materials");
|
|
12
12
|
var _excluded = ["onClick", "title", "image", "children", "imagePlacement", "description", "type", "textLines", "itemColumns", "itemPadding", "iconList", "tags", "text3", "text4", "imgWidth", "imgHeight", "itemBgColor", "style", "textAlign", "isShoppingCart", "isWishList", "isUserMenu", "itemType", "textImgGap"];
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
13
14
|
/**
|
|
14
15
|
* 数据
|
|
15
16
|
*/
|
|
@@ -18,8 +19,7 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
18
19
|
var _ref$onClick = _ref.onClick,
|
|
19
20
|
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
20
21
|
title = _ref.title,
|
|
21
|
-
|
|
22
|
-
image = _ref$image === void 0 ? [] : _ref$image,
|
|
22
|
+
image = _ref.image,
|
|
23
23
|
children = _ref.children,
|
|
24
24
|
imagePlacement = _ref.imagePlacement,
|
|
25
25
|
description = _ref.description,
|
|
@@ -43,18 +43,34 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
43
43
|
_ref$textImgGap = _ref.textImgGap,
|
|
44
44
|
textImgGap = _ref$textImgGap === void 0 ? 16 : _ref$textImgGap,
|
|
45
45
|
otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
var normalizeNodeKey = function normalizeNodeKey(rawKey) {
|
|
47
|
+
if (rawKey === undefined || rawKey === null) {
|
|
48
|
+
return '';
|
|
49
|
+
}
|
|
50
|
+
return String(rawKey).replace(/^\.?\$?/, '');
|
|
51
|
+
};
|
|
52
|
+
var IconComp = _lowcodeMaterials.Icon;
|
|
53
|
+
var resultImage = Array.isArray(image) ? image[0] || '' : image || '';
|
|
48
54
|
var _otherProps = otherProps || {};
|
|
49
|
-
var tagColorArray = ['orange', 'green'];
|
|
50
|
-
var tagList = (typeof tags === 'string' ? tags.split(',') : []).map(function (tag) {
|
|
51
|
-
return {
|
|
52
|
-
name: tag
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// console.log('itemType', itemType)
|
|
57
55
|
var containerClass = "teletext-list__panel__item image-" + imagePlacement + " itemColumns-" + itemColumns;
|
|
56
|
+
var childNodeList = _react["default"].Children.toArray(children);
|
|
57
|
+
var getChildPropsByKey = function getChildPropsByKey(key) {
|
|
58
|
+
var targetKey = normalizeNodeKey(key);
|
|
59
|
+
var targetChild = childNodeList.find(function (child) {
|
|
60
|
+
var _child$props;
|
|
61
|
+
var childKey = normalizeNodeKey(child === null || child === void 0 ? void 0 : child.key);
|
|
62
|
+
var childPropsKey = normalizeNodeKey(child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.key);
|
|
63
|
+
return childKey === targetKey || childPropsKey === targetKey;
|
|
64
|
+
});
|
|
65
|
+
return (targetChild === null || targetChild === void 0 ? void 0 : targetChild.props) || {};
|
|
66
|
+
};
|
|
67
|
+
var imageChildProps = getChildPropsByKey('image');
|
|
68
|
+
var imageClassName = ['teletext-list__panel__item_image', imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.className].filter(Boolean).join(' ');
|
|
69
|
+
var imageStyle = (0, _extends2["default"])({}, typeof imgWidth === 'number' ? {
|
|
70
|
+
width: imgWidth + "px"
|
|
71
|
+
} : {}, typeof imgHeight === 'number' ? {
|
|
72
|
+
height: imgHeight + "px"
|
|
73
|
+
} : {}, (imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.style) || {});
|
|
58
74
|
var containerStyle = (0, _extends2["default"])({
|
|
59
75
|
padding: itemPadding + "px",
|
|
60
76
|
backgroundColor: itemBgColor,
|
|
@@ -68,7 +84,6 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
68
84
|
position: 'absolute',
|
|
69
85
|
zIndex: 10
|
|
70
86
|
};
|
|
71
|
-
console.log('icon', icon);
|
|
72
87
|
// 默认偏移值
|
|
73
88
|
var defaultPosition = {};
|
|
74
89
|
switch (icon.position) {
|
|
@@ -114,11 +129,8 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
114
129
|
style: containerStyle
|
|
115
130
|
}, _otherProps), resultImage && (imagePlacement === 'left' || imagePlacement === 'top') && type !== 'textOnly' ? (0, _childrenNodeHandle.convertChildren)(children, 'image', {
|
|
116
131
|
imgSrc: resultImage,
|
|
117
|
-
className:
|
|
118
|
-
style:
|
|
119
|
-
width: imgWidth + "px",
|
|
120
|
-
height: imgHeight + "px"
|
|
121
|
-
}
|
|
132
|
+
className: imageClassName,
|
|
133
|
+
style: imageStyle
|
|
122
134
|
}) : null, type !== 'imgOnly' && itemType === '开关' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
123
135
|
className: "teletext-list__panel__item__switch",
|
|
124
136
|
style: {
|
|
@@ -216,13 +228,14 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
216
228
|
alt: ""
|
|
217
229
|
}), "Remove"))), resultImage && (imagePlacement === 'right' || imagePlacement === 'bottom') && type !== 'textOnly' ? (0, _childrenNodeHandle.convertChildren)(children, 'image', {
|
|
218
230
|
imgSrc: resultImage,
|
|
219
|
-
className:
|
|
231
|
+
className: imageClassName,
|
|
232
|
+
style: imageStyle
|
|
220
233
|
}) : null, iconList === null || iconList === void 0 ? void 0 : iconList.map(function (icon, index) {
|
|
221
234
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
222
235
|
key: index,
|
|
223
236
|
className: "teletext-list__panel__item__icon size-" + icon.size,
|
|
224
237
|
style: getIconStyle(icon)
|
|
225
|
-
}, /*#__PURE__*/_react
|
|
238
|
+
}, /*#__PURE__*/(0, _react.createElement)(IconComp, {
|
|
226
239
|
type: icon.icon,
|
|
227
240
|
size: icon.size
|
|
228
241
|
}));
|
|
@@ -11,7 +11,7 @@ interface DataProps {
|
|
|
11
11
|
/**
|
|
12
12
|
* 图片地址
|
|
13
13
|
*/
|
|
14
|
-
image?: string[];
|
|
14
|
+
image?: string | string[];
|
|
15
15
|
/**
|
|
16
16
|
* 说明
|
|
17
17
|
*/
|
|
@@ -68,7 +68,7 @@ export interface TeletextListProps {
|
|
|
68
68
|
/**
|
|
69
69
|
* 子节点
|
|
70
70
|
*/
|
|
71
|
-
children
|
|
71
|
+
children?: React.ReactNode;
|
|
72
72
|
/**
|
|
73
73
|
* 图片位置
|
|
74
74
|
*/
|
|
@@ -81,11 +81,11 @@ export interface TeletextListProps {
|
|
|
81
81
|
/**
|
|
82
82
|
* 更多
|
|
83
83
|
*/
|
|
84
|
-
moreText
|
|
84
|
+
moreText?: string;
|
|
85
85
|
/**
|
|
86
86
|
* 文字行数
|
|
87
87
|
*/
|
|
88
|
-
textLines
|
|
88
|
+
textLines?: number;
|
|
89
89
|
/**
|
|
90
90
|
* 控件类型
|
|
91
91
|
*/
|
|
@@ -23,9 +23,11 @@ var TeletextList = function TeletextList(_ref) {
|
|
|
23
23
|
_ref$imagePlacement = _ref.imagePlacement,
|
|
24
24
|
imagePlacement = _ref$imagePlacement === void 0 ? 'left' : _ref$imagePlacement,
|
|
25
25
|
handleMoreClick = _ref.handleMoreClick,
|
|
26
|
-
moreText = _ref.moreText,
|
|
26
|
+
_ref$moreText = _ref.moreText,
|
|
27
|
+
moreText = _ref$moreText === void 0 ? '' : _ref$moreText,
|
|
27
28
|
title = _ref.title,
|
|
28
|
-
textLines = _ref.textLines,
|
|
29
|
+
_ref$textLines = _ref.textLines,
|
|
30
|
+
textLines = _ref$textLines === void 0 ? 2 : _ref$textLines,
|
|
29
31
|
type = _ref.type,
|
|
30
32
|
itemColumns = _ref.itemColumns,
|
|
31
33
|
iconList = _ref.iconList,
|
|
@@ -42,34 +44,19 @@ var TeletextList = function TeletextList(_ref) {
|
|
|
42
44
|
isUserMenu = _ref.isUserMenu,
|
|
43
45
|
textImgGap = _ref.textImgGap,
|
|
44
46
|
otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
47
|
+
var TeletextListItemComp = _teletextListItem["default"];
|
|
45
48
|
var _otherProps = otherProps || {};
|
|
46
|
-
var columnStyle = {
|
|
47
|
-
gridTemplateColumns: "repeat(" + itemColumns + ",1fr)",
|
|
48
|
-
gap: itemGap + "px"
|
|
49
|
-
};
|
|
50
|
-
// console.log('dataList1', dataList)
|
|
51
49
|
var getListStyle = function getListStyle() {
|
|
52
50
|
if (itemRowAlign === 'row') {
|
|
53
51
|
return {
|
|
54
52
|
width: 'auto',
|
|
55
|
-
// 设置为 auto 以适应内容宽度
|
|
56
53
|
display: 'flex',
|
|
57
54
|
gap: itemGap + "px",
|
|
58
55
|
overflowX: 'auto',
|
|
59
|
-
// 优化滚动体验
|
|
60
56
|
scrollSnapType: 'x mandatory',
|
|
61
|
-
WebkitOverflowScrolling: 'touch'
|
|
62
|
-
// 隐藏滚动条
|
|
63
|
-
msOverflowStyle: 'none',
|
|
64
|
-
// IE和Edge
|
|
65
|
-
scrollbarWidth: 'none',
|
|
66
|
-
// Firefox
|
|
67
|
-
'::-webkit-scrollbar': {
|
|
68
|
-
display: 'none' // Chrome, Safari 和 Opera
|
|
69
|
-
}
|
|
57
|
+
WebkitOverflowScrolling: 'touch'
|
|
70
58
|
};
|
|
71
59
|
}
|
|
72
|
-
// column 模式使用 grid 布局
|
|
73
60
|
return {
|
|
74
61
|
display: 'grid',
|
|
75
62
|
gridTemplateColumns: "repeat(" + itemColumns + ",1fr)",
|
|
@@ -78,9 +65,9 @@ var TeletextList = function TeletextList(_ref) {
|
|
|
78
65
|
};
|
|
79
66
|
var getDataList = function getDataList() {
|
|
80
67
|
if (!dataList) return [];
|
|
81
|
-
console.log('dataList2', dataList);
|
|
82
68
|
return Array.isArray(dataList) ? dataList : [dataList];
|
|
83
69
|
};
|
|
70
|
+
var dataItems = getDataList();
|
|
84
71
|
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
85
72
|
className: "teletext-list__panel"
|
|
86
73
|
}, _otherProps), /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -104,11 +91,11 @@ var TeletextList = function TeletextList(_ref) {
|
|
|
104
91
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
105
92
|
className: "teletext-list__panel-head-user-menu-text"
|
|
106
93
|
}, "Hello, Paige Turner")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
107
|
-
className: "teletext-list__panel__item-list",
|
|
94
|
+
className: "teletext-list__panel__item-list " + (itemRowAlign === 'row' ? 'teletext-list__panel__item-list--row' : ''),
|
|
108
95
|
style: getListStyle()
|
|
109
|
-
},
|
|
110
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
111
|
-
key:
|
|
96
|
+
}, dataItems.length > 0 ? dataItems.map(function (item, index) {
|
|
97
|
+
return /*#__PURE__*/_react["default"].createElement(TeletextListItemComp, (0, _extends2["default"])({
|
|
98
|
+
key: index,
|
|
112
99
|
onClick: onClick,
|
|
113
100
|
imagePlacement: imagePlacement,
|
|
114
101
|
style: itemRowAlign === 'row' ? {
|
|
@@ -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;
|