unika-components 1.0.313 → 1.0.315

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.
@@ -21,7 +21,6 @@ declare const _default: import("vue").DefineComponent<{
21
21
  Controller: import("swiper/types").SwiperComponent;
22
22
  direction: string;
23
23
  upArrow: import("vue").Ref<boolean>;
24
- slideChangeTransitionEnd: (e: any) => void;
25
24
  slideClasses: (index: number) => string[];
26
25
  filterProps: (props: Record<string, any>, keysToFilter: string[], isFilter: true) => Record<string, any>;
27
26
  switchPage: (index: number) => void;
@@ -5,6 +5,19 @@
5
5
  .uni-image-mask-wrapper {
6
6
  display: inline-block;
7
7
  }
8
+
9
+ h2.uni-text-component, p.uni-text-component {
10
+ margin-top: 0;
11
+ margin-bottom: 0;
12
+ }
13
+ button.uni-text-component {
14
+ padding: 5px 10px;
15
+ cursor: pointer;
16
+ }
17
+ .uni-text-component {
18
+ box-sizing: border-box;
19
+ white-space: pre-wrap;
20
+ }
8
21
 
9
22
  .uni-video-component {
10
23
  position: relative;
@@ -26,19 +39,6 @@
26
39
  .play-pause-button:hover {
27
40
  background: rgba(0, 0, 0, 0.8);
28
41
  }
29
-
30
- h2.uni-text-component, p.uni-text-component {
31
- margin-top: 0;
32
- margin-bottom: 0;
33
- }
34
- button.uni-text-component {
35
- padding: 5px 10px;
36
- cursor: pointer;
37
- }
38
- .uni-text-component {
39
- box-sizing: border-box;
40
- white-space: pre-wrap;
41
- }
42
42
 
43
43
 
44
44
  .uni-calendar-component {
@@ -157,10 +157,11 @@ body, html {
157
157
  font-size: 16px;
158
158
  color: #333;
159
159
  }
160
-
161
- .uni-svg-component {
162
- display: inline-block;
163
- }
160
+
161
+ .uni-lotties-component {
162
+ width: 100%;
163
+ height: 100%;
164
+ }
164
165
 
165
166
  .ant-input-number {
166
167
  box-sizing: border-box;
@@ -218,11 +219,10 @@ body, html {
218
219
 
219
220
  .uni-build-up-component {
220
221
  }
221
-
222
- .uni-lotties-component {
223
- width: 100%;
224
- height: 100%;
225
- }
222
+
223
+ .uni-svg-component {
224
+ display: inline-block;
225
+ }
226
226
  /**
227
227
  * Swiper 6.8.4
228
228
  * Most modern mobile touch slider and framework with hardware accelerated transitions
@@ -13210,53 +13210,7 @@ var SwiperSlide = {
13210
13210
  }
13211
13211
  };
13212
13212
 
13213
- //隐藏元素
13214
- const swiperAnimateCache = () => {
13215
- const allBoxes = window.document.documentElement.querySelectorAll(".animation");
13216
- for (let i = 0; i < allBoxes.length; i++) {
13217
- allBoxes[i].attributes["style"]
13218
- ? allBoxes[i].setAttribute("swiper-animate-style-cache", allBoxes[i].attributes["style"].value)
13219
- : allBoxes[i].setAttribute("swiper-animate-style-cache", " ");
13220
- allBoxes[i].style.visibility = "hidden";
13221
- }
13222
- };
13223
- // 开始动画
13224
- const swiperAnimate = (a) => {
13225
- //每次添加的时候先把样式清除一遍
13226
- clearSwiperAnimate();
13227
- const b = a.slides[a.activeIndex].querySelectorAll(".animation");
13228
- for (let i = 0; i < b.length; i++) {
13229
- b[i].style.visibility = "visible";
13230
- const effect = b[i].attributes["swiper-animate-effect"]
13231
- ? b[i].attributes["swiper-animate-effect"].value
13232
- : "";
13233
- b[i].className = b[i].className + " " + effect + " " + "animated";
13234
- const duration = b[i].attributes["swiper-animate-duration"]
13235
- ? b[i].attributes["swiper-animate-duration"].value
13236
- : "";
13237
- // duration && style
13238
- const delay = b[i].attributes["swiper-animate-delay"]
13239
- ? b[i].attributes["swiper-animate-delay"].value
13240
- : "";
13241
- const style = b[i].attributes["style"].value + "animation-duration:" + duration + ";-webkit-animation-duration:" + duration + ";" + "animation-delay:" + delay + ";-webkit-animation-delay:" + delay + ";";
13242
- // delay && (style = style )
13243
- b[i].setAttribute("style", style);
13244
- }
13245
- };
13246
- // 清楚样式。 获取 .animation 类名, 注意这个所有的.animation 类名都会被获取,所以可以自己取
13247
- const clearSwiperAnimate = () => {
13248
- const allBoxes = window.document.documentElement.querySelectorAll(".animation");
13249
- for (let i = 0; i < allBoxes.length; i++) {
13250
- allBoxes[i].attributes["swiper-animate-style-cache"] && allBoxes[i].setAttribute("style", allBoxes[i].attributes["swiper-animate-style-cache"].value);
13251
- allBoxes[i].style.visibility = "hidden";
13252
- allBoxes[i].className = allBoxes[i].className.replace("animated", " ");
13253
- const effectValue = allBoxes[i].attributes["swiper-animate-effect"].value;
13254
- /* eslint-disable-next-line */
13255
- allBoxes[i].attributes['swiper-animate-effect'] && (allBoxes[i].className = allBoxes[i].className.replace(effectValue, ' '));
13256
- }
13257
- };
13258
-
13259
- SwiperCore.use([Pagination$1, EffectFade]);
13213
+ SwiperCore.use([Pagination$1, EffectFade, Controller$1]);
13260
13214
  function getComputedCSSText(style) {
13261
13215
  let cssText = '';
13262
13216
  for (const attr in style) {
@@ -13283,6 +13237,7 @@ var script$h = defineComponent({
13283
13237
  const componentRefs = ref(new Map());
13284
13238
  const currentPage = ref(0);
13285
13239
  const totalPages = ref(props.work && props.work.pages.length || 1); // 假设总页数为10
13240
+ const slideChangeTriggered = ref(false); // 标志位,防止重复触发
13286
13241
  const setAnimationRef = (el) => {
13287
13242
  if (el) {
13288
13243
  componentRefs.value.set(el.id, el);
@@ -13377,32 +13332,49 @@ var script$h = defineComponent({
13377
13332
  };
13378
13333
  const onSlideChange = (swiper) => {
13379
13334
  const currentIndex = swiper.activeIndex;
13380
- runAnimations(currentIndex);
13381
- callUniLottiesPlay(currentIndex);
13382
- if (currentIndex === swiper.slides.length - 1) {
13383
- upArrow.value = false;
13384
- }
13385
- else {
13386
- upArrow.value = true;
13335
+ if (!slideChangeTriggered.value) {
13336
+ currentPage.value = (currentIndex - 1);
13337
+ if (currentPage.value == totalPages.value) {
13338
+ currentPage.value = 0;
13339
+ }
13340
+ console.log('aaaaaaaa');
13341
+ console.log(totalPages.value);
13342
+ console.log(currentIndex);
13343
+ console.log(currentPage.value);
13344
+ sendPageInfo();
13345
+ try {
13346
+ runAnimations(currentIndex);
13347
+ callUniLottiesPlay(currentIndex);
13348
+ }
13349
+ catch (error) {
13350
+ console.error("Error in onSlideChange:", error);
13351
+ }
13352
+ if (currentIndex === swiper.slides.length - 1) {
13353
+ upArrow.value = false;
13354
+ }
13355
+ else {
13356
+ upArrow.value = true;
13357
+ }
13358
+ // swiperAnimate(swiper);
13387
13359
  }
13388
- swiperAnimate(swiper);
13389
- currentPage.value = (currentIndex - 1);
13390
- console.log('aaaaaaaa');
13391
- console.log(currentIndex);
13392
- console.log(currentPage.value);
13393
- sendPageInfo();
13394
- };
13395
- const slideChangeTransitionEnd = (e) => {
13396
- swiperAnimate(e);
13360
+ slideChangeTriggered.value = false; // 重置标志位
13397
13361
  };
13362
+ // const slideChangeTransitionEnd = (e: any) => {
13363
+ // swiperAnimate(e);
13364
+ // }
13398
13365
  const controlledSwiper = ref();
13399
13366
  const onSwiper = (swiper) => {
13400
13367
  controlledSwiper.value = swiper;
13401
- swiperAnimateCache();
13402
- swiperAnimate(swiper);
13368
+ // swiperAnimateCache();
13369
+ // swiperAnimate(swiper);
13403
13370
  const currentIndex = swiper.activeIndex;
13404
- runAnimations(currentIndex);
13405
- callUniLottiesPlay(currentIndex);
13371
+ try {
13372
+ runAnimations(currentIndex);
13373
+ callUniLottiesPlay(currentIndex);
13374
+ }
13375
+ catch (error) {
13376
+ console.error("Error in onSlideChange:", error);
13377
+ }
13406
13378
  };
13407
13379
  const direction = 'vertical';
13408
13380
  const slideClasses = (index) => {
@@ -13413,7 +13385,10 @@ var script$h = defineComponent({
13413
13385
  console.log(' switch page -----------');
13414
13386
  console.log(index);
13415
13387
  if (controlledSwiper.value) {
13416
- controlledSwiper.value.slideTo(index, 500);
13388
+ slideChangeTriggered.value = true; // 设置标志位,防止 slideTo 引发的 onSlideChange 触发
13389
+ if (controlledSwiper.value) {
13390
+ controlledSwiper.value.slideTo(index, 500);
13391
+ }
13417
13392
  }
13418
13393
  };
13419
13394
  // 翻到下一页
@@ -13479,7 +13454,7 @@ var script$h = defineComponent({
13479
13454
  Controller: Controller$1,
13480
13455
  direction,
13481
13456
  upArrow,
13482
- slideChangeTransitionEnd,
13457
+ // slideChangeTransitionEnd,
13483
13458
  slideClasses,
13484
13459
  filterProps,
13485
13460
  switchPage
@@ -13217,53 +13217,7 @@
13217
13217
  }
13218
13218
  };
13219
13219
 
13220
- //隐藏元素
13221
- const swiperAnimateCache = () => {
13222
- const allBoxes = window.document.documentElement.querySelectorAll(".animation");
13223
- for (let i = 0; i < allBoxes.length; i++) {
13224
- allBoxes[i].attributes["style"]
13225
- ? allBoxes[i].setAttribute("swiper-animate-style-cache", allBoxes[i].attributes["style"].value)
13226
- : allBoxes[i].setAttribute("swiper-animate-style-cache", " ");
13227
- allBoxes[i].style.visibility = "hidden";
13228
- }
13229
- };
13230
- // 开始动画
13231
- const swiperAnimate = (a) => {
13232
- //每次添加的时候先把样式清除一遍
13233
- clearSwiperAnimate();
13234
- const b = a.slides[a.activeIndex].querySelectorAll(".animation");
13235
- for (let i = 0; i < b.length; i++) {
13236
- b[i].style.visibility = "visible";
13237
- const effect = b[i].attributes["swiper-animate-effect"]
13238
- ? b[i].attributes["swiper-animate-effect"].value
13239
- : "";
13240
- b[i].className = b[i].className + " " + effect + " " + "animated";
13241
- const duration = b[i].attributes["swiper-animate-duration"]
13242
- ? b[i].attributes["swiper-animate-duration"].value
13243
- : "";
13244
- // duration && style
13245
- const delay = b[i].attributes["swiper-animate-delay"]
13246
- ? b[i].attributes["swiper-animate-delay"].value
13247
- : "";
13248
- const style = b[i].attributes["style"].value + "animation-duration:" + duration + ";-webkit-animation-duration:" + duration + ";" + "animation-delay:" + delay + ";-webkit-animation-delay:" + delay + ";";
13249
- // delay && (style = style )
13250
- b[i].setAttribute("style", style);
13251
- }
13252
- };
13253
- // 清楚样式。 获取 .animation 类名, 注意这个所有的.animation 类名都会被获取,所以可以自己取
13254
- const clearSwiperAnimate = () => {
13255
- const allBoxes = window.document.documentElement.querySelectorAll(".animation");
13256
- for (let i = 0; i < allBoxes.length; i++) {
13257
- allBoxes[i].attributes["swiper-animate-style-cache"] && allBoxes[i].setAttribute("style", allBoxes[i].attributes["swiper-animate-style-cache"].value);
13258
- allBoxes[i].style.visibility = "hidden";
13259
- allBoxes[i].className = allBoxes[i].className.replace("animated", " ");
13260
- const effectValue = allBoxes[i].attributes["swiper-animate-effect"].value;
13261
- /* eslint-disable-next-line */
13262
- allBoxes[i].attributes['swiper-animate-effect'] && (allBoxes[i].className = allBoxes[i].className.replace(effectValue, ' '));
13263
- }
13264
- };
13265
-
13266
- SwiperCore.use([Pagination$1, EffectFade]);
13220
+ SwiperCore.use([Pagination$1, EffectFade, Controller$1]);
13267
13221
  function getComputedCSSText(style) {
13268
13222
  let cssText = '';
13269
13223
  for (const attr in style) {
@@ -13290,6 +13244,7 @@
13290
13244
  const componentRefs = vue.ref(new Map());
13291
13245
  const currentPage = vue.ref(0);
13292
13246
  const totalPages = vue.ref(props.work && props.work.pages.length || 1); // 假设总页数为10
13247
+ const slideChangeTriggered = vue.ref(false); // 标志位,防止重复触发
13293
13248
  const setAnimationRef = (el) => {
13294
13249
  if (el) {
13295
13250
  componentRefs.value.set(el.id, el);
@@ -13384,32 +13339,49 @@
13384
13339
  };
13385
13340
  const onSlideChange = (swiper) => {
13386
13341
  const currentIndex = swiper.activeIndex;
13387
- runAnimations(currentIndex);
13388
- callUniLottiesPlay(currentIndex);
13389
- if (currentIndex === swiper.slides.length - 1) {
13390
- upArrow.value = false;
13391
- }
13392
- else {
13393
- upArrow.value = true;
13342
+ if (!slideChangeTriggered.value) {
13343
+ currentPage.value = (currentIndex - 1);
13344
+ if (currentPage.value == totalPages.value) {
13345
+ currentPage.value = 0;
13346
+ }
13347
+ console.log('aaaaaaaa');
13348
+ console.log(totalPages.value);
13349
+ console.log(currentIndex);
13350
+ console.log(currentPage.value);
13351
+ sendPageInfo();
13352
+ try {
13353
+ runAnimations(currentIndex);
13354
+ callUniLottiesPlay(currentIndex);
13355
+ }
13356
+ catch (error) {
13357
+ console.error("Error in onSlideChange:", error);
13358
+ }
13359
+ if (currentIndex === swiper.slides.length - 1) {
13360
+ upArrow.value = false;
13361
+ }
13362
+ else {
13363
+ upArrow.value = true;
13364
+ }
13365
+ // swiperAnimate(swiper);
13394
13366
  }
13395
- swiperAnimate(swiper);
13396
- currentPage.value = (currentIndex - 1);
13397
- console.log('aaaaaaaa');
13398
- console.log(currentIndex);
13399
- console.log(currentPage.value);
13400
- sendPageInfo();
13401
- };
13402
- const slideChangeTransitionEnd = (e) => {
13403
- swiperAnimate(e);
13367
+ slideChangeTriggered.value = false; // 重置标志位
13404
13368
  };
13369
+ // const slideChangeTransitionEnd = (e: any) => {
13370
+ // swiperAnimate(e);
13371
+ // }
13405
13372
  const controlledSwiper = vue.ref();
13406
13373
  const onSwiper = (swiper) => {
13407
13374
  controlledSwiper.value = swiper;
13408
- swiperAnimateCache();
13409
- swiperAnimate(swiper);
13375
+ // swiperAnimateCache();
13376
+ // swiperAnimate(swiper);
13410
13377
  const currentIndex = swiper.activeIndex;
13411
- runAnimations(currentIndex);
13412
- callUniLottiesPlay(currentIndex);
13378
+ try {
13379
+ runAnimations(currentIndex);
13380
+ callUniLottiesPlay(currentIndex);
13381
+ }
13382
+ catch (error) {
13383
+ console.error("Error in onSlideChange:", error);
13384
+ }
13413
13385
  };
13414
13386
  const direction = 'vertical';
13415
13387
  const slideClasses = (index) => {
@@ -13420,7 +13392,10 @@
13420
13392
  console.log(' switch page -----------');
13421
13393
  console.log(index);
13422
13394
  if (controlledSwiper.value) {
13423
- controlledSwiper.value.slideTo(index, 500);
13395
+ slideChangeTriggered.value = true; // 设置标志位,防止 slideTo 引发的 onSlideChange 触发
13396
+ if (controlledSwiper.value) {
13397
+ controlledSwiper.value.slideTo(index, 500);
13398
+ }
13424
13399
  }
13425
13400
  };
13426
13401
  // 翻到下一页
@@ -13486,7 +13461,7 @@
13486
13461
  Controller: Controller$1,
13487
13462
  direction,
13488
13463
  upArrow,
13489
- slideChangeTransitionEnd,
13464
+ // slideChangeTransitionEnd,
13490
13465
  slideClasses,
13491
13466
  filterProps,
13492
13467
  switchPage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unika-components",
3
- "version": "1.0.313",
3
+ "version": "1.0.315",
4
4
  "private": false,
5
5
  "main": "dist/unika-components.umd.js",
6
6
  "module": "dist/unika-components.esm.js",