From c9d18b760e31e6667853f543de4a2a195b3d4af1 Mon Sep 17 00:00:00 2001 From: yaoyuchi Date: Wed, 22 Jun 2022 11:29:23 +0800 Subject: [PATCH] new version of grid-container Change-Id: Ida1195e72dc8bf51e1ed73444f9d3516adf01a2c --- BUILD.gn | 2 + api/@internal/component/ets/grid_col.d.ts | 71 +++++++++++ api/@internal/component/ets/grid_row.d.ts | 127 ++++++++++++++++++++ api/@internal/component/ets/index-full.d.ts | 2 + 4 files changed, 202 insertions(+) create mode 100644 api/@internal/component/ets/grid_col.d.ts create mode 100644 api/@internal/component/ets/grid_row.d.ts diff --git a/BUILD.gn b/BUILD.gn index f471b043f8..563ce5ae60 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -118,6 +118,8 @@ ohos_copy("ets_component") { "api/@internal/component/ets/video.d.ts", "api/@internal/component/ets/web.d.ts", "api/@internal/component/ets/xcomponent.d.ts", + "api/@internal/component/ets/grid_col.d.ts", + "api/@internal/component/ets/grid_row.d.ts", ] outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] module_source_dir = target_out_dir + "/$target_name" diff --git a/api/@internal/component/ets/grid_col.d.ts b/api/@internal/component/ets/grid_col.d.ts new file mode 100644 index 0000000000..5b628998d4 --- /dev/null +++ b/api/@internal/component/ets/grid_col.d.ts @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** +* Defines the option in number unit of grid-container child component. +* @since 9 +*/ +declare interface GridColColumnOption { + xs?: number, + sm?: number, + md?: number, + lg?: number, + xl?: number, + xxl?: number, +} + +/** + * Defines the options of grid-container child component. + * @since 9 + */ +declare interface GridColOptions { + /** + * Sets the span of current gird-container item. + * @since 9 + */ + span?: GridColColumnOption; + + /** + * Sets the offset of current gird-container item. + * @since 9 + */ + offset?: GridColColumnOption; + + /** + * Sets the order of current gird-container item. + * @since 9 + */ + order?: GridColColumnOption; +} + + +/** + * Defines the the new version of grid-container child component. + * @since 9 + */ +interface GridColInterface { + /** + * Defines the constructor of GridContainer. + * @since 7 + */ + (optiion?: GridColOptions): GridColAttribute; +} + +declare class GridColAttribute extends CommonMethod { + onBreakpointChange(callback: (breakpoints: string) => void) +} + +declare const GridCol: GridColInterface +declare const GridColInstance: GridColAttribute; diff --git a/api/@internal/component/ets/grid_row.d.ts b/api/@internal/component/ets/grid_row.d.ts new file mode 100644 index 0000000000..5d92506a27 --- /dev/null +++ b/api/@internal/component/ets/grid_row.d.ts @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/** +* Defines the option in length unit of grid-container component. +* @since 9 +*/ +declare interface GridRowSizeOption { + xs?: Length, + sm?: Length, + md?: Length, + lg?: Length, + xl?: Length, + xxl?: Length, +} + +/** +* Defines the option in number unit of grid-container component. +* @since 9 +*/ +declare interface GridRowColumnOption { + xs?: number, + sm?: number, + md?: number, + lg?: number, + xl?: number, + xxl?: number, +} + +/** +* Defines the getter of grid-container component. +* @since 9 +*/ +declare interface GetterOption { + x?: GridRowSizeOption, + y?: GridRowSizeOption +} + +/** +* Defines the breakpoint reference of grid-container component. +* @since 9 +*/ +declare enum BreakpointsReference { + WindowSize, + ComponentSize, +} + +/** +* Defines the direction of grid-container component. +* @since 9 +*/ +declare enum GridRowDirection { + Row, + RowReverse, +} + +/** +* Defines the breakpoints of grid-container component. +* @since 9 +*/ +declare interface BreakPoints { + value?: Array, + reference?: BreakpointsReference, +} + +/** + * Defines the options of grid-container component. + * @since 9 + */ +declare interface GridRowOptions { + /** + * Sets the total number of columns in the current layout. + * @since 9 + */ + columns?: number | GridRowColumnOption; + + /** + * grid-container layout column spacing. + * @since 9 + */ + gutter?: GridRowSizeOption; + + /** + * grid-container layout breakpoints. + * @since 9 + */ + breakpoints?: BreakPoints; + + /** + * grid-container layout direction. + * @since 9 + */ + direction?: GridRowDirection; +} + + +/** + * Defines the the new version of grid-container component. + * @since 9 + */ +interface GridRowInterface { + /** + * Defines the constructor of GridContainer. + * @since 7 + */ + (optiion?: GridRowOptions): GridRowAttribute; +} + +declare class GridRowAttribute extends CommonMethod { + onBreakpointChange(callback: (breakpoints: string) => void): GridRowAttribute; +} + +declare const GridRow: GridRowInterface +declare const GridRowInstance: GridRowAttribute; diff --git a/api/@internal/component/ets/index-full.d.ts b/api/@internal/component/ets/index-full.d.ts index 2be795deba..8e6d5ef6cc 100644 --- a/api/@internal/component/ets/index-full.d.ts +++ b/api/@internal/component/ets/index-full.d.ts @@ -102,4 +102,6 @@ /// /// /// +/// +/// /// -- Gitee