• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/// <reference path='./import.ts' />
17class ArkSwiperComponent extends ArkComponent implements SwiperAttribute {
18  constructor(nativePtr: KNode, classType?: ModifierType) {
19    super(nativePtr, classType);
20  }
21  initialize(value: Object[]): SwiperAttribute {
22    if (value[0] !== undefined) {
23      modifierWithKey(this._modifiersWithKeys, SwiperInitializeModifier.identity, SwiperInitializeModifier, value[0]);
24    }
25    return this;
26  }
27  index(value: number): this {
28    modifierWithKey(this._modifiersWithKeys, SwiperIndexModifier.identity, SwiperIndexModifier, value);
29    return this;
30  }
31  autoPlay(value: boolean): this {
32    modifierWithKey(this._modifiersWithKeys, SwiperAutoPlayModifier.identity, SwiperAutoPlayModifier, value);
33    return this;
34  }
35  interval(value: number): this {
36    modifierWithKey(this._modifiersWithKeys, SwiperIntervalModifier.identity, SwiperIntervalModifier, value);
37    return this;
38  }
39
40  indicator(value: boolean | DotIndicator | DigitIndicator): this {
41    modifierWithKey(this._modifiersWithKeys, SwiperIndicatorModifier.identity, SwiperIndicatorModifier, value);
42    return this;
43  }
44
45  displayArrow(value: boolean | ArrowStyle, isHoverShow?: boolean | undefined): this {
46    let arkDisplayArrow = new ArkDisplayArrow();
47    arkDisplayArrow.value = value;
48    arkDisplayArrow.isHoverShow = isHoverShow;
49    modifierWithKey(
50      this._modifiersWithKeys,
51      SwiperDisplayArrowModifier.identity,
52      SwiperDisplayArrowModifier,
53      arkDisplayArrow
54    );
55    return this;
56  }
57  loop(value: boolean): this {
58    modifierWithKey(this._modifiersWithKeys, SwiperLoopModifier.identity, SwiperLoopModifier, value);
59    return this;
60  }
61  duration(value: number): this {
62    modifierWithKey(this._modifiersWithKeys, SwiperDurationModifier.identity, SwiperDurationModifier, value);
63    return this;
64  }
65  vertical(value: boolean): this {
66    modifierWithKey(this._modifiersWithKeys, SwiperVerticalModifier.identity, SwiperVerticalModifier, value);
67    return this;
68  }
69  itemSpace(value: string | number): this {
70    modifierWithKey(this._modifiersWithKeys, SwiperItemSpaceModifier.identity, SwiperItemSpaceModifier, value);
71    return this;
72  }
73  displayMode(value: SwiperDisplayMode): this {
74    modifierWithKey(this._modifiersWithKeys, SwiperDisplayModeModifier.identity, SwiperDisplayModeModifier, value);
75    return this;
76  }
77  cachedCount(value: number): this {
78    modifierWithKey(this._modifiersWithKeys, SwiperCachedCountModifier.identity, SwiperCachedCountModifier, value);
79    return this;
80  }
81  displayCount(value: string | number | SwiperAutoFill, swipeByGroup?: boolean | undefined): this {
82    let arkDisplayCount = new ArkDisplayCount();
83    arkDisplayCount.value = value;
84    arkDisplayCount.swipeByGroup = swipeByGroup;
85    modifierWithKey(
86      this._modifiersWithKeys,
87      SwiperDisplayCountModifier.identity,
88      SwiperDisplayCountModifier,
89      arkDisplayCount
90    );
91    return this;
92  }
93  effectMode(value: EdgeEffect): this {
94    modifierWithKey(this._modifiersWithKeys, SwiperEffectModeModifier.identity, SwiperEffectModeModifier, value);
95    return this;
96  }
97  disableSwipe(value: boolean): this {
98    modifierWithKey(this._modifiersWithKeys, SwiperDisableSwipeModifier.identity, SwiperDisableSwipeModifier, value);
99    return this;
100  }
101
102  curve(value: string | Curve | ICurve): this {
103    modifierWithKey(this._modifiersWithKeys, SwiperCurveModifier.identity, SwiperCurveModifier, value);
104    return this;
105  }
106  onChange(event: (index: number) => void): this {
107    modifierWithKey(this._modifiersWithKeys, SwiperOnChangeModifier.identity, SwiperOnChangeModifier, event);
108    return this;
109  }
110  indicatorStyle(value?: IndicatorStyle | undefined): this {
111    throw new Error('Method not implemented.');
112  }
113  prevMargin(value: Length): this {
114    modifierWithKey(this._modifiersWithKeys, SwiperPrevMarginModifier.identity, SwiperPrevMarginModifier, value);
115    return this;
116  }
117  nextMargin(value: Length): this {
118    modifierWithKey(this._modifiersWithKeys, SwiperNextMarginModifier.identity, SwiperNextMarginModifier, value);
119    return this;
120  }
121  enabled(value: boolean): this {
122    modifierWithKey(this._modifiersWithKeys, SwiperEnabledModifier.identity, SwiperEnabledModifier, value);
123    return this;
124  }
125  onAnimationStart(event: (index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => void): this {
126    modifierWithKey(this._modifiersWithKeys, SwiperOnAnimationStartModifier.identity, SwiperOnAnimationStartModifier, event);
127    return this;
128  }
129  onAnimationEnd(event: (index: number, extraInfo: SwiperAnimationEvent) => void): this {
130    modifierWithKey(this._modifiersWithKeys, SwiperOnAnimationEndModifier.identity, SwiperOnAnimationEndModifier, event);
131    return this;
132  }
133  onGestureSwipe(event: (index: number, extraInfo: SwiperAnimationEvent) => void): this {
134    modifierWithKey(this._modifiersWithKeys, SwiperOnGestureSwipeModifier.identity, SwiperOnGestureSwipeModifier, event);
135    return this;
136  }
137  nestedScroll(value: SwiperNestedScrollMode): this {
138    modifierWithKey(this._modifiersWithKeys, SwiperNestedScrollModifier.identity, SwiperNestedScrollModifier, value);
139    return this;
140  }
141  indicatorInteractive(value: boolean): this {
142    modifierWithKey(this._modifiersWithKeys, SwiperIndicatorInteractiveModifier.identity, SwiperIndicatorInteractiveModifier, value);
143    return this;
144  }
145  customContentTransition(transition: SwiperContentAnimatedTransition): this {
146    modifierWithKey(this._modifiersWithKeys, SwiperCustomContentTransitionModifier.identity, SwiperCustomContentTransitionModifier, transition);
147    return this;
148  }
149  onContentDidScroll(handler: ContentDidScrollCallback): this {
150    modifierWithKey(this._modifiersWithKeys, SwiperOnContentDidScrollModifier.identity, SwiperOnContentDidScrollModifier, handler);
151    return this;
152  }
153}
154class SwiperInitializeModifier extends ModifierWithKey<SwiperController> {
155  static identity: Symbol = Symbol('swiperInitialize');
156  applyPeer(node: KNode, reset: boolean): void {
157    if (reset) {
158      getUINativeModule().swiper.resetSwiperInitialize(node);
159    } else {
160      getUINativeModule().swiper.setSwiperInitialize(node, this.value);
161    }
162  }
163}
164class SwiperNextMarginModifier extends ModifierWithKey<Length> {
165  static identity: Symbol = Symbol('swiperNextMargin');
166  applyPeer(node: KNode, reset: boolean): void {
167    if (reset) {
168      getUINativeModule().swiper.resetSwiperNextMargin(node);
169    } else {
170      getUINativeModule().swiper.setSwiperNextMargin(node, this.value);
171    }
172  }
173  checkObjectDiff(): boolean {
174    return !isBaseOrResourceEqual(this.stageValue, this.value);
175  }
176}
177class SwiperPrevMarginModifier extends ModifierWithKey<Length> {
178  static identity: Symbol = Symbol('swiperPrevMargin');
179  applyPeer(node: KNode, reset: boolean): void {
180    if (reset) {
181      getUINativeModule().swiper.resetSwiperPrevMargin(node);
182    } else {
183      getUINativeModule().swiper.setSwiperPrevMargin(node, this.value);
184    }
185  }
186  checkObjectDiff(): boolean {
187    return !isBaseOrResourceEqual(this.stageValue, this.value);
188  }
189}
190
191class SwiperDisplayCountModifier extends ModifierWithKey<ArkDisplayCount> {
192  static identity: Symbol = Symbol('swiperDisplayCount');
193  applyPeer(node: KNode, reset: boolean): void {
194    if (reset) {
195      getUINativeModule().swiper.resetSwiperSwipeByGroup(node);
196      getUINativeModule().swiper.resetSwiperDisplayCount(node);
197    } else {
198      if (!isNull(this.value) && !isUndefined(this.value)) {
199        let swipeByGroup;
200        if (typeof this.value.swipeByGroup === 'boolean') {
201          swipeByGroup = this.value.swipeByGroup;
202        }
203
204        getUINativeModule().swiper.setSwiperSwipeByGroup(node, swipeByGroup);
205
206        if (typeof this.value.value === 'object') {
207          let minSize = (this.value.value as SwiperAutoFill).minSize.toString();
208          getUINativeModule().swiper.setSwiperDisplayCount(node, minSize, typeof this.value.value);
209        } else {
210          getUINativeModule().swiper.setSwiperDisplayCount(node, this.value.value, typeof this.value.value);
211        }
212      } else {
213        getUINativeModule().swiper.resetSwiperSwipeByGroup(node);
214        getUINativeModule().swiper.resetSwiperDisplayCount(node);
215      }
216    }
217  }
218  checkObjectDiff(): boolean {
219    if (
220      this.stageValue.swipeByGroup !== this.value.swipeByGroup ||
221      typeof this.stageValue.value !== typeof this.value.value
222    ) {
223      return true;
224    } else if (
225      typeof this.stageValue.value === 'object' &&
226      typeof this.value.value === 'object'
227    ) {
228      return (this.stageValue.value as SwiperAutoFill).minSize !== (this.value.value as SwiperAutoFill).minSize;
229    } else {
230      return !isBaseOrResourceEqual(this.stageValue.value, this.value.value);
231    }
232  }
233}
234
235class SwiperDisplayArrowModifier extends ModifierWithKey<ArkDisplayArrow> {
236  static identity: Symbol = Symbol('swiperDisplayArrow');
237  applyPeer(node: KNode, reset: boolean): void {
238    if (reset) {
239      getUINativeModule().swiper.resetSwiperDisplayArrow(node);
240    } else {
241      if (!isNull(this.value.value) && !isUndefined(this.value.value) && typeof this.value === 'object') {
242        let displayArrowValue = 3;
243        let showBackground;
244        let isSidebarMiddle;
245        let backgroundSize;
246        let backgroundColor;
247        let arrowSize;
248        let arrowColor;
249        if (typeof this.value.value === 'boolean') {
250          if (this.value.value) {
251            displayArrowValue = 1;
252          } else {
253            displayArrowValue = 0;
254          }
255        } else if (typeof this.value.value === 'object') {
256          displayArrowValue = 2;
257          showBackground = this.value.value.showBackground;
258          isSidebarMiddle = this.value.value.isSidebarMiddle;
259          backgroundSize = this.value.value.backgroundSize;
260          backgroundColor = this.value.value.backgroundColor;
261          arrowSize = this.value.value.arrowSize;
262          arrowColor = this.value.value.arrowColor;
263        }
264        let isHoverShow;
265        if (typeof this.value.isHoverShow === 'boolean') {
266          isHoverShow = this.value.isHoverShow;
267        }
268        getUINativeModule().swiper.setSwiperDisplayArrow(
269          node,
270          displayArrowValue,
271          showBackground,
272          isSidebarMiddle,
273          backgroundSize,
274          backgroundColor,
275          arrowSize,
276          arrowColor,
277          isHoverShow
278        );
279      } else {
280        getUINativeModule().swiper.resetSwiperDisplayArrow(node);
281      }
282    }
283  }
284  checkObjectDiff(): boolean {
285    if (
286      this.stageValue.isHoverShow !== this.value.isHoverShow ||
287      typeof this.stageValue.value !== typeof this.value.value
288    ) {
289      return true;
290    }
291    if (
292      typeof this.stageValue.value === 'boolean' &&
293      typeof this.value.value === 'boolean' &&
294      this.stageValue.value !== this.value.value
295    ) {
296      return true;
297    } else if (typeof this.stageValue.value === 'object' && typeof this.value.value === 'object') {
298      return (
299        !isBaseOrResourceEqual(
300          (this.stageValue.value as ArrowStyle).showBackground,
301          (this.value.value as ArrowStyle).showBackground
302        ) ||
303        !isBaseOrResourceEqual(
304          (this.stageValue.value as ArrowStyle).isSidebarMiddle,
305          (this.value.value as ArrowStyle).isSidebarMiddle
306        ) ||
307        !isBaseOrResourceEqual(
308          (this.stageValue.value as ArrowStyle).backgroundSize,
309          (this.value.value as ArrowStyle).backgroundSize
310        ) ||
311        !isBaseOrResourceEqual(
312          (this.stageValue.value as ArrowStyle).backgroundColor,
313          (this.value.value as ArrowStyle).backgroundColor
314        ) ||
315        !isBaseOrResourceEqual(
316          (this.stageValue.value as ArrowStyle).arrowSize,
317          (this.value.value as ArrowStyle).arrowSize
318        ) ||
319        !isBaseOrResourceEqual(
320          (this.stageValue.value as ArrowStyle).arrowColor,
321          (this.value.value as ArrowStyle).arrowColor
322        )
323      );
324    } else {
325      return true;
326    }
327  }
328}
329
330class SwiperIndicatorModifier extends ModifierWithKey<boolean | DotIndicator | DigitIndicator> {
331  static identity: Symbol = Symbol('swiperIndicator');
332  applyPeer(node: KNode, reset: boolean): void {
333    if (reset) {
334      getUINativeModule().swiper.resetSwiperIndicator(node);
335    } else {
336      let left;
337      let top;
338      let right;
339      let bottom;
340      let itemWidth;
341      let itemHeight;
342      let selectedItemWidth;
343      let selectedItemHeight;
344      let mask;
345      let color;
346      let selectedColor;
347      let maxDisplayCount;
348      let fontColor;
349      let selectedFontColor;
350      let digitFontSize;
351      let digitFontWeight;
352      let selectedDigitFontSize;
353      let selectedDigitFontWeight;
354      if (typeof this.value === 'boolean') {
355        getUINativeModule().swiper.setSwiperIndicator(node, 'boolean', this.value);
356      } else if (typeof this.value === 'object' && (this.value as ArkDotIndicator).type === 'DotIndicator') {
357        left = (this.value as ArkDotIndicator).leftValue;
358        top = (this.value as ArkDotIndicator).topValue;
359        right = (this.value as ArkDotIndicator).rightValue;
360        bottom = (this.value as ArkDotIndicator).bottomValue;
361        itemWidth = (this.value as ArkDotIndicator).itemWidthValue;
362        itemHeight = (this.value as ArkDotIndicator).itemHeightValue;
363        selectedItemWidth = (this.value as ArkDotIndicator).selectedItemWidthValue;
364        selectedItemHeight = (this.value as ArkDotIndicator).selectedItemHeightValue;
365        mask = (this.value as ArkDotIndicator).maskValue;
366        color = (this.value as ArkDotIndicator).colorValue;
367        selectedColor = (this.value as ArkDotIndicator).selectedColorValue;
368        maxDisplayCount = (this.value as ArkDotIndicator).maxDisplayCountValue;
369        getUINativeModule().swiper.setSwiperIndicator(
370          node,
371          'ArkDotIndicator',
372          itemWidth,
373          itemHeight,
374          selectedItemWidth,
375          selectedItemHeight,
376          mask,
377          color,
378          selectedColor,
379          maxDisplayCount,
380          left,
381          top,
382          right,
383          bottom
384        );
385      } else if (typeof this.value === 'object' && (this.value as ArkDigitIndicator).type === 'DigitIndicator') {
386        left = (this.value as ArkDigitIndicator).leftValue;
387        top = (this.value as ArkDigitIndicator).topValue;
388        right = (this.value as ArkDigitIndicator).rightValue;
389        bottom = (this.value as ArkDigitIndicator).bottomValue;
390        fontColor = (this.value as ArkDigitIndicator).fontColorValue;
391        selectedFontColor = (this.value as ArkDigitIndicator).selectedFontColorValue;
392        let arkDigitFont = new ArkDigitFont();
393        if (typeof (this.value as ArkDigitIndicator).digitFontValue === 'object') {
394          digitFontSize = ((this.value as ArkDigitIndicator).digitFontValue as Font).size;
395          digitFontWeight = arkDigitFont.parseFontWeight(
396            ((this.value as ArkDigitIndicator).digitFontValue as Font).weight
397          );
398        }
399        if (typeof (this.value as ArkDigitIndicator).selectedDigitFontValue === 'object') {
400          selectedDigitFontSize = ((this.value as ArkDigitIndicator).selectedDigitFontValue as Font).size;
401          selectedDigitFontWeight = arkDigitFont.parseFontWeight(
402            ((this.value as ArkDigitIndicator).selectedDigitFontValue as Font).weight
403          );
404        }
405        getUINativeModule().swiper.setSwiperIndicator(
406          node,
407          'ArkDigitIndicator',
408          fontColor,
409          selectedFontColor,
410          digitFontSize,
411          digitFontWeight,
412          selectedDigitFontSize,
413          selectedDigitFontWeight,
414          left,
415          top,
416          right,
417          bottom
418        );
419      } else {
420        getUINativeModule().swiper.setSwiperIndicator(node, 'boolean', true);
421      }
422    }
423  }
424  checkObjectDiff(): boolean {
425    if (typeof this.stageValue !== typeof this.value) {
426      return true;
427    }
428    if (typeof this.stageValue === 'boolean' && typeof this.value === 'boolean') {
429      return this.stageValue !== this.value;
430    }
431    if (this.stageValue instanceof ArkDotIndicator && this.value instanceof ArkDotIndicator) {
432      return (
433        !isBaseOrResourceEqual(
434          (this.stageValue as ArkDotIndicator).itemWidthValue,
435          (this.value as ArkDotIndicator).itemWidthValue
436        ) ||
437        !isBaseOrResourceEqual(
438          (this.stageValue as ArkDotIndicator).itemHeightValue,
439          (this.value as ArkDotIndicator).itemHeightValue
440        ) ||
441        !isBaseOrResourceEqual(
442          (this.stageValue as ArkDotIndicator).selectedItemWidthValue,
443          (this.value as ArkDotIndicator).selectedItemWidthValue
444        ) ||
445        !isBaseOrResourceEqual(
446          (this.stageValue as ArkDotIndicator).selectedItemHeightValue,
447          (this.value as ArkDotIndicator).selectedItemHeightValue
448        ) ||
449        !isBaseOrResourceEqual(
450          (this.stageValue as ArkDotIndicator).maskValue,
451          (this.value as ArkDotIndicator).maskValue
452        ) ||
453        !isBaseOrResourceEqual(
454          (this.stageValue as ArkDotIndicator).colorValue,
455          (this.value as ArkDotIndicator).colorValue
456        ) ||
457        !isBaseOrResourceEqual(
458          (this.stageValue as ArkDotIndicator).selectedColorValue,
459          (this.value as ArkDotIndicator).selectedColorValue
460        ) ||
461        !isBaseOrResourceEqual(
462          (this.stageValue as ArkDotIndicator).maxDisplayCountValue,
463          (this.value as ArkDotIndicator).maxDisplayCountValue
464        )
465      );
466    } else if (this.stageValue instanceof ArkDigitIndicator && this.value instanceof ArkDigitIndicator) {
467      return (
468        !isBaseOrResourceEqual(
469          (this.stageValue as ArkDigitIndicator).fontColorValue,
470          (this.value as ArkDigitIndicator).fontColorValue
471        ) ||
472        !isBaseOrResourceEqual(
473          (this.stageValue as ArkDigitIndicator).selectedFontColorValue,
474          (this.value as ArkDigitIndicator).selectedFontColorValue
475        ) ||
476        !isBaseOrResourceEqual(
477          ((this.stageValue as ArkDigitIndicator).digitFontValue as Font).size,
478          ((this.value as ArkDigitIndicator).digitFontValue as Font).size
479        ) ||
480        !isBaseOrResourceEqual(
481          ((this.stageValue as ArkDigitIndicator).digitFontValue as Font).weight,
482          ((this.value as ArkDigitIndicator).digitFontValue as Font).weight
483        ) ||
484        !isBaseOrResourceEqual(
485          ((this.stageValue as ArkDigitIndicator).selectedDigitFontValue as Font).size,
486          ((this.value as ArkDigitIndicator).selectedDigitFontValue as Font).size
487        ) ||
488        !isBaseOrResourceEqual(
489          ((this.stageValue as ArkDigitIndicator).selectedDigitFontValue as Font).weight,
490          ((this.value as ArkDigitIndicator).selectedDigitFontValue as Font).weight
491        )
492      );
493    } else {
494      return true;
495    }
496  }
497}
498
499class SwiperCurveModifier extends ModifierWithKey<string | Curve | ICurve> {
500  static identity: Symbol = Symbol('swiperCurve');
501  applyPeer(node: KNode, reset: boolean): void {
502    if (reset) {
503      getUINativeModule().swiper.resetSwiperCurve(node);
504    } else {
505      const curveMap = {
506        [0]: 'linear',
507        [1]: 'ease',
508        [2]: 'ease-in',
509        [3]: 'ease-out',
510        [4]: 'ease-in-out',
511        [5]: 'fast-out-slow-in',
512        [6]: 'linear-out-slow-in',
513        [7]: 'fast-out-linear-in',
514        [8]: 'extreme-deceleration',
515        [9]: 'sharp',
516        [10]: 'rhythm',
517        [11]: 'smooth',
518        [12]: 'friction'
519      };
520      if (typeof this.value === 'number') {
521        if (this.value in curveMap) {
522          this.value = curveMap[this.value];
523        } else {
524          this.value = this.value.toString();
525        }
526      }
527      getUINativeModule().swiper.setSwiperCurve(node, this.value);
528    }
529  }
530  checkObjectDiff(): boolean {
531    return !isBaseOrResourceEqual(this.stageValue, this.value);
532  }
533}
534class SwiperOnChangeModifier extends ModifierWithKey<Callback<number>> {
535  constructor(value: Callback<number>) {
536    super(value);
537  }
538  static identity: Symbol = Symbol('swiperOnChange');
539  applyPeer(node: KNode, reset: boolean): void {
540    if (reset) {
541      getUINativeModule().swiper.resetSwiperOnChange(node);
542    } else {
543      getUINativeModule().swiper.setSwiperOnChange(node, this.value);
544    }
545  }
546}
547class SwiperDisableSwipeModifier extends ModifierWithKey<boolean> {
548  static identity: Symbol = Symbol('swiperDisableSwipe');
549  applyPeer(node: KNode, reset: boolean): void {
550    if (reset) {
551      getUINativeModule().swiper.resetSwiperDisableSwipe(node);
552    } else {
553      getUINativeModule().swiper.setSwiperDisableSwipe(node, this.value);
554    }
555  }
556  checkObjectDiff(): boolean {
557    return !isBaseOrResourceEqual(this.stageValue, this.value);
558  }
559}
560class SwiperEffectModeModifier extends ModifierWithKey<EdgeEffect> {
561  static identity: Symbol = Symbol('swiperEffectMode');
562  applyPeer(node: KNode, reset: boolean): void {
563    if (reset) {
564      getUINativeModule().swiper.resetSwiperEffectMode(node);
565    } else {
566      getUINativeModule().swiper.setSwiperEffectMode(node, this.value);
567    }
568  }
569  checkObjectDiff(): boolean {
570    return !isBaseOrResourceEqual(this.stageValue, this.value);
571  }
572}
573class SwiperCachedCountModifier extends ModifierWithKey<number> {
574  static identity: Symbol = Symbol('swiperCachedCount');
575  applyPeer(node: KNode, reset: boolean): void {
576    if (reset) {
577      getUINativeModule().swiper.resetSwiperCachedCount(node);
578    } else {
579      getUINativeModule().swiper.setSwiperCachedCount(node, this.value);
580    }
581  }
582  checkObjectDiff(): boolean {
583    return !isBaseOrResourceEqual(this.stageValue, this.value);
584  }
585}
586class SwiperDisplayModeModifier extends ModifierWithKey<number> {
587  static identity: Symbol = Symbol('swiperDisplayMode');
588  applyPeer(node: KNode, reset: boolean): void {
589    if (reset) {
590      getUINativeModule().swiper.resetSwiperDisplayMode(node);
591    } else {
592      getUINativeModule().swiper.setSwiperDisplayMode(node, this.value);
593    }
594  }
595  checkObjectDiff(): boolean {
596    return !isBaseOrResourceEqual(this.stageValue, this.value);
597  }
598}
599class SwiperItemSpaceModifier extends ModifierWithKey<string | number> {
600  static identity: Symbol = Symbol('swiperItemSpace');
601  applyPeer(node: KNode, reset: boolean): void {
602    if (reset) {
603      getUINativeModule().swiper.resetSwiperItemSpace(node);
604    } else {
605      getUINativeModule().swiper.setSwiperItemSpace(node, this.value);
606    }
607  }
608  checkObjectDiff(): boolean {
609    return !isBaseOrResourceEqual(this.stageValue, this.value);
610  }
611}
612class SwiperVerticalModifier extends ModifierWithKey<boolean> {
613  static identity: Symbol = Symbol('swiperVertical');
614  applyPeer(node: KNode, reset: boolean): void {
615    if (reset) {
616      getUINativeModule().swiper.resetSwiperVertical(node);
617    } else {
618      getUINativeModule().swiper.setSwiperVertical(node, this.value);
619    }
620  }
621  checkObjectDiff(): boolean {
622    return !isBaseOrResourceEqual(this.stageValue, this.value);
623  }
624}
625class SwiperLoopModifier extends ModifierWithKey<boolean> {
626  static identity: Symbol = Symbol('swiperLoop');
627  applyPeer(node: KNode, reset: boolean): void {
628    if (reset) {
629      getUINativeModule().swiper.resetSwiperLoop(node);
630    } else {
631      getUINativeModule().swiper.setSwiperLoop(node, this.value);
632    }
633  }
634  checkObjectDiff(): boolean {
635    return !isBaseOrResourceEqual(this.stageValue, this.value);
636  }
637}
638class SwiperIntervalModifier extends ModifierWithKey<number> {
639  static identity: Symbol = Symbol('swiperInterval');
640  applyPeer(node: KNode, reset: boolean): void {
641    if (reset) {
642      getUINativeModule().swiper.resetSwiperInterval(node);
643    } else {
644      getUINativeModule().swiper.setSwiperInterval(node, this.value);
645    }
646  }
647  checkObjectDiff(): boolean {
648    return !isBaseOrResourceEqual(this.stageValue, this.value);
649  }
650}
651class SwiperAutoPlayModifier extends ModifierWithKey<boolean> {
652  static identity: Symbol = Symbol('swiperAutoPlay');
653  applyPeer(node: KNode, reset: boolean): void {
654    if (reset) {
655      getUINativeModule().swiper.resetSwiperAutoPlay(node);
656    } else {
657      getUINativeModule().swiper.setSwiperAutoPlay(node, this.value);
658    }
659  }
660  checkObjectDiff(): boolean {
661    return !isBaseOrResourceEqual(this.stageValue, this.value);
662  }
663}
664class SwiperIndexModifier extends ModifierWithKey<number> {
665  static identity: Symbol = Symbol('swiperIndex');
666  applyPeer(node: KNode, reset: boolean): void {
667    if (reset) {
668      getUINativeModule().swiper.resetSwiperIndex(node);
669    } else {
670      getUINativeModule().swiper.setSwiperIndex(node, this.value);
671    }
672  }
673  checkObjectDiff(): boolean {
674    return !isBaseOrResourceEqual(this.stageValue, this.value);
675  }
676}
677class SwiperDurationModifier extends ModifierWithKey<number> {
678  static identity: Symbol = Symbol('swiperDuration');
679  applyPeer(node: KNode, reset: boolean): void {
680    if (reset) {
681      getUINativeModule().swiper.resetSwiperDuration(node);
682    } else {
683      getUINativeModule().swiper.setSwiperDuration(node, this.value);
684    }
685  }
686  checkObjectDiff(): boolean {
687    return !isBaseOrResourceEqual(this.stageValue, this.value);
688  }
689}
690
691class SwiperEnabledModifier extends ModifierWithKey<boolean> {
692  constructor(value: boolean) {
693    super(value);
694  }
695  static identity: Symbol = Symbol('swiperenabled');
696  applyPeer(node: KNode, reset: boolean): void {
697    if (reset) {
698      getUINativeModule().swiper.resetSwiperEnabled(node);
699
700    } else {
701      getUINativeModule().swiper.setSwiperEnabled(node, this.value);
702    }
703  }
704}
705
706class SwiperNestedScrollModifier extends ModifierWithKey<SwiperNestedScrollMode> {
707  constructor(value: SwiperNestedScrollMode) {
708    super(value);
709  }
710  static identity: Symbol = Symbol('nestedScroll');
711  applyPeer(node: KNode, reset: boolean): void {
712    if (reset) {
713      getUINativeModule().swiper.resetNestedScroll(node);
714    } else {
715      getUINativeModule().swiper.setNestedScroll(node, this.value);
716    }
717  }
718  checkObjectDiff(): boolean {
719    return !isBaseOrResourceEqual(this.stageValue, this.value);
720  }
721}
722class SwiperOnAnimationStartModifier extends ModifierWithKey<(index: number, targetIndex: number,
723    extraInfo: SwiperAnimationEvent) => void> {
724  constructor(value: (index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => void) {
725    super(value);
726  }
727  static identity: Symbol = Symbol('swiperOnAnimationStart');
728  applyPeer(node: KNode, reset: boolean): void {
729    if (reset) {
730      getUINativeModule().swiper.resetSwiperOnAnimationStart(node);
731    } else {
732      getUINativeModule().swiper.setSwiperOnAnimationStart(node, this.value);
733    }
734  }
735}
736class SwiperOnAnimationEndModifier extends ModifierWithKey<Callback<number, SwiperAnimationEvent>> {
737  constructor(value: Callback<number, SwiperAnimationEvent>) {
738    super(value);
739  }
740  static identity: Symbol = Symbol('swiperOnAnimationEnd');
741  applyPeer(node: KNode, reset: boolean): void {
742    if (reset) {
743      getUINativeModule().swiper.resetSwiperOnAnimationEnd(node);
744    } else {
745      getUINativeModule().swiper.setSwiperOnAnimationEnd(node, this.value);
746    }
747  }
748}
749class SwiperOnGestureSwipeModifier extends ModifierWithKey<Callback<number, SwiperAnimationEvent>> {
750  constructor(value: Callback<number, SwiperAnimationEvent>) {
751    super(value);
752  }
753  static identity: Symbol = Symbol('swiperOnGestureSwipe');
754  applyPeer(node: KNode, reset: boolean): void {
755    if (reset) {
756      getUINativeModule().swiper.resetSwiperOnGestureSwipe(node);
757    } else {
758      getUINativeModule().swiper.setSwiperOnGestureSwipe(node, this.value);
759    }
760  }
761}
762class SwiperIndicatorInteractiveModifier extends ModifierWithKey<boolean> {
763  constructor(value: boolean) {
764    super(value);
765  }
766  static identity: Symbol = Symbol('indicatorInteractive');
767  applyPeer(node: KNode, reset: boolean): void {
768    if (reset) {
769      getUINativeModule().swiper.resetIndicatorInteractive(node);
770    } else {
771      getUINativeModule().swiper.setIndicatorInteractive(node, this.value);
772    }
773  }
774}
775class SwiperCustomContentTransitionModifier extends ModifierWithKey<SwiperContentAnimatedTransition> {
776  constructor(value: SwiperContentAnimatedTransition) {
777    super(value);
778  }
779  static identity: Symbol = Symbol('swiperCustomContentTransition');
780  applyPeer(node: KNode, reset: boolean): void {
781    if (reset) {
782      getUINativeModule().swiper.resetSwiperCustomContentTransition(node);
783    } else {
784      getUINativeModule().swiper.setSwiperCustomContentTransition(node, this.value);
785    }
786  }
787  checkObjectDiff(): boolean {
788    return !isBaseOrResourceEqual(this.stageValue, this.value);
789  }
790}
791class SwiperOnContentDidScrollModifier extends ModifierWithKey<(selectedIndex: number, index: number,
792  position: number, mainAxisLength: number) => void> {
793  constructor(value: (selectedIndex: number, index: number, position: number, mainAxisLength: number) => void) {
794    super(value);
795  }
796  static identity: Symbol = Symbol('swiperOnContentDidScroll');
797  applyPeer(node: KNode, reset: boolean): void {
798    if (reset) {
799      getUINativeModule().swiper.resetSwiperOnContentDidScroll(node);
800    } else {
801      getUINativeModule().swiper.setSwiperOnContentDidScroll(node, this.value);
802    }
803  }
804  checkObjectDiff(): boolean {
805    return !isBaseOrResourceEqual(this.stageValue, this.value);
806  }
807}
808// @ts-ignore
809globalThis.Swiper.attributeModifier = function (modifier: ArkComponent): void {
810  attributeModifierFunc.call(this, modifier, (nativePtr: KNode) => {
811    return new ArkSwiperComponent(nativePtr);
812  }, (nativePtr: KNode, classType: ModifierType, modifierJS: ModifierJS) => {
813    return new modifierJS.SwiperModifier(nativePtr, classType);
814  });
815};
816