@xh/hoist 53.0.0 → 53.1.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/CHANGELOG.md CHANGED
@@ -1,18 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## v53.1.0 - 2022-11-03
4
+
5
+ ### 🎁 New Features
6
+ * `PanelModel` now supports `modalSupport.defaultModal` option to allow rendering a Panel in an
7
+ initially modal state.
8
+
9
+ ### 🐞 Bug Fixes
10
+ * Fixed layout issues caused by top-level DOM elements created by `ModalSupport`
11
+ and `ColumnWidthCalculator` (grid auto-sizing). Resolved occasional gaps between select inputs and
12
+ their drop-down menus.
13
+ * Fix desktop styling bug where buttons inside a `Toast` could be rendered with a different color
14
+ than the rest of the toast contents.
15
+ * Fix `GridModel` bug where `Store` would fail to recognize dot-separated field names as paths
16
+ when provided as part of a field spec in object form.
17
+
18
+ ### ⚙️ Technical
19
+
20
+ * Snap info (if available) from the `navigator.connection` global within the built-in call to track
21
+ each application load.
22
+
3
23
  ## v53.0.0 - 2022-10-19
4
24
 
5
25
  ### 🎁 New Features
6
26
 
7
- * New application permission role: `HOIST_ADMIN_READER`.
8
- * All Hoist Framework Admin tabs are now readable (read only) by users who have this new role: `HOIST_ADMIN_READER`.
9
- * Actions (edit, delete, etc) in the Hoist Framework Admin tabs are available only to users who have the `HOIST_ADMIN` role.
10
- * The `HOIST_ADMIN` role inherits the new `HOIST_ADMIN_READER` role.
11
- * The `HOIST_ADMIN_READER` role can be assigned to users in the `roles` soft-config.
27
+ * The Hoist Admin Console is now accessible in a read-only capacity to users assigned the
28
+ new `HOIST_ADMIN_READER` role.
29
+ * The pre-existing `HOIST_ADMIN` role inherits this new role, and is still required to take any
30
+ actions that modify data.
12
31
 
13
32
  ### 💥 Breaking Changes
14
- * Upgrading to Hoist-React v53+ requires an upgrade of Hoist-Core to v14.4.0+
15
- to take advantage of the new `HOIST_ADMIN_READER` role.
33
+
34
+ * Requires `hoist-core >= 14.4` to support the new `HOIST_ADMIN_READER` role described above. (Core
35
+ upgrade _not_ required otherwise.)
16
36
 
17
37
  ## v52.0.2 - 2022-10-13
18
38
 
