@xh/hoist 80.0.0-SNAPSHOT.1767973504648 → 80.0.0-SNAPSHOT.1767982629403

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +10 -9
  2. package/build/types/cmp/filter/FilterChooserFieldSpec.d.ts +1 -1
  3. package/build/types/cmp/filter/FilterChooserModel.d.ts +19 -10
  4. package/build/types/cmp/grid/GridModel.d.ts +2 -2
  5. package/build/types/cmp/grid/filter/GridFilterFieldSpec.d.ts +4 -3
  6. package/build/types/cmp/grid/filter/GridFilterModel.d.ts +1 -1
  7. package/build/types/cmp/layout/Tags.d.ts +0 -2
  8. package/build/types/cmp/tab/TabContainerModel.d.ts +1 -1
  9. package/build/types/data/Store.d.ts +5 -6
  10. package/build/types/data/cube/View.d.ts +5 -3
  11. package/build/types/data/filter/BaseFilterFieldSpec.d.ts +3 -3
  12. package/build/types/data/filter/CompoundFilter.d.ts +1 -1
  13. package/build/types/data/filter/FieldFilter.d.ts +1 -1
  14. package/build/types/data/filter/Filter.d.ts +3 -3
  15. package/build/types/data/filter/FunctionFilter.d.ts +1 -1
  16. package/build/types/data/filter/Types.d.ts +39 -13
  17. package/build/types/desktop/cmp/dash/canvas/DashCanvasModel.d.ts +6 -46
  18. package/build/types/desktop/cmp/grid/impl/filter/headerfilter/values/ValuesTabModel.d.ts +2 -2
  19. package/build/types/svc/InspectorService.d.ts +2 -2
  20. package/cmp/filter/FilterChooserFieldSpec.ts +5 -22
  21. package/cmp/filter/FilterChooserModel.ts +27 -12
  22. package/cmp/grid/GridModel.ts +2 -2
  23. package/cmp/grid/filter/GridFilterFieldSpec.ts +52 -51
  24. package/cmp/grid/filter/GridFilterModel.ts +6 -7
  25. package/cmp/layout/Tags.ts +0 -2
  26. package/cmp/tab/TabContainerModel.ts +1 -1
  27. package/data/Store.ts +47 -13
  28. package/data/cube/View.ts +14 -3
  29. package/data/filter/BaseFilterFieldSpec.ts +3 -3
  30. package/data/filter/CompoundFilter.ts +3 -3
  31. package/data/filter/FieldFilter.ts +2 -2
  32. package/data/filter/Filter.ts +4 -4
  33. package/data/filter/FunctionFilter.ts +2 -2
  34. package/data/filter/Types.ts +53 -20
  35. package/desktop/cmp/dash/canvas/DashCanvas.ts +4 -21
  36. package/desktop/cmp/dash/canvas/DashCanvasModel.ts +24 -140
  37. package/desktop/cmp/grid/impl/filter/headerfilter/values/ValuesTabModel.ts +9 -9
  38. package/package.json +3 -3
  39. package/svc/InspectorService.ts +6 -5
  40. package/tsconfig.tsbuildinfo +1 -1
  41. package/build/types/desktop/cmp/button/FieldsetCollapseButton.d.ts +0 -10
  42. package/build/types/desktop/cmp/dash/canvas/widgetwell/DashCanvasWidgetWell.d.ts +0 -17
  43. package/build/types/desktop/cmp/dash/canvas/widgetwell/DashCanvasWidgetWellModel.d.ts +0 -11
  44. package/build/types/desktop/cmp/form/CollapsibleFieldset.d.ts +0 -11
  45. package/desktop/cmp/button/FieldsetCollapseButton.ts +0 -44
  46. package/desktop/cmp/dash/canvas/widgetwell/DashCanvasWidgetWell.scss +0 -26
  47. package/desktop/cmp/dash/canvas/widgetwell/DashCanvasWidgetWell.ts +0 -126
  48. package/desktop/cmp/dash/canvas/widgetwell/DashCanvasWidgetWellModel.ts +0 -65
  49. package/desktop/cmp/form/CollapsibleFieldset.scss +0 -14
  50. package/desktop/cmp/form/CollapsibleFieldset.ts +0 -65
