@xh/hoist 59.0.1 → 59.0.2

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/CHANGELOG.md CHANGED
@@ -1,11 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 59.0.2 - 2023-08-24
4
+
5
+ ### 🐞 Bug Fixes
6
+
7
+ * Restored support for `Select.selectOnFocus` (had broken with upgrade to `react-select` in v59.0).
8
+ * Fixed `DateInput` bug caused by changes in Chrome v116 - clicking on inputs
9
+ with `enableTextInput: false` now open the date picker popup as expected.
10
+ * Flex inner title element added to `Panel` headers in v59.0, and set `display:flex` on the new
11
+ element itself. Restores previous flexbox container behavior (when not L/R collapsed) for apps
12
+ that are providing custom components as titles.
13
+ * `DashCanvas` now properly updates its layout when shown if the browser window had been resized
14
+ while the component was hidden (e.g. in an inactive tab).
15
+ * Reverted upgrade to `react-select` in v59.0.0 due to issues found with `selectEditor` / inline
16
+ grid editing. We will revisit this upgrade in a future release.
17
+
18
+ ### 📚 Libraries
19
+
20
+ * react-select `5.7 -> 4.3`
21
+ * react-windowed-select `5.1 -> 3.1`
22
+
3
23
  ## 59.0.1 - 2023-08-17
4
24
 
5
25
  ### 🎁 New Features
6
26
 
7
- * Added new `collapsedTitle` prop to `Panel` to make it easier to display different a title
8
- when the panel is collapsed.
27
+ * Added new `Panel.collapsedTitle` prop to make it easier to display a different title when the
28
+ panel is collapsed.
9
29
 
10
30
  ## 59.0.0 - 2023-08-17
11
31
 
@@ -64,8 +84,8 @@
64
84
  * semver `7.3 -> 7.5`
65
85
  * typescript `4.9 -> 5.1`
66
86
  * highcharts `10.3 -> 11.1`
67
- * react-select `4.3.1 -> 5.7.4`
68
- * react-windowed-select `3.1.2 -> 5.1.0`
87
+ * react-select `4.3 -> 5.7`
88
+ * react-windowed-select `3.1 -> 5.1`
69
89
 
70
90
  ## 58.0.1 - 2023-07-13
71
91
 
@@ -5,11 +5,13 @@
5
5
  * Copyright © 2023 Extremely Heavy Industries Inc.
6
6
  */
7
7
  import {ContextMenu} from '@blueprintjs/core';
8
+ import composeRefs from '@seznam/compose-react-refs';
8
9
  import {div, vbox, vspacer} from '@xh/hoist/cmp/layout';
9
10
  import {elementFactory, hoistCmp, HoistProps, refreshContextView, uses, XH} from '@xh/hoist/core';
10
11
  import {dashCanvasAddViewButton} from '@xh/hoist/desktop/cmp/button/DashCanvasAddViewButton';
11
12
  import '@xh/hoist/desktop/register';
12
13
  import {Classes, overlay} from '@xh/hoist/kit/blueprint';
14
+ import {useOnVisibleChange} from '@xh/hoist/utils/react';
13
15
  import classNames from 'classnames';
14
16
  import ReactGridLayout, {WidthProvider} from 'react-grid-layout';
15
17
  import 'react-grid-layout/css/styles.css';
