• 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' />
17
18class SearchSelectionMenuHiddenModifier extends ModifierWithKey<boolean> {
19  constructor(value: boolean) {
20    super(value);
21  }
22  static identity = Symbol('searchSelectionMenuHidden');
23  applyPeer(node: KNode, reset: boolean): void {
24    if (reset) {
25      getUINativeModule().search.resetSelectionMenuHidden(node);
26    } else {
27      getUINativeModule().search.setSelectionMenuHidden(node, this.value!);
28    }
29  }
30  checkObjectDiff(): boolean {
31    return this.stageValue !== this.value;
32  }
33}
34
35class SearchCaretStyleModifier extends ModifierWithKey<CaretStyle> {
36  constructor(value: CaretStyle) {
37    super(value);
38  }
39  static identity = Symbol('searchCaretStyle');
40  applyPeer(node: KNode, reset: boolean): void {
41    if (reset) {
42      getUINativeModule().search.resetCaretStyle(node);
43    } else {
44      getUINativeModule().search.setCaretStyle(node, this.value.width,
45        this.value.color);
46    }
47  }
48  checkObjectDiff(): boolean {
49    return !isBaseOrResourceEqual(this.stageValue.width, this.value.width) ||
50      !isBaseOrResourceEqual(this.stageValue.color, this.value.color);
51  }
52}
53
54class SearchEnableKeyboardOnFocusModifier extends ModifierWithKey<boolean> {
55  constructor(value: boolean) {
56    super(value);
57  }
58  static identity = Symbol('searchEnableKeyboardOnFocus');
59  applyPeer(node: KNode, reset: boolean): void {
60    if (reset) {
61      getUINativeModule().search.resetEnableKeyboardOnFocus(node);
62    } else {
63      getUINativeModule().search.setEnableKeyboardOnFocus(node, this.value!);
64    }
65  }
66  checkObjectDiff(): boolean {
67    return this.stageValue !== this.value;
68  }
69}
70
71class SearchSearchIconModifier extends ModifierWithKey<IconOptions> {
72  constructor(value: IconOptions) {
73    super(value);
74  }
75  static identity = Symbol('searchSearchIcon');
76  applyPeer(node: KNode, reset: boolean): void {
77    if (reset) {
78      getUINativeModule().search.resetSearchIcon(node);
79    } else {
80      getUINativeModule().search.setSearchIcon(node, this.value.size,
81        this.value.color, this.value.src);
82    }
83  }
84  checkObjectDiff(): boolean {
85    return !isBaseOrResourceEqual(this.stageValue.size, this.value.size) ||
86      !isBaseOrResourceEqual(this.stageValue.color, this.value.color) ||
87      !isBaseOrResourceEqual(this.stageValue.src, this.value.src);
88  }
89}
90
91class SearchPlaceholderFontModifier extends ModifierWithKey<Font> {
92  constructor(value: Font) {
93    super(value);
94  }
95  static identity = Symbol('searchPlaceholderFont');
96  applyPeer(node: KNode, reset: boolean): void {
97    if (reset) {
98      getUINativeModule().search.resetPlaceholderFont(node);
99    } else {
100      getUINativeModule().search.setPlaceholderFont(node, this.value.size,
101        this.value.weight, this.value.family, this.value.style);
102    }
103  }
104  checkObjectDiff(): boolean {
105    return this.stageValue.weight !== this.value.weight ||
106      this.stageValue.style !== this.value.style ||
107      !isBaseOrResourceEqual(this.stageValue.size, this.value.size) ||
108      !isBaseOrResourceEqual(this.stageValue.family, this.value.family);
109  }
110}
111
112class SearchSearchButtonModifier extends ModifierWithKey<ArkSearchButton> {
113  constructor(value: ArkSearchButton) {
114    super(value);
115  }
116  static identity = Symbol('searchSearchButton');
117  applyPeer(node: KNode, reset: boolean): void {
118    if (reset) {
119      getUINativeModule().search.resetSearchButton(node);
120    } else {
121      getUINativeModule().search.setSearchButton(node, this.value.value,
122        this.value.fontSize, this.value.fontColor, this.value.autoDisable);
123    }
124  }
125  checkObjectDiff(): boolean {
126    return this.stageValue.value !== this.value.value ||
127      !isBaseOrResourceEqual(this.stageValue.fontSize, this.value.fontSize) ||
128      !isBaseOrResourceEqual(this.stageValue.fontColor, this.value.fontColor) ||
129      !isBaseOrResourceEqual(this.stageValue.autoDisable, this.value.autoDisable);
130  }
131}
132
133class SearchFontColorModifier extends ModifierWithKey<ResourceColor> {
134  constructor(value: ResourceColor) {
135    super(value);
136  }
137  static identity = Symbol('searchFontColor');
138  applyPeer(node: KNode, reset: boolean): void {
139    if (reset) {
140      getUINativeModule().search.resetFontColor(node);
141    } else {
142      getUINativeModule().search.setFontColor(node, this.value!);
143    }
144  }
145  checkObjectDiff(): boolean {
146    return !isBaseOrResourceEqual(this.stageValue, this.value);
147  }
148}
149
150class SearchCopyOptionModifier extends ModifierWithKey<CopyOptions> {
151  constructor(value: CopyOptions) {
152    super(value);
153  }
154  static identity = Symbol('searchCopyOption');
155  applyPeer(node: KNode, reset: boolean): void {
156    if (reset) {
157      getUINativeModule().search.resetCopyOption(node);
158    } else {
159      getUINativeModule().search.setCopyOption(node, this.value!);
160    }
161  }
162  checkObjectDiff(): boolean {
163    return this.stageValue !== this.value;
164  }
165}
166
167class SearchTextFontModifier extends ModifierWithKey<Font> {
168  constructor(value: Font) {
169    super(value);
170  }
171  static identity = Symbol('searchTextFont');
172  applyPeer(node: KNode, reset: boolean): void {
173    if (reset) {
174      getUINativeModule().search.resetTextFont(node);
175    } else {
176      getUINativeModule().search.setTextFont(node, this.value.size, this.value.weight, this.value.family, this.value.style);
177    }
178  }
179  checkObjectDiff(): boolean {
180    return this.stageValue.weight !== this.value.weight ||
181      this.stageValue.style !== this.value.style ||
182      !isBaseOrResourceEqual(this.stageValue.size, this.value.size) ||
183      !isBaseOrResourceEqual(this.stageValue.family, this.value.family);
184  }
185}
186
187class SearchPlaceholderColorModifier extends ModifierWithKey<ResourceColor> {
188  constructor(value: ResourceColor) {
189    super(value);
190  }
191  static identity = Symbol('searchPlaceholderColor');
192  applyPeer(node: KNode, reset: boolean): void {
193    if (reset) {
194      getUINativeModule().search.resetPlaceholderColor(node);
195    } else {
196      getUINativeModule().search.setPlaceholderColor(node, this.value!);
197    }
198  }
199  checkObjectDiff(): boolean {
200    return !isBaseOrResourceEqual(this.stageValue, this.value);
201  }
202}
203
204class SearchCancelButtonModifier extends ModifierWithKey<{ style?: CancelButtonStyle, icon?: IconOptions }> {
205  constructor(value: { style?: CancelButtonStyle, icon?: IconOptions }) {
206    super(value);
207  }
208  static identity = Symbol('searchCancelButton');
209  applyPeer(node: KNode, reset: boolean): void {
210    if (reset) {
211      getUINativeModule().search.resetCancelButton(node);
212    } else {
213      getUINativeModule().search.setCancelButton(node, this.value.style,
214        this.value.icon?.size, this.value.icon?.color, this.value.icon?.src);
215    }
216  }
217  checkObjectDiff(): boolean {
218    return this.stageValue.style !== this.value.style ||
219      !isBaseOrResourceEqual(this.stageValue.icon?.size, this.value.icon?.size) ||
220      !isBaseOrResourceEqual(this.stageValue.icon?.color, this.value.icon?.color) ||
221      !isBaseOrResourceEqual(this.stageValue.icon?.src, this.value.icon?.src);
222  }
223}
224
225class SearchTextAlignModifier extends ModifierWithKey<TextAlign> {
226  constructor(value: TextAlign) {
227    super(value);
228  }
229  static identity = Symbol('searchTextAlign');
230  applyPeer(node: KNode, reset: boolean): void {
231    if (reset) {
232      getUINativeModule().search.resetTextAlign(node);
233    } else {
234      getUINativeModule().search.setTextAlign(node, this.value!);
235    }
236  }
237  checkObjectDiff(): boolean {
238    return this.stageValue !== this.value;
239  }
240}
241
242class SearchEnterKeyTypeModifier extends ModifierWithKey<number> {
243  constructor(value: number) {
244    super(value);
245  }
246  static identity: Symbol = Symbol('searchEnterKeyType');
247  applyPeer(node: KNode, reset: boolean): void {
248    if (reset) {
249      getUINativeModule().search.resetSearchEnterKeyType(node);
250    } else {
251      getUINativeModule().search.setSearchEnterKeyType(node, this.value);
252    }
253  }
254
255  checkObjectDiff(): boolean {
256    return !isBaseOrResourceEqual(this.stageValue, this.value);
257  }
258}
259
260class SearchHeightModifier extends ModifierWithKey<Length> {
261  constructor(value: Length) {
262    super(value);
263  }
264  static identity: Symbol = Symbol('searchHeight');
265  applyPeer(node: KNode, reset: boolean): void {
266    if (reset) {
267      getUINativeModule().search.resetSearchHeight(node);
268    } else {
269      getUINativeModule().search.setSearchHeight(node, this.value);
270    }
271  }
272
273  checkObjectDiff(): boolean {
274    return !isBaseOrResourceEqual(this.stageValue, this.value);
275  }
276}
277
278class SearchIdModifier extends ModifierWithKey<string> {
279  constructor(value: string) {
280    super(value);
281  }
282  static identity: Symbol = Symbol('searchId');
283  applyPeer(node: KNode, reset: boolean): void {
284    if (reset) {
285      getUINativeModule().search.resetSearchInspectorId(node);
286    } else {
287      getUINativeModule().search.setSearchInspectorId(node, this.value);
288    }
289  }
290
291  checkObjectDiff(): boolean {
292    return !isBaseOrResourceEqual(this.stageValue, this.value);
293  }
294}
295
296class SearchDecorationModifier extends ModifierWithKey<{ type: TextDecorationType; color?: ResourceColor; style?: TextDecorationStyle }> {
297  constructor(value: { type: TextDecorationType; color?: ResourceColor; style?: TextDecorationStyle }) {
298    super(value);
299  }
300  static identity: Symbol = Symbol('searchDecoration');
301  applyPeer(node: KNode, reset: boolean): void {
302    if (reset) {
303      getUINativeModule().search.resetDecoration(node);
304    } else {
305      getUINativeModule().search.setDecoration(node, this.value!.type, this.value!.color, this.value!.style);
306    }
307  }
308
309  checkObjectDiff(): boolean {
310    if (this.stageValue.type !== this.value.type || this.stageValue.style !== this.value.style) {
311      return true;
312    }
313    if (isResource(this.stageValue.color) && isResource(this.value.color)) {
314      return !isResourceEqual(this.stageValue.color, this.value.color);
315    } else if (!isResource(this.stageValue.color) && !isResource(this.value.color)) {
316      return !(this.stageValue.color === this.value.color);
317    } else {
318      return true;
319    }
320  }
321}
322
323class SearchLetterSpacingModifier extends ModifierWithKey<number | string> {
324  constructor(value: number | string) {
325    super(value);
326  }
327  static identity: Symbol = Symbol('searchLetterSpacing');
328  applyPeer(node: KNode, reset: boolean): void {
329    if (reset) {
330      getUINativeModule().search.resetLetterSpacing(node);
331    } else {
332      getUINativeModule().search.setLetterSpacing(node, this.value);
333    }
334  }
335
336  checkObjectDiff(): boolean {
337    return !isBaseOrResourceEqual(this.stageValue, this.value);
338  }
339}
340class SearchMinFontSizeModifier extends ModifierWithKey<number | string | Resource> {
341  constructor(value: number | string | Resource) {
342    super(value);
343  }
344  static identity: Symbol = Symbol('searchMinFontSize');
345  applyPeer(node: KNode, reset: boolean): void {
346    if (reset) {
347      getUINativeModule().search.resetSearchMinFontSize(node);
348    } else {
349      getUINativeModule().search.setSearchMinFontSize(node, this.value);
350    }
351  }
352
353  checkObjectDiff(): boolean {
354    return !isBaseOrResourceEqual(this.stageValue, this.value);
355  }
356}
357
358class SearchLineHeightModifier extends ModifierWithKey<number | string | Resource> {
359  constructor(value: number | string | Resource) {
360    super(value);
361  }
362  static identity: Symbol = Symbol('searchLineHeight');
363  applyPeer(node: KNode, reset: boolean): void {
364    if (reset) {
365      getUINativeModule().search.resetLineHeight(node);
366    } else {
367      getUINativeModule().search.setLineHeight(node, this.value);
368    }
369  }
370
371  checkObjectDiff(): boolean {
372    return !isBaseOrResourceEqual(this.stageValue, this.value);
373  }
374}
375
376class SearchHalfLeadingModifier extends ModifierWithKey<boolean> {
377  constructor(value: boolean) {
378    super(value);
379  }
380  static identity: Symbol = Symbol('searchHalfLeading');
381  applyPeer(node: KNode, reset: boolean): void {
382    if (reset) {
383      getUINativeModule().search.resetHalfLeading(node);
384    } else {
385      getUINativeModule().search.setHalfLeading(node, this.value);
386    }
387  }
388
389  checkObjectDiff(): boolean {
390    return !isBaseOrResourceEqual(this.stageValue, this.value);
391  }
392}
393
394class SearchMaxFontSizeModifier extends ModifierWithKey<number | string | Resource> {
395  constructor(value: number | string | Resource) {
396    super(value);
397  }
398  static identity: Symbol = Symbol('searchMaxFontSize');
399  applyPeer(node: KNode, reset: boolean): void {
400    if (reset) {
401      getUINativeModule().search.resetSearchMaxFontSize(node);
402    } else {
403      getUINativeModule().search.setSearchMaxFontSize(node, this.value);
404    }
405  }
406
407  checkObjectDiff(): boolean {
408    return !isBaseOrResourceEqual(this.stageValue, this.value);
409  }
410}
411
412class SearchMinFontScaleModifier extends ModifierWithKey<number | Resource> {
413  constructor(value: number | Resource) {
414    super(value);
415  }
416  static identity: Symbol = Symbol('searchMinFontScale');
417  applyPeer(node: KNode, reset: boolean): void {
418    if (reset) {
419      getUINativeModule().textArea.resetMinFontScale(node);
420    } else {
421      getUINativeModule().textArea.setMinFontScale(node, this.value!);
422    }
423  }
424
425  checkObjectDiff(): boolean {
426    return !isBaseOrResourceEqual(this.stageValue, this.value);
427  }
428}
429
430class SearchMaxFontScaleModifier extends ModifierWithKey<number | Resource> {
431  constructor(value: number | Resource) {
432    super(value);
433  }
434  static identity: Symbol = Symbol('searchMaxFontScale');
435  applyPeer(node: KNode, reset: boolean): void {
436    if (reset) {
437      getUINativeModule().textArea.resetMaxFontScale(node);
438    } else {
439      getUINativeModule().textArea.setMaxFontScale(node, this.value!);
440    }
441  }
442
443  checkObjectDiff(): boolean {
444    return !isBaseOrResourceEqual(this.stageValue, this.value);
445  }
446}
447
448class SearchFontFeatureModifier extends ModifierWithKey<FontFeature> {
449  constructor(value: FontFeature) {
450    super(value);
451  }
452  static identity: Symbol = Symbol('searchFontFeature');
453  applyPeer(node: KNode, reset: boolean): void {
454    if (reset) {
455      getUINativeModule().search.resetFontFeature(node);
456    } else {
457      getUINativeModule().search.setFontFeature(node, this.value!);
458    }
459  }
460  checkObjectDiff(): boolean {
461    return !isBaseOrResourceEqual(this.stageValue, this.value);
462  }
463}
464
465class SearchSelectedBackgroundColorModifier extends ModifierWithKey<ResourceColor> {
466  constructor(value: ResourceColor) {
467    super(value);
468  }
469  static identity: Symbol = Symbol('searchSelectedBackgroundColor');
470  applyPeer(node: KNode, reset: boolean): void {
471    if (reset) {
472      getUINativeModule().search.resetSelectedBackgroundColor(node);
473    } else {
474      getUINativeModule().search.setSelectedBackgroundColor(node, this.value!);
475    }
476  }
477  checkObjectDiff(): boolean {
478    return !isBaseOrResourceEqual(this.stageValue, this.value);
479  }
480}
481
482class SearchInputFilterModifier extends ModifierWithKey<ArkSearchInputFilter> {
483  constructor(value: ArkSearchInputFilter) {
484    super(value);
485  }
486  static identity: Symbol = Symbol('searchInputFilter');
487  applyPeer(node: KNode, reset: boolean): void {
488    if (reset) {
489      getUINativeModule().search.resetInputFilter(node);
490    } else {
491      getUINativeModule().search.setInputFilter(node, this.value.value, this.value.error);
492    }
493  }
494}
495class SearchTextIndentModifier extends ModifierWithKey<Dimension> {
496  constructor(value: Dimension) {
497    super(value);
498  }
499  static identity: Symbol = Symbol('searchTextIndent');
500  applyPeer(node: KNode, reset: boolean): void {
501    if (reset) {
502      getUINativeModule().search.resetTextIndent(node);
503    } else {
504      getUINativeModule().search.setTextIndent(node, this.value!);
505    }
506  }
507  checkObjectDiff(): boolean {
508    return !isBaseOrResourceEqual(this.stageValue, this.value);
509  }
510}
511class SearchMaxLengthModifier extends ModifierWithKey<number> {
512  constructor(value: number) {
513    super(value);
514  }
515  static identity: Symbol = Symbol('searchMaxLength');
516  applyPeer(node: KNode, reset: boolean): void {
517    if (reset) {
518      getUINativeModule().search.resetMaxLength(node);
519    } else {
520      getUINativeModule().search.setMaxLength(node, this.value!);
521    }
522  }
523  checkObjectDiff(): boolean {
524    return !isBaseOrResourceEqual(this.stageValue, this.value);
525  }
526}
527
528class SearchTypeModifier extends ModifierWithKey<number> {
529  constructor(value: number) {
530    super(value);
531  }
532  static identity: Symbol = Symbol('searchType');
533  applyPeer(node: KNode, reset: boolean): void {
534    if (reset) {
535      getUINativeModule().search.resetType(node);
536    } else {
537      getUINativeModule().search.setType(node, this.value!);
538    }
539  }
540  checkObjectDiff(): boolean {
541    return !isBaseOrResourceEqual(this.stageValue, this.value);
542  }
543}
544
545class SearchOnEditChangeModifier extends ModifierWithKey<(isEditing: boolean) => void> {
546  constructor(value: (isEditing: boolean) => void) {
547    super(value);
548  }
549  static identity = Symbol('searchOnEditChange');
550  applyPeer(node: KNode, reset: boolean): void {
551    if (reset) {
552      getUINativeModule().search.resetOnEditChange(node);
553    } else {
554      getUINativeModule().search.setOnEditChange(node, this.value);
555    }
556  }
557}
558
559class SearchOnSubmitModifier extends ModifierWithKey<(info: string, event?: SubmitEvent) => void> {
560  constructor(value: (info: string, event?: SubmitEvent) => void) {
561    super(value);
562  }
563  static identity = Symbol('searchOnSubmit');
564  applyPeer(node: KNode, reset: boolean): void {
565    if (reset) {
566      getUINativeModule().search.resetOnSubmit(node);
567    } else {
568      getUINativeModule().search.setOnSubmit(node, this.value);
569    }
570  }
571}
572
573class SearchOnCopyModifier extends ModifierWithKey<(value: string) => void> {
574  constructor(value: (value: string) => void) {
575    super(value);
576  }
577  static identity = Symbol('searchOnCopy');
578  applyPeer(node: KNode, reset: boolean): void {
579    if (reset) {
580      getUINativeModule().search.resetOnCopy(node);
581    } else {
582      getUINativeModule().search.setOnCopy(node, this.value);
583    }
584  }
585}
586
587class SearchOnCutModifier extends ModifierWithKey<(value: string) => void> {
588  constructor(value: (value: string) => void) {
589    super(value);
590  }
591  static identity = Symbol('searchOnCut');
592  applyPeer(node: KNode, reset: boolean): void {
593    if (reset) {
594      getUINativeModule().search.resetOnCut(node);
595    } else {
596      getUINativeModule().search.setOnCut(node, this.value);
597    }
598  }
599}
600
601class SearchOnPasteModifier extends ModifierWithKey<(value: string, event: PasteEvent) => void> {
602  constructor(value: (value: string, event: PasteEvent) => void) {
603    super(value);
604  }
605  static identity = Symbol('searchOnPaste');
606  applyPeer(node: KNode, reset: boolean): void {
607    if (reset) {
608      getUINativeModule().search.resetOnPaste(node);
609    } else {
610      getUINativeModule().search.setOnPaste(node, this.value);
611    }
612  }
613}
614
615class SearchOnChangeModifier extends ModifierWithKey<(value: ChangeValueInfo) => void> {
616  constructor(value: (value: ChangeValueInfo) => void) {
617    super(value);
618  }
619  static identity = Symbol('searchOnChange');
620  applyPeer(node: KNode, reset: boolean): void {
621    if (reset) {
622      getUINativeModule().search.resetOnChange(node);
623    } else {
624      getUINativeModule().search.setOnChange(node, this.value);
625    }
626  }
627}
628
629class SearchOnTextSelectionChangeModifier extends ModifierWithKey<(selectionStart: number, selectionEnd: number) => void> {
630  constructor(value: (selectionStart: number, selectionEnd: number) => void) {
631    super(value);
632  }
633  static identity = Symbol('searchOnTextSelectionChange');
634  applyPeer(node: KNode, reset: boolean): void {
635    if (reset) {
636      getUINativeModule().search.resetOnTextSelectionChange(node);
637    } else {
638      getUINativeModule().search.setOnTextSelectionChange(node, this.value);
639    }
640  }
641}
642
643class SearchOnContentScrollModifier extends ModifierWithKey<(totalOffsetX: number, totalOffsetY: number) => void> {
644  constructor(value: (totalOffsetX: number, totalOffsetY: number) => void) {
645    super(value);
646  }
647  static identity = Symbol('searchOnContentScroll');
648  applyPeer(node: KNode, reset: boolean): void {
649    if (reset) {
650      getUINativeModule().search.resetOnContentScroll(node);
651    } else {
652      getUINativeModule().search.setOnContentScroll(node, this.value);
653    }
654  }
655}
656
657class SearchShowCounterModifier extends ModifierWithKey<ArkTextFieldShowCounter> {
658  constructor(value: ArkTextFieldShowCounter) {
659    super(value);
660  }
661  static identity = Symbol('searchShowCounter');
662  applyPeer(node: KNode, reset: boolean): void {
663    if (reset) {
664      getUINativeModule().search.resetShowCounter(node);
665    }
666    else {
667      getUINativeModule().search.setShowCounter(node, this.value.value!, this.value.highlightBorder, this.value.thresholdPercentage);
668    }
669  }
670  checkObjectDiff(): boolean {
671    return !isBaseOrResourceEqual(this.stageValue.value, this.value.value) ||
672      !isBaseOrResourceEqual(this.stageValue.highlightBorder, this.value.highlightBorder) ||
673      !isBaseOrResourceEqual(this.stageValue.thresholdPercentage, this.value.thresholdPercentage);
674  }
675}
676
677class SearchInitializeModifier extends ModifierWithKey<SearchParam> {
678  constructor(value: SearchParam) {
679    super(value);
680  }
681  static identity: Symbol = Symbol('searchInitialize');
682  applyPeer(node: KNode, reset: boolean): void {
683    if (reset) {
684      getUINativeModule().search.resetSearchInitialize(node);
685    } else {
686      getUINativeModule().search.setSearchInitialize(node, this.value.value,
687        this.value.placeholder, this.value.icon, this.value.controller);
688    }
689  }
690}
691
692class SearchOnWillChangeModifier extends ModifierWithKey<Callback<ChangeValueInfo, boolean>> {
693  constructor(value: Callback<ChangeValueInfo, boolean>) {
694    super(value);
695  }
696  static identity = Symbol('searchOnWillChange');
697  applyPeer(node: KNode, reset: boolean): void {
698    if (reset) {
699      getUINativeModule().search.resetOnWillChange(node);
700    } else {
701      getUINativeModule().search.setOnWillChange(node, this.value);
702    }
703  }
704}
705
706class SearchOnWillInsertModifier extends ModifierWithKey<Callback<InsertValue, boolean>> {
707  constructor(value: Callback<InsertValue, boolean>) {
708    super(value);
709  }
710  static identity = Symbol('searchOnWillInsert');
711  applyPeer(node: KNode, reset: boolean): void {
712    if (reset) {
713      getUINativeModule().search.resetOnWillInsert(node);
714    } else {
715      getUINativeModule().search.setOnWillInsert(node, this.value);
716    }
717  }
718}
719
720class SearchOnDidInsertModifier extends ModifierWithKey<Callback<InsertValue>> {
721  constructor(value: Callback<InsertValue>) {
722    super(value);
723  }
724  static identity = Symbol('searchOnDidInsert');
725  applyPeer(node: KNode, reset: boolean): void {
726    if (reset) {
727      getUINativeModule().search.resetOnDidInsert(node);
728    } else {
729      getUINativeModule().search.setOnDidInsert(node, this.value);
730    }
731  }
732}
733
734class SearchOnWillDeleteModifier extends ModifierWithKey<Callback<DeleteValue, boolean>> {
735  constructor(value: Callback<DeleteValue, boolean>) {
736    super(value);
737  }
738  static identity = Symbol('searchOnWillDelete');
739  applyPeer(node: KNode, reset: boolean): void {
740    if (reset) {
741      getUINativeModule().search.resetOnWillDelete(node);
742    } else {
743      getUINativeModule().search.setOnWillDelete(node, this.value);
744    }
745  }
746}
747
748class SearchOnDidDeleteModifier extends ModifierWithKey<Callback<DeleteValue>> {
749  constructor(value: Callback<DeleteValue>) {
750    super(value);
751  }
752  static identity = Symbol('searchOnDidDelete');
753  applyPeer(node: KNode, reset: boolean): void {
754    if (reset) {
755      getUINativeModule().search.resetOnDidDelete(node);
756    } else {
757      getUINativeModule().search.setOnDidDelete(node, this.value);
758    }
759  }
760}
761
762class SearchEnablePreviewTextModifier extends ModifierWithKey<boolean> {
763  constructor(value: boolean) {
764    super(value);
765  }
766  static identity: Symbol = Symbol('searchEnablePreviewText');
767  applyPeer(node: KNode, reset: boolean): void {
768    if (reset) {
769      getUINativeModule().search.resetEnablePreviewText(node);
770    } else {
771      getUINativeModule().search.setEnablePreviewText(node, this.value!);
772    }
773  }
774  checkObjectDiff(): boolean {
775    return !isBaseOrResourceEqual(this.stageValue, this.value);
776  }
777}
778
779class SearchEditMenuOptionsModifier extends ModifierWithKey<EditMenuOptions> {
780  constructor(value: EditMenuOptions) {
781    super(value);
782  }
783  static identity: Symbol = Symbol('textEditMenuOptions');
784  applyPeer(node: KNode, reset: boolean): void {
785    if (reset) {
786      getUINativeModule().search.resetSelectionMenuOptions(node);
787    } else {
788      getUINativeModule().search.setSelectionMenuOptions(node, this.value);
789    }
790  }
791}
792
793class SearchEnableHapticFeedbackModifier extends ModifierWithKey<boolean> {
794  constructor(value: boolean) {
795    super(value);
796  }
797  static identity: Symbol = Symbol('searchEnableHapticFeedback');
798  applyPeer(node: KNode, reset: boolean): void {
799    if (reset) {
800      getUINativeModule().search.resetEnableHapticFeedback(node);
801    } else {
802      getUINativeModule().search.setEnableHapticFeedback(node, this.value!);
803    }
804  }
805  checkObjectDiff(): boolean {
806    return !isBaseOrResourceEqual(this.stageValue, this.value);
807  }
808}
809
810interface SearchParam {
811  value?: string;
812  placeholder?: ResourceStr;
813  icon?: string;
814  controller?: SearchController
815}
816
817class ArkSearchComponent extends ArkComponent implements CommonMethod<SearchAttribute> {
818  constructor(nativePtr: KNode, classType?: ModifierType) {
819    super(nativePtr, classType);
820  }
821  initialize(value: Object[]): SearchAttribute {
822    if (value[0] !== undefined) {
823      modifierWithKey(this._modifiersWithKeys, SearchInitializeModifier.identity,
824        SearchInitializeModifier, (value[0] as SearchParam));
825    } else {
826      modifierWithKey(this._modifiersWithKeys, SearchInitializeModifier.identity,
827        SearchInitializeModifier, null);
828    }
829    return this;
830  }
831  onEditChange(callback: (isEditing: boolean) => void): SearchAttribute {
832    modifierWithKey(this._modifiersWithKeys, SearchOnEditChangeModifier.identity,
833      SearchOnEditChangeModifier, callback);
834    return this;
835  }
836  type(value: SearchType): SearchAttribute {
837    modifierWithKey(this._modifiersWithKeys, SearchTypeModifier.identity,
838      SearchTypeModifier, value);
839    return this;
840  }
841  maxLength(value: number): SearchAttribute {
842    modifierWithKey(this._modifiersWithKeys, SearchMaxLengthModifier.identity,
843      SearchMaxLengthModifier, value);
844    return this;
845  }
846  onEditChanged(callback: (isEditing: boolean) => void): SearchAttribute {
847    modifierWithKey(this._modifiersWithKeys, SearchOnEditChangeModifier.identity,
848      SearchOnEditChangeModifier, callback);
849    return this;
850  }
851  customKeyboard(event: () => void): SearchAttribute {
852    throw new Error('Method not implemented.');
853  }
854  showUnit(event: () => void): SearchAttribute {
855    throw new Error('Method not implemented.');
856  }
857  onContentScroll(callback: (totalOffsetX: number, totalOffsetY: number) => void): SearchAttribute {
858    modifierWithKey(this._modifiersWithKeys, SearchOnContentScrollModifier.identity,
859      SearchOnContentScrollModifier, callback);
860    return this;
861  }
862  onChange(callback: (value: ChangeValueInfo) => void): SearchAttribute {
863    modifierWithKey(this._modifiersWithKeys, SearchOnChangeModifier.identity,
864      SearchOnChangeModifier, callback);
865    return this;
866  }
867  onTextSelectionChange(callback: (selectionStart: number, selectionEnd: number) => void): SearchAttribute {
868    modifierWithKey(this._modifiersWithKeys, SearchOnTextSelectionChangeModifier.identity,
869      SearchOnTextSelectionChangeModifier, callback);
870    return this;
871  }
872  onCopy(callback: (value: string) => void): SearchAttribute {
873    modifierWithKey(this._modifiersWithKeys, SearchOnCopyModifier.identity,
874      SearchOnCopyModifier, callback);
875    return this;
876  }
877  onCut(callback: (value: string) => void): SearchAttribute {
878    modifierWithKey(this._modifiersWithKeys, SearchOnCutModifier.identity,
879      SearchOnCutModifier, callback);
880    return this;
881  }
882  onSubmit(callback: (value: string, event?: SubmitEvent) => void): SearchAttribute {
883    modifierWithKey(this._modifiersWithKeys, SearchOnSubmitModifier.identity,
884      SearchOnSubmitModifier, callback);
885    return this;
886  }
887  onPaste(callback: (value: string) => void): SearchAttribute {
888    modifierWithKey(this._modifiersWithKeys, SearchOnPasteModifier.identity,
889      SearchOnPasteModifier, callback);
890    return this;
891  }
892  showCounter(value: boolean, options?: InputCounterOptions): SearchAttribute {
893    let arkValue: ArkTextFieldShowCounter = new ArkTextFieldShowCounter();
894    arkValue.value = value;
895    arkValue.highlightBorder = options?.highlightBorder;
896    arkValue.thresholdPercentage = options?.thresholdPercentage;
897    modifierWithKey(this._modifiersWithKeys, SearchShowCounterModifier.identity,
898      SearchShowCounterModifier, arkValue);
899    return this;
900  }
901  searchButton(value: string, option?: SearchButtonOptions): SearchAttribute {
902    let searchButton = new ArkSearchButton();
903    searchButton.value = value;
904    searchButton.fontColor = option?.fontColor;
905    searchButton.fontSize = option?.fontSize;
906    searchButton.autoDisable = option?.autoDisable;
907    modifierWithKey(this._modifiersWithKeys, SearchSearchButtonModifier.identity, SearchSearchButtonModifier, searchButton);
908    return this;
909  }
910  selectionMenuHidden(value: boolean): SearchAttribute {
911    modifierWithKey(this._modifiersWithKeys, SearchSelectionMenuHiddenModifier.identity, SearchSelectionMenuHiddenModifier, value);
912    return this;
913  }
914  enableKeyboardOnFocus(value: boolean): SearchAttribute {
915    modifierWithKey(this._modifiersWithKeys, SearchEnableKeyboardOnFocusModifier.identity, SearchEnableKeyboardOnFocusModifier, value);
916    return this;
917  }
918  caretStyle(value: CaretStyle): SearchAttribute {
919    modifierWithKey(this._modifiersWithKeys, SearchCaretStyleModifier.identity, SearchCaretStyleModifier, value);
920    return this;
921  }
922  cancelButton(value: { style?: CancelButtonStyle, icon?: IconOptions }): SearchAttribute {
923    modifierWithKey(this._modifiersWithKeys, SearchCancelButtonModifier.identity, SearchCancelButtonModifier, value);
924    return this;
925  }
926  searchIcon(value: IconOptions): SearchAttribute {
927    modifierWithKey(this._modifiersWithKeys, SearchSearchIconModifier.identity, SearchSearchIconModifier, value);
928    return this;
929  }
930  fontColor(value: ResourceColor): SearchAttribute {
931    modifierWithKey(this._modifiersWithKeys, SearchFontColorModifier.identity, SearchFontColorModifier, value);
932    return this;
933  }
934  placeholderColor(value: ResourceColor): SearchAttribute {
935    modifierWithKey(this._modifiersWithKeys, SearchPlaceholderColorModifier.identity, SearchPlaceholderColorModifier, value);
936    return this;
937  }
938  placeholderFont(value?: Font): SearchAttribute {
939    modifierWithKey(this._modifiersWithKeys, SearchPlaceholderFontModifier.identity, SearchPlaceholderFontModifier, value);
940    return this;
941  }
942  textFont(value?: Font): SearchAttribute {
943    modifierWithKey(this._modifiersWithKeys, SearchTextFontModifier.identity, SearchTextFontModifier, value);
944    return this;
945  }
946  copyOption(value: CopyOptions): SearchAttribute {
947    modifierWithKey(this._modifiersWithKeys, SearchCopyOptionModifier.identity, SearchCopyOptionModifier, value);
948    return this;
949  }
950  textAlign(value: TextAlign): SearchAttribute {
951    modifierWithKey(this._modifiersWithKeys, SearchTextAlignModifier.identity, SearchTextAlignModifier, value);
952    return this;
953  }
954  enterKeyType(value: EnterKeyType): SearchAttribute {
955    modifierWithKey(this._modifiersWithKeys, SearchEnterKeyTypeModifier.identity,
956      SearchEnterKeyTypeModifier, value);
957    return this;
958  }
959  fontFeature(value: FontFeature): SearchAttribute {
960    modifierWithKey(this._modifiersWithKeys, SearchFontFeatureModifier.identity, SearchFontFeatureModifier, value);
961    return this;
962  }
963  height(value: Length): this {
964    modifierWithKey(this._modifiersWithKeys, SearchHeightModifier.identity, SearchHeightModifier, value);
965    return this;
966  }
967  id(value: string): this {
968    modifierWithKey(this._modifiersWithKeys, SearchIdModifier.identity, SearchIdModifier, value);
969    return this;
970  }
971  key(value: string): this {
972    modifierWithKey(this._modifiersWithKeys, SearchIdModifier.identity, SearchIdModifier, value);
973    return this;
974  }
975  decoration(value: { type: TextDecorationType; color?: ResourceColor; style?: TextDecorationStyle }): this {
976    modifierWithKey(this._modifiersWithKeys, SearchDecorationModifier.identity, SearchDecorationModifier, value);
977    return this;
978  }
979  letterSpacing(value: number | string): this {
980    modifierWithKey(this._modifiersWithKeys, SearchLetterSpacingModifier.identity, SearchLetterSpacingModifier, value);
981    return this;
982  }
983  lineHeight(value: number | string | Resource): this {
984    modifierWithKey(this._modifiersWithKeys, SearchLineHeightModifier.identity, SearchLineHeightModifier, value);
985    return this;
986  }
987  halfLeading(value: boolean): this {
988    modifierWithKey(this._modifiersWithKeys, SearchHalfLeadingModifier.identity, SearchHalfLeadingModifier, value);
989    return this;
990  }
991  minFontSize(value: number | string | Resource): this {
992    modifierWithKey(this._modifiersWithKeys, SearchMinFontSizeModifier.identity, SearchMinFontSizeModifier, value);
993    return this;
994  }
995  maxFontSize(value: number | string | Resource): this {
996    modifierWithKey(this._modifiersWithKeys, SearchMaxFontSizeModifier.identity, SearchMaxFontSizeModifier, value);
997    return this;
998  }
999  minFontScale(value: number | Resource): this {
1000    modifierWithKey(this._modifiersWithKeys, SearchMinFontScaleModifier.identity, SearchMinFontScaleModifier, value);
1001    return this;
1002  }
1003  maxFontScale(value: number | Resource): this {
1004    modifierWithKey(this._modifiersWithKeys, SearchMaxFontScaleModifier.identity, SearchMaxFontScaleModifier, value);
1005    return this;
1006  }
1007  selectedBackgroundColor(value: ResourceColor): this {
1008    modifierWithKey(this._modifiersWithKeys, SearchSelectedBackgroundColorModifier.identity, SearchSelectedBackgroundColorModifier, value);
1009    return this;
1010  }
1011  textIndent(value: Dimension): this {
1012    modifierWithKey(this._modifiersWithKeys, SearchTextIndentModifier.identity, SearchTextIndentModifier, value);
1013    return this;
1014  }
1015  inputFilter(value: ResourceStr, error?: (value: string) => void): this {
1016    let searchInputFilter = new ArkSearchInputFilter();
1017    searchInputFilter.value = value;
1018    searchInputFilter.error = error;
1019    modifierWithKey(this._modifiersWithKeys, SearchInputFilterModifier.identity, SearchInputFilterModifier, searchInputFilter);
1020    return this;
1021  }
1022  onWillChange(callback: Callback<ChangeValueInfo, boolean>): this {
1023    modifierWithKey(this._modifiersWithKeys, SearchOnWillChangeModifier.identity, SearchOnWillChangeModifier, callback);
1024    return this;
1025  }
1026  onWillInsert(callback: Callback<InsertValue, boolean>): this {
1027    modifierWithKey(this._modifiersWithKeys, SearchOnWillInsertModifier.identity, SearchOnWillInsertModifier, callback);
1028    return this;
1029  }
1030  onDidInsert(callback: Callback<InsertValue>): this {
1031    modifierWithKey(this._modifiersWithKeys, SearchOnDidInsertModifier.identity, SearchOnDidInsertModifier, callback);
1032    return this;
1033  }
1034  onWillDelete(callback: Callback<DeleteValue, boolean>): this {
1035    modifierWithKey(this._modifiersWithKeys, SearchOnWillDeleteModifier.identity, SearchOnWillDeleteModifier, callback);
1036    return this;
1037  }
1038  onDidDelete(callback: Callback<DeleteValue>): this {
1039    modifierWithKey(this._modifiersWithKeys, SearchOnDidDeleteModifier.identity, SearchOnDidDeleteModifier, callback);
1040    return this;
1041  }
1042  enablePreviewText(value: boolean): this {
1043    modifierWithKey(this._modifiersWithKeys, SearchEnablePreviewTextModifier.identity, SearchEnablePreviewTextModifier, value);
1044    return this;
1045  }
1046  editMenuOptions(value: EditMenuOptions): this {
1047    modifierWithKey(this._modifiersWithKeys, SearchEditMenuOptionsModifier.identity,
1048      SearchEditMenuOptionsModifier, value);
1049    return this;
1050  }
1051  enableHapticFeedback(value: boolean): this {
1052    modifierWithKey(this._modifiersWithKeys, SearchEnableHapticFeedbackModifier.identity, SearchEnableHapticFeedbackModifier, value);
1053    return this;
1054  }
1055}
1056// @ts-ignore
1057globalThis.Search.attributeModifier = function (modifier: ArkComponent): void {
1058  attributeModifierFunc.call(this, modifier, (nativePtr: KNode) => {
1059    return new ArkSearchComponent(nativePtr);
1060  }, (nativePtr: KNode, classType: ModifierType, modifierJS: ModifierJS) => {
1061    return new modifierJS.SearchModifier(nativePtr, classType);
1062  });
1063};
1064