@xh/hoist 75.0.0-SNAPSHOT.1752604774043 → 75.0.0-SNAPSHOT.1752777363110
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 +15 -4
- package/admin/columns/Tracking.ts +2 -0
- package/admin/tabs/activity/tracking/ActivityTrackingPanel.ts +2 -3
- package/admin/tabs/activity/tracking/detail/ActivityDetailView.ts +4 -5
- package/build/types/cmp/grid/GridModel.d.ts +0 -2
- package/build/types/cmp/grouping/GroupingChooserModel.d.ts +20 -12
- package/build/types/desktop/cmp/grid/find/impl/GridFindFieldImplModel.d.ts +2 -4
- package/cmp/grid/GridModel.ts +0 -3
- package/cmp/grouping/GroupingChooserModel.ts +53 -19
- package/core/RefreshContextView.ts +1 -1
- package/core/model/Hooks.ts +2 -3
- package/desktop/cmp/grid/find/impl/GridFindFieldImplModel.ts +20 -28
- package/desktop/cmp/grouping/GroupingChooser.ts +6 -16
- package/mobile/cmp/grouping/GroupingChooser.ts +4 -13
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 75.0-SNAPSHOT -
|
|
3
|
+
## 75.0-SNAPSHOT - Unreleased
|
|
4
|
+
|
|
5
|
+
### 🎁 New Features
|
|
6
|
+
|
|
7
|
+
* Added new `GroupingChooserModel.sortDimensions` config - can be set to false to respect the order
|
|
8
|
+
in which dimensions are provided to the model.
|
|
4
9
|
|
|
5
10
|
### 🐞 Bug Fixes
|
|
6
11
|
|
|
@@ -9,6 +14,12 @@
|
|
|
9
14
|
* DashCanvas: style with `position: relative;` to ensure that the empty state overlay is positioned
|
|
10
15
|
within the canvas, not the next parent container up that has `position: relative;`.
|
|
11
16
|
|
|
17
|
+
* `useContextModel` is now reactive to a change of an (observable) resolved model when it is set.
|
|
18
|
+
Previously this value was cached on first render.
|
|
19
|
+
|
|
20
|
+
* Fixes to framework components that bind to grids (e.g. `ColChooserButton`, `ColAutosizeButton`,
|
|
21
|
+
`GridFindField`) to rebind to a new observable GridModel available via context.
|
|
22
|
+
|
|
12
23
|
## v74.1.2 - 2025-07-03
|
|
13
24
|
|
|
14
25
|
### 🐞 Bug Fixes
|
|
@@ -20,9 +31,9 @@
|
|
|
20
31
|
### 🎁 New Features
|
|
21
32
|
|
|
22
33
|
* Further refinements to the `GroupingChooser` desktop UI.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
* Added new props `favoritesSide` and `favoritesTitle`.
|
|
35
|
+
* Deprecated `popoverTitle` prop - use `editorTitle` instead.
|
|
36
|
+
* Moved "Save as Favorite" button to a new compact toolbar within the popover.
|
|
26
37
|
|
|
27
38
|
### 🐞 Bug Fixes
|
|
28
39
|
|
|
@@ -130,6 +130,7 @@ export const deviceIcon: ColumnSpec = {
|
|
|
130
130
|
chooserGroup: 'Client App / Browser',
|
|
131
131
|
headerName: Icon.desktop(),
|
|
132
132
|
headerTooltip: 'Device',
|
|
133
|
+
exportName: 'Device',
|
|
133
134
|
tooltip: true,
|
|
134
135
|
resizable: false,
|
|
135
136
|
align: 'center',
|
|
@@ -291,6 +292,7 @@ export const severityIcon: ColumnSpec = {
|
|
|
291
292
|
field: severity.field,
|
|
292
293
|
headerName: Icon.info(),
|
|
293
294
|
headerTooltip: 'Severity',
|
|
295
|
+
exportName: 'Severity',
|
|
294
296
|
tooltip: true,
|
|
295
297
|
resizable: false,
|
|
296
298
|
align: 'center',
|
|
@@ -146,7 +146,6 @@ const filterBar = hoistCmp.factory<ActivityTrackingModel>(({model}) => {
|
|
|
146
146
|
});
|
|
147
147
|
|
|
148
148
|
const aggregateView = hoistCmp.factory<ActivityTrackingModel>(({model}) => {
|
|
149
|
-
const {gridModel} = model;
|
|
150
149
|
return panel({
|
|
151
150
|
collapsedTitle: 'Aggregate Activity',
|
|
152
151
|
collapsedIcon: Icon.users(),
|
|
@@ -161,8 +160,8 @@ const aggregateView = hoistCmp.factory<ActivityTrackingModel>(({model}) => {
|
|
|
161
160
|
items: [
|
|
162
161
|
groupingChooser({flex: 10, maxWidth: 300}),
|
|
163
162
|
filler(),
|
|
164
|
-
colChooserButton(
|
|
165
|
-
exportButton(
|
|
163
|
+
colChooserButton(),
|
|
164
|
+
exportButton()
|
|
166
165
|
]
|
|
167
166
|
}),
|
|
168
167
|
items: [
|
|
@@ -36,16 +36,15 @@ export const activityDetailView = hoistCmp.factory({
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
const tbar = hoistCmp.factory<ActivityDetailModel>(({model}) => {
|
|
39
|
-
const {gridModel} = model;
|
|
40
39
|
return toolbar({
|
|
41
40
|
compact: true,
|
|
42
41
|
items: [
|
|
43
42
|
filler(),
|
|
44
|
-
gridCountLabel({
|
|
43
|
+
gridCountLabel({unit: 'entry'}),
|
|
45
44
|
'-',
|
|
46
|
-
gridFindField({
|
|
47
|
-
colChooserButton(
|
|
48
|
-
exportButton(
|
|
45
|
+
gridFindField({width: 250}),
|
|
46
|
+
colChooserButton(),
|
|
47
|
+
exportButton()
|
|
49
48
|
]
|
|
50
49
|
});
|
|
51
50
|
});
|
|
@@ -275,8 +275,6 @@ export declare class GridModel extends HoistModel {
|
|
|
275
275
|
filterTask: TaskObserver;
|
|
276
276
|
/** Tracks execution of autosize operations. */
|
|
277
277
|
autosizeTask: TaskObserver;
|
|
278
|
-
/** @internal - used internally by any GridFindField that is bound to this GridModel. */
|
|
279
|
-
xhFindQuery: string;
|
|
280
278
|
constructor(config: GridConfig);
|
|
281
279
|
/**
|
|
282
280
|
* Restore the column, sorting, and grouping configs as specified by the application at
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import { HoistModel, PersistOptions } from '@xh/hoist/core';
|
|
1
|
+
import { HoistModel, PersistOptions, SelectOption } from '@xh/hoist/core';
|
|
2
2
|
export interface GroupingChooserConfig {
|
|
3
|
+
/** True to accept an empty list as a valid value. */
|
|
4
|
+
allowEmpty?: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* False (default) waits for the user to dismiss the popover before updating the
|
|
7
|
+
* external/observable value.
|
|
8
|
+
*/
|
|
9
|
+
commitOnChange?: boolean;
|
|
3
10
|
/**
|
|
4
11
|
* Dimensions available for selection. When using GroupingChooser to create Cube queries,
|
|
5
12
|
* it is recommended to pass the `dimensions` from the related cube (or a subset thereof).
|
|
6
13
|
* Note that {@link CubeField} meets the `DimensionSpec` interface.
|
|
7
14
|
*/
|
|
8
15
|
dimensions?: (DimensionSpec | string)[];
|
|
9
|
-
/** Initial value as an array of dimension names, or a function to produce such an array. */
|
|
10
|
-
initialValue?: string[] | (() => string[]);
|
|
11
16
|
/**
|
|
12
17
|
* Initial favorites as an array of dim name arrays, or a function to produce such an array.
|
|
13
18
|
* Ignored if `persistWith.persistFavorites: false`.
|
|
14
19
|
*/
|
|
15
20
|
initialFavorites?: string[][] | (() => string[][]);
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
/** True to accept an empty list as a valid value. */
|
|
19
|
-
allowEmpty?: boolean;
|
|
21
|
+
/** Initial value as an array of dimension names, or a function to produce such an array. */
|
|
22
|
+
initialValue?: string[] | (() => string[]);
|
|
20
23
|
/** Maximum number of dimensions allowed in a single grouping. */
|
|
21
24
|
maxDepth?: number;
|
|
25
|
+
/** Options governing persistence. */
|
|
26
|
+
persistWith?: GroupingChooserPersistOptions;
|
|
22
27
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
28
|
+
* True (default) to auto-sort dimensions by label. Set to false to show them in the order
|
|
29
|
+
* provided in the `dimensions` config.
|
|
25
30
|
*/
|
|
26
|
-
|
|
31
|
+
sortDimensions?: boolean;
|
|
27
32
|
}
|
|
28
33
|
/**
|
|
29
34
|
* Metadata for dimensions that are available for selection via a GroupingChooser control.
|
|
@@ -45,9 +50,10 @@ export declare class GroupingChooserModel extends HoistModel {
|
|
|
45
50
|
value: string[];
|
|
46
51
|
favorites: string[][];
|
|
47
52
|
allowEmpty: boolean;
|
|
48
|
-
maxDepth: number;
|
|
49
53
|
commitOnChange: boolean;
|
|
54
|
+
maxDepth: number;
|
|
50
55
|
persistFavorites: boolean;
|
|
56
|
+
sortDimensions: boolean;
|
|
51
57
|
pendingValue: string[];
|
|
52
58
|
editorIsOpen: boolean;
|
|
53
59
|
popoverRef: import("react").RefObject<HTMLElement> & import("react").RefCallback<HTMLElement>;
|
|
@@ -58,11 +64,13 @@ export declare class GroupingChooserModel extends HoistModel {
|
|
|
58
64
|
get isValid(): boolean;
|
|
59
65
|
get isAddEnabled(): boolean;
|
|
60
66
|
get isAddFavoriteEnabled(): boolean;
|
|
61
|
-
constructor({
|
|
67
|
+
constructor({ allowEmpty, commitOnChange, dimensions, initialFavorites, initialValue, maxDepth, persistWith, sortDimensions }: GroupingChooserConfig);
|
|
62
68
|
setDimensions(dimensions: Array<DimensionSpec | string>): void;
|
|
63
69
|
setValue(value: string[]): void;
|
|
64
70
|
toggleEditor(): void;
|
|
65
71
|
closeEditor(): void;
|
|
72
|
+
/** Transform dimension names into SelectOptions, with displayName and optional sort. */
|
|
73
|
+
getDimSelectOpts(dims?: string[]): SelectOption[];
|
|
66
74
|
addPendingDim(dimName: string): void;
|
|
67
75
|
replacePendingDimAtIdx(dimName: string, idx: number): void;
|
|
68
76
|
removePendingDimAtIdx(idx: number): void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { GridModel } from '@xh/hoist/cmp/grid';
|
|
2
1
|
import { HoistModel } from '@xh/hoist/core';
|
|
3
2
|
import { TextInputModel } from '@xh/hoist/desktop/cmp/input';
|
|
4
3
|
/**
|
|
@@ -6,7 +5,7 @@ import { TextInputModel } from '@xh/hoist/desktop/cmp/input';
|
|
|
6
5
|
*/
|
|
7
6
|
export declare class GridFindFieldImplModel extends HoistModel {
|
|
8
7
|
xhImpl: boolean;
|
|
9
|
-
|
|
8
|
+
query: string;
|
|
10
9
|
get matchMode(): string;
|
|
11
10
|
get queryBuffer(): number;
|
|
12
11
|
get includeFields(): string[];
|
|
@@ -20,8 +19,7 @@ export declare class GridFindFieldImplModel extends HoistModel {
|
|
|
20
19
|
get hasFocus(): boolean;
|
|
21
20
|
get hasQuery(): boolean;
|
|
22
21
|
get hasResults(): boolean;
|
|
23
|
-
get
|
|
24
|
-
setQuery(v: any): void;
|
|
22
|
+
get gridModel(): any;
|
|
25
23
|
constructor();
|
|
26
24
|
onLinked(): void;
|
|
27
25
|
selectPrev(): void;
|
package/cmp/grid/GridModel.ts
CHANGED
|
@@ -467,9 +467,6 @@ export class GridModel extends HoistModel {
|
|
|
467
467
|
/** Tracks execution of autosize operations. */
|
|
468
468
|
@managed autosizeTask = TaskObserver.trackAll();
|
|
469
469
|
|
|
470
|
-
/** @internal - used internally by any GridFindField that is bound to this GridModel. */
|
|
471
|
-
@bindable xhFindQuery: string = null;
|
|
472
|
-
|
|
473
470
|
constructor(config: GridConfig) {
|
|
474
471
|
super();
|
|
475
472
|
makeObservable(this);
|
|
@@ -5,14 +5,39 @@
|
|
|
5
5
|
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
HoistModel,
|
|
10
|
+
PersistableState,
|
|
11
|
+
PersistenceProvider,
|
|
12
|
+
PersistOptions,
|
|
13
|
+
SelectOption
|
|
14
|
+
} from '@xh/hoist/core';
|
|
9
15
|
import {genDisplayName} from '@xh/hoist/data';
|
|
10
16
|
import {action, computed, makeObservable, observable} from '@xh/hoist/mobx';
|
|
11
17
|
import {executeIfFunction, throwIf} from '@xh/hoist/utils/js';
|
|
12
18
|
import {createObservableRef} from '@xh/hoist/utils/react';
|
|
13
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
compact,
|
|
21
|
+
difference,
|
|
22
|
+
isArray,
|
|
23
|
+
isEmpty,
|
|
24
|
+
isEqual,
|
|
25
|
+
isObject,
|
|
26
|
+
isString,
|
|
27
|
+
keys,
|
|
28
|
+
sortBy
|
|
29
|
+
} from 'lodash';
|
|
14
30
|
|
|
15
31
|
export interface GroupingChooserConfig {
|
|
32
|
+
/** True to accept an empty list as a valid value. */
|
|
33
|
+
allowEmpty?: boolean;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* False (default) waits for the user to dismiss the popover before updating the
|
|
37
|
+
* external/observable value.
|
|
38
|
+
*/
|
|
39
|
+
commitOnChange?: boolean;
|
|
40
|
+
|
|
16
41
|
/**
|
|
17
42
|
* Dimensions available for selection. When using GroupingChooser to create Cube queries,
|
|
18
43
|
* it is recommended to pass the `dimensions` from the related cube (or a subset thereof).
|
|
@@ -20,29 +45,26 @@ export interface GroupingChooserConfig {
|
|
|
20
45
|
*/
|
|
21
46
|
dimensions?: (DimensionSpec | string)[];
|
|
22
47
|
|
|
23
|
-
/** Initial value as an array of dimension names, or a function to produce such an array. */
|
|
24
|
-
initialValue?: string[] | (() => string[]);
|
|
25
|
-
|
|
26
48
|
/**
|
|
27
49
|
* Initial favorites as an array of dim name arrays, or a function to produce such an array.
|
|
28
50
|
* Ignored if `persistWith.persistFavorites: false`.
|
|
29
51
|
*/
|
|
30
52
|
initialFavorites?: string[][] | (() => string[][]);
|
|
31
53
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/** True to accept an empty list as a valid value. */
|
|
36
|
-
allowEmpty?: boolean;
|
|
54
|
+
/** Initial value as an array of dimension names, or a function to produce such an array. */
|
|
55
|
+
initialValue?: string[] | (() => string[]);
|
|
37
56
|
|
|
38
57
|
/** Maximum number of dimensions allowed in a single grouping. */
|
|
39
58
|
maxDepth?: number;
|
|
40
59
|
|
|
60
|
+
/** Options governing persistence. */
|
|
61
|
+
persistWith?: GroupingChooserPersistOptions;
|
|
62
|
+
|
|
41
63
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
64
|
+
* True (default) to auto-sort dimensions by label. Set to false to show them in the order
|
|
65
|
+
* provided in the `dimensions` config.
|
|
44
66
|
*/
|
|
45
|
-
|
|
67
|
+
sortDimensions?: boolean;
|
|
46
68
|
}
|
|
47
69
|
|
|
48
70
|
/**
|
|
@@ -70,9 +92,10 @@ export class GroupingChooserModel extends HoistModel {
|
|
|
70
92
|
@observable.ref favorites: string[][] = [];
|
|
71
93
|
|
|
72
94
|
allowEmpty: boolean;
|
|
73
|
-
maxDepth: number;
|
|
74
95
|
commitOnChange: boolean;
|
|
96
|
+
maxDepth: number;
|
|
75
97
|
persistFavorites: boolean = false;
|
|
98
|
+
sortDimensions: boolean;
|
|
76
99
|
|
|
77
100
|
// Implementation fields for Control
|
|
78
101
|
@observable.ref pendingValue: string[] = [];
|
|
@@ -117,20 +140,22 @@ export class GroupingChooserModel extends HoistModel {
|
|
|
117
140
|
}
|
|
118
141
|
|
|
119
142
|
constructor({
|
|
143
|
+
allowEmpty = false,
|
|
144
|
+
commitOnChange = false,
|
|
120
145
|
dimensions,
|
|
121
|
-
initialValue = [],
|
|
122
146
|
initialFavorites = [],
|
|
123
|
-
|
|
124
|
-
allowEmpty = false,
|
|
147
|
+
initialValue = [],
|
|
125
148
|
maxDepth = null,
|
|
126
|
-
|
|
149
|
+
persistWith = null,
|
|
150
|
+
sortDimensions = true
|
|
127
151
|
}: GroupingChooserConfig) {
|
|
128
152
|
super();
|
|
129
153
|
makeObservable(this);
|
|
130
154
|
|
|
131
155
|
this.allowEmpty = allowEmpty;
|
|
132
|
-
this.maxDepth = maxDepth;
|
|
133
156
|
this.commitOnChange = commitOnChange;
|
|
157
|
+
this.maxDepth = maxDepth;
|
|
158
|
+
this.sortDimensions = sortDimensions;
|
|
134
159
|
|
|
135
160
|
this.setDimensions(dimensions);
|
|
136
161
|
|
|
@@ -187,6 +212,15 @@ export class GroupingChooserModel extends HoistModel {
|
|
|
187
212
|
this.editorIsOpen = false;
|
|
188
213
|
}
|
|
189
214
|
|
|
215
|
+
/** Transform dimension names into SelectOptions, with displayName and optional sort. */
|
|
216
|
+
getDimSelectOpts(dims: string[] = this.availableDims): SelectOption[] {
|
|
217
|
+
const ret = compact(dims).map(dimName => ({
|
|
218
|
+
value: dimName,
|
|
219
|
+
label: this.getDimDisplayName(dimName)
|
|
220
|
+
}));
|
|
221
|
+
return this.sortDimensions ? sortBy(ret, 'label') : ret;
|
|
222
|
+
}
|
|
223
|
+
|
|
190
224
|
//-------------------------
|
|
191
225
|
// Value handling
|
|
192
226
|
//-------------------------
|
package/core/model/Hooks.ts
CHANGED
|
@@ -27,9 +27,8 @@ import {each, isUndefined} from 'lodash';
|
|
|
27
27
|
* @returns model or null if no matching model found.
|
|
28
28
|
*/
|
|
29
29
|
export function useContextModel<T extends HoistModel>(selector: ModelSelector<T> = '*'): T {
|
|
30
|
-
const modelLookup = useContext(ModelLookupContext)
|
|
31
|
-
|
|
32
|
-
return ret;
|
|
30
|
+
const modelLookup = useContext(ModelLookupContext);
|
|
31
|
+
return modelLookup?.lookupModel(selector);
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
/**
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import {GridModel} from '@xh/hoist/cmp/grid';
|
|
8
8
|
import {HoistModel, XH} from '@xh/hoist/core';
|
|
9
9
|
import {TextInputModel} from '@xh/hoist/desktop/cmp/input';
|
|
10
|
-
import {action, comparer, computed, makeObservable, observable} from '@xh/hoist/mobx';
|
|
11
|
-
import {
|
|
10
|
+
import {action, bindable, comparer, computed, makeObservable, observable} from '@xh/hoist/mobx';
|
|
11
|
+
import {stripTags, withDefault} from '@xh/hoist/utils/js';
|
|
12
12
|
import {createObservableRef} from '@xh/hoist/utils/react';
|
|
13
13
|
import {
|
|
14
14
|
escapeRegExp,
|
|
@@ -29,7 +29,8 @@ import {
|
|
|
29
29
|
export class GridFindFieldImplModel extends HoistModel {
|
|
30
30
|
override xhImpl = true;
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
@bindable
|
|
33
|
+
query: string = null;
|
|
33
34
|
|
|
34
35
|
get matchMode(): string {
|
|
35
36
|
return this.componentProps.matchMode ?? 'startWord';
|
|
@@ -79,35 +80,26 @@ export class GridFindFieldImplModel extends HoistModel {
|
|
|
79
80
|
return !isNil(this.results) && !isEmpty(this.results);
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
@computed
|
|
84
|
+
get gridModel() {
|
|
85
|
+
const ret = withDefault(this.componentProps.gridModel, this.lookupModel(GridModel));
|
|
86
|
+
if (!ret) {
|
|
87
|
+
this.logError("No GridModel available. Provide via a 'gridModel' prop, or context.");
|
|
88
|
+
} else if (!ret.selModel?.isEnabled) {
|
|
89
|
+
this.logError('GridFindField must be bound to GridModel with selection enabled.');
|
|
90
|
+
}
|
|
91
|
+
return ret;
|
|
92
|
+
}
|
|
93
|
+
|
|
82
94
|
//------------------------------------------------------------------
|
|
83
95
|
// Trampoline value to grid
|
|
84
96
|
//------------------------------------------------------------------
|
|
85
|
-
get query() {
|
|
86
|
-
return this.gridModel.xhFindQuery;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@action
|
|
90
|
-
setQuery(v) {
|
|
91
|
-
this.gridModel.xhFindQuery = v;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
97
|
constructor() {
|
|
95
98
|
super();
|
|
96
99
|
makeObservable(this);
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
override onLinked() {
|
|
100
|
-
const gridModel = (this.gridModel = withDefault(
|
|
101
|
-
this.componentProps.gridModel,
|
|
102
|
-
this.lookupModel(GridModel)
|
|
103
|
-
));
|
|
104
|
-
errorIf(
|
|
105
|
-
!gridModel?.selModel?.isEnabled,
|
|
106
|
-
'GridFindField must be bound to GridModel with an enabled StoreSelectionModel.'
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
throwIf(!gridModel, "Must specify 'gridModel' in GridFindField.");
|
|
110
|
-
|
|
111
103
|
this.addReaction({
|
|
112
104
|
track: () => this.query,
|
|
113
105
|
run: () => this.updateResults(true),
|
|
@@ -116,10 +108,10 @@ export class GridFindFieldImplModel extends HoistModel {
|
|
|
116
108
|
|
|
117
109
|
this.addReaction({
|
|
118
110
|
track: () => [
|
|
119
|
-
gridModel
|
|
120
|
-
gridModel
|
|
121
|
-
gridModel
|
|
122
|
-
gridModel
|
|
111
|
+
this.gridModel?.store.records,
|
|
112
|
+
this.gridModel?.columns,
|
|
113
|
+
this.gridModel?.sortBy,
|
|
114
|
+
this.gridModel?.groupBy
|
|
123
115
|
],
|
|
124
116
|
run: () => {
|
|
125
117
|
this._records = null;
|
|
@@ -184,7 +176,7 @@ export class GridFindFieldImplModel extends HoistModel {
|
|
|
184
176
|
|
|
185
177
|
// Auto-select first matching result
|
|
186
178
|
if (autoSelect && this.hasResults && !isFinite(this.selectedIdx)) {
|
|
187
|
-
gridModel
|
|
179
|
+
gridModel?.selectAsync(this.results[0]);
|
|
188
180
|
}
|
|
189
181
|
}
|
|
190
182
|
|
|
@@ -29,7 +29,7 @@ import {dragDropContext, draggable, droppable} from '@xh/hoist/kit/react-beautif
|
|
|
29
29
|
import {apiDeprecated, elemWithin, getTestId} from '@xh/hoist/utils/js';
|
|
30
30
|
import {splitLayoutProps} from '@xh/hoist/utils/react';
|
|
31
31
|
import classNames from 'classnames';
|
|
32
|
-
import {
|
|
32
|
+
import {isEmpty, isNil, isUndefined} from 'lodash';
|
|
33
33
|
import './GroupingChooser.scss';
|
|
34
34
|
import {ReactNode} from 'react';
|
|
35
35
|
|
|
@@ -264,7 +264,7 @@ const dimensionList = hoistCmp.factory<GroupingChooserModel>({
|
|
|
264
264
|
const dimensionRow = hoistCmp.factory<GroupingChooserModel>({
|
|
265
265
|
render({model, dimension, idx}) {
|
|
266
266
|
// The options for this select include its current value
|
|
267
|
-
const options =
|
|
267
|
+
const options = model.getDimSelectOpts([...model.availableDims, dimension]);
|
|
268
268
|
|
|
269
269
|
return draggable({
|
|
270
270
|
key: dimension,
|
|
@@ -346,7 +346,8 @@ const dimensionRow = hoistCmp.factory<GroupingChooserModel>({
|
|
|
346
346
|
const addDimensionControl = hoistCmp.factory<GroupingChooserModel>({
|
|
347
347
|
render({model}) {
|
|
348
348
|
if (!model.isAddEnabled) return null;
|
|
349
|
-
|
|
349
|
+
|
|
350
|
+
const options = model.getDimSelectOpts();
|
|
350
351
|
return div({
|
|
351
352
|
className: 'xh-grouping-chooser__add-control',
|
|
352
353
|
items: [
|
|
@@ -372,9 +373,8 @@ const addDimensionControl = hoistCmp.factory<GroupingChooserModel>({
|
|
|
372
373
|
});
|
|
373
374
|
|
|
374
375
|
/**
|
|
375
|
-
* Extract integer values from CSS transform string.
|
|
376
|
-
*
|
|
377
|
-
* e.g. `translate3d(250px, 150px, 0px)` is equivalent to [250, 150, 0]
|
|
376
|
+
* Extract integer values from CSS transform string. Works for both `translate` and `translate3d`.
|
|
377
|
+
* e.g. `translate3d(250px, 150px, 0px) -> [250, 150, 0]`
|
|
378
378
|
*/
|
|
379
379
|
function parseTransform(transformStr: string): number[] {
|
|
380
380
|
return transformStr
|
|
@@ -383,16 +383,6 @@ function parseTransform(transformStr: string): number[] {
|
|
|
383
383
|
?.map(it => parseInt(it));
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
/**
|
|
387
|
-
* Convert a list of dim names into select options
|
|
388
|
-
*/
|
|
389
|
-
function getDimOptions(dims, model) {
|
|
390
|
-
const ret = compact(dims).map(dimName => {
|
|
391
|
-
return {value: dimName, label: model.getDimDisplayName(dimName)};
|
|
392
|
-
});
|
|
393
|
-
return sortBy(ret, 'label');
|
|
394
|
-
}
|
|
395
|
-
|
|
396
386
|
//------------------
|
|
397
387
|
// Favorites
|
|
398
388
|
//------------------
|
|
@@ -15,7 +15,7 @@ import '@xh/hoist/mobile/register';
|
|
|
15
15
|
import {dialogPanel, panel} from '@xh/hoist/mobile/cmp/panel';
|
|
16
16
|
import {splitLayoutProps} from '@xh/hoist/utils/react';
|
|
17
17
|
import classNames from 'classnames';
|
|
18
|
-
import {
|
|
18
|
+
import {isEmpty} from 'lodash';
|
|
19
19
|
|
|
20
20
|
import './GroupingChooser.scss';
|
|
21
21
|
|
|
@@ -134,7 +134,7 @@ const dimensionList = hoistCmp.factory<GroupingChooserModel>({
|
|
|
134
134
|
const dimensionRow = hoistCmp.factory<GroupingChooserModel>({
|
|
135
135
|
render({model, dimension, idx}) {
|
|
136
136
|
// The options for this select include its current value
|
|
137
|
-
const options =
|
|
137
|
+
const options = model.getDimSelectOpts([...model.availableDims, dimension]);
|
|
138
138
|
|
|
139
139
|
return draggable({
|
|
140
140
|
key: dimension,
|
|
@@ -182,7 +182,8 @@ const dimensionRow = hoistCmp.factory<GroupingChooserModel>({
|
|
|
182
182
|
const addDimensionControl = hoistCmp.factory<GroupingChooserModel>({
|
|
183
183
|
render({model}) {
|
|
184
184
|
if (!model.isAddEnabled) return null;
|
|
185
|
-
|
|
185
|
+
|
|
186
|
+
const options = model.getDimSelectOpts();
|
|
186
187
|
return div({
|
|
187
188
|
className: 'xh-grouping-chooser__add-control',
|
|
188
189
|
items: [
|
|
@@ -203,16 +204,6 @@ const addDimensionControl = hoistCmp.factory<GroupingChooserModel>({
|
|
|
203
204
|
}
|
|
204
205
|
});
|
|
205
206
|
|
|
206
|
-
/**
|
|
207
|
-
* Convert a list of dim names into select options
|
|
208
|
-
*/
|
|
209
|
-
function getDimOptions(dims, model) {
|
|
210
|
-
const ret = compact(dims).map(dimName => {
|
|
211
|
-
return {value: dimName, label: model.getDimDisplayName(dimName)};
|
|
212
|
-
});
|
|
213
|
-
return sortBy(ret, 'label');
|
|
214
|
-
}
|
|
215
|
-
|
|
216
207
|
//------------------
|
|
217
208
|
// Favorites
|
|
218
209
|
//------------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "75.0.0-SNAPSHOT.
|
|
3
|
+
"version": "75.0.0-SNAPSHOT.1752777363110",
|
|
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",
|