1 /* 2 * Copyright (c) 2021-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 #ifndef FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_CALENDAR_H 17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_CALENDAR_H 18 19 #include "core/components/calendar/calendar_component_v2.h" 20 #include "frameworks/bridge/declarative_frontend/jsview/js_interactable_view.h" 21 #include "frameworks/bridge/declarative_frontend/jsview/js_view_abstract.h" 22 23 namespace OHOS::Ace::Framework { 24 25 class JSCalendar : public JSViewAbstract, public JSInteractableView { 26 public: 27 static void Create(const JSCallbackInfo& info); 28 static void JSBind(BindingTarget globalObj); 29 30 static void SetCalendarData( 31 const JSRef<JSObject>& obj, MonthState monthState, const RefPtr<CalendarComponentV2>& component); 32 static ObtainedMonth GetCalendarData(const JSRef<JSObject>& obj, MonthState monthState); 33 static void SetCurrentData(const JSRef<JSObject>& obj, const RefPtr<CalendarComponentV2>& component); 34 static ObtainedMonth GetCurrentData(const JSRef<JSObject>& obj); 35 static void SetPreData(const JSRef<JSObject>& obj, const RefPtr<CalendarComponentV2>& component); 36 static ObtainedMonth GetPreData(const JSRef<JSObject>& obj); 37 static void SetNextData(const JSRef<JSObject>& obj, const RefPtr<CalendarComponentV2>& component); 38 static ObtainedMonth GetNextData(const JSRef<JSObject>& obj); 39 static void SetCardCalendar(bool cardCalendar); 40 static void SetDate(const JSRef<JSObject>& obj, const RefPtr<CalendarComponentV2>& component); 41 static void SetHolidays(const std::string& holidays); 42 static void SetOffDays(int32_t offDays); 43 static void SetShowHoliday(const JSCallbackInfo& info); 44 static void SetShowLunar(const JSCallbackInfo& info); 45 static void SetNeedSlide(const JSCallbackInfo& info); 46 static void SetStartOfWeek(const JSCallbackInfo& info); 47 static void SetWorkDays(const std::string& workDays); 48 static void SetDirection(const JSCallbackInfo& info); 49 static void SetCurrentDayStyle(const JSCallbackInfo& info); 50 static void SetNonCurrentDayStyle(const JSCallbackInfo& info); 51 static void SetTodayStyle(const JSCallbackInfo& info); 52 static void SetWeekStyle(const JSCallbackInfo& info); 53 static void SetWorkStateStyle(const JSCallbackInfo& info); 54 static void JsOnSelectedChange(const JSCallbackInfo& info); 55 static void JsOnRequestData(const JSCallbackInfo& info); 56 57 private: 58 static RefPtr<CalendarComponentV2> GetComponent(); 59 }; 60 61 } // namespace OHOS::Ace::Framework 62 63 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_JS_CALENDAR_H 64