pds-dev-kit-web 2.2.296 → 2.2.298

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 (44) hide show
  1. package/dist/src/common/assets/icons/fill/Plugin.js +1 -1
  2. package/dist/src/common/assets/icons/line/Plugin.js +1 -1
  3. package/dist/src/common/services/i18n/resources/en.json +6 -1
  4. package/dist/src/common/services/i18n/resources/es.json +6 -1
  5. package/dist/src/common/services/i18n/resources/fil.json +6 -1
  6. package/dist/src/common/services/i18n/resources/index.d.ts +35 -0
  7. package/dist/src/common/services/i18n/resources/ja.json +6 -1
  8. package/dist/src/common/services/i18n/resources/ko.json +6 -1
  9. package/dist/src/common/services/i18n/resources/zh-cn.json +6 -1
  10. package/dist/src/common/services/i18n/resources/zh-tw.json +6 -1
  11. package/dist/src/sub/DynamicLayout/CompositionEditor/CompositionEditor.js +0 -2
  12. package/dist/src/sub/DynamicLayout/CompositionRenderer/Composition.js +9 -10
  13. package/dist/src/sub/DynamicLayout/CompositionRenderer/createCompositions.d.ts +2 -1
  14. package/dist/src/sub/DynamicLayout/CompositionRenderer/createCompositions.js +15 -55
  15. package/dist/src/sub/DynamicLayout/gleStyles.js +1 -1
  16. package/dist/src/sub/DynamicLayout/mock_composition.d.ts +1 -2
  17. package/dist/src/sub/DynamicLayout/mock_queryData.d.ts +216 -74
  18. package/dist/src/sub/DynamicLayout/mock_queryData.js +1018 -2510
  19. package/dist/src/sub/DynamicLayout/mock_section.json +10777 -23774
  20. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/Button.js +38 -8
  21. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/ContentsCarousel/ContentsCarousel.js +95 -56
  22. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/ContentsCarousel/ContentsCarouselCore.js +48 -22
  23. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/ContentsCarousel/hooks/useSwiper.d.ts +1 -0
  24. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/ContentsCarousel/hooks/useSwiper.js +10 -1
  25. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/ContentsList/ContentsList.js +75 -59
  26. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Image/Image.js +33 -7
  27. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/SlideBanner/SlideBanner.js +67 -38
  28. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/SlideBanner/hooks/useSwiper.d.ts +1 -0
  29. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/SlideBanner/hooks/useSwiper.js +11 -1
  30. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.d.ts +5 -0
  31. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +109 -9
  32. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/textSpecFormatOptions.d.ts +1 -2
  33. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/textSpecFormatOptions.js +4 -4
  34. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/VideoPlayer/VideoPlayer.js +25 -1
  35. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/types.d.ts +4 -3
  36. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/fallbacks/DataNotFound.d.ts +4 -0
  37. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/fallbacks/DataNotFound.js +33 -0
  38. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseJsonProperties.js +0 -1
  39. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseQueryData.d.ts +18 -0
  40. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseQueryData.js +92 -0
  41. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBorder.js +19 -5
  42. package/dist/src/sub/DynamicLayout/types.d.ts +1 -0
  43. package/package.json +1 -1
  44. package/release-note.md +2 -2
@@ -33,6 +33,7 @@ exports.getTextStyles = void 0;
33
33
  var jsx_runtime_1 = require("react/jsx-runtime");
34
34
  /* eslint-disable react/destructuring-assignment */
35
35
  var react_1 = require("react");
36
+ var react_i18next_1 = require("react-i18next");
36
37
  var DynamicLayout_1 = require("../../../../../../../DynamicLayout");
37
38
  var compositionQueryContext_1 = require("../../../../../../../DynamicLayout/compositionQueryContext");
38
39
  var hooks_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/hooks");