@@ -81,6 +81,7 @@ export class DifferModel extends HoistModel {
81
81
 
82
82
  this.url = entityName + 'DiffAdmin';
83
83
 
84
+ const rendererIsComplex = true;
84
85
  this.gridModel = new GridModel({
85
86
  store: {
86
87
  idSpec: data => {
@@ -107,17 +108,19 @@ export class DifferModel extends HoistModel {
107
108
  hidden: true
108
109
  },
109
110
  ...this.columnFields.map(it => {
110
- const colDef = {renderer: this.fieldRenderer, maxWidth: 200};
111
+ const colDef = {renderer: this.fieldRenderer, rendererIsComplex, maxWidth: 200};
111
112
  return isString(it) ? {field: it, ...colDef} : {...colDef, ...it};
112
113
  }),
113
114
  {
114
115
  field: 'localValue',
115
116
  flex: true,
117
+ rendererIsComplex,
116
118
  renderer: this.valueRenderer
117
119
  },
118
120
  {
119
121
  field: 'remoteValue',
120
122
  flex: true,
123
+ rendererIsComplex,
121
124
  renderer: this.valueRenderer
122
125
  }
123
126
  ],
@@ -1445,7 +1445,7 @@ export class GridModel extends HoistModel {
1445
1445
  const newFields = [];
1446
1446
  forEach(leafColsByFieldName, (col, name) => {
1447
1447
  if (name !== 'id' && !storeFieldNames.includes(name)) {
1448
- newFields.push({name, displayName: col.displayName, ...col.fieldSpec});
1448
+ newFields.push({displayName: col.displayName, ...col.fieldSpec, name});
1449
1449
  }
1450
1450
  });
1451
1451
 
@@ -82,7 +82,7 @@ export class ColumnWidthCalculator {
82
82
  levelMaxes = await Promise.all(levelTasks);
83
83
  return max(levelMaxes);
84
84
  } else {
85
- return this.calcLevelWidthAsync(gridModel, records, column, options);
85
+ return await this.calcLevelWidthAsync(gridModel, records, column, options);
86
86
  }
87
87
  } catch (e) {
88
88
  console.warn(`Error calculating max data width for column "${column.colId}".`, e);
@@ -52,6 +52,7 @@
52
52
  // High level of specificity here required to override built-in BP styles
53
53
  &.bp4-toast .bp4-button {
54
54
  background: none !important;
55
+ color: white !important;
55
56
 
56
57
  .bp4-icon {
57
58
  color: white !important;
@@ -111,7 +111,10 @@ export class DockViewModel extends HoistModel {
111
111
  this.refreshContextModel = new ManagedRefreshContextModel(this);
112
112
 
113
113
  this.modalSupportModel = new ModalSupportModel({
114
- width: width ?? null, height: height ?? null, canOutsideClickClose: false
114
+ width: width ?? null,
115
+ height: height ?? null,
116
+ defaultModal: !docked,
117
+ canOutsideClickClose: false
115
118
  });
116
119
  }
117
120
 
@@ -30,6 +30,14 @@
30
30
  margin-right: var(--xh-pad-px);
31
31
  }
32
32
  }
33
+
34
+ .xh-modal-support__inline {
35
+ // Don't flex-shrink docked dock views, allowing them to clip the container.
36
+ flex: none;
37
+ // Workaround for this class getting `width: 100%` for 1 frame while waiting for
38
+ // an observable ref. See ModalSupport.js.
39
+ width: auto !important;
40
+ }
33
41
  }
34
42
 
35
43
  .xh-dock-view {
@@ -11,6 +11,7 @@ import '@xh/hoist/desktop/register';
11
11
  import {dialog} from '@xh/hoist/kit/blueprint';
12
12
  import {Children} from 'react';
13
13
  import {createPortal} from 'react-dom';
14
+ import './ModalSupport.scss';
14
15
  import {ModalSupportModel} from './ModalSupportModel';
15
16
 
16
17
  /**
@@ -0,0 +1,7 @@
1
+ .xh-modal-support {
2
+ // Unwind the (surprising) 500px default dialog width coming from Blueprint.
3
+ // If the user has configured their ModalSupportOptions with null width, this should be respected.
4
+ &__modal {
5
+ width: auto;
6
+ }
7
+ }
@@ -35,6 +35,7 @@ export class ModalSupportModel extends HoistModel {
35
35
  this.hostNode = this.createHostNode();
36
36
 
37
37
  this.options = opts instanceof ModalSupportOptions ? opts : new ModalSupportOptions(opts);
38
+ this.isModal = this.options.defaultModal;
38
39
 
39
40
  const {inlineRef, modalRef, hostNode} = this;
40
41
  this.addReaction({
@@ -54,20 +55,13 @@ export class ModalSupportModel extends HoistModel {
54
55
  const hostNode = document.createElement('div');
55
56
  hostNode.style.all = 'inherit';
56
57
  hostNode.classList.add('xh-modal-support__host');
57
- document.body.appendChild(hostNode);
58
58
  return hostNode;
59
59
  }
60
60
 
61
- /**
62
- * Toggle the current state of `isModal`
63
- */
64
61
  toggleIsModal() {
65
62
  this.setIsModal(!this.isModal);
66
63
  }
67
64
 
68
- /**
69
- * Destroy the `hostNode` DOM Element
70
- */
71
65
  destroy() {
72
66
  this.hostNode.remove();
73
67
  super.destroy();
@@ -13,6 +13,8 @@ export class ModalSupportOptions {
13
13
  width;
14
14
  /** @member {?String|number} */
15
15
  height;
16
+ /** @member {boolean} */
17
+ defaultModal;
16
18
  /** @member boolean */
17
19
  canOutsideClickClose;
18
20
  /**
@@ -20,11 +22,18 @@ export class ModalSupportOptions {
20
22
  * @param {Object} opts
21
23
  * @param {String|number} [width] - css width
22
24
  * @param {String|number} [height] - css height
25
+ * @param {boolean} [defaultModal] - begin in modal mode?
23
26
  * @param {boolean} [canOutsideClickClose]
24
27
  */
25
- constructor({width = '90vw', height = '90vh', canOutsideClickClose = true} = {}) {
28
+ constructor({
29
+ width = '90vw',
30
+ height = '90vh',
31
+ defaultModal = false,
32
+ canOutsideClickClose = true
33
+ } = {}) {
26
34
  this.width = width;
27
35
  this.height = height;
36
+ this.defaultModal = defaultModal;
28
37
  this.canOutsideClickClose = canOutsideClickClose;
29
38
  }
30
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "53.0.0",
3
+ "version": "53.1.0",
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",
@@ -7,7 +7,7 @@
7
7
  import {pick} from 'lodash';
8
8
 
9
9
  /**
10
- * Extract information about the client browser window and screen
10
+ * Extract information (if available) about the client browser's window, screen, and network speed.
11
11
  */
12
12
  export function getClientDeviceInfo() {
13
13
  const data = pick(window, 'screen', 'devicePixelRatio', 'screenX', 'screenY', 'innerWidth', 'innerHeight', 'outerWidth', 'outerHeight');
@@ -18,5 +18,9 @@ export function getClientDeviceInfo() {
18
18
  }
19
19
  }
20
20
 
21
+ if (window.navigator.connection) {
22
+ data.connection = pick(window.navigator.connection, 'downlink', 'effectiveType', 'rtt');
23
+ }
24
+
21
25
  return data;
22
26
  }