@dckj-npm/dc-material 0.1.87 → 0.1.88

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 (149) 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/index.js +1 -1
  5. package/build/lowcode/meta.design.js +1 -1
  6. package/build/lowcode/meta.js +1 -1
  7. package/build/lowcode/preview.js +5 -5
  8. package/build/lowcode/render/default/view.css +1 -1
  9. package/build/lowcode/render/default/view.js +2 -2
  10. package/build/lowcode/view.css +1 -1
  11. package/build/lowcode/view.js +1 -1
  12. package/dist/BizComps.css +1 -1
  13. package/dist/BizComps.js +2 -2
  14. package/dist/BizComps.js.map +1 -1
  15. package/es/components/notice-bar/components/ScrollSwitcher.js +45 -0
  16. package/es/components/notice-bar/components/ScrollSwitcher.scss +17 -0
  17. package/es/components/notice-bar/index.scss +17 -4
  18. package/es/components/notice-bar/notice-bar-item.js +2 -0
  19. package/es/components/notice-bar/notice-bar.js +51 -17
  20. package/es/utils/time-util.js +18 -0
  21. package/lib/components/notice-bar/components/ScrollSwitcher.js +52 -0
  22. package/lib/components/notice-bar/components/ScrollSwitcher.scss +17 -0
  23. package/lib/components/notice-bar/index.scss +17 -4
  24. package/lib/components/notice-bar/notice-bar-item.js +2 -0
  25. package/lib/components/notice-bar/notice-bar.js +53 -17
  26. package/lib/utils/time-util.js +22 -0
  27. package/lowcode_es/meta.js +1 -1
  28. package/lowcode_lib/meta.js +1 -1
  29. package/package.json +2 -2
  30. package/es/components/bottom-navigation/bottom-navigation.d.ts +0 -15
  31. package/es/components/bottom-navigation/index.d.ts +0 -3
  32. package/es/components/button/button.d.ts +0 -14
  33. package/es/components/button/index.d.ts +0 -6
  34. package/es/components/carousel/carousel.d.ts +0 -14
  35. package/es/components/colorful-button/colorful-button.d.ts +0 -12
  36. package/es/components/colorful-button/index.d.ts +0 -3
  37. package/es/components/colorful-input/colorful-input.d.ts +0 -8
  38. package/es/components/colorful-input/index.d.ts +0 -3
  39. package/es/components/goods-card-list/goods-card-list-common.d.ts +0 -5
  40. package/es/components/goods-card-list/goods-card-list.d.ts +0 -5
  41. package/es/components/goods-card-list/index.d.ts +0 -4
  42. package/es/components/goods-card-list/types.d.ts +0 -45
  43. package/es/components/grid-nav/grid-nav.d.ts +0 -13
  44. package/es/components/grid-nav/index.d.ts +0 -3
  45. package/es/components/integral-task/index.d.ts +0 -6
  46. package/es/components/integral-task/integral-task.d.ts +0 -40
  47. package/es/components/menu-list/index.d.ts +0 -6
  48. package/es/components/menu-list/menu-list-item.d.ts +0 -5
  49. package/es/components/menu-list/menu-list.d.ts +0 -5
  50. package/es/components/menu-list/types.d.ts +0 -23
  51. package/es/components/message-list/index.d.ts +0 -6
  52. package/es/components/message-list/message-list-item.d.ts +0 -33
  53. package/es/components/message-list/message-list.d.ts +0 -28
  54. package/es/components/notice-bar/index.d.ts +0 -3
  55. package/es/components/notice-bar/notice-bar-item.d.ts +0 -18
  56. package/es/components/notice-bar/notice-bar.d.ts +0 -37
  57. package/es/components/position/entity.d.ts +0 -5
  58. package/es/components/position/index.d.ts +0 -3
  59. package/es/components/position/position-left.d.ts +0 -9
  60. package/es/components/position/position-list.d.ts +0 -12
  61. package/es/components/position/position.d.ts +0 -8
  62. package/es/components/radio-group/index.d.ts +0 -8
  63. package/es/components/radio-group/radio-group-item.d.ts +0 -48
  64. package/es/components/radio-group/radio-group.d.ts +0 -52
  65. package/es/components/rich-text/index.d.ts +0 -6
  66. package/es/components/rich-text/rich-text.d.ts +0 -14
  67. package/es/components/search-bar/index.d.ts +0 -3
  68. package/es/components/search-bar/search-bar.d.ts +0 -7
  69. package/es/components/swiper/index.d.ts +0 -3
  70. package/es/components/swiper/swiper.d.ts +0 -47
  71. package/es/components/tab/index.d.ts +0 -6
  72. package/es/components/tab/tab.d.ts +0 -27
  73. package/es/components/tab-container/index.d.ts +0 -3
  74. package/es/components/tab-container/tab-container.d.ts +0 -10
  75. package/es/components/tab-container-item/index.d.ts +0 -3
  76. package/es/components/tab-container-item/tab-container-item.d.ts +0 -11
  77. package/es/components/tag/index.d.ts +0 -6
  78. package/es/components/tag/tag.d.ts +0 -14
  79. package/es/components/teletext-list/index.d.ts +0 -6
  80. package/es/components/teletext-list/teletext-list-item.d.ts +0 -33
  81. package/es/components/teletext-list/teletext-list.d.ts +0 -52
  82. package/es/components/title/index.d.ts +0 -8
  83. package/es/components/title/title-1.d.ts +0 -10
  84. package/es/components/title/title-2.d.ts +0 -18
  85. package/es/index.d.ts +0 -42
  86. package/es/utils/children-node-handle.d.ts +0 -9
  87. package/es/utils/component-wrapper.d.ts +0 -9
  88. package/es/utils/debounce.d.ts +0 -1
  89. package/es/variables.d.ts +0 -2
  90. package/lib/components/bottom-navigation/bottom-navigation.d.ts +0 -15
  91. package/lib/components/bottom-navigation/index.d.ts +0 -3
  92. package/lib/components/button/button.d.ts +0 -14
  93. package/lib/components/button/index.d.ts +0 -6
  94. package/lib/components/carousel/carousel.d.ts +0 -14
  95. package/lib/components/colorful-button/colorful-button.d.ts +0 -12
  96. package/lib/components/colorful-button/index.d.ts +0 -3
  97. package/lib/components/colorful-input/colorful-input.d.ts +0 -8
  98. package/lib/components/colorful-input/index.d.ts +0 -3
  99. package/lib/components/goods-card-list/goods-card-list-common.d.ts +0 -5
  100. package/lib/components/goods-card-list/goods-card-list.d.ts +0 -5
  101. package/lib/components/goods-card-list/index.d.ts +0 -4
  102. package/lib/components/goods-card-list/types.d.ts +0 -45
  103. package/lib/components/grid-nav/grid-nav.d.ts +0 -13
  104. package/lib/components/grid-nav/index.d.ts +0 -3
  105. package/lib/components/integral-task/index.d.ts +0 -6
  106. package/lib/components/integral-task/integral-task.d.ts +0 -40
  107. package/lib/components/menu-list/index.d.ts +0 -6
  108. package/lib/components/menu-list/menu-list-item.d.ts +0 -5
  109. package/lib/components/menu-list/menu-list.d.ts +0 -5
  110. package/lib/components/menu-list/types.d.ts +0 -23
  111. package/lib/components/message-list/index.d.ts +0 -6
  112. package/lib/components/message-list/message-list-item.d.ts +0 -33
  113. package/lib/components/message-list/message-list.d.ts +0 -28
  114. package/lib/components/notice-bar/index.d.ts +0 -3
  115. package/lib/components/notice-bar/notice-bar-item.d.ts +0 -18
  116. package/lib/components/notice-bar/notice-bar.d.ts +0 -37
  117. package/lib/components/position/entity.d.ts +0 -5
  118. package/lib/components/position/index.d.ts +0 -3
  119. package/lib/components/position/position-left.d.ts +0 -9
  120. package/lib/components/position/position-list.d.ts +0 -12
  121. package/lib/components/position/position.d.ts +0 -8
  122. package/lib/components/radio-group/index.d.ts +0 -8
  123. package/lib/components/radio-group/radio-group-item.d.ts +0 -48
  124. package/lib/components/radio-group/radio-group.d.ts +0 -52
  125. package/lib/components/rich-text/index.d.ts +0 -6
  126. package/lib/components/rich-text/rich-text.d.ts +0 -14
  127. package/lib/components/search-bar/index.d.ts +0 -3
  128. package/lib/components/search-bar/search-bar.d.ts +0 -7
  129. package/lib/components/swiper/index.d.ts +0 -3
  130. package/lib/components/swiper/swiper.d.ts +0 -47
  131. package/lib/components/tab/index.d.ts +0 -6
  132. package/lib/components/tab/tab.d.ts +0 -27
  133. package/lib/components/tab-container/index.d.ts +0 -3
  134. package/lib/components/tab-container/tab-container.d.ts +0 -10
  135. package/lib/components/tab-container-item/index.d.ts +0 -3
  136. package/lib/components/tab-container-item/tab-container-item.d.ts +0 -11
  137. package/lib/components/tag/index.d.ts +0 -6
  138. package/lib/components/tag/tag.d.ts +0 -14
  139. package/lib/components/teletext-list/index.d.ts +0 -6
  140. package/lib/components/teletext-list/teletext-list-item.d.ts +0 -33
  141. package/lib/components/teletext-list/teletext-list.d.ts +0 -52
  142. package/lib/components/title/index.d.ts +0 -8
  143. package/lib/components/title/title-1.d.ts +0 -10
  144. package/lib/components/title/title-2.d.ts +0 -18
  145. package/lib/index.d.ts +0 -42
  146. package/lib/utils/children-node-handle.d.ts +0 -9
  147. package/lib/utils/component-wrapper.d.ts +0 -9
  148. package/lib/utils/debounce.d.ts +0 -1
  149. package/lib/variables.d.ts +0 -2
