-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
60 lines (53 loc) · 1.75 KB
/
demo.html
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
57
58
59
60
<!DOCTYPE HTML>
<style>body { padding: 20px; background-color: white!important }</style>
<div id="demo"></div>
<script type="text/stache" id="demo-html">
<can-import from="bootstrap/dist/css/bootstrap.css" />
<can-import from="~/can-select" />
<can-import from="~/can-search-select" />
<can-search-select {items}="items"
{format}="@format"
{format-input}="@formatInput"
btn-class1="icon icon-chevron rotate-90"
filter-prop-name="companyName"/>
<can-select {items}="items"
display-prop-name="companyName"
{^selected-item}="selectedItem"/>
</script>
<script src="node_modules/steal/steal.js"
main="@empty">
import stache from 'can-stache'
import DefineMap from 'can-define/map/map'
//import reload from 'live-reload'
const vm = new DefineMap({
format (item) {
return `<span style="color:red">${item.companyName}</span> <span style="color:blue">${item.issuanceName}</span> price: ${item.price}`;
},
formatInput (item) {
return `${item.companyName}, ${item.issuanceName}, price: ${item.price}`
},
items: [{
companyName: 'Alphabet',
issuanceName: 'Preferred Series A',
price: '1,494'
}, {
companyName: 'Allianz SE',
issuanceName: 'Preferred Series B',
price: '5,194'
}, {
companyName: 'Anheuser-Busch',
issuanceName: 'Series 1',
price: '350'
}],
btnClass: 'caret'
})
// Enable live-reload:
stache.async(document.getElementById('demo-html').innerHTML).then(template => {
let render = () => {
const el = document.getElementById('demo')
el.appendChild(template(vm))
}
render()
//reload(render)
});
</script>