-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
115 lines (92 loc) · 3.05 KB
/
index.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
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
108
109
110
111
112
113
114
115
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>DG ODS display demo</title>
<script src="https://cdn.jsdelivr.net/gh/stadgent/vue_webcomponent_odp-search@1.2.0/dist/odp-search.min.js"></script>
<link rel="stylesheet" href="../dist/fonts.min.css">
</head>
<body>
<form style="max-width: 1290px; margin: auto; margin-bottom: 4rem" id="form">
<div><label for="dataset">Dataset</label></div>
<div style="margin-bottom: 1rem"><input type="text" value="stadgent-zoeker-test-data" id="dataset"></div>
<div><label for="key">API Key</label></div>
<div style="margin-bottom: 1rem"><input type="text" id="key"></div>
<div><label for="query">Query</label></div>
<div style="margin-bottom: 1rem"><input type="text" id="query"></div>
<div style="margin-bottom: 1rem"><label for="horizontal"><input id="horizontal" type="checkbox"> Horizontal</label></div>
<div><label for="fields">FormFields</label></div>
<div style="margin-bottom: 1rem">
<textarea id="fields" style="width: 40rem; max-width: 100%" rows="20">
[
{
"label": "veld 1",
"column": "kolom_1",
"options": [
"nameEqualsValue",
{
"value": "optie1",
"name": "optie één"
},
{
"value": "optie2",
"name": "optie twee"
}
]
},
{
"label": "veld 2",
"column": "kolom_2",
"options": [
"nameEqualsValue",
{
"value": "optie1",
"name": "optie één"
},
{
"value": "optie2",
"name": "optie twee"
}
]
}
]
</textarea>
</div>
<div>
<button style="margin-top: 2rem" type="submit">Start</button>
</div>
</form>
<div style="max-width: 1290px; margin: auto" id="wrapper">
</div>
<script>
(function() {
const wrapper = document.getElementById('wrapper');
const form = document.getElementById('form');
const dataset = document.getElementById('dataset');
const key = document.getElementById('key');
const fields = document.getElementById('fields');
const query = document.getElementById('query');
const horizontal = document.getElementById('horizontal');
form.addEventListener('submit', (e) => {
e.preventDefault();
wrapper.innerHTML = '';
const apiKey = key.value;
const set = dataset.value;
const search = document.createElement('odp-search');
search.setAttribute('dataset', set + (apiKey ? '&apikey=' + apiKey : ''));
search.setAttribute('horizontal', horizontal.checked);
if (query.value) {
search.setAttribute('query', query.value);
}
wrapper.appendChild(search);
search.formFields = JSON.parse(fields.value);
})
})()
customElements.whenDefined('odp-search').then(() => {
});
</script>
</body>
</html>