Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<span>延迟:</span>
<jigsaw-numeric-input [(value)]="timeout" step="1000" min="0" subfix="ms"></jigsaw-numeric-input>
</li>
<li class="demo-options-item">
<span>可清空:</span>
<jigsaw-switch [(checked)]="clearable"></jigsaw-switch>
</li>
<li class="demo-options-item">
<span>错误:</span>
<jigsaw-button (click)="showSystemPrompt1('重要提示,用于告知用户十分重要的信息', 'error')">容器1</jigsaw-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ export class JigsawSystemPromptBasicDemoComponent {
public container3: ViewContainerRef;

public timeout = 8000;
public clearable = true;

public showSystemPrompt1(message, type) {
JigsawSystemPrompt.show(message, this.container1, { type: type, timeout: this.timeout });
JigsawSystemPrompt.show(message, this.container1, { type: type, timeout: this.timeout, clearable: this.clearable });
}
public showSystemPrompt2(message, type) {
JigsawSystemPrompt.show(message, this.container2, { type: type, timeout: this.timeout });
JigsawSystemPrompt.show(message, this.container2, { type: type, timeout: this.timeout, clearable: this.clearable });
}
public showSystemPrompt3(message, type) {
JigsawSystemPrompt.show(message, this.container3, { type: type, timeout: this.timeout });
JigsawSystemPrompt.show(message, this.container3, { type: type, timeout: this.timeout, clearable: this.clearable });
}

public showSuccess(message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";
import { JigsawDemoDescriptionModule } from "app/for-internal/description/demo-description";
import { JigsawButtonModule, JigsawHeaderModule, JigsawNumericInputModule, JigsawSystemPromptModule } from "jigsaw/public_api";
import { JigsawButtonModule, JigsawHeaderModule, JigsawNumericInputModule, JigsawSwitchModule, JigsawSystemPromptModule } from "jigsaw/public_api";
import { JigsawSystemPromptBasicDemoComponent } from "./demo.component";
import { PerfectScrollbarModule } from "ngx-perfect-scrollbar";

@NgModule({
imports: [JigsawHeaderModule, CommonModule, JigsawDemoDescriptionModule, JigsawSystemPromptModule, JigsawButtonModule, PerfectScrollbarModule,
JigsawNumericInputModule],
JigsawNumericInputModule, JigsawSwitchModule],
declarations: [JigsawSystemPromptBasicDemoComponent],
exports: [JigsawSystemPromptBasicDemoComponent]
})
Expand Down
2 changes: 1 addition & 1 deletion src/jigsaw/pc-components/system-prompt/system-prompt.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<i class="iconfont system-prompt-icon" [ngClass]="'iconfont-' + _$getIconClass()"></i>
<span class="system-prompt-text">{{message}}</span>
<i class="iconfont iconfont-e14b system-prompt-remove" (click)="remove()"></i>
<i *ngIf="clearable" class="iconfont iconfont-e14b system-prompt-remove" (click)="remove()"></i>
8 changes: 8 additions & 0 deletions src/jigsaw/pc-components/system-prompt/system-prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { AbstractJigsawComponent} from "../../common/common";
export class SystemPromptMessage {
type?: NoticeLevel;
timeout?: number;
clearable?: boolean;
}

@Component({
Expand Down Expand Up @@ -49,6 +50,12 @@ export class JigsawSystemPrompt extends AbstractJigsawComponent implements OnDes
@RequireMarkForCheck()
public type: NoticeLevel = 'error';

/**
* @NoMarkForCheckRequired
*/
@Input()
public clearable: boolean = true;

/**
* @NoMarkForCheckRequired
*/
Expand All @@ -63,6 +70,7 @@ export class JigsawSystemPrompt extends AbstractJigsawComponent implements OnDes
const instance = componentRef.instance;
instance.type = options?.type || 'error';
instance.timeout = CommonUtils.isDefined(options?.timeout) ? options.timeout : 8000;
instance.clearable = CommonUtils.isDefined(options?.clearable) ? options?.clearable : true;
instance.message = message;
instance._setupTimeout();
containerRef.element.nativeElement.appendChild(componentRef.location.nativeElement);
Expand Down