@xh/hoist 67.0.0-SNAPSHOT.1724286422850 → 67.0.0-SNAPSHOT.1724719449021

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
@@ -21,7 +21,8 @@
21
21
  * New property `FetchOptions.asJson` to instruct `FetchService` to decode an HTTP response as JSON.
22
22
  Note that `FetchService` methods suffixed with `Json` will set this property automatically.
23
23
  * `GridModel` will now accept `contextMenu: false` to omit context menus.
24
- * Swapped locations of `primaryOnly` and `active` sliders in `MonitorEditorDialog`.
24
+ * New bindable `AppContainerModel.intializingLoadMaskMessage` property to allow apps to customize
25
+ the loading mask message shown during app initialization.
25
26
 
26
27
  ### 🐞 Bug Fixes
27
28
 
@@ -9,6 +9,7 @@ import {filler} from '@xh/hoist/cmp/layout';
9
9
  import {hoistCmp, uses} from '@xh/hoist/core';
10
10
  import {button} from '@xh/hoist/desktop/cmp/button';
11
11
  import {select} from '@xh/hoist/desktop/cmp/input';
12
+ import {panel} from '@xh/hoist/desktop/cmp/panel';
12
13
  import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
13
14
  import {Icon} from '@xh/hoist/icon';
14
15
  import {dialog, dialogBody} from '@xh/hoist/kit/blueprint';
