@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.
Files changed (326) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/es/index.js +49 -8
  3. package/es/lib/ActionList/ActionList.js +51 -26
  4. package/es/lib/ActionList/ActionListFieldArray.js +84 -27
  5. package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +198 -0
  6. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +326 -0
  7. package/es/lib/CustomProperties/Config/CustomPropertiesView.js +166 -0
  8. package/es/lib/CustomProperties/Config/CustomPropertyForm.js +360 -0
  9. package/es/lib/CustomProperties/Config/index.js +41 -0
  10. package/es/lib/EditableRefdataList/EditableRefdataList.js +17 -9
  11. package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +2 -2
  12. package/es/lib/EditableSettingsList/SettingField/SettingField.js +3 -3
  13. package/es/lib/FormModal/FormModal.js +126 -0
  14. package/es/lib/{TypeDown → FormModal}/index.js +2 -2
  15. package/es/lib/NoResultsMessage/NoResultsMessage.js +1 -1
  16. package/es/lib/QueryTypedown/QueryTypedown.js +3 -3
  17. package/es/lib/RefdataButtons/RefdataButtons.js +2 -2
  18. package/es/lib/SASQLookupComponent/SASQLookupComponent.js +8 -3
  19. package/es/lib/SASQRoute/SASQRoute.js +2 -2
  20. package/es/lib/SASQViewComponent/SASQViewComponent.js +2 -2
  21. package/es/lib/SearchField/SearchField.js +2 -2
  22. package/es/lib/SettingPage/SettingPage.js +1 -1
  23. package/es/lib/SettingPage/SettingPagePane.js +1 -1
  24. package/es/lib/Typedown/Typedown.js +45 -14
  25. package/es/lib/constants/customProperties.js +60 -0
  26. package/es/lib/hooks/index.js +16 -0
  27. package/es/lib/hooks/settingsHooks/useSettings.js +3 -3
  28. package/es/lib/hooks/useCustomProperties.js +112 -0
  29. package/es/lib/hooks/useHelperApp.js +3 -3
  30. package/es/lib/hooks/useKiwtFieldArray.js +2 -2
  31. package/es/lib/hooks/useKiwtSASQuery.js +3 -3
  32. package/es/lib/hooks/useLocalStorageState.js +1 -1
  33. package/es/lib/hooks/useMutateCustomProperties.js +143 -0
  34. package/es/lib/hooks/useQIndex.js +3 -3
  35. package/es/lib/hooks/useRefdata.js +3 -9
  36. package/es/lib/utils/index.js +8 -0
  37. package/es/lib/utils/refdataOptions.js +43 -0
  38. package/junit.xml +38 -38
  39. package/package.json +5 -3
  40. package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +58 -29
  41. package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +167 -18
  42. package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +13 -14
  43. package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +2 -3
  44. 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
  45. 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
  46. 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
  47. 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
  48. package/{artifacts/coverage-jest/lcov-report/src/lib/hooks/typedownHooks → src/artifacts/coverage-jest/lcov-report/CustomProperties/Config}/index.html +55 -41
  49. package/{artifacts/coverage-jest/lcov-report/src/lib/hooks/typedownHooks → src/artifacts/coverage-jest/lcov-report/CustomProperties/Config}/index.js.html +18 -16
  50. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +24 -13
  51. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +8 -9
  52. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +2 -3
  53. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +2 -3
  54. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +2 -3
  55. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +2 -3
  56. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +2 -3
  57. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +2 -3
  58. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +2 -3
  59. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +2 -3
  60. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +2 -3
  61. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +2 -3
  62. package/{artifacts/coverage-jest/lcov-report/src/index.js.html → src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html} +86 -93
  63. package/src/artifacts/coverage-jest/lcov-report/{TypeDown → FormModal}/index.html +15 -16
  64. package/src/artifacts/coverage-jest/lcov-report/{TypeDown → FormModal}/index.js.html +5 -6
  65. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +4 -5
  66. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +2 -3
  67. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +2 -3
  68. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +2 -3
  69. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +2 -3
  70. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +2 -3
  71. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +4 -5
  72. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +2 -3
  73. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +2 -3
  74. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +25 -8
  75. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +10 -11
  76. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +2 -3
  77. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +2 -3
  78. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +2 -3
  79. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +2 -3
  80. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +2 -3
  81. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +2 -3
  82. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +2 -3
  83. package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +2 -3
  84. package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +2 -3
  85. package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +2 -3
  86. package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +2 -3
  87. package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +2 -3
  88. package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +2 -3
  89. package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +2 -3
  90. package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +141 -16
  91. package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +8 -9
  92. package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +2 -3
  93. package/{artifacts/coverage-jest/lcov-report/src/lib/utils/sortByLabel.js.html → src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html} +28 -47
  94. package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +2 -3
  95. package/src/artifacts/coverage-jest/lcov-report/constants/index.html +19 -5
  96. package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +2 -3
  97. package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +2 -3
  98. package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +2 -3
  99. package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +36 -7
  100. package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +9 -4
  101. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +2 -3
  102. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +2 -3
  103. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +2 -3
  104. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +2 -3
  105. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +6 -7
  106. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +2 -3
  107. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +32 -36
  108. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +2 -3
  109. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +2 -3
  110. package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +2 -3
  111. package/{artifacts/coverage-jest/lcov-report/src/lib/hooks/useRefdata.js.html → src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html} +64 -47
  112. package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +2 -3
  113. package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +2 -3
  114. package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +2 -3
  115. package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +2 -3
  116. package/{artifacts/coverage-jest/lcov-report/src/lib/hooks/useMutateRefdataValue.js.html → src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html} +43 -74
  117. package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +2 -3
  118. package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +2 -3
  119. package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +5 -24
  120. package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +2 -3
  121. package/src/artifacts/coverage-jest/lcov-report/index.html +72 -58
  122. package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +2 -3
  123. package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +2 -3
  124. package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +2 -3
  125. package/src/artifacts/coverage-jest/lcov-report/utils/index.html +21 -22
  126. package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +9 -4
  127. package/{artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/index.js.html → src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html} +27 -16
  128. package/src/artifacts/coverage-jest/lcov-report/utils/renderHelpText.js.html +2 -3
  129. package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +2 -3
  130. package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +2 -3
  131. package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +2 -3
  132. package/src/artifacts/coverage-jest/lcov.info +924 -552
  133. package/src/index.js +12 -4
  134. package/src/lib/ActionList/ActionList.js +32 -22
  135. package/src/lib/ActionList/ActionListFieldArray.js +60 -10
  136. package/src/lib/ActionList/README.md +5 -1
  137. package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +111 -0
  138. package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +240 -0
  139. package/src/lib/CustomProperties/Config/CustomPropertiesView.js +150 -0
  140. package/src/lib/CustomProperties/Config/CustomPropertyForm.js +296 -0
  141. package/src/lib/CustomProperties/Config/index.js +4 -0
  142. package/src/lib/EditableRefdataList/EditableRefdataList.js +9 -5
  143. package/src/lib/FormModal/FormModal.js +71 -0
  144. package/src/lib/FormModal/index.js +1 -0
  145. package/src/lib/NoResultsMessage/NoResultsMessage.js +2 -2
  146. package/src/lib/SASQLookupComponent/SASQLookupComponent.js +6 -0
  147. package/src/lib/Typedown/Typedown.js +50 -8
  148. package/src/lib/constants/customProperties.js +9 -0
  149. package/src/lib/hooks/index.js +2 -0
  150. package/src/lib/hooks/useCustomProperties.js +73 -0
  151. package/src/lib/hooks/useMutateCustomProperties.js +62 -0
  152. package/src/lib/hooks/useRefdata.js +2 -8
  153. package/src/lib/utils/index.js +2 -0
  154. package/src/lib/utils/refdataOptions.js +7 -0
  155. package/translations/stripes-kint-components/en.json +49 -1
  156. package/artifacts/coverage-jest/lcov-report/base.css +0 -224
  157. package/artifacts/coverage-jest/lcov-report/block-navigation.js +0 -87
  158. package/artifacts/coverage-jest/lcov-report/es/lib/ActionList/ActionList.js.html +0 -389
  159. package/artifacts/coverage-jest/lcov-report/es/lib/ActionList/ActionListFieldArray.js.html +0 -1076
  160. package/artifacts/coverage-jest/lcov-report/es/lib/ActionList/index.html +0 -147
  161. package/artifacts/coverage-jest/lcov-report/es/lib/ActionList/index.js.html +0 -140
  162. package/artifacts/coverage-jest/lcov-report/es/lib/EditableRefdataList/EditableRefdataList.js.html +0 -680
  163. package/artifacts/coverage-jest/lcov-report/es/lib/EditableRefdataList/index.html +0 -132
  164. package/artifacts/coverage-jest/lcov-report/es/lib/EditableRefdataList/index.js.html +0 -140
  165. package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/EditableSettingsList.js.html +0 -353
  166. package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js.html +0 -353
  167. package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/SettingField/EditSettingValue.js.html +0 -482
  168. package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js.html +0 -434
  169. package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/SettingField/SettingField.js.html +0 -644
  170. package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/SettingField/index.html +0 -162
  171. package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/SettingField/index.js.html +0 -188
  172. package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/index.html +0 -147
  173. package/artifacts/coverage-jest/lcov-report/es/lib/EditableSettingsList/index.js.html +0 -188
  174. package/artifacts/coverage-jest/lcov-report/es/lib/NoResultsMessage/NoResultsMessage.js.html +0 -449
  175. package/artifacts/coverage-jest/lcov-report/es/lib/NoResultsMessage/index.html +0 -132
  176. package/artifacts/coverage-jest/lcov-report/es/lib/NoResultsMessage/index.js.html +0 -140
  177. package/artifacts/coverage-jest/lcov-report/es/lib/QueryTypedown/QueryTypedown.js.html +0 -413
  178. package/artifacts/coverage-jest/lcov-report/es/lib/QueryTypedown/index.html +0 -132
  179. package/artifacts/coverage-jest/lcov-report/es/lib/QueryTypedown/index.js.html +0 -140
  180. package/artifacts/coverage-jest/lcov-report/es/lib/RefdataButtons/RefdataButtons.js.html +0 -512
  181. package/artifacts/coverage-jest/lcov-report/es/lib/RefdataButtons/index.html +0 -132
  182. package/artifacts/coverage-jest/lcov-report/es/lib/RefdataButtons/index.js.html +0 -140
  183. package/artifacts/coverage-jest/lcov-report/es/lib/SASQLookupComponent/SASQLookupComponent.js.html +0 -1115
  184. package/artifacts/coverage-jest/lcov-report/es/lib/SASQLookupComponent/index.html +0 -132
  185. package/artifacts/coverage-jest/lcov-report/es/lib/SASQLookupComponent/index.js.html +0 -140
  186. package/artifacts/coverage-jest/lcov-report/es/lib/SASQRoute/SASQRoute.js.html +0 -404
  187. package/artifacts/coverage-jest/lcov-report/es/lib/SASQRoute/index.html +0 -132
  188. package/artifacts/coverage-jest/lcov-report/es/lib/SASQRoute/index.js.html +0 -140
  189. package/artifacts/coverage-jest/lcov-report/es/lib/SASQViewComponent/SASQViewComponent.js.html +0 -413
  190. package/artifacts/coverage-jest/lcov-report/es/lib/SASQViewComponent/index.html +0 -132
  191. package/artifacts/coverage-jest/lcov-report/es/lib/SASQViewComponent/index.js.html +0 -140
  192. package/artifacts/coverage-jest/lcov-report/es/lib/SearchField/SearchField.js.html +0 -353
  193. package/artifacts/coverage-jest/lcov-report/es/lib/SearchField/index.html +0 -132
  194. package/artifacts/coverage-jest/lcov-report/es/lib/SearchField/index.js.html +0 -140
  195. package/artifacts/coverage-jest/lcov-report/es/lib/SettingPage/SettingPage.js.html +0 -380
  196. package/artifacts/coverage-jest/lcov-report/es/lib/SettingPage/SettingPagePane.js.html +0 -308
  197. package/artifacts/coverage-jest/lcov-report/es/lib/SettingPage/index.html +0 -147
  198. package/artifacts/coverage-jest/lcov-report/es/lib/SettingPage/index.js.html +0 -164
  199. package/artifacts/coverage-jest/lcov-report/es/lib/TypeDown/TypeDown.js.html +0 -839
  200. package/artifacts/coverage-jest/lcov-report/es/lib/TypeDown/index.html +0 -132
  201. package/artifacts/coverage-jest/lcov-report/es/lib/TypeDown/index.js.html +0 -140
  202. package/artifacts/coverage-jest/lcov-report/es/lib/Typedown/Typedown.js.html +0 -887
  203. package/artifacts/coverage-jest/lcov-report/es/lib/Typedown/index.html +0 -132
  204. package/artifacts/coverage-jest/lcov-report/es/lib/Typedown/index.js.html +0 -140
  205. package/artifacts/coverage-jest/lcov-report/es/lib/constants/eventCodes.js.html +0 -209
  206. package/artifacts/coverage-jest/lcov-report/es/lib/constants/index.html +0 -117
  207. package/artifacts/coverage-jest/lcov-report/es/lib/contexts/SettingsContext.js.html +0 -206
  208. package/artifacts/coverage-jest/lcov-report/es/lib/contexts/index.html +0 -132
  209. package/artifacts/coverage-jest/lcov-report/es/lib/contexts/index.js.html +0 -140
  210. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/index.html +0 -252
  211. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/index.js.html +0 -374
  212. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/settingsHooks/index.html +0 -147
  213. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/settingsHooks/index.js.html +0 -164
  214. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/settingsHooks/useSettingSection.js.html +0 -305
  215. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/settingsHooks/useSettings.js.html +0 -584
  216. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/typedownHooks/index.html +0 -162
  217. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/typedownHooks/index.js.html +0 -188
  218. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/typedownHooks/useTypedown.js.html +0 -644
  219. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/typedownHooks/useTypedownData.js.html +0 -335
  220. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/typedownHooks/useTypedownToggle.js.html +0 -350
  221. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useActiveElement.js.html +0 -323
  222. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useHelperApp.js.html +0 -488
  223. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useKiwtFieldArray.js.html +0 -509
  224. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useKiwtSASQuery.js.html +0 -467
  225. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useLocalStorageState.js.html +0 -329
  226. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useMutateRefdataValue.js.html +0 -488
  227. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useQIndex.js.html +0 -407
  228. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useRefdata.js.html +0 -401
  229. package/artifacts/coverage-jest/lcov-report/es/lib/hooks/useTemplates.js.html +0 -314
  230. package/artifacts/coverage-jest/lcov-report/es/lib/utils/buildUrl.js.html +0 -296
  231. package/artifacts/coverage-jest/lcov-report/es/lib/utils/generateKiwtQuery.js.html +0 -230
  232. package/artifacts/coverage-jest/lcov-report/es/lib/utils/generateKiwtQueryParams.js.html +0 -545
  233. package/artifacts/coverage-jest/lcov-report/es/lib/utils/getFocusableElements.js.html +0 -572
  234. package/artifacts/coverage-jest/lcov-report/es/lib/utils/index.html +0 -237
  235. package/artifacts/coverage-jest/lcov-report/es/lib/utils/index.js.html +0 -284
  236. package/artifacts/coverage-jest/lcov-report/es/lib/utils/renderHelpText.js.html +0 -410
  237. package/artifacts/coverage-jest/lcov-report/es/lib/utils/selectorSafe.js.html +0 -209
  238. package/artifacts/coverage-jest/lcov-report/es/lib/utils/sortByLabel.js.html +0 -248
  239. package/artifacts/coverage-jest/lcov-report/es/lib/utils/toCamelCase.js.html +0 -227
  240. package/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
  241. package/artifacts/coverage-jest/lcov-report/index.html +0 -717
  242. package/artifacts/coverage-jest/lcov-report/prettify.css +0 -1
  243. package/artifacts/coverage-jest/lcov-report/prettify.js +0 -2
  244. package/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
  245. package/artifacts/coverage-jest/lcov-report/sorter.js +0 -196
  246. package/artifacts/coverage-jest/lcov-report/src/index.html +0 -117
  247. package/artifacts/coverage-jest/lcov-report/src/lib/ActionList/ActionList.js.html +0 -248
  248. package/artifacts/coverage-jest/lcov-report/src/lib/ActionList/ActionListFieldArray.js.html +0 -764
  249. package/artifacts/coverage-jest/lcov-report/src/lib/ActionList/index.html +0 -147
  250. package/artifacts/coverage-jest/lcov-report/src/lib/ActionList/index.js.html +0 -89
  251. package/artifacts/coverage-jest/lcov-report/src/lib/EditableRefdataList/EditableRefdataList.js.html +0 -362
  252. package/artifacts/coverage-jest/lcov-report/src/lib/EditableRefdataList/index.html +0 -132
  253. package/artifacts/coverage-jest/lcov-report/src/lib/EditableRefdataList/index.js.html +0 -86
  254. package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/EditableSettingsList.js.html +0 -224
  255. package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/EditableSettingsListFieldArray.js.html +0 -212
  256. package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/SettingField/EditSettingValue.js.html +0 -308
  257. package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/SettingField/RenderSettingValue.js.html +0 -260
  258. package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/SettingField/index.html +0 -162
  259. package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/SettingField/index.js.html +0 -95
  260. package/artifacts/coverage-jest/lcov-report/src/lib/EditableSettingsList/index.html +0 -147
  261. package/artifacts/coverage-jest/lcov-report/src/lib/NoResultsMessage/NoResultsMessage.js.html +0 -320
  262. package/artifacts/coverage-jest/lcov-report/src/lib/NoResultsMessage/index.html +0 -132
  263. package/artifacts/coverage-jest/lcov-report/src/lib/NoResultsMessage/index.js.html +0 -89
  264. package/artifacts/coverage-jest/lcov-report/src/lib/QueryTypedown/QueryTypedown.js.html +0 -185
  265. package/artifacts/coverage-jest/lcov-report/src/lib/QueryTypedown/index.html +0 -132
  266. package/artifacts/coverage-jest/lcov-report/src/lib/QueryTypedown/index.js.html +0 -89
  267. package/artifacts/coverage-jest/lcov-report/src/lib/RefdataButtons/RefdataButtons.js.html +0 -371
  268. package/artifacts/coverage-jest/lcov-report/src/lib/RefdataButtons/index.html +0 -132
  269. package/artifacts/coverage-jest/lcov-report/src/lib/RefdataButtons/index.js.html +0 -89
  270. package/artifacts/coverage-jest/lcov-report/src/lib/SASQLookupComponent/index.html +0 -132
  271. package/artifacts/coverage-jest/lcov-report/src/lib/SASQLookupComponent/index.js.html +0 -89
  272. package/artifacts/coverage-jest/lcov-report/src/lib/SASQRoute/SASQRoute.js.html +0 -275
  273. package/artifacts/coverage-jest/lcov-report/src/lib/SASQRoute/index.html +0 -132
  274. package/artifacts/coverage-jest/lcov-report/src/lib/SASQRoute/index.js.html +0 -89
  275. package/artifacts/coverage-jest/lcov-report/src/lib/SASQViewComponent/SASQViewComponent.js.html +0 -251
  276. package/artifacts/coverage-jest/lcov-report/src/lib/SASQViewComponent/index.html +0 -132
  277. package/artifacts/coverage-jest/lcov-report/src/lib/SASQViewComponent/index.js.html +0 -89
  278. package/artifacts/coverage-jest/lcov-report/src/lib/SearchField/SearchField.js.html +0 -215
  279. package/artifacts/coverage-jest/lcov-report/src/lib/SearchField/index.html +0 -132
  280. package/artifacts/coverage-jest/lcov-report/src/lib/SearchField/index.js.html +0 -89
  281. package/artifacts/coverage-jest/lcov-report/src/lib/SettingPage/SettingPage.js.html +0 -212
  282. package/artifacts/coverage-jest/lcov-report/src/lib/SettingPage/SettingPagePane.js.html +0 -149
  283. package/artifacts/coverage-jest/lcov-report/src/lib/SettingPage/index.html +0 -147
  284. package/artifacts/coverage-jest/lcov-report/src/lib/SettingPage/index.js.html +0 -92
  285. package/artifacts/coverage-jest/lcov-report/src/lib/TypeDown/TypeDown.js.html +0 -764
  286. package/artifacts/coverage-jest/lcov-report/src/lib/TypeDown/index.html +0 -132
  287. package/artifacts/coverage-jest/lcov-report/src/lib/TypeDown/index.js.html +0 -89
  288. package/artifacts/coverage-jest/lcov-report/src/lib/Typedown/index.html +0 -132
  289. package/artifacts/coverage-jest/lcov-report/src/lib/Typedown/index.js.html +0 -89
  290. package/artifacts/coverage-jest/lcov-report/src/lib/constants/eventCodes.js.html +0 -95
  291. package/artifacts/coverage-jest/lcov-report/src/lib/constants/index.html +0 -117
  292. package/artifacts/coverage-jest/lcov-report/src/lib/contexts/SettingsContext.js.html +0 -98
  293. package/artifacts/coverage-jest/lcov-report/src/lib/contexts/index.html +0 -132
  294. package/artifacts/coverage-jest/lcov-report/src/lib/contexts/index.js.html +0 -86
  295. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/index.html +0 -252
  296. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/index.js.html +0 -116
  297. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/settingsHooks/index.html +0 -147
  298. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/settingsHooks/index.js.html +0 -92
  299. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/settingsHooks/useSettingSection.js.html +0 -164
  300. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/settingsHooks/useSettings.js.html +0 -377
  301. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/typedownHooks/useTypedownData.js.html +0 -164
  302. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/typedownHooks/useTypedownToggle.js.html +0 -164
  303. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useActiveElement.js.html +0 -158
  304. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useHelperApp.js.html +0 -284
  305. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useKiwtFieldArray.js.html +0 -275
  306. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useKiwtSASQuery.js.html +0 -179
  307. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useLocalStorageState.js.html +0 -137
  308. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useQIndex.js.html +0 -209
  309. package/artifacts/coverage-jest/lcov-report/src/lib/hooks/useTemplates.js.html +0 -167
  310. package/artifacts/coverage-jest/lcov-report/src/lib/utils/buildUrl.js.html +0 -194
  311. package/artifacts/coverage-jest/lcov-report/src/lib/utils/generateKiwtQuery.js.html +0 -110
  312. package/artifacts/coverage-jest/lcov-report/src/lib/utils/generateKiwtQueryParams.js.html +0 -287
  313. package/artifacts/coverage-jest/lcov-report/src/lib/utils/getFocusableElements.js.html +0 -380
  314. package/artifacts/coverage-jest/lcov-report/src/lib/utils/index.html +0 -237
  315. package/artifacts/coverage-jest/lcov-report/src/lib/utils/index.js.html +0 -116
  316. package/artifacts/coverage-jest/lcov-report/src/lib/utils/renderHelpText.js.html +0 -167
  317. package/artifacts/coverage-jest/lcov-report/src/lib/utils/selectorSafe.js.html +0 -104
  318. package/artifacts/coverage-jest/lcov-report/src/lib/utils/toCamelCase.js.html +0 -128
  319. package/artifacts/coverage-jest/lcov.info +0 -10040
  320. package/es/lib/TypeDown/TypeDown.js +0 -251
  321. package/src/artifacts/coverage-jest/lcov-report/TypeDown/TypeDown.js.html +0 -770
  322. package/src/artifacts/coverage-jest/lcov-report/utils/getFocusableElements.js.html +0 -386
  323. package/src/lib/TypeDown/README.md +0 -1
  324. package/src/lib/TypeDown/TypeDown.js +0 -228
  325. package/src/lib/TypeDown/index.js +0 -1
  326. 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
- visibleFields
28
+ fieldComponents = {},
29
+ visibleFields,
30
+ ...mclProps // Assume anything left over is to directly apply to the MCL
26
31
  }) => {
27
32
  return (
28
- <Form
29
- enableReinitialize
30
- initialValues={{ contentData }}
31
- mutators={arrayMutators}
32
- onSubmit={actionCalls.edit}
33
- subscription={{ contentData: true }}
34
- >
35
- {({ handleSubmit }) => (
36
- <form onSubmit={handleSubmit}>
37
- <FieldArray
38
- actionAssigner={actionAssigner}
39
- actionCalls={actionCalls}
40
- columnMapping={columnMapping}
41
- component={ActionListFieldArray}
42
- editableFields={editableFields}
43
- name="contentData"
44
- visibleFields={visibleFields}
45
- />
46
- </form>
47
- )}
48
- </Form>
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
- visibleFields
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
- change(fieldName, get(initialValues, fieldName));
109
- toggleEditing(data.id);
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 edit it in a Field
175
- If it does, then we check if the property has an editableField function,
176
- if it does we run it with the data. If not then we just return the Field
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
- 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. | | ✕ |
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;