@etsoo/website
Version:
ETSOO CMS Based NextJs Website Framework
117 lines (116 loc) • 3.29 kB
TypeScript
import React from 'react';
import { ArticleLink } from '../dto/site/ArticleLink';
import { SiteData } from '../dto/site/SiteData';
import { SiteTab } from '../dto/site/SiteTab';
type TabListOptions = React.SelectHTMLAttributes<HTMLSelectElement> & {
classNames?: string;
emptyOptionLabel?: string;
};
/**
* Local site class
* 本地站点类
*/
export declare class LocalSite {
readonly data: SiteData;
/**
* Constructor
* 构造函数
* @param data Site data
*/
constructor(data: SiteData);
/**
* Clear title format
* 清除标题格式
* @param title Title
*/
clearTitle(title: string | undefined): string | undefined;
private createMenuItem;
/**
* Create Bootstrap menu
* 创建 Bootstrap 菜单
* @param url Current URL
* @param hasIcon Take tab logo as icon
* @param dropdownClasses Dropdown classes
* @returns Component
*/
createBootstrapMenu(url: string, hasIcon?: boolean, dropdownClasses?: string): JSX.Element;
/**
* Create Google Analytics service
* @returns Component
*/
createGAService(): React.ReactNode;
/**
* Create Google reCAPTCHA service
* @param domain Service domain, 'R' for recaptcha.net, 'G' for google.com
* @returns Component
*/
createRECAPService(domain?: 'G' | 'R'): React.ReactNode;
/**
* Create tab list
* 创建栏目列表
* @param name Name
* @param url URL
* @param options Options
* @returns Component
*/
createTabList(name: string, url: string, options?: TabListOptions): React.ReactElement;
createTabList(name: string, tabs: SiteTab[], options?: TabListOptions): React.ReactElement;
/**
* Create Wechat service
* @param onLoad On load handler
* @returns Component
*/
createWXService(onLoad?: () => void): React.ReactNode;
/**
* Format article URL
* 格式化文章链接
* @param item Article link item
* @returns Result
*/
formatLink(item: ArticleLink): string;
/**
* Format title
* 格式化标题
* @param title Title
*/
formatTitle(title: string | undefined, format: (part: string, partIndex: number) => React.ReactNode): React.ReactNode[] | undefined;
/**
* Format tab URL
* 格式化栏目地址
* @param tab Tab
* @returns Result
*/
formatUrl(tab: SiteTab): string;
/**
* Get resource
* 获取资源
* @param id Resource id
* @param defaultValue Default value
* @returns Result
*/
getResource(id: string, defaultValue?: string): string;
/**
* Get service
* 获取服务
* @param id Service id
* @returns Result
*/
getService(id: 'GA' | 'WX' | 'RECAP'): import("..").SiteService | undefined;
/**
* Get list tab
* 获取列表栏目
* @param filter Filter
* @returns Result
*/
getListTab(filter?: (tab: SiteTab) => boolean): [SiteTab | undefined, SiteTab[]];
/**
* Match tab
* 匹配栏目
* @param tab Tab
* @param url URL
* @param matchClass Match style clsss name
* @returns Result
*/
matchUrl(tab: SiteTab, url: string, matchClass?: string): string;
}
export {};