@xh/hoist 75.0.0-SNAPSHOT.1753116344421 → 75.0.0-SNAPSHOT.1753198948130
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 -0
- package/admin/tabs/clients/activity/ClientDetailPanel.ts +3 -2
- package/admin/tabs/general/alertBanner/AlertBannerPanel.ts +2 -5
- package/build/types/cmp/relativetimestamp/RelativeTimestamp.d.ts +6 -2
- package/cmp/relativetimestamp/RelativeTimestamp.ts +21 -8
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
a specific level/depth. Set `GridModel.levelLabels` to activate this feature.
|
|
12
12
|
* Added new `GroupingChooserModel.sortDimensions` config. Set to `false` to respect the order in
|
|
13
13
|
which `dimensions` are provided to the model.
|
|
14
|
+
* The usage of the `RelativeTimestamp` component has been streamlined by deprecating the `options`
|
|
15
|
+
prop. All `RelativeTimestampOptions` are now supported by this component as top-level props.
|
|
14
16
|
|
|
15
17
|
### 🐞 Bug Fixes
|
|
16
18
|
|
|
@@ -40,11 +40,12 @@ const clientDetail = hoistCmp.factory<ClientDetailModel>(({model}) => {
|
|
|
40
40
|
items: [
|
|
41
41
|
relativeTimestamp({
|
|
42
42
|
timestamp: data.createdTime,
|
|
43
|
-
|
|
43
|
+
prefix: 'Session established'
|
|
44
44
|
}),
|
|
45
45
|
relativeTimestamp({
|
|
46
46
|
timestamp: data.lastReceivedTime,
|
|
47
|
-
|
|
47
|
+
prefix: 'Last heartbeat',
|
|
48
|
+
emptyResult: 'No heartbeat yet'
|
|
48
49
|
})
|
|
49
50
|
]
|
|
50
51
|
})
|
|
@@ -148,11 +148,8 @@ const formPanel = hoistCmp.factory<AlertBannerModel>(({model}) => {
|
|
|
148
148
|
field: 'expires',
|
|
149
149
|
info: relativeTimestamp({
|
|
150
150
|
timestamp: formModel.values.expires,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
emptyResult:
|
|
154
|
-
'Set a date & time to automatically hide this banner.'
|
|
155
|
-
}
|
|
151
|
+
allowFuture: true,
|
|
152
|
+
emptyResult: 'Set a date & time to automatically hide this banner.'
|
|
156
153
|
}),
|
|
157
154
|
item: dateInput({
|
|
158
155
|
enableClear: true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BoxProps, HoistProps } from '@xh/hoist/core';
|
|
2
|
-
interface RelativeTimestampProps extends HoistProps, BoxProps {
|
|
2
|
+
interface RelativeTimestampProps extends HoistProps, BoxProps, RelativeTimestampOptions {
|
|
3
3
|
/**
|
|
4
4
|
* Property on context model containing timestamp.
|
|
5
5
|
* Specify as an alternative to direct `timestamp` prop (and minimize parent re-renders).
|
|
@@ -7,7 +7,11 @@ interface RelativeTimestampProps extends HoistProps, BoxProps {
|
|
|
7
7
|
bind?: string;
|
|
8
8
|
/** Date or milliseconds representing the starting time / time to compare. See also `bind`. */
|
|
9
9
|
timestamp?: Date | number;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Formatting options.
|
|
12
|
+
*
|
|
13
|
+
* @deprecated - these options should be spread into this object directly.
|
|
14
|
+
*/
|
|
11
15
|
options?: RelativeTimestampOptions;
|
|
12
16
|
}
|
|
13
17
|
export interface RelativeTimestampOptions {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
|
+
import {getLayoutProps} from '@xh/hoist/utils/react';
|
|
7
8
|
import {inRange, isNil} from 'lodash';
|
|
8
9
|
import moment from 'moment';
|
|
9
10
|
import {box, span} from '@xh/hoist/cmp/layout';
|
|
@@ -20,9 +21,9 @@ import {fmtCompactDate, fmtDateTime} from '@xh/hoist/format';
|
|
|
20
21
|
import {action, computed, makeObservable, observable} from '@xh/hoist/mobx';
|
|
21
22
|
import {Timer} from '@xh/hoist/utils/async';
|
|
22
23
|
import {DAYS, HOURS, LocalDate, SECONDS} from '@xh/hoist/utils/datetime';
|
|
23
|
-
import {logWarn, withDefault} from '@xh/hoist/utils/js';
|
|
24
|
+
import {apiDeprecated, logWarn, withDefault} from '@xh/hoist/utils/js';
|
|
24
25
|
|
|
25
|
-
interface RelativeTimestampProps extends HoistProps, BoxProps {
|
|
26
|
+
interface RelativeTimestampProps extends HoistProps, BoxProps, RelativeTimestampOptions {
|
|
26
27
|
/**
|
|
27
28
|
* Property on context model containing timestamp.
|
|
28
29
|
* Specify as an alternative to direct `timestamp` prop (and minimize parent re-renders).
|
|
@@ -32,7 +33,11 @@ interface RelativeTimestampProps extends HoistProps, BoxProps {
|
|
|
32
33
|
/** Date or milliseconds representing the starting time / time to compare. See also `bind`. */
|
|
33
34
|
timestamp?: Date | number;
|
|
34
35
|
|
|
35
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Formatting options.
|
|
38
|
+
*
|
|
39
|
+
* @deprecated - these options should be spread into this object directly.
|
|
40
|
+
*/
|
|
36
41
|
options?: RelativeTimestampOptions;
|
|
37
42
|
}
|
|
38
43
|
|
|
@@ -91,13 +96,13 @@ export const [RelativeTimestamp, relativeTimestamp] = hoistCmp.withFactory<Relat
|
|
|
91
96
|
displayName: 'RelativeTimestamp',
|
|
92
97
|
className: 'xh-relative-timestamp',
|
|
93
98
|
|
|
94
|
-
render({className, bind, timestamp,
|
|
95
|
-
const impl = useLocalModel(RelativeTimestampLocalModel)
|
|
96
|
-
|
|
99
|
+
render({className, bind, timestamp, ...rest}, ref) {
|
|
100
|
+
const impl = useLocalModel(RelativeTimestampLocalModel),
|
|
101
|
+
layoutProps = getLayoutProps(rest);
|
|
97
102
|
return box({
|
|
98
103
|
className,
|
|
99
104
|
ref,
|
|
100
|
-
...
|
|
105
|
+
...layoutProps,
|
|
101
106
|
item: span({
|
|
102
107
|
className: 'xh-title-tip',
|
|
103
108
|
item: impl.display,
|
|
@@ -128,7 +133,15 @@ class RelativeTimestampLocalModel extends HoistModel {
|
|
|
128
133
|
|
|
129
134
|
@computed.struct
|
|
130
135
|
get options(): RelativeTimestampOptions {
|
|
131
|
-
|
|
136
|
+
const {componentProps} = this;
|
|
137
|
+
|
|
138
|
+
apiDeprecated('options', {
|
|
139
|
+
test: componentProps.options,
|
|
140
|
+
msg: 'Spread options directly in this object instead',
|
|
141
|
+
v: `77`
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
return componentProps.options ?? componentProps;
|
|
132
145
|
}
|
|
133
146
|
|
|
134
147
|
constructor() {
|
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.1753198948130",
|
|
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",
|