@xh/hoist 72.0.0-SNAPSHOT.1737725354262 → 72.0.0-SNAPSHOT.1737748132453
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 +2 -1
- package/admin/jsonsearch/JsonSearchPanel.ts +210 -0
- package/admin/jsonsearch/impl/JsonSearchPanelImplModel.ts +130 -0
- package/admin/tabs/userData/jsonblob/JsonBlobPanel.ts +47 -9
- package/admin/tabs/userData/prefs/UserPreferencePanel.ts +42 -15
- package/build/types/admin/jsonsearch/JsonSearchPanel.d.ts +3 -0
- package/build/types/admin/jsonsearch/impl/JsonSearchPanelImplModel.d.ts +27 -0
- package/build/types/cmp/grid/Grid.d.ts +9 -10
- package/build/types/cmp/grid/GridModel.d.ts +2 -2
- package/cmp/ag-grid/AgGridModel.ts +1 -1
- package/cmp/grid/Grid.ts +43 -48
- package/cmp/grid/GridModel.ts +15 -11
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/cmp/grid/Grid.ts
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
|
+
import {ColumnState as AgColumnState, GridApi} from '@ag-grid-community/core';
|
|
7
8
|
import composeRefs from '@seznam/compose-react-refs';
|
|
8
9
|
import {agGrid, AgGrid} from '@xh/hoist/cmp/ag-grid';
|
|
9
|
-
import {getTreeStyleClasses} from '@xh/hoist/cmp/grid';
|
|
10
|
+
import {ColumnState, getTreeStyleClasses} from '@xh/hoist/cmp/grid';
|
|
10
11
|
import {gridHScrollbar} from '@xh/hoist/cmp/grid/impl/GridHScrollbar';
|
|
11
12
|
import {getAgGridMenuItems} from '@xh/hoist/cmp/grid/impl/MenuSupport';
|
|
12
13
|
import {div, fragment, frame, vframe} from '@xh/hoist/cmp/layout';
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
LayoutProps,
|
|
18
19
|
lookup,
|
|
19
20
|
PlainObject,
|
|
21
|
+
ReactionSpec,
|
|
20
22
|
TestSupportProps,
|
|
21
23
|
useLocalModel,
|
|
22
24
|
uses,
|
|
@@ -44,7 +46,7 @@ import {wait} from '@xh/hoist/promise';
|
|
|
44
46
|
import {consumeEvent, isDisplayed, logWithDebug} from '@xh/hoist/utils/js';
|
|
45
47
|
import {createObservableRef, getLayoutProps} from '@xh/hoist/utils/react';
|
|
46
48
|
import classNames from 'classnames';
|
|
47
|
-
import {debounce, isEmpty, isEqual, isNil, max, maxBy, merge} from 'lodash';
|
|
49
|
+
import {compact, debounce, isBoolean, isEmpty, isEqual, isNil, max, maxBy, merge} from 'lodash';
|
|
48
50
|
import './Grid.scss';
|
|
49
51
|
import {GridModel} from './GridModel';
|
|
50
52
|
import {columnGroupHeader} from './impl/ColumnGroupHeader';
|
|
@@ -463,7 +465,7 @@ export class GridLocalModel extends HoistModel {
|
|
|
463
465
|
};
|
|
464
466
|
}
|
|
465
467
|
|
|
466
|
-
columnStateReaction() {
|
|
468
|
+
columnStateReaction(): ReactionSpec<[GridApi, ColumnState[]]> {
|
|
467
469
|
const {model} = this;
|
|
468
470
|
return {
|
|
469
471
|
track: () => [model.agApi, model.columnState],
|
|
@@ -472,65 +474,57 @@ export class GridLocalModel extends HoistModel {
|
|
|
472
474
|
|
|
473
475
|
const agColState = api.getColumnState();
|
|
474
476
|
|
|
475
|
-
//
|
|
477
|
+
// Insert the auto group col state if it exists, since we won't have it in our column state list
|
|
476
478
|
const autoColState = agColState.find(c => c.colId === 'ag-Grid-AutoColumn');
|
|
477
479
|
if (autoColState) {
|
|
478
|
-
|
|
480
|
+
const {colId, width, hide, pinned} = autoColState;
|
|
481
|
+
colState.splice(agColState.indexOf(autoColState), 0, {
|
|
482
|
+
colId,
|
|
483
|
+
width,
|
|
484
|
+
hidden: hide,
|
|
485
|
+
pinned: isBoolean(pinned) ? (pinned ? 'left' : null) : pinned
|
|
486
|
+
});
|
|
479
487
|
}
|
|
480
488
|
|
|
481
|
-
//
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
colState.
|
|
490
|
-
const agCol = agColState
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
489
|
+
// Determine if column order has changed
|
|
490
|
+
const applyOrder = !isEqual(
|
|
491
|
+
colState.map(c => c.colId),
|
|
492
|
+
agColState.map(c => c.colId)
|
|
493
|
+
);
|
|
494
|
+
|
|
495
|
+
// Build a list of column state changes
|
|
496
|
+
colState = compact(
|
|
497
|
+
colState.map(({colId, width, hidden, pinned}) => {
|
|
498
|
+
const agCol: AgColumnState = agColState.find(c => c.colId === colId) || {
|
|
499
|
+
colId
|
|
500
|
+
},
|
|
501
|
+
ret: any = {colId};
|
|
502
|
+
|
|
503
|
+
let hasChanges = applyOrder;
|
|
504
|
+
|
|
505
|
+
if (agCol.width !== width) {
|
|
506
|
+
ret.width = width;
|
|
495
507
|
hasChanges = true;
|
|
496
508
|
}
|
|
497
|
-
|
|
498
|
-
|
|
509
|
+
|
|
510
|
+
if (agCol.hide !== hidden) {
|
|
511
|
+
ret.hide = hidden;
|
|
499
512
|
hasChanges = true;
|
|
500
513
|
}
|
|
501
|
-
|
|
502
|
-
|
|
514
|
+
|
|
515
|
+
if (agCol.pinned !== pinned) {
|
|
516
|
+
ret.pinned = pinned;
|
|
503
517
|
hasChanges = true;
|
|
504
518
|
}
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
// We need to tell agGrid to refresh its flexed column sizes due to
|
|
508
|
-
// a regression introduced in 25.1.0. See #2341
|
|
509
|
-
if (hasChanges) {
|
|
510
|
-
api.columnModel.refreshFlexedColumns({
|
|
511
|
-
updateBodyWidths: true,
|
|
512
|
-
fireResizedEvent: true
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
519
|
|
|
516
|
-
|
|
517
|
-
|
|
520
|
+
return hasChanges ? ret : null;
|
|
521
|
+
})
|
|
522
|
+
);
|
|
518
523
|
|
|
519
|
-
|
|
520
|
-
// Merge our state onto the ag column state to get any state which we do not yet support
|
|
521
|
-
colState = colState.map(({colId, width, hidden, pinned}) => {
|
|
522
|
-
const agCol = agColState.find(c => c.colId === colId) || {};
|
|
523
|
-
return {
|
|
524
|
-
colId,
|
|
525
|
-
...agCol,
|
|
526
|
-
width,
|
|
527
|
-
pinned,
|
|
528
|
-
hide: hidden
|
|
529
|
-
};
|
|
530
|
-
});
|
|
524
|
+
if (isEmpty(colState)) return;
|
|
531
525
|
|
|
532
526
|
this.doWithPreservedState({expansion: false}, () => {
|
|
533
|
-
api.applyColumnState({state: colState, applyOrder
|
|
527
|
+
api.applyColumnState({state: colState, applyOrder});
|
|
534
528
|
});
|
|
535
529
|
}
|
|
536
530
|
};
|
|
@@ -870,6 +864,7 @@ export class GridLocalModel extends HoistModel {
|
|
|
870
864
|
* by conditionally stopping the focus event from propagating.
|
|
871
865
|
*/
|
|
872
866
|
private static didAddFocusFixListener = false;
|
|
867
|
+
|
|
873
868
|
static addFocusFixListener() {
|
|
874
869
|
if (this.didAddFocusFixListener) return;
|
|
875
870
|
document.addEventListener(
|
package/cmp/grid/GridModel.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
CellContextMenuEvent,
|
|
10
10
|
CellDoubleClickedEvent,
|
|
11
11
|
ColumnEvent,
|
|
12
|
+
ColumnState as AgColumnState,
|
|
12
13
|
RowClickedEvent,
|
|
13
14
|
RowDoubleClickedEvent
|
|
14
15
|
} from '@ag-grid-community/core';
|
|
@@ -77,6 +78,7 @@ import {
|
|
|
77
78
|
first,
|
|
78
79
|
forEach,
|
|
79
80
|
isArray,
|
|
81
|
+
isBoolean,
|
|
80
82
|
isEmpty,
|
|
81
83
|
isFunction,
|
|
82
84
|
isNil,
|
|
@@ -1073,17 +1075,19 @@ export class GridModel extends HoistModel {
|
|
|
1073
1075
|
(this.colChooserModel as any)?.open();
|
|
1074
1076
|
}
|
|
1075
1077
|
|
|
1076
|
-
noteAgColumnStateChanged(agColState) {
|
|
1077
|
-
const colStateChanges = agColState.map(
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1078
|
+
noteAgColumnStateChanged(agColState: AgColumnState[]) {
|
|
1079
|
+
const colStateChanges: Partial<ColumnState>[] = agColState.map(
|
|
1080
|
+
({colId, width, hide, pinned}) => {
|
|
1081
|
+
const col = this.findColumn(this.columns, colId);
|
|
1082
|
+
if (!col) return null;
|
|
1083
|
+
return {
|
|
1084
|
+
colId,
|
|
1085
|
+
pinned: isBoolean(pinned) ? (pinned ? 'left' : null) : pinned,
|
|
1086
|
+
hidden: !!hide,
|
|
1087
|
+
width: col.flex ? undefined : width
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
);
|
|
1087
1091
|
|
|
1088
1092
|
pull(colStateChanges, null);
|
|
1089
1093
|
this.applyColumnStateChanges(colStateChanges);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "72.0.0-SNAPSHOT.
|
|
3
|
+
"version": "72.0.0-SNAPSHOT.1737748132453",
|
|
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",
|