@@ -0,0 +1,45 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import "./ScrollSwitcher.scss"; // 导入样式
3
+
4
+ var ScrollSwitcher = function ScrollSwitcher(_ref) {
5
+ var children = _ref.children,
6
+ _ref$height = _ref.height,
7
+ height = _ref$height === void 0 ? '20px' : _ref$height,
8
+ _ref$interval = _ref.interval,
9
+ interval = _ref$interval === void 0 ? 3000 : _ref$interval;
10
+ var _useState = useState(0),
11
+ currentIndex = _useState[0],
12
+ setCurrentIndex = _useState[1];
13
+ var childrenCount = React.Children.count(children);
14
+ useEffect(function () {
15
+ var timer = setInterval(function () {
16
+ setCurrentIndex(function (prevIndex) {
17
+ return (prevIndex + 1) % React.Children.count(children);
18
+ });
19
+ }, interval);
20
+ return function () {
21
+ return clearInterval(timer);
22
+ }; // 清理定时器
23
+ }, [children, interval]);
24
+ return /*#__PURE__*/React.createElement("div", {
25
+ className: "scroll-switcher",
26
+ style: {
27
+ height: height
28
+ }
29
+ }, /*#__PURE__*/React.createElement("div", {
30
+ className: "scroll-switcher-content",
31
+ style: {
32
+ transform: "translateY(-" + currentIndex * 100 + "%)",
33
+ transition: 'transform 0.5s ease'
34
+ }
35
+ }, React.Children.map(children, function (child, index) {
36
+ return /*#__PURE__*/React.createElement("div", {
37
+ className: "scroll-item",
38
+ key: index
39
+ }, child);
40
+ }), /*#__PURE__*/React.createElement("div", {
41
+ className: "scroll-item",
42
+ key: childrenCount
43
+ }, children)));
44
+ };
45
+ export default ScrollSwitcher;
@@ -0,0 +1,17 @@
1
+ .scroll-switcher {
2
+ overflow: hidden; /* 隐藏溢出内容 */
3
+ position: relative; /* 使子元素绝对定位 */
4
+ }
5
+
6
+ .scroll-switcher-content {
7
+ display: flex; /* 使用 flexbox 使子元素竖直排列 */
8
+ flex-direction: column; /* 子元素垂直排列 */
9
+ }
10
+
11
+ .scroll-item {
12
+ height: 100%; /* 使每个子项占满容器的高度 */
13
+ display: flex;
14
+ align-items: center; /* 垂直居中对齐 */
15
+ justify-content: center; /* 水平居中对齐 */
16
+ }
17
+
@@ -21,9 +21,22 @@
21
21
  justify-content: start;
