Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 8x 8x 8x 8x 8x 40x 40x 5x 5x 5x 3x | import { Component, Input } from "@angular/core"
import { State, Store } from "@ngrx/store"
import { CcState } from "../../codeCharta.model"
import { getPartialDefaultState } from "./getPartialDefaultState"
import { setState } from "../../state/store/state.actions"
@Component({
selector: "cc-reset-settings-button",
templateUrl: "./resetSettingsButton.component.html",
styleUrls: ["./resetSettingsButton.component.scss"],
standalone: true
})
export class ResetSettingsButtonComponent {
@Input() settingsKeys: string[]
@Input() tooltip?: string
@Input() label?: string
@Input() callback?: () => void
constructor(
private store: Store<CcState>,
private state: State<CcState>
) {}
applyDefaultSettings() {
const partialDefaultState = getPartialDefaultState(this.settingsKeys, this.state.getValue())
this.store.dispatch(setState({ value: partialDefaultState }))
if (this.callback) {
this.callback()
}
}
}
|