forked from SolidOS/solid-panes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtabbedPane.js
More file actions
56 lines (49 loc) · 1.67 KB
/
Copy pathtabbedPane.js
File metadata and controls
56 lines (49 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* Tabbed view of anything
**
** data-driven
**
*/
const UI = require('solid-ui')
const panes = require('../paneRegistry')
const ns = UI.ns
const kb = UI.store
module.exports = {
icon: UI.icons.iconBase + 'noun_688606.svg',
name: 'tabbed',
// Does the subject deserve this pane?
label: function (subject) {
var kb = UI.store
var ns = UI.ns
var typeURIs = kb.findTypeURIs(subject)
if (ns.meeting('Cluster').uri in typeURIs) {
return 'Tabbed'
}
return null
},
render: function (subject, dom) {
var div = dom.createElement('div')
kb.fetcher.load(subject).then(function (xhr) {
var renderTab = function (div, item) {
div.appendChild(UI.widgets.personTR(dom, predicate, item, {}))
}
var renderMain = function (containerDiv, item) {
var pane = null
containerDiv.innerHTML = ''
var table = containerDiv.appendChild(dom.createElement('table'))
panes.getOutliner(dom).GotoSubject(item, true, pane, false, undefined, table)
}
var predicate = kb.the(subject, ns.meeting('predicate'))
var options = {dom: dom, subject: subject}
options.predicate = kb.any(subject, ns.meeting('predicate')) || ns.meeting('toolList')
options.ordered = true
options.orientation = kb.anyValue(subject, ns.meeting('orientation')) || 0
options.renderMain = renderMain
options.renderTab = renderTab
// options.renderTabSettings = renderTabSettings No tab-specific settings
options.backgroundColor = kb.anyValue(subject, ns.ui('backgroundColor')) || '#ddddcc'
div.appendChild(UI.tabs.tabWidget(options)) // var tabs =
}) // then
return div
}
}
// ends