dash-core-components 2.3.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.
@@ -206,6 +206,7 @@ var ControlledPlotlyGraph = /*#__PURE__*/(0, _react.memo)(function (props) {
206
206
  className: extendedClassName
207
207
  })));
208
208
  });
209
+ ControlledPlotlyGraph.displayName = 'ControlledPlotlyGraph';
209
210
  PlotlyGraph.propTypes = _objectSpread(_objectSpread({}, _Graph.privatePropTypes), {}, {
210
211
  /**
211
212
  * The ID of this component, used to identify dash components
@@ -120,6 +120,11 @@ DashMarkdown.propTypes = {
120
120
  */
121
121
  dangerously_allow_html: _propTypes.default.bool,
122
122
 
123
+ /**
124
+ * A string for the target attribute to use on links (such as "_blank")
125
+ */
126
+ link_target: _propTypes.default.string,
127
+
123
128
  /**
124
129
  * A markdown string (or array of strings) that adhreres to the CommonMark spec
125
130
  */
@@ -7,6 +7,8 @@ exports.default = void 0;
7
7
 
8
8
  var _style = _interopRequireDefault(require("styled-jsx/style"));
9
9
 
10
+ var _react = _interopRequireDefault(require("react"));
11
+
10
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
13
 
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -24,18 +26,18 @@ var Tooltip = function Tooltip(props) {
24
26
  loading_state = props.loading_state;
25
27
  var is_loading = loading_state === null || loading_state === void 0 ? void 0 : loading_state.is_loading;
26
28
  var show = props.show && bbox;
27
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
29
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
28
30
  className: _style.default.dynamic([["1224640168", [(bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.x1) - (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.y1) - (bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, show ? 'inline-block' : 'none', props.targetable ? 'auto' : 'none', border_color, background_color, props.zindex, props.zindex, border_color, background_color, border_color, background_color, border_color, background_color, border_color, background_color]]]) + " " + "dcc-tooltip-bounding-box"
29
- }, /*#__PURE__*/React.createElement("span", {
31
+ }, /*#__PURE__*/_react.default.createElement("span", {
30
32
  "data-dash-is-loading": is_loading || undefined,
31
33
  className: _style.default.dynamic([["1224640168", [(bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.x1) - (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.y1) - (bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, show ? 'inline-block' : 'none', props.targetable ? 'auto' : 'none', border_color, background_color, props.zindex, props.zindex, border_color, background_color, border_color, background_color, border_color, background_color, border_color, background_color]]]) + " " + "hover hover-".concat(props.direction)
32
- }, /*#__PURE__*/React.createElement("span", {
34
+ }, /*#__PURE__*/_react.default.createElement("span", {
33
35
  id: id,
34
36
  style: props.style,
35
37
  className: _style.default.dynamic([["1224640168", [(bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.x1) - (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.y1) - (bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, show ? 'inline-block' : 'none', props.targetable ? 'auto' : 'none', border_color, background_color, props.zindex, props.zindex, border_color, background_color, border_color, background_color, border_color, background_color, border_color, background_color]]]) + " " + "hover-content ".concat(props.className)
36
- }, is_loading ? /*#__PURE__*/React.createElement("span", {
38
+ }, is_loading ? /*#__PURE__*/_react.default.createElement("span", {
37
39
  className: _style.default.dynamic([["1224640168", [(bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.x1) - (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.y1) - (bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, show ? 'inline-block' : 'none', props.targetable ? 'auto' : 'none', border_color, background_color, props.zindex, props.zindex, border_color, background_color, border_color, background_color, border_color, background_color, border_color, background_color]]])
38
- }, props.loading_text) : props.children))), /*#__PURE__*/React.createElement(_style.default, {
40
+ }, props.loading_text) : props.children))), /*#__PURE__*/_react.default.createElement(_style.default, {
39
41
  id: "1224640168",
40
42
  dynamic: [(bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.x1) - (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, (bbox === null || bbox === void 0 ? void 0 : bbox.y1) - (bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, show ? 'inline-block' : 'none', props.targetable ? 'auto' : 'none', border_color, background_color, props.zindex, props.zindex, border_color, background_color, border_color, background_color, border_color, background_color, border_color, background_color]
41
43
  }, ".dcc-tooltip-bounding-box.__jsx-style-dynamic-selector{position:absolute;top:".concat((bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, "px;left:").concat((bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, "px;width:").concat((bbox === null || bbox === void 0 ? void 0 : bbox.x1) - (bbox === null || bbox === void 0 ? void 0 : bbox.x0) || 0, "px;height:").concat((bbox === null || bbox === void 0 ? void 0 : bbox.y1) - (bbox === null || bbox === void 0 ? void 0 : bbox.y0) || 0, "px;display:").concat(show ? 'inline-block' : 'none', ";pointer-events:").concat(props.targetable ? 'auto' : 'none', ";}.hover.__jsx-style-dynamic-selector{position:absolute;}.hover-right.__jsx-style-dynamic-selector{-webkit-transform:translate(5px,0);-ms-transform:translate(5px,0);transform:translate(5px,0);top:50%;left:100%;}.hover-left.__jsx-style-dynamic-selector{-webkit-transform:translate(-5px,0);-ms-transform:translate(-5px,0);transform:translate(-5px,0);top:50%;}.hover-bottom.__jsx-style-dynamic-selector{-webkit-transform:translate(0,6px);-ms-transform:translate(0,6px);transform:translate(0,6px);top:100%;left:50%;}.hover-top.__jsx-style-dynamic-selector{-webkit-transform:translate(0,-5px);-ms-transform:translate(0,-5px);transform:translate(0,-5px);left:50%;}.hover-content.__jsx-style-dynamic-selector{position:absolute;border:1px solid ").concat(border_color, ";border-radius:2px;padding:5px 10px;background:").concat(background_color, ";white-space:nowrap;z-index:").concat(props.zindex, ";pointer-events:none;}.hover.__jsx-style-dynamic-selector .hover-content.__jsx-style-dynamic-selector,.hover-right.__jsx-style-dynamic-selector .hover-content.__jsx-style-dynamic-selector{-webkit-transform:translate(0,-50%);-ms-transform:translate(0,-50%);transform:translate(0,-50%);}.hover-left.__jsx-style-dynamic-selector .hover-content.__jsx-style-dynamic-selector{-webkit-transform:translate(-100%,-50%);-ms-transform:translate(-100%,-50%);transform:translate(-100%,-50%);}.hover-top.__jsx-style-dynamic-selector .hover-content.__jsx-style-dynamic-selector{-webkit-transform:translate(-50%,-100%);-ms-transform:translate(-50%,-100%);transform:translate(-50%,-100%);}.hover-bottom.__jsx-style-dynamic-selector .hover-content.__jsx-style-dynamic-selector{-webkit-transform:translate(-50%,0);-ms-transform:translate(-50%,0);transform:translate(-50%,0);}.hover.__jsx-style-dynamic-selector:before,.hover.__jsx-style-dynamic-selector:after{content:'';width:0;height:0;position:absolute;border-style:solid;top:-6px;z-index:").concat(props.zindex, ";}.hover.__jsx-style-dynamic-selector:before,.hover.__jsx-style-dynamic-selector:after,.hover-right.__jsx-style-dynamic-selector:before,.hover-right.__jsx-style-dynamic-selector:after{border-width:6px 6px 6px 0;}.hover-top.__jsx-style-dynamic-selector:before,.hover-top.__jsx-style-dynamic-selector:after{border-width:6px 6px 0 6px;}.hover-bottom.__jsx-style-dynamic-selector:before,.hover-bottom.__jsx-style-dynamic-selector:after{border-width:0 6px 6px 6px;}.hover-left.__jsx-style-dynamic-selector:before,.hover-left.__jsx-style-dynamic-selector:after{border-width:6px 0 6px 6px;}.hover.__jsx-style-dynamic-selector:before,.hover-right.__jsx-style-dynamic-selector:before{border-color:transparent ").concat(border_color, " transparent transparent;left:-5px;}.hover.__jsx-style-dynamic-selector:after,.hover-right.__jsx-style-dynamic-selector:after{border-color:transparent ").concat(background_color, " transparent transparent;left:-4px;}.hover-left.__jsx-style-dynamic-selector:before{border-color:transparent transparent transparent ").concat(border_color, ";left:-1px;}.hover-left.__jsx-style-dynamic-selector:after{border-color:transparent transparent transparent ").concat(background_color, ";left:-2px;}.hover-top.__jsx-style-dynamic-selector:before,.hover-top.__jsx-style-dynamic-selector:after,.hover-bottom.__jsx-style-dynamic-selector:before,.hover-bottom.__jsx-style-dynamic-selector:after{left:-6px;}.hover-bottom.__jsx-style-dynamic-selector:before{border-color:transparent transparent ").concat(border_color, " transparent;}.hover-bottom.__jsx-style-dynamic-selector:after{border-color:transparent transparent ").concat(background_color, " transparent;top:-5px;}.hover-top.__jsx-style-dynamic-selector:before{border-color:").concat(border_color, " transparent transparent transparent;top:-1px;}.hover-top.__jsx-style-dynamic-selector:after{border-color:").concat(background_color, " transparent transparent transparent;top:-2px;}")));
@@ -17,7 +17,7 @@ var _uniqid = _interopRequireDefault(require("uniqid"));
17
17
 
18
18
  var _DatePickerRange = require("../components/DatePickerRange.react");
19
19
 
20
- var _convertToMoment4 = _interopRequireDefault(require("../utils/convertToMoment"));
20
+ var _convertToMoment3 = _interopRequireDefault(require("../utils/convertToMoment"));
21
21
 
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
23
 
@@ -87,6 +87,18 @@ var DatePickerRange = /*#__PURE__*/function (_Component) {
87
87
  state.end_date = newProps.end_date;
88
88
  }
89
89
 
90
+ if (force || newProps.max_date_allowed !== this.props.max_date_allowed) {
91
+ state.max_date_allowed = (0, _convertToMoment3.default)(newProps, ['max_date_allowed']).max_date_allowed;
92
+ }
93
+
94
+ if (force || newProps.min_date_allowed !== this.props.min_date_allowed) {
95
+ state.min_date_allowed = (0, _convertToMoment3.default)(newProps, ['min_date_allowed']).min_date_allowed;
96
+ }
97
+
98
+ if (force || newProps.disabled_days !== this.props.disabled_days) {
99
+ state.disabled_days = (0, _convertToMoment3.default)(newProps, ['disabled_days']).disabled_days;
100
+ }
101
+
90
102
  if (Object.keys(state).length) {
91
103
  this.setState(state);
92
104
  }
@@ -110,7 +122,7 @@ var DatePickerRange = /*#__PURE__*/function (_Component) {
110
122
  setProps = _this$props.setProps,
111
123
  updatemode = _this$props.updatemode,
112
124
  clearable = _this$props.clearable;
113
- var oldMomentDates = (0, _convertToMoment4.default)(this.state, ['start_date', 'end_date']);
125
+ var oldMomentDates = (0, _convertToMoment3.default)(this.state, ['start_date', 'end_date']);
114
126
 
115
127
  if (start_date && !start_date.isSame(oldMomentDates.start_date)) {
116
128
  if (updatemode === 'singledate') {
@@ -147,12 +159,7 @@ var DatePickerRange = /*#__PURE__*/function (_Component) {
147
159
  }, {
148
160
  key: "isOutsideRange",
149
161
  value: function isOutsideRange(date) {
150
- var _convertToMoment = (0, _convertToMoment4.default)(this.props, ['max_date_allowed', 'min_date_allowed', 'disabled_days']),
151
- max_date_allowed = _convertToMoment.max_date_allowed,
152
- min_date_allowed = _convertToMoment.min_date_allowed,
153
- disabled_days = _convertToMoment.disabled_days;
154
-
155
- return min_date_allowed && date.isBefore(min_date_allowed) || max_date_allowed && date.isAfter(max_date_allowed) || disabled_days && disabled_days.some(function (d) {
162
+ 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) {
156
163
  return date.isSame(d, 'day');
157
164
  });
158
165
  }
@@ -187,12 +194,12 @@ var DatePickerRange = /*#__PURE__*/function (_Component) {
187
194
  start_date_id = _this$props2.start_date_id,
188
195
  end_date_id = _this$props2.end_date_id;
189
196
 
190
- var _convertToMoment2 = (0, _convertToMoment4.default)(this.props, ['initial_visible_month']),
191
- initial_visible_month = _convertToMoment2.initial_visible_month;
197
+ var _convertToMoment = (0, _convertToMoment3.default)(this.props, ['initial_visible_month']),
198
+ initial_visible_month = _convertToMoment.initial_visible_month;
192
199
 
193
- var _convertToMoment3 = (0, _convertToMoment4.default)(this.state, ['start_date', 'end_date']),
194
- start_date = _convertToMoment3.start_date,
195
- end_date = _convertToMoment3.end_date;
200
+ var _convertToMoment2 = (0, _convertToMoment3.default)(this.state, ['start_date', 'end_date']),
201
+ start_date = _convertToMoment2.start_date,
202
+ end_date = _convertToMoment2.end_date;
196
203
 
197
204
  var verticalFlag = calendar_orientation !== 'vertical';
198
205
 
@@ -17,7 +17,7 @@ var _react = _interopRequireWildcard(require("react"));
17
17
 
18
18
  var _DatePickerSingle = require("../components/DatePickerSingle.react");
19
19
 
20
- var _convertToMoment3 = _interopRequireDefault(require("../utils/convertToMoment"));
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
 
@@ -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
- var _convertToMoment = (0, _convertToMoment3.default)(this.props, ['max_date_allowed', 'min_date_allowed', 'disabled_days']),
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 _convertToMoment2 = (0, _convertToMoment3.default)(this.props, ['date', 'initial_visible_month']),
122
- date = _convertToMoment2.date,
123
- initial_visible_month = _convertToMoment2.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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
37
37
 
38
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
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 _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
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 _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); }
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 _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
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 _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
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 DELIMITER = ',';
68
-
69
- var Dropdown = /*#__PURE__*/function (_Component) {
70
- _inherits(Dropdown, _Component);
71
-
72
- var _super = _createSuper(Dropdown);
73
-
74
- function Dropdown(props) {
75
- var _this;
76
-
77
- _classCallCheck(this, Dropdown);
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
- _this = _super.call(this, props);
80
- _this.state = {
81
- filterOptions: (0, _reactSelectFastFilterOptions.default)({
82
- options: (0, _optionTypes.sanitizeOptions)(props.options),
83
- tokenizer: TOKENIZER
84
- })
85
- };
86
- return _this;
87
- }
97
+ setProps({
98
+ value: _value
99
+ });
100
+ } else {
101
+ var _value2;
88
102
 
89
- _createClass(Dropdown, [{
90
- key: "UNSAFE_componentWillReceiveProps",
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
- selectedValue = value;
106
+ _value2 = selectedOption.value;
120
107
  }
121
108
 
122
- return /*#__PURE__*/_react.default.createElement("div", {
123
- id: id,
124
- className: "dash-dropdown",
125
- style: style,
126
- "data-dash-is-loading": loading_state && loading_state.is_loading || undefined
127
- }, /*#__PURE__*/_react.default.createElement(_reactVirtualizedSelect.default, _extends({
128
- filterOptions: filterOptions,
129
- options: (0, _optionTypes.sanitizeOptions)(options),
130
- value: selectedValue,
131
- onChange: function onChange(selectedOption) {
132
- if (multi) {
133
- var _value;
134
-
135
- if ((0, _ramda.isNil)(selectedOption)) {
136
- _value = [];
137
- } else {
138
- _value = (0, _ramda.pluck)('value', selectedOption);
139
- }
140
-
141
- setProps({
142
- value: _value
143
- });
144
- } else {
145
- var _value2;
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
- }, (0, _ramda.omit)(['setProps', 'value', 'options'], this.props))));
169
- }
170
- }]);
135
+ } else {
136
+ if (!values.includes(value)) {
137
+ setProps({
138
+ value: null
139
+ });
140
+ }
141
+ }
171
142
 
172
- return Dropdown;
173
- }(_react.Component);
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;
@@ -163,6 +163,7 @@ var DashMarkdown = /*#__PURE__*/function (_Component) {
163
163
  highlight_config = _this$props.highlight_config,
164
164
  loading_state = _this$props.loading_state,
165
165
  dangerously_allow_html = _this$props.dangerously_allow_html,
166
+ link_target = _this$props.link_target,
166
167
  mathjax = _this$props.mathjax,
167
168
  children = _this$props.children,
168
169
  dedent = _this$props.dedent;
@@ -187,6 +188,7 @@ var DashMarkdown = /*#__PURE__*/function (_Component) {
187
188
  }, /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, {
188
189
  source: displayText,
189
190
  escapeHtml: !dangerously_allow_html,
191
+ linkTarget: link_target,
190
192
  plugins: mathjax ? [_remarkMath.default] : [],
191
193
  renderers: {
192
194
  math: function math(props) {
@@ -16,11 +16,11 @@ var _default = function _default() {
16
16
  if (vertical) {
17
17
  style.height = verticalHeight + 'px';
18
18
 
19
- if (!tooltip || !tooltip.always_visible || !(0, _ramda.contains)(tooltip.placement, ['left', 'topRight', 'bottomRight'])) {
19
+ if (!tooltip || !tooltip.always_visible || !(0, _ramda.includes)(tooltip.placement, ['left', 'topRight', 'bottomRight'])) {
20
20
  style.paddingLeft = '0px';
21
21
  }
22
22
  } else {
23
- if (!tooltip || !tooltip.always_visible || !(0, _ramda.contains)(tooltip.placement, ['top', 'topLeft', 'topRight'])) {
23
+ if (!tooltip || !tooltip.always_visible || !(0, _ramda.includes)(tooltip.placement, ['top', 'topLeft', 'topRight'])) {
24
24
  style.paddingTop = '0px';
25
25
  }
26
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dash-core-components",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Core component suite for Dash",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,15 +15,15 @@
15
15
  "private::format.black": "black dash_core_components_base/ tests/ setup.py",
16
16
  "private::format.eslint": "eslint src --fix",
17
17
  "private::format.prettier": "prettier --config .prettierrc --write src/**/*.js",
18
- "private::lint.black": "black --check dash_core_components_base/ tests/ setup.py",
18
+ "private::lint.black": "if [[ ${PYVERSION:-python39} != python36 ]]; then black --check dash_core_components_base/ tests/ setup.py; fi",
19
19
  "private::lint.eslint": "eslint src",
20
20
  "private::lint.flake8": "flake8 --exclude=dash_core_components,node_modules,venv",
21
21
  "private::lint.prettier": "prettier --config .prettierrc src/**/*.js --list-different",
22
22
  "prepublishOnly": "rm -rf lib && babel src --out-dir lib --copy-files && rm -rf lib/jl/ lib/*.jl",
23
23
  "test": "run-s -c lint test:intg test:pyimport",
24
- "test:intg": "pytest --nopercyfinalize --headless tests/integration",
24
+ "test:intg": "pytest --nopercyfinalize --headless tests/integration --reruns 3",
25
25
  "test:pyimport": "python -m unittest tests/test_dash_import.py",
26
- "prebuild:js": "cp node_modules/plotly.js-dist-min/plotly.min.js dash_core_components_base/plotly.min.js && cp node_modules/mathjax/es5/tex-svg.js dash_core_components_base/mathjax.js",
26
+ "prebuild:js": "cp node_modules/plotly.js-dist-min/plotly.min.js dash_core_components_base/plotly.min.js",
27
27
  "build:js": "webpack --mode production",
28
28
  "build:backends": "dash-generate-components ./src/components dash_core_components -p package-info.json && cp dash_core_components_base/** dash_core_components/ && dash-generate-components ./src/components dash_core_components -p package-info.json -k RangeSlider,Slider,Dropdown,RadioItems,Checklist,DatePickerSingle,DatePickerRange,Input,Link --r-prefix 'dcc' --r-suggests 'dash,dashHtmlComponents,jsonlite,plotly' --jl-prefix 'dcc' && black dash_core_components",
29
29
  "build": "run-s prepublishOnly build:js build:backends",
@@ -41,17 +41,17 @@
41
41
  "@fortawesome/free-solid-svg-icons": "^5.15.4",
42
42
  "@fortawesome/react-fontawesome": "^0.1.17",
43
43
  "base64-js": "^1.5.1",
44
- "color": "^4.2.1",
44
+ "color": "^4.2.3",
45
45
  "d3-format": "^1.4.5",
46
46
  "fast-isnumeric": "^1.1.4",
47
47
  "file-saver": "^2.0.5",
48
- "highlight.js": "^11.4.0",
48
+ "highlight.js": "^11.5.1",
49
49
  "mathjax": "^3.2.0",
50
- "moment": "^2.29.1",
50
+ "moment": "^2.29.3",
51
51
  "node-polyfill-webpack-plugin": "^1.1.4",
52
- "plotly.js-dist-min": "2.11.0",
53
- "prop-types": "^15.7.2",
54
- "ramda": "^0.27.1",
52
+ "plotly.js-dist-min": "2.12.1",
53
+ "prop-types": "^15.8.1",
54
+ "ramda": "^0.28.0",
55
55
  "rc-slider": "^9.7.5",
56
56
  "react-addons-shallow-compare": "^15.6.3",
57
57
  "react-dates": "^21.8.0",
@@ -65,32 +65,31 @@
65
65
  "uniqid": "^5.4.0"
66
66
  },
67
67
  "devDependencies": {
68
- "@babel/cli": "^7.17.3",
69
- "@babel/core": "^7.17.4",
68
+ "@babel/cli": "^7.17.10",
69
+ "@babel/core": "^7.17.10",
70
70
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
71
- "@babel/preset-env": "^7.16.11",
71
+ "@babel/preset-env": "^7.17.10",
72
72
  "@babel/preset-react": "^7.16.7",
73
- "@plotly/dash-component-plugins": "^1.2.2",
73
+ "@plotly/dash-component-plugins": "^1.2.3",
74
74
  "@plotly/webpack-dash-dynamic-import": "^1.3.0",
75
- "babel-eslint": "^10.1.0",
76
- "babel-loader": "^8.2.3",
75
+ "babel-loader": "^8.2.5",
77
76
  "component-playground": "^3.2.1",
78
77
  "copyfiles": "^2.4.1",
79
- "css-loader": "^6.6.0",
78
+ "css-loader": "^6.7.1",
80
79
  "es-check": "^6.2.1",
81
- "eslint": "^7.30.0",
82
- "eslint-config-prettier": "^8.3.0",
83
- "eslint-plugin-import": "^2.25.4",
84
- "eslint-plugin-react": "^7.28.0",
80
+ "eslint": "^8.14.0",
81
+ "eslint-config-prettier": "^8.5.0",
82
+ "eslint-plugin-import": "^2.26.0",
83
+ "eslint-plugin-react": "^7.29.4",
85
84
  "identity-obj-proxy": "^3.0.0",
86
85
  "npm-run-all": "^4.1.5",
87
- "prettier": "^2.5.1",
86
+ "prettier": "^2.6.2",
88
87
  "react": "^16.14.0",
89
88
  "react-dom": "^16.14.0",
90
89
  "react-jsx-parser": "1.21.0",
91
90
  "style-loader": "^3.3.1",
92
91
  "styled-jsx": "^3.4.4",
93
- "webpack": "^5.69.0",
92
+ "webpack": "^5.72.0",
94
93
  "webpack-cli": "^4.9.2"
95
94
  },
96
95
  "files": [