Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50659 views
1
// Copyright (c) IPython Development Team.
2
// Distributed under the terms of the Modified BSD License.
3
4
define([
5
"widgets/js/widget",
6
"widgets/js/widget_int",
7
], function(widget, int_widgets){
8
var IntSliderView = int_widgets.IntSliderView;
9
var IntTextView = int_widgets.IntTextView;
10
11
var FloatSliderView = IntSliderView.extend({
12
_parse_value: parseFloat,
13
14
// matches: whitespace?, float, whitespace?, [-:], whitespace?, float
15
_range_regex: /^\s*([+-]?(?:\d*\.?\d+|\d+\.)(?:[eE][+-]?\d+)?)\s*[-:]\s*([+-]?(?:\d*\.?\d+|\d+\.)(?:[eE][+-]?\d+)?)/,
16
17
_validate_slide_value: function(x) {
18
/**
19
* Validate the value of the slider before sending it to the back-end
20
* and applying it to the other views on the page.
21
*/
22
return x;
23
},
24
});
25
26
var FloatTextView = IntTextView.extend({
27
_parse_value: parseFloat
28
});
29
30
return {
31
'FloatSliderView': FloatSliderView,
32
'FloatTextView': FloatTextView,
33
};
34
});
35
36