-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathweek-schedule.html
82 lines (72 loc) · 2.32 KB
/
week-schedule.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
<!DOCTYPE html>
<script type="text/javascript">
(function() {
const defaults = {
group: {type: 'ui_group', required: true},
order: {value: 0},
label: {value: ''},
name: {value: '', required: true, validate: RED.validators.regex(/^[a-zA-Z0-9]*$/) },
order: {value: 0},
width: {
value: 0,
validate: function(v) {
var valid = true
var width = v||0;
var currentGroup = $('#node-input-group').val()|| this.group;
var groupNode = RED.nodes.node(currentGroup);
valid = !groupNode || +width <= +groupNode.width;
$("#node-input-size").toggleClass("input-error",!valid);
return valid;
}},
height: {value: 0}
}
const label = function() {
return this.name || 'week schedule';
}
const oneditprepare = function() {
$("#node-input-size").elementSizer({
width: "#node-input-width",
height: "#node-input-height",
group: "#node-input-group"
});
}
const oneditsave = function() {
}
const oneditresize = function() {
}
RED.nodes.registerType('ui_week_schedule', {
category: 'dashboard',
paletteLabel: 'week schedule',
color: 'rgb(63, 173, 181)',
defaults: defaults,
inputs: 1,
inputLabels: "value",
outputs: 1,
align: 'right',
label: label,
icon: "calendar.png",
oneditprepare: oneditprepare,
oneditsave: oneditsave,
oneditresize: oneditresize
});
})();
</script>
<script type="text/x-red" data-template-name="ui_week_schedule">
<div class="form-row" id="template-row-group">
<label for="node-input-group"><i class="fa fa-table"></i> Group</label>
<input type="text" id="node-input-group">
</div>
<div class="form-row" id="template-row-size">
<label><i class="fa fa-object-group"></i> Size</label>
<input type="hidden" id="node-input-width">
<input type="hidden" id="node-input-height">
<button class="editor-button" id="node-input-size"></button>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name">
</div>
</script>
<script type="text/x-red" data-help-name="ui_week_schedule">
<p>A week schedule for the Node-RED Dashboard</p>
</script>