@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
|
@@ -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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
3
|
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"];
|
|
4
|
-
import React from 'react';
|
|
4
|
+
import React, { createElement } from 'react';
|
|
5
5
|
import "./teletext-list-item.scss";
|
|
6
6
|
import { convertChildren } from "../../utils/children-node-handle";
|
|
7
7
|
import { Icon } from '@alilc/lowcode-materials';
|
|
@@ -14,8 +14,7 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
14
14
|
var _ref$onClick = _ref.onClick,
|
|
15
15
|
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
16
16
|
title = _ref.title,
|
|
17
|
-
|
|
18
|
-
image = _ref$image === void 0 ? [] : _ref$image,
|
|
17
|
+
image = _ref.image,
|
|
19
18
|
children = _ref.children,
|
|
20
19
|
imagePlacement = _ref.imagePlacement,
|
|
21
20
|
description = _ref.description,
|
|
@@ -39,30 +38,40 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
39
38
|
_ref$textImgGap = _ref.textImgGap,
|
|
40
39
|
textImgGap = _ref$textImgGap === void 0 ? 16 : _ref$textImgGap,
|
|
41
40
|
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
var normalizeNodeKey = function normalizeNodeKey(rawKey) {
|
|
42
|
+
if (rawKey === undefined || rawKey === null) {
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
return String(rawKey).replace(/^\.?\$?/, '');
|
|
46
|
+
};
|
|
47
|
+
var IconComp = Icon;
|
|
48
|
+
var resultImage = Array.isArray(image) ? image[0] || '' : image || '';
|
|
46
49
|
var _otherProps = otherProps || {};
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
var containerClass = "teletext-list__panel__item image-" + imagePlacement + " itemColumns-" + itemColumns;
|
|
51
|
+
var childNodeList = React.Children.toArray(children);
|
|
52
|
+
var getChildPropsByKey = function getChildPropsByKey(key) {
|
|
53
|
+
var targetKey = normalizeNodeKey(key);
|
|
54
|
+
var targetChild = childNodeList.find(function (child) {
|
|
55
|
+
var _child$props;
|
|
56
|
+
var childKey = normalizeNodeKey(child === null || child === void 0 ? void 0 : child.key);
|
|
57
|
+
var childPropsKey = normalizeNodeKey(child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.key);
|
|
58
|
+
return childKey === targetKey || childPropsKey === targetKey;
|
|
59
|
+
});
|
|
60
|
+
return (targetChild === null || targetChild === void 0 ? void 0 : targetChild.props) || {};
|
|
61
|
+
};
|
|
62
|
+
var imageChildProps = getChildPropsByKey('image');
|
|
63
|
+
var imageClassName = ['teletext-list__panel__item_image', imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.className].filter(Boolean).join(' ');
|
|
64
|
+
var imageStyle = _extends({}, typeof imgWidth === 'number' ? {
|
|
65
|
+
width: imgWidth + "px"
|
|
66
|
+
} : {}, typeof imgHeight === 'number' ? {
|
|
67
|
+
height: imgHeight + "px"
|
|
68
|
+
} : {}, (imageChildProps === null || imageChildProps === void 0 ? void 0 : imageChildProps.style) || {});
|
|
56
69
|
var containerStyle = _extends({
|
|
57
70
|
padding: itemPadding + "px",
|
|
58
71
|
backgroundColor: itemBgColor,
|
|
59
72
|
alignItems: textAlign,
|
|
60
73
|
gap: textImgGap + "px"
|
|
61
74
|
}, style);
|
|
62
|
-
var imageStyle = {
|
|
63
|
-
width: imgWidth + "px",
|
|
64
|
-
height: imgHeight + "px"
|
|
65
|
-
};
|
|
66
75
|
|
|
67
76
|
// 生成图标样式
|
|
68
77
|
var getIconStyle = function getIconStyle(icon) {
|
|
@@ -70,7 +79,6 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
70
79
|
position: 'absolute',
|
|
71
80
|
zIndex: 10
|
|
72
81
|
};
|
|
73
|
-
console.log('icon', icon);
|
|
74
82
|
// 默认偏移值
|
|
75
83
|
var defaultPosition = {};
|
|
76
84
|
switch (icon.position) {
|
|
@@ -116,7 +124,7 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
116
124
|
style: containerStyle
|
|
117
125
|
}, _otherProps), resultImage && (imagePlacement === 'left' || imagePlacement === 'top') && type !== 'textOnly' ? convertChildren(children, 'image', {
|
|
118
126
|
imgSrc: resultImage,
|
|
119
|
-
className:
|
|
127
|
+
className: imageClassName,
|
|
120
128
|
style: imageStyle
|
|
121
129
|
}) : null, type !== 'imgOnly' && itemType === '开关' && /*#__PURE__*/React.createElement("div", {
|
|
122
130
|
className: "teletext-list__panel__item__switch",
|
|
@@ -215,14 +223,14 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
215
223
|
alt: ""
|
|
216
224
|
}), "Remove"))), resultImage && (imagePlacement === 'right' || imagePlacement === 'bottom') && type !== 'textOnly' ? convertChildren(children, 'image', {
|
|
217
225
|
imgSrc: resultImage,
|
|
218
|
-
className:
|
|
226
|
+
className: imageClassName,
|
|
219
227
|
style: imageStyle
|
|
220
228
|
}) : null, iconList === null || iconList === void 0 ? void 0 : iconList.map(function (icon, index) {
|
|
221
229
|
return /*#__PURE__*/React.createElement("div", {
|
|
222
230
|
key: index,
|
|
223
231
|
className: "teletext-list__panel__item__icon size-" + icon.size,
|
|
224
232
|
style: getIconStyle(icon)
|
|
225
|
-
}, /*#__PURE__*/
|
|
233
|
+
}, /*#__PURE__*/createElement(IconComp, {
|
|
226
234
|
type: icon.icon,
|
|
227
235
|
size: icon.size
|
|
228
236
|
}));
|
|
@@ -7,22 +7,7 @@
|
|
|
7
7
|
gap: 5px;
|
|
8
8
|
// padding-bottom: 10px;
|
|
9
9
|
justify-content: flex-start;
|
|
10
|
-
align-items: flex-start;
|
|
11
10
|
background-color: #f8f9fb;
|
|
12
|
-
|
|
13
|
-
&.type-imgOnly {
|
|
14
|
-
.teletext-list__panel__item_image {
|
|
15
|
-
width: 100%;
|
|
16
|
-
height: 100%;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&.type-textOnly {
|
|
21
|
-
.teletext-list__panel__item__text {
|
|
22
|
-
width: 100%;
|
|
23
|
-
flex: 1;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
11
|
|
|
27
12
|
.teletext-list__panel__item_image {
|
|
28
13
|
width: 100px;
|
|
@@ -43,7 +28,6 @@
|
|
|
43
28
|
.teletext-list__panel__item__text {
|
|
44
29
|
display: flex;
|
|
45
30
|
flex-direction: column;
|
|
46
|
-
flex: 1;
|
|
47
31
|
gap: 3px;
|
|
48
32
|
|
|
49
33
|
.teletext-list__panel__item__text__item {
|
|
@@ -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
|
*/
|
|
@@ -19,9 +19,11 @@ var TeletextList = function TeletextList(_ref) {
|
|
|
19
19
|
_ref$imagePlacement = _ref.imagePlacement,
|
|
20
20
|
imagePlacement = _ref$imagePlacement === void 0 ? 'left' : _ref$imagePlacement,
|
|
21
21
|
handleMoreClick = _ref.handleMoreClick,
|
|
22
|
-
moreText = _ref.moreText,
|
|
22
|
+
_ref$moreText = _ref.moreText,
|
|
23
|
+
moreText = _ref$moreText === void 0 ? '' : _ref$moreText,
|
|
23
24
|
title = _ref.title,
|
|
24
|
-
textLines = _ref.textLines,
|
|
25
|
+
_ref$textLines = _ref.textLines,
|
|
26
|
+
textLines = _ref$textLines === void 0 ? 2 : _ref$textLines,
|
|
25
27
|
type = _ref.type,
|
|
26
28
|
itemColumns = _ref.itemColumns,
|
|
27
29
|
iconList = _ref.iconList,
|
|
@@ -38,34 +40,19 @@ var TeletextList = function TeletextList(_ref) {
|
|
|
38
40
|
isUserMenu = _ref.isUserMenu,
|
|
39
41
|
textImgGap = _ref.textImgGap,
|
|
40
42
|
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
43
|
+
var TeletextListItemComp = TeletextListItem;
|
|
41
44
|
var _otherProps = otherProps || {};
|
|
42
|
-
var columnStyle = {
|
|
43
|
-
gridTemplateColumns: "repeat(" + itemColumns + ",1fr)",
|
|
44
|
-
gap: itemGap + "px"
|
|
45
|
-
};
|
|
46
|
-
// console.log('dataList1', dataList)
|
|
47
45
|
var getListStyle = function getListStyle() {
|
|
48
46
|
if (itemRowAlign === 'row') {
|
|
49
47
|
return {
|
|
50
48
|
width: 'auto',
|
|
51
|
-
// 设置为 auto 以适应内容宽度
|
|
52
49
|
display: 'flex',
|
|
53
50
|
gap: itemGap + "px",
|
|
54
51
|
overflowX: 'auto',
|
|
55
|
-
// 优化滚动体验
|
|
56
52
|
scrollSnapType: 'x mandatory',
|
|
57
|
-
WebkitOverflowScrolling: 'touch'
|
|
58
|
-
// 隐藏滚动条
|
|
59
|
-
msOverflowStyle: 'none',
|
|
60
|
-
// IE和Edge
|
|
61
|
-
scrollbarWidth: 'none',
|
|
62
|
-
// Firefox
|
|
63
|
-
'::-webkit-scrollbar': {
|
|
64
|
-
display: 'none' // Chrome, Safari 和 Opera
|
|
65
|
-
}
|
|
53
|
+
WebkitOverflowScrolling: 'touch'
|
|
66
54
|
};
|
|
67
55
|
}
|
|
68
|
-
// column 模式使用 grid 布局
|
|
69
56
|
return {
|
|
70
57
|
display: 'grid',
|
|
71
58
|
gridTemplateColumns: "repeat(" + itemColumns + ",1fr)",
|
|
@@ -74,9 +61,9 @@ var TeletextList = function TeletextList(_ref) {
|
|
|
74
61
|
};
|
|
75
62
|
var getDataList = function getDataList() {
|
|
76
63
|
if (!dataList) return [];
|
|
77
|
-
console.log('dataList2', dataList);
|
|
78
64
|
return Array.isArray(dataList) ? dataList : [dataList];
|
|
79
65
|
};
|
|
66
|
+
var dataItems = getDataList();
|
|
80
67
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
81
68
|
className: "teletext-list__panel"
|
|
82
69
|
}, _otherProps), /*#__PURE__*/React.createElement("div", {
|
|
@@ -100,11 +87,11 @@ var TeletextList = function TeletextList(_ref) {
|
|
|
100
87
|
}), /*#__PURE__*/React.createElement("div", {
|
|
101
88
|
className: "teletext-list__panel-head-user-menu-text"
|
|
102
89
|
}, "Hello, Paige Turner")), /*#__PURE__*/React.createElement("div", {
|
|
103
|
-
className: "teletext-list__panel__item-list",
|
|
90
|
+
className: "teletext-list__panel__item-list " + (itemRowAlign === 'row' ? 'teletext-list__panel__item-list--row' : ''),
|
|
104
91
|
style: getListStyle()
|
|
105
|
-
},
|
|
106
|
-
return /*#__PURE__*/React.createElement(
|
|
107
|
-
key:
|
|
92
|
+
}, dataItems.length > 0 ? dataItems.map(function (item, index) {
|
|
93
|
+
return /*#__PURE__*/React.createElement(TeletextListItemComp, _extends({
|
|
94
|
+
key: index,
|
|
108
95
|
onClick: onClick,
|
|
109
96
|
imagePlacement: imagePlacement,
|
|
110
97
|
style: itemRowAlign === 'row' ? {
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
var normalizeNodeKey = function normalizeNodeKey(rawKey) {
|
|
4
|
+
if (rawKey === undefined || rawKey === null) {
|
|
5
|
+
return '';
|
|
6
|
+
}
|
|
7
|
+
return String(rawKey).replace(/^\.?\$?/, '');
|
|
8
|
+
};
|
|
9
|
+
|
|
3
10
|
/**
|
|
4
11
|
* 从children数组中获取指定组件
|
|
5
12
|
* @author ZhuGangMin
|
|
@@ -10,17 +17,16 @@ import React from 'react';
|
|
|
10
17
|
*/
|
|
11
18
|
export function convertChildren(children, key, props) {
|
|
12
19
|
var node;
|
|
20
|
+
var targetKey = normalizeNodeKey(key);
|
|
13
21
|
if (Array.isArray(children)) {
|
|
14
22
|
for (var i = 0; i < children.length; i++) {
|
|
23
|
+
var _child$props;
|
|
15
24
|
var child = children[i];
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
var childKey = normalizeNodeKey(child === null || child === void 0 ? void 0 : child.key);
|
|
26
|
+
var childPropsKey = normalizeNodeKey(child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.key);
|
|
27
|
+
if (childKey === targetKey || childPropsKey === targetKey) {
|
|
18
28
|
// 属性融合
|
|
19
29
|
var propsContact = props ? _extends({}, child.props, props) : child.props;
|
|
20
|
-
// 样式融合
|
|
21
|
-
if (props !== null && props !== void 0 && props.style && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.style) {
|
|
22
|
-
propsContact.style = _extends({}, child.props.style, props.style);
|
|
23
|
-
}
|
|
24
30
|
node = /*#__PURE__*/React.cloneElement(child, propsContact);
|
|
25
31
|
break;
|
|
26
32
|
}
|
|
@@ -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,30 +43,40 @@ 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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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 || '';
|
|
50
54
|
var _otherProps = otherProps || {};
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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) || {});
|
|
60
74
|
var containerStyle = (0, _extends2["default"])({
|
|
61
75
|
padding: itemPadding + "px",
|
|
62
76
|
backgroundColor: itemBgColor,
|
|
63
77
|
alignItems: textAlign,
|
|
64
78
|
gap: textImgGap + "px"
|
|
65
79
|
}, style);
|
|
66
|
-
var imageStyle = {
|
|
67
|
-
width: imgWidth + "px",
|
|
68
|
-
height: imgHeight + "px"
|
|
69
|
-
};
|
|
70
80
|
|
|
71
81
|
// 生成图标样式
|
|
72
82
|
var getIconStyle = function getIconStyle(icon) {
|
|
@@ -74,7 +84,6 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
74
84
|
position: 'absolute',
|
|
75
85
|
zIndex: 10
|
|
76
86
|
};
|
|
77
|
-
console.log('icon', icon);
|
|
78
87
|
// 默认偏移值
|
|
79
88
|
var defaultPosition = {};
|
|
80
89
|
switch (icon.position) {
|
|
@@ -120,7 +129,7 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
120
129
|
style: containerStyle
|
|
121
130
|
}, _otherProps), resultImage && (imagePlacement === 'left' || imagePlacement === 'top') && type !== 'textOnly' ? (0, _childrenNodeHandle.convertChildren)(children, 'image', {
|
|
122
131
|
imgSrc: resultImage,
|
|
123
|
-
className:
|
|
132
|
+
className: imageClassName,
|
|
124
133
|
style: imageStyle
|
|
125
134
|
}) : null, type !== 'imgOnly' && itemType === '开关' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
126
135
|
className: "teletext-list__panel__item__switch",
|
|
@@ -219,14 +228,14 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
219
228
|
alt: ""
|
|
220
229
|
}), "Remove"))), resultImage && (imagePlacement === 'right' || imagePlacement === 'bottom') && type !== 'textOnly' ? (0, _childrenNodeHandle.convertChildren)(children, 'image', {
|
|
221
230
|
imgSrc: resultImage,
|
|
222
|
-
className:
|
|
231
|
+
className: imageClassName,
|
|
223
232
|
style: imageStyle
|
|
224
233
|
}) : null, iconList === null || iconList === void 0 ? void 0 : iconList.map(function (icon, index) {
|
|
225
234
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
226
235
|
key: index,
|
|
227
236
|
className: "teletext-list__panel__item__icon size-" + icon.size,
|
|
228
237
|
style: getIconStyle(icon)
|
|
229
|
-
}, /*#__PURE__*/_react
|
|
238
|
+
}, /*#__PURE__*/(0, _react.createElement)(IconComp, {
|
|
230
239
|
type: icon.icon,
|
|
231
240
|
size: icon.size
|
|
232
241
|
}));
|
|
@@ -7,22 +7,7 @@
|
|
|
7
7
|
gap: 5px;
|
|
8
8
|
// padding-bottom: 10px;
|
|
9
9
|
justify-content: flex-start;
|
|
10
|
-
align-items: flex-start;
|
|
11
10
|
background-color: #f8f9fb;
|
|
12
|
-
|
|
13
|
-
&.type-imgOnly {
|
|
14
|
-
.teletext-list__panel__item_image {
|
|
15
|
-
width: 100%;
|
|
16
|
-
height: 100%;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&.type-textOnly {
|
|
21
|
-
.teletext-list__panel__item__text {
|
|
22
|
-
width: 100%;
|
|
23
|
-
flex: 1;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
11
|
|
|
27
12
|
.teletext-list__panel__item_image {
|
|
28
13
|
width: 100px;
|
|
@@ -43,7 +28,6 @@
|
|
|
43
28
|
.teletext-list__panel__item__text {
|
|
44
29
|
display: flex;
|
|
45
30
|
flex-direction: column;
|
|
46
|
-
flex: 1;
|
|
47
31
|
gap: 3px;
|
|
48
32
|
|
|
49
33
|
.teletext-list__panel__item__text__item {
|
|
@@ -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' ? {
|