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
16/**
17 * @file
18 * @kit ArkUI
19 */
20
21import { BuildOptions } from './BuilderNode';
22import { Content } from './Content';
23import { UIContext } from '../@ohos.arkui.UIContext';
24import { WrappedBuilder } from 'wrappedBuilderObject';
25
26/**
27 * Defines ComponentContent.
28 *
29 * @extends Content
30 * @syscap SystemCapability.ArkUI.ArkUI.Full
31 * @crossplatform
32 * @atomicservice
33 * @since 12
34 */
35export class ComponentContent<T extends Object> extends Content{
36  /**
37   * Constructor.
38   *
39   * @param { UIContext } uiContext - uiContext used to create the ComponentContent
40   * @param { WrappedBuilder<[]> } builder - Defined the builder will be called to build ComponentContent.
41   * @syscap SystemCapability.ArkUI.ArkUI.Full
42   * @crossplatform
43   * @atomicservice
44   * @since 12
45   */
46  constructor(uiContext: UIContext, builder: WrappedBuilder<[]>);
47
48  /**
49   * Constructor.
50   *
51   * @param { UIContext } uiContext - uiContext used to create the ComponentContent
52   * @param { WrappedBuilder<[T]> } builder - Defined the builder will be called to build ComponentContent.
53   * @param { T } args - Parameters used to update the ComponentContent.
54   * @syscap SystemCapability.ArkUI.ArkUI.Full
55   * @crossplatform
56   * @atomicservice
57   * @since 12
58   */
59  constructor(uiContext: UIContext, builder: WrappedBuilder<[T]>, args: T);
60
61  /**
62   * Constructor.
63   *
64   * @param { UIContext } uiContext - uiContext used to create the ComponentContent
65   * @param { WrappedBuilder<[T]> } builder - Defined the builder will be called to build ComponentContent.
66   * @param { T } args - Parameters used to update the ComponentContent.
67   * @param { BuildOptions } options - Defined the options will be used when build.
68   * @syscap SystemCapability.ArkUI.ArkUI.Full
69   * @crossplatform
70   * @atomicservice
71   * @since 12
72   */
73  constructor(uiContext: UIContext, builder: WrappedBuilder<[T]>, args: T, options: BuildOptions);
74
75
76  /**
77   * Update the ComponentContent based on the provided parameters.
78   *
79   * @param { T } args - Parameters used to update the ComponentContent, which must match the types required by the builder bound to the ComponentContent.
80   * @syscap SystemCapability.ArkUI.ArkUI.Full
81   * @crossplatform
82   * @atomicservice
83   * @since 12
84   */
85  update(args: T): void;
86
87  /**
88   * Reuse the ComponentContent based on the provided parameters.
89   *
90   * @param { Object } [param] - Parameters for reusing ComponentContent.
91   * @syscap SystemCapability.ArkUI.ArkUI.Full
92   * @crossplatform
93   * @atomicservice
94   * @since 12
95   */
96  reuse(param?: Object): void;
97
98  /**
99   * Recycle the ComponentContent.
100   *
101   * @syscap SystemCapability.ArkUI.ArkUI.Full
102   * @crossplatform
103   * @atomicservice
104   * @since 12
105   */
106  recycle(): void;
107
108  /**
109   * Dispose the ComponentContent immediately.
110   *
111   * @syscap SystemCapability.ArkUI.ArkUI.Full
112   * @crossplatform
113   * @atomicservice
114   * @since 12
115   */
116  dispose(): void;
117
118  /**
119   * Notify ComponentContent to update the configuration to trigger a reload of the ComponentContent.
120   *
121   * @syscap SystemCapability.ArkUI.ArkUI.Full
122   * @crossplatform
123   * @atomicservice
124   * @since 12
125   */
126  updateConfiguration(): void;
127}
128