-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(fixture): The properties are loaded from the store
In order to use the fixture-detail-view to edit it's properties it was necesarray to also save the properties into the store. This makes it possible to also rerender to the last values when editing another fixture. Also it's now possible to edit all properties and meta data of the fixture. Fixes #80, #8, #74
- Loading branch information
1 parent
b2c1682
commit e58a02e
Showing
8 changed files
with
122 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { directive } from '/node_modules/lit-html/lit-html.js' | ||
|
||
/* | ||
* Set a default value if the provided value is undefined | ||
*/ | ||
export const defaultValue = (value, defaultVal) => directive(part => { | ||
if (value === undefined) { | ||
value = defaultVal | ||
} | ||
|
||
part.setValue(value) | ||
}) |
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,15 @@ | ||
import { directive } from '/node_modules/lit-html/lit-html.js' | ||
|
||
/* | ||
* Convert an RGB-Array into a Hex color | ||
*/ | ||
export const rgbToHex = (value, defaultValue = '#000000') => directive(part => { | ||
// Is an RGB array | ||
if (Array.isArray(value) && value.length === 3) { | ||
const hex = `#${value.map(x => x.toString(16).padStart(2, '0')).join('')}` | ||
part.setValue(hex) | ||
// Is not an RGB array, so use the defaultValue | ||
} else { | ||
part.setValue(defaultValue) | ||
} | ||
}) |
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,15 @@ | ||
import { directive } from '/node_modules/lit-html/lit-html.js' | ||
|
||
/* | ||
* Find out if the provided value is defined or equals the value of the <option></option> | ||
* to set the "selected" attribute | ||
*/ | ||
export const selected = (value, optionValue) => directive(part => { | ||
if (value === undefined) { | ||
part.setValue(false) | ||
} else if (optionValue === value) { | ||
part.setValue(true) | ||
} else { | ||
part.setValue(false) | ||
} | ||
}) |
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