pds-dev-kit-web-test 2.7.347 → 2.7.348

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.
@@ -159,6 +159,7 @@ function ContentsCarousel(props) {
159
159
  if (mode === 'EDIT') {
160
160
  style.visibility = 'visible';
161
161
  }
162
+ console.log('contentsCarouselStyle', contentsCarouselNormalStyle);
162
163
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isEditModeAndHidden && (0, jsx_runtime_1.jsx)(S_HiddenCover_1.S_HiddenCover, {}), Object.entries(componentGroups).map(function (_a) {
163
164
  var position = _a[0], groupComponents = _a[1];
164
165
  return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "cb-contentscarousel-button-group ccb-elements ".concat(position), ref: function (el) {
@@ -42,21 +42,47 @@ var react_2 = require("swiper/react");
42
42
  var StyledSwiper_1 = __importDefault(require("../../../StyledSwiper/StyledSwiper"));
43
43
  var ContentsCarouselCore = (0, react_1.forwardRef)(function (_a, ref) {
44
44
  var styles = _a.styles, slidesPerView = _a.slidesPerView, children = _a.children, allowTouchMove = _a.allowTouchMove, props = __rest(_a, ["styles", "slidesPerView", "children", "allowTouchMove"]);
45
- var slidesWithEmpty = (0, react_1.useMemo)(function () {
46
- var childrenArray = Array.isArray(children) ? children : [children];
47
- if (slidesPerView === styles.slidesPerGroup &&
48
- styles.slidesPerGroup &&
49
- styles.slidesPerGroup > 1) {
50
- var remainder = childrenArray.length % styles.slidesPerGroup;
51
- if (remainder !== 0) {
52
- var emptyCount = styles.slidesPerGroup - remainder;
53
- return __spreadArray(__spreadArray([], childrenArray, true), Array(emptyCount).fill(null), true);
54
- }
45
+ var childrenArray = (0, react_1.useMemo)(function () {
46
+ return Array.isArray(children) ? children : [children];
47
+ }, [children]);
48
+ // 1. 원본 슬라이드 배열
49
+ var originalChildren = (0, react_1.useMemo)(function () {
50
+ return Array.isArray(children) ? children : [children];
51
+ }, [children]);
52
+ // 2. (수정) 루프와 slidesPerView 문제를 해결하기 위한 배열
53
+ var loopedChildren = (0, react_1.useMemo)(function () {
54
+ // 루프가 아니거나, slidesPerView가 1이하이면 원본 반환
55
+ if (!styles.loop || typeof slidesPerView !== 'number' || slidesPerView <= 1) {
56
+ return originalChildren;
55
57
  }
56
- return childrenArray;
57
- }, [children, slidesPerView, styles.slidesPerGroup]);
58
+ // 3. (핵심) 루프가 필요한데 슬라이드 수가 (slidesPerView * 2)보다 적은 경우
59
+ if (originalChildren.length > 0 && originalChildren.length < slidesPerView * 2) {
60
+ // 원본 배열을 2번 (혹은 3번) 반복하여 강제로 개수를 늘림
61
+ // 최소 8개(slidesPerView*2)는 넘겨야 하므로, 5개일 경우 10개로 만듦
62
+ return __spreadArray(__spreadArray([], originalChildren, true), originalChildren, true);
63
+ }
64
+ // 슬라이드 수가 충분하면 원본 반환
65
+ return originalChildren;
66
+ }, [originalChildren, styles.loop, slidesPerView]);
58
67
  var finalSlidesPerView = props.effect === 'cards' ? 1 : slidesPerView;
59
- var useAutoplay = !!styles.useAutoplay && Array.isArray(children) && children.length > 1;
68
+ var useAutoplay = !!styles.useAutoplay && childrenArray.length > 1;
69
+ // const slidesWithEmpty = useMemo(() => {
70
+ // const childrenArray = Array.isArray(children) ? children : [children];
71
+ // if (
72
+ // slidesPerView === styles.slidesPerGroup &&
73
+ // styles.slidesPerGroup &&
74
+ // styles.slidesPerGroup > 1
75
+ // ) {
76
+ // const remainder = childrenArray.length % styles.slidesPerGroup;
77
+ // if (remainder !== 0) {
78
+ // const emptyCount = styles.slidesPerGroup - remainder;
79
+ // return [...childrenArray, ...Array(emptyCount).fill(null)];
80
+ // }
81
+ // }
82
+ // return childrenArray;
83
+ // }, [children, slidesPerView, styles.slidesPerGroup]);
84
+ // const finalSlidesPerView = props.effect === 'cards' ? 1 : slidesPerView;
85
+ // const useAutoplay = !!styles.useAutoplay && Array.isArray(children) && children.length > 1;
60
86
  return ((0, jsx_runtime_1.jsx)(StyledSwiper_1.default, __assign({ id: "styled-swiper-wrapper" }, { children: (0, jsx_runtime_1.jsx)(react_2.Swiper, __assign({ ref: ref, style: {
61
87
  width: '100%',
62
88
  height: '100%'
@@ -71,7 +97,9 @@ var ContentsCarouselCore = (0, react_1.forwardRef)(function (_a, ref) {
71
97
  swiper_1.EffectCards,
72
98
  swiper_1.EffectCoverflow,
73
99
  swiper_1.EffectFlip
74
- ], slidesPerView: finalSlidesPerView, scrollbar: styles.scrollbar, slidesPerGroup: styles.slidesPerGroup, spaceBetween: styles.spaceBetween, freeMode: styles.freeMode, autoplay: useAutoplay ? styles.autoplay : false, loop: styles.loop, allowTouchMove: allowTouchMove }, props, { children: slidesWithEmpty.map(function (slide, index) { return ((0, jsx_runtime_1.jsx)(react_2.SwiperSlide, __assign({ style: { pointerEvents: allowTouchMove ? 'auto' : 'none' } }, { children: slide || (0, jsx_runtime_1.jsx)("div", { className: "swiper-slide-empty" }) }), index)); }) })) })));
100
+ ], slidesPerView: finalSlidesPerView, scrollbar: styles.scrollbar, slidesPerGroup: styles.slidesPerGroup, spaceBetween: styles.spaceBetween, freeMode: styles.freeMode, autoplay: useAutoplay ? styles.autoplay : false, loop: styles.loop, allowTouchMove: allowTouchMove,
101
+ // cnrk
102
+ observer: true, observeParents: true }, props, { children: loopedChildren.map(function (slide, index) { return ((0, jsx_runtime_1.jsx)(react_2.SwiperSlide, __assign({ style: { pointerEvents: allowTouchMove ? 'auto' : 'none' } }, { children: slide || (0, jsx_runtime_1.jsx)("div", { className: "swiper-slide-empty" }) }), index)); }) })) })));
75
103
  });
76
104
  ContentsCarouselCore.displayName = 'ContentsCarouselCore';
77
105
  exports.default = ContentsCarouselCore;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pds-dev-kit-web-test",
3
- "version": "2.7.347",
3
+ "version": "2.7.348",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "dist/index.js",