This repository was archived by the owner on Mar 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdemo.html
More file actions
107 lines (107 loc) · 3.07 KB
/
Copy pathdemo.html
File metadata and controls
107 lines (107 loc) · 3.07 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<!doctype html>
<html>
<head>
<title>Typehead</title>
<script src="../webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="typeahead-input.html">
<style>
body {
text-align: center;
padding-top: 50px;
font-family: Arial Sans-Serif;
}
</style>
</head>
<body unresolved>
<typeahead-test></typeahead-test>
<polymer-element name="typeahead-test">
<template>
<style>
typeahead-input {
margin: 25px;
width: 500px;
font-size: 32px;
}
.values > div {
display: inline-block;
padding: 5px;
margin: 10px;
border: 1px solid #ccc;
border-radius: 3px;
color: #ccc;
}
.values > div[selected="true"] {
color: black;
border: 1px solid black;
}
</style>
<typeahead-input id="typeahead" on-typeahead-delimiter="{{more}}"></typeahead-input>
<div class="values">
<template repeat="{{data}}">
<div selected="{{selected}}">
<template repeat="{{values}}">
{{}}<br>
</template>
</div>
</template>
</div>
</template>
<script>
Polymer('typeahead-test', {
data: [{
selected: true,
values: [
'apple',
'zebra',
'orange',
'yellow',
'awesome'
]
}, {
selected: false,
values: [
'zonk',
'baa',
'sheep',
'happy',
'house'
]
}, {
selected: false,
values: [
'moo',
'spazz',
'lemons',
'duck',
'straw'
]
}],
selected: 0,
ready: function() {
this.$.typeahead.values = this.selectedValues;
},
selectedChanged: function(old) {
this.data[old % 3].selected = false;
this.data[this.selected % 3].selected = true;
},
more: function(e, details) {
this.selected = details.query ? details.query.split('.').length : 0;
details.values = this.selectedValues;
},
get selectedValues() {
return this.data[this.selected % 3].values;
}
});
</script>
</polymer-element>
</body>
</html>