@dckj-npm/dc-material 0.1.360 → 0.1.361

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.
@@ -39,8 +39,10 @@ var TeletextListItem = function TeletextListItem(_ref) {
39
39
  _ref$textImgGap = _ref.textImgGap,
40
40
  textImgGap = _ref$textImgGap === void 0 ? 16 : _ref$textImgGap,
41
41
  otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
42
- // 处理图片地址,兼容字符串和数组
43
- var resultImage = Array.isArray(image) ? image.length > 0 ? image[0] : '' : typeof image === 'string' ? image : '';
42
+ // 处理图片地址,兼容字符串和数组,优先取第一个有效字符串
43
+ var resultImage = Array.isArray(image) ? image.find(function (item) {
44
+ return typeof item === 'string' && item.trim();
45
+ }) || '' : typeof image === 'string' ? image : '';
44
46
  var _otherProps = otherProps || {};
45
47
  var tagColorArray = ['orange', 'green'];
46
48
  var tagList = (typeof tags === 'string' ? tags.split(',') : []).map(function (tag) {
@@ -50,13 +52,17 @@ var TeletextListItem = function TeletextListItem(_ref) {
50
52
  });
51
53
 
52
54
  // console.log('itemType', itemType)
53
- var containerClass = "teletext-list__panel__item image-" + imagePlacement + " itemColumns-" + itemColumns;
55
+ var containerClass = "teletext-list__panel__item image-" + imagePlacement + " itemColumns-" + itemColumns + " type-" + type;
54
56
  var containerStyle = _extends({
55
57
  padding: itemPadding + "px",
56
58
  backgroundColor: itemBgColor,
57
59
  alignItems: textAlign,
58
60
  gap: textImgGap + "px"
59
61
  }, style);
62
+ var imageStyle = {
63
+ width: imgWidth + "px",
64
+ height: imgHeight + "px"
65
+ };
60
66
 
61
67
  // 生成图标样式
62
68
  var getIconStyle = function getIconStyle(icon) {
@@ -111,10 +117,7 @@ var TeletextListItem = function TeletextListItem(_ref) {
111
117
  }, _otherProps), resultImage && (imagePlacement === 'left' || imagePlacement === 'top') && type !== 'textOnly' ? convertChildren(children, 'image', {
112
118
  imgSrc: resultImage,
113
119
  className: 'teletext-list__panel__item_image',
114
- style: {
115
- width: imgWidth + "px",
116
- height: imgHeight + "px"
117
- }
120
+ style: imageStyle
118
121
  }) : null, type !== 'imgOnly' && itemType === '开关' && /*#__PURE__*/React.createElement("div", {
119
122
  className: "teletext-list__panel__item__switch",
120
123
  style: {
@@ -212,7 +215,8 @@ var TeletextListItem = function TeletextListItem(_ref) {
212
215
  alt: ""
213
216
  }), "Remove"))), resultImage && (imagePlacement === 'right' || imagePlacement === 'bottom') && type !== 'textOnly' ? convertChildren(children, 'image', {
214
217
  imgSrc: resultImage,
215
- className: 'teletext-list__panel__item_image'
218
+ className: 'teletext-list__panel__item_image',
219
+ style: imageStyle
216
220
  }) : null, iconList === null || iconList === void 0 ? void 0 : iconList.map(function (icon, index) {
217
221
  return /*#__PURE__*/React.createElement("div", {
218
222
  key: index,
@@ -7,7 +7,22 @@
7
7
  gap: 5px;
8
8
  // padding-bottom: 10px;
9
9
  justify-content: flex-start;
10
+ align-items: flex-start;
10
11
  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
+ }
11
26
 
12
27
  .teletext-list__panel__item_image {
13
28
  width: 100px;
@@ -28,6 +43,7 @@
28
43
  .teletext-list__panel__item__text {
29
44
  display: flex;
30
45
  flex-direction: column;
46
+ flex: 1;
31
47
  gap: 3px;
32
48
 
33
49
  .teletext-list__panel__item__text__item {