@xh/hoist 77.0.0-SNAPSHOT.1759338956409 → 77.0.0-SNAPSHOT.1759414848931

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
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## 77.0.0-SNAPSHOT - unreleased
4
4
 
5
+ ### 🎁 New Features
6
+
7
+ * `DashCanvasView` and `DashContainerView` components now have a public `@bindable` `titleDetails`
8
+ property on their models to support displaying additional information in the title bar of these
9
+ components. `titleDetails` is not persisted, and is expected to be set programmatically by the
10
+ application as needed.
11
+
5
12
  ## 76.0.0 - 2025-09-26
6
13
 
7
14
  ### 💥 Breaking Changes (upgrade difficulty: 🟠 MEDIUM - AG Grid update, Hoist React upgrade)
@@ -1,5 +1,6 @@
1
1
  import { HoistModel, MenuItemLike, PlainObject, RefreshMode, RenderMode } from '@xh/hoist/core';
2
2
  import '@xh/hoist/desktop/register';
3
+ import { IReactionDisposer } from 'mobx/dist/internal';
3
4
  import { ReactElement } from 'react';
4
5
  import { DashViewSpec } from './DashViewSpec';
5
6
  export type DashViewState = PlainObject;
@@ -23,8 +24,16 @@ export declare class DashViewModel<T extends DashViewSpec = DashViewSpec> extend
23
24
  * constructing these models - no need to specify manually.
24
25
  */
25
26
  containerModel: any;
26
- /** Title with which to initialize the view. */
27
+ /** Title with which to initialize the view. Value is persisted. */
27
28
  title: string;
29
+ /**
30
+ * Additional info that will be displayed after the title.
31
+ * Applications can bind to this property to provide dynamic title details.
32
+ * Value is not persisted.
33
+ **/
34
+ titleDetails: string;
35
+ get fullTitle(): string;
36
+ fullTitleReaction: IReactionDisposer;
28
37
  /** Icon with which to initialize the view. */
29
38
  icon: ReactElement;
30
39
  /** State with which to initialize the view. */
@@ -16,6 +16,7 @@ import {
16
16
  import '@xh/hoist/desktop/register';
17
17
  import {makeObservable, bindable} from '@xh/hoist/mobx';
18
18
  import {throwIf} from '@xh/hoist/utils/js';
19
+ import {IReactionDisposer} from 'mobx/dist/internal';
19
20
  import {ReactElement} from 'react';
20
21
  import {DashViewSpec} from './DashViewSpec';
21
22
 
@@ -44,9 +45,22 @@ export class DashViewModel<T extends DashViewSpec = DashViewSpec> extends HoistM
44
45
  */
45
46
  containerModel: any;
46
47
 
47
- /** Title with which to initialize the view. */
48
+ /** Title with which to initialize the view. Value is persisted. */
48
49
  @bindable title: string;
49
50
 
51
+ /**
52
+ * Additional info that will be displayed after the title.
53
+ * Applications can bind to this property to provide dynamic title details.
54
+ * Value is not persisted.
55
+ **/
56
+ @bindable titleDetails: string;
57
+
58
+ get fullTitle(): string {
59
+ return this.title + (this.titleDetails ? ' ' + this.titleDetails : '');
60
+ }
61
+
62
+ fullTitleReaction: IReactionDisposer;
63
+
50
64
  /** Icon with which to initialize the view. */
51
65
  @bindable.ref icon: ReactElement;
52
66
 
@@ -34,13 +34,13 @@ export const dashCanvasView = hoistCmp.factory({
34
34
  model: uses(DashCanvasViewModel, {publishMode: 'limited'}),
35
35
 
36
36
  render({model, className}) {
37
- const {viewSpec, ref, hidePanelHeader, headerItems, autoHeight} = model,
37
+ const {viewSpec, ref, hidePanelHeader, headerItems, autoHeight, fullTitle, icon} = model,
38
38
  headerProps = hidePanelHeader
39
39
  ? {}
40
40
  : {
41
41
  compactHeader: true,
42
- title: model.title,
43
- icon: model.icon,
42
+ title: fullTitle,
43
+ icon,
44
44
  headerItems: [...headerItems, headerMenu({model})]
45
45
  };
46
46
  return panel({
@@ -338,7 +338,7 @@ export class DashContainerModel
338
338
  renameView(id: string) {
339
339
  const view = this.getItemByViewModel(id);
340
340
  if (!view) return;
341
- this.showTitleForm(view.tab.element);
341
+ this.showTitleForm(view.tab.element, this.getViewModel(id));
342
342
  }
343
343
 
344
344
  onResize() {
@@ -531,7 +531,7 @@ export class DashContainerModel
531
531
  $titleEl = $el.find('.lm_title').first(),
532
532
  iconSelector = 'svg.svg-inline--fa',
533
533
  viewSpec = this.getViewSpec(item.config.component),
534
- {icon, title} = viewModel;
534
+ {icon} = viewModel;
535
535
 
536
536
  $el.off('contextmenu').contextmenu(e => {
537
537
  const index = stack.contentItems.indexOf(item);
@@ -551,15 +551,21 @@ export class DashContainerModel
551
551
  }
552
552
  }
553
553
 
554
- if (title) {
555
- const currentTitle = $titleEl.text();
556
- if (currentTitle !== title) $titleEl.text(title);
557
- }
558
-
559
554
  if (viewSpec.allowRename) {
560
555
  this.insertTitleForm($el, viewModel);
561
- $titleEl.off('dblclick').dblclick(() => this.showTitleForm($el));
556
+ $titleEl.off('dblclick').dblclick(() => this.showTitleForm($el, viewModel));
562
557
  }
558
+
559
+ viewModel.fullTitleReaction?.();
560
+ viewModel.fullTitleReaction = viewModel.addReaction({
561
+ track: () => viewModel.fullTitle,
562
+ run: () => {
563
+ const currentTitle = $titleEl.text(),
564
+ newTitle = viewModel.fullTitle;
565
+
566
+ if (currentTitle !== newTitle) $titleEl.text(newTitle);
567
+ }
568
+ });
563
569
  });
564
570
  }
565
571
 
@@ -579,7 +585,6 @@ export class DashContainerModel
579
585
  $formEl.submit(() => {
580
586
  const title = $inputEl.val();
581
587
  if (title.length) {
582
- $titleEl.text(title);
583
588
  viewModel.title = title;
584
589
  }
585
590
 
@@ -588,12 +593,11 @@ export class DashContainerModel
588
593
  });
589
594
  }
590
595
 
591
- private showTitleForm($tabEl) {
596
+ private showTitleForm($tabEl, viewModel: DashViewModel) {
592
597
  if (this.renameLocked) return;
593
598
 
594
- const $titleEl = $tabEl.find('.lm_title').first(),
595
- $inputEl = $tabEl.find('.title-form input').first(),
596
- currentTitle = $titleEl.text();
599
+ const $inputEl = $tabEl.find('.title-form input').first(),
600
+ currentTitle = viewModel.title;
597
601
 
598
602
  $tabEl.addClass('show-title-form');
599
603
  $inputEl.val(currentTitle);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "77.0.0-SNAPSHOT.1759338956409",
3
+ "version": "77.0.0-SNAPSHOT.1759414848931",
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",