diff --git a/AUTHORS.md b/AUTHORS.md index fe7ca7db0c..be4466f15f 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -2,4 +2,5 @@ Contributors === * Michael Shanks - [@mjashanks](https://github.com/mjashanks) -* Daniel Loudon - [@danbudi](https://github.com/danbudi) \ No newline at end of file +* Dan - [@danbudi](https://github.com/danbudi) +* Joe - [@joebudi](https://github.com/joebudi) \ No newline at end of file diff --git a/packages/builder/rollup.config.js b/packages/builder/rollup.config.js index 4af8540f3f..64a690d546 100644 --- a/packages/builder/rollup.config.js +++ b/packages/builder/rollup.config.js @@ -33,7 +33,7 @@ const production = !process.env.ROLLUP_WATCH; const lodash_fp_exports = ["union", "reduce", "isUndefined", "cloneDeep", "split", "some", "map", "filter", "isEmpty", "countBy", "includes", "last", "find", "constant", "take", "first", "intersection", "mapValues", "isNull", "has", "isNumber", "isString", "isBoolean", "isDate", "isArray", "isObject", "clone", "values", "keyBy", "keys", "orderBy", "concat", "reverse", "difference", "merge", "flatten", "each", "pull", "join", "defaultCase", "uniqBy", "every", "uniqWith", "isFunction", "groupBy", -"differenceBy", "intersectionBy", "isEqual", "max", "sortBy", "assign", "uniq", "trimChars", "trimCharsStart", "isObjectLike", "flattenDeep", "indexOf"]; +"differenceBy", "intersectionBy", "isEqual", "max", "sortBy", "assign", "uniq", "trimChars", "trimCharsStart", "isObjectLike", "flattenDeep", "indexOf", "isPlainObject"]; const lodash_exports = ["toNumber", "flow", "isArray", "join", "replace", "trim", "dropRight", "takeRight", "head", "isUndefined", "isNull", "isNaN", "reduce", "isEmpty", "constant", "tail", "includes", "startsWith", "findIndex", "isInteger", "isDate", "isString", "split", "clone", "keys", "isFunction", "merge", "has", "isBoolean", "isNumber", diff --git a/packages/builder/src/common/binding.js b/packages/builder/src/common/binding.js new file mode 100644 index 0000000000..704e79091c --- /dev/null +++ b/packages/builder/src/common/binding.js @@ -0,0 +1,25 @@ +import { + isString +} from "lodash/fp"; + +export const BB_STATE_BINDINGPATH = "##bbstate"; +export const BB_STATE_FALLBACK = "##bbstatefallback"; + +export const isBinding = value => + !isString(value) + && value + && isString(value[BB_STATE_BINDINGPATH]) + && value[BB_STATE_BINDINGPATH].length > 0; + +export const setBinding = ({path, fallback}, binding={} ) => { + if(isNonEmptyString(path)) binding[BB_STATE_BINDINGPATH] = path; + if(isNonEmptyString(fallback)) binding[BB_STATE_FALLBACK] = fallback; + return binding +} + +export const getBinding = binding => ({ + path: binding[BB_STATE_BINDINGPATH] || "", + fallback: binding[BB_STATE_FALLBACK] || "" +}); + +const isNonEmptyString = s => isString(s) && s.length > 0; \ No newline at end of file diff --git a/packages/builder/src/userInterface/ComponentPropSelector.svelte b/packages/builder/src/userInterface/ComponentPropSelector.svelte index 1126fb363f..7180c55001 100644 --- a/packages/builder/src/userInterface/ComponentPropSelector.svelte +++ b/packages/builder/src/userInterface/ComponentPropSelector.svelte @@ -18,7 +18,6 @@ export let props = emptyProps(); export let onValueChanged = () => {}; export let onComponentChosen = () => {}; export let onEdit = () => {}; -export let label = ""; export let disabled = false; const CHOOSE_COMPONENT = "choose_component"; @@ -70,7 +69,6 @@ const confirmClearComponent = () => { -
Name | \r\nPermissions | \r\n\r\n |
---|---|---|
{level.name} | \r\n{getPermissionsString(level.permissions)} | \r\n\r\n onLevelEdit(level)}>{@html getIcon(\"edit\")}\r\n onLevelDelete(level)}>{@html getIcon(\"trash\")}\r\n | \r\n
Component Libraries\r\n \r\n \r\n \r\n \r\n
\r\n {#each $store.pages.componentLibraries as lib}\r\nStylesheets\r\n \r\n \r\n \r\n \r\n
\r\n {#each $store.pages.stylesheets as stylesheet}\r\n