@@ -41,8 +42,10 @@ var newUtils_1 = require("../../../../../../../DynamicLayout/sections/CustomSect
41
42
  var colorUtil_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/newUtils/colorUtil");
42
43
  var types_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/types");
43
44
  var util_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/util");
45
+ var parseQueryData_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/util/parseQueryData");
44
46
  var parseStylePropShadow_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropShadow");
45
47
  var styled_components_1 = __importDefault(require("styled-components"));
48
+ var DataNotFound_1 = __importDefault(require("../../../fallbacks/DataNotFound"));
46
49
  var S_CB_AnimationObserverBox_1 = require("../components/S_CB_AnimationObserverBox");
47
50
  var S_CB_Box_1 = require("../components/S_CB_Box");
48
51
  var S_HiddenCover_1 = require("../components/S_HiddenCover");
@@ -52,11 +55,12 @@ function Button(props) {
52
55
  var _a, _b, _c;
53
56
  var _d = (0, react_1.useContext)(DynamicLayout_1.dynamicLayoutContext), device = _d.device, mode = _d.mode;
54
57
  var queryContext = (0, compositionQueryContext_1.useCCBQueryPath)();
58
+ var t = (0, react_i18next_1.useTranslation)('translation').t;
55
59
  var index = props.index, CB_STYLE_PROP_COLOR = props.CB_STYLE_PROP_COLOR, _e = props.CB_CONTENT_PROP_CLINK, CB_CONTENT_PROP_CLINK_SPEC_SRC = _e.CB_CONTENT_PROP_CLINK_SPEC_SRC, CB_CONTENT_PROP_CLINK_SPEC_TYPE = _e.CB_CONTENT_PROP_CLINK_SPEC_TYPE, CB_CONTENT_PROP_CLINK_SPEC_NEWTAB = _e.CB_CONTENT_PROP_CLINK_SPEC_NEWTAB, CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC = _e.CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC, CB_CONTENT_PROP_CLINK_SPEC_VALUETYPE = _e.CB_CONTENT_PROP_CLINK_SPEC_VALUETYPE, CB_CONTENT_PROP_CLINK_SPEC_CONNECTDATA = _e.CB_CONTENT_PROP_CLINK_SPEC_CONNECTDATA, _f = props.CB_CONTENT_PROP_TEXT, CB_CONTENT_PROP_TEXT_SPEC_VALUETYPE = _f.CB_CONTENT_PROP_TEXT_SPEC_VALUETYPE, CB_CONTENT_PROP_TEXT_SPEC_CONNECTDATA = _f.CB_CONTENT_PROP_TEXT_SPEC_CONNECTDATA, CB_STYLE_PROP_SHADOW = props.CB_STYLE_PROP_SHADOW, CB_EFFECT_PROP_ENTANIM = props.CB_EFFECT_PROP_ENTANIM, CB_CONTENT_PROP_TEXTOPTION = props.CB_CONTENT_PROP_TEXTOPTION;
56
60
  var textSuffix = (_a = CB_CONTENT_PROP_TEXTOPTION === null || CB_CONTENT_PROP_TEXTOPTION === void 0 ? void 0 : CB_CONTENT_PROP_TEXTOPTION.CB_CONTENT_PROP_TEXTOPTION_SPEC_SUFFIX) !== null && _a !== void 0 ? _a : '';
57
61
  var textPrefix = (_b = CB_CONTENT_PROP_TEXTOPTION === null || CB_CONTENT_PROP_TEXTOPTION === void 0 ? void 0 : CB_CONTENT_PROP_TEXTOPTION.CB_CONTENT_PROP_TEXTOPTION_SPEC_PREFIX) !== null && _b !== void 0 ? _b : '';
58
62
  var textFormat = (_c = CB_CONTENT_PROP_TEXTOPTION === null || CB_CONTENT_PROP_TEXTOPTION === void 0 ? void 0 : CB_CONTENT_PROP_TEXTOPTION.CB_CONTENT_PROP_TEXTOPTION_SPEC_FORMAT) !== null && _c !== void 0 ? _c : 'NONE';
59
- var cLinkValue = function () {
63
+ var cLinkValue = function (defaultValue) {
60
64
  if (CB_CONTENT_PROP_CLINK_SPEC_VALUETYPE === 'DATA' ||
61
65
  CB_CONTENT_PROP_CLINK_SPEC_VALUETYPE === 'DELEGATEDDATA') {
62
66
  if (!(queryContext === null || queryContext === void 0 ? void 0 : queryContext.queryData)) {
@@ -68,13 +72,13 @@ function Button(props) {
68
72
  }
69
73
  return link;
70
74
  }
71
- return CB_CONTENT_PROP_CLINK_SPEC_SRC;
75
+ return defaultValue;
72
76
  };
73
77
  var _g = (0, useCLINK_1.default)({
74
- src: cLinkValue(),
78
+ src: cLinkValue(CB_CONTENT_PROP_CLINK_SPEC_SRC),
75
79
  type: CB_CONTENT_PROP_CLINK_SPEC_TYPE,
76
80
  openNewTab: CB_CONTENT_PROP_CLINK_SPEC_NEWTAB,
77
- internalSrc: String(CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC)
81
+ internalSrc: cLinkValue(CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC)
78
82
  }), onClickCLINK = _g.onClickCLINK, CLINKCursor = _g.CLINKCursor;
79
83
  var _h = getTextStyles(props.CB_STYLE_PROP_TEXT, device), btnTextStyle = _h.style, btnTextHoverStyle = _h.hoverStyle;
80
84
  var _j = getBTNColorStyles(CB_STYLE_PROP_COLOR, device), btnColorStyle = _j.style, btnColorHoverStyle = _j.hoverStyle;
@@ -103,13 +107,39 @@ function Button(props) {
103
107
  CB_CONTENT_PROP_TEXT_SPEC_VALUETYPE === 'DELEGATEDDATA';
104
108
  if (isDataConnected) {
105
109
  if (queryContext === null || queryContext === void 0 ? void 0 : queryContext.queryData) {
110
+ if (CB_CONTENT_PROP_TEXT_SPEC_CONNECTDATA === 'NONE') {
111
+ if (mode === 'EDIT') {
112
+ return (0, jsx_runtime_1.jsx)(DataNotFound_1.default, { stringKey: "str_10477" });
113
+ }
114
+ return '';
115
+ }
116
+ if (!Object.prototype.hasOwnProperty.call(queryContext.queryData, CB_CONTENT_PROP_TEXT_SPEC_CONNECTDATA)) {
117
+ if (mode === 'EDIT') {
118
+ return (0, jsx_runtime_1.jsx)(DataNotFound_1.default, { stringKey: "str_10478" });
119
+ }
120
+ return '';
121
+ }
106
122
  var value = queryContext.queryData[CB_CONTENT_PROP_TEXT_SPEC_CONNECTDATA];
107
- if (formatOption) {
108
- return formatOption.formatter(value);
123
+ if (value === null || value === undefined) {
124
+ if (mode === 'EDIT') {
125
+ return (0, jsx_runtime_1.jsx)(DataNotFound_1.default, { stringKey: "str_10478" });
126
+ }
127
+ return '';
109
128
  }
110
- return value;
129
+ if (!value && mode === 'EDIT') {
130
+ return (0, jsx_runtime_1.jsx)(DataNotFound_1.default, { stringKey: "str_10597" });
131
+ }
132
+ return (0, parseQueryData_1.parseQueryValue)({
133
+ value: value,
134
+ queryKey: CB_CONTENT_PROP_TEXT_SPEC_CONNECTDATA,
135
+ formatOption: formatOption,
136
+ t: t
137
+ });
138
+ }
139
+ if (mode === 'EDIT') {
140
+ return (0, jsx_runtime_1.jsx)(DataNotFound_1.default, { stringKey: "str_10478" });
111
141
  }
112
- return 'ERROR: data connected but no data';
142
+ return '';
113
143
  }
114
144
  if (device === 'MOBILE' &&
115
145
  mode !== 'EDIT' &&
@@ -67,9 +67,9 @@ var createComponent = function (type, getDesignType, getLocation, designType) {
67
67
  };
68
68
  };
69
69
  function ContentsCarousel(props) {
70
- var _a, _b;
71
- var _c = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _c.device, mode = _c.mode, queryData = _c.queryData;
72
- var compositions = props.compositions, index = props.index, _d = props.CB_CONTENT_PROP_CONTENTSCAROUSEL, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_DISPLAYCOUNTS = _d.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_DISPLAYCOUNTS, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MDISPLAYCOUNTS = _d.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MDISPLAYCOUNTS, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE = _d.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_CONNECTDATA = _d.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_CONNECTDATA, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MANUALITEMS = _d.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MANUALITEMS, CB_STYLE_PROP_CONTENTSCAROUSELDESIGN = props.CB_STYLE_PROP_CONTENTSCAROUSELDESIGN, CB_STYLE_PROP_CONTENTSCAROUSELPLAYBACKMETHOD = props.CB_STYLE_PROP_CONTENTSCAROUSELPLAYBACKMETHOD, CB_STYLE_PROP_CONTENTSCAROUSELBUTTON = props.CB_STYLE_PROP_CONTENTSCAROUSELBUTTON, CB_STYLE_PROP_CONTENTSCAROUSELPROGRESSBAR = props.CB_STYLE_PROP_CONTENTSCAROUSELPROGRESSBAR, CB_STYLE_PROP_SHADOW = props.CB_STYLE_PROP_SHADOW, CB_EFFECT_PROP_ENTANIM = props.CB_EFFECT_PROP_ENTANIM, CB_STYLE_PROP_BGMEDIA = props.CB_STYLE_PROP_BGMEDIA, CB_EFFECT_PROP_CONTENTSCAROUSEL_SPEC_TRANSITIONTYPE = props.CB_EFFECT_PROP_CONTENTSCAROUSEL.CB_EFFECT_PROP_CONTENTSCAROUSEL_SPEC_TRANSITIONTYPE;
70
+ var _a, _b, _c;
71
+ var _d = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _d.device, mode = _d.mode, queryData = _d.queryData;
72
+ var compositions = props.compositions, index = props.index, _e = props.CB_CONTENT_PROP_CONTENTSCAROUSEL, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_DISPLAYCOUNTS = _e.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_DISPLAYCOUNTS, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_ITEMCOUNTS = _e.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_ITEMCOUNTS, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MDISPLAYCOUNTS = _e.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MDISPLAYCOUNTS, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE = _e.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_CONNECTDATA = _e.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_CONNECTDATA, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_DATASORTING = _e.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_DATASORTING, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_DATAOFFSET = _e.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_DATAOFFSET, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MANUALITEMS = _e.CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MANUALITEMS, CB_STYLE_PROP_CONTENTSCAROUSELDESIGN = props.CB_STYLE_PROP_CONTENTSCAROUSELDESIGN, CB_STYLE_PROP_CONTENTSCAROUSELPLAYBACKMETHOD = props.CB_STYLE_PROP_CONTENTSCAROUSELPLAYBACKMETHOD, CB_STYLE_PROP_CONTENTSCAROUSELBUTTON = props.CB_STYLE_PROP_CONTENTSCAROUSELBUTTON, CB_STYLE_PROP_CONTENTSCAROUSELPROGRESSBAR = props.CB_STYLE_PROP_CONTENTSCAROUSELPROGRESSBAR, CB_STYLE_PROP_SHADOW = props.CB_STYLE_PROP_SHADOW, CB_EFFECT_PROP_ENTANIM = props.CB_EFFECT_PROP_ENTANIM, CB_STYLE_PROP_BGMEDIA = props.CB_STYLE_PROP_BGMEDIA, CB_EFFECT_PROP_CONTENTSCAROUSEL_SPEC_TRANSITIONTYPE = props.CB_EFFECT_PROP_CONTENTSCAROUSEL.CB_EFFECT_PROP_CONTENTSCAROUSEL_SPEC_TRANSITIONTYPE;
73
73
  var CB_STYLE_PROP_CONTENTSCAROUSEL = __assign(__assign(__assign(__assign({}, CB_STYLE_PROP_CONTENTSCAROUSELDESIGN), CB_STYLE_PROP_CONTENTSCAROUSELPLAYBACKMETHOD), CB_STYLE_PROP_CONTENTSCAROUSELBUTTON), CB_STYLE_PROP_CONTENTSCAROUSELPROGRESSBAR);
74
74
  var autoPlayEnabled = device === 'DESKTOP'
75
75
  ? CB_STYLE_PROP_CONTENTSCAROUSELPLAYBACKMETHOD.CB_STYLE_PROP_CONTENTSCAROUSELPLAYBACKMETHOD_SPEC_AUTOPLAYUSE
@@ -77,28 +77,40 @@ function ContentsCarousel(props) {
77
77
  var displayCounts = device === 'DESKTOP'
78
78
  ? CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_DISPLAYCOUNTS
79
79
  : CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MDISPLAYCOUNTS !== null && CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MDISPLAYCOUNTS !== void 0 ? CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MDISPLAYCOUNTS : CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MANUALITEMS.length;
80
- var _e = (0, util_1.parseProperties)(props, device), style = _e.style, hoverStyle = _e.hoverStyle, layout = _e.layout, overlayStyle = _e.overlayStyle, effect = _e.effect;
81
- var _f = (0, contentsCarouselUtils_1.parseCarouselStyleToCarouselCoreProp)({
80
+ var _f = (0, util_1.parseProperties)(props, device), style = _f.style, hoverStyle = _f.hoverStyle, layout = _f.layout, overlayStyle = _f.overlayStyle, effect = _f.effect;
81
+ var _g = (0, contentsCarouselUtils_1.parseCarouselStyleToCarouselCoreProp)({
82
82
  props: CB_STYLE_PROP_CONTENTSCAROUSEL,
83
83
  contentsPropsPartials: { CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_DISPLAYCOUNTS: displayCounts },
84
84
  device: device
85
- }), contentsCarouselNormalStyle = _f.normalStyle, contentsCarouselHoverStyle = _f.hoverStyle;
86
- var _g = (0, contentsCarouselUtils_1.parseCarouselStyleToCustomNavigationProp)({
85
+ }), contentsCarouselNormalStyle = _g.normalStyle, contentsCarouselHoverStyle = _g.hoverStyle;
86
+ var _h = (0, contentsCarouselUtils_1.parseCarouselStyleToCustomNavigationProp)({
87
87
  props: CB_STYLE_PROP_CONTENTSCAROUSEL,
88
88
  device: device
89
- }), customNavigationNormalStyle = _g.normalStyle, customNavigationHoverStyle = _g.hoverStyle;
90
- var _h = (0, contentsCarouselUtils_1.parseCarouselStyleToCustomProgressbarProp)({
89
+ }), customNavigationNormalStyle = _h.normalStyle, customNavigationHoverStyle = _h.hoverStyle;
90
+ var _j = (0, contentsCarouselUtils_1.parseCarouselStyleToCustomProgressbarProp)({
91
91
  props: CB_STYLE_PROP_CONTENTSCAROUSEL,
92
92
  device: device
93
- }), customProgressbarNormalStyle = _h.normalStyle, customProgressbarHoverStyle = _h.hoverStyle;
94
- var _j = (0, useSwiper_1.useSwiper)(), swiperRef = _j.swiperRef, progressRef = _j.progressRef, leftTimeMsRef = _j.leftTimeMsRef, isBeginning = _j.isBeginning, isEnd = _j.isEnd, onSwiper = _j.onSwiper, onSlideChangeTransitionEnd = _j.onSlideChangeTransitionEnd, onAutoplayTimeLeft = _j.onAutoplayTimeLeft, onClickPrevBtn = _j.onClickPrevBtn, onClickNextBtn = _j.onClickNextBtn;
95
- var _k = (0, react_1.useState)(false), isHovered = _k[0], setIsHovered = _k[1];
96
- var orderedCompositions = __spreadArray([], CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MANUALITEMS, true).filter(function (item) { return compositions.find(function (comp) { return comp.ccbManualItemUuid === item.uuid; }); })
97
- .sort(function (a, b) { return a.order - b.order; })
98
- .map(function (item) {
99
- return compositions.find(function (comp) { return comp.ccbManualItemUuid === item.uuid; });
100
- });
101
- var loop = contentsCarouselNormalStyle.loop && orderedCompositions.length >= displayCounts;
93
+ }), customProgressbarNormalStyle = _j.normalStyle, customProgressbarHoverStyle = _j.hoverStyle;
94
+ var _k = (0, useSwiper_1.useSwiper)(), swiperRef = _k.swiperRef, progressRef = _k.progressRef, leftTimeMsRef = _k.leftTimeMsRef, isBeginning = _k.isBeginning, isEnd = _k.isEnd, onSwiper = _k.onSwiper, onSlideChangeTransitionEnd = _k.onSlideChangeTransitionEnd, onAutoplayTimeLeft = _k.onAutoplayTimeLeft, onClickPrevBtn = _k.onClickPrevBtn, onClickNextBtn = _k.onClickNextBtn, resetSwiper = _k.resetSwiper;
95
+ var _l = (0, react_1.useState)(false), isHovered = _l[0], setIsHovered = _l[1];
96
+ var queryPath = "".concat(CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_CONNECTDATA, "/").concat(CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_DATASORTING, "/").concat(CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_DATAOFFSET);
97
+ var queryDataToRender = CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE === 'DATA' && queryData
98
+ ? queryData === null || queryData === void 0 ? void 0 : queryData[queryPath]
99
+ : null;
100
+ (0, react_1.useEffect)(function () {
101
+ resetSwiper();
102
+ }, [queryPath]);
103
+ var orderedCompositions = CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE === 'VALUE'
104
+ ? __spreadArray([], CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_MANUALITEMS, true).filter(function (item) { return compositions.find(function (comp) { return comp.ccbManualItemUuid === item.uuid; }); })
105
+ .sort(function (a, b) { return a.order - b.order; })
106
+ .map(function (item) {
107
+ return compositions.find(function (comp) { return comp.ccbManualItemUuid === item.uuid; });
108
+ })
109
+ : compositions.filter(function (comp) { return !comp.ccbManualItemUuid; });
110
+ var childrenLength = CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE === 'VALUE'
111
+ ? orderedCompositions.length
112
+ : Math.min((_b = queryDataToRender === null || queryDataToRender === void 0 ? void 0 : queryDataToRender.length) !== null && _b !== void 0 ? _b : 0, CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_ITEMCOUNTS);
113
+ var loop = contentsCarouselNormalStyle.loop && childrenLength >= displayCounts;
102
114
  // NOTE: edit모드에서는 그리드의 이벤트만 작동하도록 CB의 포인터 이벤트는 막습니다.
103
115
  var editModeStyle = mode === 'EDIT' ? { pointerEvents: 'none' } : {};
104
116
  // NOTE: EFFECT와 관련된 함수들입니다.
@@ -126,31 +138,19 @@ function ContentsCarousel(props) {
126
138
  designType: customProgressbarNormalStyle.type || 'NONE'
127
139
  }
128
140
  ].filter(function (component) { return component !== undefined; });
129
- var _l = (0, useFlexGridLayout_1.useFlexGridLayout)({ components: components }), layoutRef = _l.layoutRef, positionRefs = _l.positionRefs,
141
+ var _m = (0, useFlexGridLayout_1.useFlexGridLayout)({ components: components }), layoutRef = _m.layoutRef, positionRefs = _m.positionRefs,
130
142
  // ccbInset,
131
- componentGroups = _l.componentGroups, getPositionStyle = _l.getPositionStyle, getComponentGroupLayout = _l.getComponentGroupLayout;
143
+ componentGroups = _m.componentGroups, getPositionStyle = _m.getPositionStyle, getComponentGroupLayout = _m.getComponentGroupLayout;
132
144
  var ccbInset = {
133
145
  top: '0px',
134
146
  right: '0px',
135
147
  bottom: '0px',
136
148
  left: '0px'
137
149
  };
138
- var renderElements = function (component, style) {
139
- switch (component.type) {
140
- case 'PREV':
141
- return ((0, jsx_runtime_1.jsx)(CustomNavigationPrevBtn_1.CustomNavigationPrevBtn, { isDisabled: loop ? false : isBeginning, hoverStyles: customNavigationHoverStyle, onClick: onClickPrevBtn, styles: customNavigationNormalStyle, style: __assign({}, style) }));
142
- case 'NEXT':
143
- return ((0, jsx_runtime_1.jsx)(CustomNavigationNextBtn_1.CustomNavigationNextBtn, { isDisabled: loop ? false : isEnd, styles: customNavigationNormalStyle, hoverStyles: customNavigationHoverStyle, onClick: onClickNextBtn, style: __assign({}, style) }));
144
- case 'PROGRESSBAR':
145
- return ((0, jsx_runtime_1.jsx)(CustomProgressbar_1.CustomProgressbar, { slidesLength: orderedCompositions.length, progressRef: progressRef, leftTimeMsRef: leftTimeMsRef, styles: isHovered ? customProgressbarHoverStyle : customProgressbarNormalStyle }));
146
- default:
147
- return null;
148
- }
149
- };
150
150
  // NOTE: edit환경에서 hover가 작동하지 않아서 제외함 필요시 추가..
151
151
  var columnGapEnum = device === 'DESKTOP'
152
152
  ? CB_STYLE_PROP_CONTENTSCAROUSELDESIGN.CB_STYLE_PROP_CONTENTSCAROUSELDESIGN_SPEC_ITEMSPACING
153
- : (_b = CB_STYLE_PROP_CONTENTSCAROUSELDESIGN['CB_STYLE_PROP_CONTENTSCAROUSEL_SPEC_ITEMSPACING:MOBILE']) !== null && _b !== void 0 ? _b : CB_STYLE_PROP_CONTENTSCAROUSELDESIGN.CB_STYLE_PROP_CONTENTSCAROUSELDESIGN_SPEC_ITEMSPACING;
153
+ : (_c = CB_STYLE_PROP_CONTENTSCAROUSELDESIGN['CB_STYLE_PROP_CONTENTSCAROUSEL_SPEC_ITEMSPACING:MOBILE']) !== null && _c !== void 0 ? _c : CB_STYLE_PROP_CONTENTSCAROUSELDESIGN.CB_STYLE_PROP_CONTENTSCAROUSELDESIGN_SPEC_ITEMSPACING;
154
154
  var columnGap = columnGapEnum === 'NARROW' ? 8 : columnGapEnum === 'NORMAL' ? 16 : 24;
155
155
  var pointerEventsObj = mode === 'EDIT' ? { pointerEvents: 'none' } : {};
156
156
  var backgroundRef = (0, react_1.useRef)(null);
@@ -161,6 +161,59 @@ function ContentsCarousel(props) {
161
161
  if (mode === 'EDIT') {
162
162
  style.visibility = 'visible';
163
163
  }
164
+ var renderElements = function (component, style, slidesLength) {
165
+ switch (component.type) {
166
+ case 'PREV':
167
+ return ((0, jsx_runtime_1.jsx)(CustomNavigationPrevBtn_1.CustomNavigationPrevBtn, { isDisabled: loop ? false : isBeginning, hoverStyles: customNavigationHoverStyle, onClick: onClickPrevBtn, styles: customNavigationNormalStyle, style: __assign({}, style) }));
168
+ case 'NEXT':
169
+ return ((0, jsx_runtime_1.jsx)(CustomNavigationNextBtn_1.CustomNavigationNextBtn, { isDisabled: loop ? false : childrenLength <= displayCounts || isEnd, styles: customNavigationNormalStyle, hoverStyles: customNavigationHoverStyle, onClick: onClickNextBtn, style: __assign({}, style) }));
170
+ case 'PROGRESSBAR':
171
+ return ((0, jsx_runtime_1.jsx)(CustomProgressbar_1.CustomProgressbar, { slidesLength: slidesLength, progressRef: progressRef, leftTimeMsRef: leftTimeMsRef, styles: isHovered ? customProgressbarHoverStyle : customProgressbarNormalStyle }));
172
+ default:
173
+ return null;
174
+ }
175
+ };
176
+ var renderSwiper = function (compositions) {
177
+ return ((0, jsx_runtime_1.jsx)(S_SwiperLayout, __assign({ className: "cb-contentscarousel-layout-box", ref: layoutRef, style: __assign({}, pointerEventsObj) }, { children: (0, jsx_runtime_1.jsx)(S_SwiperWrapper, __assign({ className: "cb-contentscarousel-wrapper", ccbInset: ccbInset, customStyle: isHovered
178
+ ? contentsCarouselHoverStyle === null || contentsCarouselHoverStyle === void 0 ? void 0 : contentsCarouselHoverStyle.customStyle
179
+ : contentsCarouselNormalStyle === null || contentsCarouselNormalStyle === void 0 ? void 0 : contentsCarouselNormalStyle.customStyle, style: {
180
+ display: layout.display,
181
+ flexDirection: layout.flexDirection,
182
+ justifyContent: layout.justifyContent
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(), loop: loop, displayCounts: displayCounts }, { children: (0, createCompositions_1.createCompositions)({
184
+ valueType: CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE,
185
+ queryPath: queryPath,
186
+ limit: CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE === 'VALUE'
187
+ ? displayCounts
188
+ : CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_ITEMCOUNTS,
189
+ queryData: queryData,
190
+ compositions: compositions,
191
+ componentBlockCode: types_1.CB_ALL_CODES.CB_CONTENTSCAROUSEL,
192
+ device: device
193
+ }) }), CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE +
194
+ CB_EFFECT_PROP_CONTENTSCAROUSEL_SPEC_TRANSITIONTYPE +
195
+ autoPlayEnabled +
196
+ compositions.length +
197
+ queryPath) })) })));
198
+ };
199
+ var renderCompositions = function (compositions) {
200
+ // 직접 연결
201
+ if (CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE === 'VALUE') {
202
+ if (!compositions.length)
203
+ return (0, jsx_runtime_1.jsx)(EmptyString, { stringKey: "str_9806" });
204
+ return renderSwiper(compositions);
205
+ }
206
+ // 데이터 연결
207
+ if (CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_CONNECTDATA === 'NONE' || !queryPath || !queryData) {
208
+ return (0, jsx_runtime_1.jsx)(EmptyString, { stringKey: "str_10477" }, "no-query");
209
+ }
210
+ var queryDataValue = queryData[queryPath];
211
+ // 쿼리 데이터와 키가 있으나, 쿼리 데이터에 결과가 빈 경우
212
+ if (!(queryDataValue === null || queryDataValue === void 0 ? void 0 : queryDataValue.length)) {
213
+ return (0, jsx_runtime_1.jsx)(EmptyString, { stringKey: "str_10478" }, "empty-item");
214
+ }
215
+ return renderSwiper(compositions);
216
+ };
164
217
  var isHidden = style.visibility === 'hidden';
165
218
  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) {
166
219
  var position = _a[0], groupComponents = _a[1];
@@ -172,43 +225,29 @@ function ContentsCarousel(props) {
172
225
  delete positionRefs.current[position];
173
226
  }
174
227
  }, style: __assign(__assign({}, getPositionStyle(position, ccbInset, 'GROUP', 'GROUP', 'GROUP')), { zIndex: 3, position: 'absolute' }) }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "cb-contentscarousel-button-layout-box", style: getComponentGroupLayout(groupComponents, position) }, { children: groupComponents.map(function (component) {
175
- return renderElements(component, getPositionStyle(position, ccbInset, component.designType, component.size, component.type));
228
+ return renderElements(component, getPositionStyle(position, ccbInset, component.designType, component.size, component.type), orderedCompositions.length);
176
229
  }) })) }), position));
