pds-dev-kit-web-test 2.7.347 → 2.7.350
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.
- package/dist/src/sub/DynamicLayout/{mock_fade.json → mock_section.json} +619 -5095
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/ContentsCarousel/ContentsCarousel.js +2 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/ContentsCarousel/ContentsCarouselCore.d.ts +1 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/ContentsCarousel/ContentsCarouselCore.js +45 -16
- package/package.json +1 -1
|
@@ -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) {
|
|
@@ -179,7 +180,7 @@ function ContentsCarousel(props) {
|
|
|
179
180
|
display: layout.display,
|
|
180
181
|
flexDirection: layout.flexDirection,
|
|
181
182
|
justifyContent: layout.justifyContent
|
|
182
|
-
} }, { children: (0, jsx_runtime_1.jsx)(ContentsCarouselCore_1.default, __assign({ ref: swiperRef, className: "cb-contentscarousel", allowTouchMove: mode !== 'EDIT' ? true : false, onSwiper: onSwiper, onSlideChangeTransitionEnd: onSlideChangeTransitionEnd, onAutoplayTimeLeft: onAutoplayTimeLeft, slidesPerView: displayCounts, styles: isHovered ? contentsCarouselHoverStyle : contentsCarouselNormalStyle, effect: CB_EFFECT_PROP_CONTENTSCAROUSEL_SPEC_TRANSITIONTYPE === null || CB_EFFECT_PROP_CONTENTSCAROUSEL_SPEC_TRANSITIONTYPE === void 0 ? void 0 : CB_EFFECT_PROP_CONTENTSCAROUSEL_SPEC_TRANSITIONTYPE.toLowerCase() }, { children: (0, createCompositions_1.createCompositions)({
|
|
183
|
+
} }, { children: (0, jsx_runtime_1.jsx)(ContentsCarouselCore_1.default, __assign({ ref: swiperRef, className: "cb-contentscarousel", allowTouchMove: mode !== 'EDIT' ? true : false, onSwiper: onSwiper, onSlideChangeTransitionEnd: onSlideChangeTransitionEnd, onAutoplayTimeLeft: onAutoplayTimeLeft, slidesPerView: displayCounts, styles: isHovered ? contentsCarouselHoverStyle : contentsCarouselNormalStyle, effect: CB_EFFECT_PROP_CONTENTSCAROUSEL_SPEC_TRANSITIONTYPE === null || CB_EFFECT_PROP_CONTENTSCAROUSEL_SPEC_TRANSITIONTYPE === void 0 ? void 0 : CB_EFFECT_PROP_CONTENTSCAROUSEL_SPEC_TRANSITIONTYPE.toLowerCase(), displayCounts: displayCounts }, { children: (0, createCompositions_1.createCompositions)({
|
|
183
184
|
valueType: CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE,
|
|
184
185
|
queryPath: CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_CONNECTDATA,
|
|
185
186
|
limit: displayCounts,
|
|
@@ -5,6 +5,7 @@ import type { SwiperProps, SwiperRef } from 'swiper/react/swiper-react.js';
|
|
|
5
5
|
export interface ContentsCarouselCoreProps extends SwiperProps {
|
|
6
6
|
styles: CoreCarouselProps;
|
|
7
7
|
slidesPerView?: SwiperProps['slidesPerView'];
|
|
8
|
+
displayCounts: number;
|
|
8
9
|
children?: React.ReactNode[] | JSX.Element;
|
|
9
10
|
}
|
|
10
11
|
declare const ContentsCarouselCore: import("react").ForwardRefExoticComponent<ContentsCarouselCoreProps & import("react").RefAttributes<SwiperRef>>;
|
|
@@ -41,22 +41,49 @@ require("swiper/modules/navigation/navigation.min.css");
|
|
|
41
41
|
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
|
-
var styles = _a.styles, slidesPerView = _a.slidesPerView, children = _a.children, allowTouchMove = _a.allowTouchMove, props = __rest(_a, ["styles", "slidesPerView", "children", "allowTouchMove"]);
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var emptyCount = styles.slidesPerGroup - remainder;
|
|
53
|
-
return __spreadArray(__spreadArray([], childrenArray, true), Array(emptyCount).fill(null), true);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return childrenArray;
|
|
57
|
-
}, [children, slidesPerView, styles.slidesPerGroup]);
|
|
44
|
+
var styles = _a.styles, slidesPerView = _a.slidesPerView, children = _a.children, allowTouchMove = _a.allowTouchMove, displayCounts = _a.displayCounts, props = __rest(_a, ["styles", "slidesPerView", "children", "allowTouchMove", "displayCounts"]);
|
|
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]);
|
|
58
52
|
var finalSlidesPerView = props.effect === 'cards' ? 1 : slidesPerView;
|
|
59
|
-
var useAutoplay = !!styles.useAutoplay &&
|
|
53
|
+
var useAutoplay = !!styles.useAutoplay && childrenArray.length > 1;
|
|
54
|
+
var loop = styles.loop && originalChildren.length >= displayCounts;
|
|
55
|
+
// 2. (수정) 루프와 slidesPerView 문제를 해결하기 위한 배열
|
|
56
|
+
var loopedChildren = (0, react_1.useMemo)(function () {
|
|
57
|
+
// 루프가 아니거나, slidesPerView가 1이하이면 원본 반환
|
|
58
|
+
if (!loop || typeof slidesPerView !== 'number' || slidesPerView <= 1) {
|
|
59
|
+
return originalChildren;
|
|
60
|
+
}
|
|
61
|
+
// 3. (핵심) 루프가 필요한데 슬라이드 수가 (slidesPerView * 2)보다 적은 경우
|
|
62
|
+
if (originalChildren.length > 0 && originalChildren.length < slidesPerView * 2) {
|
|
63
|
+
// 원본 배열을 2번 (혹은 3번) 반복하여 강제로 개수를 늘림
|
|
64
|
+
// 최소 8개(slidesPerView*2)는 넘겨야 하므로, 5개일 경우 10개로 만듦
|
|
65
|
+
return __spreadArray(__spreadArray([], originalChildren, true), originalChildren, true);
|
|
66
|
+
}
|
|
67
|
+
// 슬라이드 수가 충분하면 원본 반환
|
|
68
|
+
return originalChildren;
|
|
69
|
+
}, [originalChildren, loop, slidesPerView]);
|
|
70
|
+
// const slidesWithEmpty = useMemo(() => {
|
|
71
|
+
// const childrenArray = Array.isArray(children) ? children : [children];
|
|
72
|
+
// if (
|
|
73
|
+
// slidesPerView === styles.slidesPerGroup &&
|
|
74
|
+
// styles.slidesPerGroup &&
|
|
75
|
+
// styles.slidesPerGroup > 1
|
|
76
|
+
// ) {
|
|
77
|
+
// const remainder = childrenArray.length % styles.slidesPerGroup;
|
|
78
|
+
// if (remainder !== 0) {
|
|
79
|
+
// const emptyCount = styles.slidesPerGroup - remainder;
|
|
80
|
+
// return [...childrenArray, ...Array(emptyCount).fill(null)];
|
|
81
|
+
// }
|
|
82
|
+
// }
|
|
83
|
+
// return childrenArray;
|
|
84
|
+
// }, [children, slidesPerView, styles.slidesPerGroup]);
|
|
85
|
+
// const finalSlidesPerView = props.effect === 'cards' ? 1 : slidesPerView;
|
|
86
|
+
// const useAutoplay = !!styles.useAutoplay && Array.isArray(children) && children.length > 1;
|
|
60
87
|
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
88
|
width: '100%',
|
|
62
89
|
height: '100%'
|
|
@@ -71,7 +98,9 @@ var ContentsCarouselCore = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
71
98
|
swiper_1.EffectCards,
|
|
72
99
|
swiper_1.EffectCoverflow,
|
|
73
100
|
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
|
|
101
|
+
], slidesPerView: finalSlidesPerView, scrollbar: styles.scrollbar, slidesPerGroup: styles.slidesPerGroup, spaceBetween: styles.spaceBetween, freeMode: styles.freeMode, autoplay: useAutoplay ? styles.autoplay : false, loop: styles.loop, allowTouchMove: allowTouchMove,
|
|
102
|
+
// cnrk
|
|
103
|
+
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
104
|
});
|
|
76
105
|
ContentsCarouselCore.displayName = 'ContentsCarouselCore';
|
|
77
106
|
exports.default = ContentsCarouselCore;
|