@dckj-npm/dc-material 0.1.76 → 0.1.78

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.
Files changed (67) hide show
  1. package/build/lowcode/assets-daily.json +13 -13
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +13 -13
  4. package/build/lowcode/meta.design.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/render/default/view.js +1 -1
  7. package/build/lowcode/view.js +1 -1
  8. package/dist/BizComps.css +1 -1
  9. package/dist/BizComps.js +2 -2
  10. package/dist/BizComps.js.map +1 -1
  11. package/es/components/goods-card-list/goods-card-list-common.d.ts +5 -0
  12. package/es/components/goods-card-list/goods-card-list-common.js +60 -0
  13. package/es/components/goods-card-list/goods-card-list-common.scss +118 -0
  14. package/es/components/goods-card-list/index.d.ts +2 -1
  15. package/es/components/goods-card-list/index.js +2 -1
  16. package/es/components/grid-nav/index.scss +35 -31
  17. package/es/components/message-list/message-list-item.d.ts +4 -0
  18. package/es/components/message-list/message-list-item.js +4 -1
  19. package/es/components/message-list/message-list-item.scss +16 -6
  20. package/es/components/message-list/message-list.d.ts +4 -8
  21. package/es/components/message-list/message-list.js +9 -16
  22. package/es/components/notice-bar/notice-bar-item.scss +1 -1
  23. package/es/components/rich-text/index.d.ts +6 -0
  24. package/es/components/rich-text/index.js +6 -0
  25. package/es/components/rich-text/index.scss +19 -0
  26. package/es/components/rich-text/rich-text.d.ts +14 -0
  27. package/es/components/rich-text/rich-text.js +37 -0
  28. package/es/components/tab/index.scss +16 -0
  29. package/es/components/tab/tab.d.ts +4 -0
  30. package/es/components/tab/tab.js +6 -2
  31. package/es/components/tab-container-item/tab-container-item.d.ts +2 -0
  32. package/es/components/tab-container-item/tab-container-item.js +7 -2
  33. package/es/components/teletext-list/teletext-list-item.d.ts +2 -11
  34. package/es/components/teletext-list/teletext-list-item.js +11 -5
  35. package/es/components/teletext-list/teletext-list.d.ts +2 -11
  36. package/es/index.d.ts +3 -1
  37. package/es/index.js +5 -1
  38. package/lib/components/goods-card-list/goods-card-list-common.d.ts +5 -0
  39. package/lib/components/goods-card-list/goods-card-list-common.js +65 -0
  40. package/lib/components/goods-card-list/goods-card-list-common.scss +118 -0
  41. package/lib/components/goods-card-list/index.d.ts +2 -1
  42. package/lib/components/goods-card-list/index.js +3 -1
  43. package/lib/components/grid-nav/index.scss +35 -31
  44. package/lib/components/message-list/message-list-item.d.ts +4 -0
  45. package/lib/components/message-list/message-list-item.js +4 -1
  46. package/lib/components/message-list/message-list-item.scss +16 -6
  47. package/lib/components/message-list/message-list.d.ts +4 -8
  48. package/lib/components/message-list/message-list.js +9 -16
  49. package/lib/components/notice-bar/notice-bar-item.scss +1 -1
  50. package/lib/components/rich-text/index.d.ts +6 -0
  51. package/lib/components/rich-text/index.js +6 -0
  52. package/lib/components/rich-text/index.scss +19 -0
  53. package/lib/components/rich-text/rich-text.d.ts +14 -0
  54. package/lib/components/rich-text/rich-text.js +42 -0
  55. package/lib/components/tab/index.scss +16 -0
  56. package/lib/components/tab/tab.d.ts +4 -0
  57. package/lib/components/tab/tab.js +6 -2
  58. package/lib/components/tab-container-item/tab-container-item.d.ts +2 -0
  59. package/lib/components/tab-container-item/tab-container-item.js +7 -2
  60. package/lib/components/teletext-list/teletext-list-item.d.ts +2 -11
  61. package/lib/components/teletext-list/teletext-list-item.js +11 -5
  62. package/lib/components/teletext-list/teletext-list.d.ts +2 -11
  63. package/lib/index.d.ts +3 -1
  64. package/lib/index.js +6 -1
  65. package/lowcode_es/meta.js +1 -1
  66. package/lowcode_lib/meta.js +1 -1
  67. package/package.json +3 -3
