@k-int/stripes-kint-components 4.6.0 → 4.6.1
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
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
## 4.6.1 2023-04-14
|
|
2
|
+
* Added success callout to SettingsFormContainer
|
|
3
|
+
|
|
1
4
|
## 4.6.0 2023-04-14
|
|
2
5
|
* ERM-2884 Regex with lookbehind causes render failure in Safari
|
|
3
6
|
* Deprecated customPropertyContants typo. For now accessible both at customPropertyContants and customPropertyConstants, will be removed in future version.
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
|
+
var _core = require("@folio/stripes/core");
|
|
8
9
|
var _hooks = require("../hooks");
|
|
9
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -15,11 +16,17 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
16
|
ConfigFormComponent,
|
|
16
17
|
configName,
|
|
17
18
|
getInitialValues: passedGetInitialValues,
|
|
19
|
+
intlKey: passedIntlKey,
|
|
20
|
+
intlNS: passedIntlNS,
|
|
21
|
+
labelOverrides = {},
|
|
18
22
|
moduleName,
|
|
19
23
|
scope,
|
|
20
24
|
// We don't use this currently but it's here for future reference
|
|
21
25
|
...rest
|
|
22
26
|
} = _ref;
|
|
27
|
+
const callout = (0, _core.useCallout)();
|
|
28
|
+
const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
29
|
+
|
|
23
30
|
/*
|
|
24
31
|
* It is important to pass a namespaceAppend because the same hook could be rendered
|
|
25
32
|
* on the main App component. This means that in settings
|
|
@@ -56,8 +63,23 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
56
63
|
key: configName
|
|
57
64
|
})
|
|
58
65
|
};
|
|
59
|
-
editSettings(setting)
|
|
66
|
+
editSettings(setting).then(() => {
|
|
67
|
+
callout.sendCallout({
|
|
68
|
+
message: kintIntl.formatKintMessage({
|
|
69
|
+
fallbackMessage: 'stripes-smart-components.cm.success',
|
|
70
|
+
id: 'settingSaveSuccess',
|
|
71
|
+
intlKey: passedIntlKey,
|
|
72
|
+
intlNS: passedIntlNS,
|
|
73
|
+
overrideValue: labelOverrides === null || labelOverrides === void 0 ? void 0 : labelOverrides.settingSaveSuccess
|
|
74
|
+
}),
|
|
75
|
+
type: 'success'
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// At some point we might want to add a catch callout.
|
|
80
|
+
// The current ConfigManager doesn't have one, so leaving for now
|
|
60
81
|
};
|
|
82
|
+
|
|
61
83
|
const getInitialValues = () => {
|
|
62
84
|
let initialValues = parsedSettings;
|
|
63
85
|
if (passedGetInitialValues) {
|
|
@@ -80,6 +102,9 @@ SettingsFormContainer.propTypes = {
|
|
|
80
102
|
ConfigFormComponent: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.node), _propTypes.default.node, _propTypes.default.func]),
|
|
81
103
|
configName: _propTypes.default.string.isRequired,
|
|
82
104
|
getInitialValues: _propTypes.default.func,
|
|
105
|
+
intlKey: _propTypes.default.string,
|
|
106
|
+
intlNS: _propTypes.default.string,
|
|
107
|
+
labelOverrides: _propTypes.default.object,
|
|
83
108
|
moduleName: _propTypes.default.string.isRequired,
|
|
84
109
|
scope: _propTypes.default.string
|
|
85
110
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useCallout } from '@folio/stripes/core';
|
|
4
|
+
import { useKintIntl, useModConfigEntries, useMutateModConfigEntry } from '../hooks';
|
|
4
5
|
|
|
5
6
|
/*
|
|
6
7
|
* API is similar to ConfigManager
|
|
@@ -9,10 +10,16 @@ const SettingsFormContainer = ({
|
|
|
9
10
|
ConfigFormComponent,
|
|
10
11
|
configName,
|
|
11
12
|
getInitialValues: passedGetInitialValues,
|
|
13
|
+
intlKey: passedIntlKey,
|
|
14
|
+
intlNS: passedIntlNS,
|
|
15
|
+
labelOverrides = {},
|
|
12
16
|
moduleName,
|
|
13
17
|
scope, // We don't use this currently but it's here for future reference
|
|
14
18
|
...rest
|
|
15
19
|
}) => {
|
|
20
|
+
const callout = useCallout();
|
|
21
|
+
const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
|
|
22
|
+
|
|
16
23
|
/*
|
|
17
24
|
* It is important to pass a namespaceAppend because the same hook could be rendered
|
|
18
25
|
* on the main App component. This means that in settings
|
|
@@ -46,7 +53,21 @@ const SettingsFormContainer = ({
|
|
|
46
53
|
{ scope, key: configName })
|
|
47
54
|
};
|
|
48
55
|
|
|
49
|
-
editSettings(setting)
|
|
56
|
+
editSettings(setting).then(() => {
|
|
57
|
+
callout.sendCallout({
|
|
58
|
+
message: kintIntl.formatKintMessage({
|
|
59
|
+
fallbackMessage: 'stripes-smart-components.cm.success',
|
|
60
|
+
id: 'settingSaveSuccess',
|
|
61
|
+
intlKey: passedIntlKey,
|
|
62
|
+
intlNS: passedIntlNS,
|
|
63
|
+
overrideValue: labelOverrides?.settingSaveSuccess
|
|
64
|
+
}),
|
|
65
|
+
type: 'success',
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// At some point we might want to add a catch callout.
|
|
70
|
+
// The current ConfigManager doesn't have one, so leaving for now
|
|
50
71
|
};
|
|
51
72
|
|
|
52
73
|
const getInitialValues = () => {
|
|
@@ -77,6 +98,9 @@ SettingsFormContainer.propTypes = {
|
|
|
77
98
|
]),
|
|
78
99
|
configName: PropTypes.string.isRequired,
|
|
79
100
|
getInitialValues: PropTypes.func,
|
|
101
|
+
intlKey: PropTypes.string,
|
|
102
|
+
intlNS: PropTypes.string,
|
|
103
|
+
labelOverrides: PropTypes.object,
|
|
80
104
|
moduleName: PropTypes.string.isRequired,
|
|
81
105
|
scope: PropTypes.string,
|
|
82
106
|
};
|