@@ -36,10 +38,16 @@ export const [DashCanvas, dashCanvas] = hoistCmp.withFactory<DashCanvasProps>({
36
38
  className: 'xh-dash-canvas',
37
39
  model: uses(DashCanvasModel),
38
40
 
39
- render({className, model}) {
41
+ render({className, model}, ref) {
40
42
  const isDraggable = !model.layoutLocked,
41
43
  isResizable = !model.layoutLocked;
42
44
 
45
+ ref = composeRefs(
46
+ ref,
47
+ model.ref,
48
+ useOnVisibleChange(viz => model.onVisibleChange(viz))
49
+ );
50
+
43
51
  return refreshContextView({
44
52
  model: model.refreshContextModel,
45
53
  item: div({
@@ -48,7 +56,7 @@ export const [DashCanvas, dashCanvas] = hoistCmp.withFactory<DashCanvasProps>({
48
56
  isDraggable ? `${className}--draggable` : null,
49
57
  isResizable ? `${className}--resizable` : null
50
58
  ),
51
- ref: model.ref,
59
+ ref,
52
60
  onContextMenu: e => onContextMenu(e, model),
53
61
  items: [
54
62
  reactGridLayout({
@@ -198,18 +198,19 @@ export class DashCanvasModel extends DashModel<
198
198
  this.loadState(persistState?.state ?? initialState);
199
199
  this.state = this.buildState();
200
200
 
201
- this.addReaction({
202
- track: () => this.viewState,
203
- run: () => this.publishState()
204
- });
205
-
206
- this.addReaction({
207
- when: () => !!this.ref.current,
208
- run: () => {
209
- const {current: node} = this.ref;
210
- this.scrollbarVisible = node.offsetWidth > node.clientWidth;
201
+ this.addReaction(
202
+ {
203
+ track: () => this.viewState,
204
+ run: () => this.publishState()
205
+ },
206
+ {
207
+ when: () => !!this.ref.current,
208
+ run: () => {
209
+ const {current: node} = this.ref;
210
+ this.scrollbarVisible = node.offsetWidth > node.clientWidth;
211
+ }
211
212
  }
212
- });
213
+ );
213
214
  }
214
215
 
215
216
  /** Removes all views from the canvas */
@@ -377,6 +378,12 @@ export class DashCanvasModel extends DashModel<
377
378
  return model;
378
379
  }
379
380
 
381
+ // Trigger window resize event when component becomes visible to ensure layout adjusted to
382
+ // current window size - fixes https://github.com/xh/hoist-react/issues/3215
383
+ onVisibleChange(visible: boolean) {
384
+ if (visible) this.fireWindowResizeEvent();
385
+ }
386
+
380
387
  onRglLayoutChange(rglLayout) {
381
388
  rglLayout = rglLayout.map(it => pick(it, ['i', 'x', 'y', 'w', 'h']));
382
389
  this.setLayout(rglLayout);
@@ -396,7 +403,7 @@ export class DashCanvasModel extends DashModel<
396
403
  if (!node) return;
397
404
  const scrollbarVisible = node.offsetWidth > node.clientWidth;
398
405
  if (scrollbarVisible !== this.scrollbarVisible) {
399
- window.dispatchEvent(new Event('resize'));
406
+ this.fireWindowResizeEvent();
400
407
  this.scrollbarVisible = scrollbarVisible;
401
408
  }
402
409
  }
@@ -522,4 +529,8 @@ export class DashCanvasModel extends DashModel<
522
529
 
523
530
  return {x: defaultX, y: endY ?? rows};
524
531
  }
532
+
533
+ private fireWindowResizeEvent() {
534
+ window.dispatchEvent(new Event('resize'));
535
+ }
525
536
  }
@@ -30,4 +30,10 @@
30
30
  background-color: transparent !important;
31
31
  cursor: not-allowed;
32
32
  }
33
+
34
+ // Prevent browser from capturing click events when input is disabled due to use of
35
+ // enableTextInput: false prop. See https://github.com/xh/hoist-react/issues/3460
36
+ input[disabled] {
37
+ pointer-events: none;
38
+ }
33
39
  }
@@ -485,6 +485,7 @@ const cmp = hoistCmp.factory<DateInputModel>(({model, className, ...props}, ref)
485
485
  ref: model.textInputRef,
486
486
  ...getLayoutProps(props)
487
487
  }),
488
+ className: 'xh-date-input__click-target',
488
489
  onClick: !enableTextInput && !disabled ? model.onOpenPopoverClick : null
489
490
  })
490
491
  }),
@@ -373,9 +373,12 @@ class SelectInputModel extends HoistInputModel {
373
373
  const {reactSelect} = this;
374
374
  if (!reactSelect) return;
375
375
 
376
- // Use of windowedMode, creatable and async variants will create levels of nesting we must
377
- // traverse to get to the underlying Select comp and its inputRef.
378
- let selectComp = reactSelect.select;
376
+ // TODO - after update to react-select v5 in HR v59, could not identify any cases that
377
+ // still required the while loop below. Had been required due to nested layers of
378
+ // components when using enableWindowed, enableCreate, and/or queryFn. Leaving in place to
379
+ // avoid breaking some edge-case we're not finding, but could review/simplify once update
380
+ // is baked in a bit more.
381
+ let selectComp = reactSelect;
379
382
  while (selectComp && !selectComp.inputRef) {
380
383
  selectComp = selectComp.select;
381
384
  }
@@ -12,6 +12,11 @@
12
12
  white-space: nowrap;
13
13
  font-family: var(--xh-panel-title-font-family);
14
14
  font-size: var(--xh-panel-title-font-size-px);
15
+
16
+ &__inner {
17
+ display: flex;
18
+ flex: 1;
19
+ }
15
20
  }
16
21
 
17
22
  &__items {
@@ -45,6 +50,8 @@
45
50
  height: 100%;
46
51
 
47
52
  &__inner {
53
+ display: block;
54
+ flex: none;
48
55
  margin-top: 50%;
49
56
  transform: rotate(90deg);
50
57
  height: calc(1em + 5px);
@@ -1,5 +1,10 @@
1
1
  .xh-inspector {
2
- .xh-modal-support__host > .xh-panel__content > .xh-panel-header {
2
+ & > .xh-panel__content > .xh-panel-header {
3
+ background-color: hsl(33, 93%, 40%);
4
+ color: white;
5
+ }
6
+
7
+ .xh-modal-support__host > div > .xh-panel__content > .xh-panel-header {
3
8
  background-color: hsl(33, 93%, 40%);
4
9
  color: white;
5
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "59.0.1",
3
+ "version": "59.0.2",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",
@@ -68,9 +68,9 @@
68
68
  "react-grid-layout": "^1.3.4",
69
69
  "react-onsenui": "~1.13.2",
70
70
  "react-popper": "~2.3.0",
71
- "react-select": "~5.7.4",
71
+ "react-select": "~4.3.1",
72
72
  "react-transition-group": "~4.4.2",
73
- "react-windowed-select": "~5.1.0",
73
+ "react-windowed-select": "~3.1.2",
74
74
  "regenerator-runtime": "~0.13.11",
75
75
  "resize-observer-polyfill": "~1.5.1",
76
76
  "router5": "~7.0.2",