From eece1ad81ce9d84b93af8864c7b8c4239a9fa1a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=B1=AA=E7=8F=A3?= <519367854@qq.com> Date: Sat, 2 Mar 2024 22:22:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/components/icons/code.ts | 26 +++++++++++ src/app/components/icons/design.ts | 26 +++++++++++ src/app/components/icons/icon.register.ts | 8 ++++ src/app/components/icons/icon.type.ts | 6 ++- src/app/components/icons/json.ts | 25 +++++++++++ src/app/components/icons/play.ts | 26 +++++++++++ .../widgets/view-tools/view-tools.widget.ts | 45 +++++++++++++++++++ src/app/pages/home/home.component.html | 2 +- src/app/pages/home/home.component.ts | 4 +- 9 files changed, 165 insertions(+), 3 deletions(-) create mode 100644 src/app/components/icons/code.ts create mode 100644 src/app/components/icons/design.ts create mode 100644 src/app/components/icons/json.ts create mode 100644 src/app/components/icons/play.ts create mode 100644 src/app/components/widgets/view-tools/view-tools.widget.ts diff --git a/src/app/components/icons/code.ts b/src/app/components/icons/code.ts new file mode 100644 index 0000000..56b91f4 --- /dev/null +++ b/src/app/components/icons/code.ts @@ -0,0 +1,26 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'app-code-svg', + standalone: true, + template: ` + + ` +}) +export class CodeSvg { + @Input() width: string | number = '1em'; + + @Input() height: string | number = '1em'; +} diff --git a/src/app/components/icons/design.ts b/src/app/components/icons/design.ts new file mode 100644 index 0000000..d80b42c --- /dev/null +++ b/src/app/components/icons/design.ts @@ -0,0 +1,26 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'app-design-svg', + standalone: true, + template: ` + + ` +}) +export class DesignSvg { + @Input() width: string | number = '1em'; + + @Input() height: string | number = '1em'; +} diff --git a/src/app/components/icons/icon.register.ts b/src/app/components/icons/icon.register.ts index 4dee79b..4e7ddba 100644 --- a/src/app/components/icons/icon.register.ts +++ b/src/app/components/icons/icon.register.ts @@ -14,6 +14,10 @@ import { SelectionSvg } from '@/app/components/icons/selection'; import { PcSvg } from '@/app/components/icons/pc'; import { MobileSvg } from '@/app/components/icons/mobile'; import { ResponsiveSvg } from '@/app/components/icons/responsive'; +import { DesignSvg } from '@/app/components/icons/design'; +import { JsonSvg } from '@/app/components/icons/json'; +import { CodeSvg } from '@/app/components/icons/code'; +import { PlaySvg } from '@/app/components/icons/play'; export class IconRegister extends IconFactory { constructor() { @@ -35,5 +39,9 @@ export class IconRegister extends IconFactory { this.register(IconType.Pc, PcSvg); this.register(IconType.Mobile, MobileSvg); this.register(IconType.Responsive, ResponsiveSvg); + this.register(IconType.Design, DesignSvg); + this.register(IconType.Json, JsonSvg); + this.register(IconType.Code, CodeSvg); + this.register(IconType.Play, PlaySvg); } } diff --git a/src/app/components/icons/icon.type.ts b/src/app/components/icons/icon.type.ts index b0f1203..ba40aa7 100644 --- a/src/app/components/icons/icon.type.ts +++ b/src/app/components/icons/icon.type.ts @@ -15,5 +15,9 @@ export enum IconType { Selection = 'Selection', Pc = 'Pc', Mobile = 'Mobile', - Responsive = 'Responsive' + Responsive = 'Responsive', + Design = 'Design', + Json = 'Json', + Code = 'Code', + Play = 'Play' } diff --git a/src/app/components/icons/json.ts b/src/app/components/icons/json.ts new file mode 100644 index 0000000..986aca6 --- /dev/null +++ b/src/app/components/icons/json.ts @@ -0,0 +1,25 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'app-json-svg', + standalone: true, + template: ` + + ` +}) +export class JsonSvg { + @Input() width: string | number = '1em'; + + @Input() height: string | number = '1em'; +} diff --git a/src/app/components/icons/play.ts b/src/app/components/icons/play.ts new file mode 100644 index 0000000..5c59a5e --- /dev/null +++ b/src/app/components/icons/play.ts @@ -0,0 +1,26 @@ +import { Component, Input } from '@angular/core'; + +@Component({ + selector: 'app-play-svg', + standalone: true, + template: ` + + ` +}) +export class PlaySvg { + @Input() width: string | number = '1em'; + + @Input() height: string | number = '1em'; +} diff --git a/src/app/components/widgets/view-tools/view-tools.widget.ts b/src/app/components/widgets/view-tools/view-tools.widget.ts new file mode 100644 index 0000000..c6dbd1b --- /dev/null +++ b/src/app/components/widgets/view-tools/view-tools.widget.ts @@ -0,0 +1,45 @@ +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { usePrefix } from '../../../utils'; +import { SharedModule } from '../../../shared/shared.module'; +import { IconWidget } from '../icon/icon.widget'; + +@Component({ + selector: 'app-view-tools-widget', + standalone: true, + template: ` +
+ + @if (use.includes('DESIGNABLE')) { + + } + @if (use.includes('JSONTREE')) { + + } + @if (use.includes('MARKUP')) { + + } + @if (use.includes('PREVIEW')) { + + } + +
+ `, + styleUrls: ['../../styles/styles.less'], + imports: [SharedModule, IconWidget], + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class ViewToolsWidget { + prefix = usePrefix('view-tools'); + + @Input() style: { [p: string]: any }; + + @Input() use = ['DESIGNABLE', 'JSONTREE', 'PREVIEW']; +} diff --git a/src/app/pages/home/home.component.html b/src/app/pages/home/home.component.html index be6e24a..71bba44 100644 --- a/src/app/pages/home/home.component.html +++ b/src/app/pages/home/home.component.html @@ -15,7 +15,7 @@ - view-tool + diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index 3d9fad8..753969f 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -17,6 +17,7 @@ import { ToolbarPanelComponent } from '@/app/components/panels/toolbar-panel.com import { DesignerToolWidget } from '@/app/components/widgets/designer-tool/designer-tool.widget'; import { IconFactory, IconFactoryProvider } from '@/app/components/icons/icon.factory'; import { IconRegister } from '@/app/components/icons/icon.register'; +import { ViewToolsWidget } from '@/app/components/widgets/view-tools/view-tools.widget'; @Component({ selector: 'app-home', @@ -32,7 +33,8 @@ import { IconRegister } from '@/app/components/icons/icon.register'; CompositePanelItemComponent, ResourceWidget, ToolbarPanelComponent, - DesignerToolWidget + DesignerToolWidget, + ViewToolsWidget ], providers: [{ provide: IconFactory, useClass: IconRegister }, IconFactoryProvider], templateUrl: './home.component.html',