@xh/hoist 55.2.0 → 55.2.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,55 +1,65 @@
1
1
  # Changelog
2
2
 
3
+ ## v55.2.1 - 2023-02-24
4
+
5
+ ### 🐞 Bug Fixes
6
+
7
+ * Fixed issue where a resizable `Panel` splitter could be rendered incorrectly while dragging.
8
+
3
9
  ## v55.2.0 - 2023-02-10
4
10
 
5
11
  ### 🎁 New Features
12
+
6
13
  * `DashCanvas` enhancements:
7
14
  * Views now support minimum and maximum dimensions.
8
- * Views now expose an `allowDuplicate` flag for controlling the `Duplicate` menu item visibility.
15
+ * Views now expose an `allowDuplicate` flag for controlling the `Duplicate` menu item
16
+ visibility.
9
17
 
10
18
  ### 🐞 Bug Fixes
11
- * Fixed a bug with Cube views having dimensions containing non-string or `null` values. Rows grouped
12
- by these dimensions would report values for the dimension which were incorrectly stringified (e.g.
13
- `null` vs. `'null'` or `'5'` vs. `5`). This has been fixed. Note that the stringified value is
14
- still reported for the rows' `cubeLabel` value, and will be used for the purposes of grouping.
19
+
20
+ * Fixed a bug with Cube views having dimensions containing non-string or `null` values. Rows grouped
21
+ by these dimensions would report values for the dimension which were incorrectly stringified (e.g.
22
+ `'null'` vs. `null` or `'5'` vs. `5`). This has been fixed. Note that the stringified value is
23
+ still reported for the rows' `cubeLabel` value, and will be used for the purposes of grouping.
15
24
 
16
25
  ### ⚙️ Typescript API Adjustments
17
26
 
18
27
  * Improved signatures of `RestStore` APIs.
19
28
 
20
-
21
29
  ## v55.1.0 - 2023-02-09
22
30
 
