@fonixtree/magic-design 1.0.161 → 1.0.163
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/es/common/ProductCardModal/index.js +26 -3
- package/es/composite-comp/dito/components/SlideImage/pc/components/ParallaxScroll/index.js +9 -12
- package/lib/common/ProductCardModal/index.js +26 -3
- package/lib/composite-comp/dito/components/SlideImage/pc/components/ParallaxScroll/index.js +9 -12
- package/package.json +1 -1
|
@@ -62,9 +62,32 @@ function ProductCardModal(_a) {
|
|
|
62
62
|
return index === active;
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
var isShow = function isShow(index) {
|
|
66
|
+
if (data.length > 3) {
|
|
67
|
+
var oneShow = 0;
|
|
68
|
+
var twoShow = 0;
|
|
69
|
+
|
|
70
|
+
if (active === 0) {
|
|
71
|
+
oneShow = data.length - 1;
|
|
72
|
+
twoShow = active + 1;
|
|
73
|
+
} else if (active === data.length - 1) {
|
|
74
|
+
oneShow = active - 1;
|
|
75
|
+
twoShow = 0;
|
|
76
|
+
} else {
|
|
77
|
+
oneShow = active - 1;
|
|
78
|
+
twoShow = active + 1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return index === oneShow || index === twoShow;
|
|
82
|
+
} else {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
65
87
|
var randomRotateY = function randomRotateY(index) {
|
|
66
88
|
// return Math.floor(Math.random() * 21) - 10;
|
|
67
|
-
return Math.floor((index % 2 === 0 ? -index : index) * 0.1 * 21) - 10;
|
|
89
|
+
// return Math.floor((index % 2 === 0 ? -index : index) * 0.1 * 21) - 10;
|
|
90
|
+
return index === 0 || index === 1 ? -10 : 10;
|
|
68
91
|
};
|
|
69
92
|
|
|
70
93
|
var handleScroll = function handleScroll(e) {
|
|
@@ -121,11 +144,11 @@ function ProductCardModal(_a) {
|
|
|
121
144
|
onClick: function onClick(e) {
|
|
122
145
|
return e.stopPropagation();
|
|
123
146
|
}
|
|
124
|
-
}, /*#__PURE__*/_react["default"].createElement(_framerMotion.AnimatePresence, null, data.
|
|
147
|
+
}, /*#__PURE__*/_react["default"].createElement(_framerMotion.AnimatePresence, null, data.map(function (item, index) {
|
|
125
148
|
return /*#__PURE__*/_react["default"].createElement(_framerMotion.motion.div, {
|
|
126
149
|
key: item.offerId,
|
|
127
150
|
animate: {
|
|
128
|
-
opacity: isActive(index) ? 1 : 0.7,
|
|
151
|
+
opacity: isActive(index) ? 1 : isShow(index) ? 0.7 : 0,
|
|
129
152
|
scale: isActive(index) ? 1 : 0.95,
|
|
130
153
|
z: isActive(index) ? 0 : -100,
|
|
131
154
|
rotate: isActive(index) ? 0 : randomRotateY(index),
|
|
@@ -25,6 +25,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
25
25
|
|
|
26
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
27
|
|
|
28
|
+
var num = 0;
|
|
29
|
+
|
|
28
30
|
function ParallaxScroll(_a) {
|
|
29
31
|
var source = _a.source,
|
|
30
32
|
xGap = _a.xGap,
|
|
@@ -42,7 +44,6 @@ function ParallaxScroll(_a) {
|
|
|
42
44
|
colThreeScrollY = _d[0],
|
|
43
45
|
setColThreeScrollY = _d[1];
|
|
44
46
|
|
|
45
|
-
var num = 0;
|
|
46
47
|
var third = Math.ceil(source.length / 3);
|
|
47
48
|
var firstPart = source.slice(0, third);
|
|
48
49
|
var secondPart = source.slice(third, 2 * third);
|
|
@@ -87,22 +88,18 @@ function ParallaxScroll(_a) {
|
|
|
87
88
|
};
|
|
88
89
|
|
|
89
90
|
var onLoad = function onLoad() {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// initLayout();
|
|
94
|
-
// }
|
|
95
|
-
initLayout();
|
|
96
|
-
setTimeout(function () {
|
|
91
|
+
if (num < source.length - 1) {
|
|
92
|
+
num += 1;
|
|
93
|
+
} else {
|
|
97
94
|
initLayout();
|
|
98
|
-
|
|
95
|
+
setTimeout(function () {
|
|
96
|
+
initLayout();
|
|
97
|
+
}, 1000);
|
|
98
|
+
}
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
(0, _react.useEffect)(function () {
|
|
102
102
|
if (!(0, _coreUtil.isDesignMode)()) {
|
|
103
|
-
// setTimeout(() => {
|
|
104
|
-
// initLayout();
|
|
105
|
-
// }, 1000);
|
|
106
103
|
window.addEventListener('resize', (0, _debounce["default"])(initLayout, 200));
|
|
107
104
|
return function () {
|
|
108
105
|
window.removeEventListener('resize', initLayout);
|
|
@@ -62,9 +62,32 @@ function ProductCardModal(_a) {
|
|
|
62
62
|
return index === active;
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
var isShow = function isShow(index) {
|
|
66
|
+
if (data.length > 3) {
|
|
67
|
+
var oneShow = 0;
|
|
68
|
+
var twoShow = 0;
|
|
69
|
+
|
|
70
|
+
if (active === 0) {
|
|
71
|
+
oneShow = data.length - 1;
|
|
72
|
+
twoShow = active + 1;
|
|
73
|
+
} else if (active === data.length - 1) {
|
|
74
|
+
oneShow = active - 1;
|
|
75
|
+
twoShow = 0;
|
|
76
|
+
} else {
|
|
77
|
+
oneShow = active - 1;
|
|
78
|
+
twoShow = active + 1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return index === oneShow || index === twoShow;
|
|
82
|
+
} else {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
65
87
|
var randomRotateY = function randomRotateY(index) {
|
|
66
88
|
// return Math.floor(Math.random() * 21) - 10;
|
|
67
|
-
return Math.floor((index % 2 === 0 ? -index : index) * 0.1 * 21) - 10;
|
|
89
|
+
// return Math.floor((index % 2 === 0 ? -index : index) * 0.1 * 21) - 10;
|
|
90
|
+
return index === 0 || index === 1 ? -10 : 10;
|
|
68
91
|
};
|
|
69
92
|
|
|
70
93
|
var handleScroll = function handleScroll(e) {
|
|
@@ -121,11 +144,11 @@ function ProductCardModal(_a) {
|
|
|
121
144
|
onClick: function onClick(e) {
|
|
122
145
|
return e.stopPropagation();
|
|
123
146
|
}
|
|
124
|
-
}, /*#__PURE__*/_react["default"].createElement(_framerMotion.AnimatePresence, null, data.
|
|
147
|
+
}, /*#__PURE__*/_react["default"].createElement(_framerMotion.AnimatePresence, null, data.map(function (item, index) {
|
|
125
148
|
return /*#__PURE__*/_react["default"].createElement(_framerMotion.motion.div, {
|
|
126
149
|
key: item.offerId,
|
|
127
150
|
animate: {
|
|
128
|
-
opacity: isActive(index) ? 1 : 0.7,
|
|
151
|
+
opacity: isActive(index) ? 1 : isShow(index) ? 0.7 : 0,
|
|
129
152
|
scale: isActive(index) ? 1 : 0.95,
|
|
130
153
|
z: isActive(index) ? 0 : -100,
|
|
131
154
|
rotate: isActive(index) ? 0 : randomRotateY(index),
|
|
@@ -25,6 +25,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
25
25
|
|
|
26
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
27
|
|
|
28
|
+
var num = 0;
|
|
29
|
+
|
|
28
30
|
function ParallaxScroll(_a) {
|
|
29
31
|
var source = _a.source,
|
|
30
32
|
xGap = _a.xGap,
|
|
@@ -42,7 +44,6 @@ function ParallaxScroll(_a) {
|
|
|
42
44
|
colThreeScrollY = _d[0],
|
|
43
45
|
setColThreeScrollY = _d[1];
|
|
44
46
|
|
|
45
|
-
var num = 0;
|
|
46
47
|
var third = Math.ceil(source.length / 3);
|
|
47
48
|
var firstPart = source.slice(0, third);
|
|
48
49
|
var secondPart = source.slice(third, 2 * third);
|
|
@@ -87,22 +88,18 @@ function ParallaxScroll(_a) {
|
|
|
87
88
|
};
|
|
88
89
|
|
|
89
90
|
var onLoad = function onLoad() {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
// initLayout();
|
|
94
|
-
// }
|
|
95
|
-
initLayout();
|
|
96
|
-
setTimeout(function () {
|
|
91
|
+
if (num < source.length - 1) {
|
|
92
|
+
num += 1;
|
|
93
|
+
} else {
|
|
97
94
|
initLayout();
|
|
98
|
-
|
|
95
|
+
setTimeout(function () {
|
|
96
|
+
initLayout();
|
|
97
|
+
}, 1000);
|
|
98
|
+
}
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
(0, _react.useEffect)(function () {
|
|
102
102
|
if (!(0, _coreUtil.isDesignMode)()) {
|
|
103
|
-
// setTimeout(() => {
|
|
104
|
-
// initLayout();
|
|
105
|
-
// }, 1000);
|
|
106
103
|
window.addEventListener('resize', (0, _debounce["default"])(initLayout, 200));
|
|
107
104
|
return function () {
|
|
108
105
|
window.removeEventListener('resize', initLayout);
|