-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
106 lines (106 loc) · 3.5 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JSON Schema Interproperty Expressions</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<form>
<div>
<label>
Hub Pitch Circle Diameter
<input
type="number"
name="HubPitchCircleDiameter"
value="100"
step="1"
/>
</label>
<p class="validationMessage"></p>
</div>
<div>
<label>
Hub Holes Diameter
<input
type="number"
name="HubHolesDiameter"
value="12"
step="1"
/>
</label>
<p class="validationMessage"></p>
</div>
<div>
<label>
Rotor Disk Central Hole Diameter
<input
type="number"
name="RotorDiskCentralHoleDiameter"
value="65"
step="1"
/>
</label>
<p class="validationMessage"></p>
</div>
<div>
<label>
Yaw Pipe Diameter
<input
type="number"
name="YawPipeDiameter"
value="60.3"
step="0.1"
/>
</label>
<p class="validationMessage"></p>
</div>
</form>
<img src="diagram.svg" alt="Diagram">
<script type="module">
import addInputEventListeners from "./addInputEventListeners.js";
const schema = {
"type": "object",
"properties": {
"HubPitchCircleDiameter": {
"type": "number",
"title": "Hub Pitch Circle Diameter"
},
"HubHolesDiameter": {
"type": "number",
"title": "Hub Holes Diameter"
},
"RotorDiskCentralHoleDiameter": {
"type": "number",
"title": "Rotor Disk Central Hole Diameter"
},
"YawPipeDiameter": {
"type": "number",
"title": "Yaw Pipe Diameter"
}
},
"interpropertyExpressions": [
{
// Equivalent infix expression:
// {HubPitchCircleDiameter} - {HubHolesDiameter} - 10 ≥ {RotorDiskCentralHoleDiameter}
"expression": "{HubPitchCircleDiameter} {HubHolesDiameter} - 10 - {RotorDiskCentralHoleDiameter} ≥",
"type": "postfix",
"message": "Must have 5 mm between central hole of rotor disk and hub holes.",
"properties": [
"HubPitchCircleDiameter",
"HubHolesDiameter",
"RotorDiskCentralHoleDiameter"
]
}
]
};
const form = document.forms[0];
const getValidationMessageElement = (inputElement) => (
inputElement.parentElement.parentElement.lastElementChild
);
addInputEventListeners(form, schema, getValidationMessageElement);
</script>
</body>
</html>