dash-core-components 2.1.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dash_core_components/async-datepicker.js +1 -1
- package/dash_core_components/async-datepicker.js.map +1 -1
- package/dash_core_components/async-dropdown.js +1 -1
- package/dash_core_components/async-dropdown.js.map +1 -1
- package/dash_core_components/async-graph.js +1 -1
- package/dash_core_components/async-graph.js.map +1 -1
- package/dash_core_components/async-highlight.js +1 -1
- package/dash_core_components/async-highlight.js.map +1 -1
- package/dash_core_components/async-markdown.js +1 -1
- package/dash_core_components/async-markdown.js.map +1 -1
- package/dash_core_components/async-mathjax.js +1 -0
- package/dash_core_components/async-plotlyjs.js +1 -1
- package/dash_core_components/async-slider.js +1 -1
- package/dash_core_components/async-slider.js.map +1 -1
- package/dash_core_components/async-upload.js +1 -1
- package/dash_core_components/async-upload.js.map +1 -1
- package/dash_core_components/dash_core_components-shared.js +1 -1
- package/dash_core_components/dash_core_components-shared.js.map +1 -1
- package/dash_core_components/dash_core_components.js +1 -1
- package/dash_core_components/dash_core_components.js.map +1 -1
- package/dash_core_components/mathjax.js +1 -0
- package/dash_core_components/plotly.min.js +5 -5
- package/lib/components/Checklist.react.js +1 -1
- package/lib/components/Clipboard.react.js +1 -1
- package/lib/components/ConfirmDialog.react.js +1 -1
- package/lib/components/ConfirmDialogProvider.react.js +1 -1
- package/lib/components/DatePickerRange.react.js +1 -1
- package/lib/components/DatePickerSingle.react.js +1 -1
- package/lib/components/Download.react.js +1 -1
- package/lib/components/Dropdown.react.js +1 -1
- package/lib/components/Graph.react.js +18 -4
- package/lib/components/Input.react.js +1 -1
- package/lib/components/Interval.react.js +1 -1
- package/lib/components/Link.react.js +1 -1
- package/lib/components/Loading.react.js +1 -1
- package/lib/components/Location.react.js +1 -1
- package/lib/components/LogoutButton.react.js +1 -1
- package/lib/components/Markdown.react.js +47 -5
- package/lib/components/RadioItems.react.js +1 -1
- package/lib/components/RangeSlider.react.js +1 -1
- package/lib/components/Slider.react.js +1 -1
- package/lib/components/Store.react.js +1 -1
- package/lib/components/Tabs.react.js +1 -1
- package/lib/components/Textarea.react.js +1 -1
- package/lib/components/Tooltip.react.js +7 -5
- package/lib/components/Upload.react.js +1 -1
- package/lib/fragments/DatePickerRange.react.js +21 -14
- package/lib/fragments/DatePickerSingle.react.js +39 -11
- package/lib/fragments/Dropdown.react.js +106 -115
- package/lib/fragments/Graph.react.js +121 -64
- package/lib/fragments/Markdown.react.js +21 -1
- package/lib/fragments/Math.react.js +101 -0
- package/lib/fragments/RangeSlider.react.js +1 -1
- package/lib/fragments/Slider.react.js +1 -1
- package/lib/fragments/Upload.react.js +1 -1
- package/lib/utils/LazyLoader/mathjax.js +22 -0
- package/lib/utils/LazyLoader/plotly.js +1 -1
- package/lib/utils/computeSliderStyle.js +2 -2
- package/lib/utils/mathjax.js +5 -0
- package/package.json +30 -28
|
@@ -17,7 +17,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
17
17
|
|
|
18
18
|
var _DatePickerSingle = require("../components/DatePickerSingle.react");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _convertToMoment2 = _interopRequireDefault(require("../utils/convertToMoment"));
|
|
21
21
|
|
|
22
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
23
|
|
|
@@ -37,7 +37,7 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
37
37
|
|
|
38
38
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
39
39
|
|
|
40
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); }
|
|
40
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
41
41
|
|
|
42
42
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
43
43
|
|
|
@@ -62,6 +62,7 @@ var DatePickerSingle = /*#__PURE__*/function (_Component) {
|
|
|
62
62
|
_classCallCheck(this, DatePickerSingle);
|
|
63
63
|
|
|
64
64
|
_this = _super.call(this);
|
|
65
|
+
_this.propsToState = _this.propsToState.bind(_assertThisInitialized(_this));
|
|
65
66
|
_this.isOutsideRange = _this.isOutsideRange.bind(_assertThisInitialized(_this));
|
|
66
67
|
_this.onDateChange = _this.onDateChange.bind(_assertThisInitialized(_this));
|
|
67
68
|
_this.state = {
|
|
@@ -71,14 +72,41 @@ var DatePickerSingle = /*#__PURE__*/function (_Component) {
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
_createClass(DatePickerSingle, [{
|
|
75
|
+
key: "propsToState",
|
|
76
|
+
value: function propsToState(newProps) {
|
|
77
|
+
var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
78
|
+
var state = {};
|
|
79
|
+
|
|
80
|
+
if (force || newProps.max_date_allowed !== this.props.max_date_allowed) {
|
|
81
|
+
state.max_date_allowed = (0, _convertToMoment2.default)(newProps, ['max_date_allowed']).max_date_allowed;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (force || newProps.min_date_allowed !== this.props.min_date_allowed) {
|
|
85
|
+
state.min_date_allowed = (0, _convertToMoment2.default)(newProps, ['min_date_allowed']).min_date_allowed;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (force || newProps.disabled_days !== this.props.disabled_days) {
|
|
89
|
+
state.disabled_days = (0, _convertToMoment2.default)(newProps, ['disabled_days']).disabled_days;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (Object.keys(state).length) {
|
|
93
|
+
this.setState(state);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
98
|
+
value: function UNSAFE_componentWillReceiveProps(newProps) {
|
|
99
|
+
this.propsToState(newProps);
|
|
100
|
+
}
|
|
101
|
+
}, {
|
|
102
|
+
key: "UNSAFE_componentWillMount",
|
|
103
|
+
value: function UNSAFE_componentWillMount() {
|
|
104
|
+
this.propsToState(this.props, true);
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
74
107
|
key: "isOutsideRange",
|
|
75
108
|
value: function isOutsideRange(date) {
|
|
76
|
-
|
|
77
|
-
max_date_allowed = _convertToMoment.max_date_allowed,
|
|
78
|
-
min_date_allowed = _convertToMoment.min_date_allowed,
|
|
79
|
-
disabled_days = _convertToMoment.disabled_days;
|
|
80
|
-
|
|
81
|
-
return min_date_allowed && date.isBefore(min_date_allowed) || max_date_allowed && date.isAfter(max_date_allowed) || disabled_days && disabled_days.some(function (d) {
|
|
109
|
+
return this.state.min_date_allowed && date.isBefore(this.state.min_date_allowed) || this.state.max_date_allowed && date.isAfter(this.state.max_date_allowed) || this.state.disabled_days && this.state.disabled_days.some(function (d) {
|
|
82
110
|
return date.isSame(d, 'day');
|
|
83
111
|
});
|
|
84
112
|
}
|
|
@@ -118,9 +146,9 @@ var DatePickerSingle = /*#__PURE__*/function (_Component) {
|
|
|
118
146
|
style = _this$props.style,
|
|
119
147
|
className = _this$props.className;
|
|
120
148
|
|
|
121
|
-
var
|
|
122
|
-
date =
|
|
123
|
-
initial_visible_month =
|
|
149
|
+
var _convertToMoment = (0, _convertToMoment2.default)(this.props, ['date', 'initial_visible_month']),
|
|
150
|
+
date = _convertToMoment.date,
|
|
151
|
+
initial_visible_month = _convertToMoment.initial_visible_month;
|
|
124
152
|
|
|
125
153
|
var verticalFlag = calendar_orientation !== 'vertical';
|
|
126
154
|
|
|
@@ -33,25 +33,17 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
33
33
|
|
|
34
34
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
35
35
|
|
|
36
|
-
function
|
|
36
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
37
37
|
|
|
38
|
-
function
|
|
38
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
39
39
|
|
|
40
|
-
function
|
|
40
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
41
41
|
|
|
42
|
-
function
|
|
42
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
43
43
|
|
|
44
|
-
function
|
|
44
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
45
45
|
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
49
|
-
|
|
50
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
51
|
-
|
|
52
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
53
|
-
|
|
54
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
46
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
55
47
|
|
|
56
48
|
// Custom tokenizer, see https://github.com/bvaughn/js-search/issues/43
|
|
57
49
|
// Split on spaces
|
|
@@ -64,114 +56,113 @@ var TOKENIZER = {
|
|
|
64
56
|
});
|
|
65
57
|
}
|
|
66
58
|
};
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
var Dropdown =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
59
|
+
var RDProps = ['multi', 'clearable', 'searchable', 'search_value', 'placeholder', 'disabled', 'optionHeight', 'style', 'className'];
|
|
60
|
+
|
|
61
|
+
var Dropdown = function Dropdown(props) {
|
|
62
|
+
var id = props.id,
|
|
63
|
+
clearable = props.clearable,
|
|
64
|
+
multi = props.multi,
|
|
65
|
+
options = props.options,
|
|
66
|
+
setProps = props.setProps,
|
|
67
|
+
style = props.style,
|
|
68
|
+
loading_state = props.loading_state,
|
|
69
|
+
value = props.value;
|
|
70
|
+
|
|
71
|
+
var _useState = (0, _react.useState)(null),
|
|
72
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
73
|
+
optionsCheck = _useState2[0],
|
|
74
|
+
setOptionsCheck = _useState2[1];
|
|
75
|
+
|
|
76
|
+
var _useMemo = (0, _react.useMemo)(function () {
|
|
77
|
+
var sanitized = (0, _optionTypes.sanitizeOptions)(options);
|
|
78
|
+
return [sanitized, (0, _reactSelectFastFilterOptions.default)({
|
|
79
|
+
options: sanitized,
|
|
80
|
+
tokenizer: TOKENIZER
|
|
81
|
+
})];
|
|
82
|
+
}, [options]),
|
|
83
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
84
|
+
sanitizedOptions = _useMemo2[0],
|
|
85
|
+
filterOptions = _useMemo2[1];
|
|
86
|
+
|
|
87
|
+
var onChange = (0, _react.useCallback)(function (selectedOption) {
|
|
88
|
+
if (multi) {
|
|
89
|
+
var _value;
|
|
90
|
+
|
|
91
|
+
if ((0, _ramda.isNil)(selectedOption)) {
|
|
92
|
+
_value = [];
|
|
93
|
+
} else {
|
|
94
|
+
_value = (0, _ramda.pluck)('value', selectedOption);
|
|
95
|
+
}
|
|
78
96
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
})
|
|
85
|
-
};
|
|
86
|
-
return _this;
|
|
87
|
-
}
|
|
97
|
+
setProps({
|
|
98
|
+
value: _value
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
var _value2;
|
|
88
102
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
value: function UNSAFE_componentWillReceiveProps(newProps) {
|
|
92
|
-
if (newProps.options !== this.props.options) {
|
|
93
|
-
this.setState({
|
|
94
|
-
filterOptions: (0, _reactSelectFastFilterOptions.default)({
|
|
95
|
-
options: (0, _optionTypes.sanitizeOptions)(newProps.options),
|
|
96
|
-
tokenizer: TOKENIZER
|
|
97
|
-
})
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}, {
|
|
102
|
-
key: "render",
|
|
103
|
-
value: function render() {
|
|
104
|
-
var _this$props = this.props,
|
|
105
|
-
id = _this$props.id,
|
|
106
|
-
clearable = _this$props.clearable,
|
|
107
|
-
multi = _this$props.multi,
|
|
108
|
-
options = _this$props.options,
|
|
109
|
-
setProps = _this$props.setProps,
|
|
110
|
-
style = _this$props.style,
|
|
111
|
-
loading_state = _this$props.loading_state,
|
|
112
|
-
value = _this$props.value;
|
|
113
|
-
var filterOptions = this.state.filterOptions;
|
|
114
|
-
var selectedValue;
|
|
115
|
-
|
|
116
|
-
if ((0, _ramda.type)(value) === 'Array') {
|
|
117
|
-
selectedValue = value.join(DELIMITER);
|
|
103
|
+
if ((0, _ramda.isNil)(selectedOption)) {
|
|
104
|
+
_value2 = null;
|
|
118
105
|
} else {
|
|
119
|
-
|
|
106
|
+
_value2 = selectedOption.value;
|
|
120
107
|
}
|
|
121
108
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if ((0, _ramda.isNil)(selectedOption)) {
|
|
148
|
-
_value2 = null;
|
|
149
|
-
} else {
|
|
150
|
-
_value2 = selectedOption.value;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
setProps({
|
|
154
|
-
value: _value2
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
onInputChange: function onInputChange(search_value) {
|
|
159
|
-
return setProps({
|
|
160
|
-
search_value: search_value
|
|
109
|
+
setProps({
|
|
110
|
+
value: _value2
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}, [multi]);
|
|
114
|
+
var onInputChange = (0, _react.useCallback)(function (search_value) {
|
|
115
|
+
return setProps({
|
|
116
|
+
search_value: search_value
|
|
117
|
+
});
|
|
118
|
+
}, []);
|
|
119
|
+
(0, _react.useEffect)(function () {
|
|
120
|
+
if (optionsCheck !== sanitizedOptions && !(0, _ramda.isNil)(value)) {
|
|
121
|
+
var values = sanitizedOptions.map(function (option) {
|
|
122
|
+
return option.value;
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
if (multi && Array.isArray(value)) {
|
|
126
|
+
var invalids = value.filter(function (v) {
|
|
127
|
+
return !values.includes(v);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
if (invalids.length) {
|
|
131
|
+
setProps({
|
|
132
|
+
value: (0, _ramda.without)(invalids, value)
|
|
161
133
|
});
|
|
162
|
-
},
|
|
163
|
-
backspaceRemoves: clearable,
|
|
164
|
-
deleteRemoves: clearable,
|
|
165
|
-
inputProps: {
|
|
166
|
-
autoComplete: 'off'
|
|
167
134
|
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
135
|
+
} else {
|
|
136
|
+
if (!values.includes(value)) {
|
|
137
|
+
setProps({
|
|
138
|
+
value: null
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
171
142
|
|
|
172
|
-
|
|
173
|
-
}
|
|
143
|
+
setOptionsCheck(sanitizedOptions);
|
|
144
|
+
}
|
|
145
|
+
}, [sanitizedOptions, optionsCheck, multi, value]);
|
|
146
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
147
|
+
id: id,
|
|
148
|
+
className: "dash-dropdown",
|
|
149
|
+
style: style,
|
|
150
|
+
"data-dash-is-loading": loading_state && loading_state.is_loading || undefined
|
|
151
|
+
}, /*#__PURE__*/_react.default.createElement(_reactVirtualizedSelect.default, _extends({
|
|
152
|
+
filterOptions: filterOptions,
|
|
153
|
+
options: (0, _optionTypes.sanitizeOptions)(options),
|
|
154
|
+
value: value,
|
|
155
|
+
onChange: onChange,
|
|
156
|
+
onInputChange: onInputChange,
|
|
157
|
+
backspaceRemoves: clearable,
|
|
158
|
+
deleteRemoves: clearable,
|
|
159
|
+
inputProps: {
|
|
160
|
+
autoComplete: 'off'
|
|
161
|
+
}
|
|
162
|
+
}, (0, _ramda.pick)(RDProps, props))));
|
|
163
|
+
};
|
|
174
164
|
|
|
175
|
-
exports.default = Dropdown;
|
|
176
165
|
Dropdown.propTypes = _Dropdown2.propTypes;
|
|
177
|
-
Dropdown.defaultProps = _Dropdown2.defaultProps;
|
|
166
|
+
Dropdown.defaultProps = _Dropdown2.defaultProps;
|
|
167
|
+
var _default = Dropdown;
|
|
168
|
+
exports.default = _default;
|