-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
46 lines (45 loc) · 894 Bytes
/
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
<html>
<head>
<title>table.js</title>
<style>
html {
font-family: Monospace;
}
table {
border-collapse: collapse;
}
th,td {
border: 1px solid black;
padding: 4px;
}
</style>
</head>
<body>
<script type="module">
import createTable from "./table.js"
const table = createTable({
readonly: false,
columns: {
name: "string",
item: "string",
// number -> will not allow non-number input
age: "number",
// date -> <input type="date">
birthdate: "date",
// color -> <input type="color">
favcolor: "color",
// boolean -> <input type="checkbox">
alive: "boolean",
// enum -> <select>
belief: [ "love", "hate" ],
},
data: localStorage.getItem("data") ? JSON.parse(localStorage.getItem("data")) : [],
onChange: (data) => {
localStorage.setItem("data", JSON.stringify(data))
console.log("changed:", data)
},
mountTo: document.body,
})
</script>
</body>
</html>