widgets/editor: add lock property

This commit is contained in:
jean-emmanuel 2022-02-12 12:16:29 +01:00
parent fb223eb08c
commit 46ba4115af
10 changed files with 59 additions and 4 deletions

View file

@ -17,7 +17,7 @@ class UiInspectorField extends UiWidget {
this.default = options.default
this.tabIndex = options.tabIndex
this.container = html`<osc-inspector-field></osc-inspector-field>`
this.container = html`<osc-inspector-field name="${this.name}"></osc-inspector-field>`
this.label = this.container.appendChild(html`<label>${this.name}</label>`)
if (this.name === 'type' || this.name === 'widgetType') this.createTypeSelect()

View file

@ -117,15 +117,17 @@ class UiInspector extends UiWidget {
this.clearTimeout = null
}
var content = html`<div></div>`
var widget = widgets[0],
lock = widgets.some(w=>w.getProp('lock')),
props = defaults[widget.props.type],
tabIndex = 1000,
codeEditorFields = []
this.widget = widget
var content = html`<div class="${lock ? 'lock' : ''}"></div>`
for (let categoryName in props) {
if (categoryName === 'children') continue

View file

@ -265,7 +265,7 @@ class UiTree extends UiWidget {
id = widget.getProp('id'),
node = html`<li class="${selected ? 'editing' : ''} ${!widget.getProp('visible') ? 'invisible' : ''}"
data-widget="${widget.hash}" data-type="${widget.getProp('type')}">
${raw(icon(widgetIcons[widget.getProp('type')] || 'root'))}${id}</li>`
${raw(icon(widgetIcons[widget.getProp('type')] || 'root'))}${id}${widget.getProp('lock')? raw(icon('lock')) :''}</li>`
node.depth = depth