From fa6ad73c97f7c341723dbdd84317838a0553d954 Mon Sep 17 00:00:00 2001 From: dong Date: Tue, 28 Sep 2021 11:38:00 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E8=84=9A=E6=89=8B?= =?UTF-8?q?=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + devui-cli/commands/create.js | 51 ++-- devui-cli/inquirers/component.js | 6 +- devui-cli/shared/constant.js | 21 +- devui-cli/templates/component.js | 116 ++++++-- devui-cli/templates/vitepress-sidebar.js | 4 +- devui/loading/doc/api-cn.md | 84 ------ devui/loading/doc/api-en.md | 84 ------ devui/loading/index.ts | 3 + devui/pagination/index.ts | 1 + .../src/components/axis/index.tsx | 2 +- devui/search/hooks/use-search-keydown.ts | 2 +- docs/.vitepress/config/sidebar.ts | 272 +++++++++++------- package.json | 5 +- 14 files changed, 336 insertions(+), 316 deletions(-) delete mode 100644 devui/loading/doc/api-cn.md delete mode 100644 devui/loading/doc/api-en.md diff --git a/.gitignore b/.gitignore index dd5adcc5..9dc207ff 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ yarn-error.log .vscode devui/vue-devui.ts devui/theme/theme.scss +docs/.vitepress/config/sidebar.ts diff --git a/devui-cli/commands/create.js b/devui-cli/commands/create.js index 5d44628f..91433ada 100644 --- a/devui-cli/commands/create.js +++ b/devui-cli/commands/create.js @@ -1,5 +1,10 @@ const logger = require('../shared/logger') -const { bigCamelCase, resolveDirFilesInfo, parseExportByFileInfo, parseComponentInfo } = require('../shared/utils') +const { + bigCamelCase, + resolveDirFilesInfo, + parseExportByFileInfo, + parseComponentInfo +} = require('../shared/utils') const fs = require('fs-extra') const { resolve } = require('path') const { @@ -8,6 +13,7 @@ const { TESTS_DIR_NAME, COMPONENT_PARTS_MAP, INDEX_FILE_NAME, + DOCS_FILE_NAME, VUE_DEVUI_FILE, VUE_DEVUI_IGNORE_DIRS, VUE_DEVUI_FILE_NAME, @@ -29,7 +35,8 @@ const { createDirectiveTemplate, createServiceTemplate, createIndexTemplate, - createTestsTemplate + createTestsTemplate, + createDocumentTemplate } = require('../templates/component') const { createVueDevuiTemplate } = require('../templates/vue-devui') const ora = require('ora') @@ -64,17 +71,17 @@ exports.create = async (cwd) => { switch (type) { case CREATE_SUPPORT_TYPE_MAP.component: params = await inquirer.prompt([typeName(), typeTitle(), selectCategory(), selectParts()]) - params.hasComponent = params.parts.includes(COMPONENT_PARTS_MAP.get('component')) - params.hasDirective = params.parts.includes(COMPONENT_PARTS_MAP.get('directive')) - params.hasService = params.parts.includes(COMPONENT_PARTS_MAP.get('service')) + params.hasComponent = params.parts.includes('component') + params.hasDirective = params.parts.includes('directive') + params.hasService = params.parts.includes('service') await createComponent(params, cwd) break case CREATE_SUPPORT_TYPE_MAP['vue-devui']: + // 创建 devui/vue-devui.ts await createVueDevui(params, cwd) - break - case CREATE_SUPPORT_TYPE_MAP['vitepress/sidebar']: - await createVitepressSidebar(params, cwd) + // 创建 docs/.vitepress/config/sidebar.ts + await createVitepressSidebar() break default: break @@ -93,6 +100,7 @@ async function createComponent(params = {}) { const typesName = kebabCase(name) + '-types' const directiveName = kebabCase(name) + '-directive' const serviceName = kebabCase(name) + '-service' + const testName = kebabCase(name) + '.spec' const _params = { ...params, @@ -100,7 +108,8 @@ async function createComponent(params = {}) { typesName, directiveName, serviceName, - styleName + styleName, + testName } const componentTemplate = createComponentTemplate(_params) @@ -109,12 +118,15 @@ async function createComponent(params = {}) { const directiveTemplate = createDirectiveTemplate(_params) const serviceTemplate = createServiceTemplate(_params) const indexTemplate = createIndexTemplate(_params) - // TODO: 增加测试模板 + // 增加测试模板 const testsTemplate = createTestsTemplate(_params) + // 增加文档模板 + const docTemplate = createDocumentTemplate(_params) const componentDir = resolve(DEVUI_DIR, componentName) const srcDir = resolve(componentDir, 'src') const testsDir = resolve(DEVUI_DIR, componentName, TESTS_DIR_NAME) + const docsDir = resolve(SITES_COMPONENTS_DIR, componentName) if (fs.pathExistsSync(componentDir)) { logger.error(`${bigCamelCase(componentName)} 组件目录已存在!`) @@ -126,7 +138,17 @@ async function createComponent(params = {}) { try { await Promise.all([fs.mkdirs(componentDir), fs.mkdirs(srcDir), fs.mkdirs(testsDir)]) - const writeFiles = [fs.writeFile(resolve(componentDir, INDEX_FILE_NAME), indexTemplate)] + const writeFiles = [ + fs.writeFile(resolve(componentDir, INDEX_FILE_NAME), indexTemplate), + fs.writeFile(resolve(testsDir, `${testName}.ts`), testsTemplate), + ] + + if (!fs.existsSync(docsDir)) { + fs.mkdirSync(docsDir) + writeFiles.push(fs.writeFile(resolve(docsDir, DOCS_FILE_NAME), docTemplate)) + } else { + logger.warning(`\n${bigCamelCase(componentName)} 组件文档已存在:${resolve(docsDir, DOCS_FILE_NAME)}`) + } if (hasComponent || hasService) { writeFiles.push(fs.writeFile(resolve(srcDir, `${typesName}.ts`), typesTemplate)) @@ -184,12 +206,7 @@ async function createVueDevui(params, { ignoreParseError }) { } } -async function createVitepressSidebar(params, { cover }) { - if (fs.pathExistsSync(VITEPRESS_SIDEBAR_FILE) && !cover) { - logger.warning(`${VITEPRESS_SIDEBAR_FILE_NAME} 文件已存在!`) - process.exit(0) - } - +async function createVitepressSidebar() { const fileInfo = resolveDirFilesInfo(DEVUI_DIR, VUE_DEVUI_IGNORE_DIRS) const componentsInfo = [] diff --git a/devui-cli/inquirers/component.js b/devui-cli/inquirers/component.js index 226bb7ed..355a2b09 100644 --- a/devui-cli/inquirers/component.js +++ b/devui-cli/inquirers/component.js @@ -42,11 +42,7 @@ exports.selectParts = () => ({ name: 'parts', type: 'checkbox', message: '(必填)请选择包含部件,将自动生成部件文件:', - choices: [ - COMPONENT_PARTS_MAP.get('component'), - COMPONENT_PARTS_MAP.get('directive'), - COMPONENT_PARTS_MAP.get('service') - ], + choices: COMPONENT_PARTS_MAP, default: [], validate: (value) => { if (value.length === 0) { diff --git a/devui-cli/shared/constant.js b/devui-cli/shared/constant.js index a46948ae..d3f2804d 100644 --- a/devui-cli/shared/constant.js +++ b/devui-cli/shared/constant.js @@ -7,6 +7,7 @@ exports.DEVUI_DIR = resolve(this.CWD, 'devui') exports.DEVUI_NAMESPACE = 'd' exports.TESTS_DIR_NAME = '__tests__' exports.INDEX_FILE_NAME = 'index.ts' +exports.DOCS_FILE_NAME = 'index.md' exports.VUE_DEVUI_IGNORE_DIRS = ['shared', 'style'] exports.VUE_DEVUI_FILE_NAME = 'vue-devui.ts' exports.VUE_DEVUI_FILE = resolve(this.DEVUI_DIR, this.VUE_DEVUI_FILE_NAME) @@ -20,16 +21,24 @@ exports.VITEPRESS_SIDEBAR_FILE = resolve(this.VITEPRESS_DIR, `config/${this.VITE // 这里的分类顺序将会影响最终生成的页面侧边栏顺序 exports.VITEPRESS_SIDEBAR_CATEGORY = ['通用', '导航', '反馈', '数据录入', '数据展示', '布局'] -exports.COMPONENT_PARTS_MAP = new Map([ - ['component', 'component(组件)'], - ['directive', 'directive(指令)'], - ['service', 'service(服务)'] -]) +exports.COMPONENT_PARTS_MAP = [ + { + name: 'component(组件)', + value: 'component' + }, + { + name: 'directive(指令)', + value: 'directive' + }, + { + name: 'service(服务)', + value: 'service' + } +] exports.CREATE_SUPPORT_TYPE_MAP = Object.freeze({ component: 'component', 'vue-devui': 'vue-devui', - 'vitepress/sidebar': 'vitepress/sidebar', 'theme-variable': 'theme-variable', }) exports.CREATE_SUPPORT_TYPES = Object.keys(this.CREATE_SUPPORT_TYPE_MAP) diff --git a/devui-cli/templates/component.js b/devui-cli/templates/component.js index 77c07c66..8f376f87 100644 --- a/devui-cli/templates/component.js +++ b/devui-cli/templates/component.js @@ -2,6 +2,7 @@ const { DEVUI_NAMESPACE } = require('../shared/constant') const { camelCase } = require('lodash') const { bigCamelCase } = require('../shared/utils') +// 创建组件模板 exports.createComponentTemplate = ({ styleName, componentName, typesName }) => `\ import './${styleName}.scss' @@ -13,16 +14,14 @@ export default defineComponent({ props: ${camelCase(componentName)}Props, emits: [], setup(props: ${bigCamelCase(componentName)}Props, ctx) { - return {} - }, - render() { - const {} = this - - return
+ return ( +
+ ) } }) ` +// 创建类型声明模板 exports.createTypesTemplate = ({ componentName }) => `\ import type { PropType, ExtractPropTypes } from 'vue' @@ -35,6 +34,7 @@ export const ${camelCase(componentName)}Props = { export type ${bigCamelCase(componentName)}Props = ExtractPropTypes ` +// 创建指令模板 exports.createDirectiveTemplate = () => `\ // can export function. export default { @@ -47,7 +47,7 @@ export default { unmounted() { } } ` - +// 创建server模板 exports.createServiceTemplate = ({ componentName, typesName, serviceName }) => `\ import { ${bigCamelCase(componentName)}Props } from './${typesName}' @@ -58,12 +58,14 @@ const ${bigCamelCase(serviceName)} = { export default ${bigCamelCase(serviceName)} ` +// 创建scss模板 exports.createStyleTemplate = ({ componentName }) => `\ .${DEVUI_NAMESPACE}-${componentName} { // } ` +// 创建index模板 exports.createIndexTemplate = ({ title, category, @@ -86,15 +88,13 @@ exports.createIndexTemplate = ({ const getPartStr = (state, str) => (state ? str : '') - const importStr = - getPartStr(hasComponent, importComponentStr) + - getPartStr(hasDirective, importDirectiveStr) + - getPartStr(hasService, importServiceStr) + const importStr = getPartStr(hasComponent, importComponentStr) + + getPartStr(hasDirective, importDirectiveStr) + + getPartStr(hasService, importServiceStr) - const installStr = - getPartStr(hasComponent, installComponentStr) + - getPartStr(hasDirective, installDirectiveStr) + - getPartStr(hasService, installServiceStr) + const installStr = getPartStr(hasComponent, installComponentStr) + + getPartStr(hasDirective, installDirectiveStr) + + getPartStr(hasService, installServiceStr) return `\ import type { App } from 'vue'\ @@ -125,5 +125,89 @@ export default { ` } -exports.createTestsTemplate = () => `\ +// 创建测试模板 +exports.createTestsTemplate = ({ + componentName, + directiveName, + serviceName, + hasComponent, + hasDirective, + hasService +}) => `\ +import { mount } from '@vue/test-utils'; +import { ${[ + hasComponent ? bigCamelCase(componentName) : null, + hasDirective ? bigCamelCase(directiveName) : null, + hasService ? bigCamelCase(serviceName) : null + ] + .filter((p) => p !== null) + .join(', ')} } from '../index'; + +describe('${componentName} test', () => { + it('${componentName} init render', async () => { + // todo + }) +}) +` + +// 创建文档模板 +exports.createDocumentTemplate = ({ + componentName, + title +}) => `\ +# ${bigCamelCase(componentName)} ${title} + +// todo 组件描述 + +### 何时使用 + +// todo 使用时机描述 + + +### 基本用法 +// todo 用法描述 +:::demo // todo 展开代码的内部描述 + +\`\`\`vue + + + + + +\`\`\` + +::: + +### d-${componentName} + +d-${componentName} 参数 + +| 参数 | 类型 | 默认 | 说明 | 跳转 Demo | 全局配置项 | +| ---- | ---- | ---- | ---- | --------- | --------- | +| | | | | | | +| | | | | | | +| | | | | | | + +d-${componentName} 事件 + +| 事件 | 类型 | 说明 | 跳转 Demo | +| ---- | ---- | ---- | --------- | +| | | | | +| | | | | +| | | | | + ` diff --git a/devui-cli/templates/vitepress-sidebar.js b/devui-cli/templates/vitepress-sidebar.js index 81e1dbe6..ee079340 100644 --- a/devui-cli/templates/vitepress-sidebar.js +++ b/devui-cli/templates/vitepress-sidebar.js @@ -10,11 +10,11 @@ function buildCategoryOptions(text, children = []) { return { text, children } } -exports.createVitepressSidebarTemplate = (componentsInfo) => { +exports.createVitepressSidebarTemplate = (componentsInfo = []) => { const rootNav = { text: '快速开始', link: '/' } const categoryMap = VITEPRESS_SIDEBAR_CATEGORY.reduce((map, cate) => map.set(cate, []), new Map()) - ;(componentsInfo || []).forEach((info) => { + componentsInfo.forEach((info) => { if (categoryMap.has(info.category)) { categoryMap.get(info.category).push(buildComponentOptions(info.title, info.name, info.status)) } else { diff --git a/devui/loading/doc/api-cn.md b/devui/loading/doc/api-cn.md deleted file mode 100644 index c928711e..00000000 --- a/devui/loading/doc/api-cn.md +++ /dev/null @@ -1,84 +0,0 @@ -# 如何使用 - -在 module 中引入: - -```ts -import { LoadingModule } from 'ng-devui/loading'; -``` - -在页面中使用: - -```html - - -``` - -# dLoading - -## dLoading 参数 - -| 参数 | 类型 | 默认 | 说明 | 跳转 Demo | -| :----------------: | :---------------------------: | :--------------------: | :-------------------------------------------------------------------- | ------------------------------------------ | -| loading | [`LoadingType`](#loadingtype) | -- | 可选,控制 loading 状态 | [基本用法](demo#basic-usage) | -| message | `string` | -- | 可选,loading 时的提示信息 | [多 promise](demo#multi-promise) | -| loadingTemplateRef | `TemplateRef` | -- | 可选,自定义 loading 模板 | [自定义样式](demo#custom-style) | -| backdrop | `boolean` | -- | 可选,loading 时是否显示遮罩 | [基本用法](demo#basic-usage) | -| showLoading | `boolean` | -- | 可选,手动启动和关闭 loading 状态,与`loading`参数不能同时使用 | [使用 showLoading 控制](demo#show-loading) | -| positionType | `string` | 'relative' | 可选,指定`dLoading`宿主元素的定位类型,取值与 css position 属性一致。 | [使用 showLoading 控制](demo#show-loading) | -| view | `{top?:string,left?:string}` | {top:'50%',left:'50%'} | 可选,调整 loading 的显示位置,相对于宿主元素的顶部距离与左侧距离 | [基本用法](demo#basic-usage) | -| zIndex | `number` | -- | 可选,loading加载提示的 z-index 值 | [基本用法](demo#basic-usage) | - -### LoadingType - -```ts -export type LoadingType = Observable | Promise | Array> | Array> | Subscription | undefined; -``` - -# LoadingService - -在 component 中引入: - -```ts -import { LoadingService } from 'ng-devui/loading'; -``` - -在 component 里的 constructor 中声明: - -```ts -constructor( private loadingService: LoadingService ) {} -``` - -在页面中使用: - -```html -click me show full screen loading! -在openFullScreen函数中调用loadingService.open(),打开loading 加载,并且获得返回值是一个实例,该实例调用close(), 关闭loading加载。 -``` - -```ts - // 举个例子:const dm = document.querySelector('#me'); - // 举个例子:@ViewChild('loadingTemplateRef1', { static: true }) loadingTemplateRef1: TemplateRef; - this.loadingService.open({ - target: dm, - loadingTemplateRef: loadingTemplateRef1, - backdrop: true, - message: 'One moment please...', - positionType: 'relative', - view: { - top: '50%', - left: '50%' - } - }); -``` - -## LoadingService 参数 - -| 参数 | 类型 | 默认 | 说明 | 跳转 Demo | -| :----------------: | :--------------------------: | :--------------------: | :------------------------------------------------------------------ | ---------------------------------------------- | -| target | `Element` | document.body | 可选,Loading 需要覆盖的 DOM 节点 | [服务方式调用](demo#full-screen) | -| message | `string` | -- | 可选,loading 时的提示信息 | [服务方式调用](demo#full-screen) | -| loadingTemplateRef | `TemplateRef` | -- | 可选,自定义 loading 模板 | [服务方式调用](demo#full-screen) | -| backdrop | `boolean` | true | 可选,loading 时是否显示遮罩 | [服务方式调用](demo#full-screen) | -| positionType | `'static' \| 'relative' \| 'absolute' \| 'fixed' \|'sticky'` | 'relative' | 可选,指定`dLoading`宿主元素的定位类型, |[服务方式调用](demo#full-screen) -| view | `{top?:string,left?:string}` | {top:'50%',left:'50%'} | 可选,调整 loading 的显示位置,相对于宿主元素的顶部距离与左侧距离 | [服务方式调用](demo#full-screen) | -| zIndex | `number` | -- | 可选,弹出框 z-index 值 | [服务方式调用](demo#full-screen) | \ No newline at end of file diff --git a/devui/loading/doc/api-en.md b/devui/loading/doc/api-en.md deleted file mode 100644 index 1ab182b5..00000000 --- a/devui/loading/doc/api-en.md +++ /dev/null @@ -1,84 +0,0 @@ -# How to use - -Import into module - -```ts -import { LoadingModule } from 'ng-devui/loading'; -``` - -In the page - -```html - - -``` - -# dLoading - -## dLoading Parameters - -| Parameter | Type | Default | Description | Jump to Demo | -| :----------------: | :---------------------------: | :---------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- | -| loading | [`LoadingType`](#loadingtype) | -- | Optional. Controlling the loading status | [Basic Usage](demo#basic-usage) | -| message | `string` | -- | Optional. Prompt message during loading | [Multipromise](demo#multi-promise) | -| loadingTemplateRef | `TemplateRef` | -- | Optional. Custom loading template | [Custom Style](demo#custom-style) | -| backdrop | `boolean` | -- | Optional. Indicating whether to display the mask during loading | [Basic Usage](demo#basic-usage) | -| showLoading | `boolean` | -- | Optional. This parameter is used to manually enable or disable the loading status. This parameter cannot be used together with the `loading` parameter | [Using ShowLoading](demo#show-loading) | -| positionType | `string` | 'relative' | Optional. This parameter specifies the positioning type of the `dLoading` host element. The value is the same as that of the css position attribute | [Using ShowLoading](demo#show-loading) | -| view | `{top?:string,left?:string}` | {top: '50%',left:'50%'} | Optional. Adjust the loading display position, that is, the distance between the top and left of the host element | [Basic Usage](demo#basic-usage) | -| zIndex | `number` | -- | Optional. Z-index value in the loading displayed. | [Basic Usage](demo#basic-usage) | - -### LoadingType - -```ts -export type LoadingType = Observable | Promise | Array> | Array> | Subscription | undefined; -``` - -# LoadingService - -Import into component - -```ts -import { LoadingService } from 'ng-devui/loading'; -``` - -In the constructor of component, declare: - -```ts -constructor( private loadingService: LoadingService ) {} -``` - -In the page - -```html -click me show full screen loading! -Invoke loadingService.open() in the openFullScreen function to enable loading. The return value is an instance. The instance invokes close() to disable loading. -``` - -```ts -// For example, const dm = document.querySelector('#me'); -// For Example: @ViewChild('loadingTemplateRef1', {static: true}) loadingTemplateRef1: TemplateRef; - this.loadingService.open({ - target: dm, - loadingTemplateRef: loadingTemplateRef1, - backdrop: true, - message: 'One moment please...', - positionType: 'relative', - view: { - top: '50%', - left: '50%' - } - }); -``` - -## LoadingService Parameter - -| Parameter | Type | Default | Description | Jump to Demo | -| :----------------: | :--------------------------: | :--------------------: | :------------------------------------------------------------------ | ---------------------------------------------- | -| target | `Element` | document.body | Optional. Loads the DOM nodes to be covered. | [Service function](demo#full-screen) | -| message | `string` | -- | Optional. Prompt message during loading | [Service function](demo#full-screen) | -| loadingTemplateRef | `TemplateRef` | -- | Optional. Custom loading template | [Service function](demo#full-screen) | -| backdrop | `boolean` | true | Optional. Indicating whether to display the mask during loading | [Service function](demo#full-screen) | -| positionType | `'static' \| 'relative' \| 'absolute' \| 'fixed' \|'sticky'` | 'relative' | Optional. This parameter specifies the positioning type of the `dLoading` host element. |[Service function](demo#full-screen) -| view | `{top?:string,left?:string}` | {top: '50%',left:'50%'} | Optional. Adjust the loading display position, that is, the distance between the top and left of the host element | [Service function](demo#full-screen) | -| zIndex | `number` | -- | Optional. Z-index value in the loading displayed. | [Service function](demo#full-screen) | \ No newline at end of file diff --git a/devui/loading/index.ts b/devui/loading/index.ts index eea65dc9..a1d0f1b5 100644 --- a/devui/loading/index.ts +++ b/devui/loading/index.ts @@ -3,6 +3,9 @@ import Loading from './src/directive' import LoadingService from './src/service' export default { + title: 'Loading 加载提示', + category: '反馈', + status: '已完成', install(app: App): void { app.directive('dLoading', Loading) app.config.globalProperties.$loadingService = LoadingService diff --git a/devui/pagination/index.ts b/devui/pagination/index.ts index 074ec4ab..fa7e383c 100644 --- a/devui/pagination/index.ts +++ b/devui/pagination/index.ts @@ -10,6 +10,7 @@ export { Pagination } export default { title: 'Pagination 分页', category: '导航', + status: '已完成', install(app: App): void { app.use(Pagination as any) } diff --git a/devui/quadrant-diagram/src/components/axis/index.tsx b/devui/quadrant-diagram/src/components/axis/index.tsx index 0e0d7d39..77c5794d 100644 --- a/devui/quadrant-diagram/src/components/axis/index.tsx +++ b/devui/quadrant-diagram/src/components/axis/index.tsx @@ -2,7 +2,7 @@ import { defineComponent, toRefs, onMounted, ExtractPropTypes, reactive, ref, wa import { IViewConfigs, IAxisConfigs } from '../../../type' import { AXIS_TITLE_SPACE } from '../../../config' import { quadrantDiagramAxisProps, QuadrantDiagramAxisProps } from './types' -import { debounce } from 'lodash' +import { debounce } from 'lodash-es' import './index.scss' diff --git a/devui/search/hooks/use-search-keydown.ts b/devui/search/hooks/use-search-keydown.ts index 16926736..7e69826d 100644 --- a/devui/search/hooks/use-search-keydown.ts +++ b/devui/search/hooks/use-search-keydown.ts @@ -3,7 +3,7 @@ */ import { SetupContext, Ref, } from 'vue' import { KeydownReturnTypes } from '../src/search-types' -import { debounce } from 'lodash' +import { debounce } from 'lodash-es' const KEYS_MAP = { enter: 'Enter' } as const diff --git a/docs/.vitepress/config/sidebar.ts b/docs/.vitepress/config/sidebar.ts index aca6bee6..496eb536 100644 --- a/docs/.vitepress/config/sidebar.ts +++ b/docs/.vitepress/config/sidebar.ts @@ -1,100 +1,176 @@ -const sidebar = { +export default { '/': [ - { text: '快速开始', link: '/' }, - { - text: '通用', - children: [ - { text: 'Button 按钮', link: '/components/button/', status: '已完成' }, - { text: 'Icon 图标', link: '/components/icon/', status: '已完成' }, - { text: 'DragDrop 拖拽', link: '/components/dragdrop/' }, - { text: 'Fullscreen 全屏', link: '/components/fullscreen/' }, - { text: 'Panel 面板', link: '/components/panel/', status: '已完成' }, - { text: 'Search 搜索框', link: '/components/search/', status: '已完成' }, - { text: 'Status 状态', link: '/components/status/', status: '已完成' }, - { text: 'Sticky 便贴', link: '/components/sticky/' }, - { text: 'Overlay 遮罩层', link: '/components/overlay/'} - ] - }, - { - text: '导航', - children: [ - { text: 'Accordion 手风琴', link: '/components/accordion/' }, - { text: 'Anchor 锚点', link: '/components/anchor/' }, - { text: 'BackTop 回到顶部', link: '/components/back-top/' }, - { text: 'Breadcrumb 面包屑', link: '/components/breadcrumb/' }, - { text: 'Dropdown 下拉菜单', link: '/components/dropdown/' }, - { text: 'NavSprite 导航精灵', link: '/components/nav-sprite/' }, - { text: 'Pagination 分页', link: '/components/pagination/', status: '开发中' }, - { text: 'StepsGuide 操作指引', link: '/components/steps-guide/' }, - { text: 'Tabs 选项卡', link: '/components/tabs/', status: '已完成' }, - { text: 'Anchor 锚点', link: '/components/Anchor/' }, - ] - }, - { - text: '反馈', - children: [ - { text: 'Alert 警告', link: '/components/alert/', status: '已完成' }, - { text: 'Drawer 抽屉板', link: '/components/drawer/' }, - { text: 'Loading 加载提示', link: '/components/loading/', status: '已完成' }, - { text: 'Mention 提及', link: '/components/mention/' }, - { text: 'Modal 模态弹窗', link: '/components/modal/' }, - { text: 'Popover 悬浮提示', link: '/components/popover/', status: "开发中" }, - { text: 'ReadTip 阅读提示', link: '/components/read-tip/' }, - { text: 'Toast 全局通知', link: '/components/toast/', status: '已完成' }, - { text: 'Tooltip 提示', link: '/components/tooltip/' }, - ] - }, - { - text: '数据录入', - children: [ - { text: 'AutoComplete 自动补全', link: '/components/auto-complete/' }, - { text: 'Cascader 级联菜单', link: '/components/cascader/' }, - { text: 'CategorySearch 分类搜索', link: '/components/category-search/' }, - { text: 'Checkbox 复选框', link: '/components/checkbox/', status: '已完成' }, - { text: 'DatePicker 日期选择器', link: '/components/date-picker/', status: '开发中' }, - { text: 'DatePickerPro 日期选择器', link: '/components/date-picker-pro/' }, - { text: 'EditableSelect 可编辑下拉框', link: '/components/editable-select/' }, - { text: 'Form 表单', link: '/components/form/' }, - { text: 'Input 文本框', link: '/components/input/', status: '已完成' }, - { text: 'InputNumber 数字输入框', link: '/components/input-number/' }, - { text: 'MultiAutoComplete 多项自动补全', link: '/components/multi-auto-complete/' }, - { text: 'Radio 单选框', link: '/components/radio/', status: '已完成' }, - { text: 'Select 下拉选择框', link: '/components/select/', status: '开发中' }, - { text: 'Slider 滑块', link: '/components/slider/' }, - { text: 'Switch 开关', link: '/components/switch/', status: '已完成' }, - { text: 'TagInput 标签输入', link: '/components/tag-input/', status: '已完成' }, - { text: 'Textarea 多行文本框', link: '/components/textarea/' }, - { text: 'TimePicker 时间选择器', link: '/components/time-picker/' }, - { text: 'Transfer 穿梭框', link: '/components/transfer/' }, - { text: 'TreeSelect 树形选择框', link: '/components/tree-select/' }, - { text: 'Upload 上传', link: '/components/upload/', status: '开发中' }, - ] - }, - { - text: '数据展示', - children: [ - { text: 'Avatar 头像', link: '/components/avatar/', status: '已完成' }, - { text: 'Badge 徽标', link: '/components/badge/', status: '已完成' }, - { text: 'Card 卡片', link: '/components/card/', status: '已完成' }, - { text: 'Carousel 走马灯', link: '/components/carousel/', status: '已完成' }, - { text: 'DataTable 表格', link: '/components/data-table/' }, - { text: 'Gantt 甘特图', link: '/components/gantt/' }, - { text: 'ImagePreview 图片预览', link: '/components/image-preview/' }, - { text: 'Progress 进度条', link: '/components/progress/', status: '已完成' }, - { text: 'QuadrantDiagram 象限图', link: '/components/quadrant-diagram/' }, - { text: 'Rate 等级评估', link: '/components/rate/', status: '已完成' }, - { text: 'Tag 标签', link: '/components/tag/' }, - { text: 'Tree 树', link: '/components/tree/' }, - ] - }, - { - text: '布局', - children: [ - { text: 'Layout 布局', link: '/components/layout/' }, - { text: 'Splitter 分割器', link: '/components/splitter/' } - ] - }, - ] + { + "text": "快速开始", + "link": "/" + }, + { + "text": "通用", + "children": [ + { + "text": "Button 按钮", + "link": "/components/button/" + }, + { + "text": "Icon 图标", + "link": "/components/icon/" + }, + { + "text": "Overlay 遮罩层", + "link": "/components/overlay/" + }, + { + "text": "Panel 面板", + "link": "/components/panel/" + }, + { + "text": "Search 搜索框", + "link": "/components/search/" + }, + { + "text": "Status 状态", + "link": "/components/status/" + }, + { + "text": "Sticky 便贴", + "link": "/components/sticky/" + }, + { + "text": "Test 测试组件", + "link": "/components/test/" + } + ] + }, + { + "text": "导航", + "children": [ + { + "text": "Accordion 手风琴", + "link": "/components/accordion/" + }, + { + "text": "Anchor 锚点", + "link": "/components/anchor/" + }, + { + "text": "Pagination 分页", + "link": "/components/pagination/", + "status": "已完成" + }, + { + "text": "Tabs 选项卡", + "link": "/components/tabs/" + } + ] + }, + { + "text": "反馈", + "children": [ + { + "text": "Alert 警告", + "link": "/components/alert/" + }, + { + "text": "Loading 加载提示", + "link": "/components/loading/", + "status": "已完成" + }, + { + "text": "Popover 悬浮提示", + "link": "/components/popover/", + "status": "开发中" + }, + { + "text": "Progress 进度条", + "link": "/components/progress/" + }, + { + "text": "Toast 全局提示", + "link": "/components/toast/" + }, + { + "text": "Tooltip提示", + "link": "/components/tooltip/" + } + ] + }, + { + "text": "数据录入", + "children": [ + { + "text": "Checkbox 复选框", + "link": "/components/checkbox/" + }, + { + "text": "Input 输入框", + "link": "/components/input/" + }, + { + "text": "Radio 单选框", + "link": "/components/radio/" + }, + { + "text": "Rate 评分", + "link": "/components/rate/" + }, + { + "text": "Select 下拉框", + "link": "/components/select/" + }, + { + "text": "Slider 滑块", + "link": "/components/slider/" + }, + { + "text": "Switch 开关", + "link": "/components/switch/" + }, + { + "text": "TagInput 标签输入框", + "link": "/components/tag-input/" + }, + { + "text": "Transfer 穿梭框", + "link": "/components/transfer/" + }, + { + "text": "Upload 上传", + "link": "/components/upload/" + } + ] + }, + { + "text": "数据展示", + "children": [ + { + "text": "Avatar 头像", + "link": "/components/avatar/" + }, + { + "text": "Badge 徽标", + "link": "/components/badge/" + }, + { + "text": "Card 卡片", + "link": "/components/card/" + }, + { + "text": "Carousel 走马灯", + "link": "/components/carousel/" + }, + { + "text": "ImagePreview 图片预览", + "link": "/components/image-preview/" + }, + { + "text": "QuadrantDiagram 象限图", + "link": "/components/quadrant-diagram/" + } + ] + }, + { + "text": "布局", + "children": [] + } + ] } - -export default sidebar diff --git a/package.json b/package.json index cfe0a4f4..852d231e 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,9 @@ "generate:theme": "node ./devui-cli/index.js generate:theme", "copy": "cp package.json build && cp README.md build && cp devui/theme/theme.scss build/theme", "clean:cli": "npm uninstall -g devui-cli & npm uninstall -g vue-devui", - "cli:create": "node ./devui-cli/index.js create", - "predev": "node ./devui-cli/index.js create -t vue-devui --ignore-parse-error" + "cli:create": "node ./devui-cli/index.js create -t component", + "predev": "node ./devui-cli/index.js create -t vue-devui --ignore-parse-error", + "prebuild": "node ./devui-cli/index.js create -t vue-devui --ignore-parse-error" }, "dependencies": { "@devui-design/icons": "^1.3.0", -- Gitee