177
230
  }), (0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle }, { children: (0, jsx_runtime_1.jsxs)(S_CB_BoxWithShadow_1.S_CB_BoxWithShadow, __assign({ className: "cb-layout-box ccb-layout-box ".concat(isHidden ? ' hidden' : ''), normalStyle: __assign(__assign(__assign(__assign(__assign({}, style), layout), effectCssProperties), editModeStyle), { overflow: 'hidden' }), hoverStyle: __assign(__assign({}, hoverStyle), { overflow: 'hidden' }), cbStylePropsShadowSpecs: CB_STYLE_PROP_SHADOW, device: device, onMouseEnter: function () {
178
231
  setIsHovered(true);
179
- }, onMouseLeave: function () { return setIsHovered(false); }, "data-number-of-columns": displayCounts, "data-number-of-items": displayCounts, "data-column-gap": columnGap, "data-cols": displayCounts, "data-inset-top": parseFloat(ccbInset.top), "data-inset-bottom": parseFloat(ccbInset.bottom) }, { children: [(0, jsx_runtime_1.jsx)(S_CustomBackgroundWrapper, __assign({ ref: backgroundRef, style: __assign(__assign({}, effect), { background: style.background }) }, { children: isBgMedia && CB_STYLE_PROP_BGMEDIA && ((0, jsx_runtime_1.jsx)(CustomSectionBackgroundMedia_1.CustomSectionBackgroundMedia, { specs: CB_STYLE_PROP_BGMEDIA, componentStyle: style, playerId: index, mediaType: mediaType || 'NONE', device: isMobile ? 'MOBILE' : 'DESKTOP', backgroundRef: backgroundRef })) })), (0, jsx_runtime_1.jsx)(S_Overlay, { style: overlayStyle }), orderedCompositions.length > 0 ? ((0, jsx_runtime_1.jsx)(S_SwiperLayout, __assign({ className: "cb-contentscarousel-layout-box", ref: layoutRef, style: __assign({}, pointerEventsObj) }, { children: (0, jsx_runtime_1.jsx)(S_SwiperWrapper, __assign({ className: "cb-contentscarousel-wrapper", ccbInset: ccbInset, customStyle: isHovered
180
- ? contentsCarouselHoverStyle === null || contentsCarouselHoverStyle === void 0 ? void 0 : contentsCarouselHoverStyle.customStyle
181
- : contentsCarouselNormalStyle === null || contentsCarouselNormalStyle === void 0 ? void 0 : contentsCarouselNormalStyle.customStyle, style: {
182
- display: layout.display,
183
- flexDirection: layout.flexDirection,
184
- justifyContent: layout.justifyContent
185
- } }, { 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(), loop: loop, displayCounts: displayCounts }, { children: (0, createCompositions_1.createCompositions)({
186
- valueType: CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_VALUETYPE,
187
- queryPath: CB_CONTENT_PROP_CONTENTSCAROUSEL_SPEC_CONNECTDATA,
188
- limit: displayCounts,
189
- queryData: queryData,
190
- compositions: orderedCompositions,
191
- componentBlockCode: types_1.CB_ALL_CODES.CB_CONTENTSCAROUSEL
192
- }) }), CB_EFFECT_PROP_CONTENTSCAROUSEL_SPEC_TRANSITIONTYPE +
193
- autoPlayEnabled +
194
- orderedCompositions.length) })) }))) : ((0, jsx_runtime_1.jsx)(EmptyString, {}))] })) }))] }));
232
+ }, onMouseLeave: function () { return setIsHovered(false); }, "data-number-of-columns": displayCounts, "data-number-of-items": displayCounts, "data-column-gap": columnGap, "data-cols": displayCounts, "data-inset-top": parseFloat(ccbInset.top), "data-inset-bottom": parseFloat(ccbInset.bottom) }, { children: [(0, jsx_runtime_1.jsx)(S_CustomBackgroundWrapper, __assign({ ref: backgroundRef, style: __assign(__assign({}, effect), { background: style.background }) }, { children: isBgMedia && CB_STYLE_PROP_BGMEDIA && ((0, jsx_runtime_1.jsx)(CustomSectionBackgroundMedia_1.CustomSectionBackgroundMedia, { specs: CB_STYLE_PROP_BGMEDIA, componentStyle: style, playerId: index, mediaType: mediaType || 'NONE', device: isMobile ? 'MOBILE' : 'DESKTOP', backgroundRef: backgroundRef })) })), (0, jsx_runtime_1.jsx)(S_Overlay, { style: overlayStyle }), renderCompositions(orderedCompositions)] })) }))] }));
195
233
  }
