@nordicsemiconductor/pc-nrfconnect-shared 160.0.0 → 161.0.0
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 +7 -1
- package/package.json +1 -1
- package/src/ConfirmBeforeClose/ConfirmCloseDialog.tsx +1 -1
- package/src/ConfirmBeforeClose/confirmBeforeCloseSlice.ts +18 -7
- package/typings/generated/src/ConfirmBeforeClose/confirmBeforeCloseSlice.d.ts +5 -2
- package/typings/generated/src/ConfirmBeforeClose/confirmBeforeCloseSlice.d.ts.map +1 -1
package/Changelog.md
CHANGED
|
@@ -7,7 +7,13 @@ This project does _not_ adhere to
|
|
|
7
7
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html) but contrary to it
|
|
8
8
|
every new version is a new major version.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## 161.0.0 - 2024-02-26
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- `ConfirmCloseDialog` title now uses app display name
|
|
15
|
+
|
|
16
|
+
## 160.0.0 - 2024-02-23
|
|
11
17
|
|
|
12
18
|
### Added
|
|
13
19
|
|
package/package.json
CHANGED
|
@@ -60,7 +60,7 @@ export default () => {
|
|
|
60
60
|
return (
|
|
61
61
|
<ConfirmationDialog
|
|
62
62
|
headerIcon="alert-outline"
|
|
63
|
-
title=
|
|
63
|
+
title={nextConfirmDialog?.title ?? ''}
|
|
64
64
|
isVisible={showCloseDialog && !!nextConfirmDialog}
|
|
65
65
|
onConfirm={() => {
|
|
66
66
|
if (nextConfirmDialog) {
|
|
@@ -8,13 +8,22 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
|
8
8
|
import { v4 as uuid } from 'uuid';
|
|
9
9
|
|
|
10
10
|
import type { AppThunk, RootState } from '../store';
|
|
11
|
+
import { packageJsonApp } from '../utils/packageJson';
|
|
12
|
+
|
|
13
|
+
export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
11
14
|
|
|
12
15
|
export interface ConfirmBeforeCloseApp {
|
|
13
16
|
id: string;
|
|
17
|
+
title: string;
|
|
14
18
|
message: React.ReactNode;
|
|
15
19
|
onClose?: () => void;
|
|
16
20
|
}
|
|
17
21
|
|
|
22
|
+
export type ConfirmBeforeCloseOptionalTitle = Optional<
|
|
23
|
+
ConfirmBeforeCloseApp,
|
|
24
|
+
'title'
|
|
25
|
+
>;
|
|
26
|
+
|
|
18
27
|
export interface ConfirmBeforeCloseState {
|
|
19
28
|
confirmCloseApp: ConfirmBeforeCloseApp[];
|
|
20
29
|
showCloseDialog: boolean;
|
|
@@ -31,19 +40,21 @@ const slice = createSlice({
|
|
|
31
40
|
reducers: {
|
|
32
41
|
addConfirmBeforeClose(
|
|
33
42
|
state,
|
|
34
|
-
action: PayloadAction<
|
|
43
|
+
action: PayloadAction<ConfirmBeforeCloseOptionalTitle>
|
|
35
44
|
) {
|
|
36
45
|
const index = state.confirmCloseApp.findIndex(
|
|
37
46
|
confirmCloseApp => confirmCloseApp.id === action.payload.id
|
|
38
47
|
);
|
|
39
48
|
|
|
49
|
+
const dialog = {
|
|
50
|
+
title: `Closing ${packageJsonApp().displayName}`,
|
|
51
|
+
...action.payload,
|
|
52
|
+
};
|
|
53
|
+
|
|
40
54
|
if (index !== -1) {
|
|
41
|
-
state.confirmCloseApp[index] =
|
|
55
|
+
state.confirmCloseApp[index] = dialog;
|
|
42
56
|
} else {
|
|
43
|
-
state.confirmCloseApp = [
|
|
44
|
-
action.payload,
|
|
45
|
-
...state.confirmCloseApp,
|
|
46
|
-
];
|
|
57
|
+
state.confirmCloseApp = [dialog, ...state.confirmCloseApp];
|
|
47
58
|
}
|
|
48
59
|
},
|
|
49
60
|
clearConfirmBeforeClose(state, action: PayloadAction<string>) {
|
|
@@ -76,7 +87,7 @@ export const getShowConfirmCloseDialog = (state: RootState) =>
|
|
|
76
87
|
|
|
77
88
|
export const preventAppCloseUntilComplete =
|
|
78
89
|
(
|
|
79
|
-
dialogInfo: Omit<
|
|
90
|
+
dialogInfo: Omit<ConfirmBeforeCloseOptionalTitle, 'id'>,
|
|
80
91
|
promise: Promise<unknown>,
|
|
81
92
|
abortController?: AbortController
|
|
82
93
|
): AppThunk =>
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { AppThunk, RootState } from '../store';
|
|
3
|
+
export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
3
4
|
export interface ConfirmBeforeCloseApp {
|
|
4
5
|
id: string;
|
|
6
|
+
title: string;
|
|
5
7
|
message: React.ReactNode;
|
|
6
8
|
onClose?: () => void;
|
|
7
9
|
}
|
|
10
|
+
export type ConfirmBeforeCloseOptionalTitle = Optional<ConfirmBeforeCloseApp, 'title'>;
|
|
8
11
|
export interface ConfirmBeforeCloseState {
|
|
9
12
|
confirmCloseApp: ConfirmBeforeCloseApp[];
|
|
10
13
|
showCloseDialog: boolean;
|
|
11
14
|
}
|
|
12
|
-
export declare const reducer: import("redux").Reducer<ConfirmBeforeCloseState, import("redux").AnyAction>, addConfirmBeforeClose: import("@reduxjs/toolkit").ActionCreatorWithPayload<
|
|
15
|
+
export declare const reducer: import("redux").Reducer<ConfirmBeforeCloseState, import("redux").AnyAction>, addConfirmBeforeClose: import("@reduxjs/toolkit").ActionCreatorWithPayload<ConfirmBeforeCloseOptionalTitle, "confirmBeforeCloseDialog/addConfirmBeforeClose">, setShowCloseDialog: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "confirmBeforeCloseDialog/setShowCloseDialog">, clearConfirmBeforeClose: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "confirmBeforeCloseDialog/clearConfirmBeforeClose">;
|
|
13
16
|
export declare const getNextConfirmDialog: (state: RootState) => ConfirmBeforeCloseApp | undefined;
|
|
14
17
|
export declare const getShowConfirmCloseDialog: (state: RootState) => boolean;
|
|
15
|
-
export declare const preventAppCloseUntilComplete: (dialogInfo: Omit<
|
|
18
|
+
export declare const preventAppCloseUntilComplete: (dialogInfo: Omit<ConfirmBeforeCloseOptionalTitle, 'id'>, promise: Promise<unknown>, abortController?: AbortController) => AppThunk;
|
|
16
19
|
//# sourceMappingURL=confirmBeforeCloseSlice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirmBeforeCloseSlice.d.ts","sourceRoot":"","sources":["../../../../src/ConfirmBeforeClose/confirmBeforeCloseSlice.ts"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"confirmBeforeCloseSlice.d.ts","sourceRoot":"","sources":["../../../../src/ConfirmBeforeClose/confirmBeforeCloseSlice.ts"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGpD,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE9E,MAAM,WAAW,qBAAqB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,+BAA+B,GAAG,QAAQ,CAClD,qBAAqB,EACrB,OAAO,CACV,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACpC,eAAe,EAAE,qBAAqB,EAAE,CAAC;IACzC,eAAe,EAAE,OAAO,CAAC;CAC5B;AAyCD,eAAO,MACH,OAAO,+EAEH,qBAAqB,0IACrB,kBAAkB,+GAClB,uBAAuB,iHAEtB,CAAC;AAEV,eAAO,MAAM,oBAAoB,UAAW,SAAS,sCAGlC,CAAC;AAEpB,eAAO,MAAM,yBAAyB,UAAW,SAAS,YACR,CAAC;AAEnD,eAAO,MAAM,4BAA4B,eAErB,KAAK,+BAA+B,EAAE,IAAI,CAAC,WAC9C,QAAQ,OAAO,CAAC,oBACP,eAAe,KAClC,QAcF,CAAC"}
|