Skip to content

@vtj / Modules / core / ProjectModel

Class: ProjectModel

core.ProjectModel

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ProjectModel(schema): ProjectModel

Parameters

NameType
schemaProjectSchema

Returns

ProjectModel

Defined in

packages/core/src/models/project.ts:79

Properties

apis

apis: ApiSchema[] = []

Defined in

packages/core/src/models/project.ts:66


blocks

blocks: BlockFile[] = []

Defined in

packages/core/src/models/project.ts:65


config

config: ProjectConfig = {}

Defined in

packages/core/src/models/project.ts:68


currentFile

currentFile: null | BlockFile | PageFile = null

Defined in

packages/core/src/models/project.ts:67


dependencies

dependencies: Dependencie[] = []

Defined in

packages/core/src/models/project.ts:63


description

description: string = ''

Defined in

packages/core/src/models/project.ts:61


homepage

homepage: string = ''

Defined in

packages/core/src/models/project.ts:62


id

id: string = ''

Defined in

packages/core/src/models/project.ts:59


name

name: string = ''

Defined in

packages/core/src/models/project.ts:60


pages

pages: PageFile[] = []

Defined in

packages/core/src/models/project.ts:64


attrs

Static attrs: string[]

Defined in

packages/core/src/models/project.ts:69

Methods

active

active(file, silent?): void

打开文件

Parameters

NameTypeDefault value
fileBlockFile | PageFileundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:137


clonePage

clonePage(page, parentId?, silent?): void

复制页面

Parameters

NameTypeDefault value
pagePageFileundefined
parentId?stringundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:342


createBlock

createBlock(block, silent?): void

创建区块

Parameters

NameTypeDefault value
blockBlockFileundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:423


createPage

createPage(page, parentId?, silent?): void

新建页面

Parameters

NameTypeDefault value
pagePageFileundefined
parentId?stringundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:267


deactivate

deactivate(silent?): void

关闭文件

Parameters

NameTypeDefault value
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:151


existApiName

existApiName(name, excludes?): boolean

Parameters

NameTypeDefault value
namestringundefined
excludesstring[][]

Returns

boolean

Defined in

packages/core/src/models/project.ts:575


existBlockName

existBlockName(name, excludes?): boolean

检查是否存在名称的区块

Parameters

NameTypeDefault value
namestringundefined
excludesstring[][]

Returns

boolean

Defined in

packages/core/src/models/project.ts:506


existPageName

existPageName(name, excludes?): boolean

检测是否存在名称的页面

Parameters

NameTypeDefault value
namestringundefined
excludesstring[][]

Returns

boolean

Defined in

packages/core/src/models/project.ts:518


getBlock

getBlock(id): undefined | BlockFile

获取区块文件

Parameters

NameType
idstring

Returns

undefined | BlockFile

Defined in

packages/core/src/models/project.ts:414


getPage

getPage(id): undefined | PageFile

根据页面id查找页面或目录

Parameters

NameType
idstring

Returns

undefined | PageFile

Defined in

packages/core/src/models/project.ts:219


getPages

getPages(): PageFile[]

查找全部页面,不含目录

Returns

PageFile[]

Defined in

packages/core/src/models/project.ts:244


isPageFile

isPageFile(file): file is PageFile

Parameters

NameType
fileBlockFile | PageFile

Returns

file is PageFile

Defined in

packages/core/src/models/project.ts:100


publish

publish(file?): void

Parameters

NameType
file?BlockFile | PageFile

Returns

void

Defined in

packages/core/src/models/project.ts:602


removeApi

removeApi(name, silent?): void

删除api

Parameters

NameTypeDefault value
namestringundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:557


removeBlock

removeBlock(id, silent?): void

删除区块

Parameters

NameTypeDefault value
idstringundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:477


removeDeps

removeDeps(item, silent?): void

删除依赖

Parameters

NameTypeDefault value
itemDependencieundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:197


removePage

removePage(id, silent?): void

删除页面或目录

Parameters

NameTypeDefault value
idstringundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:377


setApi

setApi(item, silent?): void

新增或更新api

Parameters

NameTypeDefault value
itemApiSchemaundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:528


setConfig

setConfig(config, silent?): void

Parameters

NameTypeDefault value
configProjectConfigundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:590


setDeps

setDeps(item, silent?): void

新增或更新依赖

Parameters

NameTypeDefault value
itemDependencieundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:167


setHomepage

setHomepage(id, silent?): void

Parameters

NameTypeDefault value
idstringundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:578


toDsl

toDsl(version?): ProjectSchema

Parameters

NameType
version?string

Returns

ProjectSchema

Defined in

packages/core/src/models/project.ts:104


update

update(schema, silent?): void

Parameters

NameTypeDefault value
schemaPartial<ProjectSchema>undefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:85


updateBlock

updateBlock(block, silent?): void

Parameters

NameTypeDefault valueDescription
blockBlockFileundefined更新区块
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:451


updatePage

updatePage(page, silent?): void

更新页面

Parameters

NameTypeDefault value
pagePageFileundefined
silentbooleanfalse

Returns

void

Defined in

packages/core/src/models/project.ts:318

Released under the MIT License.