@k-int/stripes-kint-components 1.7.0 → 2.1.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 +36 -0
- package/es/index.js +51 -8
- package/es/lib/ActionList/ActionList.js +48 -28
- package/es/lib/ActionList/ActionListFieldArray.js +56 -16
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +198 -0
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +326 -0
- package/es/lib/CustomProperties/Config/CustomPropertiesView.js +166 -0
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +360 -0
- package/es/lib/CustomProperties/Config/index.js +41 -0
- package/es/lib/EditableRefdataList/EditableRefdataList.js +0 -1
- package/es/lib/FormModal/FormModal.js +126 -0
- package/es/lib/{TypeDown → FormModal}/index.js +2 -2
- package/es/lib/NoResultsMessage/NoResultsMessage.js +1 -1
- package/es/lib/SASQRoute/SASQRoute.js +15 -11
- package/es/lib/SASQViewComponent/SASQViewComponent.js +6 -3
- package/es/lib/Typedown/Typedown.js +50 -18
- package/es/lib/constants/customProperties.js +60 -0
- package/es/lib/hooks/index.js +16 -0
- package/es/lib/hooks/useCustomProperties.js +122 -0
- package/es/lib/hooks/useMutateCustomProperties.js +143 -0
- package/es/lib/utils/generateKiwtQueryParams.js +51 -8
- package/junit.xml +40 -40
- package/package.json +5 -3
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +47 -26
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +122 -8
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +10 -10
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesLookup.js.html +418 -0
- package/src/artifacts/coverage-jest/lcov-report/{TypeDown/TypeDown.js.html → CustomProperties/Config/CustomPropertiesSettings.js.html} +268 -232
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesView.js.html +535 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +973 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.html +176 -0
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.js.html +97 -0
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +2 -5
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html +298 -0
- package/src/artifacts/coverage-jest/lcov-report/{TypeDown → FormModal}/index.html +14 -14
- package/src/artifacts/coverage-jest/lcov-report/{TypeDown → FormModal}/index.js.html +4 -4
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +3 -3
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +43 -16
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +6 -3
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +150 -21
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +7 -7
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html +112 -0
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +18 -3
- package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +35 -5
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +8 -2
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html +313 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html +271 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/index.html +62 -47
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +174 -12
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +17 -17
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/renderHelpText.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +1 -1
- package/src/artifacts/coverage-jest/lcov.info +841 -348
- package/src/index.js +14 -4
- package/src/lib/ActionList/ActionList.js +30 -23
- package/src/lib/ActionList/ActionListFieldArray.js +40 -2
- package/src/lib/ActionList/README.md +4 -1
- package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +111 -0
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +240 -0
- package/src/lib/CustomProperties/Config/CustomPropertiesView.js +150 -0
- package/src/lib/CustomProperties/Config/CustomPropertyForm.js +296 -0
- package/src/lib/CustomProperties/Config/index.js +4 -0
- package/src/lib/EditableRefdataList/EditableRefdataList.js +0 -1
- package/src/lib/FormModal/FormModal.js +71 -0
- package/src/lib/FormModal/index.js +1 -0
- package/src/lib/NoResultsMessage/NoResultsMessage.js +2 -2
- package/src/lib/SASQRoute/SASQRoute.js +23 -14
- package/src/lib/SASQViewComponent/SASQViewComponent.js +2 -1
- package/src/lib/Typedown/Typedown.js +56 -13
- package/src/lib/constants/customProperties.js +9 -0
- package/src/lib/hooks/index.js +2 -0
- package/src/lib/hooks/useCustomProperties.js +76 -0
- package/src/lib/hooks/useMutateCustomProperties.js +62 -0
- package/src/lib/utils/generateKiwtQueryParams.js +58 -4
- package/styles/TypeDown.css +7 -0
- package/translations/stripes-kint-components/en.json +49 -1
- package/es/lib/TypeDown/TypeDown.js +0 -251
- package/src/lib/TypeDown/README.md +0 -1
- package/src/lib/TypeDown/TypeDown.js +0 -228
- package/src/lib/TypeDown/index.js +0 -1
|
@@ -17,8 +17,6 @@ var _get3 = _interopRequireDefault(require("lodash/get"));
|
|
|
17
17
|
|
|
18
18
|
var _components = require("@folio/stripes/components");
|
|
19
19
|
|
|
20
|
-
var _interactionStyles = require("@folio/stripes-components/lib/sharedStyles/interactionStyles.css");
|
|
21
|
-
|
|
22
20
|
var _SearchField = _interopRequireDefault(require("../SearchField"));
|
|
23
21
|
|
|
24
22
|
var _TypeDown = _interopRequireDefault(require("../../../styles/TypeDown.css"));
|
|
@@ -57,9 +55,14 @@ var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoader
|
|
|
57
55
|
};
|
|
58
56
|
|
|
59
57
|
var Typedown = function Typedown(_ref) {
|
|
60
|
-
var
|
|
58
|
+
var className = _ref.className,
|
|
59
|
+
dataOptions = _ref.dataOptions,
|
|
60
|
+
endOfList = _ref.endOfList,
|
|
61
|
+
id = _ref.id,
|
|
61
62
|
input = _ref.input,
|
|
63
|
+
isSelected = _ref.isSelected,
|
|
62
64
|
filterPath = _ref.filterPath,
|
|
65
|
+
label = _ref.label,
|
|
63
66
|
meta = _ref.meta,
|
|
64
67
|
onChange = _ref.onChange,
|
|
65
68
|
onType = _ref.onType,
|
|
@@ -67,6 +70,7 @@ var Typedown = function Typedown(_ref) {
|
|
|
67
70
|
renderFooter = _ref$renderFooter === void 0 ? null : _ref$renderFooter,
|
|
68
71
|
_ref$renderListItem = _ref.renderListItem,
|
|
69
72
|
renderListItem = _ref$renderListItem === void 0 ? null : _ref$renderListItem,
|
|
73
|
+
required = _ref.required,
|
|
70
74
|
_ref$uniqueIdentifica = _ref.uniqueIdentificationPath,
|
|
71
75
|
uniqueIdentificationPath = _ref$uniqueIdentifica === void 0 ? 'id' : _ref$uniqueIdentifica;
|
|
72
76
|
var selectedUniqueId = (0, _get3.default)(input.value, uniqueIdentificationPath); // Display data needs to be in line with data options but also able to react to default handleType
|
|
@@ -74,7 +78,18 @@ var Typedown = function Typedown(_ref) {
|
|
|
74
78
|
var _useState = (0, _react.useState)(dataOptions),
|
|
75
79
|
_useState2 = _slicedToArray(_useState, 2),
|
|
76
80
|
displayData = _useState2[0],
|
|
77
|
-
setDisplayData = _useState2[1];
|
|
81
|
+
setDisplayData = _useState2[1]; // keep track of what we've typed and whether we've typed an exact match or not
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
var _useState3 = (0, _react.useState)(''),
|
|
85
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
86
|
+
currentlyTyped = _useState4[0],
|
|
87
|
+
setCurrentlyTyped = _useState4[1];
|
|
88
|
+
|
|
89
|
+
var _useState5 = (0, _react.useState)(false),
|
|
90
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
91
|
+
exactMatch = _useState6[0],
|
|
92
|
+
setExactMatch = _useState6[1];
|
|
78
93
|
|
|
79
94
|
(0, _react.useEffect)(function () {
|
|
80
95
|
setDisplayData(dataOptions);
|
|
@@ -102,6 +117,14 @@ var Typedown = function Typedown(_ref) {
|
|
|
102
117
|
} else {
|
|
103
118
|
setDisplayData(dataOptions);
|
|
104
119
|
}
|
|
120
|
+
|
|
121
|
+
setCurrentlyTyped(e.target.value);
|
|
122
|
+
|
|
123
|
+
if (displayData.length === 1 && (0, _get3.default)(displayData[0], filterPath) === e.target.value) {
|
|
124
|
+
setExactMatch(true);
|
|
125
|
+
} else {
|
|
126
|
+
setExactMatch(false);
|
|
127
|
+
}
|
|
105
128
|
}; // Hook to set up all the essentials
|
|
106
129
|
|
|
107
130
|
|
|
@@ -124,9 +147,9 @@ var Typedown = function Typedown(_ref) {
|
|
|
124
147
|
var renderItem = (0, _react.useCallback)(function (option) {
|
|
125
148
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
126
149
|
className: _TypeDown.default.listItem,
|
|
127
|
-
children: renderListItem ? renderListItem(option) : (0, _get3.default)(option, uniqueIdentificationPath)
|
|
150
|
+
children: renderListItem ? renderListItem(option, currentlyTyped, exactMatch) : (0, _get3.default)(option, uniqueIdentificationPath)
|
|
128
151
|
});
|
|
129
|
-
}, [renderListItem, uniqueIdentificationPath]);
|
|
152
|
+
}, [currentlyTyped, exactMatch, renderListItem, uniqueIdentificationPath]);
|
|
130
153
|
var handleChange = (0, _react.useCallback)(function (value) {
|
|
131
154
|
input.onChange(value);
|
|
132
155
|
|
|
@@ -146,10 +169,10 @@ var Typedown = function Typedown(_ref) {
|
|
|
146
169
|
className: _TypeDown.default.listContainer,
|
|
147
170
|
id: "typedown-list",
|
|
148
171
|
children: displayData !== null && displayData !== void 0 && displayData.length ? displayData === null || displayData === void 0 ? void 0 : displayData.map(function (d, index) {
|
|
149
|
-
var
|
|
172
|
+
var isSelectedEval = isSelected ? isSelected(input.value, d) : (0, _get3.default)(input.value, uniqueIdentificationPath) === (0, _get3.default)(d, uniqueIdentificationPath);
|
|
150
173
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
151
|
-
className: (0, _classnames.default)(
|
|
152
|
-
"data-selected":
|
|
174
|
+
className: (0, _classnames.default)(_TypeDown.default.fullWidth, _TypeDown.default.menuButton),
|
|
175
|
+
"data-selected": isSelectedEval,
|
|
153
176
|
id: "typedown-button-[".concat(index, "]"),
|
|
154
177
|
onClick: function onClick() {
|
|
155
178
|
handleChange(d);
|
|
@@ -159,18 +182,15 @@ var Typedown = function Typedown(_ref) {
|
|
|
159
182
|
type: "button",
|
|
160
183
|
children: renderItem(d)
|
|
161
184
|
}, "typedown-button-[".concat(index, "]"));
|
|
162
|
-
}) :
|
|
163
|
-
/*#__PURE__*/
|
|
164
|
-
// TODO test this
|
|
165
|
-
(0, _jsxRuntime.jsx)(_components.EndOfList, {})
|
|
185
|
+
}) : endOfList || /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.EndOfList, {})
|
|
166
186
|
}), renderFooter && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
167
187
|
ref: footerRef,
|
|
168
188
|
className: _TypeDown.default.footer,
|
|
169
189
|
id: "typedown-footer-".concat((0, _selectorSafe.default)(input.name)),
|
|
170
|
-
children: renderFooter()
|
|
190
|
+
children: renderFooter(displayData, currentlyTyped, exactMatch)
|
|
171
191
|
})]
|
|
172
192
|
});
|
|
173
|
-
}, [displayData, footerRef, handleChange, handleNextFocus, input, listKeyDownHandler, listRef, renderFooter, renderItem, searchWidth, uniqueIdentificationPath]);
|
|
193
|
+
}, [currentlyTyped, displayData, endOfList, exactMatch, footerRef, handleChange, handleNextFocus, input, isSelected, listKeyDownHandler, listRef, renderFooter, renderItem, searchWidth, uniqueIdentificationPath]);
|
|
174
194
|
|
|
175
195
|
var renderSearchField = function renderSearchField() {
|
|
176
196
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -189,7 +209,13 @@ var Typedown = function Typedown(_ref) {
|
|
|
189
209
|
|
|
190
210
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
191
211
|
ref: resizeRef,
|
|
192
|
-
|
|
212
|
+
className: (0, _classnames.default)(_TypeDown.default.typedown, className),
|
|
213
|
+
children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Label, {
|
|
214
|
+
htmlFor: id,
|
|
215
|
+
id: "".concat(id, "-label"),
|
|
216
|
+
required: required,
|
|
217
|
+
children: label
|
|
218
|
+
}), renderSearchField(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Popper, {
|
|
193
219
|
anchorRef: triggerRef,
|
|
194
220
|
className: (0, _classnames.default)(_TypeDown.default.dropdown, _TypeDown.default.fullWidth),
|
|
195
221
|
isOpen: open,
|
|
@@ -215,7 +241,7 @@ var Typedown = function Typedown(_ref) {
|
|
|
215
241
|
portal: portal,
|
|
216
242
|
children: dropDown()
|
|
217
243
|
}, "typedown-menu-toggle"), selectedUniqueId && !open && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
218
|
-
className: (0, _classnames.default)(_TypeDown.default.
|
|
244
|
+
className: (0, _classnames.default)(_TypeDown.default.selectedDisplay),
|
|
219
245
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
220
246
|
className: _TypeDown.default.selectedItem,
|
|
221
247
|
children: renderItem(input.value)
|
|
@@ -230,19 +256,25 @@ var Typedown = function Typedown(_ref) {
|
|
|
230
256
|
});
|
|
231
257
|
};
|
|
232
258
|
|
|
233
|
-
__signature__(Typedown, "useState{[displayData, setDisplayData](dataOptions)}\nuseEffect{}\nuseTypedown{{\n refs: {\n listRef,\n triggerRef,\n overlayRef,\n footerRef\n },\n handlers: {\n handleNextFocus,\n listKeyDownHandler,\n searchFieldKeyDownHandler\n },\n variables: {\n open,\n portal,\n resizeRef,\n searchWidth\n }\n }}\nuseCallback{renderItem}\nuseCallback{handleChange}\nuseCallback{dropDown}", function () {
|
|
259
|
+
__signature__(Typedown, "useState{[displayData, setDisplayData](dataOptions)}\nuseState{[currentlyTyped, setCurrentlyTyped]('')}\nuseState{[exactMatch, setExactMatch](false)}\nuseEffect{}\nuseTypedown{{\n refs: {\n listRef,\n triggerRef,\n overlayRef,\n footerRef\n },\n handlers: {\n handleNextFocus,\n listKeyDownHandler,\n searchFieldKeyDownHandler\n },\n variables: {\n open,\n portal,\n resizeRef,\n searchWidth\n }\n }}\nuseCallback{renderItem}\nuseCallback{handleChange}\nuseCallback{dropDown}", function () {
|
|
234
260
|
return [_typedownHooks.useTypedown];
|
|
235
261
|
});
|
|
236
262
|
|
|
237
263
|
Typedown.propTypes = {
|
|
264
|
+
className: _propTypes.default.string,
|
|
238
265
|
dataOptions: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
266
|
+
endOfList: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node, _propTypes.default.element]),
|
|
239
267
|
filterPath: _propTypes.default.string,
|
|
268
|
+
id: _propTypes.default.string,
|
|
240
269
|
input: _propTypes.default.object,
|
|
270
|
+
isSelected: _propTypes.default.func,
|
|
271
|
+
label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.element]),
|
|
241
272
|
meta: _propTypes.default.object,
|
|
242
273
|
onChange: _propTypes.default.func,
|
|
243
274
|
onType: _propTypes.default.func,
|
|
244
275
|
renderFooter: _propTypes.default.func,
|
|
245
276
|
renderListItem: _propTypes.default.func,
|
|
277
|
+
required: _propTypes.default.bool,
|
|
246
278
|
uniqueIdentificationPath: _propTypes.default.string
|
|
247
279
|
};
|
|
248
280
|
var _default = Typedown;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TYPE_CLASS_PREFIX = exports.TEXT_CLASS_NAME = exports.REFDATA_DEFINITION_CLASS_NAME = exports.REFDATA_CLASS_NAME = exports.INTEGER_CLASS_NAME = exports.DECIMAL_CLASS_NAME = exports.CONTAINER_CLASS_NAME = exports.BOOLEAN_CLASS_NAME = exports.BLOB_CLASS_NAME = void 0;
|
|
7
|
+
|
|
8
|
+
(function () {
|
|
9
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
10
|
+
enterModule && enterModule(module);
|
|
11
|
+
})();
|
|
12
|
+
|
|
13
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
14
|
+
return a;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var TYPE_CLASS_PREFIX = 'com.k_int.web.toolkit.custprops.types.CustomProperty';
|
|
18
|
+
exports.TYPE_CLASS_PREFIX = TYPE_CLASS_PREFIX;
|
|
19
|
+
var BLOB_CLASS_NAME = 'com.k_int.web.toolkit.custprops.types.CustomPropertyBlob';
|
|
20
|
+
exports.BLOB_CLASS_NAME = BLOB_CLASS_NAME;
|
|
21
|
+
var BOOLEAN_CLASS_NAME = 'com.k_int.web.toolkit.custprops.types.CustomPropertyBoolean';
|
|
22
|
+
exports.BOOLEAN_CLASS_NAME = BOOLEAN_CLASS_NAME;
|
|
23
|
+
var CONTAINER_CLASS_NAME = 'com.k_int.web.toolkit.custprops.types.CustomPropertyContainer';
|
|
24
|
+
exports.CONTAINER_CLASS_NAME = CONTAINER_CLASS_NAME;
|
|
25
|
+
var DECIMAL_CLASS_NAME = 'com.k_int.web.toolkit.custprops.types.CustomPropertyDecimal';
|
|
26
|
+
exports.DECIMAL_CLASS_NAME = DECIMAL_CLASS_NAME;
|
|
27
|
+
var INTEGER_CLASS_NAME = 'com.k_int.web.toolkit.custprops.types.CustomPropertyInteger';
|
|
28
|
+
exports.INTEGER_CLASS_NAME = INTEGER_CLASS_NAME;
|
|
29
|
+
var REFDATA_CLASS_NAME = 'com.k_int.web.toolkit.custprops.types.CustomPropertyRefdata';
|
|
30
|
+
exports.REFDATA_CLASS_NAME = REFDATA_CLASS_NAME;
|
|
31
|
+
var REFDATA_DEFINITION_CLASS_NAME = 'com.k_int.web.toolkit.custprops.types.CustomPropertyRefdataDefinition';
|
|
32
|
+
exports.REFDATA_DEFINITION_CLASS_NAME = REFDATA_DEFINITION_CLASS_NAME;
|
|
33
|
+
var TEXT_CLASS_NAME = 'com.k_int.web.toolkit.custprops.types.CustomPropertyText';
|
|
34
|
+
exports.TEXT_CLASS_NAME = TEXT_CLASS_NAME;
|
|
35
|
+
;
|
|
36
|
+
|
|
37
|
+
(function () {
|
|
38
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
39
|
+
|
|
40
|
+
if (!reactHotLoader) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
reactHotLoader.register(TYPE_CLASS_PREFIX, "TYPE_CLASS_PREFIX", "/home/ethan/FolioModules/stripes-kint-components/src/lib/constants/customProperties.js");
|
|
45
|
+
reactHotLoader.register(BLOB_CLASS_NAME, "BLOB_CLASS_NAME", "/home/ethan/FolioModules/stripes-kint-components/src/lib/constants/customProperties.js");
|
|
46
|
+
reactHotLoader.register(BOOLEAN_CLASS_NAME, "BOOLEAN_CLASS_NAME", "/home/ethan/FolioModules/stripes-kint-components/src/lib/constants/customProperties.js");
|
|
47
|
+
reactHotLoader.register(CONTAINER_CLASS_NAME, "CONTAINER_CLASS_NAME", "/home/ethan/FolioModules/stripes-kint-components/src/lib/constants/customProperties.js");
|
|
48
|
+
reactHotLoader.register(DECIMAL_CLASS_NAME, "DECIMAL_CLASS_NAME", "/home/ethan/FolioModules/stripes-kint-components/src/lib/constants/customProperties.js");
|
|
49
|
+
reactHotLoader.register(INTEGER_CLASS_NAME, "INTEGER_CLASS_NAME", "/home/ethan/FolioModules/stripes-kint-components/src/lib/constants/customProperties.js");
|
|
50
|
+
reactHotLoader.register(REFDATA_CLASS_NAME, "REFDATA_CLASS_NAME", "/home/ethan/FolioModules/stripes-kint-components/src/lib/constants/customProperties.js");
|
|
51
|
+
reactHotLoader.register(REFDATA_DEFINITION_CLASS_NAME, "REFDATA_DEFINITION_CLASS_NAME", "/home/ethan/FolioModules/stripes-kint-components/src/lib/constants/customProperties.js");
|
|
52
|
+
reactHotLoader.register(TEXT_CLASS_NAME, "TEXT_CLASS_NAME", "/home/ethan/FolioModules/stripes-kint-components/src/lib/constants/customProperties.js");
|
|
53
|
+
})();
|
|
54
|
+
|
|
55
|
+
;
|
|
56
|
+
|
|
57
|
+
(function () {
|
|
58
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
59
|
+
leaveModule && leaveModule(module);
|
|
60
|
+
})();
|
package/es/lib/hooks/index.js
CHANGED
|
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "useActiveElement", {
|
|
|
9
9
|
return _useActiveElement.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "useCustomProperties", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _useCustomProperties.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
Object.defineProperty(exports, "useHelperApp", {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
get: function get() {
|
|
@@ -33,6 +39,12 @@ Object.defineProperty(exports, "useLocalStorageState", {
|
|
|
33
39
|
return _useLocalStorageState.default;
|
|
34
40
|
}
|
|
35
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "useMutateCustomProperties", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function get() {
|
|
45
|
+
return _useMutateCustomProperties.default;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
36
48
|
Object.defineProperty(exports, "useMutateRefdataValue", {
|
|
37
49
|
enumerable: true,
|
|
38
50
|
get: function get() {
|
|
@@ -90,6 +102,10 @@ var _settingsHooks = require("./settingsHooks");
|
|
|
90
102
|
|
|
91
103
|
var _useKiwtFieldArray = _interopRequireDefault(require("./useKiwtFieldArray"));
|
|
92
104
|
|
|
105
|
+
var _useCustomProperties = _interopRequireDefault(require("./useCustomProperties"));
|
|
106
|
+
|
|
107
|
+
var _useMutateCustomProperties = _interopRequireDefault(require("./useMutateCustomProperties"));
|
|
108
|
+
|
|
93
109
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
94
110
|
|
|
95
111
|
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
var _reactQuery = require("react-query");
|
|
11
|
+
|
|
12
|
+
var _core = require("@folio/stripes/core");
|
|
13
|
+
|
|
14
|
+
var _utils = require("../utils");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
(function () {
|
|
19
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
20
|
+
enterModule && enterModule(module);
|
|
21
|
+
})();
|
|
22
|
+
|
|
23
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
|
+
|
|
25
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
|
+
|
|
27
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
28
|
+
|
|
29
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
30
|
+
return a;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var useCustomProperties = function useCustomProperties(_ref) {
|
|
34
|
+
var endpoint = _ref.endpoint,
|
|
35
|
+
ctx = _ref.ctx,
|
|
36
|
+
_ref$nsValues = _ref.nsValues,
|
|
37
|
+
nsValues = _ref$nsValues === void 0 ? {
|
|
38
|
+
sort: 'id'
|
|
39
|
+
} : _ref$nsValues,
|
|
40
|
+
_ref$options = _ref.options,
|
|
41
|
+
options = _ref$options === void 0 ? {} : _ref$options,
|
|
42
|
+
queryParams = _ref.queryParams,
|
|
43
|
+
_ref$returnQueryObjec = _ref.returnQueryObject,
|
|
44
|
+
returnQueryObject = _ref$returnQueryObjec === void 0 ? false : _ref$returnQueryObjec;
|
|
45
|
+
var ky = (0, _core.useOkapiKy)();
|
|
46
|
+
|
|
47
|
+
var custPropOptions = _objectSpread({
|
|
48
|
+
searchKey: 'label,name,description',
|
|
49
|
+
filterKeys: {
|
|
50
|
+
ContextKey: 'ctx'
|
|
51
|
+
},
|
|
52
|
+
filters: [],
|
|
53
|
+
stats: false,
|
|
54
|
+
max: 100
|
|
55
|
+
}, options);
|
|
56
|
+
|
|
57
|
+
if (Array.isArray(ctx)) {
|
|
58
|
+
// If we have an array, append a context filter for each ctx given
|
|
59
|
+
// Special case if one is isNull
|
|
60
|
+
custPropOptions.filters.push({
|
|
61
|
+
values: ctx.map(function (c) {
|
|
62
|
+
return c === 'isNull' ? 'ctx isNull' : "ctx==".concat(c);
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
} else if (ctx === 'isNull') {
|
|
66
|
+
// isNull is a special case
|
|
67
|
+
custPropOptions.filters.push({
|
|
68
|
+
value: 'ctx isNull'
|
|
69
|
+
});
|
|
70
|
+
} else if (ctx) {
|
|
71
|
+
custPropOptions.filters.push({
|
|
72
|
+
path: 'ctx',
|
|
73
|
+
value: ctx
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var query = (0, _utils.generateKiwtQuery)(custPropOptions, nsValues);
|
|
78
|
+
var path = "".concat(endpoint).concat(query);
|
|
79
|
+
var queryObject = (0, _reactQuery.useQuery)(['stripes-kint-components', 'useCustomProperties', 'custprops', ctx, path], function () {
|
|
80
|
+
return ky(path).json();
|
|
81
|
+
}, queryParams);
|
|
82
|
+
|
|
83
|
+
if (returnQueryObject) {
|
|
84
|
+
return queryObject || {};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
var custprops = queryObject.data;
|
|
88
|
+
return custprops || [];
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
__signature__(useCustomProperties, "useOkapiKy{ky}\nuseQuery{queryObject}", function () {
|
|
92
|
+
return [_core.useOkapiKy, _reactQuery.useQuery];
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
useCustomProperties.propTypes = {
|
|
96
|
+
endpoint: _propTypes.default.string,
|
|
97
|
+
ctx: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
98
|
+
queryParams: _propTypes.default.object,
|
|
99
|
+
returnQueryObject: _propTypes.default.bool
|
|
100
|
+
};
|
|
101
|
+
var _default = useCustomProperties;
|
|
102
|
+
var _default2 = _default;
|
|
103
|
+
exports.default = _default2;
|
|
104
|
+
;
|
|
105
|
+
|
|
106
|
+
(function () {
|
|
107
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
108
|
+
|
|
109
|
+
if (!reactHotLoader) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
reactHotLoader.register(useCustomProperties, "useCustomProperties", "/home/ethan/FolioModules/stripes-kint-components/src/lib/hooks/useCustomProperties.js");
|
|
114
|
+
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/hooks/useCustomProperties.js");
|
|
115
|
+
})();
|
|
116
|
+
|
|
117
|
+
;
|
|
118
|
+
|
|
119
|
+
(function () {
|
|
120
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
121
|
+
leaveModule && leaveModule(module);
|
|
122
|
+
})();
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactQuery = require("react-query");
|
|
9
|
+
|
|
10
|
+
var _core = require("@folio/stripes/core");
|
|
11
|
+
|
|
12
|
+
(function () {
|
|
13
|
+
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
14
|
+
enterModule && enterModule(module);
|
|
15
|
+
})();
|
|
16
|
+
|
|
17
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
18
|
+
|
|
19
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
20
|
+
|
|
21
|
+
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var useMutateCustomProperties = function useMutateCustomProperties(_ref) {
|
|
26
|
+
var afterQueryCalls = _ref.afterQueryCalls,
|
|
27
|
+
endpoint = _ref.endpoint,
|
|
28
|
+
id = _ref.id,
|
|
29
|
+
queryParams = _ref.queryParams,
|
|
30
|
+
_ref$returnQueryObjec = _ref.returnQueryObject,
|
|
31
|
+
returnQueryObject = _ref$returnQueryObjec === void 0 ? {
|
|
32
|
+
post: false,
|
|
33
|
+
put: false,
|
|
34
|
+
delete: false
|
|
35
|
+
} : _ref$returnQueryObjec;
|
|
36
|
+
var returnObj = {};
|
|
37
|
+
var ky = (0, _core.useOkapiKy)();
|
|
38
|
+
var deleteQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateCustomProperties', 'delete', id], /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
39
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
40
|
+
while (1) {
|
|
41
|
+
switch (_context.prev = _context.next) {
|
|
42
|
+
case 0:
|
|
43
|
+
return _context.abrupt("return", ky.delete("".concat(endpoint, "/").concat(id)).json().then(afterQueryCalls === null || afterQueryCalls === void 0 ? void 0 : afterQueryCalls.delete));
|
|
44
|
+
|
|
45
|
+
case 1:
|
|
46
|
+
case "end":
|
|
47
|
+
return _context.stop();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}, _callee);
|
|
51
|
+
})), queryParams === null || queryParams === void 0 ? void 0 : queryParams.delete);
|
|
52
|
+
var putQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateCustomProperties', 'put', id], /*#__PURE__*/function () {
|
|
53
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(data) {
|
|
54
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
55
|
+
while (1) {
|
|
56
|
+
switch (_context2.prev = _context2.next) {
|
|
57
|
+
case 0:
|
|
58
|
+
return _context2.abrupt("return", ky.put("".concat(endpoint, "/").concat(id), {
|
|
59
|
+
json: data
|
|
60
|
+
}).json().then(afterQueryCalls === null || afterQueryCalls === void 0 ? void 0 : afterQueryCalls.put));
|
|
61
|
+
|
|
62
|
+
case 1:
|
|
63
|
+
case "end":
|
|
64
|
+
return _context2.stop();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, _callee2);
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
return function (_x) {
|
|
71
|
+
return _ref3.apply(this, arguments);
|
|
72
|
+
};
|
|
73
|
+
}(), queryParams === null || queryParams === void 0 ? void 0 : queryParams.put);
|
|
74
|
+
var postQueryObject = (0, _reactQuery.useMutation)(['stripes-kint-components', 'useMutateCustomProperties', 'post'], /*#__PURE__*/function () {
|
|
75
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(data) {
|
|
76
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
77
|
+
while (1) {
|
|
78
|
+
switch (_context3.prev = _context3.next) {
|
|
79
|
+
case 0:
|
|
80
|
+
return _context3.abrupt("return", ky.post("".concat(endpoint), {
|
|
81
|
+
json: data
|
|
82
|
+
}).json().then(afterQueryCalls === null || afterQueryCalls === void 0 ? void 0 : afterQueryCalls.post));
|
|
83
|
+
|
|
84
|
+
case 1:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context3.stop();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, _callee3);
|
|
90
|
+
}));
|
|
91
|
+
|
|
92
|
+
return function (_x2) {
|
|
93
|
+
return _ref4.apply(this, arguments);
|
|
94
|
+
};
|
|
95
|
+
}(), queryParams === null || queryParams === void 0 ? void 0 : queryParams.post);
|
|
96
|
+
|
|
97
|
+
if (returnQueryObject !== null && returnQueryObject !== void 0 && returnQueryObject.delete) {
|
|
98
|
+
returnObj.delete = deleteQueryObject;
|
|
99
|
+
} else {
|
|
100
|
+
returnObj.delete = deleteQueryObject.mutateAsync;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (returnQueryObject !== null && returnQueryObject !== void 0 && returnQueryObject.put) {
|
|
104
|
+
returnObj.put = putQueryObject;
|
|
105
|
+
} else {
|
|
106
|
+
returnObj.put = putQueryObject.mutateAsync;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (returnQueryObject !== null && returnQueryObject !== void 0 && returnQueryObject.post) {
|
|
110
|
+
returnObj.post = postQueryObject;
|
|
111
|
+
} else {
|
|
112
|
+
returnObj.post = postQueryObject.mutateAsync;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return returnObj;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
__signature__(useMutateCustomProperties, "useOkapiKy{ky}\nuseMutation{deleteQueryObject}\nuseMutation{putQueryObject}\nuseMutation{postQueryObject}", function () {
|
|
119
|
+
return [_core.useOkapiKy, _reactQuery.useMutation, _reactQuery.useMutation, _reactQuery.useMutation];
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
var _default = useMutateCustomProperties;
|
|
123
|
+
var _default2 = _default;
|
|
124
|
+
exports.default = _default2;
|
|
125
|
+
;
|
|
126
|
+
|
|
127
|
+
(function () {
|
|
128
|
+
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
129
|
+
|
|
130
|
+
if (!reactHotLoader) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
reactHotLoader.register(useMutateCustomProperties, "useMutateCustomProperties", "/home/ethan/FolioModules/stripes-kint-components/src/lib/hooks/useMutateCustomProperties.js");
|
|
135
|
+
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/hooks/useMutateCustomProperties.js");
|
|
136
|
+
})();
|
|
137
|
+
|
|
138
|
+
;
|
|
139
|
+
|
|
140
|
+
(function () {
|
|
141
|
+
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
142
|
+
leaveModule && leaveModule(module);
|
|
143
|
+
})();
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _excluded = ["searchKey", "filterKeys", "sortKeys", "stats"];
|
|
7
|
+
var _excluded = ["searchKey", "filterKeys", "sortKeys", "stats", "sort", "filters"];
|
|
8
8
|
|
|
9
9
|
(function () {
|
|
10
10
|
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
@@ -55,6 +55,8 @@ var generateKiwtQueryParams = function generateKiwtQueryParams(options, nsValues
|
|
|
55
55
|
sortKeys = _options$sortKeys === void 0 ? {} : _options$sortKeys,
|
|
56
56
|
_options$stats = options.stats,
|
|
57
57
|
stats = _options$stats === void 0 ? true : _options$stats,
|
|
58
|
+
optionsSort = options.sort,
|
|
59
|
+
optionsFilters = options.filters,
|
|
58
60
|
rest = _objectWithoutProperties(options, _excluded);
|
|
59
61
|
|
|
60
62
|
var paramsArray = [];
|
|
@@ -68,13 +70,41 @@ var generateKiwtQueryParams = function generateKiwtQueryParams(options, nsValues
|
|
|
68
70
|
paramsArray.push("term=".concat(query));
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
if (
|
|
73
|
+
if (optionsFilters) {
|
|
74
|
+
optionsFilters.forEach(function (opf) {
|
|
75
|
+
if (opf !== null && opf !== void 0 && opf.values) {
|
|
76
|
+
// Build the values filter block
|
|
77
|
+
var innerFilters = [];
|
|
78
|
+
opf.values.forEach(function (opfv) {
|
|
79
|
+
if (opf.path) {
|
|
80
|
+
var _opf$comparator;
|
|
81
|
+
|
|
82
|
+
innerFilters.push("".concat(opf.path).concat((_opf$comparator = opf.comparator) !== null && _opf$comparator !== void 0 ? _opf$comparator : '==').concat(opfv));
|
|
83
|
+
} else {
|
|
84
|
+
innerFilters.push(opfv);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
paramsArray.push("filters=".concat(innerFilters.join('||')));
|
|
88
|
+
} else if (opf !== null && opf !== void 0 && opf.value) {
|
|
89
|
+
// If no value OR values, then ignore
|
|
90
|
+
if (opf.path) {
|
|
91
|
+
var _opf$comparator2;
|
|
92
|
+
|
|
93
|
+
paramsArray.push("filters=".concat(opf.path).concat((_opf$comparator2 = opf.comparator) !== null && _opf$comparator2 !== void 0 ? _opf$comparator2 : '==').concat(opf.value));
|
|
94
|
+
} else {
|
|
95
|
+
paramsArray.push("filters=".concat(opf.value));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
} else if (filters) {
|
|
72
100
|
var filterMap = {};
|
|
73
101
|
filters.split(',').forEach(function (filter) {
|
|
74
|
-
var _filter$
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
102
|
+
var _filter$trim;
|
|
103
|
+
|
|
104
|
+
var _filter$trim$split = (_filter$trim = filter.trim()) === null || _filter$trim === void 0 ? void 0 : _filter$trim.split('.'),
|
|
105
|
+
_filter$trim$split2 = _toArray(_filter$trim$split),
|
|
106
|
+
filterName = _filter$trim$split2[0],
|
|
107
|
+
filterRest = _filter$trim$split2.slice(1);
|
|
78
108
|
|
|
79
109
|
var filterValue = filterRest.join('.');
|
|
80
110
|
if (filterMap[filterName] === undefined) filterMap[filterName] = [];
|
|
@@ -102,8 +132,21 @@ var generateKiwtQueryParams = function generateKiwtQueryParams(options, nsValues
|
|
|
102
132
|
});
|
|
103
133
|
}
|
|
104
134
|
|
|
105
|
-
if (
|
|
106
|
-
|
|
135
|
+
if (optionsSort && optionsSort.length > 0) {
|
|
136
|
+
optionsSort.forEach(function (os) {
|
|
137
|
+
if (os.value) {
|
|
138
|
+
paramsArray.push("sort=".concat(os.value));
|
|
139
|
+
} else if (os.path) {
|
|
140
|
+
var _os$direction;
|
|
141
|
+
|
|
142
|
+
// If no path then ignore
|
|
143
|
+
paramsArray.push("sort=".concat(os.path, ";").concat((_os$direction = os.direction) !== null && _os$direction !== void 0 ? _os$direction : 'asc'));
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
} else if (sort) {
|
|
147
|
+
var _sort$trim;
|
|
148
|
+
|
|
149
|
+
paramsArray.push.apply(paramsArray, _toConsumableArray((_sort$trim = sort.trim()) === null || _sort$trim === void 0 ? void 0 : _sort$trim.split(',').map(function (sortKey) {
|
|
107
150
|
var descending = sortKey.startsWith('-');
|
|
108
151
|
var term = sortKey.replace('-', '');
|
|
109
152
|
|