1/*
2 * Copyright (c) 2024 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
16export class AlbumPickerComponent extends ViewPU {
17    constructor(e, o, n, t = -1, i = void 0) {
18        super(e, n, t);
19        'function' === typeof i && (this.paramsGenerator_ = i);
20        this.albumPickerOptions = void 0;
21        this.onAlbumClick = void 0;
22        this.onEmptyAreaClick = void 0;
23        this.setInitiallyProvidedValue(o);
24    }
25
26    setInitiallyProvidedValue(e) {
27        void 0 !== e.albumPickerOptions && (this.albumPickerOptions = e.albumPickerOptions);
28        void 0 !== e.onAlbumClick && (this.onAlbumClick = e.onAlbumClick);
29        void 0 !== e.onEmptyAreaClick && (this.onEmptyAreaClick = e.onEmptyAreaClick);
30    }
31
32    updateStateVars(e) {
33    }
34
35    purgeVariableDependenciesOnElmtId(e) {
36    }
37
38    aboutToBeDeleted() {
39        SubscriberManager.Get().delete(this.id__());
40        this.aboutToBeDeletedInternal();
41    }
42
43    initialRender() {
44        this.observeComponentCreation2(((e, o) => {
45            Row.create();
46            Row.height('100%');
47        }), Row);
48        this.observeComponentCreation2(((e, o) => {
49            Column.create();
50            Column.width('100%');
51        }), Column);
52        this.observeComponentCreation2(((e, o) => {
53            var n;
54            var m;
55            SecurityUIExtensionComponent.create({
56                parameters: {
57                    'ability.want.params.uiExtensionTargetType': 'photoPicker',
58                    targetPage: 'albumPage',
59                    themeColorMode: null === (n = this.albumPickerOptions) || void 0 === n ? void 0 : n.themeColorMode,
60                    filterType: null === (m = this.albumPickerOptions) || void 0 === m ? void 0 : m.filterType
61                }
62            });
63            SecurityUIExtensionComponent.height('100%');
64            SecurityUIExtensionComponent.width('100%');
65            SecurityUIExtensionComponent.onRemoteReady((e => {
66                console.info('AlbumPickerComponent onRemoteReady');
67            }));
68            SecurityUIExtensionComponent.onReceive((e => {
69                this.handleOnRecevie(e);
70            }));
71            SecurityUIExtensionComponent.onError((() => {
72                console.info("AlbumPickerComponent onResult")
73            }))
74        }), SecurityUIExtensionComponent);
75        Column.pop();
76        Row.pop();
77    }
78
79    handleOnRecevie(e) {
80        let o = e;
81        let n = o.dataType;
82        if ('selectAlbum' === n) {
83            if (this.onAlbumClick) {
84                let e = new AlbumInfo;
85                e.uri = o.albumUri;
86                e.albumName = o.albumName;
87                this.onAlbumClick(e);
88            }
89        } else if ('emptyAreaClick' === n) {
90            if (this.onEmptyAreaClick) {
91                this.onEmptyAreaClick();
92            }
93        } else {
94            console.info('AlbumPickerComponent onReceive: other case');
95        }
96        console.info('AlbumPickerComponent onReceive ' + n);
97    }
98
99    rerender() {
100        this.updateDirtyElements();
101    }
102}
103
104export class AlbumPickerOptions {
105}
106
107export class AlbumInfo {
108}
109
110export default { AlbumPickerComponent, AlbumPickerOptions, AlbumInfo };