@@ -4,7 +4,6 @@
4
4
  *
5
5
  * Copyright © 2026 Extremely Heavy Industries Inc.
6
6
  */
7
- import {wait} from '@xh/hoist/promise';
8
7
  import type {LayoutItem} from 'react-grid-layout';
9
8
  import {Persistable, PersistableState, PersistenceProvider, XH} from '@xh/hoist/core';
10
9
  import {required} from '@xh/hoist/data';
@@ -18,7 +17,6 @@ import {createObservableRef} from '@xh/hoist/utils/react';
18
17
  import {
19
18
  defaultsDeep,
20
19
  find,
21
- omit,
22
20
  uniqBy,
23
21
  times,
24
22
  without,
@@ -43,12 +41,11 @@ export interface DashCanvasConfig extends DashConfig<DashCanvasViewSpec, DashCan
43
41
  rowHeight?: number;
44
42
 
45
43
  /**
46
- * Whether views should "compact" vertically, horizontally or wrap
44
+ * Whether views should "compact" vertically or horizontally
47
45
  * to condense space. Default `true` defaults to vertical compaction.
48
- * Use `wrap` with caution. It only works well if all items are 1 row high.
49
46
  * See react-grid-layout docs for more information.
50
- */
51
- compact?: boolean | 'vertical' | 'horizontal' | 'wrap';
47
+ * */
48
+ compact?: boolean | 'vertical' | 'horizontal';
52
49
 
53
50
  /** Between items [x,y] in pixels. Default `[10, 10]`. */
54
51
  margin?: [number, number];
@@ -63,35 +60,6 @@ export interface DashCanvasConfig extends DashConfig<DashCanvasViewSpec, DashCan
63
60
  * Whether a grid background should be shown. Default false.
64
61
  */
65
62
  showGridBackground?: boolean;
66
-
67
- /**
68
- * Whether the canvas should accept drag-and-drop of views from outside
69
- * the canvas. Default false.
70
- */
71
- allowsDrop?: boolean;
72
-
73
- /**
74
- * Optional callback to invoke after a view is successfully dropped onto the canvas.
75
- */
76
- onDropDone?: (viewModel: DashCanvasViewModel) => void;
77
-
78
- /**
79
- * Optional callback to invoke when an item is dragged over the canvas. This may be used to
80
- * customize how the size of the dropping placeholder is calculated. The callback should
81
- * return an object with optional properties indicating the desired width, height (in grid units),
82
- * and offset (in pixels) of the dropping placeholder. The method's signature is the same as
83
- * the `onDropDragOver` prop of ReactGridLayout.
84
- * Returning `false` will prevent the dropping placeholder from being shown, and prevents a drop.
85
- * Returning `void` will use the default behavior, which is to size the placeholder as per the
86
- * `dropConfig.defaultItem` specification.
87
- */
88
- onDropDragOver?: (e: DragEvent) => OnDropDragOverResult;
89
-
90
- /**
91
- * Whether an overlay with an Add View button should be rendered
92
- * when the canvas is empty. Default true.
93
- */
94
- showAddViewButtonWhenEmpty?: boolean;
95
63
  }
96
64
 
