16e80583aSopenharmony_ci/**
26e80583aSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
36e80583aSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
46e80583aSopenharmony_ci * you may not use this file except in compliance with the License.
56e80583aSopenharmony_ci * You may obtain a copy of the License at
66e80583aSopenharmony_ci *
76e80583aSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
86e80583aSopenharmony_ci *
96e80583aSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
106e80583aSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
116e80583aSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
126e80583aSopenharmony_ci * See the License for the specific language governing permissions and
136e80583aSopenharmony_ci * limitations under the License.
146e80583aSopenharmony_ci */
156e80583aSopenharmony_ci
166e80583aSopenharmony_ciimport { ILayoutConfig } from './ILayoutConfig';
176e80583aSopenharmony_ciimport { CommonConstants } from '../constants/CommonConstants';
186e80583aSopenharmony_ciimport { StyleConstants } from '../constants/StyleConstants';
196e80583aSopenharmony_ciimport { PresetStyleConstants } from '../constants/PresetStyleConstants';
206e80583aSopenharmony_ci
216e80583aSopenharmony_ci/**
226e80583aSopenharmony_ci * Style config for app grid.
236e80583aSopenharmony_ci */
246e80583aSopenharmony_ciexport class AppGridStyleConfig extends ILayoutConfig {
256e80583aSopenharmony_ci  /**
266e80583aSopenharmony_ci   * Style config symbol for app grid
276e80583aSopenharmony_ci   */
286e80583aSopenharmony_ci  static APP_GRID_STYLE_CONFIG = 'AppGridStyleConfig';
296e80583aSopenharmony_ci
306e80583aSopenharmony_ci  /**
316e80583aSopenharmony_ci   * 列数
326e80583aSopenharmony_ci   */
336e80583aSopenharmony_ci  mColumns = StyleConstants.DEFAULT_APP_GRID_COLUMN;
346e80583aSopenharmony_ci
356e80583aSopenharmony_ci  /**
366e80583aSopenharmony_ci   * 行数
376e80583aSopenharmony_ci   */
386e80583aSopenharmony_ci  mRows = StyleConstants.DEFAULT_APP_GRID_ROW;
396e80583aSopenharmony_ci
406e80583aSopenharmony_ci  /**
416e80583aSopenharmony_ci   * 类间隙
426e80583aSopenharmony_ci   */
436e80583aSopenharmony_ci  mColumnsGap = StyleConstants.DEFAULT_APP_GRID_COLUMN_GAP;
446e80583aSopenharmony_ci
456e80583aSopenharmony_ci  /**
466e80583aSopenharmony_ci   * 行间隙
476e80583aSopenharmony_ci   */
486e80583aSopenharmony_ci  mRowsGap = StyleConstants.DEFAULT_APP_GRID_ROW_GAP;
496e80583aSopenharmony_ci
506e80583aSopenharmony_ci  /**
516e80583aSopenharmony_ci   * grid margin
526e80583aSopenharmony_ci   */
536e80583aSopenharmony_ci  mMargin = PresetStyleConstants.DEFAULT_LAYOUT_MARGIN;
546e80583aSopenharmony_ci
556e80583aSopenharmony_ci  /**
566e80583aSopenharmony_ci   * grid minimum gutter
576e80583aSopenharmony_ci   */
586e80583aSopenharmony_ci  mGridGutter = PresetStyleConstants.DEFAULT_APP_LAYOUT_MIN_GUTTER;
596e80583aSopenharmony_ci
606e80583aSopenharmony_ci  /**
616e80583aSopenharmony_ci   * grid width
626e80583aSopenharmony_ci   */
636e80583aSopenharmony_ci  mGridWidth: number;
646e80583aSopenharmony_ci
656e80583aSopenharmony_ci  /**
666e80583aSopenharmony_ci   * grid height
676e80583aSopenharmony_ci   */
686e80583aSopenharmony_ci  mGridHeight: number;
696e80583aSopenharmony_ci
706e80583aSopenharmony_ci  /**
716e80583aSopenharmony_ci   * app width
726e80583aSopenharmony_ci   */
736e80583aSopenharmony_ci  mAppItemSize: number;
746e80583aSopenharmony_ci
756e80583aSopenharmony_ci  /**
766e80583aSopenharmony_ci   * icon size
776e80583aSopenharmony_ci   */
786e80583aSopenharmony_ci  mIconSize = StyleConstants.DEFAULT_APP_ICON_SIZE_WIDTH;
796e80583aSopenharmony_ci
806e80583aSopenharmony_ci  /**
816e80583aSopenharmony_ci   * app name font size
826e80583aSopenharmony_ci   */
836e80583aSopenharmony_ci  mNameSize = StyleConstants.DEFAULT_APP_NAME_SIZE;
846e80583aSopenharmony_ci
856e80583aSopenharmony_ci  /**
866e80583aSopenharmony_ci   * app name font color
876e80583aSopenharmony_ci   */
886e80583aSopenharmony_ci  mNameFontColor = StyleConstants.DEFAULT_FONT_COLOR;
896e80583aSopenharmony_ci
906e80583aSopenharmony_ci  /**
916e80583aSopenharmony_ci   * app name font height
926e80583aSopenharmony_ci   */
936e80583aSopenharmony_ci  mNameHeight = StyleConstants.DEFAULT_APP_NAME_HEIGHT;
946e80583aSopenharmony_ci
956e80583aSopenharmony_ci  /**
966e80583aSopenharmony_ci   * app name lines
976e80583aSopenharmony_ci   */
986e80583aSopenharmony_ci  mNameLines = PresetStyleConstants.DEFAULT_APP_NAME_LINES;
996e80583aSopenharmony_ci
1006e80583aSopenharmony_ci  /**
1016e80583aSopenharmony_ci * left margin of app center
1026e80583aSopenharmony_ci */
1036e80583aSopenharmony_ci  mAppCenterMarginLeft: number = PresetStyleConstants.DEFAULT_APP_CENTER_MARGIN;
1046e80583aSopenharmony_ci
1056e80583aSopenharmony_ci  /**
1066e80583aSopenharmony_ci   * app icon margin top
1076e80583aSopenharmony_ci   */
1086e80583aSopenharmony_ci  mIconMarginVertical: number = PresetStyleConstants.DEFAULT_ICON_PADDING_TOP;
1096e80583aSopenharmony_ci
1106e80583aSopenharmony_ci  /**
1116e80583aSopenharmony_ci   * app icon margin horizontal
1126e80583aSopenharmony_ci   */
1136e80583aSopenharmony_ci  mIconMarginHorizontal: number = PresetStyleConstants.DEFAULT_ICON_PADDING_LEFT;
1146e80583aSopenharmony_ci
1156e80583aSopenharmony_ci  /**
1166e80583aSopenharmony_ci   * icon name margin
1176e80583aSopenharmony_ci   */
1186e80583aSopenharmony_ci  mIconNameMargin: number = PresetStyleConstants.DEFAULT_ICON_NAME_GAP;
1196e80583aSopenharmony_ci
1206e80583aSopenharmony_ci  constructor() {
1216e80583aSopenharmony_ci    super();
1226e80583aSopenharmony_ci  }
1236e80583aSopenharmony_ci
1246e80583aSopenharmony_ci  /**
1256e80583aSopenharmony_ci   * Get single instance.
1266e80583aSopenharmony_ci   */
1276e80583aSopenharmony_ci  static getInstance(): AppGridStyleConfig {
1286e80583aSopenharmony_ci    if (globalThis.AppGridStyleConfig == null) {
1296e80583aSopenharmony_ci      globalThis.AppGridStyleConfig = new AppGridStyleConfig();
1306e80583aSopenharmony_ci      globalThis.AppGridStyleConfig.initConfig();
1316e80583aSopenharmony_ci    }
1326e80583aSopenharmony_ci    return globalThis.AppGridStyleConfig;
1336e80583aSopenharmony_ci  }
1346e80583aSopenharmony_ci
1356e80583aSopenharmony_ci  initConfig(): void {
1366e80583aSopenharmony_ci  }
1376e80583aSopenharmony_ci
1386e80583aSopenharmony_ci  getConfigLevel(): string {
1396e80583aSopenharmony_ci    return CommonConstants.LAYOUT_CONFIG_LEVEL_COMMON;
1406e80583aSopenharmony_ci  }
1416e80583aSopenharmony_ci
1426e80583aSopenharmony_ci  getConfigType(): number {
1436e80583aSopenharmony_ci    return CommonConstants.LAYOUT_CONFIG_TYPE_STYLE;
1446e80583aSopenharmony_ci  }
1456e80583aSopenharmony_ci
1466e80583aSopenharmony_ci  getConfigName(): string {
1476e80583aSopenharmony_ci    return AppGridStyleConfig.APP_GRID_STYLE_CONFIG;
1486e80583aSopenharmony_ci  }
1496e80583aSopenharmony_ci
1506e80583aSopenharmony_ci  getPersistConfigJson(): string {
1516e80583aSopenharmony_ci    const persistConfig = {
1526e80583aSopenharmony_ci    };
1536e80583aSopenharmony_ci    return JSON.stringify(persistConfig);
1546e80583aSopenharmony_ci  }
1556e80583aSopenharmony_ci}
156