1 /* 2 * Copyright (c) 2022 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 #ifndef FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_TEXTFIELD_H 17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_TEXTFIELD_H 18 19 #include "bridge/declarative_frontend/engine/js_types.h" 20 #include "frameworks/bridge/declarative_frontend/engine/functions/js_function.h" 21 #include "frameworks/bridge/declarative_frontend/jsview/js_interactable_view.h" 22 #include "frameworks/core/components/text_field/text_field_controller.h" 23 #include "frameworks/core/components/text_field/text_field_component.h" 24 #include "frameworks/core/components/text_field/textfield_theme.h" 25 26 namespace OHOS::Ace::Framework { 27 28 class JSTextField : public JSViewAbstract { 29 public: 30 static void CreateTextInput(const JSCallbackInfo& info); 31 static void CreateTextArea(const JSCallbackInfo& info); 32 static void SetType(const JSCallbackInfo& info); 33 static void SetPlaceholderColor(const JSCallbackInfo& info); 34 static void SetPlaceholderFont(const JSCallbackInfo& info); 35 static void SetEnterKeyType(const JSCallbackInfo& info); 36 static void SetTextAlign(int32_t value); 37 static void SetCaretColor(const JSCallbackInfo& info); 38 static void SetMaxLength(const JSCallbackInfo& info); 39 static void SetFontSize(const JSCallbackInfo& info); 40 static void SetFontWeight(const std::string& value); 41 static void SetTextColor(const JSCallbackInfo& info); 42 static void SetFontStyle(int32_t value); 43 static void SetFontFamily(const JSCallbackInfo& info); 44 static void SetInputFilter(const JSCallbackInfo& info); 45 static void SetInputStyle(const JSCallbackInfo& info); 46 static void SetShowPasswordIcon(const JSCallbackInfo& info); 47 static void SetBackgroundColor(const JSCallbackInfo& info); 48 static void JsHeight(const JSCallbackInfo& info); 49 static void JsWidth(const JSCallbackInfo& info); 50 static void JsPadding(const JSCallbackInfo& info); 51 static void JsBorder(const JSCallbackInfo& info); 52 static void JsBorderWidth(const JSCallbackInfo& info); 53 static void JsBorderColor(const JSCallbackInfo& info); 54 static void JsBorderStyle(const JSCallbackInfo& info); 55 static void JsBorderRadius(const JSCallbackInfo& info); 56 static void JsHoverEffect(const JSCallbackInfo& info); 57 static void SetOnEditChanged(const JSCallbackInfo& info); 58 static void SetOnSubmit(const JSCallbackInfo& info); 59 static void SetOnChange(const JSCallbackInfo& info); 60 static void SetOnCopy(const JSCallbackInfo& info); 61 static void SetOnCut(const JSCallbackInfo& info); 62 static void SetOnPaste(const JSCallbackInfo& info); 63 static void SetOnClick(const JSCallbackInfo& info); 64 static void SetCopyOption(const JSCallbackInfo& info); 65 static void UpdateDecoration(const RefPtr<BoxComponent>& boxComponent, const RefPtr<TextFieldComponent>& component, 66 const Border& boxBorder, const RefPtr<TextFieldTheme>& textFieldTheme); 67 }; 68 69 } // namespace OHOS::Ace::Framework 70 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_TEXTINPUT_H