196
- function EmptyString() {
234
+ function EmptyString(_a) {
235
+ var stringKey = _a.stringKey;
197
236
  var t = (0, react_i18next_1.useTranslation)('translation').t;
198
- return (0, jsx_runtime_1.jsx)(S_EmptyLayer, { children: t('str_9806') });
237
+ return (0, jsx_runtime_1.jsx)(S_EmptyLayer, { children: t(stringKey) });
199
238
  }
200
- var S_EmptyLayer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: rgba(0, 0, 0, 0.6);\n color: white;\n display: flex;\n font-size: ", ";\n font-weight: ", ";\n justify-content: center;\n line-height: ", ";\n margin: auto;\n padding: ", ";\n text-align: center;\n width: 100%;\n word-break: keep-all;\n"], ["\n background-color: rgba(0, 0, 0, 0.6);\n color: white;\n display: flex;\n font-size: ", ";\n font-weight: ", ";\n justify-content: center;\n line-height: ", ";\n margin: auto;\n padding: ", ";\n text-align: center;\n width: 100%;\n word-break: keep-all;\n"])), function (_a) {
239
+ var S_EmptyLayer = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: rgba(0, 0, 0, 0.5);\n color: white;\n display: flex;\n font-size: ", ";\n font-weight: ", ";\n justify-content: center;\n line-height: ", ";\n margin: auto;\n padding: ", ";\n text-align: center;\n width: 100%;\n word-break: keep-all;\n"], ["\n background-color: rgba(0, 0, 0, 0.5);\n color: white;\n display: flex;\n font-size: ", ";\n font-weight: ", ";\n justify-content: center;\n line-height: ", ";\n margin: auto;\n padding: ", ";\n text-align: center;\n width: 100%;\n word-break: keep-all;\n"])), function (_a) {
201
240
  var theme = _a.theme;
202
- return theme.desktopFontSize.body2;
241
+ return theme.desktopFontSize.caption1;
203
242
  }, function (_a) {
204
243
  var theme = _a.theme;
205
244
  return theme.fontWeight.bold;
206
245
  }, function (_a) {
207
246
  var theme = _a.theme;
208
- return theme.desktopLineHeight.body2;
247
+ return theme.desktopLineHeight.caption1;
209
248
  }, function (_a) {
210
249
  var theme = _a.theme;
211
- return theme.spacing.spacingE;
250
+ return theme.spacing.spacingD;
212
251
  });
