Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export function tabWidget (options: TabWidgetOptions) {
const onClose = options.onClose

const [selectedColor, color] = getColors(backgroundColor)
const bodyMainStyle = `flex: 2; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: ${selectedColor}; padding: 1em;`
const bodyMainStyle = `display: grid; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: ${selectedColor}; padding: 1em;`
const rootElement: TabWidgetElement = dom.createElement('div') // 20200117a

rootElement.setAttribute('style', style.tabsRootElement)
Expand Down
28 changes: 25 additions & 3 deletions src/widgets/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -712,16 +712,38 @@ field[ns.ui('Classifier').uri] = function (
if (!ok) return callbackFunction(ok, body)
return callbackFunction(ok, body)
}
const box = makeSelectForNestedCategory(
// Create container for label and select
const outerBox = dom.createElement('div')
outerBox.setAttribute('class', 'classifierBox')
// Render label
const labelDiv = dom.createElement('div')
labelDiv.setAttribute('class', 'formFieldName classifierBox-label')
// Use fieldLabel to render ui:label if present
labelDiv.appendChild(fieldLabel(dom, category, form))
outerBox.appendChild(labelDiv)
// Render select
const selectBox = dom.createElement('div')
selectBox.setAttribute('class', 'formFieldValue classifierBox-selectBox')
const selectElement = makeSelectForNestedCategory(
dom,
kb,
subject,
category,
dataDoc,
checkOptions
)
if (container) container.appendChild(box)
return box
// Set readonly if not editable
if (selectElement && selectElement.querySelector && selectElement.querySelector('select')) {
const select = selectElement.querySelector('select');
if (select && !kb.updater.editable(dataDoc.uri)) {
select.readOnly = true;
select.style = style.textInputStyleUneditable;
}
}
selectBox.appendChild(selectElement)
outerBox.appendChild(selectBox)
if (container) container.appendChild(outerBox)
return outerBox
}

/** Choice field
Expand Down
2 changes: 1 addition & 1 deletion test/unit/__snapshots__/tabs.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`tabWidget minimal setup of options renders content for first tab 1`] =
style="height: 100%; width: 100%;"
>
<main
style="flex: 2; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: #e7e7db; padding: 1em;"
style="display: grid; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: #e7e7db; padding: 1em;"
/>
</div>
<div
Expand Down