97
65
  export interface DashCanvasItemState {
@@ -108,16 +76,6 @@ export interface DashCanvasItemLayout {
108
76
  h: number;
109
77
  }
110
78
 
111
- export type OnDropDragOverResult =
112
- | {
113
- w?: number;
114
- h?: number;
115
- dragOffsetX?: number;
116
- dragOffsetY?: number;
117
- }
118
- | false
119
- | void;
120
-
121
79
  /**
122
80
  * Model for {@link DashCanvas}, managing all configurable options for the component and publishing
123
81
  * the observable state of its current widgets and their layout.
@@ -131,21 +89,16 @@ export class DashCanvasModel
131
89
  //------------------------------
132
90
  @bindable columns: number;
133
91
  @bindable rowHeight: number;
134
- @bindable compact: 'vertical' | 'horizontal' | 'wrap';
92
+ @bindable compact: 'vertical' | 'horizontal';
135
93
  @bindable.ref margin: [number, number]; // [x, y]
136
94
  @bindable.ref containerPadding: [number, number]; // [x, y]
137
95
  @bindable showGridBackground: boolean;
138
96
  @bindable rglHeight: number;
139
- @bindable showAddViewButtonWhenEmpty: boolean;
140
97
 
141
98
  //-----------------------------
142
99
  // Public properties
143
100
  //-----------------------------
144
- DROPPING_ELEM_ID = '__dropping-elem__';
145
101
  maxRows: number;
146
- allowsDrop: boolean;
147
- onDropDone: (viewModel: DashCanvasViewModel) => void;
148
- draggedInView: DashCanvasItemState;
149
102
 
150
103
  /** Current number of rows in canvas */
151
104
  get rows(): number {
@@ -165,27 +118,21 @@ export class DashCanvasModel
165
118
  private isLoadingState: boolean;
166
119
 
167
120
  get rglLayout() {
168
- return this.layout
169
- .map(it => {
170
- const dashCanvasView = this.getView(it.i);
171
-
172
- // `dashCanvasView` will not be found if `it` is a dropping element.
173
- if (!dashCanvasView) return null;
174
-
175
- const {autoHeight, viewSpec} = dashCanvasView;
176
-
177
- return {
178
- ...it,
179
- resizeHandles: autoHeight
180
- ? ['w', 'e']
181
- : ['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'],
182
- maxH: viewSpec.maxHeight,
183
- minH: viewSpec.minHeight,
184
- maxW: viewSpec.maxWidth,
185
- minW: viewSpec.minWidth
186
- };
187
- })
188
- .filter(Boolean);
121
+ return this.layout.map(it => {
122
+ const dashCanvasView = this.getView(it.i),
123
+ {autoHeight, viewSpec} = dashCanvasView;
124
+
125
+ return {
126
+ ...it,
127
+ resizeHandles: autoHeight
128
+ ? ['w', 'e']
129
+ : ['s', 'w', 'e', 'n', 'sw', 'nw', 'se', 'ne'],
130
+ maxH: viewSpec.maxHeight,
131
+ minH: viewSpec.minHeight,
132
+ maxW: viewSpec.maxWidth,
133
+ minW: viewSpec.minWidth
134
+ };
135
+ });
189
136
  }
190
137
 
191
138
  constructor({
@@ -205,11 +152,7 @@ export class DashCanvasModel
205
152
  maxRows = Infinity,
206
153
  containerPadding = margin,
207
154
  extraMenuItems,
208
- showGridBackground = false,
209
- showAddViewButtonWhenEmpty = true,
210
- allowsDrop = false,
211
- onDropDone,
212
- onDropDragOver
155
+ showGridBackground = false
213
156
  }: DashCanvasConfig) {
214
157
  super();
215
158
  makeObservable(this);
@@ -257,10 +200,6 @@ export class DashCanvasModel
257
200
  this.addViewButtonText = addViewButtonText;
258
201
  this.extraMenuItems = extraMenuItems;
259
202
  this.showGridBackground = showGridBackground;
260
- this.showAddViewButtonWhenEmpty = showAddViewButtonWhenEmpty;
261
- this.allowsDrop = allowsDrop;
262
- this.onDropDone = onDropDone;
263
- if (onDropDragOver) this.onDropDragOver = onDropDragOver;
264
203
 
265
204
  this.loadState(initialState);
266
205
  this.state = this.buildState();
@@ -398,59 +337,6 @@ export class DashCanvasModel
398
337
  this.getView(id)?.ensureVisible();
399
338
  }
400
339
 
401
- onDrop(rglLayout: LayoutItem[], layoutItem: LayoutItem, evt: Event) {
402
- throwIf(
403
- !this.draggedInView,
404
- `No draggedInView set on DashCanvasModel prior to onDrop operation.
405
- Typically a developer would set this in response to dragstart events from
406
- a DashViewTray or similar component.`
407
- );
408
-
409
- const droppingItem: any = rglLayout.find(it => it.i === this.DROPPING_ELEM_ID);
410
- if (!droppingItem) {
411
- // if `onDropDragOver` returned false, we won't have a dropping item
412
- // and we cancel the drop
413
- this.draggedInView = null;
414
- return;
415
- }
416
-
417
- const {viewSpecId, title, state} = this.draggedInView,
418
- layout = omit(layoutItem, 'i'),
419
- newViewModel: DashCanvasViewModel = this.addViewInternal(viewSpecId, {
420
- title,
421
- state,
422
- layout
423
- });
424
-
425
- // Change ID of dropping item to the new view's id
426
- // so that the new view goes where the dropping item is.
427
- droppingItem.i = newViewModel.id;
428
-
429
- // must wait a tick for RGL to settle
430
- wait().then(() => {
431
- this.draggedInView = null;
432
- this.onRglLayoutChange(rglLayout);
433
- this.onDropDone?.(newViewModel);
434
- });
435
- }
436
-
437
- setDraggedInView(view?: DashCanvasItemState) {
438
- this.draggedInView = view;
439
- }
440
-
441
- onDropDragOver(evt: DragEvent): OnDropDragOverResult {
442
- if (!this.draggedInView) return false;
443
-
444
- return {
445
- w: this.draggedInView.layout.w,
446
- h: this.draggedInView.layout.h
447
- };
448
- }
449
-
450
- getViewsBySpecId(id) {
451
- return this.viewModels.filter(it => it.viewSpec.id === id);
452
- }
453
-
454
340
  //------------------------
455
341
  // Persistable Interface
456
342
  //------------------------
@@ -527,12 +413,6 @@ export class DashCanvasModel
527
413
 
528
414
  onRglLayoutChange(rglLayout: LayoutItem[]) {
529
415
  rglLayout = rglLayout.map(it => pick(it, ['i', 'x', 'y', 'w', 'h']));
530
-
531
- // Early out if RGL is changing layout as user is dragging droppable
532
- // item around the canvas. This will be called again once dragging
533
- // has stopped and user has dropped the item onto the canvas.
534
- if (rglLayout.some(it => it.i === this.DROPPING_ELEM_ID)) return;
535
-
536
416
  this.setLayout(rglLayout);
537
417
  }
538
418
 
@@ -616,6 +496,10 @@ export class DashCanvasModel
616
496
  return some(this.viewSpecs, {id});
617
497
  }
618
498
 
499
+ private getViewsBySpecId(id) {
500
+ return this.viewModels.filter(it => it.viewSpec.id === id);
501
+ }
502
+
619
503
  private getNextAvailablePosition({
620
504
  width,
621
505
  height,
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import {GridFilterModel, GridModel} from '@xh/hoist/cmp/grid';
8
8
  import {HoistModel, managed} from '@xh/hoist/core';
9
- import {FieldFilterSpec} from '@xh/hoist/data';
9
+ import type {FieldFilterOperator, FieldFilterSpec} from '@xh/hoist/data';
10
10
  import {checkbox} from '@xh/hoist/desktop/cmp/input';
11
11
  import {Icon} from '@xh/hoist/icon';
12
12
  import {action, bindable, computed, makeObservable, observable} from '@xh/hoist/mobx';
@@ -73,12 +73,12 @@ export class ValuesTabModel extends HoistModel {
73
73
  return this.fieldSpec.values;
74
74
  }
75
75
 
76
- get valueCount() {
77
- return this.fieldSpec.valueCount;
76
+ get allValuesCount() {
77
+ return this.fieldSpec.allValuesCount;
78
78
  }
79
79
 
80
80
  get hasHiddenValues() {
81
- return this.values.length < this.valueCount;
81
+ return this.values.length < this.allValuesCount;
82
82
  }
83
83
 
84
84
  get sortIcon() {
@@ -193,24 +193,24 @@ export class ValuesTabModel extends HoistModel {
193
193
  );
194
194
  }
195
195
 
196
- private getFilter() {
197
- const {gridFilterModel, pendingValues, values, valueCount, field} = this,
196
+ private getFilter(): FieldFilterSpec {
197
+ const {gridFilterModel, pendingValues, values, allValuesCount, field} = this,
198
198
  included = pendingValues.map(it => gridFilterModel.fromDisplayValue(it)),
199
199
  excluded = difference(values, pendingValues).map(it =>
200
200
  gridFilterModel.fromDisplayValue(it)
201
201
  );
202
202
 
203
- if (included.length === valueCount || excluded.length === valueCount) {
203
+ if (included.length === allValuesCount || excluded.length === allValuesCount) {
204
204
  return null;
205
205
  }
206
206
 
207
207
  const {fieldType} = this.headerFilterModel;
208
- let arr, op;
208
+ let arr: any[], op: FieldFilterOperator;
209
209
  if (fieldType === 'tags') {
210
210
  arr = included;
211
211
  op = 'includes';
212
212
  } else {
213
- const weight = valueCount <= 10 ? 2.5 : 1; // Prefer '=' for short lists
213
+ const weight = allValuesCount <= 10 ? 2.5 : 1; // Prefer '=' for short lists
214
214
  op = included.length > excluded.length * weight ? '!=' : '=';
215
215
  arr = op === '=' ? included : excluded;
216
216
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "80.0.0-SNAPSHOT.1767973504648",
3
+ "version": "80.0.0-SNAPSHOT.1767982629403",
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",
@@ -62,11 +62,11 @@
62
62
  "moment": "~2.30.1",
63
63
  "numbro": "~2.5.0",
64
64
  "onsenui": "~2.12.8",
65
- "qs": "~6.14.1",
65
+ "qs": "~6.14.0",
66
66
  "react-beautiful-dnd": "~13.1.0",
67
67
  "react-dates": "~21.8.0",
68
68
  "react-dropzone": "~10.2.2",
69
- "react-grid-layout": "2.2.2",
69
+ "react-grid-layout": "2.1.1",
70
70
  "react-markdown": "~10.1.0",
71
71
  "react-onsenui": "~1.13.2",
72
72
  "react-popper": "~2.3.0",
@@ -5,6 +5,7 @@
5
5
  * Copyright © 2026 Extremely Heavy Industries Inc.
6
6
  */
7
7
  import {HoistService, managed, persist, XH} from '@xh/hoist/core';
8
+ import {Store} from '@xh/hoist/data';
8
9
  import {action, bindable, makeObservable, observable} from '@xh/hoist/mobx';
9
10
  import {wait} from '@xh/hoist/promise';
10
11
  import {Timer} from '@xh/hoist/utils/async';
@@ -59,8 +60,8 @@ export class InspectorService extends HoistService {
59
60
  @managed
60
61
  statsUpdateTimer: Timer;
61
62
 
62
- private _syncRun = 0;
63
- private _idToSyncRun = new Map();
63
+ private _syncRun: number = 0;
64
+ private _idToSyncRun = new Map<string, number>();
64
65
 
65
66
  constructor() {
66
67
  super();
@@ -196,7 +197,7 @@ export class InspectorService extends HoistService {
196
197
  created: inst._created,
197
198
  isHoistService: inst.isHoistService,
198
199
  isHoistModel: inst.isHoistModel,
199
- isStore: inst.isStore,
200
+ isStore: Store.isStore(inst),
200
201
  isLinked: inst.isLinked,
201
202
  isXhImpl: inst.xhImpl,
202
203
  hasLoadSupport: inst.loadSupport != null,
@@ -211,7 +212,7 @@ export class InspectorService extends HoistService {
211
212
  }
212
213
 
213
214
  @action
214
- setActiveInstances(ai) {
215
+ setActiveInstances(ai: InspectorInstanceData[]) {
215
216
  this.activeInstances = ai;
216
217
  }
217
218
 
@@ -229,7 +230,7 @@ export class InspectorService extends HoistService {
229
230
 
230
231
  interface InspectorInstanceData {
231
232
  className: string;
232
- created: Date;
233
+ created: number;
233
234
  isHoistModel: boolean;
234
235
  isHoistService: boolean;
235
236
  isStore: boolean;