Repository navigation
Conversation
|
Staging NPM Package published: |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://nice-bush-054beb503-355.westeurope.5.azurestaticapps.net |
|
Staging NPM Package published: |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://nice-bush-054beb503-355.westeurope.5.azurestaticapps.net |
|
Staging NPM Package published: |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://nice-bush-054beb503-355.westeurope.5.azurestaticapps.net |
|
Staging NPM Package published: |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://nice-bush-054beb503-355.westeurope.5.azurestaticapps.net |
|
Staging NPM Package published: |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://nice-bush-054beb503-355.westeurope.5.azurestaticapps.net |
…o 325-add-angular-wrappers
|
Staging NPM Package published: |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://nice-bush-054beb503-355.westeurope.5.azurestaticapps.net |
|
Staging NPM Package published: |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://nice-bush-054beb503-355.westeurope.5.azurestaticapps.net |
|
Staging NPM Package published: |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://nice-bush-054beb503-355.westeurope.5.azurestaticapps.net |
|
Staging NPM Package published: |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://nice-bush-054beb503-355.westeurope.5.azurestaticapps.net |
|
Staging NPM Package published: |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://nice-bush-054beb503-355.westeurope.5.azurestaticapps.net |
|
Staging NPM Package published: |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://nice-bush-054beb503-355.westeurope.5.azurestaticapps.net |
Co-authored-by: Trygve Bernhardt Moen Haaland <51702336+trybern@users.noreply.github.com>
Co-authored-by: Trygve Bernhardt Moen Haaland <51702336+trybern@users.noreply.github.com>
| switch (webComponentTagName) { | ||
| case 'fhi-text-input': | ||
| case 'fhi-date-input': | ||
| case 'fhi-select': | ||
| stateProperty = 'value'; | ||
| valueProperty = 'value'; | ||
| break; | ||
| case 'fhi-checkbox': | ||
| case 'fhi-radio': | ||
| stateProperty = 'checked'; | ||
| valueProperty = 'value'; | ||
| break; | ||
| case 'fhi-button': | ||
| return ''; | ||
| default: | ||
| throw new Error( | ||
| `No value location defined for web component ${webComponentTagName}`, | ||
| ); |
There was a problem hiding this comment.
Kunne det vært en ide å bruke manifestet her for å sjekke om et komponent er form associated, istedenfor å ha hardkodede tag navn man sjekker. Hvis det kommer et nytt komponent som er for skjema så må switchen oppdateres. F.eks. legge med komponent metadata i input og sjekke etter checked eller value?
There was a problem hiding this comment.
Jeg er litt usikker på hva du tenker her. Kan du utdype?
There was a problem hiding this comment.
Tenkte man kan bruke metadata i manifestet for å sjekke properties for value og checked.
const getFormAccessorConfig = (componentClass) => {
const properties = componentClass.members.filter(member => member.kind === 'field');
const propertyNames = new Set(properties.map(property => property.name));
if (propertyNames.has('checked') && propertyNames.has('value')) {
return {
stateProperty: 'checked',
valueProperty: 'value',
};
}
if (propertyNames.has('value')) {
return {
stateProperty: 'value',
valueProperty: 'value',
};
}
return null;
};
Så kan den brukes i starten av generateFormAccessor.
if (!formConfig) {
return;
}
const { stateProperty, valueProperty } = formConfig;
There was a problem hiding this comment.
ah, nå skjønner jeg hva du mener.
Det ser bra ut og jeg legger det til.
Det er to det kan være vært å notere seg:
- Jeg kan ikke garantere at om en komponent har en property med navn
checkedså vil det alltid være state-en. - Jeg kan ikke garantere at om en komponent mangler en
checkedproperty så vil alltidvaluevære state-en.
Så det er mulig dette kan brekke på et tidspunkt og må oppdateres, men det skal nok gå greit.
These are some guidelines for web component development that generates the best wrappers:
!to declare a property/attribute mandatoryupdate,updatedor similar life cycle functions