@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
|
@@ -21,11 +21,6 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
|
-
(function () {
|
|
25
|
-
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
26
|
-
enterModule && enterModule(module);
|
|
27
|
-
})();
|
|
28
|
-
|
|
29
24
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
30
25
|
|
|
31
26
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -46,10 +41,6 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
46
41
|
|
|
47
42
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
48
43
|
|
|
49
|
-
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
50
|
-
return a;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
44
|
var CustomPropertyForm = function CustomPropertyForm(_ref) {
|
|
54
45
|
var _labelOverrides$label, _labelOverrides$name, _labelOverrides$descr, _labelOverrides$ctx, _labelOverrides$weigh, _labelOverrides$prima2, _labelOverrides$retir, _labelOverrides$defau, _labelOverrides$type, _labelOverrides$categ;
|
|
55
46
|
|
|
@@ -370,10 +361,6 @@ var CustomPropertyForm = function CustomPropertyForm(_ref) {
|
|
|
370
361
|
});
|
|
371
362
|
};
|
|
372
363
|
|
|
373
|
-
__signature__(CustomPropertyForm, "useFormState{{ values }}\nuseForm{{ change }}\nuseIntl{intl}\nuseState{[contextOptions, setContextOptions](contextFilterOptions?.filter(ctx => ctx.value !== '' && ctx?.value !== 'isNull'))}", function () {
|
|
374
|
-
return [_reactFinalForm.useFormState, _reactFinalForm.useForm, _reactIntl.useIntl];
|
|
375
|
-
});
|
|
376
|
-
|
|
377
364
|
CustomPropertyForm.propTypes = {
|
|
378
365
|
contextFilterOptions: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
379
366
|
helpPopovers: _propTypes.default.object,
|
|
@@ -381,24 +368,4 @@ CustomPropertyForm.propTypes = {
|
|
|
381
368
|
refdata: _propTypes.default.arrayOf(_propTypes.default.object)
|
|
382
369
|
};
|
|
383
370
|
var _default = CustomPropertyForm;
|
|
384
|
-
|
|
385
|
-
exports.default = _default2;
|
|
386
|
-
;
|
|
387
|
-
|
|
388
|
-
(function () {
|
|
389
|
-
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
390
|
-
|
|
391
|
-
if (!reactHotLoader) {
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
reactHotLoader.register(CustomPropertyForm, "CustomPropertyForm", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertyForm.js");
|
|
396
|
-
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertyForm.js");
|
|
397
|
-
})();
|
|
398
|
-
|
|
399
|
-
;
|
|
400
|
-
|
|
401
|
-
(function () {
|
|
402
|
-
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
403
|
-
leaveModule && leaveModule(module);
|
|
404
|
-
})();
|
|
371
|
+
exports.default = _default;
|
|
@@ -17,17 +17,8 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
|
-
(function () {
|
|
21
|
-
var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
|
|
22
|
-
enterModule && enterModule(module);
|
|
23
|
-
})();
|
|
24
|
-
|
|
25
|
-
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
26
|
-
return a;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
20
|
// A default option for CustProp view pane, with the ability to override labels for fields
|
|
30
|
-
var
|
|
21
|
+
var CustomPropertyView = function CustomPropertyView(_ref) {
|
|
31
22
|
var _labelOverrides$label, _labelOverrides$name, _labelOverrides$descr, _labelOverrides$prima, _labelOverrides$retir, _labelOverrides$weigh, _labelOverrides$defau, _labelOverrides$ctx, _customProperty$ctx, _labelOverrides$type, _labelOverrides$categ, _customProperty$categ, _customProperty$categ2;
|
|
32
23
|
|
|
33
24
|
var customProperty = _ref.customProperty,
|
|
@@ -137,7 +128,7 @@ var CustomPropertiesView = function CustomPropertiesView(_ref) {
|
|
|
137
128
|
});
|
|
138
129
|
};
|
|
139
130
|
|
|
140
|
-
|
|
131
|
+
CustomPropertyView.propTypes = {
|
|
141
132
|
customProperty: _propTypes.default.shape({
|
|
142
133
|
id: _propTypes.default.string,
|
|
143
134
|
label: _propTypes.default.string,
|
|
@@ -155,25 +146,5 @@ CustomPropertiesView.propTypes = {
|
|
|
155
146
|
}),
|
|
156
147
|
labelOverrides: _propTypes.default.object
|
|
157
148
|
};
|
|
158
|
-
var _default =
|
|
159
|
-
|
|
160
|
-
exports.default = _default2;
|
|
161
|
-
;
|
|
162
|
-
|
|
163
|
-
(function () {
|
|
164
|
-
var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
|
|
165
|
-
|
|
166
|
-
if (!reactHotLoader) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
reactHotLoader.register(CustomPropertiesView, "CustomPropertiesView", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertiesView.js");
|
|
171
|
-
reactHotLoader.register(_default, "default", "/home/ethan/FolioModules/stripes-kint-components/src/lib/CustomProperties/Config/CustomPropertiesView.js");
|
|
172
|
-
})();
|
|
173
|
-
|
|
174
|
-
;
|
|
175
|
-
|
|
176
|
-
(function () {
|
|
177
|
-
var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
|
|
178
|
-
leaveModule && leaveModule(module);
|
|
179
|
-
})();
|
|
149
|
+
var _default = CustomPropertyView;
|
|
150
|
+
exports.default = _default;
|
|
@@ -15,27 +15,25 @@ Object.defineProperty(exports, "CustomPropertiesSettings", {
|
|
|
15
15
|
return _CustomPropertiesSettings.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "CustomPropertyForm", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function get() {
|
|
21
|
-
return
|
|
21
|
+
return _CustomPropertyForm.default;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "CustomPropertyView", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function get() {
|
|
27
|
-
return
|
|
27
|
+
return _CustomPropertyView.default;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
var _CustomPropertiesLookup = _interopRequireDefault(require("./CustomPropertiesLookup"));
|
|
32
32
|
|
|
33
|
+
var _CustomPropertyView = _interopRequireDefault(require("./CustomPropertyView"));
|
|
34
|
+
|
|
33
35
|
var _CustomPropertiesSettings = _interopRequireDefault(require("./CustomPropertiesSettings"));
|
|
34
36
|
|
|
35
37
|
var _CustomPropertyForm = _interopRequireDefault(require("./CustomPropertyForm"));
|
|
36
38
|
|
|
37
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
38
|
-
|
|
39
|
-
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
|
|
40
|
-
return a;
|
|
41
|
-
};
|
|
39
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,43 @@
|
|
|
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 _CustomPropertiesEditCtx = _interopRequireDefault(require("./CustomPropertiesEditCtx"));
|
|
11
|
+
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
var CustomPropertiesEdit = function CustomPropertiesEdit(_ref) {
|
|
17
|
+
var _ref$contexts = _ref.contexts,
|
|
18
|
+
contexts = _ref$contexts === void 0 ? [] : _ref$contexts,
|
|
19
|
+
customPropertiesEndpoint = _ref.customPropertiesEndpoint,
|
|
20
|
+
id = _ref.id,
|
|
21
|
+
_ref$labelOverrides = _ref.labelOverrides,
|
|
22
|
+
labelOverrides = _ref$labelOverrides === void 0 ? {} : _ref$labelOverrides,
|
|
23
|
+
nameOverride = _ref.nameOverride;
|
|
24
|
+
return contexts.map(function (ctx) {
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesEditCtx.default, {
|
|
26
|
+
ctx: ctx,
|
|
27
|
+
customPropertiesEndpoint: customPropertiesEndpoint,
|
|
28
|
+
id: id,
|
|
29
|
+
labelOverrides: labelOverrides,
|
|
30
|
+
nameOverride: nameOverride
|
|
31
|
+
}, "customPropertiesEdit-".concat(ctx));
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
CustomPropertiesEdit.propTypes = {
|
|
36
|
+
contexts: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
37
|
+
customPropertiesEndpoint: _propTypes.default.string,
|
|
38
|
+
id: _propTypes.default.string,
|
|
39
|
+
labelOverrides: _propTypes.default.object,
|
|
40
|
+
nameOverride: _propTypes.default.string
|
|
41
|
+
};
|
|
42
|
+
var _default = CustomPropertiesEdit;
|
|
43
|
+
exports.default = _default;
|
|
@@ -0,0 +1,100 @@
|
|
|
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 _components = require("@folio/stripes/components");
|
|
13
|
+
|
|
14
|
+
var _CustomPropertiesListField = _interopRequireDefault(require("./CustomPropertiesListField"));
|
|
15
|
+
|
|
16
|
+
var _hooks = require("../../hooks");
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
var CustomPropertiesEditCtx = function CustomPropertiesEditCtx(_ref) {
|
|
23
|
+
var ctx = _ref.ctx,
|
|
24
|
+
customPropertiesEndpoint = _ref.customPropertiesEndpoint,
|
|
25
|
+
id = _ref.id,
|
|
26
|
+
labelOverrides = _ref.labelOverrides,
|
|
27
|
+
nameOverride = _ref.nameOverride;
|
|
28
|
+
|
|
29
|
+
// Deal with all the possible label override options
|
|
30
|
+
var getAccordionLabel = function getAccordionLabel() {
|
|
31
|
+
var _labelOverrides$defau;
|
|
32
|
+
|
|
33
|
+
// Special case for null context
|
|
34
|
+
if (ctx === 'isNull') {
|
|
35
|
+
var _labelOverrides$noCon;
|
|
36
|
+
|
|
37
|
+
return (_labelOverrides$noCon = labelOverrides.noContext) !== null && _labelOverrides$noCon !== void 0 ? _labelOverrides$noCon : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
38
|
+
id: "stripes-kint-components.customProperties"
|
|
39
|
+
});
|
|
40
|
+
} // Label overrides for specific contexts
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if (labelOverrides[ctx]) {
|
|
44
|
+
return labelOverrides[ctx];
|
|
45
|
+
} // Label override for default title, taking ctx into account
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if (labelOverrides.defaultTitle && typeof labelOverrides.defaultTitle === 'function') {
|
|
49
|
+
return labelOverrides.defaultTitle(ctx);
|
|
50
|
+
} // Label override for default title or finally built in default
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
return (_labelOverrides$defau = labelOverrides.defaultTitle) !== null && _labelOverrides$defau !== void 0 ? _labelOverrides$defau : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
54
|
+
id: "stripes-kint-components.customProperties.ctx.title",
|
|
55
|
+
values: {
|
|
56
|
+
ctx: ctx
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
var _useCustomProperties = (0, _hooks.useCustomProperties)({
|
|
62
|
+
ctx: ctx,
|
|
63
|
+
endpoint: customPropertiesEndpoint,
|
|
64
|
+
returnQueryObject: true,
|
|
65
|
+
options: {
|
|
66
|
+
filters: [{
|
|
67
|
+
path: 'retired',
|
|
68
|
+
comparator: '!=',
|
|
69
|
+
value: 'true'
|
|
70
|
+
}]
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
custprops = _useCustomProperties.data,
|
|
74
|
+
isLoading = _useCustomProperties.isLoading;
|
|
75
|
+
|
|
76
|
+
if (isLoading) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return custprops.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Accordion, {
|
|
81
|
+
id: "".concat(id, "-accordion-").concat(ctx),
|
|
82
|
+
label: getAccordionLabel(),
|
|
83
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertiesListField.default, {
|
|
84
|
+
ctx: ctx,
|
|
85
|
+
customProperties: custprops,
|
|
86
|
+
labelOverrides: labelOverrides,
|
|
87
|
+
name: nameOverride !== null && nameOverride !== void 0 ? nameOverride : 'customProperties'
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
CustomPropertiesEditCtx.propTypes = {
|
|
93
|
+
ctx: _propTypes.default.string,
|
|
94
|
+
customPropertiesEndpoint: _propTypes.default.string,
|
|
95
|
+
id: _propTypes.default.string,
|
|
96
|
+
labelOverrides: _propTypes.default.object,
|
|
97
|
+
nameOverride: _propTypes.default.string
|
|
98
|
+
};
|
|
99
|
+
var _default = CustomPropertiesEditCtx;
|
|
100
|
+
exports.default = _default;
|
|
@@ -0,0 +1,243 @@
|
|
|
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 _reactFinalForm = require("react-final-form");
|
|
13
|
+
|
|
14
|
+
var _components = require("@folio/stripes/components");
|
|
15
|
+
|
|
16
|
+
var _reactIntl = require("react-intl");
|
|
17
|
+
|
|
18
|
+
var _hooks = require("../../hooks");
|
|
19
|
+
|
|
20
|
+
var _CustomPropertyFormCard = _interopRequireDefault(require("./CustomPropertyFormCard"));
|
|
21
|
+
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
|
|
24
|
+
var _excluded = ["ctx", "customProperties", "labelOverrides"];
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
39
|
+
|
|
40
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
+
|
|
42
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
43
|
+
|
|
44
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
45
|
+
|
|
46
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
47
|
+
|
|
48
|
+
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."); }
|
|
49
|
+
|
|
50
|
+
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); }
|
|
51
|
+
|
|
52
|
+
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; }
|
|
53
|
+
|
|
54
|
+
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; }
|
|
55
|
+
|
|
56
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
57
|
+
|
|
58
|
+
var CustomPropertiesList = function CustomPropertiesList(_ref) {
|
|
59
|
+
var _labelOverrides$prima, _labelOverrides$optio, _labelOverrides$addPr;
|
|
60
|
+
|
|
61
|
+
var _ref$availableCustomP = _ref.availableCustomProperties,
|
|
62
|
+
availableCustomProperties = _ref$availableCustomP === void 0 ? [] : _ref$availableCustomP,
|
|
63
|
+
_ref$input = _ref.input,
|
|
64
|
+
name = _ref$input.name,
|
|
65
|
+
onChange = _ref$input.onChange,
|
|
66
|
+
value = _ref$input.value,
|
|
67
|
+
labelOverrides = _ref.labelOverrides,
|
|
68
|
+
pristine = _ref.meta.pristine;
|
|
69
|
+
|
|
70
|
+
var _useState = (0, _react.useState)([]),
|
|
71
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
72
|
+
customProperties = _useState2[0],
|
|
73
|
+
setCustomProperties = _useState2[1]; // This is the list of customProperties we're currently displaying for edit.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
var _useState3 = (0, _react.useState)(false),
|
|
77
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
78
|
+
dirtying = _useState4[0],
|
|
79
|
+
setDirtying = _useState4[1];
|
|
80
|
+
|
|
81
|
+
(0, _react.useEffect)(function () {
|
|
82
|
+
// When the user loads this form, we want to init the list of customProperties
|
|
83
|
+
// we're displaying (state.customProperties) with the list of customProperties that have been set
|
|
84
|
+
// either via defaults or previously-saved data. Since that data may come in
|
|
85
|
+
// _after_ we have mounted this component, we need to check if new data has come in
|
|
86
|
+
// while the form is still marked as pristine.
|
|
87
|
+
//
|
|
88
|
+
// final-form unsets `pristine` after its `onChange` is called, but we also dirty
|
|
89
|
+
// the component when we add/remove rows. That happens _before_ `onChange` is called,
|
|
90
|
+
// so internally we use `state.dirtying` to show that we just initiated an action
|
|
91
|
+
// that will result in a dirty component.
|
|
92
|
+
if (pristine && !dirtying) {
|
|
93
|
+
setCustomProperties(availableCustomProperties.filter(function (customProperty) {
|
|
94
|
+
return value[customProperty.value] !== undefined;
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return null;
|
|
99
|
+
}, [availableCustomProperties, dirtying, pristine, value]);
|
|
100
|
+
|
|
101
|
+
var handleDeleteCustomProperty = function handleDeleteCustomProperty(customProperty, i) {
|
|
102
|
+
var _value$customProperty, _value$customProperty2;
|
|
103
|
+
|
|
104
|
+
var currentValue = (_value$customProperty = (_value$customProperty2 = value[customProperty.value]) === null || _value$customProperty2 === void 0 ? void 0 : _value$customProperty2[0]) !== null && _value$customProperty !== void 0 ? _value$customProperty : {};
|
|
105
|
+
|
|
106
|
+
var newCustomProperties = _toConsumableArray(customProperties);
|
|
107
|
+
|
|
108
|
+
newCustomProperties.splice(i, 1);
|
|
109
|
+
setCustomProperties(newCustomProperties);
|
|
110
|
+
setDirtying(true);
|
|
111
|
+
onChange(_objectSpread(_objectSpread({}, value), {}, _defineProperty({}, customProperty.value, [_objectSpread(_objectSpread({}, currentValue), {}, {
|
|
112
|
+
_delete: true
|
|
113
|
+
})])));
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
var renderCustomProperties = function renderCustomProperties(customPropertyType) {
|
|
117
|
+
// This is necessary to track individually since "index" will span primary/optional for a given set
|
|
118
|
+
var internalPropertyCounter = 0;
|
|
119
|
+
return customProperties.map(function (customProperty, index) {
|
|
120
|
+
if (customPropertyType === 'primary' && !customProperty.primary) return undefined;
|
|
121
|
+
if (customPropertyType === 'optional' && customProperty.primary) return undefined;
|
|
122
|
+
internalPropertyCounter += 1;
|
|
123
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomPropertyFormCard.default, {
|
|
124
|
+
availableCustomProperties: availableCustomProperties,
|
|
125
|
+
customProperty: customProperty,
|
|
126
|
+
customPropertyType: customPropertyType,
|
|
127
|
+
customProperties: customProperties,
|
|
128
|
+
handleDeleteCustomProperty: handleDeleteCustomProperty,
|
|
129
|
+
index: index,
|
|
130
|
+
internalPropertyCounter: internalPropertyCounter,
|
|
131
|
+
labelOverrides: labelOverrides,
|
|
132
|
+
name: name,
|
|
133
|
+
onChange: onChange,
|
|
134
|
+
setCustomProperties: setCustomProperties,
|
|
135
|
+
value: value
|
|
136
|
+
}, "customPropertyField-".concat(customProperty.value, "-").concat(index));
|
|
137
|
+
}).filter(function (cp) {
|
|
138
|
+
return cp !== undefined;
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
143
|
+
children: [availableCustomProperties.some(function () {
|
|
144
|
+
var customProperty = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
145
|
+
return customProperty.primary;
|
|
146
|
+
}) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
147
|
+
label: (_labelOverrides$prima = labelOverrides.primaryProperties) !== null && _labelOverrides$prima !== void 0 ? _labelOverrides$prima : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
148
|
+
id: "stripes-kint-components.customProperties.primaryProperties"
|
|
149
|
+
}),
|
|
150
|
+
value: renderCustomProperties('primary')
|
|
151
|
+
}), availableCustomProperties.some(function () {
|
|
152
|
+
var customProperty = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
153
|
+
return !customProperty.primary;
|
|
154
|
+
}) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.KeyValue, {
|
|
155
|
+
label: (_labelOverrides$optio = labelOverrides.optionalProperties) !== null && _labelOverrides$optio !== void 0 ? _labelOverrides$optio : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
156
|
+
id: "stripes-kint-components.customProperties.optionalProperties"
|
|
157
|
+
}),
|
|
158
|
+
value: renderCustomProperties('optional')
|
|
159
|
+
}), availableCustomProperties.some(function () {
|
|
160
|
+
var customProperty = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
161
|
+
return !customProperty.primary;
|
|
162
|
+
}) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
163
|
+
id: "add-customproperty-btn",
|
|
164
|
+
onClick: function onClick() {
|
|
165
|
+
setCustomProperties([].concat(_toConsumableArray(customProperties), [{}]));
|
|
166
|
+
setDirtying(true);
|
|
167
|
+
},
|
|
168
|
+
children: (_labelOverrides$addPr = labelOverrides.addProperty) !== null && _labelOverrides$addPr !== void 0 ? _labelOverrides$addPr : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactIntl.FormattedMessage, {
|
|
169
|
+
id: "stripes-kint-components.customProperties.addProperty"
|
|
170
|
+
})
|
|
171
|
+
})]
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
var CustomPropertiesListField = function CustomPropertiesListField(_ref2) {
|
|
176
|
+
var ctx = _ref2.ctx,
|
|
177
|
+
customProperties = _ref2.customProperties,
|
|
178
|
+
labelOverrides = _ref2.labelOverrides,
|
|
179
|
+
fieldProps = _objectWithoutProperties(_ref2, _excluded);
|
|
180
|
+
|
|
181
|
+
var fieldRef = (0, _react.useRef)();
|
|
182
|
+
var availableCustomProperties = (0, _hooks.useAvailableCustomProperties)(customProperties);
|
|
183
|
+
|
|
184
|
+
var _useFormState = (0, _reactFinalForm.useFormState)(),
|
|
185
|
+
initialValues = _useFormState.initialValues;
|
|
186
|
+
|
|
187
|
+
var getInitialValue = function getInitialValue() {
|
|
188
|
+
var cps = {};
|
|
189
|
+
(customProperties || []).filter(function (cp) {
|
|
190
|
+
return cp.primary;
|
|
191
|
+
}) // Change default to be an ignored customProperty.
|
|
192
|
+
// This means any changes without setting the value will be ignored
|
|
193
|
+
.forEach(function (cp) {
|
|
194
|
+
cps[cp.name] = [{
|
|
195
|
+
_delete: true
|
|
196
|
+
}];
|
|
197
|
+
}); // IMPORTANT -- All customproperty ctx sections are adding to the same "initialValue" field
|
|
198
|
+
// Ensure that we don't already have initialValues for this particular set before setting them,
|
|
199
|
+
// to ensure no looping behaviour
|
|
200
|
+
|
|
201
|
+
if (Object.keys(cps).every(function (key) {
|
|
202
|
+
var _initialValues$custom;
|
|
203
|
+
|
|
204
|
+
return ((_initialValues$custom = initialValues.customProperties) === null || _initialValues$custom === void 0 ? void 0 : _initialValues$custom[key]) !== undefined;
|
|
205
|
+
})) {
|
|
206
|
+
return initialValues.customProperties;
|
|
207
|
+
} // Ensure that if we already had these values in initialvalues they're not overwritten
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
return _objectSpread(_objectSpread({}, cps), initialValues.customProperties);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFinalForm.Field, _objectSpread(_objectSpread({}, fieldProps), {}, {
|
|
214
|
+
initialValue: getInitialValue(),
|
|
215
|
+
render: function render(p) {
|
|
216
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(CustomPropertiesList, _objectSpread({
|
|
217
|
+
ref: fieldRef,
|
|
218
|
+
availableCustomProperties: availableCustomProperties,
|
|
219
|
+
ctx: ctx,
|
|
220
|
+
labelOverrides: labelOverrides
|
|
221
|
+
}, p));
|
|
222
|
+
}
|
|
223
|
+
}));
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
CustomPropertiesListField.propTypes = {
|
|
227
|
+
ctx: _propTypes.default.string,
|
|
228
|
+
customProperties: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
229
|
+
labelOverrides: _propTypes.default.object
|
|
230
|
+
};
|
|
231
|
+
CustomPropertiesList.propTypes = {
|
|
232
|
+
availableCustomProperties: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
233
|
+
ctx: _propTypes.default.string,
|
|
234
|
+
input: _propTypes.default.shape({
|
|
235
|
+
name: _propTypes.default.string,
|
|
236
|
+
value: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
237
|
+
onChange: _propTypes.default.func
|
|
238
|
+
}),
|
|
239
|
+
labelOverrides: _propTypes.default.object,
|
|
240
|
+
meta: _propTypes.default.object
|
|
241
|
+
};
|
|
242
|
+
var _default = CustomPropertiesListField;
|
|
243
|
+
exports.default = _default;
|