@k-int/stripes-kint-components 1.6.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -1
- package/es/index.js +49 -8
- package/es/lib/ActionList/ActionList.js +51 -26
- package/es/lib/ActionList/ActionListFieldArray.js +84 -27
- package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +198 -0
- package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +326 -0
- package/es/lib/CustomProperties/Config/CustomPropertiesView.js +166 -0
- package/es/lib/CustomProperties/Config/CustomPropertyForm.js +360 -0
- package/es/lib/CustomProperties/Config/index.js +41 -0
- package/es/lib/EditableRefdataList/EditableRefdataList.js +17 -9
- package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +2 -2
- package/es/lib/EditableSettingsList/SettingField/SettingField.js +3 -3
- package/es/lib/FormModal/FormModal.js +126 -0
- package/es/lib/{TypeDown → FormModal}/index.js +2 -2
- package/es/lib/NoResultsMessage/NoResultsMessage.js +1 -1
- package/es/lib/QueryTypedown/QueryTypedown.js +3 -3
- package/es/lib/RefdataButtons/RefdataButtons.js +2 -2
- package/es/lib/SASQLookupComponent/SASQLookupComponent.js +8 -3
- package/es/lib/SASQRoute/SASQRoute.js +2 -2
- package/es/lib/SASQViewComponent/SASQViewComponent.js +2 -2
- package/es/lib/SearchField/SearchField.js +2 -2
- package/es/lib/SettingPage/SettingPage.js +1 -1
- package/es/lib/SettingPage/SettingPagePane.js +1 -1
- package/es/lib/Typedown/Typedown.js +45 -14
- package/es/lib/constants/customProperties.js +60 -0
- package/es/lib/hooks/index.js +16 -0
- package/es/lib/hooks/settingsHooks/useSettings.js +3 -3
- package/es/lib/hooks/useCustomProperties.js +112 -0
- package/es/lib/hooks/useHelperApp.js +3 -3
- package/es/lib/hooks/useKiwtFieldArray.js +2 -2
- package/es/lib/hooks/useKiwtSASQuery.js +3 -3
- package/es/lib/hooks/useLocalStorageState.js +1 -1
- package/es/lib/hooks/useMutateCustomProperties.js +143 -0
- package/es/lib/hooks/useQIndex.js +3 -3
- package/es/lib/hooks/useRefdata.js +3 -9
- package/es/lib/utils/index.js +8 -0
- package/es/lib/utils/refdataOptions.js +43 -0
- package/junit.xml +38 -38
- package/package.json +5 -3
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +58 -29
- package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +167 -18
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +13 -14
- package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +2 -3
- package/{artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/SettingField/SettingField.js.html → src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesLookup.js.html} +121 -140
- package/{artifacts/coverage-jest/lcov-report/src/lib/Typedown/Typedown.js.html → src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesSettings.js.html} +263 -246
- package/{artifacts/coverage-jest/lcov-report/src/lib/hooks/typedownHooks/useTypedown.js.html → src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesView.js.html} +222 -211
- package/{artifacts/coverage-jest/lcov-report/src/lib/SASQLookupComponent/SASQLookupComponent.js.html → src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html} +356 -315
- package/{artifacts/coverage-jest/lcov-report/src/lib/hooks/typedownHooks → src/artifacts/coverage-jest/lcov-report/CustomProperties/Config}/index.html +55 -41
- package/{artifacts/coverage-jest/lcov-report/src/lib/hooks/typedownHooks → src/artifacts/coverage-jest/lcov-report/CustomProperties/Config}/index.js.html +18 -16
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +24 -13
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +8 -9
- package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +2 -3
- package/{artifacts/coverage-jest/lcov-report/src/index.js.html → src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html} +86 -93
- package/src/artifacts/coverage-jest/lcov-report/{TypeDown → FormModal}/index.html +15 -16
- package/src/artifacts/coverage-jest/lcov-report/{TypeDown → FormModal}/index.js.html +5 -6
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +4 -5
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +4 -5
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +25 -8
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +10 -11
- package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +141 -16
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +8 -9
- package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +2 -3
- package/{artifacts/coverage-jest/lcov-report/src/lib/utils/sortByLabel.js.html → src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html} +28 -47
- package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/constants/index.html +19 -5
- package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +36 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +9 -4
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +6 -7
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +32 -36
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +2 -3
- package/{artifacts/coverage-jest/lcov-report/src/lib/hooks/useRefdata.js.html → src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html} +64 -47
- package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +2 -3
- package/{artifacts/coverage-jest/lcov-report/src/lib/hooks/useMutateRefdataValue.js.html → src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html} +43 -74
- package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +5 -24
- package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/index.html +72 -58
- package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/index.html +21 -22
- package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +9 -4
- package/{artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/index.js.html → src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html} +27 -16
- package/src/artifacts/coverage-jest/lcov-report/utils/renderHelpText.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +2 -3
- package/src/artifacts/coverage-jest/lcov.info +924 -552
- package/src/index.js +12 -4
- package/src/lib/ActionList/ActionList.js +32 -22
- package/src/lib/ActionList/ActionListFieldArray.js +60 -10
- package/src/lib/ActionList/README.md +5 -1
- package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +111 -0
- package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +240 -0
- package/src/lib/CustomProperties/Config/CustomPropertiesView.js +150 -0
- package/src/lib/CustomProperties/Config/CustomPropertyForm.js +296 -0
- package/src/lib/CustomProperties/Config/index.js +4 -0
- package/src/lib/EditableRefdataList/EditableRefdataList.js +9 -5
- package/src/lib/FormModal/FormModal.js +71 -0
- package/src/lib/FormModal/index.js +1 -0
- package/src/lib/NoResultsMessage/NoResultsMessage.js +2 -2
- package/src/lib/SASQLookupComponent/SASQLookupComponent.js +6 -0
- package/src/lib/Typedown/Typedown.js +50 -8
- package/src/lib/constants/customProperties.js +9 -0
- package/src/lib/hooks/index.js +2 -0
- package/src/lib/hooks/useCustomProperties.js +73 -0
- package/src/lib/hooks/useMutateCustomProperties.js +62 -0
- package/src/lib/hooks/useRefdata.js +2 -8
- package/src/lib/utils/index.js +2 -0
- package/src/lib/utils/refdataOptions.js +7 -0
- package/translations/stripes-kint-components/en.json +49 -1
- package/artifacts/coverage-jest/lcov-report/base.css +0 -224
- package/artifacts/coverage-jest/lcov-report/block-navigation.js +0 -87
- package/artifacts/coverage-jest/lcov-report/es/lib/ActionList/ActionList.js.html +0 -389
- package/artifacts/coverage-jest/lcov-report/es/lib/ActionList/ActionListFieldArray.js.html +0 -1076
- package/artifacts/coverage-jest/lcov-report/es/lib/ActionList/index.html +0 -147
- package/artifacts/coverage-jest/lcov-report/es/lib/ActionList/index.js.html +0 -140
- package/artifacts/coverage-jest/lcov-report/es/lib/EditableRefdataList/EditableRefdataList.js.html +0 -680
- package/artifacts/coverage-jest/lcov-report/es/lib/EditableRefdataList/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/es/lib/EditableRefdataList/index.js.html +0 -140
- package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/EditableSettingsList.js.html +0 -353
- package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js.html +0 -353
- package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/SettingField/EditSettingValue.js.html +0 -482
- package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js.html +0 -434
- package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/SettingField/SettingField.js.html +0 -644
- package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/SettingField/index.html +0 -162
- package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/SettingField/index.js.html +0 -188
- package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/index.html +0 -147
- package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/index.js.html +0 -188
- package/artifacts/coverage-jest/lcov-report/es/lib/NoResultsMessage/NoResultsMessage.js.html +0 -449
- package/artifacts/coverage-jest/lcov-report/es/lib/NoResultsMessage/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/es/lib/NoResultsMessage/index.js.html +0 -140
- package/artifacts/coverage-jest/lcov-report/es/lib/QueryTypedown/QueryTypedown.js.html +0 -413
- package/artifacts/coverage-jest/lcov-report/es/lib/QueryTypedown/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/es/lib/QueryTypedown/index.js.html +0 -140
- package/artifacts/coverage-jest/lcov-report/es/lib/RefdataButtons/RefdataButtons.js.html +0 -512
- package/artifacts/coverage-jest/lcov-report/es/lib/RefdataButtons/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/es/lib/RefdataButtons/index.js.html +0 -140
- package/artifacts/coverage-jest/lcov-report/es/lib/SASQLookupComponent/SASQLookupComponent.js.html +0 -1115
- package/artifacts/coverage-jest/lcov-report/es/lib/SASQLookupComponent/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/es/lib/SASQLookupComponent/index.js.html +0 -140
- package/artifacts/coverage-jest/lcov-report/es/lib/SASQRoute/SASQRoute.js.html +0 -404
- package/artifacts/coverage-jest/lcov-report/es/lib/SASQRoute/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/es/lib/SASQRoute/index.js.html +0 -140
- package/artifacts/coverage-jest/lcov-report/es/lib/SASQViewComponent/SASQViewComponent.js.html +0 -413
- package/artifacts/coverage-jest/lcov-report/es/lib/SASQViewComponent/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/es/lib/SASQViewComponent/index.js.html +0 -140
- package/artifacts/coverage-jest/lcov-report/es/lib/SearchField/SearchField.js.html +0 -353
- package/artifacts/coverage-jest/lcov-report/es/lib/SearchField/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/es/lib/SearchField/index.js.html +0 -140
- package/artifacts/coverage-jest/lcov-report/es/lib/SettingPage/SettingPage.js.html +0 -380
- package/artifacts/coverage-jest/lcov-report/es/lib/SettingPage/SettingPagePane.js.html +0 -308
- package/artifacts/coverage-jest/lcov-report/es/lib/SettingPage/index.html +0 -147
- package/artifacts/coverage-jest/lcov-report/es/lib/SettingPage/index.js.html +0 -164
- package/artifacts/coverage-jest/lcov-report/es/lib/TypeDown/TypeDown.js.html +0 -839
- package/artifacts/coverage-jest/lcov-report/es/lib/TypeDown/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/es/lib/TypeDown/index.js.html +0 -140
- package/artifacts/coverage-jest/lcov-report/es/lib/Typedown/Typedown.js.html +0 -887
- package/artifacts/coverage-jest/lcov-report/es/lib/Typedown/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/es/lib/Typedown/index.js.html +0 -140
- package/artifacts/coverage-jest/lcov-report/es/lib/constants/eventCodes.js.html +0 -209
- package/artifacts/coverage-jest/lcov-report/es/lib/constants/index.html +0 -117
- package/artifacts/coverage-jest/lcov-report/es/lib/contexts/SettingsContext.js.html +0 -206
- package/artifacts/coverage-jest/lcov-report/es/lib/contexts/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/es/lib/contexts/index.js.html +0 -140
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/index.html +0 -252
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/index.js.html +0 -374
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/settingsHooks/index.html +0 -147
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/settingsHooks/index.js.html +0 -164
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/settingsHooks/useSettingSection.js.html +0 -305
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/settingsHooks/useSettings.js.html +0 -584
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/typedownHooks/index.html +0 -162
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/typedownHooks/index.js.html +0 -188
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/typedownHooks/useTypedown.js.html +0 -644
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/typedownHooks/useTypedownData.js.html +0 -335
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/typedownHooks/useTypedownToggle.js.html +0 -350
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useActiveElement.js.html +0 -323
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useHelperApp.js.html +0 -488
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useKiwtFieldArray.js.html +0 -509
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useKiwtSASQuery.js.html +0 -467
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useLocalStorageState.js.html +0 -329
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useMutateRefdataValue.js.html +0 -488
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useQIndex.js.html +0 -407
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useRefdata.js.html +0 -401
- package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useTemplates.js.html +0 -314
- package/artifacts/coverage-jest/lcov-report/es/lib/utils/buildUrl.js.html +0 -296
- package/artifacts/coverage-jest/lcov-report/es/lib/utils/generateKiwtQuery.js.html +0 -230
- package/artifacts/coverage-jest/lcov-report/es/lib/utils/generateKiwtQueryParams.js.html +0 -545
- package/artifacts/coverage-jest/lcov-report/es/lib/utils/getFocusableElements.js.html +0 -572
- package/artifacts/coverage-jest/lcov-report/es/lib/utils/index.html +0 -237
- package/artifacts/coverage-jest/lcov-report/es/lib/utils/index.js.html +0 -284
- package/artifacts/coverage-jest/lcov-report/es/lib/utils/renderHelpText.js.html +0 -410
- package/artifacts/coverage-jest/lcov-report/es/lib/utils/selectorSafe.js.html +0 -209
- package/artifacts/coverage-jest/lcov-report/es/lib/utils/sortByLabel.js.html +0 -248
- package/artifacts/coverage-jest/lcov-report/es/lib/utils/toCamelCase.js.html +0 -227
- package/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
- package/artifacts/coverage-jest/lcov-report/index.html +0 -717
- package/artifacts/coverage-jest/lcov-report/prettify.css +0 -1
- package/artifacts/coverage-jest/lcov-report/prettify.js +0 -2
- package/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
- package/artifacts/coverage-jest/lcov-report/sorter.js +0 -196
- package/artifacts/coverage-jest/lcov-report/src/index.html +0 -117
- package/artifacts/coverage-jest/lcov-report/src/lib/ActionList/ActionList.js.html +0 -248
- package/artifacts/coverage-jest/lcov-report/src/lib/ActionList/ActionListFieldArray.js.html +0 -764
- package/artifacts/coverage-jest/lcov-report/src/lib/ActionList/index.html +0 -147
- package/artifacts/coverage-jest/lcov-report/src/lib/ActionList/index.js.html +0 -89
- package/artifacts/coverage-jest/lcov-report/src/lib/EditableRefdataList/EditableRefdataList.js.html +0 -362
- package/artifacts/coverage-jest/lcov-report/src/lib/EditableRefdataList/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/src/lib/EditableRefdataList/index.js.html +0 -86
- package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/EditableSettingsList.js.html +0 -224
- package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/EditableSettingsListFieldArray.js.html +0 -212
- package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/SettingField/EditSettingValue.js.html +0 -308
- package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/SettingField/RenderSettingValue.js.html +0 -260
- package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/SettingField/index.html +0 -162
- package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/SettingField/index.js.html +0 -95
- package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/index.html +0 -147
- package/artifacts/coverage-jest/lcov-report/src/lib/NoResultsMessage/NoResultsMessage.js.html +0 -320
- package/artifacts/coverage-jest/lcov-report/src/lib/NoResultsMessage/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/src/lib/NoResultsMessage/index.js.html +0 -89
- package/artifacts/coverage-jest/lcov-report/src/lib/QueryTypedown/QueryTypedown.js.html +0 -185
- package/artifacts/coverage-jest/lcov-report/src/lib/QueryTypedown/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/src/lib/QueryTypedown/index.js.html +0 -89
- package/artifacts/coverage-jest/lcov-report/src/lib/RefdataButtons/RefdataButtons.js.html +0 -371
- package/artifacts/coverage-jest/lcov-report/src/lib/RefdataButtons/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/src/lib/RefdataButtons/index.js.html +0 -89
- package/artifacts/coverage-jest/lcov-report/src/lib/SASQLookupComponent/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/src/lib/SASQLookupComponent/index.js.html +0 -89
- package/artifacts/coverage-jest/lcov-report/src/lib/SASQRoute/SASQRoute.js.html +0 -275
- package/artifacts/coverage-jest/lcov-report/src/lib/SASQRoute/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/src/lib/SASQRoute/index.js.html +0 -89
- package/artifacts/coverage-jest/lcov-report/src/lib/SASQViewComponent/SASQViewComponent.js.html +0 -251
- package/artifacts/coverage-jest/lcov-report/src/lib/SASQViewComponent/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/src/lib/SASQViewComponent/index.js.html +0 -89
- package/artifacts/coverage-jest/lcov-report/src/lib/SearchField/SearchField.js.html +0 -215
- package/artifacts/coverage-jest/lcov-report/src/lib/SearchField/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/src/lib/SearchField/index.js.html +0 -89
- package/artifacts/coverage-jest/lcov-report/src/lib/SettingPage/SettingPage.js.html +0 -212
- package/artifacts/coverage-jest/lcov-report/src/lib/SettingPage/SettingPagePane.js.html +0 -149
- package/artifacts/coverage-jest/lcov-report/src/lib/SettingPage/index.html +0 -147
- package/artifacts/coverage-jest/lcov-report/src/lib/SettingPage/index.js.html +0 -92
- package/artifacts/coverage-jest/lcov-report/src/lib/TypeDown/TypeDown.js.html +0 -764
- package/artifacts/coverage-jest/lcov-report/src/lib/TypeDown/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/src/lib/TypeDown/index.js.html +0 -89
- package/artifacts/coverage-jest/lcov-report/src/lib/Typedown/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/src/lib/Typedown/index.js.html +0 -89
- package/artifacts/coverage-jest/lcov-report/src/lib/constants/eventCodes.js.html +0 -95
- package/artifacts/coverage-jest/lcov-report/src/lib/constants/index.html +0 -117
- package/artifacts/coverage-jest/lcov-report/src/lib/contexts/SettingsContext.js.html +0 -98
- package/artifacts/coverage-jest/lcov-report/src/lib/contexts/index.html +0 -132
- package/artifacts/coverage-jest/lcov-report/src/lib/contexts/index.js.html +0 -86
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/index.html +0 -252
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/index.js.html +0 -116
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/settingsHooks/index.html +0 -147
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/settingsHooks/index.js.html +0 -92
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/settingsHooks/useSettingSection.js.html +0 -164
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/settingsHooks/useSettings.js.html +0 -377
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/typedownHooks/useTypedownData.js.html +0 -164
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/typedownHooks/useTypedownToggle.js.html +0 -164
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useActiveElement.js.html +0 -158
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useHelperApp.js.html +0 -284
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useKiwtFieldArray.js.html +0 -275
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useKiwtSASQuery.js.html +0 -179
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useLocalStorageState.js.html +0 -137
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useQIndex.js.html +0 -209
- package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useTemplates.js.html +0 -167
- package/artifacts/coverage-jest/lcov-report/src/lib/utils/buildUrl.js.html +0 -194
- package/artifacts/coverage-jest/lcov-report/src/lib/utils/generateKiwtQuery.js.html +0 -110
- package/artifacts/coverage-jest/lcov-report/src/lib/utils/generateKiwtQueryParams.js.html +0 -287
- package/artifacts/coverage-jest/lcov-report/src/lib/utils/getFocusableElements.js.html +0 -380
- package/artifacts/coverage-jest/lcov-report/src/lib/utils/index.html +0 -237
- package/artifacts/coverage-jest/lcov-report/src/lib/utils/index.js.html +0 -116
- package/artifacts/coverage-jest/lcov-report/src/lib/utils/renderHelpText.js.html +0 -167
- package/artifacts/coverage-jest/lcov-report/src/lib/utils/selectorSafe.js.html +0 -104
- package/artifacts/coverage-jest/lcov-report/src/lib/utils/toCamelCase.js.html +0 -128
- package/artifacts/coverage-jest/lcov.info +0 -10040
- package/es/lib/TypeDown/TypeDown.js +0 -251
- package/src/artifacts/coverage-jest/lcov-report/TypeDown/TypeDown.js.html +0 -770
- package/src/artifacts/coverage-jest/lcov-report/utils/getFocusableElements.js.html +0 -386
- package/src/lib/TypeDown/README.md +0 -1
- package/src/lib/TypeDown/TypeDown.js +0 -228
- package/src/lib/TypeDown/index.js +0 -1
- package/yarn-error.log +0 -15050
package/src/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// Useful hooks
|
|
2
2
|
export {
|
|
3
3
|
useActiveElement,
|
|
4
|
+
useCustomProperties,
|
|
4
5
|
useHelperApp,
|
|
5
6
|
useKiwtFieldArray,
|
|
6
7
|
useKiwtSASQuery,
|
|
7
8
|
useLocalStorageState,
|
|
9
|
+
useMutateCustomProperties,
|
|
8
10
|
useMutateRefdataValue,
|
|
9
11
|
useQIndex,
|
|
10
12
|
useRefdata,
|
|
@@ -16,6 +18,7 @@ export {
|
|
|
16
18
|
export {
|
|
17
19
|
generateKiwtQuery,
|
|
18
20
|
generateKiwtQueryParams,
|
|
21
|
+
refdataOptions,
|
|
19
22
|
selectorSafe
|
|
20
23
|
} from './lib/utils';
|
|
21
24
|
|
|
@@ -35,10 +38,6 @@ export { default as ActionList } from './lib/ActionList';
|
|
|
35
38
|
export { default as EditableRefdataList } from './lib/EditableRefdataList';
|
|
36
39
|
|
|
37
40
|
// Typedown
|
|
38
|
-
export {
|
|
39
|
-
default as TypeDown
|
|
40
|
-
} from './lib/TypeDown';
|
|
41
|
-
|
|
42
41
|
export {
|
|
43
42
|
default as Typedown
|
|
44
43
|
} from './lib/Typedown';
|
|
@@ -72,3 +71,12 @@ export { default as NoResultsMessage } from './lib/NoResultsMessage';
|
|
|
72
71
|
|
|
73
72
|
// RefdataButtons
|
|
74
73
|
export { default as RefdataButtons } from './lib/RefdataButtons';
|
|
74
|
+
|
|
75
|
+
// Custom properties
|
|
76
|
+
export {
|
|
77
|
+
CustomPropertiesLookup,
|
|
78
|
+
CustomPropertiesSettings,
|
|
79
|
+
CustomPropertiesView
|
|
80
|
+
} from './lib/CustomProperties/Config';
|
|
81
|
+
|
|
82
|
+
export * as customPropertyContants from './lib/constants/customProperties';
|
|
@@ -12,7 +12,9 @@ const propTypes = {
|
|
|
12
12
|
actionCalls: PropTypes.object,
|
|
13
13
|
columnMapping: PropTypes.object,
|
|
14
14
|
contentData: PropTypes.arrayOf(PropTypes.object),
|
|
15
|
+
creatableFields: PropTypes.object,
|
|
15
16
|
editableFields: PropTypes.object,
|
|
17
|
+
fieldComponents: PropTypes.object,
|
|
16
18
|
visibleFields: PropTypes.arrayOf(PropTypes.string)
|
|
17
19
|
};
|
|
18
20
|
|
|
@@ -21,31 +23,39 @@ const ActionList = ({
|
|
|
21
23
|
actionCalls = {},
|
|
22
24
|
columnMapping,
|
|
23
25
|
contentData,
|
|
26
|
+
creatableFields = {},
|
|
24
27
|
editableFields = {},
|
|
25
|
-
|
|
28
|
+
fieldComponents = {},
|
|
29
|
+
visibleFields,
|
|
30
|
+
...mclProps // Assume anything left over is to directly apply to the MCL
|
|
26
31
|
}) => {
|
|
27
32
|
return (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
33
|
+
<>
|
|
34
|
+
<Form
|
|
35
|
+
enableReinitialize
|
|
36
|
+
initialValues={{ contentData }}
|
|
37
|
+
mutators={arrayMutators}
|
|
38
|
+
onSubmit={actionCalls.edit}
|
|
39
|
+
subscription={{ contentData: true }}
|
|
40
|
+
>
|
|
41
|
+
{() => (
|
|
42
|
+
<form onSubmit={e => { e.preventDefault(); }}>
|
|
43
|
+
<FieldArray
|
|
44
|
+
actionAssigner={actionAssigner}
|
|
45
|
+
actionCalls={actionCalls}
|
|
46
|
+
columnMapping={columnMapping}
|
|
47
|
+
component={ActionListFieldArray}
|
|
48
|
+
creatableFields={creatableFields}
|
|
49
|
+
editableFields={editableFields}
|
|
50
|
+
fieldComponents={fieldComponents}
|
|
51
|
+
name="contentData"
|
|
52
|
+
visibleFields={visibleFields}
|
|
53
|
+
{...mclProps}
|
|
54
|
+
/>
|
|
55
|
+
</form>
|
|
56
|
+
)}
|
|
57
|
+
</Form>
|
|
58
|
+
</>
|
|
49
59
|
);
|
|
50
60
|
};
|
|
51
61
|
|
|
@@ -15,8 +15,11 @@ const propTypes = {
|
|
|
15
15
|
actionAssigner: PropTypes.func,
|
|
16
16
|
actionCalls: PropTypes.object,
|
|
17
17
|
columnMapping: PropTypes.object,
|
|
18
|
+
creatableFields: PropTypes.object,
|
|
18
19
|
editableFields: PropTypes.object,
|
|
19
20
|
fields: PropTypes.object,
|
|
21
|
+
fieldComponents: PropTypes.object,
|
|
22
|
+
formatter: PropTypes.object,
|
|
20
23
|
visibleFields: PropTypes.arrayOf(PropTypes.string)
|
|
21
24
|
};
|
|
22
25
|
|
|
@@ -24,9 +27,12 @@ const ActionListFieldArray = ({
|
|
|
24
27
|
actionAssigner,
|
|
25
28
|
actionCalls,
|
|
26
29
|
columnMapping,
|
|
30
|
+
creatableFields,
|
|
27
31
|
editableFields,
|
|
28
32
|
fields,
|
|
29
|
-
|
|
33
|
+
fieldComponents,
|
|
34
|
+
visibleFields,
|
|
35
|
+
...mclProps // Assume anything left over is to directly apply to the MCL
|
|
30
36
|
}) => {
|
|
31
37
|
// Grab finalForm functions/values from form hooks
|
|
32
38
|
const { change } = useForm();
|
|
@@ -54,7 +60,7 @@ const ActionListFieldArray = ({
|
|
|
54
60
|
};
|
|
55
61
|
|
|
56
62
|
const handleCreate = (index) => {
|
|
57
|
-
const rowData = fields.value[index];
|
|
63
|
+
const { actionListActions: _a, ...rowData } = fields.value[index];
|
|
58
64
|
actionCalls.create(rowData);
|
|
59
65
|
};
|
|
60
66
|
|
|
@@ -90,6 +96,7 @@ const ActionListFieldArray = ({
|
|
|
90
96
|
key={`save[${data.rowIndex}]`}
|
|
91
97
|
buttonStyle="primary"
|
|
92
98
|
disabled={submitting || pristine}
|
|
99
|
+
marginBottom0
|
|
93
100
|
onClick={() => {
|
|
94
101
|
if (!data.id && editing === 'NEW_ROW') {
|
|
95
102
|
handleCreate(data.rowIndex);
|
|
@@ -104,9 +111,15 @@ const ActionListFieldArray = ({
|
|
|
104
111
|
<Button
|
|
105
112
|
key={`cancel[${data.rowIndex}]`}
|
|
106
113
|
data-type-button="cancel"
|
|
114
|
+
marginBottom0
|
|
107
115
|
onClick={() => {
|
|
108
|
-
|
|
109
|
-
|
|
116
|
+
if (!data.id && editing === 'NEW_ROW') {
|
|
117
|
+
fields.remove(data.rowIndex);
|
|
118
|
+
toggleEditing('NEW_ROW');
|
|
119
|
+
} else {
|
|
120
|
+
change(fieldName, get(initialValues, fieldName));
|
|
121
|
+
toggleEditing(data.id);
|
|
122
|
+
}
|
|
110
123
|
}}
|
|
111
124
|
>
|
|
112
125
|
<FormattedMessage id="stripes-kint-components.actionList.cancel" />
|
|
@@ -131,6 +144,7 @@ const ActionListFieldArray = ({
|
|
|
131
144
|
key={`action-${action.name}[${data.rowIndex}]`}
|
|
132
145
|
disabled={editing}
|
|
133
146
|
icon={action.icon}
|
|
147
|
+
marginBottom0
|
|
134
148
|
onClick={actionFunction}
|
|
135
149
|
/>
|
|
136
150
|
);
|
|
@@ -141,6 +155,7 @@ const ActionListFieldArray = ({
|
|
|
141
155
|
<Button
|
|
142
156
|
key={`action-${action.name}[${data.rowIndex}]`}
|
|
143
157
|
disabled={editing}
|
|
158
|
+
marginBottom0
|
|
144
159
|
onClick={actionFunction}
|
|
145
160
|
>
|
|
146
161
|
{action.label ?? action.name}
|
|
@@ -153,7 +168,7 @@ const ActionListFieldArray = ({
|
|
|
153
168
|
|
|
154
169
|
const formatContent = () => {
|
|
155
170
|
return (
|
|
156
|
-
fields.map(fieldName => {
|
|
171
|
+
fields.map((fieldName, fieldIndex) => {
|
|
157
172
|
// Fetch the content from the field Values
|
|
158
173
|
const cd = get(values, fieldName);
|
|
159
174
|
cd.actionListActions = actionAssigner(cd);
|
|
@@ -170,19 +185,30 @@ const ActionListFieldArray = ({
|
|
|
170
185
|
*/
|
|
171
186
|
for (const key of visibleFields) {
|
|
172
187
|
const editFunction = editableFields[key] ?? (() => true);
|
|
188
|
+
const createFunction = creatableFields[key] ?? (() => true);
|
|
173
189
|
/*
|
|
174
|
-
Next check if this is a new row, if so we should
|
|
175
|
-
If it
|
|
176
|
-
|
|
190
|
+
Next check if this is a new row, if so we should run the createableField function with the data.
|
|
191
|
+
If it is not a new row, then we run the editableField function with the data,
|
|
192
|
+
and it should return true/false
|
|
193
|
+
|
|
194
|
+
For both checks
|
|
195
|
+
true => Field, false => display value
|
|
177
196
|
*/
|
|
178
197
|
if (
|
|
179
|
-
!cd.id ||
|
|
198
|
+
(!cd.id && createFunction(cd)) ||
|
|
180
199
|
(editFunction(cd))
|
|
181
200
|
) {
|
|
182
201
|
returnObj[key] =
|
|
202
|
+
fieldComponents[key] ?
|
|
203
|
+
fieldComponents[key]({
|
|
204
|
+
name: `${fieldName}.${key}`
|
|
205
|
+
}) :
|
|
183
206
|
<Field
|
|
207
|
+
autofocus={fieldIndex === 0}
|
|
184
208
|
component={TextField}
|
|
209
|
+
marginBottom0
|
|
185
210
|
name={`${fieldName}.${key}`}
|
|
211
|
+
parse={v => v}
|
|
186
212
|
/>;
|
|
187
213
|
}
|
|
188
214
|
}
|
|
@@ -192,6 +218,28 @@ const ActionListFieldArray = ({
|
|
|
192
218
|
);
|
|
193
219
|
};
|
|
194
220
|
|
|
221
|
+
const { formatter, ...restOfMclProps } = mclProps; // Destructure formatter part of mclProps
|
|
222
|
+
const fieldAwareFormatter = () => {
|
|
223
|
+
const returnObj = {};
|
|
224
|
+
// For each visible field, if it's being edited then ignore passed formatters, else use them
|
|
225
|
+
visibleFields.forEach(key => {
|
|
226
|
+
returnObj[key] = cd => {
|
|
227
|
+
// Row is being edited if it has no id, or its id is in the editing string
|
|
228
|
+
const editingRow = cd.id === editing || !cd.id;
|
|
229
|
+
// If not editing, use the passed formatter values
|
|
230
|
+
|
|
231
|
+
let returnValue = cd[key];
|
|
232
|
+
|
|
233
|
+
if (!editingRow && formatter?.[key]) {
|
|
234
|
+
returnValue = formatter[key](cd);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return returnValue;
|
|
238
|
+
};
|
|
239
|
+
});
|
|
240
|
+
return returnObj;
|
|
241
|
+
};
|
|
242
|
+
|
|
195
243
|
return (
|
|
196
244
|
<>
|
|
197
245
|
<Button
|
|
@@ -212,10 +260,12 @@ const ActionListFieldArray = ({
|
|
|
212
260
|
columnWidths={getColumnWidths()}
|
|
213
261
|
contentData={formatContent()}
|
|
214
262
|
formatter={{
|
|
215
|
-
actionListActions: renderActionButtons
|
|
263
|
+
actionListActions: renderActionButtons,
|
|
264
|
+
...fieldAwareFormatter()
|
|
216
265
|
}}
|
|
217
266
|
interactive={false}
|
|
218
267
|
visibleColumns={[...visibleFields, 'actionListActions']}
|
|
268
|
+
{...restOfMclProps}
|
|
219
269
|
/>
|
|
220
270
|
</>
|
|
221
271
|
);
|
|
@@ -61,5 +61,9 @@ actionAssigner | function | A function which will be passed the entire row objec
|
|
|
61
61
|
actionCalls | object<function> | An object with keys matching any "actions" the `actionAssigner` may have assigned (In addition to special case `create`, if relevant), and values which are functions. These functions will be handed the row as a parameter. | {} | ✕ |
|
|
62
62
|
columnMapping | object | An object which will act on the rendered MultiColumnList headers to map the labels for each `visibleField` | | ✕ |
|
|
63
63
|
contentData | array | An array of objects to render along with their actions | | ✓ |
|
|
64
|
-
|
|
64
|
+
creatableFields | object<function> | An object with keys from the `visibleFields` array, and values of functions which take the entire row object and return a boolean indicating whether that field is fillable on create or not. | | ✕ |
|
|
65
|
+
editableFields | object<function> | An object with keys from the `visibleFields` array, and values of functions which take the entire row object and return a boolean indicating whether that field is editable or not. No key for a given field will be interpreted as () => true, so a field is editable by default. | | ✕ |
|
|
66
|
+
fieldComponents | object<function> | An object with keys from the `visibleFields` array, and values of functions which take some `fieldProps` (currently only the name of the field `name`), and returns a Field component to be used in "edit mode" for the visible field specified. | | ✕ |
|
|
67
|
+
formatter | object<function> | A "formatter" object that takes the same shape as an MCL formatter, and is used in the same way whilst a row is NOT being edited. While editing a given row, this formatter entry is ignored. | | ✕ |
|
|
65
68
|
visibleFields | array<String> | An array of strings corresponding to those fields to be displayed in the rendered MultiColumnList | | ✓ |
|
|
69
|
+
...mclProps | any | Any other props supplied to ActionList will be applied to the MCL directly. *WARNING* Some MCL props may override important functionality within ActionList | | ✕ |
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { FormattedMessage } from 'react-intl';
|
|
5
|
+
|
|
6
|
+
import debounce from 'lodash/debounce';
|
|
7
|
+
|
|
8
|
+
import { Col, MultiColumnList, Row, Spinner, Select } from '@folio/stripes/components';
|
|
9
|
+
|
|
10
|
+
import SearchField from '../../SearchField';
|
|
11
|
+
import { useCustomProperties } from '../../hooks';
|
|
12
|
+
|
|
13
|
+
const DEBOUNCE_TIME = 500;
|
|
14
|
+
|
|
15
|
+
const CustomPropertiesLookup = ({
|
|
16
|
+
contextFilterOptions, // expects an array of the form [{value: "OpenAccess", label: "Open Access"}, {value: false, label: "None"}]
|
|
17
|
+
customPropertiesEndpoint: endpoint,
|
|
18
|
+
labelOverrides,
|
|
19
|
+
mclProps,
|
|
20
|
+
onSelectCustomProperty,
|
|
21
|
+
queryParams
|
|
22
|
+
}) => {
|
|
23
|
+
const [nsValues, setNsValues] = useState({
|
|
24
|
+
sort: 'id'
|
|
25
|
+
});
|
|
26
|
+
const [selectedContext, setSelectedContext] = useState();
|
|
27
|
+
|
|
28
|
+
const { data: custprops, isLoading } = useCustomProperties({
|
|
29
|
+
endpoint,
|
|
30
|
+
nsValues,
|
|
31
|
+
queryParams,
|
|
32
|
+
returnQueryObject: true,
|
|
33
|
+
ctx: selectedContext
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const handleSearch = debounce((query) => {
|
|
37
|
+
setNsValues({
|
|
38
|
+
...nsValues,
|
|
39
|
+
query,
|
|
40
|
+
});
|
|
41
|
+
}, DEBOUNCE_TIME);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<>
|
|
45
|
+
<SearchField fullWidth onChange={e => handleSearch(e.target.value)} />
|
|
46
|
+
<Row>
|
|
47
|
+
<Col xs={6}>
|
|
48
|
+
<Select
|
|
49
|
+
dataOptions={contextFilterOptions}
|
|
50
|
+
onChange={(e) => {
|
|
51
|
+
setSelectedContext(e.target.value);
|
|
52
|
+
}}
|
|
53
|
+
value={selectedContext}
|
|
54
|
+
/>
|
|
55
|
+
</Col>
|
|
56
|
+
</Row>
|
|
57
|
+
{isLoading ?
|
|
58
|
+
<Spinner /> :
|
|
59
|
+
<MultiColumnList
|
|
60
|
+
columnMapping={{
|
|
61
|
+
'label': labelOverrides?.label ?? <FormattedMessage id="stripes-kint-components.customProperties.label" />,
|
|
62
|
+
'primary': labelOverrides?.primary ?? <FormattedMessage id="stripes-kint-components.customProperties.primary" />,
|
|
63
|
+
'ctx': labelOverrides?.ctx ?? <FormattedMessage id="stripes-kint-components.customProperties.ctx" />,
|
|
64
|
+
'weight': labelOverrides?.weight ?? <FormattedMessage id="stripes-kint-components.customProperties.weight" />,
|
|
65
|
+
'type': labelOverrides?.type ?? <FormattedMessage id="stripes-kint-components.customProperties.type" />,
|
|
66
|
+
'category': labelOverrides?.category ?? <FormattedMessage id="stripes-kint-components.customProperties.category" />
|
|
67
|
+
}}
|
|
68
|
+
contentData={custprops}
|
|
69
|
+
formatter={{
|
|
70
|
+
primary: data => {
|
|
71
|
+
if (data?.primary) {
|
|
72
|
+
return (
|
|
73
|
+
<FormattedMessage id="stripes-kint-components.yes" />
|
|
74
|
+
);
|
|
75
|
+
} else {
|
|
76
|
+
return (
|
|
77
|
+
<FormattedMessage id="stripes-kint-components.no" />
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
type: data => (
|
|
82
|
+
<FormattedMessage id={`stripes-kint-components.customProperties.type.${data?.type}`} />
|
|
83
|
+
),
|
|
84
|
+
category: data => data?.category?.desc
|
|
85
|
+
}}
|
|
86
|
+
onRowClick={onSelectCustomProperty}
|
|
87
|
+
visibleColumns={['label', 'primary', 'ctx', 'weight', 'type', 'category']}
|
|
88
|
+
{...mclProps}
|
|
89
|
+
/>
|
|
90
|
+
}
|
|
91
|
+
</>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
CustomPropertiesLookup.propTypes = {
|
|
96
|
+
contextFilterOptions: PropTypes.arrayOf(PropTypes.shape({
|
|
97
|
+
value: PropTypes.string,
|
|
98
|
+
label: PropTypes.oneOfType([
|
|
99
|
+
PropTypes.element,
|
|
100
|
+
PropTypes.string
|
|
101
|
+
])
|
|
102
|
+
})),
|
|
103
|
+
customPropertiesEndpoint: PropTypes.string,
|
|
104
|
+
labelOverrides: PropTypes.object,
|
|
105
|
+
mclProps: PropTypes.object,
|
|
106
|
+
onSelectCustomProperty: PropTypes.func,
|
|
107
|
+
queryParams: PropTypes.object,
|
|
108
|
+
refdataEndpoint: PropTypes.string,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default CustomPropertiesLookup;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import compose from 'compose-function';
|
|
5
|
+
|
|
6
|
+
import { FormattedMessage, useIntl } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
import { useQueryClient } from 'react-query';
|
|
9
|
+
|
|
10
|
+
import SafeHTMLMessage from '@folio/react-intl-safe-html';
|
|
11
|
+
|
|
12
|
+
import { Button, ConfirmationModal, Pane } from '@folio/stripes/components';
|
|
13
|
+
|
|
14
|
+
import FormModal from '../../FormModal/FormModal';
|
|
15
|
+
|
|
16
|
+
import CustomPropertiesLookup from './CustomPropertiesLookup';
|
|
17
|
+
import CustomPropertiesView from './CustomPropertiesView';
|
|
18
|
+
import CustomPropertiesForm from './CustomPropertyForm';
|
|
19
|
+
import { useMutateCustomProperties, useRefdata } from '../../hooks';
|
|
20
|
+
|
|
21
|
+
const EDITING = 'edit';
|
|
22
|
+
const CREATING = 'create';
|
|
23
|
+
const VIEWING = 'view';
|
|
24
|
+
|
|
25
|
+
// A default option for setting up panes manually
|
|
26
|
+
const CustomPropertiesSettings = ({
|
|
27
|
+
afterQueryCalls,
|
|
28
|
+
contextFilterOptions,
|
|
29
|
+
customPropertiesEndpoint,
|
|
30
|
+
helpPopovers,
|
|
31
|
+
labelOverrides,
|
|
32
|
+
refdataEndpoint,
|
|
33
|
+
}) => {
|
|
34
|
+
const queryClient = useQueryClient();
|
|
35
|
+
|
|
36
|
+
const intl = useIntl();
|
|
37
|
+
const [customProperty, setCustomProperty] = useState();
|
|
38
|
+
const [deleteModal, setDeleteModal] = useState(false);
|
|
39
|
+
|
|
40
|
+
const refdata = useRefdata({
|
|
41
|
+
endpoint: refdataEndpoint,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const [mode, setMode] = useState(VIEWING);
|
|
45
|
+
|
|
46
|
+
// Default props that need hooks are hard
|
|
47
|
+
let renderContextFilterOptions = contextFilterOptions;
|
|
48
|
+
if (!contextFilterOptions) {
|
|
49
|
+
/*
|
|
50
|
+
Default is {value: '', label: 'All'}, empty string will map to ALL contexts
|
|
51
|
+
If null context is needed, use
|
|
52
|
+
{value: 'isNull', label: ...}
|
|
53
|
+
*/
|
|
54
|
+
renderContextFilterOptions = [
|
|
55
|
+
{
|
|
56
|
+
value: '', // empty string is all custoprop contexts
|
|
57
|
+
label: intl.formatMessage({ id: 'stripes-kint-components.customProperties.all' })
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let renderViewPaneTitle = labelOverrides?.viewPaneTitle;
|
|
63
|
+
if (renderViewPaneTitle instanceof Function) {
|
|
64
|
+
renderViewPaneTitle = renderViewPaneTitle(customProperty);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Defaulting is hard
|
|
68
|
+
const afterQueryCallsSafe = {
|
|
69
|
+
put: () => null,
|
|
70
|
+
post: () => null,
|
|
71
|
+
delete: () => null,
|
|
72
|
+
...afterQueryCalls
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const {
|
|
76
|
+
post: createCustprop,
|
|
77
|
+
put: editCustProp,
|
|
78
|
+
delete: deleteCustProp
|
|
79
|
+
} = useMutateCustomProperties({
|
|
80
|
+
afterQueryCalls: {
|
|
81
|
+
put: () => {
|
|
82
|
+
setMode(VIEWING);
|
|
83
|
+
queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
|
|
84
|
+
afterQueryCallsSafe.put();
|
|
85
|
+
},
|
|
86
|
+
post: () => {
|
|
87
|
+
setMode(VIEWING);
|
|
88
|
+
queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
|
|
89
|
+
afterQueryCallsSafe.post();
|
|
90
|
+
},
|
|
91
|
+
delete: () => {
|
|
92
|
+
setMode(VIEWING);
|
|
93
|
+
queryClient.invalidateQueries(['stripes-kint-components', 'useCustomProperties', 'custprops']);
|
|
94
|
+
afterQueryCallsSafe.delete();
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
endpoint: customPropertiesEndpoint,
|
|
98
|
+
id: customProperty?.id
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const handeContextSubmit = (submitData) => {
|
|
102
|
+
return {
|
|
103
|
+
...submitData,
|
|
104
|
+
ctx: submitData?.ctx?.[0]?.value
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<>
|
|
110
|
+
<Pane
|
|
111
|
+
defaultWidth="fill"
|
|
112
|
+
id="settings-customProperties.lookupPane"
|
|
113
|
+
lastMenu={
|
|
114
|
+
<Button
|
|
115
|
+
marginBottom0
|
|
116
|
+
onClick={() => setMode(CREATING)} // TODO do we need to clear form here too?
|
|
117
|
+
>
|
|
118
|
+
<FormattedMessage id="stripes-kint-components.create" />
|
|
119
|
+
</Button>
|
|
120
|
+
}
|
|
121
|
+
paneTitle={labelOverrides.paneTitle ??
|
|
122
|
+
<FormattedMessage id="stripes-kint-components.customProperties" /> // This should be configurable?
|
|
123
|
+
}
|
|
124
|
+
>
|
|
125
|
+
<CustomPropertiesLookup
|
|
126
|
+
contextFilterOptions={renderContextFilterOptions}
|
|
127
|
+
customPropertiesEndpoint={customPropertiesEndpoint}
|
|
128
|
+
labelOverrides={labelOverrides}
|
|
129
|
+
onSelectCustomProperty={(_e, cp) => setCustomProperty(cp)}
|
|
130
|
+
/>
|
|
131
|
+
</Pane>
|
|
132
|
+
{customProperty &&
|
|
133
|
+
<Pane
|
|
134
|
+
actionMenu={({ onToggle }) => (
|
|
135
|
+
[
|
|
136
|
+
<Button
|
|
137
|
+
buttonStyle="dropdownItem"
|
|
138
|
+
marginBottom0
|
|
139
|
+
onClick={() => setMode(EDITING)}
|
|
140
|
+
>
|
|
141
|
+
<FormattedMessage id="stripes-kint-components.edit" />
|
|
142
|
+
</Button>,
|
|
143
|
+
<Button
|
|
144
|
+
buttonStyle="dropdownItem"
|
|
145
|
+
marginBottom0
|
|
146
|
+
onClick={() => {
|
|
147
|
+
setDeleteModal(true);
|
|
148
|
+
onToggle();
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
<FormattedMessage id="stripes-kint-components.delete" />
|
|
152
|
+
</Button>
|
|
153
|
+
]
|
|
154
|
+
)}
|
|
155
|
+
defaultWidth="fill"
|
|
156
|
+
dismissible
|
|
157
|
+
id="settings-customProperties-viewPane"
|
|
158
|
+
onClose={() => setCustomProperty()}
|
|
159
|
+
paneTitle={
|
|
160
|
+
renderViewPaneTitle ?? customProperty?.label ?? customProperty?.name
|
|
161
|
+
}
|
|
162
|
+
>
|
|
163
|
+
<CustomPropertiesView
|
|
164
|
+
customProperty={customProperty}
|
|
165
|
+
labelOverrides={labelOverrides}
|
|
166
|
+
/>
|
|
167
|
+
</Pane>
|
|
168
|
+
}
|
|
169
|
+
<FormModal
|
|
170
|
+
initialValues={mode === CREATING ?
|
|
171
|
+
{
|
|
172
|
+
weight: 0,
|
|
173
|
+
primary: true,
|
|
174
|
+
defaultInternal: true
|
|
175
|
+
} :
|
|
176
|
+
{
|
|
177
|
+
...customProperty,
|
|
178
|
+
ctx: customProperty?.ctx ? [{ value: customProperty.ctx, label: customProperty.ctx }] : null
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
modalProps={{
|
|
182
|
+
dismissible: true,
|
|
183
|
+
onClose: () => setMode(VIEWING),
|
|
184
|
+
open: (mode === CREATING || mode === EDITING)
|
|
185
|
+
}}
|
|
186
|
+
onSubmit={mode === CREATING ?
|
|
187
|
+
compose(createCustprop, handeContextSubmit) :
|
|
188
|
+
compose(editCustProp, handeContextSubmit)
|
|
189
|
+
}
|
|
190
|
+
>
|
|
191
|
+
<CustomPropertiesForm
|
|
192
|
+
contextFilterOptions={renderContextFilterOptions}
|
|
193
|
+
helpPopovers={helpPopovers}
|
|
194
|
+
labelOverrides={labelOverrides}
|
|
195
|
+
refdata={refdata.map(rdc => ({ label: rdc.desc, value: rdc.id }))}
|
|
196
|
+
/>
|
|
197
|
+
</FormModal>
|
|
198
|
+
<ConfirmationModal
|
|
199
|
+
buttonStyle="danger"
|
|
200
|
+
confirmLabel={
|
|
201
|
+
labelOverrides?.confirmLabel ??
|
|
202
|
+
<FormattedMessage id="stripes-kint-components.customProperties.delete.confirmLabel" />
|
|
203
|
+
}
|
|
204
|
+
heading={
|
|
205
|
+
labelOverrides?.confirmHeading ??
|
|
206
|
+
<FormattedMessage id="stripes-kint-components.customProperties.delete.confirmHeading" />
|
|
207
|
+
}
|
|
208
|
+
id="delete-job-confirmation"
|
|
209
|
+
message={
|
|
210
|
+
labelOverrides?.confirmMessage ??
|
|
211
|
+
<SafeHTMLMessage id="stripes-kint-components.customProperties.delete.confirmMessage" values={{ name: customProperty?.name }} />
|
|
212
|
+
}
|
|
213
|
+
onCancel={() => setDeleteModal(false)}
|
|
214
|
+
onConfirm={() => {
|
|
215
|
+
deleteCustProp();
|
|
216
|
+
setCustomProperty();
|
|
217
|
+
setDeleteModal(false);
|
|
218
|
+
}}
|
|
219
|
+
open={deleteModal}
|
|
220
|
+
/>
|
|
221
|
+
</>
|
|
222
|
+
);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
CustomPropertiesSettings.propTypes = {
|
|
226
|
+
afterQueryCalls: PropTypes.object,
|
|
227
|
+
contextFilterOptions: PropTypes.arrayOf(PropTypes.shape({
|
|
228
|
+
value: PropTypes.string,
|
|
229
|
+
label: PropTypes.oneOfType([
|
|
230
|
+
PropTypes.element,
|
|
231
|
+
PropTypes.string
|
|
232
|
+
])
|
|
233
|
+
})),
|
|
234
|
+
customPropertiesEndpoint: PropTypes.string,
|
|
235
|
+
helpPopovers: PropTypes.object,
|
|
236
|
+
labelOverrides: PropTypes.object,
|
|
237
|
+
refdataEndpoint: PropTypes.string,
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export default CustomPropertiesSettings;
|