@vtj / Modules / core / ProjectModel
Class: ProjectModel
core.ProjectModel
Table of contents
Constructors
Properties
Methods
- active
- clonePage
- createBlock
- createPage
- deactivate
- existApiName
- existBlockName
- existPageName
- getBlock
- getPage
- getPages
- isPageFile
- publish
- removeApi
- removeBlock
- removeDeps
- removePage
- setApi
- setConfig
- setDeps
- setHomepage
- toDsl
- update
- updateBlock
- updatePage
Constructors
constructor
• new ProjectModel(schema
): ProjectModel
Parameters
Name | Type |
---|---|
schema | ProjectSchema |
Returns
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
Name | Type | Default value |
---|---|---|
file | BlockFile | PageFile | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:137
clonePage
▸ clonePage(page
, parentId?
, silent?
): void
复制页面
Parameters
Name | Type | Default value |
---|---|---|
page | PageFile | undefined |
parentId? | string | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:342
createBlock
▸ createBlock(block
, silent?
): void
创建区块
Parameters
Name | Type | Default value |
---|---|---|
block | BlockFile | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:423
createPage
▸ createPage(page
, parentId?
, silent?
): void
新建页面
Parameters
Name | Type | Default value |
---|---|---|
page | PageFile | undefined |
parentId? | string | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:267
deactivate
▸ deactivate(silent?
): void
关闭文件
Parameters
Name | Type | Default value |
---|---|---|
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:151
existApiName
▸ existApiName(name
, excludes?
): boolean
Parameters
Name | Type | Default value |
---|---|---|
name | string | undefined |
excludes | string [] | [] |
Returns
boolean
Defined in
packages/core/src/models/project.ts:575
existBlockName
▸ existBlockName(name
, excludes?
): boolean
检查是否存在名称的区块
Parameters
Name | Type | Default value |
---|---|---|
name | string | undefined |
excludes | string [] | [] |
Returns
boolean
Defined in
packages/core/src/models/project.ts:506
existPageName
▸ existPageName(name
, excludes?
): boolean
检测是否存在名称的页面
Parameters
Name | Type | Default value |
---|---|---|
name | string | undefined |
excludes | string [] | [] |
Returns
boolean
Defined in
packages/core/src/models/project.ts:518
getBlock
▸ getBlock(id
): undefined
| BlockFile
获取区块文件
Parameters
Name | Type |
---|---|
id | string |
Returns
undefined
| BlockFile
Defined in
packages/core/src/models/project.ts:414
getPage
▸ getPage(id
): undefined
| PageFile
根据页面id查找页面或目录
Parameters
Name | Type |
---|---|
id | string |
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
Name | Type |
---|---|
file | BlockFile | PageFile |
Returns
file is PageFile
Defined in
packages/core/src/models/project.ts:100
publish
▸ publish(file?
): void
Parameters
Name | Type |
---|---|
file? | BlockFile | PageFile |
Returns
void
Defined in
packages/core/src/models/project.ts:602
removeApi
▸ removeApi(name
, silent?
): void
删除api
Parameters
Name | Type | Default value |
---|---|---|
name | string | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:557
removeBlock
▸ removeBlock(id
, silent?
): void
删除区块
Parameters
Name | Type | Default value |
---|---|---|
id | string | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:477
removeDeps
▸ removeDeps(item
, silent?
): void
删除依赖
Parameters
Name | Type | Default value |
---|---|---|
item | Dependencie | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:197
removePage
▸ removePage(id
, silent?
): void
删除页面或目录
Parameters
Name | Type | Default value |
---|---|---|
id | string | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:377
setApi
▸ setApi(item
, silent?
): void
新增或更新api
Parameters
Name | Type | Default value |
---|---|---|
item | ApiSchema | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:528
setConfig
▸ setConfig(config
, silent?
): void
Parameters
Name | Type | Default value |
---|---|---|
config | ProjectConfig | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:590
setDeps
▸ setDeps(item
, silent?
): void
新增或更新依赖
Parameters
Name | Type | Default value |
---|---|---|
item | Dependencie | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:167
setHomepage
▸ setHomepage(id
, silent?
): void
Parameters
Name | Type | Default value |
---|---|---|
id | string | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:578
toDsl
▸ toDsl(version?
): ProjectSchema
Parameters
Name | Type |
---|---|
version? | string |
Returns
Defined in
packages/core/src/models/project.ts:104
update
▸ update(schema
, silent?
): void
Parameters
Name | Type | Default value |
---|---|---|
schema | Partial <ProjectSchema > | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:85
updateBlock
▸ updateBlock(block
, silent?
): void
Parameters
Name | Type | Default value | Description |
---|---|---|---|
block | BlockFile | undefined | 更新区块 |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:451
updatePage
▸ updatePage(page
, silent?
): void
更新页面
Parameters
Name | Type | Default value |
---|---|---|
page | PageFile | undefined |
silent | boolean | false |
Returns
void
Defined in
packages/core/src/models/project.ts:318