22
22
  border-left: 1px solid #f1f1f1;
23
23
  padding-left: 10px;
24
- // .notice-bar__panel__item-loop {
25
- // width: 100% !important;
26
- // padding-left: 10px;
27
- // }
24
+ .notice-bar__panel-loop {
25
+ width: 100%;
26
+ overflow: hidden;
27
+ list-style: none;
28
+ text-align: center;
29
+ height: 20px;
30
+ color: #111111;
31
+ padding: 0;
32
+ .notice-bar__panel-loop__item {
33
+ text-align: left;
34
+ height: 20px;
35
+ }
36
+ .toUp {
37
+ margin-top: -25px; //向上移
38
+ transition: all 0.5s;
39
+ }
40
+ }
28
41
  }
29
42
  }
@@ -4,6 +4,7 @@ var _excluded = ["content", "releaseTime", "isTop", "children"];
4
4
  import React from 'react';
5
5
  import "./notice-bar-item.scss";
6
6
  import { convertChildren } from "../../utils/children-node-handle";
7
+ import { formatTime } from "../../utils/time-util";
7
8
  var NoticeBarItem = function NoticeBarItem(_ref) {
8
9
  var content = _ref.content,
9
10
  releaseTime = _ref.releaseTime,
@@ -11,6 +12,7 @@ var NoticeBarItem = function NoticeBarItem(_ref) {
11
12
  children = _ref.children,
12
13
  otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
13
14
  var _otherProps = otherProps || {};
15
+ releaseTime = formatTime(releaseTime);
14
16
  return /*#__PURE__*/React.createElement("div", _extends({
15
17
  className: "notice-bar__panel__item"
16
18
  }, _otherProps), /*#__PURE__*/React.createElement("div", {
@@ -1,9 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
3
  var _excluded = ["dataList", "onClick", "icon", "children"];
4
- import React from 'react';
4
+ import React, { useRef, useState, useEffect } from 'react';
5
5
  import "./index.scss";
6
- import { TextLoop } from "react-text-loop-next";
7
6
  import NoticeBarItem from "./notice-bar-item";
8
7
  var NoticeBar = function NoticeBar(_ref) {
9
8
  var dataList = _ref.dataList,
@@ -13,11 +12,44 @@ var NoticeBar = function NoticeBar(_ref) {
13
12
  children = _ref.children,
14
13
  otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
15
14
  var _otherProps = otherProps || {};
16
- var stickyItems = (dataList || []).filter(function (item) {
17
- return (item === null || item === void 0 ? void 0 : item.isTop) === 0;
18
- });
19
- var loopItems = (dataList || []).filter(function (item) {
20
- return (item === null || item === void 0 ? void 0 : item.isTop) === 1;
15
+ // const stickyItems = (dataList || []).filter((item) => item?.isTop === 1)
16
+ // const loopItems = (dataList || []).filter((item) => item?.isTop === 0)
17
+
18
+ var _useState = useState(true),
19
+ play = _useState[0],
20
+ setPlay = _useState[1];
21
+ var _useState2 = useState([]),
22
+ loopItems = _useState2[0],
23
+ setLoopItems = _useState2[1];
24
+ var intervalId = useRef(null);
25
+ useEffect(function () {
26
+ var stickyItems = dataList.filter(function (item) {
27
+ return item.isTop === 1;
28
+ });
29
+ setLoopItems(dataList.filter(function (item) {
30
+ return item.isTop === 1;
31
+ }));
32
+ var startPlay = function startPlay() {
33
+ if (play) {
34
+ setLoopItems(function (prev) {
35
+ var newItems = [].concat(prev);
36
+ newItems.push(newItems[0]);
37
+ newItems.shift();
38
+ return newItems;
39
+ });
40
+ setPlay(false);
41
+ }
42
+ };
43
+ intervalId.current = setInterval(startPlay, 2000);
44
+ return function () {
45
+ clearInterval(intervalId.current);
46
+ };
47
+ }, [dataList, play]);
48
+ var isScroll = function isScroll(index) {
49
+ return index === 0;
50
+ };
51
+ var stickyItems = dataList.filter(function (item) {
52
+ return item.isTop === 1;
21
53
  });
22
54
  return /*#__PURE__*/React.createElement("div", _extends({
23
55
  className: "notice-bar__panel"
@@ -33,17 +65,19 @@ var NoticeBar = function NoticeBar(_ref) {
33
65
  onClick: onClick,
34
66
  children: children
35
67
  }, item));
36
- }) : /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement(TextLoop, {
37
- mask: true,
38
- className: "notice-bar__panel__item-loop",
39
- interval: 2000
40
- }, loopItems ? loopItems.map(function (item, index) {
41
- return /*#__PURE__*/React.createElement(NoticeBarItem, _extends({
68
+ }) : /*#__PURE__*/React.createElement("div", null), loopItems.length > 0 ? /*#__PURE__*/React.createElement("div", {
69
+ className: "notice-bar__panel-loop"
70
+ }, loopItems.map(function (item, index) {
71
+ return /*#__PURE__*/React.createElement(NoticeBarItem, {
42
72
  key: index,
43
- onClick: onClick,
44
- children: children
45
- }, item));
46
- }) : /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E"))));
73
+ className: "notice-bar__panel-loop__item " + (isScroll(index) && play ? 'toUp' : ''),
74
+ content: item.content,
75
+ releaseTime: item.releaseTime,
76
+ isTop: item.isTop,
77
+ tag: item.tag,
78
+ onClick: onClick
79
+ });
80
+ })) : /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E")));
47
81
  };
48
82
  NoticeBar.displayName = 'NoticeBar';
49
83
  export default NoticeBar;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * 时间计算
3
+ * @param timeString
4
+ */
5
+ export function formatTime(timeString) {
6
+ var time = new Date(timeString);
7
+ var now = new Date();
8
+ var diff = now - time;
9
+ var minutes = Math.floor(diff / (1000 * 60));
10
+ var hours = Math.floor(diff / (1000 * 60 * 60));
11
+ if (minutes < 60) {
12
+ return minutes + "\u5206\u949F\u524D";
13
+ } else if (hours < 24) {
14
+ return hours + "\u5C0F\u65F6\u524D";
15
+ } else {
16
+ return time.getFullYear() + "-" + (time.getMonth() + 1).toString().padStart(2, '0') + "-" + time.getDate().toString().padStart(2, '0');
17
+ }
18
+ }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports["default"] = void 0;
5
+ var _react = _interopRequireWildcard(require("react"));
6
+ require("./ScrollSwitcher.scss");
7
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
8
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
9
+ // 导入样式
10
+
11
+ var ScrollSwitcher = function ScrollSwitcher(_ref) {
12
+ var children = _ref.children,
13
+ _ref$height = _ref.height,
14
+ height = _ref$height === void 0 ? '20px' : _ref$height,
15
+ _ref$interval = _ref.interval,
16
+ interval = _ref$interval === void 0 ? 3000 : _ref$interval;
17
+ var _useState = (0, _react.useState)(0),
18
+ currentIndex = _useState[0],
19
+ setCurrentIndex = _useState[1];
20
+ var childrenCount = _react["default"].Children.count(children);
21
+ (0, _react.useEffect)(function () {
22
+ var timer = setInterval(function () {
23
+ setCurrentIndex(function (prevIndex) {
24
+ return (prevIndex + 1) % _react["default"].Children.count(children);
25
+ });
26
+ }, interval);
27
+ return function () {
28
+ return clearInterval(timer);
29
+ }; // 清理定时器
30
+ }, [children, interval]);
31
+ return /*#__PURE__*/_react["default"].createElement("div", {
32
+ className: "scroll-switcher",
33
+ style: {
34
+ height: height
35
+ }
36
+ }, /*#__PURE__*/_react["default"].createElement("div", {
37
+ className: "scroll-switcher-content",
38
+ style: {
39
+ transform: "translateY(-" + currentIndex * 100 + "%)",
40
+ transition: 'transform 0.5s ease'
41
+ }
42
+ }, _react["default"].Children.map(children, function (child, index) {
43
+ return /*#__PURE__*/_react["default"].createElement("div", {
44
+ className: "scroll-item",
45
+ key: index
46
+ }, child);
47
+ }), /*#__PURE__*/_react["default"].createElement("div", {
48
+ className: "scroll-item",
49
+ key: childrenCount
50
+ }, children)));
51
+ };
52
+ var _default = exports["default"] = ScrollSwitcher;
@@ -0,0 +1,17 @@
1
+ .scroll-switcher {
2
+ overflow: hidden; /* 隐藏溢出内容 */
3
+ position: relative; /* 使子元素绝对定位 */
4
+ }
5
+
6
+ .scroll-switcher-content {
7
+ display: flex; /* 使用 flexbox 使子元素竖直排列 */
8
+ flex-direction: column; /* 子元素垂直排列 */
9
+ }
10
+
11
+ .scroll-item {
12
+ height: 100%; /* 使每个子项占满容器的高度 */
13
+ display: flex;
14
+ align-items: center; /* 垂直居中对齐 */
15
+ justify-content: center; /* 水平居中对齐 */
16
+ }
17
+
@@ -21,9 +21,22 @@
21
21
  justify-content: start;
22
22
  border-left: 1px solid #f1f1f1;
23
23
  padding-left: 10px;
24
- // .notice-bar__panel__item-loop {
25
- // width: 100% !important;
26
- // padding-left: 10px;
27
- // }
24
+ .notice-bar__panel-loop {
25
+ width: 100%;
26
+ overflow: hidden;
27
+ list-style: none;
28
+ text-align: center;
29
+ height: 20px;
30
+ color: #111111;
31
+ padding: 0;
32
+ .notice-bar__panel-loop__item {
33
+ text-align: left;
34
+ height: 20px;
35
+ }
36
+ .toUp {
37
+ margin-top: -25px; //向上移
38
+ transition: all 0.5s;
39
+ }
40
+ }
28
41
  }
29
42
  }
@@ -8,6 +8,7 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  require("./notice-bar-item.scss");
10
10
  var _childrenNodeHandle = require("../../utils/children-node-handle");
11
+ var _timeUtil = require("../../utils/time-util");
11
12
  var _excluded = ["content", "releaseTime", "isTop", "children"];
12
13
  var NoticeBarItem = function NoticeBarItem(_ref) {
13
14
  var content = _ref.content,
@@ -16,6 +17,7 @@ var NoticeBarItem = function NoticeBarItem(_ref) {
16
17
  children = _ref.children,
17
18
  otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
18
19
  var _otherProps = otherProps || {};
20
+ releaseTime = (0, _timeUtil.formatTime)(releaseTime);
19
21
  return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
20
22
  className: "notice-bar__panel__item"
21
23
  }, _otherProps), /*#__PURE__*/_react["default"].createElement("div", {
@@ -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 = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
  require("./index.scss");
10
- var _reactTextLoopNext = require("react-text-loop-next");
11
10
  var _noticeBarItem = _interopRequireDefault(require("./notice-bar-item"));
12
11
  var _excluded = ["dataList", "onClick", "icon", "children"];
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
13
14
  var NoticeBar = function NoticeBar(_ref) {
14
15
  var dataList = _ref.dataList,
15
16
  _ref$onClick = _ref.onClick,
@@ -18,11 +19,44 @@ var NoticeBar = function NoticeBar(_ref) {
18
19
  children = _ref.children,
19
20
  otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
20
21
  var _otherProps = otherProps || {};
21
- var stickyItems = (dataList || []).filter(function (item) {
22
- return (item === null || item === void 0 ? void 0 : item.isTop) === 0;
23
- });
24
- var loopItems = (dataList || []).filter(function (item) {
25
- return (item === null || item === void 0 ? void 0 : item.isTop) === 1;
22
+ // const stickyItems = (dataList || []).filter((item) => item?.isTop === 1)
23
+ // const loopItems = (dataList || []).filter((item) => item?.isTop === 0)
24
+
25
+ var _useState = (0, _react.useState)(true),
26
+ play = _useState[0],
27
+ setPlay = _useState[1];
28
+ var _useState2 = (0, _react.useState)([]),
29
+ loopItems = _useState2[0],
30
+ setLoopItems = _useState2[1];
31
+ var intervalId = (0, _react.useRef)(null);
32
+ (0, _react.useEffect)(function () {
33
+ var stickyItems = dataList.filter(function (item) {
34
+ return item.isTop === 1;
35
+ });
36
+ setLoopItems(dataList.filter(function (item) {
37
+ return item.isTop === 1;
38
+ }));
39
+ var startPlay = function startPlay() {
40
+ if (play) {
41
+ setLoopItems(function (prev) {
42
+ var newItems = [].concat(prev);
43
+ newItems.push(newItems[0]);
44
+ newItems.shift();
45
+ return newItems;
46
+ });
47
+ setPlay(false);
48
+ }
49
+ };
50
+ intervalId.current = setInterval(startPlay, 2000);
51
+ return function () {
52
+ clearInterval(intervalId.current);
53
+ };
54
+ }, [dataList, play]);
55
+ var isScroll = function isScroll(index) {
56
+ return index === 0;
57
+ };
58
+ var stickyItems = dataList.filter(function (item) {
59
+ return item.isTop === 1;
26
60
  });
27
61
  return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
28
62
  className: "notice-bar__panel"
@@ -38,17 +72,19 @@ var NoticeBar = function NoticeBar(_ref) {
38
72
  onClick: onClick,
39
73
  children: children
40
74
  }, item));
41
- }) : /*#__PURE__*/_react["default"].createElement("div", null), /*#__PURE__*/_react["default"].createElement(_reactTextLoopNext.TextLoop, {
42
- mask: true,
43
- className: "notice-bar__panel__item-loop",
44
- interval: 2000
45
- }, loopItems ? loopItems.map(function (item, index) {
46
- return /*#__PURE__*/_react["default"].createElement(_noticeBarItem["default"], (0, _extends2["default"])({
75
+ }) : /*#__PURE__*/_react["default"].createElement("div", null), loopItems.length > 0 ? /*#__PURE__*/_react["default"].createElement("div", {
76
+ className: "notice-bar__panel-loop"
77
+ }, loopItems.map(function (item, index) {
78
+ return /*#__PURE__*/_react["default"].createElement(_noticeBarItem["default"], {
47
79
  key: index,
48
- onClick: onClick,
49
- children: children
50
- }, item));
51
- }) : /*#__PURE__*/_react["default"].createElement("div", null, "\u6682\u65E0\u6570\u636E"))));
80
+ className: "notice-bar__panel-loop__item " + (isScroll(index) && play ? 'toUp' : ''),
81
+ content: item.content,
82
+ releaseTime: item.releaseTime,
83
+ isTop: item.isTop,
84
+ tag: item.tag,
85
+ onClick: onClick
86
+ });
87
+ })) : /*#__PURE__*/_react["default"].createElement("div", null, "\u6682\u65E0\u6570\u636E")));
52
88
  };