@@ -17,7 +18,7 @@ export const recategorizeDialog = hoistCmp.factory({
17
18
  model: uses(RecategorizeDialogModel),
18
19
 
19
20
  render({model}) {
20
- const {isOpen} = model;
21
+ const {isOpen, savingTask} = model;
21
22
  if (!isOpen) return null;
22
23
 
23
24
  return dialog({
@@ -26,22 +27,24 @@ export const recategorizeDialog = hoistCmp.factory({
26
27
  style: {width: 300},
27
28
  isOpen: true,
28
29
  isCloseButtonShown: false,
29
- items: [
30
- dialogBody(
30
+ item: panel({
31
+ mask: savingTask,
32
+ item: dialogBody(
31
33
  select({
34
+ autoFocus: true,
32
35
  bind: 'categoryName',
33
36
  enableCreate: true,
34
37
  options: model.options,
35
38
  width: 260
36
39
  })
37
40
  ),
38
- tbar()
39
- ]
41
+ bbar: bbar()
42
+ })
40
43
  });
41
44
  }
42
45
  });
43
46
 
44
- const tbar = hoistCmp.factory<RecategorizeDialogModel>(({model}) => {
47
+ const bbar = hoistCmp.factory<RecategorizeDialogModel>(({model}) => {
45
48
  return toolbar(
46
49
  filler(),
47
50
  button({
@@ -5,7 +5,7 @@
5
5
  * Copyright © 2024 Extremely Heavy Industries Inc.
6
6
  */
7
7
  import {RoleModel} from '@xh/hoist/admin/tabs/userData/roles/RoleModel';
8
- import {HoistModel, XH} from '@xh/hoist/core';
8
+ import {HoistModel, TaskObserver, XH} from '@xh/hoist/core';
9
9
  import {StoreRecord} from '@xh/hoist/data';
10
10
  import {Icon} from '@xh/hoist/icon/Icon';
11
11
  import {action, bindable, makeObservable, observable} from '@xh/hoist/mobx';
@@ -15,6 +15,8 @@ export class RecategorizeDialogModel extends HoistModel {
15
15
  private parent: RoleModel;
16
16
  selectedRecords: StoreRecord[];
17
17
 
18
+ readonly savingTask = TaskObserver.trackLast();
19
+
18
20
  @bindable categoryName = null;
19
21
  @observable isOpen = false;
20
22
 
@@ -53,17 +55,21 @@ export class RecategorizeDialogModel extends HoistModel {
53
55
  it => !it.isGroupRow
54
56
  );
55
57
  const roles: string[] = map(roleSpec, it => it.name);
56
- await XH.fetchService
57
- .postJson({
58
- url: 'roleAdmin/bulkCategoryUpdate',
59
- body: {
60
- roles,
61
- category: this.categoryName === '_CLEAR_ROLES_' ? null : this.categoryName
62
- }
63
- })
64
- .catchDefault();
65
- await this.parent.refreshAsync();
66
- this.close();
58
+ try {
59
+ await XH.fetchService
60
+ .postJson({
61
+ url: 'roleAdmin/bulkCategoryUpdate',
62
+ body: {
63
+ roles,
64
+ category: this.categoryName === '_CLEAR_ROLES_' ? null : this.categoryName
65
+ }
66
+ })
67
+ .linkTo(this.savingTask);
68
+ await this.parent.refreshAsync();
69
+ this.close();
70
+ } catch (e) {
71
+ XH.handleException(e);
72
+ }
67
73
  }
68
74
 
69
75
  //-----------------
@@ -16,9 +16,10 @@ import {
16
16
  XH
17
17
  } from '@xh/hoist/core';
18
18
  import {Icon} from '@xh/hoist/icon';
19
- import {action, when as mobxWhen} from '@xh/hoist/mobx';
19
+ import {action, bindable, when as mobxWhen} from '@xh/hoist/mobx';
20
20
  import {never, wait} from '@xh/hoist/promise';
21
21
  import numbro from 'numbro';
22
+ import {ReactNode} from 'react';
22
23
  import {createRoot} from 'react-dom/client';
23
24
  import {
24
25
  AlertBannerService,
@@ -97,6 +98,12 @@ export class AppContainerModel extends HoistModel {
97
98
  @managed themeModel = new ThemeModel();
98
99
  @managed userAgentModel = new UserAgentModel();
99
100
 
101
+ /**
102
+ * Message shown on spinner while the application is in the INITIALIZING state.
103
+ * Update within `AppModel.initAsync()` to relay app-specific initialization status.
104
+ */
105
+ @bindable initializingLoadMaskMessage: ReactNode;
106
+
100
107
  /**
101
108
  * Main entry point. Initialize and render application code.
102
109
  */
@@ -1,8 +1,9 @@
1
- import { HoistModel } from '@xh/hoist/core';
1
+ import { HoistModel, TaskObserver } from '@xh/hoist/core';
2
2
  import { StoreRecord } from '@xh/hoist/data';
3
3
  export declare class RecategorizeDialogModel extends HoistModel {
4
4
  private parent;
5
5
  selectedRecords: StoreRecord[];
6
+ readonly savingTask: TaskObserver;
6
7
  categoryName: any;
7
8
  isOpen: boolean;
8
9
  recategorizeAction(): {
@@ -1,4 +1,5 @@
1
1
  import { AppSpec, HoistAppModel, HoistModel, RootRefreshContextModel, TaskObserver } from '@xh/hoist/core';
2
+ import { ReactNode } from 'react';
2
3
  import { AboutDialogModel } from './AboutDialogModel';
3
4
  import { BannerSourceModel } from './BannerSourceModel';
4
5
  import { ChangelogDialogModel } from './ChangelogDialogModel';
@@ -40,6 +41,11 @@ export declare class AppContainerModel extends HoistModel {
40
41
  viewportSizeModel: ViewportSizeModel;
41
42
  themeModel: ThemeModel;
42
43
  userAgentModel: UserAgentModel;
44
+ /**
45
+ * Message shown on spinner while the application is in the INITIALIZING state.
46
+ * Update within `AppModel.initAsync()` to relay app-specific initialization status.
47
+ */
48
+ initializingLoadMaskMessage: ReactNode;
43
49
  /**
44
50
  * Main entry point. Initialize and render application code.
45
51
  */
@@ -87,7 +87,7 @@ export const AppContainer = hoistCmp({
87
87
  },
88
88
  errorRenderer: () => null
89
89
  },
90
- item: viewForState()
90
+ item: viewForState({model})
91
91
  }),
92
92
  // Modal component helpers rendered here at top-level to support display of messages
93
93
  // and exceptions at any point during the app lifecycle.
@@ -101,11 +101,13 @@ export const AppContainer = hoistCmp({
101
101
  //-----------------------------------------
102
102
  // Implementation
103
103
  //-----------------------------------------
104
- function viewForState() {
104
+ function viewForState({model}) {
105
105
  switch (XH.appState) {
106
106
  case 'PRE_AUTH':
107
107
  case 'INITIALIZING':
108
- return viewport(mask({spinner: true, isDisplayed: true}));
108
+ return viewport(
109
+ mask({spinner: true, isDisplayed: true, message: model.initializingLoadMaskMessage})
110
+ );
109
111
  case 'LOGIN_REQUIRED':
110
112
  return loginPanel();
111
113
  case 'ACCESS_DENIED':
@@ -72,7 +72,7 @@ export const AppContainer = hoistCmp({
72
72
  },
73
73
  errorRenderer: () => null
74
74
  },
75
- item: viewForState()
75
+ item: viewForState({model})
76
76
  }),
77
77
  // Modal component helpers rendered here at top-level to support display of messages
78
78
  // and exceptions at any point during the app lifecycle.
@@ -86,11 +86,13 @@ export const AppContainer = hoistCmp({
86
86
  //-------------------
87
87
  // Implementation
88
88
  //-------------------
89
- function viewForState() {
89
+ function viewForState({model}) {
90
90
  switch (XH.appState) {
91
91
  case 'PRE_AUTH':
92
92
  case 'INITIALIZING':
93
- return viewport(mask({spinner: true, isDisplayed: true}));
93
+ return viewport(
94
+ mask({spinner: true, isDisplayed: true, message: model.initializingLoadMaskMessage})
95
+ );
94
96
  case 'LOGIN_REQUIRED':
95
97
  return loginPanel();
96
98
  case 'ACCESS_DENIED':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "67.0.0-SNAPSHOT.1724286422850",
3
+ "version": "67.0.0-SNAPSHOT.1724719449021",
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",