-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wizards/smv): add edit wizard and allow access from sampledvalue…
…control wizard (#519) * fix(wiazrds/address): wrong wizard input definition * fix(translation): complex action title * feat(wizards/smv): add edit wizard * feat(wiazrds/sampledvaluecontrol): allow access to scm wizard
- Loading branch information
1 parent
b6f7ea1
commit aff0367
Showing
11 changed files
with
681 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { get } from 'lit-translate'; | ||
|
||
import { Checkbox } from '@material/mwc-checkbox'; | ||
|
||
import { | ||
ComplexAction, | ||
identity, | ||
Wizard, | ||
WizardAction, | ||
WizardActor, | ||
WizardInput, | ||
} from '../foundation.js'; | ||
import { renderGseSmvAddress, updateAddress } from './address.js'; | ||
|
||
export function updateSmvAction(element: Element): WizardActor { | ||
return (inputs: WizardInput[], wizard: Element): WizardAction[] => { | ||
const complexAction: ComplexAction = { | ||
actions: [], | ||
title: get('smv.action.addaddress', { | ||
identity: identity(element), | ||
}), | ||
}; | ||
|
||
const instType: boolean = (<Checkbox>( | ||
wizard.shadowRoot?.querySelector('#instType') | ||
))?.checked; | ||
const addressActions = updateAddress(element, inputs, instType); | ||
if (!addressActions.length) return []; | ||
|
||
addressActions.forEach(action => { | ||
complexAction.actions.push(action); | ||
}); | ||
|
||
return [complexAction]; | ||
}; | ||
} | ||
|
||
export function editSMvWizard(element: Element): Wizard { | ||
return [ | ||
{ | ||
title: get('wizard.title.edit', { tagName: element.tagName }), | ||
element, | ||
primary: { | ||
label: get('save'), | ||
icon: 'edit', | ||
action: updateSmvAction(element), | ||
}, | ||
content: [...renderGseSmvAddress(element)], | ||
}, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.