23
- Version 55 is the first major update of the toolkit after our transition to typescript. In addition
24
- to a host of runtime fixes and features, it also contains a good number of important typescript
25
- typing adjustments, which are listed below. In also includes a helpful
31
+ Version 55 is the first major update of the toolkit after our transition to Typescript. In addition
32
+ to a host of runtime fixes and features, it also contains a good number of important Typescript
33
+ typing adjustments, which are listed below. It also includes a helpful
26
34
  [Typescript upgrade guide](https://github.com/xh/hoist-react/blob/develop/docs/upgrade-to-typescript.md).
27
35
 
28
36
  ### 🎁 New Features
29
37
 
30
38
  * Grid exports can now be tracked in the admin activity tab by setting `exportOptions.track` to
31
39
  true (defaults to false).
32
- * Miscellaneous performance improvements to the cube package
33
- * The implementation of the `Cube.omitFn` feature has been enhanced. This function will now be
34
- called on *all* non-leaf nodes, not just single child nodes. This allows for more flexible
40
+ * Miscellaneous performance improvements to the cube package.
41
+ * The implementation of the `Cube.omitFn` feature has been enhanced. This function will now be
42
+ called on *all* non-leaf nodes, not just single child nodes. This allows for more flexible
35
43
  editing of the shape of the resulting hierarchical data emitted by cube views.
36
44
 
37
45
  ### 🐞 Bug Fixes
46
+
38
47
  * Fixed: grid cell editors would drop a single character edit.
39
48
  * Fixed: grid date input editor's popup did not position correctly in a grid with pinned columns.
40
49
  * Fixed issue with `DashContainer` flashing its "empty" text briefly before loading.
41
50
  * Several Hoist TypeScript types, interfaces, and signatures have been improved or corrected (typing
42
51
  changes only).
43
52
  * Fix bug where a `className` provided to a `Panel` with `modalSupport` would be dropped when in a
44
- modal state. Note this necessitated an additional layer in the `Panel` DOM hierarchy. Highly
53
+ modal state. Note this necessitated an additional layer in the `Panel` DOM hierarchy. Highly
45
54
  specific CSS selectors may be affected.
46
55
  * Fix bug where `TileFrame` would not pass through the keys of its children.
47
56
 
48
57
  ### 💥 Breaking Changes
49
- * The semantics of `Cube.omitFn` have changed such that it will now be called on all aggregate nodes,
50
- not just nodes with a single child. Applications may need to adjust any implementation of this
51
- function accordingly.
52
- * `hoistCmp.containerFactory` and `hoistCmp.withContainerFactory` are removed in favor of
58
+
59
+ * The semantics of `Cube.omitFn` have changed such that it will now be called on all aggregate
60
+ nodes, not just nodes with a single child. Applications may need to adjust any implementation of
61
+ this function accordingly.
62
+ * `hoistCmp.containerFactory` and `hoistCmp.withContainerFactory` are removed in favor of
53
63
  the basic `hoistCmp.factory` and `hoistCmp.withFactory` respectively. See typescript
54
64
  API adjustments below.
55
65
 
@@ -57,22 +67,19 @@ typing adjustments, which are listed below. In also includes a helpful
57
67
 
58
68
  The following Typescript API were adjusted in v55.
59
69
 
60
- * Removed the distinction between `StandardElementFactory` and `ContainerElementFactory`. This
70
+ * Removed the distinction between `StandardElementFactory` and `ContainerElementFactory`. This
61
71
  distinction was deemed to be unnecessary, and overcomplicated the understanding of Hoist.
62
- Applications should simply continue to use `ElementFactory` instead. `hoistCmp.containerFactory` and
63
- `hoistCmp.withContainerFactory` are also removed in favor of the basic `hoistCmp.factory` and
72
+ Applications should simply continue to use `ElementFactory` instead. `hoistCmp.containerFactory`
73
+ and `hoistCmp.withContainerFactory` are also removed in favor of the basic `hoistCmp.factory` and
64
74
  `hoistCmp.withFactory` respectively.
65
-
66
75
  * `HoistProps.modelConfig` now references the type declaration of `HoistModel.config`. See
67
76
  `PanelModel` and `TabContainerModel` for examples.
68
-
69
77
  * The new `SelectOption` type has been made multi-platform and moved to `@xh/hoist/core`.
70
78
 
71
79
  **Note** that we do not intend to make such extensive Typescript changes going forward post-v55.0.
72
80
  These changes were deemed critical and worth adjusting in our first typescript update, and before
73
81
  typescript has been widely adopted in production Hoist apps.
74
82
 
75
-
76
83
  ### ⚙️ Technical
77
84
 
78
85
  * Hoist's `Icon` enumeration has been re-organized slightly to better separate icons that describe
@@ -7,27 +7,27 @@
7
7
  import {ColumnRenderer} from '@xh/hoist/cmp/grid';
8
8
  import {HoistInputProps} from '@xh/hoist/cmp/input';
9
9
  import {PlainObject} from '@xh/hoist/core';
10
+ import {FieldFilterOperator, parseFilter, View} from '@xh/hoist/data';
10
11
  import {
11
12
  BaseFilterFieldSpec,
12
13
  BaseFilterFieldSpecConfig
13
14
  } from '@xh/hoist/data/filter/BaseFilterFieldSpec';
14
- import {FieldFilterOperator, parseFilter, View} from '@xh/hoist/data';
15
15
  import {castArray, compact, flatten, isDate, isEmpty, uniqBy} from 'lodash';
16
16
  import {GridFilterModel} from './GridFilterModel';
17
17
 
18
-
19
18
  export interface GridFilterFieldSpecConfig extends BaseFilterFieldSpecConfig {
20
- /** GridFilterModel instance which owns this fieldSpec. */
19
+ /** GridFilterModel instance owning this fieldSpec. */
21
20
  filterModel?: GridFilterModel;
21
+
22
22
  /**
23
- * function returning a formatted string for each value in this values filter display.
23
+ * Function returning a formatted string for each value in this values filter display.
24
24
  * If not provided, the Column's renderer will be used.
25
25
  */
26
26
  renderer?: ColumnRenderer;
27
27
 
28
28
  /**
29
- * Props to pass through to the HoistInput components used on the custom filter tab. Note
30
- * that the HoistInput component used is decided by fieldType.
29
+ * Props to pass through to the HoistInput components used on the custom filter tab.
30
+ * Note that the HoistInput component used is decided by fieldType.
31
31
  */
32
32
  inputProps?: HoistInputProps;
33
33
 
@@ -36,8 +36,8 @@ export interface GridFilterFieldSpecConfig extends BaseFilterFieldSpecConfig {
36
36
  }
37
37
 
38
38
  /**
39
- * Apps should NOT instantiate this class directly. Provide a config for this object
40
- * to the GridModel's `filterModel` property instead.
39
+ * Apps should NOT instantiate this class directly.
40
+ * Instead, provide a config for this object to the GridModel's `filterModel` config.
41
41
  */
42
42
  export class GridFilterFieldSpec extends BaseFilterFieldSpec {
43
43
 
@@ -53,7 +53,7 @@ export class GridFilterFieldSpec extends BaseFilterFieldSpec {
53
53
  inputProps,
54
54
  defaultOp,
55
55
  ...rest
56
- }:GridFilterFieldSpecConfig) {
56
+ }: GridFilterFieldSpecConfig) {
57
57
  super(rest);
58
58
 
59
59
  this.filterModel = filterModel;
@@ -106,9 +106,7 @@ export class GridFilterFieldSpec extends BaseFilterFieldSpec {
106
106
  this.valueCount = allValues.length;
107
107
  }
108
108
 
109
- /**
110
- * Recursively modify a Filter|CompoundFilter to remove all FieldFilters that reference this column
111
- */
109
+ // Recursively modify a Filter|CompoundFilter to remove all FieldFilters referencing this column
112
110
  cleanFilter(filter) {
113
111
  if (!filter) return filter;
114
112
 
@@ -5,15 +5,22 @@
5
5
  * Copyright © 2022 Extremely Heavy Industries Inc.
6
6
  */
7
7
 
8
- import {GridFilterModelConfig} from '@xh/hoist/cmp/grid';
8
+ import {GridFilterFieldSpec, GridFilterModelConfig} from '@xh/hoist/cmp/grid';
9
9
  import {HoistModel, managed} from '@xh/hoist/core';
10
- import {action, bindable, observable, makeObservable} from '@xh/hoist/mobx';
11
- import {CompoundFilter, FieldFilter, Filter,
12
- FilterLike, flattenFilter, Store, View, withFilterByField, withFilterByTypes} from '@xh/hoist/data';
10
+ import {
11
+ CompoundFilter,
12
+ FieldFilter,
13
+ Filter,
14
+ FilterLike,
15
+ flattenFilter,
16
+ Store,
17
+ View,
18
+ withFilterByField,
19
+ withFilterByTypes
20
+ } from '@xh/hoist/data';
21
+ import {action, bindable, makeObservable, observable} from '@xh/hoist/mobx';
13
22
  import {wait} from '@xh/hoist/promise';
14
- import {find, isString, isNil, castArray, uniq, every, compact} from 'lodash';
15
-
16
- import {GridFilterFieldSpec} from './GridFilterFieldSpec';
23
+ import {castArray, compact, every, find, isNil, isString, uniq} from 'lodash';
17
24
  import {GridModel} from '../GridModel';
18
25
 
19
26
 
@@ -174,4 +181,4 @@ export class GridFilterModel extends HoistModel {
174
181
  const results = compact(filter.filters.map(it => this.getOuterCompoundFilter(it, field)));
175
182
  return results.length === 1 ? results[0] : null;
176
183
  }
177
- }
184
+ }
@@ -90,7 +90,7 @@ export class TabModel extends HoistModel {
90
90
  @bindable.ref icon: ReactElement;
91
91
  @bindable.ref tooltip: ReactNode;
92
92
  @observable disabled: boolean;
93
- excludeFromSwitcher: boolean;
93
+ @bindable excludeFromSwitcher: boolean;
94
94
  showRemoveAction: boolean;
95
95
  content: Content;
96
96
 
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Copyright © 2022 Extremely Heavy Industries Inc.
6
6
  */
7
- import {HoistBase, managed, LoadSupport, LoadSpec, Loadable} from './';
7
+ import {HoistBase, managed, LoadSupport, LoadSpec, Loadable, PlainObject} from './';
8
8
 
9
9
  /**
10
10
  * Core superclass for Services in Hoist. Services are special classes used in both Hoist and
@@ -64,12 +64,12 @@ export class HoistService extends HoistBase implements Loadable {
64
64
  @managed
65
65
  loadSupport: LoadSupport;
66
66
 
67
- get loadModel() {return this.loadSupport?.loadModel}
68
- get lastLoadRequested() {return this.loadSupport?.lastLoadRequested}
69
- get lastLoadCompleted() {return this.loadSupport?.lastLoadCompleted}
70
- get lastLoadException() {return this.loadSupport?.lastLoadException}
71
- async refreshAsync(meta?: object) {return this.loadSupport?.refreshAsync(meta)}
72
- async autoRefreshAsync(meta?: object) {return this.loadSupport?.autoRefreshAsync(meta)}
67
+ get loadModel() {return this.loadSupport?.loadModel}
68
+ get lastLoadRequested() {return this.loadSupport?.lastLoadRequested}
69
+ get lastLoadCompleted() {return this.loadSupport?.lastLoadCompleted}
70
+ get lastLoadException() {return this.loadSupport?.lastLoadException}
71
+ async refreshAsync(meta?: PlainObject) {return this.loadSupport?.refreshAsync(meta)}
72
+ async autoRefreshAsync(meta?: PlainObject) {return this.loadSupport?.autoRefreshAsync(meta)}
73
73
  async doLoadAsync(loadSpec: LoadSpec) {}
74
74
  async loadAsync(loadSpec?: LoadSpec|Partial<LoadSpec>) {
75
75
  return this.loadSupport?.loadAsync(loadSpec);
@@ -37,10 +37,9 @@ export interface ExceptionHandlerOptions {
37
37
  showAlert?: boolean;
38
38
 
39
39
  /**
40
- * If `showAlert`, which type of alert to display.
41
- * Valid options are 'dialog'|'toast'. Defaults to ExceptionHandler.ALERT_TYPE.
40
+ * If `showAlert`, which type of alert to display. Defaults to ExceptionHandler.ALERT_TYPE.
42
41
  */
43
- alertType?: string;
42
+ alertType?: 'dialog'|'toast';
44
43
 
45
44
  /**
46
45
  * Force user to fully refresh the app in order to dismiss - default false, excepting
@@ -80,9 +79,8 @@ export class ExceptionHandler {
80
79
 
81
80
  /**
82
81
  * Default type of alert to use to display exceptions with `showAlert`.
83
- * Valid options are 'dialog'|'toast'.
84
82
  */
85
- static ALERT_TYPE: string = 'dialog';
83
+ static ALERT_TYPE: 'dialog'|'toast' = 'dialog';
86
84
 
87
85
  /**
88
86
  * Default props provided to toast, when alert type is 'toast'
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import {LoadSupport} from './';
9
+ import {PlainObject} from '../types/Types';
9
10
 
10
11
  /**
11
12
  * Object describing a load/refresh request in Hoist.
@@ -46,7 +47,7 @@ export class LoadSpec {
46
47
  owner: LoadSupport;
47
48
 
48
49
  /** Application specific information about the load request */
49
- meta: object;
50
+ meta: PlainObject;
50
51
 
51
52
  /** True if a more recent request to load this object's owner has *started*. */
52
53
  get isStale(): boolean {
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import {forOwn, has, isFunction} from 'lodash';
8
8
  import {warnIf} from '@xh/hoist/utils/js';
9
- import {DefaultHoistProps, HoistBase, managed} from '../';
9
+ import {DefaultHoistProps, HoistBase, managed, PlainObject} from '../';
10
10
  import {ModelSelector} from './';
11
11
  import {LoadSupport, LoadSpec, Loadable} from '../load';
12
12
  import {observable, action, makeObservable} from '@xh/hoist/mobx';
@@ -94,12 +94,12 @@ export abstract class HoistModel extends HoistBase implements Loadable {
94
94
  @managed
95
95
  loadSupport: LoadSupport;
96
96
 
97
- get loadModel() {return this.loadSupport?.loadModel}
98
- get lastLoadRequested() {return this.loadSupport?.lastLoadRequested}
99
- get lastLoadCompleted() {return this.loadSupport?.lastLoadCompleted}
100
- get lastLoadException() {return this.loadSupport?.lastLoadException}
101
- async refreshAsync(meta?: object) {return this.loadSupport?.refreshAsync(meta)}
102
- async autoRefreshAsync(meta?: object) {return this.loadSupport?.autoRefreshAsync(meta)}
97
+ get loadModel() {return this.loadSupport?.loadModel}
98
+ get lastLoadRequested() {return this.loadSupport?.lastLoadRequested}
99
+ get lastLoadCompleted() {return this.loadSupport?.lastLoadCompleted}
100
+ get lastLoadException() {return this.loadSupport?.lastLoadException}
101
+ async refreshAsync(meta?: PlainObject) {return this.loadSupport?.refreshAsync(meta)}
102
+ async autoRefreshAsync(meta?: PlainObject) {return this.loadSupport?.autoRefreshAsync(meta)}
103
103
  async doLoadAsync(loadSpec: LoadSpec) {}
104
104
  async loadAsync(loadSpec?: LoadSpec|Partial<LoadSpec>) {
105
105
  return this.loadSupport?.loadAsync(loadSpec);
package/data/cube/View.ts CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  Cube,
11
11
  CubeField,
12
12
  Filter,
13
+ FilterLike,
13
14
  Query,
14
15
  QueryConfig,
15
16
  Store,
@@ -17,15 +18,14 @@ import {
17
18
  StoreRecordId
18
19
  } from '@xh/hoist/data';
19
20
  import {action, makeObservable, observable} from '@xh/hoist/mobx';
20
- import {throwIf, logWithDebug} from '@xh/hoist/utils/js';
21
21
  import {shallowEqualArrays} from '@xh/hoist/utils/impl';
22
- import {castArray, forEach, groupBy, isEmpty, isNil, map, find} from 'lodash';
22
+ import {logWithDebug, throwIf} from '@xh/hoist/utils/js';
23
+ import {castArray, find, forEach, groupBy, isEmpty, isNil, map} from 'lodash';
23
24
  import {AggregationContext} from './aggregate/AggregationContext';
24
-
25
25
  import {AggregateRow} from './row/AggregateRow';
26
+ import {BaseRow} from './row/BaseRow';
26
27
  import {BucketRow} from './row/BucketRow';
27
28
  import {LeafRow} from './row/LeafRow';
28
- import {BaseRow} from './row/BaseRow';
29
29
 
30
30
  export interface ViewConfig {
31
31
  /** Query to be used to construct this view. */
@@ -177,7 +177,7 @@ export class View extends HoistBase {
177
177
  }
178
178
 
179
179
  /** Update the filter on the current Query.*/
180
- setFilter(filter: Filter) {
180
+ setFilter(filter: FilterLike) {
181
181
  this.updateQuery({filter});
182
182
  }
183
183
 
@@ -159,6 +159,7 @@ export class PanelModel extends HoistModel {
159
159
  // Implementation
160
160
  //-----------------
161
161
  _resizeRef;
162
+ splitterRef = createRef<HTMLDivElement>();
162
163
 
163
164
  constructor({
164
165
  collapsible = true,
@@ -30,7 +30,8 @@ export const splitter = hoistCmp.factory({
30
30
  icon: Icon[chevron](),
31
31
  onClick: () => panelModel.toggleCollapsed(),
32
32
  omit: !showSplitterCollapseButton || !collapsible
33
- })
33
+ }),
34
+ ref: panelModel.splitterRef
34
35
  };
35
36
 
36
37
  return cmp(cfg);
@@ -155,8 +155,8 @@ export class DraggerModel extends HoistModel {
155
155
 
156
156
  private getDraggableSplitter() {
157
157
  // clone .xh-resizable-splitter to get its styling
158
- const splitter = this.panelEl.querySelector('.xh-resizable-splitter'),
159
- ret = splitter.cloneNode();
158
+ const splitter = this.panelModel.splitterRef.current,
159
+ ret = splitter.cloneNode() as HTMLDivElement;
160
160
 
161
161
  ret.style.position = 'absolute';
162
162
  ret.style.display = 'none'; // display = none needed to prevent flash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "55.2.0",
3
+ "version": "55.2.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",