@@ -0,0 +1,5 @@
1
+ import type { GoodsCardListProps } from './types';
2
+ import React from 'react';
3
+ import './goods-card-list-common.scss';
4
+ declare const GoodsCardListCommon: React.FC<GoodsCardListProps>;
5
+ export default GoodsCardListCommon;
@@ -0,0 +1,60 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["dataList", "maxSales", "onClick"];
4
+ import React from 'react';
5
+ import Carousel from "../carousel/carousel";
6
+ import "./goods-card-list-common.scss";
7
+ var GoodsCardListCommon = function GoodsCardListCommon(_ref) {
8
+ var _ref$dataList = _ref.dataList,
9
+ dataList = _ref$dataList === void 0 ? [] : _ref$dataList,
10
+ _ref$maxSales = _ref.maxSales,
11
+ maxSales = _ref$maxSales === void 0 ? 1000 : _ref$maxSales,
12
+ _ref$onClick = _ref.onClick,
13
+ _onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
14
+ otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
15
+ var _otherProps = otherProps || {};
16
+ var resolveResultDesc = function resolveResultDesc(desc) {
17
+ var htmlString = "<div>" + desc + "</div>";
18
+ // 创建一个虚拟的 DOM 容器
19
+ var tempDiv = document.createElement('div');
20
+ tempDiv.innerHTML = htmlString;
21
+ // 提取文本
22
+ return tempDiv.textContent || tempDiv.innerText;
23
+ };
24
+ return /*#__PURE__*/React.createElement("div", _extends({
25
+ className: "card-list-goods-common__container"
26
+ }, _otherProps), dataList.map(function (item) {
27
+ return /*#__PURE__*/React.createElement("div", {
28
+ key: item.key,
29
+ className: "card-list-goods__item",
30
+ onClick: function onClick() {
31
+ return _onClick(item);
32
+ }
33
+ }, item.imageList && item.imageList.length > 0 && /*#__PURE__*/React.createElement("div", {
34
+ className: "card-list-goods__image"
35
+ }, /*#__PURE__*/React.createElement(Carousel, {
36
+ images: item.imageList,
37
+ interval: 3000
38
+ })), /*#__PURE__*/React.createElement("div", {
39
+ className: "card-list-goods__content"
40
+ }, /*#__PURE__*/React.createElement("div", {
41
+ className: "card-list-goods__title"
42
+ }, item.title), /*#__PURE__*/React.createElement("div", {
43
+ className: "card-list-goods__desc"
44
+ }, resolveResultDesc(item.desc)), /*#__PURE__*/React.createElement("div", {
45
+ className: "card-list-goods__bottom"
46
+ }, /*#__PURE__*/React.createElement("div", {
47
+ className: "card-list-goods__unit"
48
+ }, "\uFFE5"), /*#__PURE__*/React.createElement("div", {
49
+ className: "card-list-goods__price"
50
+ }, item.activePrice || item.price), item.activePrice && /*#__PURE__*/React.createElement("div", {
51
+ className: "card-list-goods__unit__delete"
52
+ }, "\uFFE5"), item.activePrice && /*#__PURE__*/React.createElement("div", {
53
+ className: "card-list-goods__price__delete"
54
+ }, item.price), /*#__PURE__*/React.createElement("div", {
55
+ className: "card-list-goods__sales"
56
+ }, "\u5DF2\u552E", item.sales > maxSales ? maxSales + "+" : item.sales))));
57
+ }));
58
+ };
59
+ GoodsCardListCommon.displayName = 'GoodsCardListCommon';
60
+ export default GoodsCardListCommon;
@@ -0,0 +1,118 @@
1
+ .card-list-goods-common__container {
2
+ display: grid;
3
+ grid-template-columns:repeat(2, minmax(0, 1fr));
4
+ row-gap: 12px;
5
+ column-gap: 10px;
6
+ width: 100%;
7
+
8
+ & > .card-list-goods__item {
9
+ box-sizing: border-box;
10
+ transition: top 0.35s ease, left 0.35s ease, width 0.35s ease;
11
+ overflow: hidden;
12
+ border-radius: 8px;
13
+ box-shadow: 0 3px 9px 1px rgba(204, 204, 204, 0.35);
14
+
15
+ & > .card-list-goods__image {
16
+ height: 200px;
17
+ width: 100%;
18
+ overflow: hidden;
19
+ display: flex;
20
+
21
+ & > img {
22
+ height: 100%;
23
+ width: 100%;
24
+ object-fit: cover;
25
+ //object-position: center;
26
+ object-position: 50% 50%;
27
+ }
28
+ }
29
+
30
+ & > .card-list-goods__content {
31
+ display: flex;
32
+ flex-direction: column;
33
+ justify-content: space-between;
34
+ padding: 0.5rem;
35
+
36
+ .card-list-goods__title {
37
+ overflow: hidden;
38
+ display: -webkit-box;
39
+ -webkit-box-orient: vertical;
40
+ -webkit-line-clamp: 2;
41
+ line-clamp: 2;
42
+ margin-top: 0.25rem;
43
+ margin-bottom: 0.25rem;
44
+ font-size: 14px;
45
+ font-weight: 700;
46
+ }
47
+
48
+ .card-list-goods__desc {
49
+ overflow: hidden;
50
+ text-overflow: ellipsis;
51
+ white-space: nowrap;
52
+ line-clamp: 2;
53
+ margin-top: 0.25rem;
54
+ margin-bottom: 0.25rem;
55
+ font-size: 12px;
56
+ color: #333333;
57
+ }
58
+
59
+ .card-list-goods__bottom {
60
+ margin-top: 0.25rem;
61
+ margin-bottom: 0.25rem;
62
+ display: flex;
63
+ align-items: baseline;
64
+ flex-wrap: wrap;
65
+ row-gap: 0.5rem;
66
+
67
+ & > div {
68
+ display: flex;
69
+ }
70
+
71
+ .card-list-goods__unit {
72
+ font-size: 12px;
73
+ color: #F57D51;
74
+ font-weight: 700;
75
+ line-height: 1;
76
+
77
+ &__delete {
78
+ margin-left: 0;
79
+ font-size: 14px;
80
+ color: #666666;
81
+ line-height: 1;
82
+ text-decoration: line-through
83
+ }
84
+
85
+ }
86
+
87
+ .card-list-goods__price {
88
+ font-size: 17px;
89
+ color: #F57D51;
90
+ font-weight: 700;
91
+ line-height: 1;
92
+
93
+ &__delete {
94
+ margin-left: 0;
95
+ font-size: 14px;
96
+ color: #666666;
97
+ line-height: 1;
98
+ text-decoration: line-through
99
+ }
100
+ }
101
+
102
+ .card-list-goods__sales {
103
+ margin-left: 3px;
104
+ font-size: 12px;
105
+ color: #666666;
106
+ line-height: 1;
107
+ }
108
+
109
+ }
110
+
111
+ }
112
+
113
+ }
114
+
115
+ }
116
+
117
+
118
+
@@ -1,3 +1,4 @@
1
1
  import GoodsCardList from './goods-card-list';