213
252
  var S_Overlay = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: inherit;\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n"], ["\n border-radius: inherit;\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n"])));
214
253
  function getIsBgMedia(isMobile, specs) {
@@ -21,20 +21,13 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  }
22
22
  return t;
23
23
  };
24
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
25
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
26
- if (ar || !(i in from)) {
27
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
28
- ar[i] = from[i];
29
- }
30
- }
31
- return to.concat(ar || Array.prototype.slice.call(from));
32
- };
33
24
  var __importDefault = (this && this.__importDefault) || function (mod) {
34
25
  return (mod && mod.__esModule) ? mod : { "default": mod };
35
26
  };
36
27
  Object.defineProperty(exports, "__esModule", { value: true });
37
28
  var jsx_runtime_1 = require("react/jsx-runtime");
29
+ /* eslint-disable no-loop-func */
30
+ /* eslint-disable no-plusplus */
38
31
  var react_1 = require("react");
39
32
  var swiper_1 = require("swiper");
40
33
  require("swiper/modules/navigation/navigation.min.css");
@@ -53,21 +46,51 @@ function (_a, ref) {
53
46
  }, [children]);
54
47
  var finalSlidesPerView = props.effect === 'cards' ? 1 : slidesPerView;
55
48
  var useAutoplay = !!styles.useAutoplay && childrenArray.length > 1;
