@k-int/stripes-kint-components 5.6.1 → 5.7.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 -0
- package/es/lib/ActionList/ActionListFieldArray.js +32 -37
- package/es/lib/ComboButton/ComboButton.js +5 -6
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +4 -7
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +29 -32
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +58 -58
- package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +2 -2
- package/es/lib/CustomProperties/Config/CustomPropertyView.js +32 -33
- 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 +5 -10
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +18 -25
- package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +5 -5
- 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 +11 -12
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +6 -11
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +20 -28
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +1 -1
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +6 -6
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +8 -8
- package/es/lib/CustomProperties/Filter/testResources.js +1 -2
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +1 -2
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +1 -1
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +18 -26
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +7 -11
- package/es/lib/CycleButton/CycleButton.js +1 -1
- package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +26 -38
- package/es/lib/EditableRefdataList/EditableRefdataList.js +26 -33
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +1 -1
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +5 -5
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +10 -12
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +4 -4
- package/es/lib/FormattedKintMessage/FormattedKintMessage.js +4 -7
- package/es/lib/IconSelect/IconSelect.js +5 -9
- package/es/lib/NoResultsMessage/NoResultsMessage.js +4 -4
- package/es/lib/RefdataButtons/RefdataButtons.js +3 -3
- package/es/lib/RefdataCategoriesSettings/RefdataCategoriesSettings.js +13 -17
- package/es/lib/ResponsiveButtonGroup/ResponsiveButtonGroup.js +21 -28
- package/es/lib/ResponsiveButtonGroup/useResponsiveButtonGroupSizing.js +5 -6
- package/es/lib/RichSelect/RichSelect.js +14 -19
- package/es/lib/RichSelect/useSelectedOption.js +1 -2
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +14 -17
- package/es/lib/SASQLookupComponent/TableBody/TableBody.js +6 -8
- package/es/lib/SASQRoute/SASQRoute.js +2 -2
- package/es/lib/SASQViewComponent/SASQViewComponent.js +5 -9
- package/es/lib/SettingPage/SettingPagePane.js +2 -2
- package/es/lib/SettingsFormContainer/SettingsFormContainer.js +2 -2
- package/es/lib/Typedown/Typedown.js +34 -32
- 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 +2 -2
- package/es/lib/hooks/useHelperApp.js +6 -6
- package/es/lib/hooks/useIntlKeyStore.js +4 -7
- package/es/lib/hooks/useKintIntl.js +5 -11
- package/es/lib/hooks/useKiwtSASQuery.js +1 -1
- package/es/lib/hooks/useModConfigEntries.js +2 -2
- package/es/lib/hooks/useMutateCustomProperties.js +8 -8
- package/es/lib/hooks/useMutateModConfigEntry.js +2 -2
- package/es/lib/hooks/useMutateRefdataCategory.js +4 -4
- package/es/lib/hooks/useMutateRefdataValue.js +6 -6
- package/es/lib/hooks/useQIndex.js +5 -5
- package/es/lib/hooks/useRefdata.js +3 -3
- package/es/lib/hooks/useTemplates.js +4 -4
- package/es/lib/settingsHooks/useAppSettings.js +7 -11
- package/es/lib/settingsHooks/useSettingSection.js +2 -2
- package/es/lib/settingsHooks/useSettings.js +3 -3
- package/es/lib/utils/buildUrl.js +2 -3
- 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 +4 -5
- package/es/lib/utils/filterParsers/parseKiwtQueryString.js +1 -1
- package/es/lib/utils/generateKiwtQueryParams.js +28 -37
- package/es/lib/utils/groupCustomPropertiesByCtx.js +2 -3
- package/es/lib/utils/matchString.js +5 -7
- package/es/lib/utils/parseErrorResponse.js +2 -3
- package/es/lib/utils/selectorSafe.js +2 -3
- package/es/lib/utils/sortByLabel.js +2 -3
- package/es/lib/validators/validators.js +3 -3
- package/package.json +2 -4
- package/src/lib/Typedown/Typedown.js +12 -5
- package/styles/TypeDown.css +6 -1
|
@@ -12,7 +12,6 @@ var _NoResultsMessage = _interopRequireDefault(require("../../NoResultsMessage")
|
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
const TableBody = _ref => {
|
|
15
|
-
var _query$sort, _match$params2;
|
|
16
15
|
let {
|
|
17
16
|
data,
|
|
18
17
|
error,
|
|
@@ -36,7 +35,7 @@ const TableBody = _ref => {
|
|
|
36
35
|
toggleFilterPane,
|
|
37
36
|
query
|
|
38
37
|
} = _ref;
|
|
39
|
-
const sortOrder =
|
|
38
|
+
const sortOrder = query.sort ?? '';
|
|
40
39
|
const history = (0, _reactRouterDom.useHistory)();
|
|
41
40
|
const location = (0, _reactRouterDom.useLocation)();
|
|
42
41
|
const onNeedMoreData = (_askAmount, index) => {
|
|
@@ -51,9 +50,9 @@ const TableBody = _ref => {
|
|
|
51
50
|
// Build the list of visible columns
|
|
52
51
|
const visibleColumns = resultColumns.map(e => e.propertyPath);
|
|
53
52
|
const getRowUrl = (0, _react.useCallback)(rowData => {
|
|
54
|
-
const baseUrl =
|
|
53
|
+
const baseUrl = `${path}/${rowData?.id}`;
|
|
55
54
|
return {
|
|
56
|
-
url:
|
|
55
|
+
url: `${baseUrl}${location?.search}`,
|
|
57
56
|
path,
|
|
58
57
|
baseUrl,
|
|
59
58
|
location
|
|
@@ -78,16 +77,15 @@ const TableBody = _ref => {
|
|
|
78
77
|
return null;
|
|
79
78
|
}, [getRowUrl, history, rowNavigation]);
|
|
80
79
|
const isSelected = (0, _react.useCallback)(_ref2 => {
|
|
81
|
-
var _match$params;
|
|
82
80
|
let {
|
|
83
81
|
item
|
|
84
82
|
} = _ref2;
|
|
85
|
-
return item.id ===
|
|
86
|
-
}, [match
|
|
83
|
+
return item.id === match?.params?.id;
|
|
84
|
+
}, [match?.params?.id]);
|
|
87
85
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, {
|
|
88
86
|
autosize: true,
|
|
89
87
|
columnMapping: columnMapping,
|
|
90
|
-
contentData: data
|
|
88
|
+
contentData: data?.results,
|
|
91
89
|
formatter: getEnhancedFormatter() // Pass enhanced formatter
|
|
92
90
|
,
|
|
93
91
|
hasMargin: true,
|
|
@@ -36,7 +36,7 @@ const SASQRoute = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
36
36
|
// Reinsert the SASQ_MAP
|
|
37
37
|
fetchParameters.SASQ_MAP = SASQ_MAP;
|
|
38
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
39
|
-
path:
|
|
39
|
+
path: `${path}/:id?`,
|
|
40
40
|
render: routeProps => {
|
|
41
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQLookupComponent.SASQLookupComponent, {
|
|
42
42
|
ref: lookupRef,
|
|
@@ -46,7 +46,7 @@ const SASQRoute = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
46
46
|
...props,
|
|
47
47
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.Switch, {
|
|
48
48
|
children: [children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
49
|
-
path:
|
|
49
|
+
path: `${path}/:id`,
|
|
50
50
|
render: innerProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQViewComponent.default, {
|
|
51
51
|
ref: viewRef,
|
|
52
52
|
...innerProps,
|
|
@@ -11,7 +11,6 @@ var _core = require("@folio/stripes/core");
|
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
const SASQViewComponent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
14
|
-
var _fetchParameters$item, _match$params, _match$params3;
|
|
15
14
|
let {
|
|
16
15
|
fetchParameters,
|
|
17
16
|
history,
|
|
@@ -27,22 +26,19 @@ const SASQViewComponent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
27
26
|
} = (0, _core.useNamespace)();
|
|
28
27
|
|
|
29
28
|
// If itemEndpoint is available, use that, otherwise use standard endpoint
|
|
30
|
-
const endpoint =
|
|
29
|
+
const endpoint = fetchParameters?.itemEndpoint ?? fetchParameters?.endpoint;
|
|
31
30
|
const queryNamespace = [namespace, 'SASQ'];
|
|
32
31
|
if (id) {
|
|
33
32
|
queryNamespace.push(id);
|
|
34
33
|
}
|
|
35
34
|
queryNamespace.push('view');
|
|
36
|
-
queryNamespace.push(match
|
|
35
|
+
queryNamespace.push(match?.params?.id);
|
|
37
36
|
const ky = (0, _core.useOkapiKy)();
|
|
38
37
|
const {
|
|
39
38
|
data = {},
|
|
40
39
|
...rest
|
|
41
|
-
} = (0, _reactQuery.useQuery)(queryNamespace, () => {
|
|
42
|
-
|
|
43
|
-
return ky("".concat(endpoint, "/").concat(match === null || match === void 0 || (_match$params2 = match.params) === null || _match$params2 === void 0 ? void 0 : _match$params2.id)).json();
|
|
44
|
-
}, {
|
|
45
|
-
enabled: !!(match !== null && match !== void 0 && (_match$params3 = match.params) !== null && _match$params3 !== void 0 && _match$params3.id)
|
|
40
|
+
} = (0, _reactQuery.useQuery)(queryNamespace, () => ky(`${endpoint}/${match?.params?.id}`).json(), {
|
|
41
|
+
enabled: !!match?.params?.id
|
|
46
42
|
});
|
|
47
43
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
48
44
|
queryProps: {
|
|
@@ -51,7 +47,7 @@ const SASQViewComponent = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
51
47
|
}
|
|
52
48
|
}));
|
|
53
49
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ViewComponent, {
|
|
54
|
-
onClose: () => history.push(
|
|
50
|
+
onClose: () => history.push(`${path}${location.search}`),
|
|
55
51
|
queryProps: {
|
|
56
52
|
...rest
|
|
57
53
|
},
|
|
@@ -20,9 +20,9 @@ const SettingPagePane = _ref => {
|
|
|
20
20
|
const kintIntl = (0, _hooks.useKintIntl)(passedIntlKey, passedIntlNS);
|
|
21
21
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
|
|
22
22
|
defaultWidth: "fill",
|
|
23
|
-
id:
|
|
23
|
+
id: `settings-${sectionName}`,
|
|
24
24
|
paneTitle: kintIntl.formatKintMessage({
|
|
25
|
-
id:
|
|
25
|
+
id: `settings.settingsSection.${(0, _utils.toCamelCase)(sectionName)}`,
|
|
26
26
|
fallbackMessage: sectionName
|
|
27
27
|
}),
|
|
28
28
|
children: children
|
|
@@ -49,7 +49,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
49
49
|
} = (0, _hooks.useMutateModConfigEntry)({
|
|
50
50
|
configName,
|
|
51
51
|
moduleName,
|
|
52
|
-
id: settings
|
|
52
|
+
id: settings?.id
|
|
53
53
|
});
|
|
54
54
|
const onSubmit = values => {
|
|
55
55
|
const setting = {
|
|
@@ -70,7 +70,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
70
70
|
id: 'settingSaveSuccess',
|
|
71
71
|
intlKey: passedIntlKey,
|
|
72
72
|
intlNS: passedIntlNS,
|
|
73
|
-
overrideValue: labelOverrides
|
|
73
|
+
overrideValue: labelOverrides?.settingSaveSuccess
|
|
74
74
|
}),
|
|
75
75
|
type: 'success'
|
|
76
76
|
});
|
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var
|
|
10
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
11
11
|
var _components = require("@folio/stripes/components");
|
|
12
12
|
var _SearchField = _interopRequireDefault(require("../SearchField"));
|
|
13
13
|
var _TypeDown = _interopRequireDefault(require("../../../styles/TypeDown.css"));
|
|
@@ -34,9 +34,11 @@ const Typedown = _ref => {
|
|
|
34
34
|
renderFooter = null,
|
|
35
35
|
renderListItem = null,
|
|
36
36
|
required,
|
|
37
|
+
selectedStyles,
|
|
38
|
+
// A way to pass any styles that need to be applied globally on selection
|
|
37
39
|
uniqueIdentificationPath = 'id'
|
|
38
40
|
} = _ref;
|
|
39
|
-
const selectedUniqueId = (0,
|
|
41
|
+
const selectedUniqueId = (0, _get.default)(input.value, uniqueIdentificationPath);
|
|
40
42
|
|
|
41
43
|
// Display data needs to be in line with data options but also able to react to default handleType
|
|
42
44
|
const [displayData, setDisplayData] = (0, _react.useState)(dataOptions);
|
|
@@ -50,25 +52,18 @@ const Typedown = _ref => {
|
|
|
50
52
|
|
|
51
53
|
// Setup default handleType
|
|
52
54
|
const handleType = e => {
|
|
53
|
-
|
|
54
|
-
const regex = new RegExp("".concat(e.target.value.toLowerCase()));
|
|
55
|
+
const regex = new RegExp(`${e.target.value.toLowerCase()}`);
|
|
55
56
|
if (onType) {
|
|
56
57
|
onType(e);
|
|
57
|
-
} else if (filterPath && e
|
|
58
|
-
setDisplayData(dataOptions.filter(item =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}));
|
|
62
|
-
} else if (e !== null && e !== void 0 && (_e$target2 = e.target) !== null && _e$target2 !== void 0 && _e$target2.value) {
|
|
63
|
-
setDisplayData(dataOptions.filter(item => {
|
|
64
|
-
var _get2;
|
|
65
|
-
return (_get2 = (0, _get3.default)(item, uniqueIdentificationPath)) === null || _get2 === void 0 || (_get2 = _get2.toLowerCase()) === null || _get2 === void 0 ? void 0 : _get2.match(regex);
|
|
66
|
-
}));
|
|
58
|
+
} else if (filterPath && e?.target?.value) {
|
|
59
|
+
setDisplayData(dataOptions.filter(item => (0, _get.default)(item, filterPath)?.toLowerCase()?.match(regex)));
|
|
60
|
+
} else if (e?.target?.value) {
|
|
61
|
+
setDisplayData(dataOptions.filter(item => (0, _get.default)(item, uniqueIdentificationPath)?.toLowerCase()?.match(regex)));
|
|
67
62
|
} else {
|
|
68
63
|
setDisplayData(dataOptions);
|
|
69
64
|
}
|
|
70
65
|
setCurrentlyTyped(e.target.value);
|
|
71
|
-
if (displayData.length === 1 && (0,
|
|
66
|
+
if (displayData.length === 1 && (0, _get.default)(displayData[0], filterPath) === e.target.value) {
|
|
72
67
|
setExactMatch(true);
|
|
73
68
|
} else {
|
|
74
69
|
setExactMatch(false);
|
|
@@ -95,10 +90,13 @@ const Typedown = _ref => {
|
|
|
95
90
|
searchWidth
|
|
96
91
|
}
|
|
97
92
|
} = (0, _typedownHooks.useTypedown)(input.name);
|
|
98
|
-
const renderItem = (0, _react.useCallback)(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
const renderItem = (0, _react.useCallback)(function (option) {
|
|
94
|
+
let optionIsSelected = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
95
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
96
|
+
className: _TypeDown.default.listItem,
|
|
97
|
+
children: renderListItem ? renderListItem(option, currentlyTyped, exactMatch, optionIsSelected) : (0, _get.default)(option, uniqueIdentificationPath)
|
|
98
|
+
});
|
|
99
|
+
}, [currentlyTyped, exactMatch, renderListItem, uniqueIdentificationPath]);
|
|
102
100
|
const handleChange = (0, _react.useCallback)(value => {
|
|
103
101
|
input.onChange(value);
|
|
104
102
|
if (typeof onChange === 'function') {
|
|
@@ -108,45 +106,48 @@ const Typedown = _ref => {
|
|
|
108
106
|
const dropDown = (0, _react.useCallback)(() => {
|
|
109
107
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
110
108
|
className: _TypeDown.default.dropdownMenu,
|
|
111
|
-
id:
|
|
109
|
+
id: `typedown-parent-${(0, _selectorSafe.default)(input.name)}-menu`,
|
|
112
110
|
style: {
|
|
113
|
-
'--searchWidth':
|
|
111
|
+
'--searchWidth': `${searchWidth}px`
|
|
114
112
|
},
|
|
115
113
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
116
114
|
ref: listRef,
|
|
117
115
|
className: _TypeDown.default.listContainer,
|
|
118
116
|
id: "typedown-list",
|
|
119
|
-
children: displayData
|
|
120
|
-
const isSelectedEval = isSelected ? isSelected(input.value, d) : (0,
|
|
117
|
+
children: displayData?.length ? displayData?.map((d, index) => {
|
|
118
|
+
const isSelectedEval = isSelected ? isSelected(input.value, d) : (0, _get.default)(input.value, uniqueIdentificationPath) === (0, _get.default)(d, uniqueIdentificationPath);
|
|
119
|
+
const selectedCSS = selectedStyles ?? _TypeDown.default.selectedMenuButton;
|
|
121
120
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
122
|
-
className: (0, _classnames.default)(_TypeDown.default.fullWidth, _TypeDown.default.menuButton
|
|
121
|
+
className: (0, _classnames.default)(_TypeDown.default.fullWidth, _TypeDown.default.menuButton, {
|
|
122
|
+
[`${selectedCSS}`]: isSelectedEval
|
|
123
|
+
}),
|
|
123
124
|
"data-selected": isSelectedEval,
|
|
124
|
-
id:
|
|
125
|
+
id: `typedown-button-[${index}]`,
|
|
125
126
|
onClick: () => {
|
|
126
127
|
handleChange(d);
|
|
127
128
|
handleNextFocus();
|
|
128
129
|
},
|
|
129
130
|
onKeyDown: listKeyDownHandler,
|
|
130
131
|
type: "button",
|
|
131
|
-
children: renderItem(d)
|
|
132
|
-
},
|
|
132
|
+
children: renderItem(d, isSelectedEval)
|
|
133
|
+
}, `typedown-button-[${index}]`);
|
|
133
134
|
}) : endOfList || /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.EndOfList, {})
|
|
134
135
|
}), renderFooter && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
135
136
|
ref: footerRef,
|
|
136
137
|
className: _TypeDown.default.footer,
|
|
137
|
-
id:
|
|
138
|
+
id: `typedown-footer-${(0, _selectorSafe.default)(input.name)}`,
|
|
138
139
|
children: renderFooter(displayData, currentlyTyped, exactMatch)
|
|
139
140
|
})]
|
|
140
141
|
});
|
|
141
|
-
}, [currentlyTyped, displayData, endOfList, exactMatch, footerRef, handleChange, handleNextFocus, input, isSelected, listKeyDownHandler, listRef, renderFooter, renderItem, searchWidth, uniqueIdentificationPath]);
|
|
142
|
+
}, [currentlyTyped, displayData, endOfList, exactMatch, footerRef, handleChange, handleNextFocus, input.name, input.value, isSelected, listKeyDownHandler, listRef, renderFooter, renderItem, searchWidth, selectedStyles, uniqueIdentificationPath]);
|
|
142
143
|
const renderSearchField = () => {
|
|
143
144
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
144
145
|
ref: triggerRef,
|
|
145
|
-
id:
|
|
146
|
+
id: `typedown-parent-${(0, _selectorSafe.default)(input.name)}-searchField`,
|
|
146
147
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchField.default
|
|
147
148
|
// Pass meta through so correct styling gets applied to the TextField
|
|
148
149
|
, {
|
|
149
|
-
id:
|
|
150
|
+
id: `typedown-searchField-${(0, _selectorSafe.default)(input.name)}`,
|
|
150
151
|
label: label,
|
|
151
152
|
marginBottom0: true,
|
|
152
153
|
meta: meta,
|
|
@@ -159,7 +160,7 @@ const Typedown = _ref => {
|
|
|
159
160
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
160
161
|
ref: resizeRef,
|
|
161
162
|
className: (0, _classnames.default)(_TypeDown.default.typedown, className),
|
|
162
|
-
id:
|
|
163
|
+
id: `typedown-id-${id}`,
|
|
163
164
|
children: [renderSearchField(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Popper, {
|
|
164
165
|
anchorRef: triggerRef,
|
|
165
166
|
className: (0, _classnames.default)(_TypeDown.default.dropdown, _TypeDown.default.fullWidth),
|
|
@@ -213,6 +214,7 @@ Typedown.propTypes = {
|
|
|
213
214
|
renderFooter: _propTypes.default.func,
|
|
214
215
|
renderListItem: _propTypes.default.func,
|
|
215
216
|
required: _propTypes.default.bool,
|
|
217
|
+
selectedStyles: _propTypes.default.string,
|
|
216
218
|
uniqueIdentificationPath: _propTypes.default.string
|
|
217
219
|
};
|
|
218
220
|
var _default = exports.default = Typedown;
|
|
@@ -13,14 +13,14 @@ var _useTypedownToggle = _interopRequireDefault(require("./useTypedownToggle"));
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
const useTypedown = name => {
|
|
15
15
|
// SEARCHFIELD COMPONENT
|
|
16
|
-
const searchFieldComponent = document.getElementById(
|
|
16
|
+
const searchFieldComponent = document.getElementById(`typedown-searchField-${(0, _selectorSafe.default)(name)}`);
|
|
17
17
|
|
|
18
18
|
// SET UP REFS
|
|
19
19
|
const listRef = (0, _react.useRef)();
|
|
20
20
|
const triggerRef = (0, _react.useRef)();
|
|
21
21
|
const overlayRef = (0, _react.useRef)();
|
|
22
22
|
const footerRef = (0, _react.useRef)();
|
|
23
|
-
const footer = document.getElementById(
|
|
23
|
+
const footer = document.getElementById(`typedown-footer-${(0, _selectorSafe.default)(name)}`);
|
|
24
24
|
// Add an event listener to the footer, so that we can control tab behaviour between footer elements
|
|
25
25
|
|
|
26
26
|
if (footer && footer.getAttribute('hasListener') !== 'true') {
|
|
@@ -18,8 +18,8 @@ const useTypedownToggle = name => {
|
|
|
18
18
|
} = (0, _useActiveElement.default)();
|
|
19
19
|
|
|
20
20
|
// Trawl up element stack and check if a typedown-parent exists, use that to toggle
|
|
21
|
-
const openBool = !open && hasParent(
|
|
22
|
-
const closeBool = open && !hasParent(
|
|
21
|
+
const openBool = !open && hasParent(`typedown-parent-${(0, _selectorSafe.default)(name)}`);
|
|
22
|
+
const closeBool = open && !hasParent(`typedown-parent-${(0, _selectorSafe.default)(name)}`);
|
|
23
23
|
(0, _react.useEffect)(() => {
|
|
24
24
|
if (openBool || closeBool) {
|
|
25
25
|
onToggle();
|
|
@@ -13,7 +13,7 @@ const useActionListRef = () => {
|
|
|
13
13
|
const passedRef = (0, _react.useCallback)(node => {
|
|
14
14
|
// All functions must be present on here
|
|
15
15
|
actionListRef.current = node;
|
|
16
|
-
if (node
|
|
16
|
+
if (node?.editing) {
|
|
17
17
|
setEditing(node.editing);
|
|
18
18
|
} else {
|
|
19
19
|
setEditing();
|
|
@@ -11,7 +11,7 @@ const useActiveElement = () => {
|
|
|
11
11
|
setActive(document.activeElement);
|
|
12
12
|
};
|
|
13
13
|
const hasParent = id => {
|
|
14
|
-
return active.closest(
|
|
14
|
+
return active.closest(`[id^=${id}]`) !== null;
|
|
15
15
|
};
|
|
16
16
|
(0, _react.useEffect)(() => {
|
|
17
17
|
document.addEventListener('focusin', handleFocusIn);
|
|
@@ -41,7 +41,7 @@ const useCustomProperties = _ref => {
|
|
|
41
41
|
|
|
42
42
|
// Special case if one is isNull
|
|
43
43
|
custPropOptions.filters.push({
|
|
44
|
-
values: ctx.map(c => c === 'isNull' ? 'ctx isNull' :
|
|
44
|
+
values: ctx.map(c => c === 'isNull' ? 'ctx isNull' : `ctx==${c}`)
|
|
45
45
|
});
|
|
46
46
|
} else if (ctx === 'isNull') {
|
|
47
47
|
// isNull is a special case
|
|
@@ -55,7 +55,7 @@ const useCustomProperties = _ref => {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
const query = (0, _utils.generateKiwtQuery)(custPropOptions, nsValues);
|
|
58
|
-
const path =
|
|
58
|
+
const path = `${endpoint}${query}`;
|
|
59
59
|
const queryObject = (0, _reactQuery.useQuery)(['stripes-kint-components', 'useCustomProperties', 'custprops', ctx, path], () => ky(path).json(), queryParams);
|
|
60
60
|
if (returnQueryObject) {
|
|
61
61
|
return queryObject || {};
|
|
@@ -17,7 +17,7 @@ const useHelperApp = helpers => {
|
|
|
17
17
|
const history = (0, _reactRouterDom.useHistory)();
|
|
18
18
|
const location = (0, _reactRouterDom.useLocation)();
|
|
19
19
|
const query = _queryString.default.parse(location.search);
|
|
20
|
-
const [currentHelper, setCurrentHelper] = (0, _react.useState)(query
|
|
20
|
+
const [currentHelper, setCurrentHelper] = (0, _react.useState)(query?.helper);
|
|
21
21
|
const handleToggleHelper = (0, _react.useCallback)(helper => {
|
|
22
22
|
setCurrentHelper(helper !== currentHelper ? helper : undefined);
|
|
23
23
|
}, [currentHelper]);
|
|
@@ -29,26 +29,26 @@ const useHelperApp = helpers => {
|
|
|
29
29
|
if (!(0, _isEqual.default)(Object.keys(helperObject), Object.keys(helpers))) {
|
|
30
30
|
helperObject = helpers;
|
|
31
31
|
}
|
|
32
|
-
if (currentHelper !==
|
|
32
|
+
if (currentHelper !== query?.helper) {
|
|
33
33
|
const newQuery = {
|
|
34
34
|
...query,
|
|
35
35
|
helper: currentHelper
|
|
36
36
|
};
|
|
37
37
|
history.push({
|
|
38
38
|
pathname: location.pathname,
|
|
39
|
-
search:
|
|
39
|
+
search: `?${_queryString.default.stringify(newQuery)}`
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
}, [currentHelper, helpers, history, location, query]);
|
|
43
43
|
|
|
44
44
|
// Set the HelperComponent
|
|
45
45
|
const HelperComponent = (0, _react.useMemo)(() => props => {
|
|
46
|
-
if (!
|
|
46
|
+
if (!query?.helper) return null;
|
|
47
47
|
let Component = null;
|
|
48
|
-
Component = helperObject[query
|
|
48
|
+
Component = helperObject[query?.helper];
|
|
49
49
|
if (!Component) return null;
|
|
50
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
51
|
-
onToggle: () => handleToggleHelper(query
|
|
51
|
+
onToggle: () => handleToggleHelper(query?.helper),
|
|
52
52
|
...props
|
|
53
53
|
});
|
|
54
54
|
}, [handleToggleHelper, query.helper]);
|
|
@@ -12,9 +12,8 @@ var _zustand = require("zustand");
|
|
|
12
12
|
const useIntlKeyStore = (0, _zustand.create)((set, get) => ({
|
|
13
13
|
intlKeys: {},
|
|
14
14
|
addKey: (key, namespace) => set(state => {
|
|
15
|
-
var _useNamespace;
|
|
16
15
|
let ns = namespace;
|
|
17
|
-
const folioNS = (
|
|
16
|
+
const folioNS = (0, _core.useNamespace)()?.[0];
|
|
18
17
|
if (!ns) {
|
|
19
18
|
ns = folioNS;
|
|
20
19
|
}
|
|
@@ -27,9 +26,8 @@ const useIntlKeyStore = (0, _zustand.create)((set, get) => ({
|
|
|
27
26
|
};
|
|
28
27
|
}),
|
|
29
28
|
removeKey: namespace => set(state => {
|
|
30
|
-
var _useNamespace2;
|
|
31
29
|
let ns = namespace;
|
|
32
|
-
const folioNS = (
|
|
30
|
+
const folioNS = (0, _core.useNamespace)()?.[0];
|
|
33
31
|
if (!ns) {
|
|
34
32
|
ns = folioNS;
|
|
35
33
|
}
|
|
@@ -43,13 +41,12 @@ const useIntlKeyStore = (0, _zustand.create)((set, get) => ({
|
|
|
43
41
|
};
|
|
44
42
|
}),
|
|
45
43
|
getKey: namespace => {
|
|
46
|
-
var _useNamespace3, _get$intlKeys;
|
|
47
44
|
let ns = namespace;
|
|
48
|
-
const folioNS = (
|
|
45
|
+
const folioNS = (0, _core.useNamespace)()?.[0];
|
|
49
46
|
if (!ns) {
|
|
50
47
|
ns = folioNS;
|
|
51
48
|
}
|
|
52
|
-
return
|
|
49
|
+
return get().intlKeys?.[ns];
|
|
53
50
|
}
|
|
54
51
|
}));
|
|
55
52
|
var _default = exports.default = useIntlKeyStore;
|
|
@@ -15,7 +15,6 @@ const useKintIntl = (passedIntlKey, passedIntlNS) => {
|
|
|
15
15
|
// FormatKintMessage id misses out the top level key part of the path.
|
|
16
16
|
// This works analogously to FormattedKintMessage component
|
|
17
17
|
const formatKintMessage = (_ref, formatValues) => {
|
|
18
|
-
var _intlObj$messages2;
|
|
19
18
|
let {
|
|
20
19
|
id,
|
|
21
20
|
overrideValue,
|
|
@@ -23,12 +22,11 @@ const useKintIntl = (passedIntlKey, passedIntlNS) => {
|
|
|
23
22
|
...formatParams
|
|
24
23
|
} = _ref;
|
|
25
24
|
if (overrideValue) {
|
|
26
|
-
var _intlObj$messages;
|
|
27
25
|
// Version 3 is a breaking change, where labelOverrides must be strings.
|
|
28
26
|
if (typeof overrideValue !== 'string') {
|
|
29
27
|
throw new Error('Override values must be strings as of stripes-kint-components ^3.0.0');
|
|
30
28
|
}
|
|
31
|
-
if (
|
|
29
|
+
if (intlObj.messages?.[overrideValue]) {
|
|
32
30
|
// We've been passed a key as an override, use it
|
|
33
31
|
return intlObj.formatMessage({
|
|
34
32
|
id: overrideValue,
|
|
@@ -42,10 +40,9 @@ const useKintIntl = (passedIntlKey, passedIntlNS) => {
|
|
|
42
40
|
// If key does not exist in intl, and we have a specified "fallbackMessage", use that
|
|
43
41
|
|
|
44
42
|
// (FallbackMessage works like defaultMessage but with no warning)
|
|
45
|
-
if (!
|
|
46
|
-
var _intlObj$messages3;
|
|
43
|
+
if (!intlObj.messages?.[`${intlKey}.${id}`] && fallbackMessage) {
|
|
47
44
|
// Allow fallback message to be an intl key
|
|
48
|
-
if (
|
|
45
|
+
if (intlObj.messages?.[fallbackMessage]) {
|
|
49
46
|
return intlObj.formatMessage({
|
|
50
47
|
id: fallbackMessage,
|
|
51
48
|
...formatParams
|
|
@@ -56,14 +53,11 @@ const useKintIntl = (passedIntlKey, passedIntlNS) => {
|
|
|
56
53
|
|
|
57
54
|
// After all that, render the message from key
|
|
58
55
|
return intlObj.formatMessage({
|
|
59
|
-
id:
|
|
56
|
+
id: `${intlKey}.${id}`,
|
|
60
57
|
...formatParams
|
|
61
58
|
}, formatValues);
|
|
62
59
|
};
|
|
63
|
-
const messageExists = key => {
|
|
64
|
-
var _intlObj$messages4;
|
|
65
|
-
return !!((_intlObj$messages4 = intlObj.messages) !== null && _intlObj$messages4 !== void 0 && _intlObj$messages4["".concat(intlKey, ".").concat(key)]);
|
|
66
|
-
};
|
|
60
|
+
const messageExists = key => !!intlObj.messages?.[`${intlKey}.${key}`];
|
|
67
61
|
return {
|
|
68
62
|
...intlObj,
|
|
69
63
|
formatKintMessage,
|
|
@@ -23,7 +23,7 @@ const locationQuerySetter = _ref => {
|
|
|
23
23
|
|
|
24
24
|
// Do not push to history if the url didn't change
|
|
25
25
|
// https://issues.folio.org/browse/STSMACOM-637
|
|
26
|
-
if (
|
|
26
|
+
if (`${pathname}${search}` !== url) {
|
|
27
27
|
history.push(url);
|
|
28
28
|
}
|
|
29
29
|
};
|
|
@@ -18,8 +18,8 @@ const useModConfigEntries = _ref => {
|
|
|
18
18
|
queryParams
|
|
19
19
|
} = _ref;
|
|
20
20
|
const ky = (0, _core.useOkapiKy)();
|
|
21
|
-
const query =
|
|
22
|
-
const path =
|
|
21
|
+
const query = `?query=(module=${moduleName} and configName=${configName})`;
|
|
22
|
+
const path = `${_endpoints.MOD_SETTINGS_ENDPOINT}${query}`;
|
|
23
23
|
const namespace = (0, _utils.modConfigEntriesQueryKey)({
|
|
24
24
|
configName,
|
|
25
25
|
moduleName,
|
|
@@ -21,24 +21,24 @@ const useMutateCustomProperties = _ref => {
|
|
|
21
21
|
} = _ref;
|
|
22
22
|
const returnObj = {};
|
|
23
23
|
const ky = (0, _core.useOkapiKy)();
|
|
24
|
-
const deleteQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateCustomProperties', 'delete', id], async () => ky.delete(
|
|
25
|
-
const putQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateCustomProperties', 'put', id], async data => ky.put(
|
|
24
|
+
const deleteQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateCustomProperties', 'delete', id], async () => ky.delete(`${endpoint}/${id}`).json().then(afterQueryCalls?.delete).catch(catchQueryCalls?.delete), queryParams?.delete);
|
|
25
|
+
const putQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateCustomProperties', 'put', id], async data => ky.put(`${endpoint}/${id}`, {
|
|
26
26
|
json: data
|
|
27
|
-
}).json().then(afterQueryCalls
|
|
28
|
-
const postQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateCustomProperties', 'post'], async data => ky.post(
|
|
27
|
+
}).json().then(afterQueryCalls?.put).catch(catchQueryCalls?.put), queryParams?.put);
|
|
28
|
+
const postQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateCustomProperties', 'post'], async data => ky.post(`${endpoint}`, {
|
|
29
29
|
json: data
|
|
30
|
-
}).json().then(afterQueryCalls
|
|
31
|
-
if (returnQueryObject
|
|
30
|
+
}).json().then(afterQueryCalls?.post).catch(catchQueryCalls?.post), queryParams?.post);
|
|
31
|
+
if (returnQueryObject?.delete) {
|
|
32
32
|
returnObj.delete = deleteQueryObject;
|
|
33
33
|
} else {
|
|
34
34
|
returnObj.delete = deleteQueryObject.mutateAsync;
|
|
35
35
|
}
|
|
36
|
-
if (returnQueryObject
|
|
36
|
+
if (returnQueryObject?.put) {
|
|
37
37
|
returnObj.put = putQueryObject;
|
|
38
38
|
} else {
|
|
39
39
|
returnObj.put = putQueryObject.mutateAsync;
|
|
40
40
|
}
|
|
41
|
-
if (returnQueryObject
|
|
41
|
+
if (returnQueryObject?.post) {
|
|
42
42
|
returnObj.post = postQueryObject;
|
|
43
43
|
} else {
|
|
44
44
|
returnObj.post = postQueryObject.mutateAsync;
|
|
@@ -21,12 +21,12 @@ const useMutateModConfigEntry = _ref => {
|
|
|
21
21
|
configName,
|
|
22
22
|
moduleName
|
|
23
23
|
});
|
|
24
|
-
const putQueryObject = (0, _reactQuery.useMutation)([...baseNamespace, 'putConfigEntry', id], async data => ky.put(
|
|
24
|
+
const putQueryObject = (0, _reactQuery.useMutation)([...baseNamespace, 'putConfigEntry', id], async data => ky.put(`${_endpoints.MOD_SETTINGS_ENDPOINT}/${id}`, {
|
|
25
25
|
json: data
|
|
26
26
|
}).json().then(() => {
|
|
27
27
|
queryClient.invalidateQueries(baseNamespace);
|
|
28
28
|
}));
|
|
29
|
-
const postQueryObject = (0, _reactQuery.useMutation)([...baseNamespace, 'postConfigEntry'], async data => ky.post(
|
|
29
|
+
const postQueryObject = (0, _reactQuery.useMutation)([...baseNamespace, 'postConfigEntry'], async data => ky.post(`${_endpoints.MOD_SETTINGS_ENDPOINT}`, {
|
|
30
30
|
json: data
|
|
31
31
|
}).json().then(() => {
|
|
32
32
|
queryClient.invalidateQueries(baseNamespace);
|
|
@@ -22,19 +22,19 @@ const useMutateRefdataCategory = _ref => {
|
|
|
22
22
|
const returnObj = {};
|
|
23
23
|
const ky = (0, _core.useOkapiKy)();
|
|
24
24
|
const invalidateRefdata = (0, _useInvalidateRefdata.default)();
|
|
25
|
-
const deleteQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateRefdataCategory', 'delete'], async id => ky.delete(
|
|
25
|
+
const deleteQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateRefdataCategory', 'delete'], async id => ky.delete(`${endpoint}/${id}`).json().then(afterQueryCalls?.delete).then(() => invalidateRefdata()).catch(catchQueryCalls?.delete), queryParams?.delete);
|
|
26
26
|
const postQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateRefdataCategory', 'post'], async payload => ky.post(endpoint, {
|
|
27
27
|
json: {
|
|
28
28
|
...payload,
|
|
29
29
|
values: []
|
|
30
30
|
}
|
|
31
|
-
}).json().then(afterQueryCalls
|
|
32
|
-
if (returnQueryObject
|
|
31
|
+
}).json().then(afterQueryCalls?.post).then(() => invalidateRefdata()).catch(catchQueryCalls?.post), queryParams?.post);
|
|
32
|
+
if (returnQueryObject?.delete) {
|
|
33
33
|
returnObj.delete = deleteQueryObject;
|
|
34
34
|
} else {
|
|
35
35
|
returnObj.delete = deleteQueryObject.mutateAsync;
|
|
36
36
|
}
|
|
37
|
-
if (returnQueryObject
|
|
37
|
+
if (returnQueryObject?.post) {
|
|
38
38
|
returnObj.post = postQueryObject;
|
|
39
39
|
} else {
|
|
40
40
|
returnObj.post = postQueryObject.mutateAsync;
|
|
@@ -23,7 +23,7 @@ const useMutateRefdataValue = _ref => {
|
|
|
23
23
|
const returnObj = {};
|
|
24
24
|
const ky = (0, _core.useOkapiKy)();
|
|
25
25
|
const invalidateRefdata = (0, _useInvalidateRefdata.default)();
|
|
26
|
-
const deleteQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateRefdataValue', 'delete', id], async data => ky.put(
|
|
26
|
+
const deleteQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateRefdataValue', 'delete', id], async data => ky.put(`${endpoint}/${id}`, {
|
|
27
27
|
json: {
|
|
28
28
|
id,
|
|
29
29
|
values: [{
|
|
@@ -31,19 +31,19 @@ const useMutateRefdataValue = _ref => {
|
|
|
31
31
|
_delete: true
|
|
32
32
|
}]
|
|
33
33
|
}
|
|
34
|
-
}).json().then(afterQueryCalls
|
|
35
|
-
const putQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'editableRefdataList', 'editValue', id], async data => ky.put(
|
|
34
|
+
}).json().then(afterQueryCalls?.delete).then(() => invalidateRefdata()).catch(catchQueryCalls?.delete), queryParams?.delete);
|
|
35
|
+
const putQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'editableRefdataList', 'editValue', id], async data => ky.put(`${endpoint}/${id}`, {
|
|
36
36
|
json: {
|
|
37
37
|
id,
|
|
38
38
|
values: [data]
|
|
39
39
|
}
|
|
40
|
-
}).json().then(afterQueryCalls
|
|
41
|
-
if (returnQueryObject
|
|
40
|
+
}).json().then(afterQueryCalls?.put).then(() => invalidateRefdata()).catch(catchQueryCalls?.put), queryParams?.put);
|
|
41
|
+
if (returnQueryObject?.delete) {
|
|
42
42
|
returnObj.delete = deleteQueryObject;
|
|
43
43
|
} else {
|
|
44
44
|
returnObj.delete = deleteQueryObject.mutateAsync;
|
|
45
45
|
}
|
|
46
|
-
if (returnQueryObject
|
|
46
|
+
if (returnQueryObject?.put) {
|
|
47
47
|
returnObj.put = putQueryObject;
|
|
48
48
|
} else {
|
|
49
49
|
returnObj.put = putQueryObject.mutateAsync;
|