@xh/hoist 71.0.0-SNAPSHOT.1735062266455 → 71.0.0-SNAPSHOT.1735247152243
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 +1 -1
- package/build/types/cmp/grid/GridModel.d.ts +1 -1
- package/build/types/desktop/cmp/button/RefreshButton.d.ts +7 -4
- package/build/types/mobile/cmp/button/RefreshButton.d.ts +5 -2
- package/build/types/svc/GridExportService.d.ts +2 -2
- package/cmp/grid/GridModel.ts +5 -1
- package/desktop/cmp/button/RefreshButton.ts +13 -14
- package/desktop/cmp/rest/impl/RestGridToolbar.ts +1 -1
- package/desktop/cmp/viewmanager/dialog/ManageDialog.ts +1 -1
- package/desktop/cmp/viewmanager/dialog/ManageDialogModel.ts +0 -6
- package/mobile/cmp/button/RefreshButton.ts +12 -12
- package/package.json +1 -1
- package/svc/GridExportService.ts +6 -20
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
`@xh/hoist/cmp/loadingindicator`.
|
|
14
14
|
* `TreeMap` and `SplitTreeMap` are now cross-platform and can be used in mobile applications.
|
|
15
15
|
Their import paths have changed from `@xh/hoist/desktop/cmp/treemap` to `@xh/hoist/cmp/treemap`.
|
|
16
|
-
|
|
16
|
+
* The `RefreshButton` `model` prop has been renamed `target` for clarity and consistency.
|
|
17
17
|
### 🎁 New Features
|
|
18
18
|
|
|
19
19
|
* Major Improvements to ViewManager component
|
|
@@ -553,7 +553,7 @@ export declare class GridModel extends HoistModel {
|
|
|
553
553
|
private parseExperimental;
|
|
554
554
|
private parseChooserModel;
|
|
555
555
|
private isGroupSpec;
|
|
556
|
-
defaultGroupSortFn: (a: any, b: any) =>
|
|
556
|
+
defaultGroupSortFn: (a: any, b: any) => any;
|
|
557
557
|
private readonly LEFT_BORDER_CLASS;
|
|
558
558
|
private readonly RIGHT_BORDER_CLASS;
|
|
559
559
|
private enhanceConfigWithGroupBorders;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { Loadable } from '@xh/hoist/core';
|
|
3
3
|
import '@xh/hoist/desktop/register';
|
|
4
4
|
import { ButtonProps } from './Button';
|
|
5
|
-
export
|
|
5
|
+
export interface RefreshButtonProps extends ButtonProps {
|
|
6
|
+
/** Object to refresh when clicked. */
|
|
7
|
+
target?: Loadable;
|
|
8
|
+
}
|
|
6
9
|
/**
|
|
7
10
|
* Convenience Button preconfigured for use as a trigger for a refresh operation.
|
|
8
11
|
*
|
|
9
|
-
* If an onClick handler is provided it will be used. Otherwise this button will
|
|
10
|
-
* be linked to
|
|
12
|
+
* If an onClick handler is provided it will be used. Otherwise, this button will
|
|
13
|
+
* be linked to the target in props with LoadSupport enabled, or the contextual
|
|
11
14
|
* See {@link RefreshContextModel}.
|
|
12
15
|
*/
|
|
13
16
|
export declare const RefreshButton: import("react").FC<RefreshButtonProps>, refreshButton: import("@xh/hoist/core").ElementFactory<RefreshButtonProps>;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { Loadable } from '@xh/hoist/core';
|
|
3
3
|
import { ButtonProps } from '@xh/hoist/mobile/cmp/button';
|
|
4
4
|
import '@xh/hoist/mobile/register';
|
|
5
|
-
export
|
|
5
|
+
export interface RefreshButtonProps extends ButtonProps {
|
|
6
|
+
/** Object to refresh when clicked. */
|
|
7
|
+
target?: Loadable;
|
|
8
|
+
}
|
|
6
9
|
/**
|
|
7
10
|
* Convenience Button preconfigured for use as a trigger for a refresh operation.
|
|
8
11
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HoistService } from '@xh/hoist/core';
|
|
1
|
+
import { HoistService, TrackOptions } from '@xh/hoist/core';
|
|
2
2
|
import { GridModel, Column } from '@xh/hoist/cmp/grid';
|
|
3
3
|
import { StoreRecord } from '@xh/hoist/data';
|
|
4
4
|
/**
|
|
@@ -50,7 +50,7 @@ export interface ExportOptions {
|
|
|
50
50
|
*/
|
|
51
51
|
columns?: 'VISIBLE' | 'ALL' | string[] | ((g: GridModel) => string[]);
|
|
52
52
|
/** True to enable activity tracking of exports (default false). */
|
|
53
|
-
track?: boolean
|
|
53
|
+
track?: boolean | Partial<TrackOptions>;
|
|
54
54
|
/** Timeout (in ms) for export request - defaults to 30 seconds. */
|
|
55
55
|
timeout?: number;
|
|
56
56
|
}
|
package/cmp/grid/GridModel.ts
CHANGED
|
@@ -1771,7 +1771,11 @@ export class GridModel extends HoistModel {
|
|
|
1771
1771
|
}
|
|
1772
1772
|
|
|
1773
1773
|
defaultGroupSortFn = (a, b) => {
|
|
1774
|
-
|
|
1774
|
+
// Place ungrouped items at bottom.
|
|
1775
|
+
if (a === b) return 0;
|
|
1776
|
+
if (a === '') return 1;
|
|
1777
|
+
if (b === '') return -1;
|
|
1778
|
+
return a.localeCompare(b);
|
|
1775
1779
|
};
|
|
1776
1780
|
|
|
1777
1781
|
private readonly LEFT_BORDER_CLASS = 'xh-cell--group-border-left';
|
|
@@ -4,35 +4,34 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Copyright © 2024 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
|
-
import {hoistCmp,
|
|
7
|
+
import {hoistCmp, Loadable, RefreshContextModel, useContextModel} from '@xh/hoist/core';
|
|
8
8
|
import '@xh/hoist/desktop/register';
|
|
9
9
|
import {Icon} from '@xh/hoist/icon';
|
|
10
|
-
import {errorIf, withDefault} from '@xh/hoist/utils/js';
|
|
11
10
|
import {button, ButtonProps} from './Button';
|
|
11
|
+
import {apiRemoved} from '@xh/hoist/utils/js';
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export interface RefreshButtonProps extends ButtonProps {
|
|
14
|
+
/** Object to refresh when clicked. */
|
|
15
|
+
target?: Loadable;
|
|
16
|
+
}
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
19
|
* Convenience Button preconfigured for use as a trigger for a refresh operation.
|
|
17
20
|
*
|
|
18
|
-
* If an onClick handler is provided it will be used. Otherwise this button will
|
|
19
|
-
* be linked to
|
|
21
|
+
* If an onClick handler is provided it will be used. Otherwise, this button will
|
|
22
|
+
* be linked to the target in props with LoadSupport enabled, or the contextual
|
|
20
23
|
* See {@link RefreshContextModel}.
|
|
21
24
|
*/
|
|
22
25
|
export const [RefreshButton, refreshButton] = hoistCmp.withFactory<RefreshButtonProps>({
|
|
23
26
|
displayName: 'RefreshButton',
|
|
24
|
-
model: false,
|
|
27
|
+
model: false,
|
|
25
28
|
|
|
26
|
-
render({
|
|
27
|
-
|
|
29
|
+
render({target, onClick, ...props}, ref) {
|
|
30
|
+
apiRemoved('model', {test: props.model, msg: 'Use target instead.'});
|
|
28
31
|
|
|
32
|
+
const refreshContextModel = useContextModel(RefreshContextModel);
|
|
29
33
|
if (!onClick) {
|
|
30
|
-
|
|
31
|
-
errorIf(
|
|
32
|
-
target && !target.loadSupport,
|
|
33
|
-
'Models provided to RefreshButton must enable LoadSupport.'
|
|
34
|
-
);
|
|
35
|
-
target = withDefault(target, refreshContextModel);
|
|
34
|
+
target ??= refreshContextModel;
|
|
36
35
|
onClick = target ? () => target.refreshAsync() : null;
|
|
37
36
|
}
|
|
38
37
|
|
|
@@ -263,12 +263,6 @@ export class ManageDialogModel extends HoistModel {
|
|
|
263
263
|
sortBy: 'name',
|
|
264
264
|
showGroupRowCounts: false,
|
|
265
265
|
groupBy: ['group'],
|
|
266
|
-
groupSortFn: (a, b) => {
|
|
267
|
-
// Place ungrouped items at bottom.
|
|
268
|
-
if (a == '') return 1;
|
|
269
|
-
if (b == '') return -1;
|
|
270
|
-
return a.localeCompare(b);
|
|
271
|
-
},
|
|
272
266
|
selModel: 'multiple',
|
|
273
267
|
contextMenu: null,
|
|
274
268
|
sizingMode: 'standard',
|
|
@@ -4,13 +4,16 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Copyright © 2024 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
|
-
import {hoistCmp,
|
|
7
|
+
import {hoistCmp, Loadable, RefreshContextModel, useContextModel} from '@xh/hoist/core';
|
|
8
8
|
import {Icon} from '@xh/hoist/icon';
|
|
9
9
|
import {button, ButtonProps} from '@xh/hoist/mobile/cmp/button';
|
|
10
10
|
import '@xh/hoist/mobile/register';
|
|
11
|
-
import {
|
|
11
|
+
import {apiRemoved} from '@xh/hoist/utils/js';
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export interface RefreshButtonProps extends ButtonProps {
|
|
14
|
+
/** Object to refresh when clicked. */
|
|
15
|
+
target?: Loadable;
|
|
16
|
+
}
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
19
|
* Convenience Button preconfigured for use as a trigger for a refresh operation.
|
|
@@ -21,18 +24,15 @@ export type RefreshButtonProps = ButtonProps<HoistModel>;
|
|
|
21
24
|
*/
|
|
22
25
|
export const [RefreshButton, refreshButton] = hoistCmp.withFactory<RefreshButtonProps>({
|
|
23
26
|
displayName: 'RefreshButton',
|
|
24
|
-
model: false,
|
|
27
|
+
model: false,
|
|
25
28
|
|
|
26
|
-
render({
|
|
27
|
-
|
|
29
|
+
render({target, icon = Icon.sync(), onClick, ...props}) {
|
|
30
|
+
apiRemoved('model', {test: props.model, msg: 'Use target instead.'});
|
|
28
31
|
|
|
32
|
+
const refreshContextModel = useContextModel(RefreshContextModel);
|
|
29
33
|
if (!onClick) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
'Models provided to RefreshButton must enable LoadSupport.'
|
|
33
|
-
);
|
|
34
|
-
model = model ?? refreshContextModel;
|
|
35
|
-
onClick = model ? () => model.refreshAsync() : null;
|
|
34
|
+
target ??= refreshContextModel;
|
|
35
|
+
onClick = target ? () => target.refreshAsync() : null;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
return button({icon, onClick, ...props});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "71.0.0-SNAPSHOT.
|
|
3
|
+
"version": "71.0.0-SNAPSHOT.1735247152243",
|
|
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",
|
package/svc/GridExportService.ts
CHANGED
|
@@ -5,17 +5,16 @@
|
|
|
5
5
|
* Copyright © 2024 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
7
|
import {ExcelFormat} from '@xh/hoist/cmp/grid';
|
|
8
|
-
import {HoistService, XH} from '@xh/hoist/core';
|
|
8
|
+
import {HoistService, TrackOptions, XH} from '@xh/hoist/core';
|
|
9
9
|
import {fmtDate} from '@xh/hoist/format';
|
|
10
10
|
import {Icon} from '@xh/hoist/icon';
|
|
11
11
|
import {isLocalDate, SECONDS} from '@xh/hoist/utils/datetime';
|
|
12
|
-
import {
|
|
12
|
+
import {withDefault} from '@xh/hoist/utils/js';
|
|
13
13
|
import download from 'downloadjs';
|
|
14
14
|
import {StatusCodes} from 'http-status-codes';
|
|
15
15
|
import {
|
|
16
16
|
castArray,
|
|
17
17
|
countBy,
|
|
18
|
-
isArray,
|
|
19
18
|
isEmpty,
|
|
20
19
|
isFunction,
|
|
21
20
|
isNil,
|
|
@@ -56,21 +55,6 @@ export class GridExportService extends HoistService {
|
|
|
56
55
|
timeout = 30 * SECONDS
|
|
57
56
|
}: ExportOptions = {}
|
|
58
57
|
) {
|
|
59
|
-
throwIf(!gridModel, 'GridModel required for export');
|
|
60
|
-
throwIf(
|
|
61
|
-
!isString(filename) && !isFunction(filename),
|
|
62
|
-
'Export filename must be either a string or a closure'
|
|
63
|
-
);
|
|
64
|
-
throwIf(
|
|
65
|
-
!['excel', 'excelTable', 'csv'].includes(type),
|
|
66
|
-
`Invalid export type "${type}". Must be either "excel", "excelTable" or "csv"`
|
|
67
|
-
);
|
|
68
|
-
throwIf(
|
|
69
|
-
!(isFunction(columns) || isArray(columns) || ['ALL', 'VISIBLE'].includes(columns)),
|
|
70
|
-
'Invalid columns config - must be "ALL", "VISIBLE", an array of colIds, or a function'
|
|
71
|
-
);
|
|
72
|
-
throwIf(!isBoolean(track), 'Invalid track value - must be either true or false');
|
|
73
|
-
|
|
74
58
|
if (isFunction(filename)) filename = filename(gridModel);
|
|
75
59
|
|
|
76
60
|
const config = XH.configService.get('xhExportConfig', {}),
|
|
@@ -153,11 +137,13 @@ export class GridExportService extends HoistService {
|
|
|
153
137
|
XH.successToast('Export complete.');
|
|
154
138
|
|
|
155
139
|
if (track) {
|
|
140
|
+
const trackOpts = track !== true ? track : null;
|
|
156
141
|
XH.track({
|
|
157
142
|
category: 'Export',
|
|
158
143
|
message: `Downloaded ${filename}${fileExt}`,
|
|
159
144
|
data: {rows: rows.length, columns: exportColumns.length},
|
|
160
|
-
logData: true
|
|
145
|
+
logData: true,
|
|
146
|
+
...trackOpts
|
|
161
147
|
});
|
|
162
148
|
}
|
|
163
149
|
} catch (e) {
|
|
@@ -460,7 +446,7 @@ export interface ExportOptions {
|
|
|
460
446
|
columns?: 'VISIBLE' | 'ALL' | string[] | ((g: GridModel) => string[]);
|
|
461
447
|
|
|
462
448
|
/** True to enable activity tracking of exports (default false). */
|
|
463
|
-
track?: boolean
|
|
449
|
+
track?: boolean | Partial<TrackOptions>;
|
|
464
450
|
|
|
465
451
|
/** Timeout (in ms) for export request - defaults to 30 seconds. */
|
|
466
452
|
timeout?: number;
|