@dckj-npm/dc-material 0.1.124 → 0.1.126

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.
@@ -3,7 +3,6 @@ import './index.scss';
3
3
  import { Location } from "./position";
4
4
  interface LocationProps {
5
5
  itemArray: Location[];
6
- currentLocation: Location;
7
6
  open: boolean;
8
7
  setIsOpen: () => void;
9
8
  setCurrent: (data: Location) => void;
@@ -3,7 +3,6 @@ import "./index.scss";
3
3
  var ContentList = function navigationList(_ref) {
4
4
  var open = _ref.open,
5
5
  itemArray = _ref.itemArray,
6
- currentLocation = _ref.currentLocation,
7
6
  setIsOpen = _ref.setIsOpen,
8
7
  setCurrent = _ref.setCurrent;
9
8
  var changeHandle = function changeHandle(position) {
@@ -18,13 +17,13 @@ var ContentList = function navigationList(_ref) {
18
17
  style: {
19
18
  display: open ? 'block' : 'none'
20
19
  }
21
- }, itemArray.map(function (item) {
20
+ }, itemArray ? itemArray.map(function (item) {
22
21
  return /*#__PURE__*/React.createElement("div", {
23
22
  onClick: function onClick() {
24
23
  return changeHandle(item);
25
24
  },
26
25
  className: "location-list-item"
27
26
  }, item.address);
28
- }));
27
+ }) : /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E"));
29
28
  };
30
29
  export default ContentList;