2
+ import GoodsCardListCommon from './goods-card-list-common';
2
3
  export type { GoodsCardListItemProps, GoodsCardListProps } from './types';
3
- export { GoodsCardList };
4
+ export { GoodsCardList, GoodsCardListCommon };
@@ -1,2 +1,3 @@
1
1
  import GoodsCardList from "./goods-card-list";
2
- export { GoodsCardList };
2
+ import GoodsCardListCommon from "./goods-card-list-common";
3
+ export { GoodsCardList, GoodsCardListCommon };
@@ -1,37 +1,41 @@
1
1
  /* write style here */
2
2
  .grid-navigation {
3
- //padding: 10px;
4
- width: 100%;
5
- display: grid;
6
- gap: 14px 38px; /* 宫格之间的间距 */
7
- margin: 0;
8
- // grid-template-columns: repeat(60px, minmax(1fr));
9
- }
3
+ //padding: 10px;
4
+ width: 100%;
5
+ display: grid;
6
+ grid-template-columns: repeat(4, 1fr);
7
+ //gap: 14px 38px; /* 宫格之间的间距 */
8
+ grid-row-gap: 14px;
9
+ margin: 0;
10
+ //padding: 0 18px
11
+ // grid-template-columns: repeat(60px, minmax(1fr));
12
+ }
13
+
14
+ .grid-item {
15
+ display: flex;
16
+ flex-direction: column;
17
+ align-items: center;
18
+ text-align: center;
19
+ text-decoration: none;
20
+ color: #333;
21
+ position: relative;
10
22
 
11
- .grid-item {
12
- display: flex;
13
- flex-direction: column;
14
- align-items: center;
15
- text-align: center;
16
- text-decoration: none;
17
- color: #333;
18
- position: relative;
19
- img {
20
- width: 48px;
21
- height: 51px;
22
- margin-bottom: 3px;
23
- }
23
+ img {
24
+ width: 48px;
25
+ height: 51px;
26
+ margin-bottom: 3px;
27
+ }
24
28
 
25
- span {
26
- font-size: 13px;
27
- color: #222222;
28
- // overflow: hidden;
29
- // text-overflow: ellipsis;
30
- // white-space: nowrap;
31
- // max-width: 60px;
32
- }
29
+ span {
30
+ font-size: 13px;
31
+ color: #222222;
32
+ // overflow: hidden;
33
+ // text-overflow: ellipsis;
34
+ // white-space: nowrap;
35
+ // max-width: 60px;
36
+ }
33
37
 
34
- &:hover {
35
- color: #007bff;
36
- }
38
+ &:hover {
39
+ color: #007bff;
37
40
  }
41
+ }
@@ -24,6 +24,10 @@ export interface DataProps {
24
24
  * 点击事件
25
25
  */
26
26
  onClick?: (e: any) => void;
27
+ /**
28
+ * 是否已读
29
+ */
30
+ isRead?: boolean;
27
31
  }
28
32
  declare const MessageListItem: React.FC<DataProps>;
29
33
  export default MessageListItem;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["onClick", "title", "image", "gmtCreate", "children", "description"];
3
+ var _excluded = ["onClick", "title", "image", "gmtCreate", "children", "description", "isRead"];
4
4
  import React from 'react';
5
5
  import "./message-list-item.scss";
6
6
  import { convertChildren } from "../../utils/children-node-handle";
@@ -17,6 +17,7 @@ var MessageListItem = function MessageListItem(_ref) {
17
17
  gmtCreate = _ref.gmtCreate,
18
18
  children = _ref.children,
19
19
  description = _ref.description,
20
+ isRead = _ref.isRead,
20
21
  otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
21
22
  var _otherProps = otherProps || {};
22
23
  return /*#__PURE__*/React.createElement("div", _extends({
@@ -24,6 +25,8 @@ var MessageListItem = function MessageListItem(_ref) {
24
25
  onClick: onClick
25
26
  }, _otherProps), convertChildren(children, 'image', {
26
27
  src: image
28
+ }), isRead ? null : /*#__PURE__*/React.createElement("span", {
29
+ className: "badge"
27
30
  }), /*#__PURE__*/React.createElement("div", {
28
31
  className: "message-list__panel__item__text"
29
32
  }, convertChildren(children, 'title', {
@@ -5,33 +5,42 @@
5
5
  gap: 5px;
6
6
  padding-bottom: 15px;
7
7
  justify-content: flex-start;
8
-
9
- border-bottom: 0.5px solid #eeeeee;
10
-
8
+ border-bottom: 1px solid #eeeeee;
9
+ position: relative;
11
10
  &_image {
12
11
  width: 90px;
13
12
  height: 71px;
14
13
  border-radius: 5px;
15
14
  flex: 0 0 auto;
16
15
  overflow: hidden;
16
+ position: relative;
17
17
 
18
18
  & > img {
19
19
  width: 100%;
20
20
  height: 100%;
21
21
  object-fit: cover;
22
22
  }
23
-
23
+ }
24
+ .badge {
25
+ display: inline-block;
26
+ width: 7px; // 根据需要设置的大小
27
+ height: 7px;
28
+ border-radius: 50%;
29
+ background-color: #F44341; // 红色背景
30
+ position: absolute; // 绝对定位
31
+ top: 5px; // 根据需要调整位置
32
+ left: 38px; // 根据需要调整位置
24
33
  }
25
34
 
26
35
  &__text {
27
36
  display: flex;
28
37
  flex-direction: column;
29
38
  gap: 3px;
30
- padding-top: 5px;
39
+ padding-top: 4px;
31
40
 
32
41
  &__title {
33
42
  font-size: 15px;
34
- font-weight: 500;
43
+ font-weight: 600;
35
44
  color: #000000;
36
45
  }
37
46
 
@@ -46,5 +55,6 @@
46
55
  }
47
56
 
48
57
  }
58
+
49
59
 
50
60
  }
@@ -6,14 +6,6 @@ export interface MessageListProps {
6
6
  * 全部的数据
7
7
  */
8
8
  dataList?: DataProps[];
9
- /**
10
- * 已读的数据
11
- */
12
- readDataList?: DataProps[];
13
- /**
14
- * 未读的数据
15
- */
16
- unReadDataList?: DataProps[];
17
9
  /**
18
10
  * 点击事件
19
11
  * @param e
@@ -27,6 +19,10 @@ export interface MessageListProps {
27
19
  * 图片
28
20
  */
29
21
  images: string[];
22
+ /**
23
+ * 切换数据源
24
+ */
25
+ handleDataList: (key: string) => DataProps[];
30
26
  }
31
27
  declare const MessageList: React.FC<MessageListProps>;
32
28
  export default MessageList;
@@ -1,43 +1,36 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["dataList", "readDataList", "unReadDataList", "onClick", "children", "images"];
3
+ var _excluded = ["dataList", "handleDataList", "onClick", "children", "images"];
4
4
  import React, { useEffect } from 'react';
5
5
  import "./index.scss";
6
6
  import { default as MessageListItem } from "./message-list-item";
7
7
  import { convertChildren } from "../../utils/children-node-handle";
8
8
  var MessageList = function MessageList(_ref) {
9
9
  var dataList = _ref.dataList,
10
- readDataList = _ref.readDataList,
11
- unReadDataList = _ref.unReadDataList,
10
+ handleDataList = _ref.handleDataList,
12
11
  _ref$onClick = _ref.onClick,
13
12
  onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
14
13
  children = _ref.children,
15
14
  images = _ref.images,
16
15
  otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
17
16
  var _otherProps = otherProps || {};
18
- var _React$useState = React.useState(dataList),
17
+ var _React$useState = React.useState(dataList || []),
19
18
  currentDataList = _React$useState[0],
20
19
  setCurrentDataList = _React$useState[1];
21
20
  var _React$useState2 = React.useState('all'),
22
21
  currentKey = _React$useState2[0],
23
22
  setCurrentKey = _React$useState2[1];
23
+
24
24
  // 切换数据源
25
25
  var handleClick = function handleClick(key) {
26
- if (key === 'read') {
27
- setCurrentDataList(readDataList);
28
- setCurrentKey('read');
29
- } else if (key === 'unRead') {
30
- setCurrentDataList(unReadDataList);
31
- setCurrentKey('unRead');
32
- } else {
33
- setCurrentDataList(dataList);
34
- setCurrentKey('all');
35
- }
26
+ var newDataList = handleDataList(key);
27
+ setCurrentDataList(newDataList);
28
+ setCurrentKey(key);
36
29
  };
37
30
  images = images || [];
38
31
  useEffect(function () {
39
- handleClick(currentKey);
40
- });
32
+ setCurrentDataList(dataList || []);
33
+ }, [dataList]);
41
34
  return /*#__PURE__*/React.createElement("div", _extends({
42
35
  className: "message-list__panel"
43
36
  }, _otherProps), /*#__PURE__*/React.createElement("div", {
@@ -1,5 +1,5 @@
1
1
  .notice-bar__panel__item {
2
- width: calc(100vw - 104px);
2
+ width: calc(100vw - 110px);
3
3
  display: flex;
4
4
  align-items: center;
5
5
  justify-content: space-between;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 富文本
3
+ */
4
+ import RichText from './rich-text';
5
+ export type { RichTextProps } from './rich-text';
6
+ export { RichText, };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 富文本
3
+ */
4
+
5
+ import RichText from "./rich-text";
6
+ export { RichText };
@@ -0,0 +1,19 @@
1
+ .rich-text {
2
+ width: 100%;
3
+ display: flex;
4
+ flex-direction: column;
5
+ padding: 0; /* 添加内边距 */
6
+ margin: 0; /* 去除外边距 */
7
+ word-break: break-word; /* 处理长单词换行 */
8
+ overflow-wrap: break-word; /* 支持长单词换行 */
9
+ overflow: hidden; /* 隐藏超出部分 */
10
+ }
11
+ p {
12
+ padding: 0;
13
+ margin: 0 0 20px 0 !important;
14
+ }
15
+ img {
16
+ max-width: 100%;
17
+ height: auto; /* 保持纵横比 */
18
+ object-fit: contain; /* 确保图片保持在容器内 */
19
+ }
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import './index.scss';
3
+ interface DataProps {
4
+ content?: string;
5
+ }
6
+ export interface RichTextProps {
7
+ content?: string;
8
+ dataList?: DataProps[];
9
+ }
10
+ declare const RichText: {
11
+ (props: RichTextProps): JSX.Element;
12
+ displayName: string;
13
+ };
14
+ export default RichText;
@@ -0,0 +1,37 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["content", "dataList"];
4
+ import React from 'react';
5
+ import "./index.scss";
6
+ // 富文本
7
+
8
+ // 用于处理富文本内容的函数
9
+ var processContent = function processContent(content) {
10
+ // 检查内容是否为字符串
11
+ if (typeof content !== 'string') {
12
+ return '';
13
+ }
14
+ // 替换转义符号(这里可以根据需要添加更多处理逻辑)
15
+ return content.replace(/\\/g, '');
16
+ };
17
+ var RichText = function RichText(props) {
18
+ var content = props.content,
19
+ dataList = props.dataList,
20
+ otherProps = _objectWithoutPropertiesLoose(props, _excluded);
21
+ return /*#__PURE__*/React.createElement("div", _extends({
22
+ className: "rich-text"
23
+ }, otherProps), dataList && dataList.length > 0 ? dataList.map(function (item, index) {
24
+ return /*#__PURE__*/React.createElement("div", {
25
+ key: index,
26
+ dangerouslySetInnerHTML: {
27
+ __html: processContent(item.content)
28
+ }
29
+ });
30
+ }) : /*#__PURE__*/React.createElement("div", {
31
+ dangerouslySetInnerHTML: {
32
+ __html: processContent(content)
33
+ }
34
+ }));
35
+ };
36
+ RichText.displayName = 'RichText';
37
+ export default RichText;
@@ -8,6 +8,7 @@
8
8
  cursor: pointer;
9
9
  margin-right: 6px;
10
10
  letter-spacing: 2px;
11
+ position: relative;
11
12
  &--selected {
12
13
  background-color: #ED794A;
13
14
  color: #FFFFFF;
@@ -20,4 +21,19 @@
20
21
  padding: 14px 30px;
21
22
  border-radius: 28px;
22
23
  }
24
+ .badge {
25
+ display: flex;
26
+ padding: 2px 4px;
27
+ border-radius: 8px;
28
+ background-color: #F44341; // 红色背景
29
+ color: white; // 字体颜色
30
+ // text-align: center;
31
+ letter-spacing: 0;
32
+ justify-content: center;
33
+ line-height: normal; // 垂直居中
34
+ font-size: 10px; // 根据需要调整字体大小
35
+ position: absolute; // 绝对定位
36
+ top: 0; // 根据需要调整位置
37
+ right: 3px; // 根据需要调整位置
38
+ }
23
39
  }
@@ -18,6 +18,10 @@ export interface TabProps {
18
18
  * @param e
19
19
  */
20
20
  onClickHandle?: (e: string) => void;
21
+ /**
22
+ * 未读消息数量
23
+ */
24
+ unreadCount?: number;
21
25
  }
22
26
  declare const Tab: React.FC<TabProps>;
23
27
  export default Tab;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["selectedBGColor", "selectedFontColor", "size", "onClickHandle"];
3
+ var _excluded = ["selectedBGColor", "selectedFontColor", "size", "onClickHandle", "unreadCount"];
4
4
  import * as React from 'react';
5
5
  import "./index.scss";
6
6
  var Tab = function Tab(_ref) {
@@ -8,6 +8,7 @@ var Tab = function Tab(_ref) {
8
8
  selectedFontColor = _ref.selectedFontColor,
9
9
  size = _ref.size,
10
10
  onClickHandle = _ref.onClickHandle,
11
+ unreadCount = _ref.unreadCount,
11
12
  otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
12
13
  var tabList = [{
13
14
  key: 'all',
@@ -40,7 +41,10 @@ var Tab = function Tab(_ref) {
40
41
  backgroundColor: tab === item.key ? selectedBGColor : '',
41
42
  color: tab === item.key ? selectedFontColor : ''
42
43
  }
43
- }), item.label);
44
+ }), item.label, item.key === 'unRead' && unreadCount > 0 && /*#__PURE__*/React.createElement("span", {
45
+ className: "badge"
46
+ }, unreadCount) // 条件渲染badge
47
+ );
44
48
  });
45
49
  };
46
50
  export default Tab;
@@ -2,6 +2,8 @@ import React from 'react';
2
2
  import { Tab } from '@alifd/next';
3
3
  export interface TabContainerItemProps extends React.ComponentProps<typeof Tab> {
4
4
  className?: string;
5
+ tab: string;
6
+ key: string;
5
7
  }
6
8
  export declare const TabContainerItem: {
7
9
  (props: TabContainerItemProps): JSX.Element;
@@ -1,14 +1,19 @@
1
1
  import _Tab from "@alifd/next/es/tab";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
4
- var _excluded = ["className"];
4
+ var _excluded = ["className", "tab", "key"];
5
5
  import React from 'react';
6
6
  import cx from 'classnames';
7
7
  export var TabContainerItem = function TabContainerItem(props) {
8
8
  var className = props.className,
9
+ tab = props.tab,
10
+ key = props.key,
9
11
  restProps = _objectWithoutPropertiesLoose(props, _excluded);
10
12
  return /*#__PURE__*/React.createElement(_Tab.Item, _extends({
11
13
  className: cx(className, 'fusion-ui-tab')
12
- }, restProps));
14
+ }, restProps, {
15
+ title: tab,
16
+ primaryKey: key
17
+ }));
13
18
  };
14
19
  TabContainerItem.displayName = 'TabContainerItem';
@@ -19,7 +19,7 @@ export interface TeletextListItemProps {
19
19
  /**
20
20
  * 图片位置
21
21
  */
22
- imagePlacement?: "left" | "right" | "none";
22
+ imagePlacement?: 'left' | 'right' | 'none';
23
23
  /**
24
24
  * 说明
25
25
  */
@@ -27,16 +27,7 @@ export interface TeletextListItemProps {
27
27
  /**
28
28
  * 标签列表
29
29
  */
30
- tags?: {
31
- /**
32
- * 标签名称
33
- */
34
- name: string;
35
- /**
36
- * 标签颜色
37
- */
38
- color: string;
39
- }[] | string;
30
+ tags?: string;
40
31
  }
41
32
  declare const TeletextListItem: React.FC<TeletextListItemProps>;
42
33
  export default TeletextListItem;