53
89
  NoticeBar.displayName = 'NoticeBar';
54
90
  var _default = exports["default"] = NoticeBar;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.formatTime = formatTime;
5
+ /**
6
+ * 时间计算
7
+ * @param timeString
8
+ */
9
+ function formatTime(timeString) {
10
+ var time = new Date(timeString);
11
+ var now = new Date();
12
+ var diff = now - time;
13
+ var minutes = Math.floor(diff / (1000 * 60));
14
+ var hours = Math.floor(diff / (1000 * 60 * 60));
15
+ if (minutes < 60) {
16
+ return minutes + "\u5206\u949F\u524D";
17
+ } else if (hours < 24) {
18
+ return hours + "\u5C0F\u65F6\u524D";
19
+ } else {
20
+ return time.getFullYear() + "-" + (time.getMonth() + 1).toString().padStart(2, '0') + "-" + time.getDate().toString().padStart(2, '0');
21
+ }
22
+ }
@@ -93,7 +93,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
93
93
  packageName = '@dckj-npm/dc-material';
94
94
  }
95
95
  if (version === void 0) {
96
- version = '0.1.87';
96
+ version = '0.1.88';
97
97
  }
98
98
  if (basicLibraryVersion === void 0) {
99
99
  basicLibraryVersion = {
@@ -98,7 +98,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
98
98
  packageName = '@dckj-npm/dc-material';
99
99
  }
100
100
  if (version === void 0) {
101
- version = '0.1.87';
101
+ version = '0.1.88';
102
102
  }
103
103
  if (basicLibraryVersion === void 0) {
104
104
  basicLibraryVersion = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dckj-npm/dc-material",
3
- "version": "0.1.87",
3
+ "version": "0.1.88",
4
4
  "description": "dc低代码物料",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -103,7 +103,7 @@
103
103
  },
104
104
  "componentConfig": {
105
105
  "isComponentLibrary": true,
106
- "materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.87/build/lowcode/assets-prod.json"
106
+ "materialSchema": "https://unpkg.com/@dckj-npm/dc-material@0.1.88/build/lowcode/assets-prod.json"
107
107
  },
108
108
  "lcMeta": {
109
109
  "type": "component"
@@ -1,15 +0,0 @@
1
- import * as React from 'react';
2
- import './index.scss';
3
- interface Navigation {
4
- text: string;
5
- icon: string;
6
- selectedIcon: string;
7
- pageId: string;
8
- }
9
- export interface NavigationProps {
10
- itemArray: Navigation[];
11
- selectedColor: string;
12
- onClick?: (pageId: string) => void;
13
- }
14
- declare const Navigation: React.FC<NavigationProps>;
15
- export default Navigation;
@@ -1,3 +0,0 @@
1
- import Navigation from './bottom-navigation';
2
- export type { NavigationProps } from './bottom-navigation';
3
- export default Navigation;
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- import './index.scss';
3
- export interface ButtonProps {
4
- /**
5
- * 标签名称
6
- */
7
- name: string;
8
- /**
9
- * 标签颜色
10
- */
11
- color: string;
12
- }
13
- declare const Button: React.FC<ButtonProps>;
14
- export default Button;
@@ -1,6 +0,0 @@
1
- /**
2
- * 标签tag
3
- */
4
- import Button from './button';
5
- export type { ButtonProps } from './button';
6
- export default Button;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import './carousel.scss';
3
- export interface CarouselProps {
4
- /**
5
- * 图片列表
6
- */
7
- images: string[];
8
- /**
9
- * 定时播放的时间
10
- */
11
- interval?: number;
12
- }
13
- declare const Carousel: React.FC<CarouselProps>;
14
- export default Carousel;
@@ -1,12 +0,0 @@
1
- import * as React from 'react';
2
- import './index.scss';
3
- export interface ColorfulButtonProps {
4
- /**
5
- * 类型
6
- */
7
- type?: "primary" | "secondary" | "normal";
8
- color?: string;
9
- style?: object;
10
- }
11
- declare const ColorfulButton: React.FC<ColorfulButtonProps>;
12
- export default ColorfulButton;
@@ -1,3 +0,0 @@
1
- import ColorfulButton from './colorful-button';
2
- export type { ColorfulButtonProps } from './colorful-button';
3
- export default ColorfulButton;
@@ -1,8 +0,0 @@
1
- import * as React from 'react';
2
- import './index.scss';
3
- export interface ColorfulInputProps {
4
- color?: string;
5
- style?: object;
6
- }
7
- declare const ColorfulInput: React.FC<ColorfulInputProps>;
8
- export default ColorfulInput;
@@ -1,3 +0,0 @@
1
- import ColorfulInput from './colorful-input';
2
- export type { ColorfulInputProps } from './colorful-input';
3
- export default ColorfulInput;
@@ -1,5 +0,0 @@
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;
@@ -1,5 +0,0 @@
1
- import type { GoodsCardListProps } from './types';
2
- import React from 'react';
3
- import './goods-card-list.scss';
4
- declare const GoodsCardList: React.FC<GoodsCardListProps>;
5
- export default GoodsCardList;
@@ -1,4 +0,0 @@
1
- import GoodsCardList from './goods-card-list';
2
- import GoodsCardListCommon from './goods-card-list-common';
3
- export type { GoodsCardListItemProps, GoodsCardListProps } from './types';
4
- export { GoodsCardList, GoodsCardListCommon };
@@ -1,45 +0,0 @@
1
- export interface GoodsCardListProps {
2
- /**
3
- * 卡片列表数据
4
- */
5
- dataList: GoodsCardListItemProps[];
6
- /**
7
- * 最大销量
8
- */
9
- maxSales?: number;
10
- /**
11
- * 点击事件
12
- * @param item
13
- */
14
- onClick?: (item: GoodsCardListItemProps) => void;
15
- }
16
- export interface GoodsCardListItemProps {
17
- /**
18
- * 唯一标识
19
- */
20
- key: string;
21
- /**
22
- * 缩略图列表
23
- */
24
- imageList: string[];
25
- /**
26
- * 标题
27
- */
28
- title: string;
29
- /**
30
- * 简介
31
- */
32
- desc: string;
33
- /**
34
- * 价格
35
- */
36
- price: string;
37
- /**
38
- * 促销价格
39
- */
40
- activePrice?: string;
41
- /**
42
- * 销量
43
- */
44
- sales: number;
45
- }