@@ -1,12 +1,33 @@
1
- /* write style here */
2
- .swiper__container {
1
+ .carousel {
2
+ position: relative;
3
+ overflow: hidden;
4
+ width: 100%;
3
5
  margin: 0;
4
- &__sliede {
5
- position: relative;
6
- height: 100%;
7
- }
8
6
  }
9
- .img{
7
+ .carousel__wrapper {
8
+ display: flex;
9
+ }
10
+ .carousel__slide {
11
+ min-width: 100%;
12
+ transition: transform ease-in-out;
13
+ }
14
+ .carousel__slide img {
10
15
  width: 100%;
11
- height: 100%;
16
+ height: auto;
17
+ }
18
+ .carousel__button {
19
+ position: absolute;
20
+ top: 50%;
21
+ transform: translateY(-50%);
22
+ background: rgba(0, 0, 0, 0.5);
23
+ color: white;
24
+ border: none;
25
+ padding: 10px;
26
+ cursor: pointer;
27
+ }
28
+ .carousel__button--prev {
29
+ left: 10px;
30
+ }
31
+ .carousel__button--next {
32
+ right: 10px;
12
33
  }
@@ -1,31 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import './index.scss';
3
- import 'swiper/swiper.min.css';
4
3
  export interface ComponentProps {
5
- /**
6
- * 设定初始化时slide的索引
7
- */
8
- initialSlide?: number;
9
- /**
10
- * 设定初始化时slide的索引
11
- */
12
- direction?: 'vertical' | 'horizontal';
13
4
  /**
14
5
  * 切换速度,单位ms
15
6
  */
16
7
  speed?: number;
17
- /**
18
- * 展示数量
19
- */
20
- slidesPerView: number;
21
8
  /**
22
9
  * 高度
23
10
  */
24
11
  height: number;
25
- /**
26
- * 自动高度
27
- */
28
- autoHeight: boolean;
29
12
  /**
30
13
  * 自动播放
31
14
  */
@@ -34,10 +17,6 @@ export interface ComponentProps {
34
17
  * 循环播放
35
18
  */
36
19
  loop: boolean;
37
- /**
38
- * 图片间距
39
- */
40
- spaceBetween: number;
41
20
  /**
42
21
  * 图片路径
43
22
  */
@@ -1,34 +1,77 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["speed", "autoplay", "loop", "picUrls", "height"];
2
4
  import * as React from 'react';
3
- import { Image } from '@alilc/lowcode-materials';
4
- import { Swiper, SwiperSlide } from 'swiper/react';
5
- import SwiperCore, { Autoplay } from 'swiper/core'; // 引入核心插件和自动播放组件
6
- SwiperCore.use([Autoplay]); // 使用插件,插件名放入[]中,这一行是重点
5
+ import { useEffect, useRef, useState } from 'react';
7
6
  import "./index.scss";
8
- import 'swiper/swiper.min.css';
9
- var DCSlider = function DCSlider(props) {
10
- var height = props.height;
11
- return /*#__PURE__*/React.createElement(Swiper, _extends({}, props, {
12
- className: "swiper__container",
7
+ var DCSlider = function DCSlider(_ref) {
8
+ var _ref$speed = _ref.speed,
9
+ speed = _ref$speed === void 0 ? 500 : _ref$speed,
10
+ autoplay = _ref.autoplay,
11
+ loop = _ref.loop,
12
+ _ref$picUrls = _ref.picUrls,
13
+ picUrls = _ref$picUrls === void 0 ? [] : _ref$picUrls,
14
+ height = _ref.height,
15
+ otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
16
+ var _useState = useState(0),
17
+ currentIndex = _useState[0],
18
+ setCurrentIndex = _useState[1];
19
+ var autoplayRef = useRef(null);
20
+ var nextSlide = function nextSlide() {
21
+ if (currentIndex < picUrls.length - 1) {
22
+ setCurrentIndex(currentIndex + 1);
23
+ } else if (loop) {
24
+ setCurrentIndex(0);
25
+ }
26
+ };
27
+ var startAutoplay = function startAutoplay() {
28
+ if (autoplay && !autoplayRef.current) {
29
+ autoplayRef.current = setInterval(nextSlide, speed);
30
+ }
31
+ };
32
+ var stopAutoplay = function stopAutoplay() {
33
+ if (autoplayRef.current) {
34
+ clearInterval(autoplayRef.current);
35
+ autoplayRef.current = null;
36
+ }
37
+ };
38
+ useEffect(function () {
39
+ if (autoplay) {
40
+ startAutoplay();
41
+ }
42
+ return function () {
43
+ stopAutoplay();
44
+ };
45
+ }, [autoplay, speed, loop, picUrls]);
46
+ return /*#__PURE__*/React.createElement("div", _extends({
47
+ className: "carousel",
48
+ onMouseEnter: stopAutoplay,
49
+ onMouseLeave: startAutoplay,
13
50
  style: {
14
51
  height: height ? height + "px" : '100%'
15
52
  }
16
- }), props.picUrls && props.picUrls.length > 0 ? props.picUrls.map(function (url, index) {
17
- return /*#__PURE__*/React.createElement(SwiperSlide, {
18
- className: "swiper__container__sliede",
53
+ }, otherProps), /*#__PURE__*/React.createElement("div", {
54
+ className: "carousel__wrapper",
55
+ style: {
56
+ transform: "translateX(-" + currentIndex * 100 + "%)",
57
+ transitionDuration: speed + "ms"
58
+ }
59
+ }, picUrls.map(function (url, index) {
60
+ return /*#__PURE__*/React.createElement("div", {
61
+ key: index,
62
+ className: "carousel__slide",
19
63
  style: {
20
64
  width: '100%',
21
65
  height: height ? height + "px" : '100%'
22
66
  }
23
- }, /*#__PURE__*/React.createElement(Image, {
67
+ }, /*#__PURE__*/React.createElement("img", {
24
68
  src: url,
25
- alt: "Slide",
26
- key: index,
69
+ alt: "Slide " + index,
27
70
  style: {
28
71
  width: '100%',
29
72
  height: height ? height + "px" : '100%'
30
73
  }
31
74
  }));
32
- }) : /*#__PURE__*/React.createElement("div", null, "\u56FE\u7247\u4E3A\u7A7A"));
75
+ })));
33
76
  };
34
77
  export default DCSlider;
@@ -7,8 +7,6 @@
7
7
  padding-bottom: 10px;
8
8
  justify-content: flex-start;
9
9
 
10
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
11
-
12
10
  .teletext-list__panel__item_image {
13
11
  width: 90px;
14
12
  height: 71px;
@@ -53,3 +51,7 @@
53
51
  }
54
52
 
55
53
  }
54
+
55
+ .teletext-list__panel__item:not(:last-child) {
56
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
57
+ }
@@ -3,7 +3,6 @@ import './index.scss';
3
3
  import { Location } from "./position";
4
4
  interface LocationProps {
5
5
  itemArray: Location[];
6
- currentLocation: Location;
7
6
  open: boolean;
8
7
  setIsOpen: () => void;
9
8
  setCurrent: (data: Location) => void;
@@ -9,7 +9,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
9
9
  var ContentList = function navigationList(_ref) {
10
10
  var open = _ref.open,
11
11
  itemArray = _ref.itemArray,
12
- currentLocation = _ref.currentLocation,
13
12
  setIsOpen = _ref.setIsOpen,
14
13
  setCurrent = _ref.setCurrent;
15
14
  var changeHandle = function changeHandle(position) {
@@ -24,13 +23,13 @@ var ContentList = function navigationList(_ref) {
24
23
  style: {
25
24
  display: open ? 'block' : 'none'
26
25
  }
27
- }, itemArray.map(function (item) {
26
+ }, itemArray ? itemArray.map(function (item) {
28
27
  return /*#__PURE__*/React.createElement("div", {
29
28
  onClick: function onClick() {
30
29
  return changeHandle(item);
31
30
  },
32
31
  className: "location-list-item"
33
32
  }, item.address);
34
- }));
33
+ }) : /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E"));
35
34
  };
36
35
  var _default = exports["default"] = ContentList;
@@ -1,12 +1,33 @@
1
- /* write style here */
2
- .swiper__container {
1
+ .carousel {
2
+ position: relative;
3
+ overflow: hidden;
4
+ width: 100%;
3
5
  margin: 0;
4
- &__sliede {
5
- position: relative;
6
- height: 100%;
7
- }
8
6
  }
9
- .img{
7
+ .carousel__wrapper {
8
+ display: flex;
9
+ }
10
+ .carousel__slide {
11
+ min-width: 100%;
12
+ transition: transform ease-in-out;
13
+ }
14
+ .carousel__slide img {
10
15
  width: 100%;
11
- height: 100%;
16
+ height: auto;
17
+ }
18
+ .carousel__button {
19
+ position: absolute;
20
+ top: 50%;
21
+ transform: translateY(-50%);
22
+ background: rgba(0, 0, 0, 0.5);
23
+ color: white;
24
+ border: none;
25
+ padding: 10px;
26
+ cursor: pointer;
27
+ }
28
+ .carousel__button--prev {
29
+ left: 10px;
30
+ }
31
+ .carousel__button--next {
32
+ right: 10px;
12
33
  }
@@ -1,31 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import './index.scss';
3
- import 'swiper/swiper.min.css';
4
3
  export interface ComponentProps {
5
- /**
6
- * 设定初始化时slide的索引
7
- */
8
- initialSlide?: number;
9
- /**
10
- * 设定初始化时slide的索引
11
- */
12
- direction?: 'vertical' | 'horizontal';
13
4
  /**
14
5
  * 切换速度,单位ms
15
6
  */
16
7
  speed?: number;
17
- /**
18
- * 展示数量
19
- */
20
- slidesPerView: number;
21
8
  /**
22
9
  * 高度
23
10
  */
24
11
  height: number;
25
- /**
26
- * 自动高度
27
- */
28
- autoHeight: boolean;
29
12
  /**
30
13
  * 自动播放
31
14
  */
@@ -34,10 +17,6 @@ export interface ComponentProps {
34
17
  * 循环播放
35
18
  */
36
19
  loop: boolean;
37
- /**
38
- * 图片间距
39
- */
40
- spaceBetween: number;
41
20
  /**
42
21
  * 图片路径
43
22
  */
@@ -4,40 +4,81 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  exports.__esModule = true;
5
5
  exports["default"] = void 0;
6
6
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
7
- var React = _interopRequireWildcard(require("react"));
8
- var _lowcodeMaterials = require("@alilc/lowcode-materials");
9
- var _react2 = require("swiper/react");
10
- var _core = _interopRequireWildcard(require("swiper/core"));
7
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var React = _react;
11
10
  require("./index.scss");
12
- require("swiper/swiper.min.css");
11
+ var _excluded = ["speed", "autoplay", "loop", "picUrls", "height"];
13
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); }
14
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; }
15
- // 引入核心插件和自动播放组件
16
- _core["default"].use([_core.Autoplay]); // 使用插件,插件名放入[]中,这一行是重点
17
-
18
- var DCSlider = function DCSlider(props) {
19
- var height = props.height;
20
- return /*#__PURE__*/React.createElement(_react2.Swiper, (0, _extends2["default"])({}, props, {
21
- className: "swiper__container",
14
+ var DCSlider = function DCSlider(_ref) {
15
+ var _ref$speed = _ref.speed,
16
+ speed = _ref$speed === void 0 ? 500 : _ref$speed,
17
+ autoplay = _ref.autoplay,
18
+ loop = _ref.loop,
19
+ _ref$picUrls = _ref.picUrls,
20
+ picUrls = _ref$picUrls === void 0 ? [] : _ref$picUrls,
21
+ height = _ref.height,
22
+ otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
23
+ var _useState = (0, _react.useState)(0),
24
+ currentIndex = _useState[0],
25
+ setCurrentIndex = _useState[1];
26
+ var autoplayRef = (0, _react.useRef)(null);
27
+ var nextSlide = function nextSlide() {
28
+ if (currentIndex < picUrls.length - 1) {
29
+ setCurrentIndex(currentIndex + 1);
30
+ } else if (loop) {
31
+ setCurrentIndex(0);
32
+ }
33
+ };
34
+ var startAutoplay = function startAutoplay() {
35
+ if (autoplay && !autoplayRef.current) {
36
+ autoplayRef.current = setInterval(nextSlide, speed);
37
+ }
38
+ };
39
+ var stopAutoplay = function stopAutoplay() {
40
+ if (autoplayRef.current) {
41
+ clearInterval(autoplayRef.current);
42
+ autoplayRef.current = null;
43
+ }
44
+ };
45
+ (0, _react.useEffect)(function () {
46
+ if (autoplay) {
47
+ startAutoplay();
48
+ }
49
+ return function () {
50
+ stopAutoplay();
51
+ };
52
+ }, [autoplay, speed, loop, picUrls]);
53
+ return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({
54
+ className: "carousel",
55
+ onMouseEnter: stopAutoplay,
56
+ onMouseLeave: startAutoplay,
22
57
  style: {
23
58
  height: height ? height + "px" : '100%'
24
59
  }
25
- }), props.picUrls && props.picUrls.length > 0 ? props.picUrls.map(function (url, index) {
26
- return /*#__PURE__*/React.createElement(_react2.SwiperSlide, {
27
- className: "swiper__container__sliede",
60
+ }, otherProps), /*#__PURE__*/React.createElement("div", {
61
+ className: "carousel__wrapper",
62
+ style: {
63
+ transform: "translateX(-" + currentIndex * 100 + "%)",
64
+ transitionDuration: speed + "ms"
65
+ }
66
+ }, picUrls.map(function (url, index) {
67
+ return /*#__PURE__*/React.createElement("div", {
68
+ key: index,
69
+ className: "carousel__slide",
28
70
  style: {
29
71
  width: '100%',
30
72
  height: height ? height + "px" : '100%'
31
73
  }
32
- }, /*#__PURE__*/React.createElement(_lowcodeMaterials.Image, {
74
+ }, /*#__PURE__*/React.createElement("img", {
33
75
  src: url,
34
- alt: "Slide",
35
- key: index,
76
+ alt: "Slide " + index,
36
77
  style: {
37
78
  width: '100%',
38
79
  height: height ? height + "px" : '100%'
39
80
  }
40
81
  }));
41
- }) : /*#__PURE__*/React.createElement("div", null, "\u56FE\u7247\u4E3A\u7A7A"));
82
+ })));
42
83
  };
43
84
  var _default = exports["default"] = DCSlider;
@@ -7,8 +7,6 @@
7
7
  padding-bottom: 10px;
8
8
  justify-content: flex-start;
9
9
 
10
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
11
-
12
10
  .teletext-list__panel__item_image {
13
11
  width: 90px;
14
12
  height: 71px;
@@ -53,3 +51,7 @@
53
51
  }
54
52
 
55
53
  }
54
+
55
+ .teletext-list__panel__item:not(:last-child) {
56
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
57
+ }
@@ -19,53 +19,6 @@ const SwiperMeta: IPublicTypeComponentMetadata = {
19
19
  },
20
20
  "configure": {
21
21
  "props": [
22
- {
23
- "title": "初始索引",
24
- "name": "initialSlide",
25
- "description": "设定初始化时slide的索引",
26
- "setter": {
27
- "componentName": "NumberSetter",
28
- "isRequired": false,
29
- "initialValue": 0
30
- }
31
- },
32
- {
33
- "title": {
34
- "label": {
35
- "type": "i18n",
36
- "en-US": "direction",
37
- "zh-CN": "方向"
38
- },
39
- "tip": "direction | 轮播方向"
40
- },
41
- "name": "direction",
42
- "setter": {
43
- "componentName": "RadioGroupSetter",
44
- "props": {
45
- "dataSource": [
46
- {
47
- "label": "vertical",
48
- "value": "vertical"
49
- },
50
- {
51
- "label": "horizontal",
52
- "value": "horizontal"
53
- }
54
- ],
55
- "options": [
56
- {
57
- "label": "vertical",
58
- "value": "vertical"
59
- },
60
- {
61
- "label": "horizontal",
62
- "value": "horizontal"
63
- }
64
- ]
65
- },
66
- "initialValue": "vertical"
67
- }
68
- },
69
22
  {
70
23
  "title": {
71
24
  "label": {
@@ -83,23 +36,6 @@ const SwiperMeta: IPublicTypeComponentMetadata = {
83
36
  "initialValue": 0
84
37
  }
85
38
  },
86
- {
87
- "title": {
88
- "label": {
89
- "type": "i18n",
90
- "en-US": "slidesPerView",
91
- "zh-CN": "展示数量"
92
- },
93
- "tip": "同时展示图片数量"
94
- },
95
- "name": "slidesPerView",
96
- "description": "展示数量",
97
- "setter": {
98
- "componentName": "NumberSetter",
99
- "isRequired": true,
100
- "initialValue": 0
101
- }
102
- },
103
39
  {
104
40
  "title": {
105
41
  "label": {
@@ -116,23 +52,6 @@ const SwiperMeta: IPublicTypeComponentMetadata = {
116
52
  "isRequired": true
117
53
  }
118
54
  },
119
- {
120
- "title": {
121
- "label": {
122
- "type": "i18n",
123
- "en-US": "autoHeight",
124
- "zh-CN": "自动高度"
125
- },
126
- "tip": "autoHeight | 自动高度"
127
- },
128
- "name": "autoHeight",
129
- "description": "自动高度",
130
- "setter": {
131
- "componentName": "BoolSetter",
132
- "isRequired": true,
133
- "initialValue": false
134
- }
135
- },
136
55
  {
137
56
  "title": {
138
57
  "label": {
@@ -167,23 +86,6 @@ const SwiperMeta: IPublicTypeComponentMetadata = {
167
86
  "initialValue": false
168
87
  }
169
88
  },
170
- {
171
- "title": {
172
- "label": {
173
- "type": "i18n",
174
- "en-US": "spaceBetween",
175
- "zh-CN": "图片间距"
176
- },
177
- "tip": "spaceBetween | 图片间距"
178
- },
179
- "name": "spaceBetween",
180
- "description": "图片间距",
181
- "setter": {
182
- "componentName": "NumberSetter",
183
- "isRequired": true,
184
- "initialValue": 0
185
- }
186
- },
187
89
  {
188
90
  name: 'picUrls',
189
91
  title: '数据源绑定',
@@ -213,14 +115,10 @@ const snippets: IPublicTypeSnippet[] = [
213
115
  "schema": {
214
116
  "componentName": "Swiper",
215
117
  "props": {
216
- spaceBetween: 0,
217
118
  loop: true,
218
119
  autoplay: true,
219
120
  speed: 200,
220
- slidesPerView: 1,
221
- initialSlide: 1,
222
- direction: 'horizontal',
223
- autoHeight: false,
121
+ height: 172,
224
122
  // 轮播路径
225
123
  picUrls: ['https://img.alicdn.com/tps/TB1bewbNVXXXXc5XXXXXXXXXXXX-1000-300.png',
226
124
  'https://img.alicdn.com/tps/TB1xuUcNVXXXXcRXXXXXXXXXXXX-1000-300.jpg',
@@ -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.124';
96
+ version = '0.1.126';
97
97
  }
98
98
  if (basicLibraryVersion === void 0) {
99
99
  basicLibraryVersion = {