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