1c8a96e64Sopenharmony_ci/*
2c8a96e64Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
3c8a96e64Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4c8a96e64Sopenharmony_ci * you may not use this file except in compliance with the License.
5c8a96e64Sopenharmony_ci * You may obtain a copy of the License at
6c8a96e64Sopenharmony_ci *
7c8a96e64Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8c8a96e64Sopenharmony_ci *
9c8a96e64Sopenharmony_ci * Unless required by applicable law or agreed to  in writing, software
10c8a96e64Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11c8a96e64Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12c8a96e64Sopenharmony_ci * See the License for the specific language governing permissions and
13c8a96e64Sopenharmony_ci * limitations under the License.
14c8a96e64Sopenharmony_ci */
15c8a96e64Sopenharmony_ci
16c8a96e64Sopenharmony_ciif (!("finalizeConstruction" in ViewPU.prototype)) {
17c8a96e64Sopenharmony_ci    Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { });
18c8a96e64Sopenharmony_ci}
19c8a96e64Sopenharmony_ciexport class AtomicServiceNavigation extends ViewPU {
20c8a96e64Sopenharmony_ci    constructor(w, x, y, z = -1, a1 = undefined, b1) {
21c8a96e64Sopenharmony_ci        super(w, y, z, b1);
22c8a96e64Sopenharmony_ci        if (typeof a1 === "function") {
23c8a96e64Sopenharmony_ci            this.paramsGenerator_ = a1;
24c8a96e64Sopenharmony_ci        }
25c8a96e64Sopenharmony_ci        this.__navPathStack = new ObservedPropertyObjectPU(new NavPathStack(), this, "navPathStack");
26c8a96e64Sopenharmony_ci        this.navigationContent = undefined;
27c8a96e64Sopenharmony_ci        this.__title = new SynchedPropertyObjectOneWayPU(x.title, this, "title");
28c8a96e64Sopenharmony_ci        this.__titleOptions = new SynchedPropertyObjectOneWayPU(x.titleOptions, this, "titleOptions");
29c8a96e64Sopenharmony_ci        this.__hideTitleBar = new SynchedPropertySimpleOneWayPU(x.hideTitleBar, this, "hideTitleBar");
30c8a96e64Sopenharmony_ci        this.__navBarWidth = new SynchedPropertyObjectOneWayPU(x.navBarWidth, this, "navBarWidth");
31c8a96e64Sopenharmony_ci        this.__mode = new SynchedPropertySimpleOneWayPU(x.mode, this, "mode");
32c8a96e64Sopenharmony_ci        this.navDestinationBuilder = this.defaultNavDestinationBuilder;
33c8a96e64Sopenharmony_ci        this.__navBarWidthRange = new SynchedPropertyObjectOneWayPU(x.navBarWidthRange, this, "navBarWidthRange");
34c8a96e64Sopenharmony_ci        this.__minContentWidth = new SynchedPropertyObjectOneWayPU(x.minContentWidth, this, "minContentWidth");
35c8a96e64Sopenharmony_ci        this.stateChangeCallback = undefined;
36c8a96e64Sopenharmony_ci        this.modeChangeCallback = undefined;
37c8a96e64Sopenharmony_ci        this.setInitiallyProvidedValue(x);
38c8a96e64Sopenharmony_ci        this.finalizeConstruction();
39c8a96e64Sopenharmony_ci    }
40c8a96e64Sopenharmony_ci    setInitiallyProvidedValue(v) {
41c8a96e64Sopenharmony_ci        if (v.navPathStack !== undefined) {
42c8a96e64Sopenharmony_ci            this.navPathStack = v.navPathStack;
43c8a96e64Sopenharmony_ci        }
44c8a96e64Sopenharmony_ci        if (v.navigationContent !== undefined) {
45c8a96e64Sopenharmony_ci            this.navigationContent = v.navigationContent;
46c8a96e64Sopenharmony_ci        }
47c8a96e64Sopenharmony_ci        if (v.titleOptions === undefined) {
48c8a96e64Sopenharmony_ci            this.__titleOptions.set({ isBlurEnabled: true });
49c8a96e64Sopenharmony_ci        }
50c8a96e64Sopenharmony_ci        if (v.navDestinationBuilder !== undefined) {
51c8a96e64Sopenharmony_ci            this.navDestinationBuilder = v.navDestinationBuilder;
52c8a96e64Sopenharmony_ci        }
53c8a96e64Sopenharmony_ci        if (v.stateChangeCallback !== undefined) {
54c8a96e64Sopenharmony_ci            this.stateChangeCallback = v.stateChangeCallback;
55c8a96e64Sopenharmony_ci        }
56c8a96e64Sopenharmony_ci        if (v.modeChangeCallback !== undefined) {
57c8a96e64Sopenharmony_ci            this.modeChangeCallback = v.modeChangeCallback;
58c8a96e64Sopenharmony_ci        }
59c8a96e64Sopenharmony_ci    }
60c8a96e64Sopenharmony_ci    updateStateVars(u) {
61c8a96e64Sopenharmony_ci        this.__title.reset(u.title);
62c8a96e64Sopenharmony_ci        this.__titleOptions.reset(u.titleOptions);
63c8a96e64Sopenharmony_ci        this.__hideTitleBar.reset(u.hideTitleBar);
64c8a96e64Sopenharmony_ci        this.__navBarWidth.reset(u.navBarWidth);
65c8a96e64Sopenharmony_ci        this.__mode.reset(u.mode);
66c8a96e64Sopenharmony_ci        this.__navBarWidthRange.reset(u.navBarWidthRange);
67c8a96e64Sopenharmony_ci        this.__minContentWidth.reset(u.minContentWidth);
68c8a96e64Sopenharmony_ci    }
69c8a96e64Sopenharmony_ci    purgeVariableDependenciesOnElmtId(t) {
70c8a96e64Sopenharmony_ci        this.__navPathStack.purgeDependencyOnElmtId(t);
71c8a96e64Sopenharmony_ci        this.__title.purgeDependencyOnElmtId(t);
72c8a96e64Sopenharmony_ci        this.__titleOptions.purgeDependencyOnElmtId(t);
73c8a96e64Sopenharmony_ci        this.__hideTitleBar.purgeDependencyOnElmtId(t);
74c8a96e64Sopenharmony_ci        this.__navBarWidth.purgeDependencyOnElmtId(t);
75c8a96e64Sopenharmony_ci        this.__mode.purgeDependencyOnElmtId(t);
76c8a96e64Sopenharmony_ci        this.__navBarWidthRange.purgeDependencyOnElmtId(t);
77c8a96e64Sopenharmony_ci        this.__minContentWidth.purgeDependencyOnElmtId(t);
78c8a96e64Sopenharmony_ci    }
79c8a96e64Sopenharmony_ci    aboutToBeDeleted() {
80c8a96e64Sopenharmony_ci        this.__navPathStack.aboutToBeDeleted();
81c8a96e64Sopenharmony_ci        this.__title.aboutToBeDeleted();
82c8a96e64Sopenharmony_ci        this.__titleOptions.aboutToBeDeleted();
83c8a96e64Sopenharmony_ci        this.__hideTitleBar.aboutToBeDeleted();
84c8a96e64Sopenharmony_ci        this.__navBarWidth.aboutToBeDeleted();
85c8a96e64Sopenharmony_ci        this.__mode.aboutToBeDeleted();
86c8a96e64Sopenharmony_ci        this.__navBarWidthRange.aboutToBeDeleted();
87c8a96e64Sopenharmony_ci        this.__minContentWidth.aboutToBeDeleted();
88c8a96e64Sopenharmony_ci        SubscriberManager.Get().delete(this.id__());
89c8a96e64Sopenharmony_ci        this.aboutToBeDeletedInternal();
90c8a96e64Sopenharmony_ci    }
91c8a96e64Sopenharmony_ci    get navPathStack() {
92c8a96e64Sopenharmony_ci        return this.__navPathStack.get();
93c8a96e64Sopenharmony_ci    }
94c8a96e64Sopenharmony_ci    set navPathStack(s) {
95c8a96e64Sopenharmony_ci        this.__navPathStack.set(s);
96c8a96e64Sopenharmony_ci    }
97c8a96e64Sopenharmony_ci    get title() {
98c8a96e64Sopenharmony_ci        return this.__title.get();
99c8a96e64Sopenharmony_ci    }
100c8a96e64Sopenharmony_ci    set title(r) {
101c8a96e64Sopenharmony_ci        this.__title.set(r);
102c8a96e64Sopenharmony_ci    }
103c8a96e64Sopenharmony_ci    get titleOptions() {
104c8a96e64Sopenharmony_ci        return this.__titleOptions.get();
105c8a96e64Sopenharmony_ci    }
106c8a96e64Sopenharmony_ci    set titleOptions(q) {
107c8a96e64Sopenharmony_ci        this.__titleOptions.set(q);
108c8a96e64Sopenharmony_ci    }
109c8a96e64Sopenharmony_ci    get hideTitleBar() {
110c8a96e64Sopenharmony_ci        return this.__hideTitleBar.get();
111c8a96e64Sopenharmony_ci    }
112c8a96e64Sopenharmony_ci    set hideTitleBar(p) {
113c8a96e64Sopenharmony_ci        this.__hideTitleBar.set(p);
114c8a96e64Sopenharmony_ci    }
115c8a96e64Sopenharmony_ci    get navBarWidth() {
116c8a96e64Sopenharmony_ci        return this.__navBarWidth.get();
117c8a96e64Sopenharmony_ci    }
118c8a96e64Sopenharmony_ci    set navBarWidth(o) {
119c8a96e64Sopenharmony_ci        this.__navBarWidth.set(o);
120c8a96e64Sopenharmony_ci    }
121c8a96e64Sopenharmony_ci    get mode() {
122c8a96e64Sopenharmony_ci        return this.__mode.get();
123c8a96e64Sopenharmony_ci    }
124c8a96e64Sopenharmony_ci    set mode(n) {
125c8a96e64Sopenharmony_ci        this.__mode.set(n);
126c8a96e64Sopenharmony_ci    }
127c8a96e64Sopenharmony_ci    get navBarWidthRange() {
128c8a96e64Sopenharmony_ci        return this.__navBarWidthRange.get();
129c8a96e64Sopenharmony_ci    }
130c8a96e64Sopenharmony_ci    set navBarWidthRange(m) {
131c8a96e64Sopenharmony_ci        this.__navBarWidthRange.set(m);
132c8a96e64Sopenharmony_ci    }
133c8a96e64Sopenharmony_ci    get minContentWidth() {
134c8a96e64Sopenharmony_ci        return this.__minContentWidth.get();
135c8a96e64Sopenharmony_ci    }
136c8a96e64Sopenharmony_ci    set minContentWidth(l) {
137c8a96e64Sopenharmony_ci        this.__minContentWidth.set(l);
138c8a96e64Sopenharmony_ci    }
139c8a96e64Sopenharmony_ci    defaultNavDestinationBuilder(i, j, k = null) {
140c8a96e64Sopenharmony_ci    }
141c8a96e64Sopenharmony_ci    initialRender() {
142c8a96e64Sopenharmony_ci        this.observeComponentCreation2((g, h) => {
143c8a96e64Sopenharmony_ci            Navigation.create(this.navPathStack);
144c8a96e64Sopenharmony_ci            Navigation.title(ObservedObject.GetRawObject(this.title), {
145c8a96e64Sopenharmony_ci                backgroundColor: this.titleOptions?.backgroundColor,
146c8a96e64Sopenharmony_ci                backgroundBlurStyle: this.titleOptions?.isBlurEnabled ? BlurStyle.COMPONENT_THICK : BlurStyle.NONE,
147c8a96e64Sopenharmony_ci                barStyle: this.titleOptions?.barStyle
148c8a96e64Sopenharmony_ci            });
149c8a96e64Sopenharmony_ci            Navigation.titleMode(NavigationTitleMode.Mini);
150c8a96e64Sopenharmony_ci            Navigation.hideBackButton(true);
151c8a96e64Sopenharmony_ci            Navigation.hideTitleBar(this.hideTitleBar);
152c8a96e64Sopenharmony_ci            Navigation.navBarWidth(ObservedObject.GetRawObject(this.navBarWidth));
153c8a96e64Sopenharmony_ci            Navigation.navBarPosition(NavBarPosition.Start);
154c8a96e64Sopenharmony_ci            Navigation.mode(this.mode);
155c8a96e64Sopenharmony_ci            Navigation.navDestination({ builder: this.navDestinationBuilder.bind(this) });
156c8a96e64Sopenharmony_ci            Navigation.navBarWidthRange(ObservedObject.GetRawObject(this.navBarWidthRange));
157c8a96e64Sopenharmony_ci            Navigation.minContentWidth(ObservedObject.GetRawObject(this.minContentWidth));
158c8a96e64Sopenharmony_ci            Navigation.onNavBarStateChange(this.stateChangeCallback);
159c8a96e64Sopenharmony_ci            Navigation.onNavigationModeChange(this.modeChangeCallback);
160c8a96e64Sopenharmony_ci        }, Navigation);
161c8a96e64Sopenharmony_ci        this.observeComponentCreation2((c, d) => {
162c8a96e64Sopenharmony_ci            If.create();
163c8a96e64Sopenharmony_ci            if (this.navigationContent) {
164c8a96e64Sopenharmony_ci                this.ifElseBranchUpdateFunction(0, () => {
165c8a96e64Sopenharmony_ci                    this.navigationContent.bind(this)(this);
166c8a96e64Sopenharmony_ci                });
167c8a96e64Sopenharmony_ci            }
168c8a96e64Sopenharmony_ci            else {
169c8a96e64Sopenharmony_ci                this.ifElseBranchUpdateFunction(1, () => {
170c8a96e64Sopenharmony_ci                });
171c8a96e64Sopenharmony_ci            }
172c8a96e64Sopenharmony_ci        }, If);
173c8a96e64Sopenharmony_ci        If.pop();
174c8a96e64Sopenharmony_ci        Navigation.pop();
175c8a96e64Sopenharmony_ci    }
176c8a96e64Sopenharmony_ci    rerender() {
177c8a96e64Sopenharmony_ci        this.updateDirtyElements();
178c8a96e64Sopenharmony_ci    }
179c8a96e64Sopenharmony_ci}
180c8a96e64Sopenharmony_ci
181c8a96e64Sopenharmony_ciexport default { AtomicServiceNavigation };