@k-int/stripes-kint-components 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/es/index.js +29 -49
- package/es/lib/ActionList/ActionList.js +28 -73
- package/es/lib/ActionList/ActionListFieldArray.js +97 -220
- package/es/lib/ActionList/index.js +2 -8
- package/es/lib/EditableRefdataList/EditableRefdataList.js +46 -134
- package/es/lib/EditableRefdataList/index.js +2 -8
- package/es/lib/EditableSettingsList/EditableSettingsList.js +11 -47
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +16 -61
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +62 -137
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +23 -91
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +103 -127
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +19 -75
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +188 -357
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +39 -120
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +61 -157
- package/es/lib/EditableSettingsList/SettingField/index.js +4 -12
- package/es/lib/EditableSettingsList/index.js +4 -12
- package/es/lib/NoResultsMessage/NoResultsMessage.js +24 -61
- package/es/lib/NoResultsMessage/index.js +2 -8
- package/es/lib/QueryTypedown/QueryTypedown.js +15 -89
- package/es/lib/QueryTypedown/index.js +2 -8
- package/es/lib/RefdataButtons/RefdataButtons.js +32 -85
- package/es/lib/RefdataButtons/index.js +2 -8
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +120 -227
- package/es/lib/SASQLookupComponent/index.js +2 -8
- package/es/lib/SASQRoute/SASQRoute.js +27 -76
- package/es/lib/SASQRoute/index.js +2 -8
- package/es/lib/SASQViewComponent/SASQViewComponent.js +28 -89
- package/es/lib/SASQViewComponent/index.js +2 -8
- package/es/lib/SearchField/SearchField.js +11 -61
- package/es/lib/SearchField/index.js +2 -8
- package/es/lib/SettingPage/SettingPage.js +17 -63
- package/es/lib/SettingPage/SettingPagePane.js +13 -58
- package/es/lib/SettingPage/index.js +3 -10
- package/es/lib/TypeDown/TypeDown.js +61 -132
- package/es/lib/TypeDown/index.js +2 -8
- package/es/lib/Typedown/Typedown.js +74 -153
- package/es/lib/Typedown/index.js +2 -8
- package/es/lib/constants/eventCodes.js +3 -36
- package/es/lib/contexts/SettingsContext.js +2 -34
- package/es/lib/contexts/index.js +2 -8
- package/es/lib/hooks/index.js +12 -27
- package/es/lib/hooks/settingsHooks/index.js +3 -10
- package/es/lib/hooks/settingsHooks/useSettingSection.js +16 -60
- package/es/lib/hooks/settingsHooks/useSettings.js +51 -130
- package/es/lib/hooks/typedownHooks/index.js +4 -12
- package/es/lib/hooks/typedownHooks/useTypedown.js +60 -114
- package/es/lib/hooks/typedownHooks/useTypedownData.js +13 -69
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +15 -71
- package/es/lib/hooks/useActiveElement.js +10 -63
- package/es/lib/hooks/useHelperApp.js +37 -111
- package/es/lib/hooks/useKiwtFieldArray.js +35 -101
- package/es/lib/hooks/useKiwtSASQuery.js +36 -107
- package/es/lib/hooks/useLocalStorageState.js +7 -69
- package/es/lib/hooks/useMutateRefdataValue.js +31 -115
- package/es/lib/hooks/useQIndex.js +17 -87
- package/es/lib/hooks/useRefdata.js +19 -65
- package/es/lib/hooks/useTemplates.js +16 -60
- package/es/lib/utils/buildUrl.js +11 -51
- package/es/lib/utils/generateKiwtQuery.js +4 -40
- package/es/lib/utils/generateKiwtQueryParams.js +38 -125
- package/es/lib/utils/index.js +9 -22
- package/es/lib/utils/refdataOptions.js +2 -32
- package/es/lib/utils/renderHelpText.js +32 -89
- package/es/lib/utils/selectorSafe.js +2 -34
- package/es/lib/utils/sortByLabel.js +4 -41
- package/es/lib/utils/toCamelCase.js +8 -42
- package/package.json +17 -3
- package/es/artifacts/coverage-jest/lcov-report/block-navigation.js +0 -109
- package/es/artifacts/coverage-jest/lcov-report/prettify.js +0 -998
- package/es/artifacts/coverage-jest/lcov-report/sorter.js +0 -238
- package/junit.xml +0 -79
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +0 -256
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +0 -799
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +0 -146
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +0 -376
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +0 -223
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +0 -211
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +0 -376
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +0 -262
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +0 -436
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +0 -161
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +0 -94
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +0 -146
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +0 -94
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +0 -319
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +0 -184
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +0 -370
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +0 -949
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +0 -274
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +0 -250
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +0 -214
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +0 -211
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +0 -178
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +0 -146
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +0 -91
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/TypeDown.js.html +0 -769
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +0 -790
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +0 -88
- package/src/artifacts/coverage-jest/lcov-report/base.css +0 -224
- package/src/artifacts/coverage-jest/lcov-report/block-navigation.js +0 -87
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +0 -94
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +0 -116
- package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +0 -97
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +0 -91
- package/src/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +0 -251
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +0 -115
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +0 -146
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +0 -91
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +0 -163
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +0 -403
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +0 -161
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +0 -94
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +0 -520
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +0 -163
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +0 -163
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +0 -157
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +0 -283
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +0 -274
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +0 -178
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +0 -136
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +0 -301
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +0 -208
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +0 -268
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +0 -166
- package/src/artifacts/coverage-jest/lcov-report/index.html +0 -401
- package/src/artifacts/coverage-jest/lcov-report/prettify.css +0 -1
- package/src/artifacts/coverage-jest/lcov-report/prettify.js +0 -2
- package/src/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
- package/src/artifacts/coverage-jest/lcov-report/sorter.js +0 -196
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +0 -193
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +0 -109
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +0 -286
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +0 -236
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +0 -121
- package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +0 -106
- package/src/artifacts/coverage-jest/lcov-report/utils/renderHelpText.js.html +0 -166
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +0 -103
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +0 -130
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +0 -127
- package/src/artifacts/coverage-jest/lcov.info +0 -1999
|
@@ -4,234 +4,155 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _reactIntl = require("react-intl");
|
|
13
|
-
|
|
14
10
|
var _reactQuery = require("react-query");
|
|
15
|
-
|
|
16
11
|
var _core = require("@folio/stripes/core");
|
|
17
|
-
|
|
18
12
|
var _smartComponents = require("@folio/stripes/smart-components");
|
|
19
|
-
|
|
20
13
|
var _components = require("@folio/stripes/components");
|
|
21
|
-
|
|
22
14
|
var _NoResultsMessage = _interopRequireDefault(require("../NoResultsMessage"));
|
|
23
|
-
|
|
24
15
|
var _utils = require("../utils");
|
|
25
|
-
|
|
26
16
|
var _hooks = require("../hooks");
|
|
27
|
-
|
|
28
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
-
|
|
30
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return a;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
var SASQLookupComponent = function SASQLookupComponent(_ref) {
|
|
68
|
-
var _totalData$pages$redu, _totalData$pages;
|
|
69
|
-
|
|
70
|
-
var _children = _ref.children,
|
|
71
|
-
_ref$fetchParameters = _ref.fetchParameters,
|
|
72
|
-
fetchParameters = _ref$fetchParameters === void 0 ? {} : _ref$fetchParameters,
|
|
73
|
-
_ref$FilterPaneHeader = _ref.FilterPaneHeaderComponent,
|
|
74
|
-
FilterPaneHeaderComponent = _ref$FilterPaneHeader === void 0 ? function () {
|
|
75
|
-
return null;
|
|
76
|
-
} : _ref$FilterPaneHeader,
|
|
77
|
-
_ref$FilterComponent = _ref.FilterComponent,
|
|
78
|
-
FilterComponent = _ref$FilterComponent === void 0 ? function () {
|
|
79
|
-
return null;
|
|
80
|
-
} : _ref$FilterComponent,
|
|
81
|
-
history = _ref.history,
|
|
82
|
-
id = _ref.id,
|
|
83
|
-
location = _ref.location,
|
|
84
|
-
mainPaneProps = _ref.mainPaneProps,
|
|
85
|
-
match = _ref.match,
|
|
86
|
-
mclProps = _ref.mclProps,
|
|
87
|
-
noSearchField = _ref.noSearchField,
|
|
88
|
-
path = _ref.path,
|
|
89
|
-
_ref$resultColumns = _ref.resultColumns,
|
|
90
|
-
resultColumns = _ref$resultColumns === void 0 ? [] : _ref$resultColumns,
|
|
91
|
-
RenderBody = _ref.RenderBody,
|
|
92
|
-
sasqProps = _ref.sasqProps;
|
|
93
|
-
|
|
94
|
-
var _useKiwtSASQuery = (0, _hooks.useKiwtSASQuery)(),
|
|
95
|
-
query = _useKiwtSASQuery.query,
|
|
96
|
-
queryGetter = _useKiwtSASQuery.queryGetter,
|
|
97
|
-
querySetter = _useKiwtSASQuery.querySetter;
|
|
98
|
-
|
|
99
|
-
var _useNamespace = (0, _core.useNamespace)(),
|
|
100
|
-
namespace = _useNamespace[0];
|
|
101
|
-
|
|
102
|
-
var ky = (0, _core.useOkapiKy)();
|
|
103
|
-
var filterPaneVisibileKey = "".concat(namespace, "-").concat(id, "-filterPaneVisibility");
|
|
104
|
-
|
|
105
|
-
var fetchPageData = function fetchPageData(_ref2) {
|
|
106
|
-
var _ref2$pageParam = _ref2.pageParam,
|
|
107
|
-
pageParam = _ref2$pageParam === void 0 ? 0 : _ref2$pageParam;
|
|
108
|
-
var queryMap = fetchParameters.SASQ_MAP;
|
|
19
|
+
const SASQLookupComponent = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
children,
|
|
22
|
+
fetchParameters = {},
|
|
23
|
+
FilterPaneHeaderComponent = () => null,
|
|
24
|
+
FilterComponent = () => null,
|
|
25
|
+
history,
|
|
26
|
+
id,
|
|
27
|
+
location,
|
|
28
|
+
mainPaneProps,
|
|
29
|
+
match,
|
|
30
|
+
mclProps,
|
|
31
|
+
noSearchField,
|
|
32
|
+
path,
|
|
33
|
+
resultColumns = [],
|
|
34
|
+
RenderBody,
|
|
35
|
+
sasqProps
|
|
36
|
+
} = _ref;
|
|
37
|
+
const {
|
|
38
|
+
query,
|
|
39
|
+
queryGetter,
|
|
40
|
+
querySetter
|
|
41
|
+
} = (0, _hooks.useKiwtSASQuery)();
|
|
42
|
+
const {
|
|
43
|
+
0: namespace
|
|
44
|
+
} = (0, _core.useNamespace)();
|
|
45
|
+
const ky = (0, _core.useOkapiKy)();
|
|
46
|
+
const filterPaneVisibileKey = `${namespace}-${id}-filterPaneVisibility`;
|
|
47
|
+
const fetchPageData = _ref2 => {
|
|
48
|
+
let {
|
|
49
|
+
pageParam = 0
|
|
50
|
+
} = _ref2;
|
|
51
|
+
const queryMap = fetchParameters.SASQ_MAP;
|
|
109
52
|
queryMap.offset = pageParam;
|
|
110
|
-
return ky(
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
var _useLocalStorageState = (0, _hooks.useLocalStorageState)(filterPaneVisibileKey, true),
|
|
114
|
-
_useLocalStorageState2 = _slicedToArray(_useLocalStorageState, 2),
|
|
115
|
-
filterPaneVisible = _useLocalStorageState2[0],
|
|
116
|
-
setFilterPaneVisible = _useLocalStorageState2[1];
|
|
117
|
-
|
|
118
|
-
var toggleFilterPane = function toggleFilterPane() {
|
|
119
|
-
return setFilterPaneVisible(!filterPaneVisible);
|
|
53
|
+
return ky(`${fetchParameters.endpoint}${(0, _utils.generateKiwtQuery)(queryMap, query)}`).json();
|
|
120
54
|
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
for (var _i2 = 0, _Object$entries = Object.entries(curr); _i2 < _Object$entries.length; _i2++) {
|
|
136
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2),
|
|
137
|
-
key = _Object$entries$_i[0],
|
|
138
|
-
value = _Object$entries$_i[1];
|
|
139
|
-
|
|
55
|
+
const [filterPaneVisible, setFilterPaneVisible] = (0, _hooks.useLocalStorageState)(filterPaneVisibileKey, true);
|
|
56
|
+
const toggleFilterPane = () => setFilterPaneVisible(!filterPaneVisible);
|
|
57
|
+
const {
|
|
58
|
+
data: totalData = {},
|
|
59
|
+
error,
|
|
60
|
+
isError,
|
|
61
|
+
isLoading,
|
|
62
|
+
fetchNextPage
|
|
63
|
+
} = (0, _reactQuery.useInfiniteQuery)([namespace, id, 'data', query], fetchPageData);
|
|
64
|
+
const data = totalData.pages?.reduce((acc, curr) => {
|
|
65
|
+
const newAcc = {
|
|
66
|
+
...acc
|
|
67
|
+
};
|
|
68
|
+
for (const [key, value] of Object.entries(curr)) {
|
|
140
69
|
if (key !== 'page' && key !== 'result' && acc[key] !== value) {
|
|
141
70
|
newAcc[key] = value;
|
|
142
71
|
}
|
|
143
72
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
newResults.push.apply(newResults, _toConsumableArray((_curr$results = curr.results) !== null && _curr$results !== void 0 ? _curr$results : []));
|
|
73
|
+
const newResults = [...(acc.results ?? [])];
|
|
74
|
+
newResults.push(...(curr.results ?? []));
|
|
148
75
|
newAcc.results = newResults;
|
|
149
76
|
return newAcc;
|
|
150
|
-
}, {})
|
|
77
|
+
}, {}) ?? {};
|
|
78
|
+
|
|
79
|
+
// TODO focus handling to stop redraw movin to top
|
|
151
80
|
|
|
152
|
-
|
|
81
|
+
const onNeedMoreData = (_askAmount, index) => {
|
|
153
82
|
fetchNextPage({
|
|
154
83
|
pageParam: index
|
|
155
84
|
});
|
|
156
|
-
};
|
|
157
|
-
|
|
85
|
+
};
|
|
158
86
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
})); // Build the list of visible columns
|
|
87
|
+
// Build the map of column definitions
|
|
88
|
+
const columnMapping = Object.fromEntries(resultColumns.map(e => [e.propertyPath, e.label]));
|
|
162
89
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_smartComponents.SearchAndSortQuery, _objectSpread(_objectSpread({
|
|
90
|
+
// Build the list of visible columns
|
|
91
|
+
const visibleColumns = resultColumns.map(e => e.propertyPath);
|
|
92
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_smartComponents.SearchAndSortQuery, {
|
|
167
93
|
initialSearchState: {
|
|
168
94
|
query: ''
|
|
169
95
|
},
|
|
170
96
|
queryGetter: queryGetter,
|
|
171
|
-
querySetter: querySetter
|
|
172
|
-
|
|
173
|
-
children:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
var Body = RenderBody !== null && RenderBody !== void 0 ? RenderBody : TableBody;
|
|
97
|
+
querySetter: querySetter,
|
|
98
|
+
...sasqProps,
|
|
99
|
+
children: _ref3 => {
|
|
100
|
+
let {
|
|
101
|
+
activeFilters,
|
|
102
|
+
filterChanged,
|
|
103
|
+
getFilterHandlers,
|
|
104
|
+
getSearchHandlers,
|
|
105
|
+
onSort,
|
|
106
|
+
onSubmitSearch,
|
|
107
|
+
resetAll,
|
|
108
|
+
searchChanged,
|
|
109
|
+
searchValue
|
|
110
|
+
} = _ref3;
|
|
111
|
+
const searchHandlers = getSearchHandlers();
|
|
112
|
+
const sortOrder = query.sort ?? '';
|
|
113
|
+
const disableReset = !filterChanged && !searchChanged;
|
|
114
|
+
const filterCount = activeFilters.string ? activeFilters.string.split(',').length : 0;
|
|
115
|
+
const TableBody = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MultiColumnList, {
|
|
116
|
+
autosize: true,
|
|
117
|
+
columnMapping: columnMapping,
|
|
118
|
+
contentData: data?.results,
|
|
119
|
+
isEmptyMessage: /*#__PURE__*/(0, _jsxRuntime.jsx)(_NoResultsMessage.default, {
|
|
120
|
+
error,
|
|
121
|
+
isError,
|
|
122
|
+
isLoading,
|
|
123
|
+
filterPaneIsVisible: filterPaneVisible,
|
|
124
|
+
searchTerm: query.query,
|
|
125
|
+
toggleFilterPane
|
|
126
|
+
}),
|
|
127
|
+
isSelected: _ref4 => {
|
|
128
|
+
let {
|
|
129
|
+
item
|
|
130
|
+
} = _ref4;
|
|
131
|
+
return item.id === match?.params?.id;
|
|
132
|
+
},
|
|
133
|
+
onHeaderClick: onSort,
|
|
134
|
+
onNeedMoreData: onNeedMoreData,
|
|
135
|
+
onRowClick: (_e, rowData) => {
|
|
136
|
+
history.push(`${path}/${rowData?.id}${location?.search}`);
|
|
137
|
+
},
|
|
138
|
+
pagingType: "click",
|
|
139
|
+
sortDirection: sortOrder.startsWith('-') ? 'descending' : 'ascending',
|
|
140
|
+
sortOrder: sortOrder.replace(/^-/, '').replace(/,.*/, ''),
|
|
141
|
+
totalCount: data.totalRecords,
|
|
142
|
+
virtualize: true,
|
|
143
|
+
visibleColumns: visibleColumns,
|
|
144
|
+
...mclProps
|
|
145
|
+
});
|
|
146
|
+
const Body = RenderBody ?? TableBody;
|
|
224
147
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_smartComponents.PersistedPaneset, {
|
|
225
148
|
appId: namespace,
|
|
226
|
-
id:
|
|
149
|
+
id: `${id}-paneset`,
|
|
227
150
|
children: [filterPaneVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
|
|
228
151
|
defaultWidth: "20%",
|
|
229
152
|
lastMenu: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PaneMenu, {
|
|
230
153
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, {
|
|
231
154
|
icon: "caret-left",
|
|
232
|
-
onClick:
|
|
233
|
-
return setFilterPaneVisible(false);
|
|
234
|
-
}
|
|
155
|
+
onClick: () => setFilterPaneVisible(false)
|
|
235
156
|
})
|
|
236
157
|
}),
|
|
237
158
|
paneTitle: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
@@ -276,37 +197,30 @@ var SASQLookupComponent = function SASQLookupComponent(_ref) {
|
|
|
276
197
|
searchValue: searchValue
|
|
277
198
|
})]
|
|
278
199
|
})
|
|
279
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane,
|
|
200
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Pane, {
|
|
280
201
|
defaultWidth: "fill",
|
|
281
202
|
firstMenu: !filterPaneVisible ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PaneMenu, {
|
|
282
203
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, {
|
|
283
204
|
badgeCount: filterCount,
|
|
284
205
|
icon: "caret-right",
|
|
285
|
-
onClick:
|
|
286
|
-
return setFilterPaneVisible(true);
|
|
287
|
-
}
|
|
206
|
+
onClick: () => setFilterPaneVisible(true)
|
|
288
207
|
})
|
|
289
208
|
}) : null,
|
|
290
209
|
paneSub: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
291
210
|
id: "stripes-kint-components.sasqLookupComponent.mainPane.found",
|
|
292
211
|
values: {
|
|
293
|
-
total: data
|
|
212
|
+
total: data?.total
|
|
294
213
|
}
|
|
295
|
-
})
|
|
296
|
-
|
|
214
|
+
}),
|
|
215
|
+
...mainPaneProps,
|
|
297
216
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Body, {
|
|
298
217
|
data: data
|
|
299
218
|
})
|
|
300
|
-
})
|
|
219
|
+
}), children]
|
|
301
220
|
});
|
|
302
221
|
}
|
|
303
|
-
})
|
|
222
|
+
});
|
|
304
223
|
};
|
|
305
|
-
|
|
306
|
-
__signature__(SASQLookupComponent, "useKiwtSASQuery{{ query, queryGetter, querySetter }}\nuseNamespace{{ 0: namespace }}\nuseOkapiKy{ky}\nuseLocalStorageState{[filterPaneVisible, setFilterPaneVisible]}\nuseInfiniteQuery{{\n data: totalData = {},\n error,\n isError,\n isLoading,\n fetchNextPage,\n }}", function () {
|
|
307
|
-
return [_hooks.useKiwtSASQuery, _core.useNamespace, _core.useOkapiKy, _hooks.useLocalStorageState, _reactQuery.useInfiniteQuery];
|
|
308
|
-
});
|
|
309
|
-
|
|
310
224
|
SASQLookupComponent.propTypes = {
|
|
311
225
|
children: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]),
|
|
312
226
|
fetchParameters: _propTypes.default.object,
|
|
@@ -325,25 +239,4 @@ SASQLookupComponent.propTypes = {
|
|
|
325
239
|
resultColumns: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
326
240
|
sasqProps: _propTypes.default.object
|
|
327
241
|
};
|
|
328
|
-
var _default = SASQLookupComponent;
|
|
329
|
-
var _default2 = _default;
|
|
330
|
-
exports.default = _default2;
|
|
331
|
-
;
|
|
332
|
-
|
|
333
|
-
(function () {
|
|
334
|
-
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
335
|
-
|
|
336
|
-
if (!reactHotLoader) {
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
reactHotLoader.register(SASQLookupComponent, "SASQLookupComponent", "/home/ethan/FolioModules/stripes-kint-components/src/lib/SASQLookupComponent/SASQLookupComponent.js");
|
|
341
|
-
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/SASQLookupComponent/SASQLookupComponent.js");
|
|
342
|
-
})();
|
|
343
|
-
|
|
344
|
-
;
|
|
345
|
-
|
|
346
|
-
(function () {
|
|
347
|
-
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
348
|
-
leaveModule && leaveModule(module);
|
|
349
|
-
})();
|
|
242
|
+
var _default = exports.default = SASQLookupComponent;
|
|
@@ -5,15 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "default", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
8
|
+
get: function () {
|
|
9
9
|
return _SASQLookupComponent.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
var _SASQLookupComponent = _interopRequireDefault(require("./SASQLookupComponent"));
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
|
-
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -4,104 +4,55 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _reactRouterDom = require("react-router-dom");
|
|
13
|
-
|
|
14
10
|
var _SASQLookupComponent = _interopRequireDefault(require("../SASQLookupComponent"));
|
|
15
|
-
|
|
16
11
|
var _SASQViewComponent = _interopRequireDefault(require("../SASQViewComponent"));
|
|
17
|
-
|
|
18
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
|
|
20
|
-
var _excluded = ["path", "fetchParameters"];
|
|
21
|
-
|
|
22
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
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; }
|
|
30
|
-
|
|
31
|
-
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; }
|
|
32
|
-
|
|
33
|
-
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; }
|
|
34
|
-
|
|
35
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
36
|
-
|
|
37
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
38
|
-
|
|
39
|
-
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
40
|
-
return a;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
var SASQRoute = function SASQRoute(_ref) {
|
|
44
|
-
var path = _ref.path,
|
|
45
|
-
fetchParameters = _ref.fetchParameters,
|
|
46
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
47
|
-
|
|
14
|
+
const SASQRoute = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
path,
|
|
17
|
+
fetchParameters,
|
|
18
|
+
...props
|
|
19
|
+
} = _ref;
|
|
48
20
|
// Grab the SASQ_MAP and tweak it
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
21
|
+
const {
|
|
22
|
+
SASQ_MAP = {}
|
|
23
|
+
} = fetchParameters;
|
|
52
24
|
if (!SASQ_MAP.perPage) {
|
|
53
25
|
SASQ_MAP.perPage = 25;
|
|
54
26
|
}
|
|
27
|
+
SASQ_MAP.stats = true;
|
|
55
28
|
|
|
56
|
-
|
|
57
|
-
|
|
29
|
+
// Reinsert the SASQ_MAP
|
|
58
30
|
fetchParameters.SASQ_MAP = SASQ_MAP;
|
|
59
31
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
60
|
-
path:
|
|
61
|
-
render:
|
|
62
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQLookupComponent.default,
|
|
32
|
+
path: `${path}/:id?`,
|
|
33
|
+
render: routeProps => {
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQLookupComponent.default, {
|
|
35
|
+
...routeProps,
|
|
63
36
|
fetchParameters: fetchParameters,
|
|
64
|
-
path: path
|
|
65
|
-
|
|
37
|
+
path: path,
|
|
38
|
+
...props,
|
|
66
39
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
|
|
67
|
-
path:
|
|
68
|
-
render:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
40
|
+
path: `${path}/:id`,
|
|
41
|
+
render: innerProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_SASQViewComponent.default, {
|
|
42
|
+
...innerProps,
|
|
43
|
+
fetchParameters: fetchParameters,
|
|
44
|
+
path: path,
|
|
45
|
+
ViewComponent: props.ViewComponent,
|
|
46
|
+
...props
|
|
47
|
+
})
|
|
75
48
|
})
|
|
76
|
-
})
|
|
49
|
+
});
|
|
77
50
|
}
|
|
78
51
|
});
|
|
79
52
|
};
|
|
80
|
-
|
|
81
53
|
SASQRoute.propTypes = {
|
|
82
54
|
fetchParameters: _propTypes.default.object,
|
|
83
55
|
path: _propTypes.default.string,
|
|
84
56
|
ViewComponent: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node])
|
|
85
57
|
};
|
|
86
|
-
var _default = SASQRoute;
|
|
87
|
-
var _default2 = _default;
|
|
88
|
-
exports.default = _default2;
|
|
89
|
-
;
|
|
90
|
-
|
|
91
|
-
(function () {
|
|
92
|
-
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
93
|
-
|
|
94
|
-
if (!reactHotLoader) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
reactHotLoader.register(SASQRoute, "SASQRoute", "/home/ethan/FolioModules/stripes-kint-components/src/lib/SASQRoute/SASQRoute.js");
|
|
99
|
-
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/SASQRoute/SASQRoute.js");
|
|
100
|
-
})();
|
|
101
|
-
|
|
102
|
-
;
|
|
103
|
-
|
|
104
|
-
(function () {
|
|
105
|
-
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
106
|
-
leaveModule && leaveModule(module);
|
|
107
|
-
})();
|
|
58
|
+
var _default = exports.default = SASQRoute;
|
|
@@ -5,15 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
Object.defineProperty(exports, "default", {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: function
|
|
8
|
+
get: function () {
|
|
9
9
|
return _SASQRoute.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
var _SASQRoute = _interopRequireDefault(require("./SASQRoute"));
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
|
-
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|