@k-int/stripes-kint-components 5.25.2 → 5.25.3
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 -0
- package/es/__mocks__/@folio/stripes/components.js +7 -3
- package/es/__mocks__/@folio/stripes/core.js +6 -4
- package/es/__mocks__/@folio/stripes/smart-components.js +6 -4
- package/es/__mocks__/react-query.js +6 -4
- package/es/__mocks__/react-router-dom.js +6 -6
- package/es/lib/ActionList/ActionList.js +33 -26
- package/es/lib/ActionList/ActionListFieldArray.js +119 -103
- package/es/lib/ComboButton/ComboButton.js +47 -42
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +17 -11
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +46 -42
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +8 -4
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +33 -32
- package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +1 -1
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +3 -3
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +35 -29
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +59 -61
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +20 -20
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +2 -2
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +1 -1
- package/es/lib/CustomProperties/Edit/testResources.js +12 -11
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +33 -22
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +35 -23
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +6 -3
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +8 -4
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +17 -14
- package/es/lib/CustomProperties/Filter/testResources.js +2 -1
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +2 -1
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +26 -18
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +6 -3
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +11 -7
- package/es/lib/CycleButton/CycleButton.js +17 -9
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +46 -30
- package/es/lib/EditableRefdataList/EditableRefdataList.js +43 -33
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray/EditableSettingsListFieldArray.js +9 -5
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue/EditSettingValue.js +6 -6
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue/RenderSettingValue.js +12 -10
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +12 -8
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +3 -3
- package/es/lib/FormModal/FormModal.js +32 -24
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +30 -23
- package/es/lib/IconSelect/IconSelect.js +32 -22
- package/es/lib/NoResultsMessage/NoResultsMessage.js +5 -4
- package/es/lib/NumberField/NumberField.js +25 -17
- package/es/lib/NumberField/NumberField.test.js +7 -6
- package/es/lib/QueryTypedown/QueryTypedown.js +15 -8
- package/es/lib/RefdataButtons/RefdataButtons.js +9 -6
- package/es/lib/RefdataCategoriesSettings/RefdataCategoriesSettings.js +26 -19
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +60 -48
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +6 -5
- package/es/lib/RichSelect/RichSelect.js +36 -31
- package/es/lib/RichSelect/useSelectedOption.js +2 -1
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +94 -91
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +51 -41
- package/es/lib/SASQRoute/SASQRoute.js +29 -25
- package/es/lib/SASQViewComponent/SASQViewComponent.js +76 -68
- package/es/lib/SearchField/SearchField.js +13 -7
- package/es/lib/SearchKeyControl/SearchKeyControl.js +13 -8
- package/es/lib/SearchKeyControl/SearchKeyControl.test.js +6 -2
- package/es/lib/SettingPage/SettingPagePane/SettingPagePane.js +2 -2
- package/es/lib/SettingsFormContainer/SettingsFormContainer.js +35 -30
- package/es/lib/Tags/Tags.js +8 -5
- package/es/lib/Tags/hooks/useTags.js +1 -1
- package/es/lib/Tags/hooks/useTagsEnabled.js +1 -1
- package/es/lib/Tags/tagsConfig.js +1 -1
- package/es/lib/Typedown/Typedown.js +28 -21
- package/es/lib/hooks/__mocks__/index.js +7 -3
- package/es/lib/hooks/intlHooks/useIntlKeyStore/useIntlKeyStore.js +26 -20
- package/es/lib/hooks/intlHooks/useKintIntl/useKintIntl.js +34 -24
- package/es/lib/hooks/typedownHooks/useTypedown.js +2 -2
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +2 -2
- package/es/lib/hooks/useActionListRef.js +1 -1
- package/es/lib/hooks/useActiveElement.js +1 -1
- package/es/lib/hooks/useCustomProperties.js +10 -6
- package/es/lib/hooks/useHelperApp.js +16 -13
- package/es/lib/hooks/useKiwtFieldArray.js +8 -7
- package/es/lib/hooks/useKiwtSASQuery.js +19 -15
- package/es/lib/hooks/useLocalPageStore.js +10 -7
- package/es/lib/hooks/useModConfigEntries.js +2 -2
- package/es/lib/hooks/useMutateCustomProperties/useMutateCustomProperties.js +17 -10
- package/es/lib/hooks/useMutateGeneric/useMutateGeneric.js +2 -2
- package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
- package/es/lib/hooks/useMutateRefdataCategory/useMutateRefdataCategory.js +21 -15
- package/es/lib/hooks/useMutateRefdataValue/useMutateRefdataValue.js +23 -16
- package/es/lib/hooks/usePrevNextPagination.js +19 -17
- package/es/lib/hooks/useQIndex.js +14 -11
- package/es/lib/hooks/useRefdata.js +3 -3
- package/es/lib/hooks/useTemplates.js +4 -4
- package/es/lib/settingsHooks/useAppSettings/useAppSettings.js +11 -7
- package/es/lib/settingsHooks/useSettingSection/useSettingSection.js +18 -12
- package/es/lib/settingsHooks/useSettings/useSettings.js +60 -60
- package/es/lib/utils/buildUrl.js +3 -2
- package/es/lib/utils/filterParsers/deparseKiwtQueryFilters.js +5 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryFilters.js +2 -2
- package/es/lib/utils/filterParsers/parseKiwtQueryGroups.js +5 -4
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
- package/es/lib/utils/generateKiwtQueryParams/generateKiwtQueryParams.js +82 -70
- package/es/lib/utils/groupCustomPropertiesByCtx.js +9 -5
- package/es/lib/utils/matchString.js +7 -5
- package/es/lib/utils/parseErrorResponse.js +4 -3
- package/es/lib/utils/selectorSafe.js +3 -2
- package/es/lib/utils/sortByLabel.js +3 -2
- package/es/lib/validators/validators.js +9 -6
- package/package.json +1 -1
- package/styles/TypeDown.css +3 -1
|
@@ -7,19 +7,27 @@ exports.default = void 0;
|
|
|
7
7
|
var _noop = _interopRequireDefault(require("lodash/noop"));
|
|
8
8
|
var _useInvalidateRefdata = _interopRequireDefault(require("../useInvalidateRefdata"));
|
|
9
9
|
var _useMutateGeneric = _interopRequireDefault(require("../useMutateGeneric"));
|
|
10
|
+
const _excluded = ["afterQueryCalls", "endpoint"];
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
18
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
11
19
|
const useMutateRefdataCategory = _ref => {
|
|
12
20
|
let {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
afterQueryCalls: {
|
|
22
|
+
delete: afterQueryDelete = _noop.default,
|
|
23
|
+
post: afterQueryPost = _noop.default,
|
|
24
|
+
put: afterQueryPut = _noop.default
|
|
25
|
+
} = {},
|
|
26
|
+
endpoint
|
|
27
|
+
} = _ref,
|
|
28
|
+
mutateGenericProps = _objectWithoutProperties(_ref, _excluded);
|
|
21
29
|
const invalidateRefdata = (0, _useInvalidateRefdata.default)();
|
|
22
|
-
return (0, _useMutateGeneric.default)({
|
|
30
|
+
return (0, _useMutateGeneric.default)(_objectSpread({
|
|
23
31
|
afterQueryCalls: {
|
|
24
32
|
delete: res => {
|
|
25
33
|
invalidateRefdata().then(() => {
|
|
@@ -40,14 +48,12 @@ const useMutateRefdataCategory = _ref => {
|
|
|
40
48
|
endpoint,
|
|
41
49
|
payloadMutators: {
|
|
42
50
|
post: data => ({
|
|
43
|
-
json: {
|
|
44
|
-
...data,
|
|
51
|
+
json: _objectSpread(_objectSpread({}, data), {}, {
|
|
45
52
|
values: []
|
|
46
|
-
}
|
|
53
|
+
})
|
|
47
54
|
})
|
|
48
55
|
},
|
|
49
|
-
queryKey: ['stripes-kint-components', 'useMutateRefdataCategory']
|
|
50
|
-
|
|
51
|
-
});
|
|
56
|
+
queryKey: ['stripes-kint-components', 'useMutateRefdataCategory']
|
|
57
|
+
}, mutateGenericProps));
|
|
52
58
|
};
|
|
53
59
|
var _default = exports.default = useMutateRefdataCategory;
|
|
@@ -7,20 +7,28 @@ exports.default = void 0;
|
|
|
7
7
|
var _noop = _interopRequireDefault(require("lodash/noop"));
|
|
8
8
|
var _useInvalidateRefdata = _interopRequireDefault(require("../useInvalidateRefdata"));
|
|
9
9
|
var _useMutateGeneric = _interopRequireDefault(require("../useMutateGeneric"));
|
|
10
|
+
const _excluded = ["afterQueryCalls", "endpoint", "id"];
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
18
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
11
19
|
const useMutateRefdataValue = _ref => {
|
|
12
20
|
let {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
afterQueryCalls: {
|
|
22
|
+
delete: afterQueryDelete = _noop.default,
|
|
23
|
+
post: afterQueryPost = _noop.default,
|
|
24
|
+
put: afterQueryPut = _noop.default
|
|
25
|
+
} = {},
|
|
26
|
+
endpoint,
|
|
27
|
+
id
|
|
28
|
+
} = _ref,
|
|
29
|
+
mutateGenericProps = _objectWithoutProperties(_ref, _excluded);
|
|
22
30
|
const invalidateRefdata = (0, _useInvalidateRefdata.default)();
|
|
23
|
-
return (0, _useMutateGeneric.default)({
|
|
31
|
+
return (0, _useMutateGeneric.default)(_objectSpread({
|
|
24
32
|
afterQueryCalls: {
|
|
25
33
|
delete: res => {
|
|
26
34
|
invalidateRefdata().then(() => {
|
|
@@ -41,7 +49,7 @@ const useMutateRefdataValue = _ref => {
|
|
|
41
49
|
endpoint,
|
|
42
50
|
id,
|
|
43
51
|
promiseReturns: {
|
|
44
|
-
delete: (delId, ky) => ky.put(
|
|
52
|
+
delete: (delId, ky) => ky.put("".concat(endpoint, "/").concat(id), {
|
|
45
53
|
json: {
|
|
46
54
|
id,
|
|
47
55
|
values: [{
|
|
@@ -50,21 +58,20 @@ const useMutateRefdataValue = _ref => {
|
|
|
50
58
|
}]
|
|
51
59
|
}
|
|
52
60
|
}).json(),
|
|
53
|
-
post: (data, ky) => ky.put(
|
|
61
|
+
post: (data, ky) => ky.put("".concat(endpoint, "/").concat(id), {
|
|
54
62
|
json: {
|
|
55
63
|
id,
|
|
56
64
|
values: [data]
|
|
57
65
|
}
|
|
58
66
|
}).json(),
|
|
59
|
-
put: (data, ky) => ky.put(
|
|
67
|
+
put: (data, ky) => ky.put("".concat(endpoint, "/").concat(id), {
|
|
60
68
|
json: {
|
|
61
69
|
id,
|
|
62
70
|
values: [data]
|
|
63
71
|
}
|
|
64
72
|
}).json()
|
|
65
73
|
},
|
|
66
|
-
queryKey: ['stripes-kint-components', 'useMutateRefdataValue', id]
|
|
67
|
-
|
|
68
|
-
});
|
|
74
|
+
queryKey: ['stripes-kint-components', 'useMutateRefdataValue', id]
|
|
75
|
+
}, mutateGenericProps));
|
|
69
76
|
};
|
|
70
77
|
var _default = exports.default = useMutateRefdataValue;
|
|
@@ -10,6 +10,11 @@ var _queryString = _interopRequireDefault(require("query-string"));
|
|
|
10
10
|
var _pagination = require("../constants/pagination");
|
|
11
11
|
var _useLocalPageStore = _interopRequireDefault(require("./useLocalPageStore"));
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
18
|
// Currently there are several places in which this hook is used twice within the same component
|
|
14
19
|
// Once in order to get the current page, and again in order to handle changes to paginations
|
|
15
20
|
// This hook should be refactored in order to resolve these issue - @EthanFreestone
|
|
@@ -69,14 +74,13 @@ const usePrevNextPagination = function () {
|
|
|
69
74
|
// change the store and the currentPage will update below
|
|
70
75
|
setPage(id, newPage);
|
|
71
76
|
setCurrentPage(newPage);
|
|
72
|
-
} else if (newPage !== urlQuery
|
|
73
|
-
const newQuery = {
|
|
74
|
-
...urlQuery,
|
|
77
|
+
} else if (newPage !== (urlQuery === null || urlQuery === void 0 ? void 0 : urlQuery.page)) {
|
|
78
|
+
const newQuery = _objectSpread(_objectSpread({}, urlQuery), {}, {
|
|
75
79
|
page: newPage
|
|
76
|
-
};
|
|
80
|
+
});
|
|
77
81
|
history.push({
|
|
78
82
|
pathname: location.pathname,
|
|
79
|
-
search:
|
|
83
|
+
search: "?".concat(_queryString.default.stringify(newQuery))
|
|
80
84
|
});
|
|
81
85
|
}
|
|
82
86
|
}, [currentPage, history, id, location.pathname, location.search, setPage, syncToLocation]);
|
|
@@ -92,30 +96,28 @@ const usePrevNextPagination = function () {
|
|
|
92
96
|
(0, _react.useEffect)(() => {
|
|
93
97
|
if (syncToLocation) {
|
|
94
98
|
const urlQuery = _queryString.default.parse(location.search);
|
|
95
|
-
if (urlQuery
|
|
96
|
-
setCurrentPage(Number(urlQuery
|
|
97
|
-
} else if (!urlQuery
|
|
99
|
+
if (urlQuery !== null && urlQuery !== void 0 && urlQuery.page && currentPage !== (urlQuery === null || urlQuery === void 0 ? void 0 : urlQuery.page)) {
|
|
100
|
+
setCurrentPage(Number(urlQuery === null || urlQuery === void 0 ? void 0 : urlQuery.page));
|
|
101
|
+
} else if (!(urlQuery !== null && urlQuery !== void 0 && urlQuery.page) && defaultToPageOne) {
|
|
98
102
|
// If url query "page" is not yet set, set it to 1
|
|
99
103
|
setCurrentPage(1);
|
|
100
|
-
const newQuery = {
|
|
101
|
-
...urlQuery,
|
|
104
|
+
const newQuery = _objectSpread(_objectSpread({}, urlQuery), {}, {
|
|
102
105
|
page: 1
|
|
103
|
-
};
|
|
106
|
+
});
|
|
104
107
|
|
|
105
108
|
// We use replace instead of push for the defaulting so we don't add unnecessary history entries
|
|
106
109
|
history.replace({
|
|
107
110
|
pathname: location.pathname,
|
|
108
|
-
search:
|
|
111
|
+
search: "?".concat(_queryString.default.stringify(newQuery))
|
|
109
112
|
});
|
|
110
113
|
}
|
|
111
114
|
if (resetPageState) {
|
|
112
|
-
const newQuery = {
|
|
113
|
-
...urlQuery,
|
|
115
|
+
const newQuery = _objectSpread(_objectSpread({}, urlQuery), {}, {
|
|
114
116
|
page: 1
|
|
115
|
-
};
|
|
117
|
+
});
|
|
116
118
|
history.push({
|
|
117
119
|
pathname: location.pathname,
|
|
118
|
-
search:
|
|
120
|
+
search: "?".concat(_queryString.default.stringify(newQuery))
|
|
119
121
|
});
|
|
120
122
|
setResetPageState(false);
|
|
121
123
|
}
|
|
@@ -127,7 +129,7 @@ const usePrevNextPagination = function () {
|
|
|
127
129
|
}, [currentPage, defaultToPageOne, history, id, location, pageStore, resetPageState, syncToLocation]);
|
|
128
130
|
|
|
129
131
|
// Set up MCL specific props based on page
|
|
130
|
-
const pagingCanGoNext = hasNextPage
|
|
132
|
+
const pagingCanGoNext = hasNextPage !== null && hasNextPage !== void 0 ? hasNextPage : currentPage && currentPage < Number(count) / pageSize;
|
|
131
133
|
const pagingCanGoPrevious = currentPage && Number(currentPage) > 1;
|
|
132
134
|
const pagingOffset = currentPage ? (currentPage - 1) * pageSize : 0;
|
|
133
135
|
const onNeedMoreData = function () {
|
|
@@ -9,35 +9,38 @@ var _reactRouterDom = require("react-router-dom");
|
|
|
9
9
|
var _queryString = _interopRequireDefault(require("query-string"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
12
17
|
const useQIndex = () => {
|
|
13
18
|
const history = (0, _reactRouterDom.useHistory)();
|
|
14
19
|
const location = (0, _reactRouterDom.useLocation)();
|
|
15
20
|
const query = _queryString.default.parse(location.search);
|
|
16
|
-
const [currentQindex, setCurrentQindex] = (0, _react.useState)(query
|
|
21
|
+
const [currentQindex, setCurrentQindex] = (0, _react.useState)(query === null || query === void 0 ? void 0 : query.qindex);
|
|
17
22
|
const handleQindexChange = newQindex => {
|
|
18
23
|
setCurrentQindex(newQindex);
|
|
19
|
-
if (newQindex !== query
|
|
24
|
+
if (newQindex !== (query === null || query === void 0 ? void 0 : query.qindex)) {
|
|
20
25
|
let newQuery;
|
|
21
26
|
if (newQindex !== '') {
|
|
22
|
-
newQuery = {
|
|
23
|
-
...query,
|
|
27
|
+
newQuery = _objectSpread(_objectSpread({}, query), {}, {
|
|
24
28
|
qindex: newQindex
|
|
25
|
-
};
|
|
29
|
+
});
|
|
26
30
|
} else {
|
|
27
|
-
newQuery = {
|
|
28
|
-
...query,
|
|
31
|
+
newQuery = _objectSpread(_objectSpread({}, query), {}, {
|
|
29
32
|
qindex: undefined
|
|
30
|
-
};
|
|
33
|
+
});
|
|
31
34
|
}
|
|
32
35
|
history.push({
|
|
33
36
|
pathname: location.pathname,
|
|
34
|
-
search:
|
|
37
|
+
search: "?".concat(_queryString.default.stringify(newQuery))
|
|
35
38
|
});
|
|
36
39
|
}
|
|
37
40
|
};
|
|
38
41
|
(0, _react.useEffect)(() => {
|
|
39
|
-
if (currentQindex !== query
|
|
40
|
-
setCurrentQindex(query
|
|
42
|
+
if (currentQindex !== (query === null || query === void 0 ? void 0 : query.qindex)) {
|
|
43
|
+
setCurrentQindex(query === null || query === void 0 ? void 0 : query.qindex);
|
|
41
44
|
}
|
|
42
45
|
}, [currentQindex, history, location, query]);
|
|
43
46
|
return [currentQindex, handleQindexChange];
|
|
@@ -28,13 +28,13 @@ const useRefdata = _ref => {
|
|
|
28
28
|
|
|
29
29
|
if (Array.isArray(desc)) {
|
|
30
30
|
// If we have an array, append a desc filter for each desc given
|
|
31
|
-
nsValues.filters = desc.map(d =>
|
|
31
|
+
nsValues.filters = desc.map(d => "DescKey.".concat(d)).join(',');
|
|
32
32
|
} else if (desc) {
|
|
33
33
|
// If we just have a string, append a single desc filter
|
|
34
|
-
nsValues.filters =
|
|
34
|
+
nsValues.filters = "DescKey.".concat(desc);
|
|
35
35
|
}
|
|
36
36
|
const query = (0, _utils.generateKiwtQuery)(options, nsValues);
|
|
37
|
-
const path =
|
|
37
|
+
const path = "".concat(endpoint).concat(query);
|
|
38
38
|
const queryObject = (0, _reactQuery.useQuery)((0, _utils.refdataQueryKey)(desc), () => ky(path).json(), queryParams);
|
|
39
39
|
if (returnQueryObject) {
|
|
40
40
|
return queryObject || {};
|
|
@@ -18,16 +18,16 @@ const useTemplates = _ref => {
|
|
|
18
18
|
const ky = (0, _core.useOkapiKy)();
|
|
19
19
|
const extraPathItems = [];
|
|
20
20
|
if (context) {
|
|
21
|
-
extraPathItems.push(
|
|
21
|
+
extraPathItems.push("filters=context=".concat(context));
|
|
22
22
|
}
|
|
23
23
|
if (sort) {
|
|
24
|
-
extraPathItems.push(
|
|
24
|
+
extraPathItems.push("sort=".concat(sort));
|
|
25
25
|
}
|
|
26
26
|
extraPathItems.push('max=500');
|
|
27
|
-
const path =
|
|
27
|
+
const path = "".concat(endpoint, "?").concat(extraPathItems.join('&'));
|
|
28
28
|
const {
|
|
29
29
|
data: templates
|
|
30
|
-
} = (0, _reactQuery.useQuery)(['stripes-kint-components', 'useTemplates', 'templates', context
|
|
30
|
+
} = (0, _reactQuery.useQuery)(['stripes-kint-components', 'useTemplates', 'templates', context !== null && context !== void 0 ? context : ''], () => ky(path).json(), queryParams);
|
|
31
31
|
return templates || [];
|
|
32
32
|
};
|
|
33
33
|
var _default = exports.default = useTemplates;
|
|
@@ -8,6 +8,7 @@ var _reactQuery = require("react-query");
|
|
|
8
8
|
var _core = require("@folio/stripes/core");
|
|
9
9
|
var _utils = require("../../utils");
|
|
10
10
|
const useAppSettings = _ref => {
|
|
11
|
+
var _ref2, _ref3, _queryObject$data2;
|
|
11
12
|
let {
|
|
12
13
|
endpoint,
|
|
13
14
|
keyName,
|
|
@@ -23,29 +24,32 @@ const useAppSettings = _ref => {
|
|
|
23
24
|
};
|
|
24
25
|
const namespaceArray = [endpoint];
|
|
25
26
|
if (sectionName) {
|
|
26
|
-
|
|
27
|
+
var _defaultQueryParamObj;
|
|
28
|
+
defaultQueryParamObject.filters = [...((_defaultQueryParamObj = defaultQueryParamObject.filters) !== null && _defaultQueryParamObj !== void 0 ? _defaultQueryParamObj : []), {
|
|
27
29
|
path: 'section',
|
|
28
30
|
value: sectionName
|
|
29
31
|
}];
|
|
30
32
|
namespaceArray.push(sectionName);
|
|
31
33
|
}
|
|
32
34
|
if (keyName) {
|
|
33
|
-
|
|
35
|
+
var _defaultQueryParamObj2;
|
|
36
|
+
defaultQueryParamObject.filters = [...((_defaultQueryParamObj2 = defaultQueryParamObject.filters) !== null && _defaultQueryParamObj2 !== void 0 ? _defaultQueryParamObj2 : []), {
|
|
34
37
|
path: 'key',
|
|
35
38
|
value: keyName
|
|
36
39
|
}];
|
|
37
40
|
defaultQueryParamObject.perPage = 1;
|
|
38
41
|
namespaceArray.push(keyName);
|
|
39
42
|
}
|
|
40
|
-
const queryParamArray = (0, _utils.generateKiwtQueryParams)(options
|
|
43
|
+
const queryParamArray = (0, _utils.generateKiwtQueryParams)(options !== null && options !== void 0 ? options : defaultQueryParamObject, {});
|
|
41
44
|
namespaceArray.push(queryParamArray);
|
|
42
|
-
const queryObject = (0, _reactQuery.useQuery)(namespaceArray, () => ky(
|
|
45
|
+
const queryObject = (0, _reactQuery.useQuery)(namespaceArray, () => ky("".concat(endpoint, "?").concat(queryParamArray === null || queryParamArray === void 0 ? void 0 : queryParamArray.join('&'))).json(), queryParams);
|
|
43
46
|
if (returnQueryObject) {
|
|
44
47
|
return queryObject;
|
|
45
48
|
}
|
|
46
|
-
if ((queryParams
|
|
47
|
-
|
|
49
|
+
if ((_ref2 = queryParams !== null && queryParams !== void 0 ? queryParams : defaultQueryParamObject) !== null && _ref2 !== void 0 && _ref2.perPage && ((_ref3 = queryParams !== null && queryParams !== void 0 ? queryParams : defaultQueryParamObject) === null || _ref3 === void 0 ? void 0 : _ref3.perPage) === 1) {
|
|
50
|
+
var _queryObject$data$, _queryObject$data;
|
|
51
|
+
return (_queryObject$data$ = queryObject === null || queryObject === void 0 || (_queryObject$data = queryObject.data) === null || _queryObject$data === void 0 ? void 0 : _queryObject$data[0]) !== null && _queryObject$data$ !== void 0 ? _queryObject$data$ : {};
|
|
48
52
|
}
|
|
49
|
-
return queryObject
|
|
53
|
+
return (_queryObject$data2 = queryObject === null || queryObject === void 0 ? void 0 : queryObject.data) !== null && _queryObject$data2 !== void 0 ? _queryObject$data2 : [];
|
|
50
54
|
};
|
|
51
55
|
var _default = exports.default = useAppSettings;
|
|
@@ -7,6 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
var _reactQuery = require("react-query");
|
|
8
8
|
var _core = require("@folio/stripes/core");
|
|
9
9
|
var _utils = require("../../utils");
|
|
10
|
+
const _excluded = ["data"],
|
|
11
|
+
_excluded2 = ["mutateAsync"];
|
|
12
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
13
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
14
|
const useSettingSection = _ref => {
|
|
11
15
|
let {
|
|
12
16
|
sectionName,
|
|
@@ -31,18 +35,20 @@ const useSettingSection = _ref => {
|
|
|
31
35
|
perPage: 100,
|
|
32
36
|
stats: false
|
|
33
37
|
}, {});
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
const _useQuery = (0, _reactQuery.useQuery)(getQueryNamespaceGenerator({
|
|
39
|
+
queryParams
|
|
40
|
+
}), () => ky("".concat(settingEndpoint, "?").concat(queryParams === null || queryParams === void 0 ? void 0 : queryParams.join('&'))).json()),
|
|
41
|
+
{
|
|
42
|
+
data: settings = []
|
|
43
|
+
} = _useQuery,
|
|
44
|
+
settingsQuery = _objectWithoutProperties(_useQuery, _excluded);
|
|
45
|
+
const _useMutation = (0, _reactQuery.useMutation)(getMutateNamespaceGenerator(), data => ky.put("".concat(settingEndpoint).concat(data.id ? '/' + data.id : ''), {
|
|
46
|
+
json: data
|
|
47
|
+
})),
|
|
48
|
+
{
|
|
49
|
+
mutateAsync: putSetting
|
|
50
|
+
} = _useMutation,
|
|
51
|
+
settingsMutate = _objectWithoutProperties(_useMutation, _excluded2);
|
|
46
52
|
return {
|
|
47
53
|
handleSubmit: putSetting,
|
|
48
54
|
settings,
|
|
@@ -15,7 +15,11 @@ var _utils = require("../../utils");
|
|
|
15
15
|
var _hooks = require("../../hooks");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
-
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // TODO work underway to make the settings hook more useful when trying to render multiple sections at a time
|
|
19
23
|
const useSettings = function () {
|
|
20
24
|
let settingsProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
21
25
|
const {
|
|
@@ -48,11 +52,13 @@ const useSettings = function () {
|
|
|
48
52
|
// Set up array of queryParams, pageLists etc etc ready for us to do all the work in a single place
|
|
49
53
|
|
|
50
54
|
const sectionMetaArray = (0, _react.useMemo)(() => {
|
|
55
|
+
var _sections$length;
|
|
51
56
|
const array = [];
|
|
52
57
|
const getSectionQueryProps = sectionProps => {
|
|
53
|
-
|
|
58
|
+
var _sectionProps$dynamic, _sectionProps$setting;
|
|
59
|
+
const dqp = (_sectionProps$dynamic = sectionProps.dynamicPageExclusions) !== null && _sectionProps$dynamic !== void 0 ? _sectionProps$dynamic : dynamicPageExclusions;
|
|
54
60
|
const queryParams = (0, _utils.generateKiwtQueryParams)({
|
|
55
|
-
filters: dqp
|
|
61
|
+
filters: dqp === null || dqp === void 0 ? void 0 : dqp.map(dpe => ({
|
|
56
62
|
path: 'section',
|
|
57
63
|
comparator: '!=',
|
|
58
64
|
value: dpe
|
|
@@ -60,72 +66,68 @@ const useSettings = function () {
|
|
|
60
66
|
perPage: 100,
|
|
61
67
|
stats: false
|
|
62
68
|
}, {});
|
|
63
|
-
const finalSettingEndpoint = sectionProps.settingEndpoint
|
|
69
|
+
const finalSettingEndpoint = (_sectionProps$setting = sectionProps.settingEndpoint) !== null && _sectionProps$setting !== void 0 ? _sectionProps$setting : settingEndpoint;
|
|
64
70
|
const queryKey = ['stripes-kint-components', 'useSettings', 'appSettings', finalSettingEndpoint, queryParams];
|
|
65
|
-
const queryFn = () => ky(
|
|
71
|
+
const queryFn = () => ky("".concat(finalSettingEndpoint, "?").concat(queryParams === null || queryParams === void 0 ? void 0 : queryParams.join('&'))).json();
|
|
66
72
|
return {
|
|
67
73
|
queryParams,
|
|
68
74
|
queryKey,
|
|
69
75
|
queryFn
|
|
70
76
|
};
|
|
71
77
|
};
|
|
72
|
-
if ((sections
|
|
78
|
+
if (((_sections$length = sections === null || sections === void 0 ? void 0 : sections.length) !== null && _sections$length !== void 0 ? _sections$length : 0) > 0) {
|
|
73
79
|
array.push(...sections.map(section => {
|
|
74
80
|
const querySectionProps = getSectionQueryProps(section);
|
|
75
|
-
return {
|
|
76
|
-
...settingsProps,
|
|
77
|
-
// ensure these fall through to section based props
|
|
78
|
-
...querySectionProps,
|
|
79
|
-
...section // return original section object
|
|
80
|
-
};
|
|
81
|
+
return _objectSpread(_objectSpread(_objectSpread({}, settingsProps), querySectionProps), section);
|
|
81
82
|
}));
|
|
82
83
|
} else {
|
|
83
84
|
const querySectionProps = getSectionQueryProps(settingsProps);
|
|
84
|
-
array.push({
|
|
85
|
-
...settingsProps,
|
|
86
|
-
...querySectionProps
|
|
87
|
-
});
|
|
85
|
+
array.push(_objectSpread(_objectSpread({}, settingsProps), querySectionProps));
|
|
88
86
|
}
|
|
89
87
|
return array;
|
|
90
88
|
}, [dynamicPageExclusions, ky, sections, settingEndpoint, settingsProps]);
|
|
91
|
-
const queries = (0, _react.useMemo)(() =>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
enabled =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
89
|
+
const queries = (0, _react.useMemo)(() => {
|
|
90
|
+
var _sectionMetaArray$map;
|
|
91
|
+
return (_sectionMetaArray$map = sectionMetaArray.map(sma => {
|
|
92
|
+
let enabled = true;
|
|
93
|
+
if (sma.pages || sma.preventQueries || pages || preventQueries) {
|
|
94
|
+
enabled = false;
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
queryKey: sma.queryKey,
|
|
98
|
+
queryFn: sma.queryFn,
|
|
99
|
+
enabled
|
|
100
|
+
};
|
|
101
|
+
})) !== null && _sectionMetaArray$map !== void 0 ? _sectionMetaArray$map : [];
|
|
102
|
+
}, [pages, preventQueries, sectionMetaArray]);
|
|
102
103
|
const queryReturnArray = (0, _reactQuery.useQueries)(queries);
|
|
103
104
|
const [isLoading, setIsLoading] = (0, _react.useState)(true);
|
|
104
105
|
const getDynamicPages = (0, _react.useCallback)((qra, sma) => {
|
|
105
|
-
|
|
106
|
+
var _qra$data;
|
|
107
|
+
const pagesFromQueryReturn = [...new Set((_qra$data = qra.data) === null || _qra$data === void 0 ? void 0 : _qra$data.map(s => s.section))];
|
|
106
108
|
const dynamic = pagesFromQueryReturn.map(page => {
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
const
|
|
109
|
+
var _sma$render, _sma$sectionRoute;
|
|
110
|
+
const finalRender = (_sma$render = sma.render) !== null && _sma$render !== void 0 ? _sma$render : render;
|
|
111
|
+
const finalSectionRoute = (_sma$sectionRoute = sma.sectionRoute) !== null && _sma$sectionRoute !== void 0 ? _sma$sectionRoute : sectionRoute;
|
|
112
|
+
const pageRoute = (finalSectionRoute ? "".concat(finalSectionRoute, "/") : '') + page;
|
|
110
113
|
return {
|
|
111
114
|
route: pageRoute,
|
|
112
115
|
label: kintIntl.formatKintMessage({
|
|
113
|
-
id:
|
|
116
|
+
id: "settings.settingsSection.".concat((0, _utils.toCamelCase)(page)),
|
|
114
117
|
fallbackMessage: page
|
|
115
118
|
}),
|
|
116
119
|
component: props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_SettingPage.SettingPagePane, {
|
|
117
120
|
intlKey: passedIntlKey,
|
|
118
121
|
intlNS: passedIntlNS,
|
|
119
122
|
sectionName: page,
|
|
120
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SettingPage.SettingPage, {
|
|
123
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SettingPage.SettingPage, _objectSpread({
|
|
121
124
|
allowEdit: allowGlobalEdit,
|
|
122
125
|
intlKey: passedIntlKey,
|
|
123
126
|
intlNS: passedIntlNS,
|
|
124
127
|
labelOverrides: labelOverrides,
|
|
125
128
|
render: finalRender,
|
|
126
|
-
sectionName: page
|
|
127
|
-
|
|
128
|
-
})
|
|
129
|
+
sectionName: page
|
|
130
|
+
}, props))
|
|
129
131
|
})
|
|
130
132
|
};
|
|
131
133
|
});
|
|
@@ -142,18 +144,20 @@ const useSettings = function () {
|
|
|
142
144
|
}, [isLoading, queryReturnArray]);
|
|
143
145
|
const finalSections = (0, _react.useMemo)(() => {
|
|
144
146
|
return sectionMetaArray.map((sma, idx) => {
|
|
147
|
+
var _sma$sectionPermissio;
|
|
145
148
|
const SettingsContextProvider = _ref => {
|
|
149
|
+
var _sma$intlKey, _sma$refdataEndpoint, _sma$settingEndpoint, _sma$templateEndpoint;
|
|
146
150
|
let {
|
|
147
151
|
children
|
|
148
152
|
} = _ref;
|
|
149
153
|
const intlKey = (0, _hooks.useIntlKey)(passedIntlKey, passedIntlNS);
|
|
150
154
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_contexts.SettingsContext.Provider, {
|
|
151
155
|
value: {
|
|
152
|
-
intlKey: sma.intlKey
|
|
156
|
+
intlKey: (_sma$intlKey = sma.intlKey) !== null && _sma$intlKey !== void 0 ? _sma$intlKey : intlKey,
|
|
153
157
|
// This is only here for backwards compatibility... is now grabbed from useIntlKey instead of what's passed in directly
|
|
154
|
-
refdataEndpoint: sma.refdataEndpoint
|
|
155
|
-
settingEndpoint: sma.settingEndpoint
|
|
156
|
-
templateEndpoint: sma.templateEndpoint
|
|
158
|
+
refdataEndpoint: (_sma$refdataEndpoint = sma.refdataEndpoint) !== null && _sma$refdataEndpoint !== void 0 ? _sma$refdataEndpoint : refdataEndpoint,
|
|
159
|
+
settingEndpoint: (_sma$settingEndpoint = sma.settingEndpoint) !== null && _sma$settingEndpoint !== void 0 ? _sma$settingEndpoint : settingEndpoint,
|
|
160
|
+
templateEndpoint: (_sma$templateEndpoint = sma.templateEndpoint) !== null && _sma$templateEndpoint !== void 0 ? _sma$templateEndpoint : templateEndpoint
|
|
157
161
|
},
|
|
158
162
|
children: children
|
|
159
163
|
});
|
|
@@ -161,27 +165,24 @@ const useSettings = function () {
|
|
|
161
165
|
SettingsContextProvider.propTypes = {
|
|
162
166
|
children: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node])
|
|
163
167
|
};
|
|
164
|
-
const finalPermission = sma.sectionPermission
|
|
168
|
+
const finalPermission = (_sma$sectionPermissio = sma.sectionPermission) !== null && _sma$sectionPermissio !== void 0 ? _sma$sectionPermissio : sectionPermission;
|
|
165
169
|
if (!finalPermission || stripes.hasPerm(finalPermission)) {
|
|
170
|
+
var _ref2, _sma$pages, _sma$persistentPages;
|
|
166
171
|
const dynamicPagesFromQueryReturn = getDynamicPages(queryReturnArray[idx], sma);
|
|
167
|
-
const finalPages = sma.pages
|
|
168
|
-
return {
|
|
169
|
-
...p,
|
|
172
|
+
const finalPages = (_ref2 = (_sma$pages = sma.pages) !== null && _sma$pages !== void 0 ? _sma$pages : pages) !== null && _ref2 !== void 0 ? _ref2 : ((_sma$persistentPages = sma.persistentPages) !== null && _sma$persistentPages !== void 0 ? _sma$persistentPages : persistentPages).concat(dynamicPagesFromQueryReturn.dynamic).sort(_utils.sortByLabel).map(p => {
|
|
173
|
+
return _objectSpread(_objectSpread({}, p), {}, {
|
|
170
174
|
component: pCProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(SettingsContextProvider, {
|
|
171
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(p.component, {
|
|
172
|
-
...pCProps
|
|
173
|
-
})
|
|
175
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(p.component, _objectSpread({}, pCProps))
|
|
174
176
|
})
|
|
175
|
-
};
|
|
177
|
+
});
|
|
176
178
|
});
|
|
177
|
-
return {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
...dynamicPagesFromQueryReturn,
|
|
179
|
+
return _objectSpread(_objectSpread(_objectSpread({}, sma), {}, {
|
|
180
|
+
SettingsContextProvider
|
|
181
|
+
}, dynamicPagesFromQueryReturn), {}, {
|
|
181
182
|
pageList: finalPages,
|
|
182
183
|
// DEPRECATED Here for backwards compatibility
|
|
183
184
|
pages: finalPages // ASSUMPTION MADE THAT INDICES REMAIN THE SAME
|
|
184
|
-
};
|
|
185
|
+
});
|
|
185
186
|
}
|
|
186
187
|
return null;
|
|
187
188
|
}).filter(Boolean);
|
|
@@ -189,7 +190,7 @@ const useSettings = function () {
|
|
|
189
190
|
const pageList = (0, _react.useMemo)(() => {
|
|
190
191
|
let finalPages = null;
|
|
191
192
|
if (finalSections && finalSections.length === 1 && !renderSingleSection) {
|
|
192
|
-
finalPages = pages
|
|
193
|
+
finalPages = pages !== null && pages !== void 0 ? pages : finalSections[0].pages;
|
|
193
194
|
}
|
|
194
195
|
return finalPages;
|
|
195
196
|
}, [finalSections, pages, renderSingleSection]);
|
|
@@ -200,14 +201,13 @@ const useSettings = function () {
|
|
|
200
201
|
return null;
|
|
201
202
|
}, [finalSections, renderSingleSection]);
|
|
202
203
|
const SettingsComponent = props => {
|
|
203
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_smartComponents.Settings, {
|
|
204
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_smartComponents.Settings, _objectSpread({
|
|
204
205
|
pages: pageList,
|
|
205
206
|
paneTitle: kintIntl.formatKintMessage({
|
|
206
207
|
id: 'meta.title'
|
|
207
208
|
}),
|
|
208
|
-
sections: passedSections
|
|
209
|
-
|
|
210
|
-
});
|
|
209
|
+
sections: passedSections
|
|
210
|
+
}, props));
|
|
211
211
|
};
|
|
212
212
|
return {
|
|
213
213
|
isLoading,
|
|
@@ -215,10 +215,10 @@ const useSettings = function () {
|
|
|
215
215
|
sections: finalSections,
|
|
216
216
|
SettingsComponent,
|
|
217
217
|
// This doesn't make much sense if there is more than one section, here to avoid breaking changes
|
|
218
|
-
SettingsContextProvider: finalSections && finalSections.length === 1 ? finalSections[0].SettingsContextProvider :
|
|
218
|
+
SettingsContextProvider: finalSections && finalSections.length === 1 ? finalSections[0].SettingsContextProvider : _ref3 => {
|
|
219
219
|
let {
|
|
220
220
|
children
|
|
221
|
-
} =
|
|
221
|
+
} = _ref3;
|
|
222
222
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
223
223
|
children: [" ", children, " "]
|
|
224
224
|
});
|