@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;
|
|
@@ -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,18 +38,34 @@ 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
|
-
|
|
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 || '';
|
|
44
49
|
var _otherProps = otherProps || {};
|
|
45
|
-
var tagColorArray = ['orange', 'green'];
|
|
46
|
-
var tagList = (typeof tags === 'string' ? tags.split(',') : []).map(function (tag) {
|
|
47
|
-
return {
|
|
48
|
-
name: tag
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// console.log('itemType', itemType)
|
|
53
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) || {});
|
|
54
69
|
var containerStyle = _extends({
|
|
55
70
|
padding: itemPadding + "px",
|
|
56
71
|
backgroundColor: itemBgColor,
|
|
@@ -64,7 +79,6 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
64
79
|
position: 'absolute',
|
|
65
80
|
zIndex: 10
|
|
66
81
|
};
|
|
67
|
-
console.log('icon', icon);
|
|
68
82
|
// 默认偏移值
|
|
69
83
|
var defaultPosition = {};
|
|
70
84
|
switch (icon.position) {
|
|
@@ -110,11 +124,8 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
110
124
|
style: containerStyle
|
|
111
125
|
}, _otherProps), resultImage && (imagePlacement === 'left' || imagePlacement === 'top') && type !== 'textOnly' ? convertChildren(children, 'image', {
|
|
112
126
|
imgSrc: resultImage,
|
|
113
|
-
className:
|
|
114
|
-
style:
|
|
115
|
-
width: imgWidth + "px",
|
|
116
|
-
height: imgHeight + "px"
|
|
117
|
-
}
|
|
127
|
+
className: imageClassName,
|
|
128
|
+
style: imageStyle
|
|
118
129
|
}) : null, type !== 'imgOnly' && itemType === '开关' && /*#__PURE__*/React.createElement("div", {
|
|
119
130
|
className: "teletext-list__panel__item__switch",
|
|
120
131
|
style: {
|
|
@@ -212,13 +223,14 @@ var TeletextListItem = function TeletextListItem(_ref) {
|
|
|
212
223
|
alt: ""
|
|
213
224
|
}), "Remove"))), resultImage && (imagePlacement === 'right' || imagePlacement === 'bottom') && type !== 'textOnly' ? convertChildren(children, 'image', {
|
|
214
225
|
imgSrc: resultImage,
|
|
215
|
-
className:
|
|
226
|
+
className: imageClassName,
|
|
227
|
+
style: imageStyle
|
|
216
228
|
}) : null, iconList === null || iconList === void 0 ? void 0 : iconList.map(function (icon, index) {
|
|
217
229
|
return /*#__PURE__*/React.createElement("div", {
|
|
218
230
|
key: index,
|
|
219
231
|
className: "teletext-list__panel__item__icon size-" + icon.size,
|
|
220
232
|
style: getIconStyle(icon)
|
|
221
|
-
}, /*#__PURE__*/
|
|
233
|
+
}, /*#__PURE__*/createElement(IconComp, {
|
|
222
234
|
type: icon.icon,
|
|
223
235
|
size: icon.size
|
|
224
236
|
}));
|
|
@@ -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
|
}
|