@xh/hoist 48.0.0 → 48.0.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.
package/CHANGELOG.md CHANGED
@@ -1,20 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## v48.0.1 - 2022-04-22
4
+
5
+ ### 🐞 Bug Fixes
6
+
7
+ * Improve default rendering to call `toString()` on non-react elements returned by renderers.
8
+ * Fixed issue with `model` property missing from `Model.componentProps` under certain conditions.
9
+
10
+ [Commit Log](https://github.com/xh/hoist-react/compare/v48.0.0...v48.0.1)
11
+
3
12
  ## v48.0.0 - 2022-04-21
4
13
 
5
14
  ### 🎁 New Features
6
- * A new `DashCanvas` layout component for creating scrollable dashboards that allow users to manually
7
- place and size their widgets using a grid-based layout. Note that this component is in Beta and
8
- its API is subject to change.
15
+
16
+ * A new `DashCanvas` layout component for creating scrollable dashboards that allow users to
17
+ manually place and size their widgets using a grid-based layout. Note that this component is in
18
+ beta and its API is subject to change.
9
19
  * FontAwesome upgraded to v6. This includes redesigns of the majority of bundled icons - please
10
20
  check your app's icon usages carefully.
11
- * `fmtQuantity` now displays values greater than one billion with `b` unit, similar to current
12
- handling of millions with `m`.
13
21
  * Enhancements to admin log viewer. Log file metadata (size & last modified) available with
14
22
  optional upgrade to `hoist-core >= 13.2`.
15
23
  * Mobile `Dialog` will scroll internally if taller than the screen.
16
24
  * Configs passed to `XH.message()` and its variants now take an optional `className` to apply to the
17
25
  message dialog.
26
+ * `fmtQuantity` now displays values greater than one billion with `b` unit, similar to current
27
+ handling of millions with `m`.
18
28
 
19
29
  ### 💥 Breaking Changes
20
30
 
@@ -51,7 +61,6 @@
51
61
 
52
62
  [Commit Log](https://github.com/xh/hoist-react/compare/v47.1.2...v48.0.0)
53
63
 
54
-
55
64
  ## v47.1.2 - 2022-04-01
56
65
 
57
66
  ### 🐞 Bug Fixes
@@ -64,7 +64,7 @@ export const local = {
64
64
  };
65
65
 
66
66
  function truncateIfJson(value, {record}) {
67
- return record.data.type === 'json' ? truncateValue(value) : value;
67
+ return record.data.type === 'json' ? truncateValue(value) : value?.toString();
68
68
  }
69
69
 
70
70
  function truncateValue(value) {
@@ -37,7 +37,7 @@ function renderTables() {
37
37
  let hrVersion = get('hoistReactVersion');
38
38
  if (hrVersion.includes('SNAPSHOT.')) {
39
39
  const snapDate = new Date(parseInt(hrVersion.split('SNAPSHOT.')[1]));
40
- hrVersion += ` (${fmtDateTime(snapDate)})`;
40
+ hrVersion += ` (${fmtDateTime(snapDate, {asHtml: true})})`;
41
41
  }
42
42
 
43
43
  return [
@@ -118,7 +118,7 @@ export class ConfigPanelModel extends HoistModel {
118
118
  case 'json':
119
119
  return truncate(value, {length: 500});
120
120
  default:
121
- return value;
121
+ return value?.toString();
122
122
  }
123
123
  }
124
124
 
@@ -298,7 +298,7 @@ export class QueryEngine {
298
298
 
299
299
  const max = this.model.maxResults;
300
300
  return max > 0 && results.length > max ?
301
- [...results.slice(0, max), msgOption(`${max} of ${fmtNumber(results.length)} results shown`)] :
301
+ [...results.slice(0, max), msgOption(`${max} of ${fmtNumber(results.length, {asHtml: true})} results shown`)] :
302
302
  results;
303
303
  }
304
304
 
@@ -4,10 +4,11 @@
4
4
  *
5
5
  * Copyright © 2021 Extremely Heavy Industries Inc.
6
6
  */
7
- import {div, ul, li, span} from '@xh/hoist/cmp/layout';
7
+ import {div, li, span, ul} from '@xh/hoist/cmp/layout';
8
8
  import {XH} from '@xh/hoist/core';
9
9
  import {genDisplayName} from '@xh/hoist/data';
10
- import {throwIf, warnIf, withDefault, apiRemoved} from '@xh/hoist/utils/js';
10
+ import {apiRemoved, throwIf, warnIf, withDefault} from '@xh/hoist/utils/js';
11
+ import classNames from 'classnames';
11
12
  import {
12
13
  castArray,
13
14
  clone,
@@ -23,8 +24,7 @@ import {
23
24
  isString,
24
25
  toString
25
26
  } from 'lodash';
26
- import {forwardRef, useImperativeHandle, createElement, isValidElement} from 'react';
27
- import classNames from 'classnames';
27
+ import {createElement, forwardRef, isValidElement, useImperativeHandle} from 'react';
28
28
  import {GridSorter} from '../impl/GridSorter';
29
29
  import {ExcelFormat} from './ExcelFormat';
30
30
 
@@ -611,9 +611,11 @@ export class Column {
611
611
  const {renderer} = this;
612
612
  if (!agOptions.cellRenderer) {
613
613
  setRenderer((agParams) => {
614
- const ret = renderer ?
614
+ let ret = renderer ?
615
615
  renderer(agParams.value, {record: agParams.data, column: this, gridModel, agParams}) :
616
- agParams.value?.toString();
616
+ agParams.value;
617
+
618
+ ret = isNil(ret) || isValidElement(ret) ? ret : toString(ret);
617
619
 
618
620
  // Add wrapping span for styling purposes
619
621
  return span({className: 'xh-cell-inner-wrapper', item: ret});
@@ -28,7 +28,7 @@ export const [WebSocketIndicator, webSocketIndicator] = hoistCmp.withFactory({
28
28
  } else if (connected) {
29
29
  icon = Icon.circle({prefix: 'fas', intent: 'success'});
30
30
  txt = 'Connected';
31
- tooltip = `Last message: ${fmtTime(lastMessageTime)}`;
31
+ tooltip = `Last message: ${fmtTime(lastMessageTime, {asHtml: true})}`;
32
32
  } else {
33
33
  icon = Icon.xCircle({intent: 'danger'});
34
34
  txt = 'Disconnected';
@@ -209,9 +209,10 @@ function callRender(render, spec, model, modelLookup, props, ref, displayName) {
209
209
  }
210
210
  const ctx = localModelContext;
211
211
  try {
212
+ props = propsWithModel(props, model);
212
213
  ctx.props = props;
213
214
  ctx.modelLookup = modelLookup;
214
- return render(propsWithModel(props, model), ref);
215
+ return render(props, ref);
215
216
  } finally {
216
217
  ctx.props = null;
217
218
  ctx.modelLookup = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "48.0.0",
3
+ "version": "48.0.1",
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",