56
- // 2. (수정) 루프와 slidesPerView 문제를 해결하기 위한 배열
57
- var loopedChildren = (0, react_1.useMemo)(function () {
58
- // 루프가 아니거나, slidesPerView가 1이하이면 원본 반환
49
+ // 2. loop를 위한 슬라이드 배열 key 생성
50
+ var _b = (0, react_1.useMemo)(function () {
59
51
  if (!loop || typeof slidesPerView !== 'number' || slidesPerView <= 1) {
60
- return originalChildren;
52
+ return {
53
+ slides: originalChildren.map(function (child, idx) { return ({ child: child, key: "original-".concat(idx) }); }),
54
+ shouldEnableLoop: loop
55
+ };
56
+ }
57
+ // loop를 위한 최소 슬라이드 수 계산 (Swiper 내부 복제를 위한 공간 확보)
58
+ var minSlidesForLoop = slidesPerView * 2;
59
+ // 슬라이드가 충분하면 원본 그대로 + loop 활성화
60
+ if (originalChildren.length >= minSlidesForLoop) {
61
+ return {
62
+ slides: originalChildren.map(function (child, idx) { return ({ child: child, key: "original-".concat(idx) }); }),
63
+ shouldEnableLoop: true
64
+ };
61
65
  }
62
- // 3. (핵심) 루프가 필요한데 슬라이드 수가 (slidesPerView * 2)보다 적은 경우
63
- if (originalChildren.length > 0 && originalChildren.length < slidesPerView * 2) {
64
- // 원본 배열을 2번 (혹은 3번) 반복하여 강제로 개수를 늘림
65
- // 최소 8개(slidesPerView*2)는 넘겨야 하므로, 5개일 경우 10개로 만듦
66
- return __spreadArray(__spreadArray([], originalChildren, true), originalChildren, true);
66
+ // 슬라이드가 부족하면 충분한 개수까지 복제 + loop 활성화
67
+ if (originalChildren.length > 0) {
68
+ var duplicatedSlides_1 = [];
69
+ var copyCount_1 = 0;
70
+ // Swiper loop가 제대로 작동하려면 충분히 많이 복제
71
+ // minSlidesForLoop * 3 = 18개 정도면 무한 루프가 자연스럽게 작동
72
+ while (duplicatedSlides_1.length < minSlidesForLoop * 3) {
73
+ originalChildren.forEach(function (child, idx) {
74
+ duplicatedSlides_1.push({ child: child, key: "copy-".concat(copyCount_1, "-").concat(idx) });
75
+ });
76
+ copyCount_1++;
77
+ }
78
+ return {
79
+ slides: duplicatedSlides_1,
80
+ shouldEnableLoop: true // 충분히 복제했으므로 loop 활성화
81
+ };
67
82
  }
68
- // 슬라이드 수가 충분하면 원본 반환
69
- return originalChildren;
70
- }, [originalChildren, loop, slidesPerView]);
83
+ return {
84
+ slides: originalChildren.map(function (child, idx) { return ({ child: child, key: "original-".concat(idx) }); }),
85
+ shouldEnableLoop: false
86
+ };
87
+ }, [originalChildren, loop, slidesPerView]), slides = _b.slides, shouldEnableLoop = _b.shouldEnableLoop;
88
+ // loopedSlides는 loop가 실제로 활성화될 때만 설정
89
+ var loopedSlidesCount = (0, react_1.useMemo)(function () {
90
+ if (!shouldEnableLoop || typeof slidesPerView !== 'number')
91
+ return undefined;
92
+ return slidesPerView;
93
+ }, [shouldEnableLoop, slidesPerView]);
71
94
  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: {
72
95
  width: '100%',
73
96
  height: '100%'
@@ -82,7 +105,10 @@ function (_a, ref) {
82
105
  swiper_1.EffectCards,
83
106
  swiper_1.EffectCoverflow,
84
107
  swiper_1.EffectFlip
85
- ], slidesPerView: finalSlidesPerView, scrollbar: styles.scrollbar, slidesPerGroup: styles.slidesPerGroup, spaceBetween: styles.spaceBetween, freeMode: styles.freeMode, autoplay: useAutoplay ? styles.autoplay : false, loop: loop, allowTouchMove: allowTouchMove, 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)); }) })) })));
108
+ ], loopedSlides: loopedSlidesCount, slidesPerView: finalSlidesPerView, scrollbar: styles.scrollbar, slidesPerGroup: styles.slidesPerGroup, spaceBetween: styles.spaceBetween, freeMode: styles.freeMode, autoplay: useAutoplay ? styles.autoplay : false, loop: shouldEnableLoop, allowTouchMove: allowTouchMove, observer: true, observeParents: true }, props, { children: slides.map(function (_a) {
109
+ var child = _a.child, key = _a.key;
110
+ return ((0, jsx_runtime_1.jsx)(react_2.SwiperSlide, __assign({ style: { pointerEvents: allowTouchMove ? 'auto' : 'none' } }, { children: child || (0, jsx_runtime_1.jsx)("div", { className: "swiper-slide-empty" }) }), key));
111
+ }) })) })));
86
112
  });
