• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
21/*** if arkts 1.1 */
22import { BuildOptions } from './BuilderNode';
23import { Content } from './Content';
24import { UIContext } from '../@ohos.arkui.UIContext';
25import { WrappedBuilder } from 'wrappedBuilderObject';
26/*** endif */
27
28/*** if arkts 1.2 */
29import { BuildOptions } from './BuilderNode';
30import { Content } from './Content';
31import { UIContext } from '../@ohos.arkui.UIContext';
32import { WrappedBuilder, CustomBuilder, CustomBuilderT } from './component/builder';
33/*** endif */
34
35/**
36 * Defines ComponentContent.
37 *
38 * @extends Content
39 * @syscap SystemCapability.ArkUI.ArkUI.Full
40 * @crossplatform
41 * @atomicservice
42 * @since 12
43 */
44export class ComponentContent<T extends Object> extends Content {
45  /**
46   * Constructor.
47   *
48   * @param { UIContext } uiContext - uiContext used to create the ComponentContent
49   * @param { WrappedBuilder<[]> } builder - Defined the builder will be called to build ComponentContent.
50   * @syscap SystemCapability.ArkUI.ArkUI.Full
51   * @crossplatform
52   * @atomicservice
53   * @since 12
54   */
55  constructor(uiContext: UIContext, builder: WrappedBuilder<[]>);
56
57  /**
58   * Constructor.
59   *
60   * @param { UIContext } uiContext - uiContext used to create the ComponentContent
61   * @param { WrappedBuilder<[T]> } builder - Defined the builder will be called to build ComponentContent.
62   * @param { T } args - Parameters used to update the ComponentContent.
63   * @syscap SystemCapability.ArkUI.ArkUI.Full
64   * @crossplatform
65   * @atomicservice
66   * @since 12
67   */
68  constructor(uiContext: UIContext, builder: WrappedBuilder<[T]>, args: T);
69
70  /**
71   * Constructor.
72   *
73   * @param { UIContext } uiContext - uiContext used to create the ComponentContent
74   * @param { WrappedBuilder<[T]> } builder - Defined the builder will be called to build ComponentContent.
75   * @param { T } args - Parameters used to update the ComponentContent.
76   * @param { BuildOptions } options - Defined the options will be used when build.
77   * @syscap SystemCapability.ArkUI.ArkUI.Full
78   * @crossplatform
79   * @atomicservice
80   * @since 12
81   */
82  constructor(uiContext: UIContext, builder: WrappedBuilder<[T]>, args: T, options: BuildOptions);
83
84
85  /**
86   * Update the ComponentContent based on the provided parameters.
87   *
88   * @param { T } args - Parameters used to update the ComponentContent, which must match the types required by the builder bound to the ComponentContent.
89   * @syscap SystemCapability.ArkUI.ArkUI.Full
90   * @crossplatform
91   * @atomicservice
92   * @since 12
93   */
94  update(args: T): void;
95
96  /**
97   * Reuse the ComponentContent based on the provided parameters.
98   *
99   * @param { Object } [param] - Parameters for reusing ComponentContent.
100   * @syscap SystemCapability.ArkUI.ArkUI.Full
101   * @crossplatform
102   * @atomicservice
103   * @since 12
104   */
105  reuse(param?: Object): void;
106
107  /**
108   * Recycle the ComponentContent.
109   *
110   * @syscap SystemCapability.ArkUI.ArkUI.Full
111   * @crossplatform
112   * @atomicservice
113   * @since 12
114   */
115  recycle(): void;
116
117  /**
118   * Dispose the ComponentContent immediately.
119   *
120   * @syscap SystemCapability.ArkUI.ArkUI.Full
121   * @crossplatform
122   * @atomicservice
123   * @since 12
124   */
125  dispose(): void;
126
127  /**
128   * Notify ComponentContent to update the configuration to trigger a reload of the ComponentContent.
129   *
130   * @syscap SystemCapability.ArkUI.ArkUI.Full
131   * @crossplatform
132   * @atomicservice
133   * @since 12
134   */
135  updateConfiguration(): void;
136
137  /**
138   * Set if the ComponentContent inherits the freezing policy of the parent CustomComponent, ComponentContent, or BuilderNode.
139   *
140   * @param { boolean } enabled - If the ComponentContent inherits the freezing policy of the parent CustomComponent, ComponentContent, or BuilderNode.
141   * @syscap SystemCapability.ArkUI.ArkUI.Full
142   * @crossplatform
143   * @atomicservice
144   * @since 20
145   */
146  inheritFreezeOptions(enabled: boolean): void;
147
148  /**
149   * Get if the node is disposed.
150   *
151   * @returns { boolean } - Returns true if the node is disposed, false otherwise.
152   * @syscap SystemCapability.ArkUI.ArkUI.Full
153   * @crossplatform
154   * @atomicservice
155   * @since 20
156   */
157  isDisposed(): boolean;
158}
159
160/**
161 * Defines ComponentContent.
162 *
163 * @extends Content
164 * @syscap SystemCapability.ArkUI.ArkUI.Full
165 * @crossplatform
166 * @atomicservice
167 * @since 20
168 * @arkts 1.2
169 */
170export declare class ComponentContent<T = undefined> extends Content {
171  /**
172   * Constructor.
173   *
174   * @param { UIContext } uiContext - uiContext used to create the ComponentContent
175   * @param { WrappedBuilder<CustomBuilder> } builder - Defined the builder will be called to build ComponentContent.
176   * @syscap SystemCapability.ArkUI.ArkUI.Full
177   * @crossplatform
178   * @atomicservice
179   * @since 20
180   * @arkts 1.2
181   */
182  constructor(uiContext: UIContext, builder: WrappedBuilder<CustomBuilder>);
183
184  /**
185   * Constructor.
186   *
187   * @param { UIContext } uiContext - uiContext used to create the ComponentContent
188   * @param { WrappedBuilder<CustomBuilderT<T>> } builder - Defined the builder will be called to build ComponentContent.
189   * @param { T } args - Parameters used to update the ComponentContent.
190   * @syscap SystemCapability.ArkUI.ArkUI.Full
191   * @crossplatform
192   * @atomicservice
193   * @since 20
194   * @arkts 1.2
195   */
196  constructor(uiContext: UIContext, builder: WrappedBuilder<CustomBuilderT<T>>, args: T);
197
198  /**
199   * Constructor.
200   *
201   * @param { UIContext } uiContext - uiContext used to create the ComponentContent
202   * @param { WrappedBuilder<CustomBuilderT<T>> } builder - Defined the builder will be called to build ComponentContent.
203   * @param { T } args - Parameters used to update the ComponentContent.
204   * @param { BuildOptions } options - Defined the options will be used when build.
205   * @syscap SystemCapability.ArkUI.ArkUI.Full
206   * @crossplatform
207   * @atomicservice
208   * @since 20
209   * @arkts 1.2
210   */
211  constructor(uiContext: UIContext, builder: WrappedBuilder<CustomBuilderT<T>>, args: T, options: BuildOptions);
212
213  /**
214   * Update the ComponentContent based on the provided parameters.
215   *
216   * @param { T } args - Parameters used to update the ComponentContent, which must match the types required by the builder bound to the ComponentContent.
217   * @syscap SystemCapability.ArkUI.ArkUI.Full
218   * @crossplatform
219   * @atomicservice
220   * @since 20
221   * @arkts 1.2
222   */
223  update(args: T): void;
224
225  /**
226   * Reuse the ComponentContent based on the provided parameters.
227   *
228   * @param { Record<string, NullishType> } [param] - Parameters for reusing ComponentContent.
229   * @syscap SystemCapability.ArkUI.ArkUI.Full
230   * @crossplatform
231   * @atomicservice
232   * @since 20
233   * @arkts 1.2
234   */
235  reuse(param?: Record<string, NullishType>): void;
236
237  /**
238   * Recycle the ComponentContent.
239   *
240   * @syscap SystemCapability.ArkUI.ArkUI.Full
241   * @crossplatform
242   * @atomicservice
243   * @since 20
244   * @arkts 1.2
245   */
246  recycle(): void;
247
248  /**
249   * Dispose the ComponentContent immediately.
250   *
251   * @syscap SystemCapability.ArkUI.ArkUI.Full
252   * @crossplatform
253   * @atomicservice
254   * @since 20
255   * @arkts 1.2
256   */
257  dispose(): void;
258
259  /**
260   * Notify ComponentContent to update the configuration to trigger a reload of the ComponentContent.
261   *
262   * @syscap SystemCapability.ArkUI.ArkUI.Full
263   * @crossplatform
264   * @atomicservice
265   * @since 20
266   * @arkts 1.2
267   */
268  updateConfiguration(): void;
269}
270