dash-core-components 4.3.0 → 4.4.1

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.
@@ -167,8 +167,14 @@ const DatePickerRange = ({
167
167
  start_date: dateAsStr(internalStartDate),
168
168
  end_date: dateAsStr(internalEndDate),
169
169
  });
170
- } else if (endChanged && !internalEndDate) {
171
- // End date was cleared (user started a new range).
170
+ } else if (
171
+ updatemode === 'singledate' &&
172
+ endChanged &&
173
+ !internalEndDate
174
+ ) {
175
+ // End date was cleared (user started a new range). Under
176
+ // 'bothdates' we wait for a complete range before updating props,
177
+ // so this partial update is only sent in 'singledate' mode.
172
178
  setProps({
173
179
  start_date: dateAsStr(internalStartDate) ?? null,
174
180
  end_date: null,
@@ -358,7 +364,7 @@ const DatePickerRange = ({
358
364
 
359
365
  return (
360
366
  <div className="dash-datepicker" ref={containerRef}>
361
- <ResizeDetector onResize={handleResize} targets={[containerRef]}/>
367
+ <ResizeDetector onResize={handleResize} targets={[containerRef]} />
362
368
  <Popover.Root
363
369
  open={!disabled && isCalendarOpen}
364
370
  onOpenChange={disabled ? undefined : setIsCalendarOpen}
@@ -388,9 +394,7 @@ const DatePickerRange = ({
388
394
  id={start_date_id || accessibleId}
389
395
  inputClassName="dash-datepicker-input dash-datepicker-start-date"
390
396
  value={startInputValue}
391
- onChange={e =>
392
- setStartInputValue(e.target?.value)
393
- }
397
+ onChange={e => setStartInputValue(e.target?.value)}
394
398
  onKeyDown={handleStartInputKeyDown}
395
399
  onFocus={() => {
396
400
  if (isCalendarOpen) {
@@ -412,9 +416,7 @@ const DatePickerRange = ({
412
416
  id={end_date_id || accessibleId + '-end-date'}
413
417
  inputClassName="dash-datepicker-input dash-datepicker-end-date"
414
418
  value={endInputValue}
415
- onChange={e =>
416
- setEndInputValue(e.target?.value)
417
- }
419
+ onChange={e => setEndInputValue(e.target?.value)}
418
420
  onKeyDown={handleEndInputKeyDown}
419
421
  onFocus={() => {
420
422
  if (isCalendarOpen) {
@@ -148,7 +148,7 @@ const Dropdown = (props: DropdownProps) => {
148
148
  );
149
149
 
150
150
  const onInputChange = useCallback(
151
- search_value => setProps({search_value}),
151
+ (search_value: string) => setProps({search_value}),
152
152
  []
153
153
  );
154
154
 
@@ -119,6 +119,21 @@ var filterEventData = function filterEventData(gd, eventData, event) {
119
119
  filteredEventData = {
120
120
  points
121
121
  };
122
+ var includeXYVals = event === 'hover' && gd._fullLayout.hoveranywhere === true || event === 'click' && gd._fullLayout.clickanywhere === true;
123
+ if (includeXYVals) {
124
+ if ((0, _ramda.has)('xvals', eventData)) {
125
+ filteredEventData.xvals = eventData.xvals;
126
+ }
127
+ if ((0, _ramda.has)('yvals', eventData)) {
128
+ filteredEventData.yvals = eventData.yvals;
129
+ }
130
+ if ((0, _ramda.has)('xaxes', eventData)) {
131
+ filteredEventData.xaxes_id = eventData.xaxes[0]._id;
132
+ }
133
+ if ((0, _ramda.has)('yaxes', eventData)) {
134
+ filteredEventData.yaxes_id = eventData.yaxes[0]._id;
135
+ }
136
+ }
122
137
  } else if (event === 'relayout' || event === 'restyle') {
123
138
  /*
124
139
  * relayout shouldn't include any big objects
@@ -447,28 +462,35 @@ var PlotlyGraph = /*#__PURE__*/function (_Component) {
447
462
  relayoutData: relayout
448
463
  });
449
464
  }
450
- // Sync shapes from gd.layout to figure when shapes are modified by user
451
- // This is needed because getLayout() clones layout to prevent mutation issues
465
+ // Sync user-driven layout changes (pan/zoom ranges, edited
466
+ // shapes, annotations, ...) from gd.layout back to the figure
467
+ // prop. This is needed because getLayout() clones layout to
468
+ // prevent mutation issues, so plotly.js only updates its own
469
+ // copy and the figure prop (used as the base for Patch
470
+ // updates) would otherwise go stale.
452
471
  if (eventData && gd.layout) {
453
- var hasShapeChanges = Object.keys(eventData).some(function (key) {
454
- return key === 'shapes' || key.startsWith('shapes[');
455
- });
456
- if (hasShapeChanges) {
472
+ var _this4$props$figure = _this4.props.figure,
473
+ figure = _this4$props$figure === void 0 ? {} : _this4$props$figure;
474
+ var updates = {};
475
+ for (var _i = 0, _Object$keys = Object.keys(eventData); _i < _Object$keys.length; _i++) {
457
476
  var _figure$layout;
458
- var _this4$props$figure = _this4.props.figure,
459
- figure = _this4$props$figure === void 0 ? {} : _this4$props$figure;
460
- var currentShapes = figure === null || figure === void 0 || (_figure$layout = figure.layout) === null || _figure$layout === void 0 ? void 0 : _figure$layout.shapes;
461
- var newShapes = gd.layout.shapes;
462
- if (!(0, _ramda.equals)(currentShapes, newShapes)) {
463
- setProps({
464
- figure: _objectSpread(_objectSpread({}, figure), {}, {
465
- layout: _objectSpread(_objectSpread({}, figure === null || figure === void 0 ? void 0 : figure.layout), {}, {
466
- shapes: newShapes
467
- })
468
- })
469
- });
477
+ var eventKey = _Object$keys[_i];
478
+ // 'xaxis.range[0]' -> 'xaxis', 'shapes[1].x0' -> 'shapes'
479
+ var key = eventKey.split('.')[0].split('[')[0];
480
+ if (
481
+ // autosize/width/height relayouts come from the
482
+ // resize machinery, not from user interactions.
483
+ !(0, _ramda.includes)(key, ['autosize', 'width', 'height']) && !(key in updates) && !(0, _ramda.equals)(figure === null || figure === void 0 || (_figure$layout = figure.layout) === null || _figure$layout === void 0 ? void 0 : _figure$layout[key], gd.layout[key])) {
484
+ updates[key] = (0, _ramda.clone)(gd.layout[key]);
470
485
  }
471
486
  }
487
+ if (Object.keys(updates).length) {
488
+ setProps({
489
+ figure: _objectSpread(_objectSpread({}, figure), {}, {
490
+ layout: _objectSpread(_objectSpread({}, figure === null || figure === void 0 ? void 0 : figure.layout), updates)
491
+ })
492
+ });
493
+ }
472
494
  }
473
495
  });
474
496
  gd.on('plotly_restyle', function (eventData) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dash-core-components",
3
- "version": "4.3.0",
3
+ "version": "4.4.1",
4
4
  "description": "Core component suite for Dash",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,10 +41,10 @@
41
41
  "@fortawesome/free-solid-svg-icons": "^5.15.4",
42
42
  "@fortawesome/react-fontawesome": "^0.1.17",
43
43
  "@radix-ui/react-icons": "^1.3.2",
44
- "@radix-ui/react-popover": "^1.1.15",
45
- "@radix-ui/react-select": "^2.1.3",
46
- "@radix-ui/react-slider": "^1.3.6",
47
- "@radix-ui/react-tooltip": "^1.2.8",
44
+ "@radix-ui/react-popover": "^1.1.20",
45
+ "@radix-ui/react-select": "^2.3.4",
46
+ "@radix-ui/react-slider": "^1.4.4",
47
+ "@radix-ui/react-tooltip": "^1.2.13",
48
48
  "base64-js": "^1.5.1",
49
49
  "d3-format": "^1.4.5",
50
50
  "date-fns": "^4.1.0",
@@ -55,7 +55,7 @@
55
55
  "mathjax": "^3.2.2",
56
56
  "node-polyfill-webpack-plugin": "^2.0.1",
57
57
  "prop-types": "^15.8.1",
58
- "ramda": "^0.30.1",
58
+ "ramda": "^0.32.0",
59
59
  "react-addons-shallow-compare": "^15.6.3",
60
60
  "react-docgen": "^5.4.3",
61
61
  "react-dropzone": "^4.1.2",
@@ -76,24 +76,25 @@
76
76
  "@babel/preset-typescript": "^7.28.5",
77
77
  "@plotly/dash-component-plugins": "^1.2.3",
78
78
  "@plotly/webpack-dash-dynamic-import": "^1.3.0",
79
+ "@testing-library/dom": "^10.0.0",
79
80
  "@testing-library/jest-dom": "^6.9.1",
80
- "@testing-library/react": "^12.1.5",
81
+ "@testing-library/react": "^16.3.2",
81
82
  "@types/d3-format": "^3.0.4",
82
83
  "@types/fast-isnumeric": "^1.1.2",
83
84
  "@types/jest": "^29.5.14",
84
85
  "@types/js-search": "^1.4.4",
85
86
  "@types/ramda": "^0.31.0",
86
- "@types/react": "^16.14.8",
87
- "@types/react-dom": "^16.9.13",
87
+ "@types/react": "^18",
88
+ "@types/react-dom": "^18",
88
89
  "@types/react-input-autosize": "^2.2.4",
89
90
  "@types/react-window": "^1.8.8",
90
91
  "@types/uniqid": "^5.3.4",
91
92
  "@typescript-eslint/eslint-plugin": "^5.59.7",
92
93
  "@typescript-eslint/parser": "^5.59.7",
93
- "babel-loader": "^9.2.1",
94
+ "babel-loader": "^10.1.1",
94
95
  "copyfiles": "^2.4.1",
95
- "css-loader": "^6.8.1",
96
- "es-check": "^7.1.1",
96
+ "css-loader": "^7.1.4",
97
+ "es-check": "^9.6.4",
97
98
  "eslint": "^8.41.0",
98
99
  "eslint-config-prettier": "^8.8.0",
99
100
  "eslint-plugin-import": "^2.27.5",
@@ -103,16 +104,16 @@
103
104
  "jest-environment-jsdom": "^30.2.0",
104
105
  "npm-run-all": "^4.1.5",
105
106
  "prettier": "^2.8.8",
106
- "react": "^16.14.0",
107
- "react-dom": "^16.14.0",
108
- "react-jsx-parser": "1.21.0",
109
- "rimraf": "^5.0.5",
107
+ "react": "^18",
108
+ "react-dom": "^18",
109
+ "react-jsx-parser": "2.4.1",
110
+ "rimraf": "^6.1.3",
110
111
  "style-loader": "^3.3.3",
111
112
  "styled-jsx": "^5.1.7",
112
113
  "ts-jest": "^29.1.0",
113
114
  "typescript": "^5.8.3",
114
115
  "webpack": "^5.104.1",
115
- "webpack-cli": "^5.1.4"
116
+ "webpack-cli": "^7.0.3"
116
117
  },
117
118
  "optionalDependencies": {
118
119
  "fsevents": "*"