diff --git a/src/app/components/icons/close.ts b/src/app/components/icons/close.ts new file mode 100644 index 0000000..e222ec4 --- /dev/null +++ b/src/app/components/icons/close.ts @@ -0,0 +1,26 @@ +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; + +@Component({ + selector: 'app-close-svg', + standalone: true, + template: ` + + `, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class CloseSvg { + @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 74023c3..8d1cd6b 100644 --- a/src/app/components/icons/icon.register.ts +++ b/src/app/components/icons/icon.register.ts @@ -5,6 +5,8 @@ import { OutlineSvg } from '@/app/components/icons/outline'; import { HistorySvg } from '@/app/components/icons/history'; import { ExpandSvg } from '@/app/components/icons/expand'; import { CardSourceSvg, InputSourceSvg, TextAreaSourceSvg } from '@/app/components/icons/sources'; +import { PinFilledSvg, PinOutlinedSvg } from '@/app/components/icons/pin'; +import { CloseSvg } from '@/app/components/icons/close'; export class IconRegister extends IconFactory { constructor() { @@ -16,5 +18,8 @@ export class IconRegister extends IconFactory { this.register(IconType.InputSource, InputSourceSvg); this.register(IconType.TextAreaSource, TextAreaSourceSvg); this.register(IconType.CardSource, CardSourceSvg); + this.register(IconType.PushPinOutlined, PinOutlinedSvg); + this.register(IconType.PushPinFilled, PinFilledSvg); + this.register(IconType.Close, CloseSvg); } } diff --git a/src/app/components/icons/icon.type.ts b/src/app/components/icons/icon.type.ts index 1d5cd11..24ff433 100644 --- a/src/app/components/icons/icon.type.ts +++ b/src/app/components/icons/icon.type.ts @@ -5,5 +5,8 @@ export enum IconType { Expand = 'Expand', InputSource = 'InputSource', TextAreaSource = 'TextAreaSource', - CardSource = 'CardSource' + CardSource = 'CardSource', + PushPinOutlined = 'PushPinOutlined', + PushPinFilled = 'PushPinFilled', + Close = 'Close' } diff --git a/src/app/components/icons/pin.ts b/src/app/components/icons/pin.ts new file mode 100644 index 0000000..b5471cb --- /dev/null +++ b/src/app/components/icons/pin.ts @@ -0,0 +1,53 @@ +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; + +@Component({ + selector: 'app-pin-outlined-svg', + standalone: true, + template: ` + + `, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class PinOutlinedSvg { + @Input() width: string | number = '1em'; + + @Input() height: string | number = '1em'; +} + +@Component({ + selector: 'app-pin-filled-svg', + standalone: true, + template: ` + + `, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class PinFilledSvg { + @Input() width: string | number = '1em'; + + @Input() height: string | number = '1em'; +} diff --git a/src/app/components/panels/composite-panel.component.ts b/src/app/components/panels/composite-panel.component.ts index 8c05c1b..16ab72c 100644 --- a/src/app/components/panels/composite-panel.component.ts +++ b/src/app/components/panels/composite-panel.component.ts @@ -26,7 +26,7 @@ import { NgIf } from '@angular/common'; `, - styleUrls: ['./styles.less'], + styleUrls: ['../styles/styles.less'], changeDetection: ChangeDetectionStrategy.OnPush }) export class CompositePanelItemComponent { @@ -54,12 +54,34 @@ export class CompositePanelItemComponent { -
+
-
+
+
+
+ +
+
+ +
+ +
@@ -74,7 +96,7 @@ export class CompositePanelItemComponent { } ` ], - styleUrls: ['./styles.less'], + styleUrls: ['../styles/styles.less'], providers: [{ provide: IconFactory, useClass: IconRegister }, IconFactoryProvider], changeDetection: ChangeDetectionStrategy.OnPush }) @@ -85,7 +107,7 @@ export class CompositePanelComponent implements AfterViewInit { iconItemList: IconType[] = []; - activeKey: number = 0; + activeKey: number = -1; activeTitle: string; @@ -101,6 +123,11 @@ export class CompositePanelComponent implements AfterViewInit { } changeActiveTab(key: number) { + if (this.activeKey == key) { + this.visible.update(v => !v); + } else { + this.visible.set(true); + } this.activeKey = key; const list = this.panelItemList?.toArray(); if (Array.isArray(list) && list.length) { @@ -110,4 +137,12 @@ export class CompositePanelComponent implements AfterViewInit { list.forEach((v, i) => v.changeVisible(i === this.activeKey)); } } + + pinningChange() { + this.pinning.update(v => !v); + } + + close() { + this.visible.set(false); + } } diff --git a/src/app/components/panels/setting-panel.component.ts b/src/app/components/panels/setting-panel.component.ts index 5d2126e..2c146d8 100644 --- a/src/app/components/panels/setting-panel.component.ts +++ b/src/app/components/panels/setting-panel.component.ts @@ -17,7 +17,7 @@ import { usePrefix } from '@/app/utils'; } ` ], - styleUrls: ['./styles.less'], + styleUrls: ['../styles/styles.less'], changeDetection: ChangeDetectionStrategy.OnPush }) export class SettingPanelComponent { diff --git a/src/app/components/panels/studio-panel.component.ts b/src/app/components/panels/studio-panel.component.ts index 3a7e888..fcddd17 100644 --- a/src/app/components/panels/studio-panel.component.ts +++ b/src/app/components/panels/studio-panel.component.ts @@ -22,7 +22,7 @@ import { usePrefix } from '@/app/utils';
`, styles: [``], - styleUrls: ['./styles.less'], + styleUrls: ['../styles/styles.less'], changeDetection: ChangeDetectionStrategy.OnPush }) export class StudioPanelComponent implements OnInit { diff --git a/src/app/components/panels/workspace-panel.component.ts b/src/app/components/panels/workspace-panel.component.ts index 3b05ebf..703a97e 100644 --- a/src/app/components/panels/workspace-panel.component.ts +++ b/src/app/components/panels/workspace-panel.component.ts @@ -18,7 +18,7 @@ import { usePrefix } from '@/app/utils'; } ` ], - styleUrls: ['./styles.less'], + styleUrls: ['../styles/styles.less'], changeDetection: ChangeDetectionStrategy.OnPush }) export class WorkspacePanelComponent { diff --git a/src/app/components/panels/styles.less b/src/app/components/styles/styles.less similarity index 100% rename from src/app/components/panels/styles.less rename to src/app/components/styles/styles.less diff --git a/src/app/components/widgets/icon/icon.widget.ts b/src/app/components/widgets/icon/icon.widget.ts index b83c273..0b14494 100644 --- a/src/app/components/widgets/icon/icon.widget.ts +++ b/src/app/components/widgets/icon/icon.widget.ts @@ -11,7 +11,6 @@ import { import { usePrefix } from '@/app/utils'; import { ComponentSvg } from '@/app/components/icons/component'; import { IconFactoryProvider } from '@/app/components/icons/icon.factory'; -import { IconType } from '@/app/components/icons/icon.type'; import { NgOptimizedImage } from '@angular/common'; @Component({ @@ -19,7 +18,7 @@ import { NgOptimizedImage } from '@angular/common'; standalone: true, imports: [ComponentSvg, NgOptimizedImage], template: ` -
+
@if (isRegister) {
} @else { @@ -27,7 +26,7 @@ import { NgOptimizedImage } from '@angular/common'; }
`, - styleUrls: ['./icon.widget.less'], + styleUrls: ['./icon.widget.less', '../../styles/styles.less'], changeDetection: ChangeDetectionStrategy.OnPush }) export class IconWidget implements OnChanges, AfterViewInit { @@ -35,6 +34,8 @@ export class IconWidget implements OnChanges, AfterViewInit { @Input() size: number | string = '1em'; + @Input() classname: string; + @Input() style: Partial; @ViewChild('container', { read: ViewContainerRef }) container: ViewContainerRef | undefined;