@k-int/stripes-kint-components 2.2.0 → 2.3.2
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 +29 -0
- package/es/index.js +125 -9
- package/es/lib/ActionList/ActionList.js +8 -33
- package/es/lib/ActionList/ActionListFieldArray.js +50 -49
- package/es/lib/ActionList/index.js +1 -5
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +1 -35
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +3 -39
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +1 -34
- package/es/lib/CustomProperties/Config/{CustomPropertiesView.js → CustomPropertyView.js} +4 -33
- package/es/lib/CustomProperties/Config/index.js +7 -9
- package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +43 -0
- package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +100 -0
- package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +243 -0
- package/es/lib/CustomProperties/Edit/CustomPropertyField.js +337 -0
- package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +127 -0
- package/es/lib/CustomProperties/Edit/index.js +47 -0
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +183 -0
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +204 -0
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +126 -0
- package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +90 -0
- package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +139 -0
- package/es/lib/CustomProperties/Filter/index.js +55 -0
- package/es/lib/CustomProperties/Filter/useOperators.js +100 -0
- package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +64 -0
- package/es/lib/CustomProperties/Filter/useValueProps.js +67 -0
- package/es/lib/CustomProperties/View/CustomPropertiesView.js +44 -0
- package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +155 -0
- package/es/lib/CustomProperties/View/CustomPropertyCard.js +175 -0
- package/es/lib/CustomProperties/View/index.js +31 -0
- package/es/lib/CustomProperties/index.js +121 -0
- package/es/lib/EditableRefdataList/EditableRefdataList.js +13 -51
- package/es/lib/EditableRefdataList/index.js +1 -5
- package/es/lib/EditableSettingsList/EditableSettingsList.js +1 -30
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +1 -30
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.test.js +1 -30
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +1 -34
- package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +1 -34
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +1 -34
- package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +1 -41
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +1 -34
- package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +1 -30
- package/es/lib/EditableSettingsList/SettingField/index.js +1 -5
- package/es/lib/EditableSettingsList/index.js +1 -5
- package/es/lib/FormModal/FormModal.js +21 -34
- package/es/lib/FormModal/index.js +1 -5
- package/es/lib/NoResultsMessage/NoResultsMessage.js +1 -30
- package/es/lib/NoResultsMessage/index.js +1 -5
- package/es/lib/QueryTypedown/QueryTypedown.js +9 -37
- package/es/lib/QueryTypedown/index.js +1 -5
- package/es/lib/RefdataButtons/RefdataButtons.js +1 -34
- package/es/lib/RefdataButtons/index.js +1 -5
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +1 -34
- package/es/lib/SASQLookupComponent/index.js +1 -5
- package/es/lib/SASQRoute/SASQRoute.js +1 -30
- package/es/lib/SASQRoute/index.js +1 -5
- package/es/lib/SASQViewComponent/SASQViewComponent.js +1 -34
- package/es/lib/SASQViewComponent/index.js +1 -5
- package/es/lib/SearchField/SearchField.js +1 -31
- package/es/lib/SearchField/index.js +1 -5
- package/es/lib/SettingPage/SettingPage.js +1 -34
- package/es/lib/SettingPage/SettingPagePane.js +1 -32
- package/es/lib/SettingPage/index.js +1 -5
- package/es/lib/Typedown/Typedown.js +1 -34
- package/es/lib/Typedown/index.js +1 -5
- package/es/lib/constants/customProperties.js +3 -37
- package/es/lib/constants/eventCodes.js +1 -31
- package/es/lib/contexts/SettingsContext.js +1 -30
- package/es/lib/contexts/index.js +1 -5
- package/es/lib/hooks/index.js +16 -4
- package/es/lib/hooks/settingsHooks/index.js +1 -5
- package/es/lib/hooks/settingsHooks/useSettingSection.js +1 -34
- package/es/lib/hooks/settingsHooks/useSettings.js +1 -36
- package/es/lib/hooks/typedownHooks/index.js +1 -5
- package/es/lib/hooks/typedownHooks/useTypedown.js +1 -34
- package/es/lib/hooks/typedownHooks/useTypedownData.js +9 -35
- package/es/lib/hooks/typedownHooks/useTypedownToggle.js +1 -34
- package/es/lib/hooks/useActiveElement.js +1 -32
- package/es/lib/hooks/useAvailableCustomProperties.js +73 -0
- package/es/lib/hooks/useCustomProperties.js +1 -34
- package/es/lib/hooks/useHelperApp.js +1 -34
- package/es/lib/hooks/useInvalidateRefdata.js +20 -0
- package/es/lib/hooks/useKiwtFieldArray.js +1 -34
- package/es/lib/hooks/useKiwtSASQuery.js +1 -35
- package/es/lib/hooks/useLocalStorageState.js +1 -34
- package/es/lib/hooks/useMutateCustomProperties.js +1 -34
- package/es/lib/hooks/useMutateRefdataValue.js +10 -38
- package/es/lib/hooks/useQIndex.js +1 -34
- package/es/lib/hooks/useRefdata.js +2 -37
- package/es/lib/hooks/useTemplates.js +1 -34
- package/es/lib/utils/buildUrl.js +2 -31
- package/es/lib/utils/generateKiwtQuery.js +1 -30
- package/es/lib/utils/generateKiwtQueryParams.js +1 -30
- package/es/lib/utils/groupCustomPropertiesByCtx.js +41 -0
- package/es/lib/utils/index.js +25 -5
- package/es/lib/utils/refdataOptions.js +1 -30
- package/es/lib/utils/refdataQueryKey.js +19 -0
- package/es/lib/utils/renderHelpText.js +1 -30
- package/es/lib/utils/selectorSafe.js +1 -30
- package/es/lib/utils/sortByLabel.js +1 -30
- package/es/lib/utils/toCamelCase.js +1 -30
- package/es/lib/utils/typedownQueryKey.js +19 -0
- package/es/lib/utils/validators.js +59 -31
- package/git_translate.sh +8 -0
- package/package.json +1 -1
- package/src/index.js +27 -3
- package/src/lib/ActionList/ActionList.js +5 -2
- package/src/lib/ActionList/ActionListFieldArray.js +31 -9
- package/src/lib/ActionList/README.md +23 -20
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +2 -2
- package/src/lib/CustomProperties/Config/{CustomPropertiesView.js → CustomPropertyView.js} +3 -3
- package/src/lib/CustomProperties/Config/index.js +1 -1
- package/src/lib/CustomProperties/Edit/CustomPropertiesEdit.js +35 -0
- package/src/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +85 -0
- package/src/lib/CustomProperties/Edit/CustomPropertiesListField.js +194 -0
- package/src/lib/CustomProperties/Edit/CustomPropertyField.js +299 -0
- package/src/lib/CustomProperties/Edit/CustomPropertyFormCard.js +131 -0
- package/src/lib/CustomProperties/Edit/index.js +5 -0
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilter.js +125 -0
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +148 -0
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +113 -0
- package/src/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +74 -0
- package/src/lib/CustomProperties/Filter/CustomPropertiesRule.js +122 -0
- package/src/lib/CustomProperties/Filter/index.js +6 -0
- package/src/lib/CustomProperties/Filter/useOperators.js +55 -0
- package/src/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +35 -0
- package/src/lib/CustomProperties/Filter/useValueProps.js +45 -0
- package/src/lib/CustomProperties/View/CustomPropertiesView.js +36 -0
- package/src/lib/CustomProperties/View/CustomPropertiesViewCtx.js +112 -0
- package/src/lib/CustomProperties/View/CustomPropertyCard.js +177 -0
- package/src/lib/CustomProperties/View/index.js +3 -0
- package/src/lib/CustomProperties/index.js +30 -0
- package/src/lib/EditableRefdataList/EditableRefdataList.js +13 -10
- package/src/lib/FormModal/FormModal.js +39 -17
- package/src/lib/QueryTypedown/QueryTypedown.js +3 -1
- package/src/lib/constants/customProperties.js +1 -0
- package/src/lib/hooks/index.js +2 -0
- package/src/lib/hooks/typedownHooks/useTypedownData.js +9 -3
- package/src/lib/hooks/useAvailableCustomProperties.js +40 -0
- package/src/lib/hooks/useInvalidateRefdata.js +11 -0
- package/src/lib/hooks/useMutateRefdataValue.js +7 -3
- package/src/lib/hooks/useRefdata.js +2 -3
- package/src/lib/utils/groupCustomPropertiesByCtx.js +13 -0
- package/src/lib/utils/index.js +5 -0
- package/src/lib/utils/refdataQueryKey.js +9 -0
- package/src/lib/utils/typedownQueryKey.js +9 -0
- package/src/lib/utils/validators.js +40 -0
- package/translate.sh +63 -0
- package/translations/stripes-kint-components/ar.json +105 -0
- package/translations/stripes-kint-components/ca.json +1 -0
- package/translations/stripes-kint-components/cs_CZ.json +105 -0
- package/translations/stripes-kint-components/da.json +1 -0
- package/translations/stripes-kint-components/de.json +105 -0
- package/translations/stripes-kint-components/en.json +54 -2
- package/translations/stripes-kint-components/es.json +105 -0
- package/translations/stripes-kint-components/fr.json +105 -0
- package/translations/stripes-kint-components/he.json +1 -0
- package/translations/stripes-kint-components/hi_IN.json +105 -0
- package/translations/stripes-kint-components/hu.json +105 -0
- package/translations/stripes-kint-components/it_IT.json +105 -0
- package/translations/stripes-kint-components/ja.json +105 -0
- package/translations/stripes-kint-components/ko.json +105 -0
- package/translations/stripes-kint-components/nb.json +1 -0
- package/translations/stripes-kint-components/nn.json +1 -0
- package/translations/stripes-kint-components/pl.json +105 -0
- package/translations/stripes-kint-components/pt_PT.json +105 -0
- package/translations/stripes-kint-components/ru.json +105 -0
- package/translations/stripes-kint-components/sv.json +105 -0
- package/translations/stripes-kint-components/ur.json +1 -0
- package/translations/stripes-kint-components/zh_CN.json +105 -0
- 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 -286
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +0 -925
- 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/CustomProperties/Config/CustomPropertiesLookup.js.html +0 -418
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesSettings.js.html +0 -808
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesView.js.html +0 -601
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +0 -1135
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.html +0 -176
- package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.js.html +0 -97
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +0 -373
- 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/FormModal/FormModal.js.html +0 -283
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.html +0 -131
- package/src/artifacts/coverage-jest/lcov-report/FormModal/index.js.html +0 -88
- 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 -301
- 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 -253
- 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 -919
- 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/customProperties.js.html +0 -112
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +0 -94
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +0 -131
- 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 -281
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +0 -121
- 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/useCustomProperties.js.html +0 -313
- 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/useMutateCustomProperties.js.html +0 -271
- 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 -416
- 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 -454
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +0 -251
- 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-report/utils/validators.js.html +0 -202
- package/src/artifacts/coverage-jest/lcov.info +0 -2562
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _reactIntl = require("react-intl");
|
|
13
|
+
|
|
14
|
+
var _components = require("@folio/stripes/components");
|
|
15
|
+
|
|
16
|
+
var _hooks = require("../../hooks");
|
|
17
|
+
|
|
18
|
+
var _useParseActiveFilterStrings = _interopRequireDefault(require("./useParseActiveFilterStrings"));
|
|
19
|
+
|
|
20
|
+
var _CustomPropertiesFilterForm = _interopRequireDefault(require("./CustomPropertiesFilterForm"));
|
|
21
|
+
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
|
|
24
|
+
var _excluded = ["customProperties"];
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
+
|
|
36
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
37
|
+
|
|
38
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
39
|
+
|
|
40
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
41
|
+
|
|
42
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
43
|
+
|
|
44
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
+
|
|
46
|
+
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; }
|
|
47
|
+
|
|
48
|
+
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; }
|
|
49
|
+
|
|
50
|
+
var CustomPropertiesFilter = function CustomPropertiesFilter(_ref) {
|
|
51
|
+
var _parsedFilterData$num3, _labelOverrides$custo2;
|
|
52
|
+
|
|
53
|
+
var _ref$activeFilters = _ref.activeFilters,
|
|
54
|
+
custPropFilters = _ref$activeFilters.customProperties,
|
|
55
|
+
restOfFilters = _objectWithoutProperties(_ref$activeFilters, _excluded),
|
|
56
|
+
customPropertiesEndpoint = _ref.customPropertiesEndpoint,
|
|
57
|
+
filterHandlers = _ref.filterHandlers,
|
|
58
|
+
labelOverrides = _ref.labelOverrides;
|
|
59
|
+
|
|
60
|
+
var _useState = (0, _react.useState)(false),
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
editingFilters = _useState2[0],
|
|
63
|
+
setEditingFilters = _useState2[1];
|
|
64
|
+
|
|
65
|
+
var openEditModal = function openEditModal() {
|
|
66
|
+
return setEditingFilters(true);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
var closeEditModal = function closeEditModal() {
|
|
70
|
+
return setEditingFilters(false);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var _useCustomProperties = (0, _hooks.useCustomProperties)({
|
|
74
|
+
endpoint: customPropertiesEndpoint,
|
|
75
|
+
returnQueryObject: true,
|
|
76
|
+
options: {
|
|
77
|
+
sort: [{
|
|
78
|
+
path: 'ctx'
|
|
79
|
+
}, // Group by ctx
|
|
80
|
+
{
|
|
81
|
+
path: 'retired'
|
|
82
|
+
}, // Place retired custprops at the end
|
|
83
|
+
{
|
|
84
|
+
path: 'label'
|
|
85
|
+
} // Within those groups, sort by label
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
custprops = _useCustomProperties.data,
|
|
90
|
+
isLoading = _useCustomProperties.isLoading;
|
|
91
|
+
|
|
92
|
+
var parsedFilterData = (0, _useParseActiveFilterStrings.default)(custPropFilters || []);
|
|
93
|
+
|
|
94
|
+
var getFiltersApplied = function getFiltersApplied() {
|
|
95
|
+
var _labelOverrides$filte, _parsedFilterData$num2;
|
|
96
|
+
|
|
97
|
+
if (labelOverrides.filtersApplied && typeof labelOverrides.filtersApplied === 'function') {
|
|
98
|
+
var _parsedFilterData$num;
|
|
99
|
+
|
|
100
|
+
return labelOverrides.filtersApplied((_parsedFilterData$num = parsedFilterData === null || parsedFilterData === void 0 ? void 0 : parsedFilterData.numberOfFilters) !== null && _parsedFilterData$num !== void 0 ? _parsedFilterData$num : 0);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return (_labelOverrides$filte = labelOverrides.filtersApplied) !== null && _labelOverrides$filte !== void 0 ? _labelOverrides$filte : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
104
|
+
id: "stripes-kint-components.customProperty.filtersApplied",
|
|
105
|
+
values: {
|
|
106
|
+
count: (_parsedFilterData$num2 = parsedFilterData === null || parsedFilterData === void 0 ? void 0 : parsedFilterData.numberOfFilters) !== null && _parsedFilterData$num2 !== void 0 ? _parsedFilterData$num2 : 0
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
if (isLoading) {
|
|
112
|
+
var _labelOverrides$custo;
|
|
113
|
+
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Accordion, {
|
|
115
|
+
closedByDefault: true,
|
|
116
|
+
header: _components.FilterAccordionHeader,
|
|
117
|
+
id: "clickable-custprop-filter",
|
|
118
|
+
label: (_labelOverrides$custo = labelOverrides.customProperties) !== null && _labelOverrides$custo !== void 0 ? _labelOverrides$custo : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
119
|
+
id: "stripes-kint-components.customProperties"
|
|
120
|
+
}),
|
|
121
|
+
separator: false,
|
|
122
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Spinner, {})
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
var handleSubmit = function handleSubmit(values) {
|
|
127
|
+
var _values$filters = values.filters,
|
|
128
|
+
filters = _values$filters === void 0 ? [] : _values$filters;
|
|
129
|
+
var filterStrings = filters.filter(function (filter) {
|
|
130
|
+
return filter.rules;
|
|
131
|
+
}).map(function (filter) {
|
|
132
|
+
return filter.rules.map(function (rule) {
|
|
133
|
+
var _rule$value;
|
|
134
|
+
|
|
135
|
+
return "customProperties.".concat(filter.customProperty, ".value").concat(rule.operator).concat((_rule$value = rule.value) !== null && _rule$value !== void 0 ? _rule$value : '');
|
|
136
|
+
}).join('||');
|
|
137
|
+
});
|
|
138
|
+
filterHandlers.state(_objectSpread(_objectSpread({}, restOfFilters), {}, {
|
|
139
|
+
customProperties: filterStrings
|
|
140
|
+
}));
|
|
141
|
+
setEditingFilters(false);
|
|
142
|
+
return Promise.resolve();
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Accordion, {
|
|
146
|
+
closedByDefault: true,
|
|
147
|
+
displayClearButton: ((_parsedFilterData$num3 = parsedFilterData === null || parsedFilterData === void 0 ? void 0 : parsedFilterData.numberOfFilters) !== null && _parsedFilterData$num3 !== void 0 ? _parsedFilterData$num3 : 0) > 0,
|
|
148
|
+
header: _components.FilterAccordionHeader,
|
|
149
|
+
id: "clickable-custprop-filter",
|
|
150
|
+
label: (_labelOverrides$custo2 = labelOverrides.customProperties) !== null && _labelOverrides$custo2 !== void 0 ? _labelOverrides$custo2 : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
151
|
+
id: "stripes-kint-components.customProperties"
|
|
152
|
+
}),
|
|
153
|
+
onClearFilter: function onClearFilter() {
|
|
154
|
+
return filterHandlers.state(_objectSpread(_objectSpread({}, restOfFilters), {}, {
|
|
155
|
+
customProperties: []
|
|
156
|
+
}));
|
|
157
|
+
},
|
|
158
|
+
separator: false,
|
|
159
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Layout, {
|
|
160
|
+
className: "padding-bottom-gutter",
|
|
161
|
+
children: getFiltersApplied()
|
|
162
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesFilterForm.default, {
|
|
163
|
+
customProperties: custprops,
|
|
164
|
+
editingFilters: editingFilters,
|
|
165
|
+
filters: parsedFilterData === null || parsedFilterData === void 0 ? void 0 : parsedFilterData.filters,
|
|
166
|
+
handlers: {
|
|
167
|
+
closeEditModal: closeEditModal,
|
|
168
|
+
openEditModal: openEditModal
|
|
169
|
+
},
|
|
170
|
+
labelOverrides: labelOverrides,
|
|
171
|
+
onSubmit: handleSubmit
|
|
172
|
+
})]
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
CustomPropertiesFilter.propTypes = {
|
|
177
|
+
activeFilters: _propTypes.default.object,
|
|
178
|
+
customPropertiesEndpoint: _propTypes.default.string,
|
|
179
|
+
filterHandlers: _propTypes.default.object,
|
|
180
|
+
labelOverrides: _propTypes.default.object
|
|
181
|
+
};
|
|
182
|
+
var _default = CustomPropertiesFilter;
|
|
183
|
+
exports.default = _default;
|
|
@@ -0,0 +1,204 @@
|
|
|
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 _reactIntl = require("react-intl");
|
|
11
|
+
|
|
12
|
+
var _reactFinalForm = require("react-final-form");
|
|
13
|
+
|
|
14
|
+
var _reactFinalFormArrays = require("react-final-form-arrays");
|
|
15
|
+
|
|
16
|
+
var _components = require("@folio/stripes/components");
|
|
17
|
+
|
|
18
|
+
var _utils = require("../../utils");
|
|
19
|
+
|
|
20
|
+
var _validators = require("../../utils/validators");
|
|
21
|
+
|
|
22
|
+
var _CustomPropertiesRule = _interopRequireDefault(require("./CustomPropertiesRule"));
|
|
23
|
+
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
+
|
|
36
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
37
|
+
|
|
38
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
39
|
+
|
|
40
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
41
|
+
|
|
42
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
43
|
+
|
|
44
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
+
|
|
46
|
+
var CustomPropertiesFilterField = function CustomPropertiesFilterField(_ref) {
|
|
47
|
+
var _labelOverrides$custo, _customProperties$fin, _customProperties$fin2, _fields$value$index2;
|
|
48
|
+
|
|
49
|
+
var _ref$customProperties = _ref.customProperties,
|
|
50
|
+
customProperties = _ref$customProperties === void 0 ? [] : _ref$customProperties,
|
|
51
|
+
fields = _ref.fields,
|
|
52
|
+
index = _ref.index,
|
|
53
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
54
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
55
|
+
name = _ref.name;
|
|
56
|
+
var groupedCustomProperties = (0, _utils.groupCustomPropertiesByCtx)(customProperties);
|
|
57
|
+
|
|
58
|
+
var _useForm = (0, _reactFinalForm.useForm)(),
|
|
59
|
+
change = _useForm.change,
|
|
60
|
+
push = _useForm.mutators.push;
|
|
61
|
+
|
|
62
|
+
var _useFormState = (0, _reactFinalForm.useFormState)(),
|
|
63
|
+
values = _useFormState.values; // Deal with all the possible label override options
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
var getRetiredName = function getRetiredName(customProperty) {
|
|
67
|
+
var _labelOverrides$retir;
|
|
68
|
+
|
|
69
|
+
// Label override for default card title,
|
|
70
|
+
if (labelOverrides.retiredName && typeof labelOverrides.retiredName === 'function') {
|
|
71
|
+
return labelOverrides.retiredName(customProperty.label);
|
|
72
|
+
} // Label override for default title or finally built in default
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
return (_labelOverrides$retir = labelOverrides.retiredName) !== null && _labelOverrides$retir !== void 0 ? _labelOverrides$retir : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
76
|
+
id: "stripes-kint-components.customProperty.retiredName",
|
|
77
|
+
values: {
|
|
78
|
+
name: customProperty.label
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
84
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, {
|
|
85
|
+
id: "input-custprop-".concat(index),
|
|
86
|
+
label: (_labelOverrides$custo = labelOverrides.customProperty) !== null && _labelOverrides$custo !== void 0 ? _labelOverrides$custo : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
87
|
+
id: "stripes-kint-components.customProperty"
|
|
88
|
+
}),
|
|
89
|
+
name: "".concat(name, ".customProperty"),
|
|
90
|
+
placeholder: " ",
|
|
91
|
+
render: function render(fieldProps) {
|
|
92
|
+
var _Object$entries;
|
|
93
|
+
|
|
94
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Select, _objectSpread(_objectSpread({}, fieldProps), {}, {
|
|
95
|
+
placeholder: null // placeholder default causes issues
|
|
96
|
+
,
|
|
97
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
98
|
+
value: "",
|
|
99
|
+
children: " "
|
|
100
|
+
}), (_Object$entries = Object.entries(groupedCustomProperties)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.sort(function (a, b) {
|
|
101
|
+
if (a[0] === 'isNull') return -1; // Make sure noContext is at top
|
|
102
|
+
|
|
103
|
+
if (a[0].toLowerCase() < b[0].toLowerCase()) return -1;
|
|
104
|
+
if (a[0].toLowerCase() > b[0].toLowerCase()) return 1;
|
|
105
|
+
return 0;
|
|
106
|
+
}).map(function (_ref2) {
|
|
107
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
108
|
+
key = _ref3[0],
|
|
109
|
+
value = _ref3[1];
|
|
110
|
+
|
|
111
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("optgroup", {
|
|
112
|
+
label: key === 'isNull' ? '-' : key,
|
|
113
|
+
children: value.map(function (v) {
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
115
|
+
value: v.name,
|
|
116
|
+
children: v.retired ? getRetiredName(v) : v.label
|
|
117
|
+
}, v.id);
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
})]
|
|
121
|
+
}));
|
|
122
|
+
},
|
|
123
|
+
required: true,
|
|
124
|
+
validate: _validators.required
|
|
125
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
126
|
+
id: "selected-custprop-name-".concat(index),
|
|
127
|
+
style: {
|
|
128
|
+
display: 'none'
|
|
129
|
+
},
|
|
130
|
+
children: (_customProperties$fin = (_customProperties$fin2 = customProperties.find(function (t) {
|
|
131
|
+
var _fields$value$index;
|
|
132
|
+
|
|
133
|
+
return t.name === ((_fields$value$index = fields.value[index]) === null || _fields$value$index === void 0 ? void 0 : _fields$value$index.customProperty);
|
|
134
|
+
})) === null || _customProperties$fin2 === void 0 ? void 0 : _customProperties$fin2.label) !== null && _customProperties$fin !== void 0 ? _customProperties$fin : ''
|
|
135
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Row, {
|
|
136
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
137
|
+
xs: 2
|
|
138
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
139
|
+
xs: 4,
|
|
140
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Label, {
|
|
141
|
+
id: "rule-column-header-comparator",
|
|
142
|
+
required: true,
|
|
143
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
144
|
+
id: "stripes-erm-components.customProperty.filters.comparator"
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
148
|
+
xs: 4,
|
|
149
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Label, {
|
|
150
|
+
id: "rule-column-header-value",
|
|
151
|
+
required: true,
|
|
152
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
153
|
+
id: "stripes-erm-components.customProperty.filters.value"
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Col, {
|
|
157
|
+
xs: 2
|
|
158
|
+
})]
|
|
159
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, {
|
|
160
|
+
name: "".concat(name, ".rules"),
|
|
161
|
+
children: function children(_ref4) {
|
|
162
|
+
var ruleFields = _ref4.fields;
|
|
163
|
+
return ruleFields.map(function (ruleFieldName, ruleFieldIndex) {
|
|
164
|
+
var _values$filters$index;
|
|
165
|
+
|
|
166
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesRule.default, {
|
|
167
|
+
ariaLabelledby: "selected-custprop-name-".concat(index),
|
|
168
|
+
clearRuleValue: function clearRuleValue() {
|
|
169
|
+
return change("filters[".concat(index, "].rules[").concat(ruleFieldIndex, "].value"), '');
|
|
170
|
+
},
|
|
171
|
+
custPropDefinition: customProperties.find(function (t) {
|
|
172
|
+
return t.name === fields.value[index].customProperty;
|
|
173
|
+
}),
|
|
174
|
+
index: ruleFieldIndex,
|
|
175
|
+
name: ruleFieldName,
|
|
176
|
+
onDelete: function onDelete() {
|
|
177
|
+
return ruleFields.remove(ruleFieldIndex);
|
|
178
|
+
},
|
|
179
|
+
value: (_values$filters$index = values.filters[index]) === null || _values$filters$index === void 0 ? void 0 : _values$filters$index.rules[ruleFieldIndex]
|
|
180
|
+
}, ruleFieldName);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
184
|
+
"data-test-add-rule-btn": true,
|
|
185
|
+
disabled: !((_fields$value$index2 = fields.value[index]) !== null && _fields$value$index2 !== void 0 && _fields$value$index2.customProperty),
|
|
186
|
+
onClick: function onClick() {
|
|
187
|
+
return push("".concat(name, ".rules"));
|
|
188
|
+
},
|
|
189
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
190
|
+
id: "stripes-erm-components.customProperty.filters.addRule"
|
|
191
|
+
})
|
|
192
|
+
})]
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
CustomPropertiesFilterField.propTypes = {
|
|
197
|
+
customProperties: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
198
|
+
fields: _propTypes.default.object,
|
|
199
|
+
index: _propTypes.default.number,
|
|
200
|
+
labelOverrides: _propTypes.default.object,
|
|
201
|
+
name: _propTypes.default.string
|
|
202
|
+
};
|
|
203
|
+
var _default = CustomPropertiesFilterField;
|
|
204
|
+
exports.default = _default;
|
|
@@ -0,0 +1,126 @@
|
|
|
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 _reactIntl = require("react-intl");
|
|
11
|
+
|
|
12
|
+
var _reactFinalForm = require("react-final-form");
|
|
13
|
+
|
|
14
|
+
var _reactFinalFormArrays = require("react-final-form-arrays");
|
|
15
|
+
|
|
16
|
+
var _components = require("@folio/stripes/components");
|
|
17
|
+
|
|
18
|
+
var _CustomPropertiesFilterField = _interopRequireDefault(require("./CustomPropertiesFilterField"));
|
|
19
|
+
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
var CustomPropertiesFilterFieldArray = function CustomPropertiesFilterFieldArray(_ref) {
|
|
25
|
+
var _labelOverrides$addFi;
|
|
26
|
+
|
|
27
|
+
var customProperties = _ref.customProperties,
|
|
28
|
+
labelOverrides = _ref.labelOverrides;
|
|
29
|
+
|
|
30
|
+
var _useForm = (0, _reactFinalForm.useForm)(),
|
|
31
|
+
push = _useForm.mutators.push;
|
|
32
|
+
|
|
33
|
+
var getCardTitle = function getCardTitle(index) {
|
|
34
|
+
var _labelOverrides$custo;
|
|
35
|
+
|
|
36
|
+
if (labelOverrides.customPropertyFilter && typeof labelOverrides.customPropertyFilter === 'function') {
|
|
37
|
+
return labelOverrides.customPropertyFilter(index);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return (_labelOverrides$custo = labelOverrides.customPropertyFilter) !== null && _labelOverrides$custo !== void 0 ? _labelOverrides$custo : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
41
|
+
id: "stripes-kint-components.customProperty.filterIndex",
|
|
42
|
+
values: {
|
|
43
|
+
index: index + 1
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var getTooltipText = function getTooltipText(index) {
|
|
49
|
+
var _labelOverrides$remov;
|
|
50
|
+
|
|
51
|
+
if (labelOverrides.removeFilter && typeof labelOverrides.removeFilter === 'function') {
|
|
52
|
+
return labelOverrides.removeFilter(index);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return (_labelOverrides$remov = labelOverrides.removeFilter) !== null && _labelOverrides$remov !== void 0 ? _labelOverrides$remov : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
56
|
+
id: "stripes-kint-components.customProperty.removeFilter",
|
|
57
|
+
values: {
|
|
58
|
+
number: index + 1
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
64
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalFormArrays.FieldArray, {
|
|
65
|
+
name: "filters",
|
|
66
|
+
children: function children(_ref2) {
|
|
67
|
+
var fields = _ref2.fields;
|
|
68
|
+
return fields.map(function (name, index) {
|
|
69
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
70
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Card, {
|
|
71
|
+
headerEnd: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Tooltip, {
|
|
72
|
+
id: "custom-property-filter-card-delete-[".concat(index, "]-tooltip"),
|
|
73
|
+
text: getTooltipText(index),
|
|
74
|
+
children: function children(_ref3) {
|
|
75
|
+
var ref = _ref3.ref,
|
|
76
|
+
ariaIds = _ref3.ariaIds;
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.IconButton, {
|
|
78
|
+
ref: ref,
|
|
79
|
+
"aria-labelledby": ariaIds.text,
|
|
80
|
+
icon: "trash",
|
|
81
|
+
id: "custom-property-filter-card-delete-[".concat(index, "]"),
|
|
82
|
+
onClick: function onClick() {
|
|
83
|
+
return fields.remove(index);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}),
|
|
88
|
+
headerStart: /*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
89
|
+
children: getCardTitle(index)
|
|
90
|
+
}),
|
|
91
|
+
marginBottom0: index !== fields.length - 1,
|
|
92
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesFilterField.default, {
|
|
93
|
+
customProperties: customProperties,
|
|
94
|
+
fields: fields,
|
|
95
|
+
index: index,
|
|
96
|
+
labelOverrides: labelOverrides,
|
|
97
|
+
name: name
|
|
98
|
+
})
|
|
99
|
+
}, "custom-property-filter-card[".concat(index, "]")), index < fields.value.length - 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Layout, {
|
|
100
|
+
className: "textCentered",
|
|
101
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
102
|
+
id: "stripes-kint-components.AND"
|
|
103
|
+
})
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
109
|
+
onClick: function onClick() {
|
|
110
|
+
return push('filters', {
|
|
111
|
+
rules: [{}]
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
children: (_labelOverrides$addFi = labelOverrides.addFilter) !== null && _labelOverrides$addFi !== void 0 ? _labelOverrides$addFi : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
115
|
+
id: "stripes-kint-components.customProperty.addFilter"
|
|
116
|
+
})
|
|
117
|
+
})]
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
CustomPropertiesFilterFieldArray.propTypes = {
|
|
122
|
+
customProperties: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
123
|
+
labelOverrides: _propTypes.default.object
|
|
124
|
+
};
|
|
125
|
+
var _default = CustomPropertiesFilterFieldArray;
|
|
126
|
+
exports.default = _default;
|
|
@@ -0,0 +1,90 @@
|
|
|
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 _reactIntl = require("react-intl");
|
|
11
|
+
|
|
12
|
+
var _finalFormArrays = _interopRequireDefault(require("final-form-arrays"));
|
|
13
|
+
|
|
14
|
+
var _components = require("@folio/stripes/components");
|
|
15
|
+
|
|
16
|
+
var _FormModal = _interopRequireDefault(require("../../FormModal"));
|
|
17
|
+
|
|
18
|
+
var _CustomPropertiesFilterFieldArray = _interopRequireDefault(require("./CustomPropertiesFilterFieldArray"));
|
|
19
|
+
|
|
20
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
+
|
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
var CustomPropertyFiltersForm = function CustomPropertyFiltersForm(_ref) {
|
|
31
|
+
var _labelOverrides$editC, _labelOverrides$filte;
|
|
32
|
+
|
|
33
|
+
var customProperties = _ref.customProperties,
|
|
34
|
+
editingFilters = _ref.editingFilters,
|
|
35
|
+
filters = _ref.filters,
|
|
36
|
+
_ref$handlers = _ref.handlers,
|
|
37
|
+
closeEditModal = _ref$handlers.closeEditModal,
|
|
38
|
+
openEditModal = _ref$handlers.openEditModal,
|
|
39
|
+
labelOverrides = _ref.labelOverrides,
|
|
40
|
+
onSubmit = _ref.onSubmit;
|
|
41
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
42
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
43
|
+
onClick: openEditModal,
|
|
44
|
+
children: (_labelOverrides$editC = labelOverrides.editCustomPropertyFilters) !== null && _labelOverrides$editC !== void 0 ? _labelOverrides$editC : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
45
|
+
id: "stripes-kint-components.customProperty.editCustomPropertyFilters"
|
|
46
|
+
})
|
|
47
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormModal.default, {
|
|
48
|
+
initialValues: {
|
|
49
|
+
filters: filters.length ? filters : [{
|
|
50
|
+
rules: [{}]
|
|
51
|
+
}]
|
|
52
|
+
},
|
|
53
|
+
labelOverrides: {
|
|
54
|
+
save: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
55
|
+
id: "stripes-kint-components.apply"
|
|
56
|
+
})
|
|
57
|
+
},
|
|
58
|
+
modalProps: {
|
|
59
|
+
dismissible: true,
|
|
60
|
+
enforceFocus: false,
|
|
61
|
+
label: (_labelOverrides$filte = labelOverrides.filterBuilder) !== null && _labelOverrides$filte !== void 0 ? _labelOverrides$filte : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
62
|
+
id: "stripes-kint-components.customProperty.filterbuilder"
|
|
63
|
+
}),
|
|
64
|
+
onClose: closeEditModal,
|
|
65
|
+
open: editingFilters,
|
|
66
|
+
size: 'medium'
|
|
67
|
+
},
|
|
68
|
+
mutators: _objectSpread({}, _finalFormArrays.default),
|
|
69
|
+
onSubmit: onSubmit,
|
|
70
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesFilterFieldArray.default, {
|
|
71
|
+
customProperties: customProperties,
|
|
72
|
+
labelOverrides: labelOverrides
|
|
73
|
+
})
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
CustomPropertyFiltersForm.propTypes = {
|
|
79
|
+
customProperties: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
80
|
+
editingFilters: _propTypes.default.bool,
|
|
81
|
+
filters: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
82
|
+
handlers: _propTypes.default.shape({
|
|
83
|
+
closeEditModal: _propTypes.default.func.isRequired,
|
|
84
|
+
openEditModal: _propTypes.default.func.isRequired
|
|
85
|
+
}),
|
|
86
|
+
labelOverrides: _propTypes.default.object,
|
|
87
|
+
onSubmit: _propTypes.default.func.isRequired
|
|
88
|
+
};
|
|
89
|
+
var _default = CustomPropertyFiltersForm;
|
|
90
|
+
exports.default = _default;
|