87
113
  ContentsCarouselCore.displayName = 'ContentsCarouselCore';
88
114
  exports.default = ContentsCarouselCore;
@@ -11,4 +11,5 @@ export declare function useSwiper(): {
11
11
  onAutoplayTimeLeft: (swiper: SwiperClass, time: number, progress: number) => void;
12
12
  onClickPrevBtn: () => void;
13
13
  onClickNextBtn: () => void;
14
+ resetSwiper: () => void;
14
15
  };
@@ -30,6 +30,14 @@ function useSwiper() {
30
30
  swiperRef.current.swiper.slideNext();
31
31
  }
32
32
  };
33
+ var resetSwiper = function () {
34
+ var _a, _b, _c;
35
+ setIsBeginning(true);
36
+ setIsEnd(false);
37
+ progressRef.current = 0;
38
+ leftTimeMsRef.current = 0;
39
+ (_c = (_b = (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo) === null || _c === void 0 ? void 0 : _c.call(_b, 0, 0);
40
+ };
33
41
  return {
34
42
  swiperRef: swiperRef,
35
43
  progressRef: progressRef,
@@ -40,7 +48,8 @@ function useSwiper() {
40
48
  onSlideChangeTransitionEnd: onSlideChangeTransitionEnd,
41
49
  onAutoplayTimeLeft: onAutoplayTimeLeft,
42
50
  onClickPrevBtn: onClickPrevBtn,
43
- onClickNextBtn: onClickNextBtn
51
+ onClickNextBtn: onClickNextBtn,
52
+ resetSwiper: resetSwiper
44
53
  };
45
54
  }
46
55
  exports.useSwiper = useSwiper;