|
|
@ -142,6 +142,10 @@ |
|
|
// Determine and apply settings to the component |
|
|
// Determine and apply settings to the component |
|
|
$: applySettings(staticSettings, enrichedSettings, conditionalSettings) |
|
|
$: applySettings(staticSettings, enrichedSettings, conditionalSettings) |
|
|
|
|
|
|
|
|
|
|
|
// Determine custom css. |
|
|
|
|
|
// Broken out as a separate variable to minimize reactivity updates. |
|
|
|
|
|
$: customCSS = cachedSettings?._css |
|
|
|
|
|
|
|
|
// Scroll the selected element into view |
|
|
// Scroll the selected element into view |
|
|
$: selected && scrollIntoView() |
|
|
$: selected && scrollIntoView() |
|
|
|
|
|
|
|
|
@ -151,6 +155,7 @@ |
|
|
children: children.length, |
|
|
children: children.length, |
|
|
styles: { |
|
|
styles: { |
|
|
...instance._styles, |
|
|
...instance._styles, |
|
|
|
|
|
custom: customCSS, |
|
|
id, |
|
|
id, |
|
|
empty: emptyState, |
|
|
empty: emptyState, |
|
|
interactive, |
|
|
interactive, |
|
|
@ -259,14 +264,18 @@ |
|
|
// Get raw settings |
|
|
// Get raw settings |
|
|
let settings = {} |
|
|
let settings = {} |
|
|
Object.entries(instance) |
|
|
Object.entries(instance) |
|
|
.filter(([name]) => name === "_conditions" || !name.startsWith("_")) |
|
|
.filter(([name]) => !name.startsWith("_")) |
|
|
.forEach(([key, value]) => { |
|
|
.forEach(([key, value]) => { |
|
|
settings[key] = value |
|
|
settings[key] = value |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// Derive static, dynamic and nested settings if the instance changed |
|
|
|
|
|
let newStaticSettings = { ...settings } |
|
|
let newStaticSettings = { ...settings } |
|
|
let newDynamicSettings = { ...settings } |
|
|
let newDynamicSettings = { ...settings } |
|
|
|
|
|
|
|
|
|
|
|
// Attach some internal properties |
|
|
|
|
|
newDynamicSettings["_conditions"] = instance._conditions |
|
|
|
|
|
newDynamicSettings["_css"] = instance._styles?.custom |
|
|
|
|
|
|
|
|
|
|
|
// Derive static, dynamic and nested settings if the instance changed |
|
|
settingsDefinition?.forEach(setting => { |
|
|
settingsDefinition?.forEach(setting => { |
|
|
if (setting.nested) { |
|
|
if (setting.nested) { |
|
|
delete newDynamicSettings[setting.key] |
|
|
delete newDynamicSettings[setting.key] |
|
|
@ -372,6 +381,10 @@ |
|
|
initialSettings = cachedSettings |
|
|
initialSettings = cachedSettings |
|
|
} else { |
|
|
} else { |
|
|
Object.keys(allSettings).forEach(key => { |
|
|
Object.keys(allSettings).forEach(key => { |
|
|
|
|
|
if (key === "_css") { |
|
|
|
|
|
console.log(enrichedSettings._css) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const same = propsAreSame(allSettings[key], cachedSettings[key]) |
|
|
const same = propsAreSame(allSettings[key], cachedSettings[key]) |
|
|
if (!same) { |
|
|
if (!same) { |
|
|
// Updated cachedSettings (which is assigned by reference to |
|
|
// Updated cachedSettings (which is assigned by reference to |
|
|
@ -379,8 +392,10 @@ |
|
|
// initial props are up to date. By setting it this way rather than |
|
|
// initial props are up to date. By setting it this way rather than |
|
|
// setting it on initialSettings directly, we avoid a double render. |
|
|
// setting it on initialSettings directly, we avoid a double render. |
|
|
cachedSettings[key] = allSettings[key] |
|
|
cachedSettings[key] = allSettings[key] |
|
|
if (key === "css") { |
|
|
|
|
|
instance._styles.custom = cachedSettings[key] |
|
|
// Don't update components for internal properties |
|
|
|
|
|
if (key.startsWith("_")) { |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (ref?.$$set) { |
|
|
if (ref?.$$set) { |
|
|
|