@k-int/stripes-kint-components 2.8.1 → 3.0.0

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 (328) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/es/index.js +54 -12
  3. package/es/lib/ActionList/ActionList.js +11 -5
  4. package/es/lib/ActionList/ActionListFieldArray.js +147 -77
  5. package/es/lib/CustomProperties/Config/CustomPropertiesLookup.js +43 -31
  6. package/es/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +17 -14
  7. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.js +67 -47
  8. package/es/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +17 -24
  9. package/es/lib/CustomProperties/Config/CustomPropertyForm.js +91 -70
  10. package/es/lib/CustomProperties/Config/CustomPropertyForm.test.js +53 -36
  11. package/es/lib/CustomProperties/Config/CustomPropertyView.js +50 -31
  12. package/es/lib/CustomProperties/Config/CustomPropertyView.test.js +13 -14
  13. package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.js +6 -0
  14. package/es/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +8 -12
  15. package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +22 -24
  16. package/es/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +9 -12
  17. package/es/lib/CustomProperties/Edit/CustomPropertiesListField.js +62 -13
  18. package/es/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +12 -13
  19. package/es/lib/CustomProperties/Edit/CustomPropertyField.js +91 -44
  20. package/es/lib/CustomProperties/Edit/CustomPropertyField.test.js +80 -73
  21. package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.js +31 -32
  22. package/es/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +26 -24
  23. package/es/lib/CustomProperties/Edit/testResources.js +73 -908
  24. package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.js +21 -29
  25. package/es/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +12 -10
  26. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +38 -39
  27. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +28 -13
  28. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +29 -44
  29. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +6 -6
  30. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +16 -10
  31. package/es/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +12 -12
  32. package/es/lib/CustomProperties/Filter/CustomPropertiesRule.js +20 -11
  33. package/es/lib/CustomProperties/Filter/CustomPropertiesRule.test.js +4 -3
  34. package/es/lib/CustomProperties/Filter/testResources.js +37 -233
  35. package/es/lib/CustomProperties/Filter/useOperators.js +69 -27
  36. package/es/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +3 -2
  37. package/es/lib/CustomProperties/Filter/useValueProps.js +7 -2
  38. package/es/lib/CustomProperties/View/CustomPropertiesView.js +6 -0
  39. package/es/lib/CustomProperties/View/CustomPropertiesView.test.js +4 -3
  40. package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.js +13 -19
  41. package/es/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +4 -10
  42. package/es/lib/CustomProperties/View/CustomPropertyCard.js +34 -51
  43. package/es/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +38 -28
  44. package/es/lib/EditableRefdataList/EditableRefdataList.js +44 -32
  45. package/es/lib/EditableSettingsList/EditableSettingsList.js +11 -1
  46. package/es/lib/EditableSettingsList/EditableSettingsListFieldArray.js +10 -0
  47. package/es/lib/EditableSettingsList/SettingField/EditSettingValue.js +19 -11
  48. package/es/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +9 -8
  49. package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.js +21 -9
  50. package/es/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +1 -0
  51. package/es/lib/EditableSettingsList/SettingField/SettingField.js +83 -16
  52. package/es/lib/EditableSettingsList/SettingField/SettingField.test.js +138 -65
  53. package/es/lib/FormModal/FormModal.js +14 -9
  54. package/es/lib/FormattedKintMessage/FormattedKintMessage.js +91 -0
  55. package/es/lib/FormattedKintMessage/index.js +15 -0
  56. package/es/lib/IconSelect/IconSelect.js +18 -12
  57. package/es/lib/NoResultsMessage/NoResultsMessage.js +13 -2
  58. package/es/lib/RichSelect/RichSelect.js +13 -34
  59. package/es/lib/SASQLookupComponent/SASQLookupComponent.js +16 -5
  60. package/es/lib/SASQLookupComponent/TableBody/TableBody.js +11 -1
  61. package/es/lib/SettingPage/SettingPage.js +12 -13
  62. package/es/lib/SettingPage/SettingPagePane.js +12 -20
  63. package/es/lib/hooks/__mocks__/index.js +46 -0
  64. package/es/lib/hooks/index.js +24 -8
  65. package/es/lib/hooks/settingsHooks/useSettings.js +22 -17
  66. package/es/lib/hooks/useIntlKey.js +34 -0
  67. package/es/lib/hooks/useIntlKeyStore.js +84 -0
  68. package/es/lib/hooks/useKintIntl.js +93 -0
  69. package/es/lib/utils/index.js +48 -4
  70. package/es/lib/utils/parseErrorResponse.js +91 -0
  71. package/es/lib/utils/validators.js +76 -59
  72. package/jest.config.js +4 -1
  73. package/junit.xml +157 -656
  74. package/package.json +54 -33
  75. package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionList.js.html +56 -8
  76. package/src/artifacts/coverage-jest/lcov-report/ActionList/ActionListFieldArray.js.html +394 -64
  77. package/src/artifacts/coverage-jest/lcov-report/ActionList/index.html +10 -10
  78. package/src/artifacts/coverage-jest/lcov-report/ActionList/index.js.html +1 -1
  79. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesLookup.js.html +187 -52
  80. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertiesSettings.js.html +372 -87
  81. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyForm.js.html +293 -74
  82. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/CustomPropertyView.js.html +126 -54
  83. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.html +45 -60
  84. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Config/index.js.html +1 -1
  85. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEdit.js.html +23 -5
  86. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesEditCtx.js.html +59 -47
  87. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertiesListField.js.html +259 -97
  88. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyField.js.html +399 -105
  89. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/CustomPropertyFormCard.js.html +41 -68
  90. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.html +57 -57
  91. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/index.js.html +1 -1
  92. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Edit/testResources.js.html +67 -688
  93. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilter.js.html +92 -53
  94. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterField.js.html +103 -64
  95. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js.html +54 -63
  96. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesFilterForm.js.html +49 -16
  97. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/CustomPropertiesRule.js.html +69 -18
  98. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.html +89 -89
  99. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/index.js.html +1 -1
  100. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/testResources.js.html +33 -786
  101. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useOperators.js.html +46 -46
  102. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useParseActiveFilterStrings.js.html +45 -36
  103. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/Filter/useValueProps.js.html +43 -28
  104. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesView.js.html +20 -2
  105. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertiesViewCtx.js.html +50 -41
  106. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/CustomPropertyCard.js.html +54 -75
  107. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.html +24 -24
  108. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/index.js.html +1 -1
  109. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/View/testResources.js.html +1 -1
  110. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.html +1 -1
  111. package/src/artifacts/coverage-jest/lcov-report/CustomProperties/index.js.html +1 -1
  112. package/src/artifacts/coverage-jest/lcov-report/{hooks/useAvailableCustomProperties.js.html → CycleButton/CycleButton.js.html} +62 -50
  113. package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.html +131 -0
  114. package/src/artifacts/coverage-jest/lcov-report/CycleButton/index.js.html +88 -0
  115. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/EditableRefdataCategoryList.js.html +664 -0
  116. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.html +131 -0
  117. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataCategoryList/index.js.html +88 -0
  118. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/EditableRefdataList.js.html +264 -39
  119. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.html +9 -9
  120. package/src/artifacts/coverage-jest/lcov-report/EditableRefdataList/index.js.html +1 -1
  121. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsList.js.html +41 -14
  122. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/EditableSettingsListFieldArray.js.html +45 -6
  123. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/EditSettingValue.js.html +47 -11
  124. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/RenderSettingValue.js.html +65 -14
  125. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/SettingField.js.html +154 -31
  126. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.html +26 -26
  127. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/SettingField/index.js.html +1 -1
  128. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.html +18 -18
  129. package/src/artifacts/coverage-jest/lcov-report/EditableSettingsList/index.js.html +1 -1
  130. package/src/artifacts/coverage-jest/lcov-report/FormModal/FormModal.js.html +35 -17
  131. package/src/artifacts/coverage-jest/lcov-report/FormModal/index.html +15 -15
  132. package/src/artifacts/coverage-jest/lcov-report/FormModal/index.js.html +1 -1
  133. package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/FormattedKintMessage.js.html +247 -0
  134. package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.html +131 -0
  135. package/src/artifacts/coverage-jest/lcov-report/FormattedKintMessage/index.js.html +88 -0
  136. package/src/artifacts/coverage-jest/lcov-report/{CustomProperties/Config/CustomPropertiesView.js.html → IconSelect/IconSelect.js.html} +158 -257
  137. package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.html +131 -0
  138. package/src/artifacts/coverage-jest/lcov-report/IconSelect/index.js.html +88 -0
  139. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/NoResultsMessage.js.html +48 -6
  140. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.html +7 -7
  141. package/src/artifacts/coverage-jest/lcov-report/NoResultsMessage/index.js.html +1 -1
  142. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/QueryTypedown.js.html +1 -1
  143. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.html +1 -1
  144. package/src/artifacts/coverage-jest/lcov-report/QueryTypedown/index.js.html +1 -1
  145. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/RefdataButtons.js.html +3 -3
  146. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.html +1 -1
  147. package/src/artifacts/coverage-jest/lcov-report/RefdataButtons/index.js.html +1 -1
  148. package/src/artifacts/coverage-jest/lcov-report/{CustomProperties/Config/testResources.js.html → RichSelect/RichSelect.js.html} +256 -334
  149. package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.html +146 -0
  150. package/src/artifacts/coverage-jest/lcov-report/RichSelect/index.js.html +91 -0
  151. package/src/artifacts/coverage-jest/lcov-report/RichSelect/useSelectedOption.js.html +127 -0
  152. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/SASQLookupComponent.js.html +52 -7
  153. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/TableBody.js.html +31 -4
  154. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.html +3 -3
  155. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/TableBody/index.js.html +1 -1
  156. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.html +7 -7
  157. package/src/artifacts/coverage-jest/lcov-report/SASQLookupComponent/index.js.html +1 -1
  158. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/SASQRoute.js.html +1 -1
  159. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.html +1 -1
  160. package/src/artifacts/coverage-jest/lcov-report/SASQRoute/index.js.html +1 -1
  161. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/SASQViewComponent.js.html +1 -1
  162. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.html +1 -1
  163. package/src/artifacts/coverage-jest/lcov-report/SASQViewComponent/index.js.html +1 -1
  164. package/src/artifacts/coverage-jest/lcov-report/SearchField/SearchField.js.html +1 -1
  165. package/src/artifacts/coverage-jest/lcov-report/SearchField/index.html +1 -1
  166. package/src/artifacts/coverage-jest/lcov-report/SearchField/index.js.html +1 -1
  167. package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPage.js.html +24 -27
  168. package/src/artifacts/coverage-jest/lcov-report/SettingPage/SettingPagePane.js.html +47 -17
  169. package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.html +22 -22
  170. package/src/artifacts/coverage-jest/lcov-report/SettingPage/index.js.html +1 -1
  171. package/src/artifacts/coverage-jest/lcov-report/Typedown/Typedown.js.html +1 -1
  172. package/src/artifacts/coverage-jest/lcov-report/Typedown/index.html +1 -1
  173. package/src/artifacts/coverage-jest/lcov-report/Typedown/index.js.html +1 -1
  174. package/src/artifacts/coverage-jest/lcov-report/constants/customProperties.js.html +1 -1
  175. package/src/artifacts/coverage-jest/lcov-report/constants/eventCodes.js.html +1 -1
  176. package/src/artifacts/coverage-jest/lcov-report/constants/index.html +1 -1
  177. package/src/artifacts/coverage-jest/lcov-report/contexts/SettingsContext.js.html +2 -2
  178. package/src/artifacts/coverage-jest/lcov-report/contexts/index.html +1 -1
  179. package/src/artifacts/coverage-jest/lcov-report/contexts/index.js.html +1 -1
  180. package/src/artifacts/coverage-jest/lcov-report/favicon.png +0 -0
  181. package/src/artifacts/coverage-jest/lcov-report/hooks/index.html +142 -97
  182. package/src/artifacts/coverage-jest/lcov-report/hooks/index.js.html +13 -4
  183. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.html +35 -20
  184. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/index.js.html +5 -2
  185. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useAppSettings.js.html +7 -7
  186. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettingSection.js.html +7 -7
  187. package/src/artifacts/coverage-jest/lcov-report/hooks/settingsHooks/useSettings.js.html +61 -22
  188. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.html +1 -1
  189. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/index.js.html +1 -1
  190. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedown.js.html +1 -1
  191. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownData.js.html +1 -1
  192. package/src/artifacts/coverage-jest/lcov-report/hooks/typedownHooks/useTypedownToggle.js.html +1 -1
  193. package/src/artifacts/coverage-jest/lcov-report/hooks/useActiveElement.js.html +7 -7
  194. package/src/artifacts/coverage-jest/lcov-report/hooks/useCustomProperties.js.html +19 -22
  195. package/src/artifacts/coverage-jest/lcov-report/hooks/useHelperApp.js.html +7 -7
  196. package/src/artifacts/coverage-jest/lcov-report/hooks/useIntlKey.js.html +151 -0
  197. package/src/artifacts/coverage-jest/lcov-report/{utils/renderHelpText.js.html → hooks/useIntlKeyStore.js.html} +71 -38
  198. package/src/artifacts/coverage-jest/lcov-report/hooks/useInvalidateRefdata.js.html +7 -7
  199. package/src/artifacts/coverage-jest/lcov-report/hooks/useKintIntl.js.html +238 -0
  200. package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtFieldArray.js.html +7 -7
  201. package/src/artifacts/coverage-jest/lcov-report/hooks/useKiwtSASQuery.js.html +9 -9
  202. package/src/artifacts/coverage-jest/lcov-report/hooks/useLocalStorageState.js.html +7 -7
  203. package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateCustomProperties.js.html +23 -11
  204. package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataCategory.js.html +274 -0
  205. package/src/artifacts/coverage-jest/lcov-report/hooks/useMutateRefdataValue.js.html +19 -10
  206. package/src/artifacts/coverage-jest/lcov-report/hooks/useQIndex.js.html +7 -7
  207. package/src/artifacts/coverage-jest/lcov-report/hooks/useRefdata.js.html +9 -9
  208. package/src/artifacts/coverage-jest/lcov-report/hooks/useTemplates.js.html +7 -7
  209. package/src/artifacts/coverage-jest/lcov-report/index.html +205 -130
  210. package/src/artifacts/coverage-jest/lcov-report/sort-arrow-sprite.png +0 -0
  211. package/src/artifacts/coverage-jest/lcov-report/utils/buildUrl.js.html +1 -1
  212. package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQuery.js.html +2 -2
  213. package/src/artifacts/coverage-jest/lcov-report/utils/generateKiwtQueryParams.js.html +2 -2
  214. package/src/artifacts/coverage-jest/lcov-report/utils/groupCustomPropertiesByCtx.js.html +7 -7
  215. package/src/artifacts/coverage-jest/lcov-report/utils/highlightString.js.html +3 -3
  216. package/src/artifacts/coverage-jest/lcov-report/utils/index.html +34 -34
  217. package/src/artifacts/coverage-jest/lcov-report/utils/index.js.html +42 -3
  218. package/src/artifacts/coverage-jest/lcov-report/utils/matchString.js.html +2 -2
  219. package/src/artifacts/coverage-jest/lcov-report/utils/parseErrorResponse.js.html +139 -0
  220. package/src/artifacts/coverage-jest/lcov-report/utils/refdataOptions.js.html +5 -2
  221. package/src/artifacts/coverage-jest/lcov-report/utils/refdataQueryKey.js.html +2 -2
  222. package/src/artifacts/coverage-jest/lcov-report/utils/selectorSafe.js.html +2 -2
  223. package/src/artifacts/coverage-jest/lcov-report/utils/sortByLabel.js.html +2 -2
  224. package/src/artifacts/coverage-jest/lcov-report/utils/toCamelCase.js.html +2 -2
  225. package/src/artifacts/coverage-jest/lcov-report/utils/typedownQueryKey.js.html +2 -2
  226. package/src/artifacts/coverage-jest/lcov-report/utils/validators.js.html +128 -80
  227. package/src/artifacts/coverage-jest/lcov.info +2603 -2086
  228. package/src/index.js +12 -4
  229. package/src/lib/ActionList/ActionList.js +9 -3
  230. package/src/lib/ActionList/ActionListFieldArray.js +115 -37
  231. package/src/lib/ActionList/README.md +2 -1
  232. package/src/lib/CustomProperties/Config/CustomPropertiesLookup.js +60 -16
  233. package/src/lib/CustomProperties/Config/CustomPropertiesLookup.test.js +14 -4
  234. package/src/lib/CustomProperties/Config/CustomPropertiesSettings.js +109 -34
  235. package/src/lib/CustomProperties/Config/CustomPropertiesSettings.test.js +16 -9
  236. package/src/lib/CustomProperties/Config/CustomPropertyForm.js +131 -58
  237. package/src/lib/CustomProperties/Config/CustomPropertyForm.test.js +52 -33
  238. package/src/lib/CustomProperties/Config/CustomPropertyView.js +71 -47
  239. package/src/lib/CustomProperties/Config/CustomPropertyView.test.js +8 -6
  240. package/src/lib/CustomProperties/Config/README.md +33 -28
  241. package/src/lib/CustomProperties/Edit/CustomPropertiesEdit.js +6 -0
  242. package/src/lib/CustomProperties/Edit/CustomPropertiesEdit.test.js +7 -3
  243. package/src/lib/CustomProperties/Edit/CustomPropertiesEditCtx.js +23 -19
  244. package/src/lib/CustomProperties/Edit/CustomPropertiesEditCtx.test.js +5 -3
  245. package/src/lib/CustomProperties/Edit/CustomPropertiesListField.js +65 -11
  246. package/src/lib/CustomProperties/Edit/CustomPropertiesListField.test.js +10 -8
  247. package/src/lib/CustomProperties/Edit/CustomPropertyField.js +115 -21
  248. package/src/lib/CustomProperties/Edit/CustomPropertyField.test.js +59 -60
  249. package/src/lib/CustomProperties/Edit/CustomPropertyFormCard.js +24 -33
  250. package/src/lib/CustomProperties/Edit/CustomPropertyFormCard.test.js +20 -27
  251. package/src/lib/CustomProperties/Edit/testResources.js +46 -1047
  252. package/src/lib/CustomProperties/Filter/CustomPropertiesFilter.js +22 -22
  253. package/src/lib/CustomProperties/Filter/CustomPropertiesFilter.test.js +12 -8
  254. package/src/lib/CustomProperties/Filter/CustomPropertiesFilterField.js +44 -31
  255. package/src/lib/CustomProperties/Filter/CustomPropertiesFilterField.test.js +26 -13
  256. package/src/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.js +33 -36
  257. package/src/lib/CustomProperties/Filter/CustomPropertiesFilterFieldArray.test.js +3 -3
  258. package/src/lib/CustomProperties/Filter/CustomPropertiesFilterForm.js +19 -8
  259. package/src/lib/CustomProperties/Filter/CustomPropertiesFilterForm.test.js +9 -12
  260. package/src/lib/CustomProperties/Filter/CustomPropertiesRule.js +22 -5
  261. package/src/lib/CustomProperties/Filter/CustomPropertiesRule.test.js +3 -1
  262. package/src/lib/CustomProperties/Filter/testResources.js +14 -265
  263. package/src/lib/CustomProperties/Filter/useOperators.js +20 -20
  264. package/src/lib/CustomProperties/Filter/useParseActiveFilterStrings.js +2 -2
  265. package/src/lib/CustomProperties/Filter/useValueProps.js +8 -3
  266. package/src/lib/CustomProperties/View/CustomPropertiesView.js +6 -0
  267. package/src/lib/CustomProperties/View/CustomPropertiesView.test.js +2 -1
  268. package/src/lib/CustomProperties/View/CustomPropertiesViewCtx.js +15 -13
  269. package/src/lib/CustomProperties/View/CustomPropertiesViewCtx.test.js +2 -5
  270. package/src/lib/CustomProperties/View/CustomPropertyCard.js +36 -43
  271. package/src/lib/EditableRefdataCategoryList/EditableRefdataCategoryList.js +47 -28
  272. package/src/lib/EditableRefdataList/EditableRefdataList.js +58 -33
  273. package/src/lib/EditableSettingsList/EditableSettingsList.js +10 -1
  274. package/src/lib/EditableSettingsList/EditableSettingsListFieldArray.js +14 -1
  275. package/src/lib/EditableSettingsList/SettingField/EditSettingValue.js +17 -5
  276. package/src/lib/EditableSettingsList/SettingField/EditSettingValue.test.js +9 -8
  277. package/src/lib/EditableSettingsList/SettingField/RenderSettingValue.js +24 -7
  278. package/src/lib/EditableSettingsList/SettingField/RenderSettingValue.test.js +1 -0
  279. package/src/lib/EditableSettingsList/SettingField/SettingField.js +57 -16
  280. package/src/lib/EditableSettingsList/SettingField/SettingField.test.js +14 -19
  281. package/src/lib/FormModal/FormModal.js +15 -9
  282. package/src/lib/FormattedKintMessage/FormattedKintMessage.js +54 -0
  283. package/src/lib/FormattedKintMessage/index.js +1 -0
  284. package/src/lib/IconSelect/IconSelect.js +17 -8
  285. package/src/lib/NoResultsMessage/NoResultsMessage.js +15 -1
  286. package/src/lib/RichSelect/RichSelect.js +16 -36
  287. package/src/lib/SASQLookupComponent/SASQLookupComponent.js +17 -2
  288. package/src/lib/SASQLookupComponent/TableBody/TableBody.js +10 -1
  289. package/src/lib/SettingPage/SettingPage.js +12 -13
  290. package/src/lib/SettingPage/SettingPagePane.js +16 -6
  291. package/src/lib/hooks/__mocks__/index.js +17 -0
  292. package/src/lib/hooks/index.js +3 -1
  293. package/src/lib/hooks/settingsHooks/useSettings.js +25 -12
  294. package/src/lib/hooks/useIntlKey.js +22 -0
  295. package/src/lib/hooks/useIntlKeyStore.js +38 -0
  296. package/src/lib/hooks/useKintIntl.js +51 -0
  297. package/src/lib/utils/index.js +14 -1
  298. package/src/lib/utils/parseErrorResponse.js +18 -0
  299. package/src/lib/utils/validators.js +57 -41
  300. package/styles/RichSelect.css +7 -4
  301. package/test/helpers/test-implementor-translations.json +80 -0
  302. package/test/helpers/translationsProperties.js +6 -1
  303. package/test/jest/customProperties.js +166 -0
  304. package/test/jest/helpers/KintHarness.js +1 -1
  305. package/test/jest/helpers/renderWithKintHarness.js +2 -1
  306. package/test/jest/index.js +8 -0
  307. package/test/jest/refdata.js +471 -0
  308. package/test/jest/resolver.js +29 -0
  309. package/translations/stripes-kint-components/ar.json +1 -122
  310. package/translations/stripes-kint-components/cs_CZ.json +1 -122
  311. package/translations/stripes-kint-components/de.json +1 -122
  312. package/translations/stripes-kint-components/en.json +1 -148
  313. package/translations/stripes-kint-components/es.json +1 -122
  314. package/translations/stripes-kint-components/hi_IN.json +1 -122
  315. package/translations/stripes-kint-components/hu.json +1 -122
  316. package/translations/stripes-kint-components/it_IT.json +1 -122
  317. package/translations/stripes-kint-components/ja.json +1 -122
  318. package/translations/stripes-kint-components/ko.json +1 -122
  319. package/translations/stripes-kint-components/pt_PT.json +1 -122
  320. package/translations/stripes-kint-components/ru.json +1 -122
  321. package/translations/stripes-kint-components/sv.json +1 -122
  322. package/translations/stripes-kint-components/zh_CN.json +1 -122
  323. package/es/lib/CustomProperties/Config/testResources.js +0 -198
  324. package/es/lib/hooks/useAvailableCustomProperties.js +0 -73
  325. package/es/lib/utils/renderHelpText.js +0 -80
  326. package/src/lib/CustomProperties/Config/testResources.js +0 -236
  327. package/src/lib/hooks/useAvailableCustomProperties.js +0 -40
  328. package/src/lib/utils/renderHelpText.js +0 -27
@@ -1,15 +1,19 @@
1
1
  import PropTypes from 'prop-types';
2
- import { FormattedMessage } from 'react-intl';
3
2
  import { Col, InfoPopover, KeyValue, NoValue, Row } from '@folio/stripes/components';
4
3
 
4
+ import { useKintIntl } from '../../hooks';
5
5
  import { MULTI_REFDATA_CLASS_NAME, REFDATA_CLASS_NAME } from '../../constants/customProperties';
6
6
 
7
7
  // A default option for CustProp view pane, with the ability to override labels for fields
8
8
  const CustomPropertyView = ({
9
9
  customProperty,
10
10
  helpPopovers,
11
+ intlKey: passedIntlKey,
12
+ intlNS: passedIntlNS,
11
13
  labelOverrides = {}
12
14
  }) => {
15
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
16
+
13
17
  return (
14
18
  <>
15
19
  <Row>
@@ -17,8 +21,12 @@ const CustomPropertyView = ({
17
21
  <KeyValue
18
22
  label={
19
23
  <div>
20
- {labelOverrides?.label ??
21
- <FormattedMessage id="stripes-kint-components.customProperties.label" />}
24
+ {
25
+ kintIntl.formatKintMessage({
26
+ id: 'customProperties.label',
27
+ overrideValue: labelOverrides?.label
28
+ })
29
+ }
22
30
  {helpPopovers?.label ?
23
31
  <InfoPopover
24
32
  content={helpPopovers?.label}
@@ -32,8 +40,12 @@ const CustomPropertyView = ({
32
40
  <KeyValue
33
41
  label={
34
42
  <div>
35
- {labelOverrides?.name ??
36
- <FormattedMessage id="stripes-kint-components.customProperties.name" />}
43
+ {
44
+ kintIntl.formatKintMessage({
45
+ id: 'customProperties.name',
46
+ overrideValue: labelOverrides?.name
47
+ })
48
+ }
37
49
  {helpPopovers?.name ?
38
50
  <InfoPopover
39
51
  content={helpPopovers?.name}
@@ -48,8 +60,10 @@ const CustomPropertyView = ({
48
60
  <Col xs={12}>
49
61
  <KeyValue
50
62
  label={
51
- labelOverrides?.description ??
52
- <FormattedMessage id="stripes-kint-components.customProperties.description" />
63
+ kintIntl.formatKintMessage({
64
+ id: 'customProperties.description',
65
+ overrideValue: labelOverrides?.description
66
+ })
53
67
  }
54
68
  value={customProperty?.description}
55
69
  />
@@ -59,38 +73,32 @@ const CustomPropertyView = ({
59
73
  <Col xs={6}>
60
74
  <KeyValue
61
75
  label={
62
- labelOverrides?.primary ??
63
- <FormattedMessage
64
- id="stripes-kint-components.customProperties.primary"
65
- />
76
+ kintIntl.formatKintMessage({
77
+ id: 'customProperties.primary',
78
+ overrideValue: labelOverrides?.primary
79
+ })
66
80
  }
67
81
  value={
68
- <FormattedMessage
69
- id={
70
- customProperty?.primary
71
- ? 'stripes-kint-components.yes'
72
- : 'stripes-kint-components.no'
73
- }
74
- />
82
+ kintIntl.formatKintMessage({
83
+ id: customProperty?.primary ? 'yes' : 'no',
84
+ overrideValue: customProperty?.primary ? labelOverrides.yes : labelOverrides.no,
85
+ })
75
86
  }
76
87
  />
77
88
  </Col>
78
89
  <Col xs={6}>
79
90
  <KeyValue
80
91
  label={
81
- labelOverrides?.retired ??
82
- <FormattedMessage
83
- id="stripes-kint-components.customProperties.retired"
84
- />
92
+ kintIntl.formatKintMessage({
93
+ id: 'customProperties.retired',
94
+ overrideValue: labelOverrides?.retired
95
+ })
85
96
  }
86
97
  value={
87
- <FormattedMessage
88
- id={
89
- customProperty?.retired
90
- ? 'stripes-kint-components.yes'
91
- : 'stripes-kint-components.no'
92
- }
93
- />
98
+ kintIntl.formatKintMessage({
99
+ id: customProperty?.retired ? 'yes' : 'no',
100
+ overrideValue: customProperty?.retired ? labelOverrides.yes : labelOverrides.no,
101
+ })
94
102
  }
95
103
  />
96
104
  </Col>
@@ -99,8 +107,10 @@ const CustomPropertyView = ({
99
107
  <Col xs={6}>
100
108
  <KeyValue
101
109
  label={
102
- labelOverrides?.weight ??
103
- <FormattedMessage id="stripes-kint-components.customProperties.weight" />
110
+ kintIntl.formatKintMessage({
111
+ id: 'customProperties.weight',
112
+ overrideValue: labelOverrides?.weight
113
+ })
104
114
  }
105
115
  value={customProperty?.weight}
106
116
  />
@@ -108,17 +118,16 @@ const CustomPropertyView = ({
108
118
  <Col xs={6}>
109
119
  <KeyValue
110
120
  label={
111
- labelOverrides?.defaultVisibility ??
112
- <FormattedMessage id="stripes-kint-components.customProperties.defaultVisibility" />
121
+ kintIntl.formatKintMessage({
122
+ id: 'customProperties.defaultVisibility',
123
+ overrideValue: labelOverrides?.defaultVisibility
124
+ })
113
125
  }
114
126
  value={
115
- <FormattedMessage
116
- id={
117
- customProperty?.defaultInternal
118
- ? 'stripes-kint-components.customProperties.internalTrue'
119
- : 'stripes-kint-components.customProperties.internalFalse'
120
- }
121
- />
127
+ kintIntl.formatKintMessage({
128
+ id: customProperty?.defaultInternal ? 'customProperties.internalTrue' : 'customProperties.internalFalse',
129
+ overrideValue: customProperty?.defaultInternal ? labelOverrides.internalTrue : labelOverrides.internalFalse,
130
+ })
122
131
  }
123
132
  />
124
133
  </Col>
@@ -128,8 +137,12 @@ const CustomPropertyView = ({
128
137
  <KeyValue
129
138
  label={
130
139
  <div>
131
- {labelOverrides?.ctx ??
132
- <FormattedMessage id="stripes-kint-components.customProperties.ctx" />}
140
+ {
141
+ kintIntl.formatKintMessage({
142
+ id: 'customProperties.ctx',
143
+ overrideValue: labelOverrides?.ctx
144
+ })
145
+ }
133
146
  {helpPopovers?.ctx ?
134
147
  <InfoPopover
135
148
  content={helpPopovers?.ctx}
@@ -145,10 +158,17 @@ const CustomPropertyView = ({
145
158
  {customProperty?.type && (
146
159
  <KeyValue
147
160
  label={
148
- labelOverrides?.type ??
149
- <FormattedMessage id="stripes-kint-components.customProperties.type" />
161
+ kintIntl.formatKintMessage({
162
+ id: 'customProperties.type',
163
+ overrideValue: labelOverrides?.type
164
+ })
165
+ }
166
+ value={
167
+ kintIntl.formatKintMessage({
168
+ id: `customProperties.type.${customProperty?.type}`,
169
+ overrideValue: labelOverrides?.[customProperty?.type]
170
+ })
150
171
  }
151
- value={labelOverrides?.[customProperty?.type] ?? <FormattedMessage id={`stripes-kint-components.customProperties.type.${customProperty?.type}`} />}
152
172
  />
153
173
  )}
154
174
  </Col>
@@ -156,8 +176,10 @@ const CustomPropertyView = ({
156
176
  {(customProperty?.type === REFDATA_CLASS_NAME || customProperty?.type === MULTI_REFDATA_CLASS_NAME) && (
157
177
  <KeyValue
158
178
  label={
159
- labelOverrides?.category ??
160
- <FormattedMessage id="stripes-kint-components.customProperties.category" />
179
+ kintIntl.formatKintMessage({
180
+ id: 'customProperties.category',
181
+ overrideValue: labelOverrides?.category
182
+ })
161
183
  }
162
184
  value={customProperty?.category?.desc ?? <NoValue />}
163
185
  />
@@ -186,6 +208,8 @@ CustomPropertyView.propTypes = {
186
208
 
187
209
  }),
188
210
  helpPopovers: PropTypes.object,
211
+ intlKey: PropTypes.string,
212
+ intlNS: PropTypes.string,
189
213
  labelOverrides: PropTypes.object
190
214
  };
191
215
 
@@ -2,17 +2,19 @@ import React from 'react';
2
2
  import '@folio/stripes-erm-components/test/jest/__mock__';
3
3
  import { MemoryRouter } from 'react-router-dom';
4
4
  import { KeyValue } from '@folio/stripes-testing';
5
- import { renderWithKintHarness } from '../../../../test/jest/helpers';
6
5
 
7
- import { custPropView } from './testResources';
8
6
  import CustomPropertyView from './CustomPropertyView';
7
+ import customProperties from '../../../../test/jest/customProperties';
8
+ import { renderWithKintHarness } from '../../../../test/jest';
9
+
10
+ jest.mock('../../hooks');
9
11
 
10
12
  describe('CustomPropertyView', () => {
11
13
  beforeEach(() => {
12
14
  renderWithKintHarness(
13
15
  <MemoryRouter>
14
16
  <CustomPropertyView
15
- {...custPropView}
17
+ customProperty={customProperties?.find(cp => cp.name === 'Eligible authors')}
16
18
  />
17
19
  </MemoryRouter>
18
20
  );
@@ -33,11 +35,11 @@ describe('CustomPropertyView', () => {
33
35
  await KeyValue('Primary').has({ value: 'Yes' });
34
36
  });
35
37
 
36
- test('displays expected Deprecated value', async () => {
37
- await KeyValue('Deprecated').has({ value: 'No' });
38
+ test('displays expected Retired value', async () => {
39
+ await KeyValue('Retired').has({ value: 'No' });
38
40
  });
39
41
 
40
- test('displays expected Order weight value', async () => {
42
+ test('displays expected Weight value', async () => {
41
43
  await KeyValue('Order weight').has({ value: '0' });
42
44
  });
43
45
 
@@ -4,32 +4,37 @@
4
4
  These components, namely CustomPropertiesSettings, and its constituent components CustomPropertiesLookup, CustomPropertiesForm and CustomPropertyView are designed for use in a FOLIO settings context, as a way to search through, view, create and edit custom properties.
5
5
 
6
6
  ## LabelOverrides
7
- These components can all be provided with a prop `labelOverrides` which allows the overriding of certain translation defaults provided by kint-components. These values must take a certain shape, which differs by translation key. A table is provided below.
7
+ The default behaviour for translations as of v3.0.0 is that Stripes-Kint-Components will attempt to read a top level intlKey from the store, say `ui-agreements`, and then build a standard translation which the implementing library is expected to then provide. This allows us to keep translations existing within the FOLIO sphere of influence.
8
8
 
9
- Key | Type | Description | default
10
- --- | --- | --- | ---
11
- category | node/string | Override for the display of field "category" | "Category" |
12
- confirmHeading | node/string | Override for the title of the confirmation modal which pops up on attempting to delete a custom property | "Delete custom property" |
13
- com.k_int.web.toolkit.custprops.types.CustomPropertyDate (See customPropertyConstants) | string | Override for the "Date" type custom property display. Must be string in order to support display within the Select. | "Date" |
14
- com.k_int.web.toolkit.custprops.types.CustomPropertyDecimal (See customPropertyConstants) | string | Override for the "Decimal" type custom property display. Must be string in order to support display within the Select. | "Decimal" |
15
- com.k_int.web.toolkit.custprops.types.CustomPropertyInteger (See customPropertyConstants) | string | Override for the "Integer" type custom property display. Must be string in order to support display within the Select. | "Integer" |
16
- com.k_int.web.toolkit.custprops.types.CustomPropertyMultiRefdata (See customPropertyConstants) | string | Override for the "MultiRefdata" type custom property display. Must be string in order to support display within the Select. | "Refdata (multi-select)" |
17
- com.k_int.web.toolkit.custprops.types.CustomPropertyRefdata (See customPropertyConstants) | string | Override for the "Refdata" type custom property display. Must be string in order to support display within the Select. | "Refdata" |
18
- com.k_int.web.toolkit.custprops.types.CustomPropertyText (See customPropertyConstants) | string | Override for the "Text" type custom property display. Must be string in order to support display within the Select. | "Text" |
19
- confirmMessage | function | Override for the message displayed in the confirmation modal on trying to delete a custom property. Accepts a function which will be provided the custom property object in question. | "Custom property <strong>{name}</strong> will be <strong>deleted</strong>." |
20
- ctx | node/string | Override for the display of field "ctx" | "Context" |
21
- deleteError | function | Override for the default callout message shown when a custom property fails to delete. Accepts a function to which it will provide the error message and the customProperty in question. | "<strong>Error: {label}</strong> was not deleted. {error}" |
22
- defaultVisibility | node/string | Override for the display of field "defaultVisibility" | "Default visibility" |
23
- description | node/string | Override for the display of field "description" | "Description" |
24
- label | node/string | Override for the display of field "label" | "Label" |
25
- modalTitleEdit | node/string | Override for the modal header on editing a custom property | "New custom property" |
26
- modalTitleNew | node/string | Override for the modal header on attempting to create a custom property | "Edit custom property" |
27
- name | node/string | Override for the display of field "name" | "Name" |
28
- paneTitle | node/string | Override for the pane title displayed in the main lookup section. | "Custom properties" |
29
- primary | node/string | Override for the display of field "primary" | "Primary" |
30
- primaryRetired | node/string | Override for the warning message on validation, preventing a custom property being set both as primary AND as retired | "A custom property cannot be both primary and retired" |
31
- retired | node/string | Override for the display of field "retired" | "Retired" |
32
- searchAriaLabel | string | Override for the aria label provided by the search field in the main custom property lookup section | 'custom-property-search-field' |
33
- type | node/string | Override for the display of field "type" | "Type" |
34
- viewPaneTitle | node/string/function | Label override for the title of the custom property view pane once one has been selected. This override accepts any shape, if a function is provided it will provide the customProperty and expect a string/node in return: `(customProperty) => ("${customProperty.name}-example")` | customProperty label if exists, falls back to customProperty name |
35
- weight | node/string | Override for the display of field "weight" | ""Order weight" |
9
+ However, these components can all be provided with a prop `labelOverrides` to allow the overriding of this default behaviour. These values must be of type `String`, either referring to an intl translation key `ui-agreements.test.intl.key` or the string to display.
10
+
11
+ In the case where a key is provided, for some translations the library will present values the resulting translation can read from.
12
+
13
+ In some very rare cases, a fallback is provided by default by the library, meaning no intl or labelOverride is necessary.
14
+
15
+ The default translation keys, their corresponding `labelOverrides` value, and any passed information are described below.
16
+
17
+ LabelOverrides key | Default key | Description | Values provided | FallbackMessage |
18
+ --- | --- | --- | --- | ---
19
+ category | `<moduleIntlKey>.customProperties.category` | Override for the display of field "category" | | |
20
+ confirmHeading | `<moduleIntlKey>.customProperties.config.delete.confirmHeading` | Override for the title of the confirmation modal which pops up on attempting to delete a custom property | | |
21
+ confirmMessage | `<moduleIntlKey>.customProperties.config.delete.confirmMessage` | Override for the message displayed in the confirmation modal on trying to delete a custom property. Accepts a function which will be provided the custom property object in question. | name: The label of the custom property, falling back to name |
22
+ ctx | `<moduleIntlKey>.customProperties.ctx` | Override for the display of field "ctx" | | |
23
+ deleteError | `<moduleIntlKey>customProperties.config.delete.errorMessage` | Override for the default callout message shown when a custom property fails to delete. Accepts a function to which it will provide the error message and the customProperty in question. | error; The error on delete, label: The label of the custom property |
24
+ defaultVisibility | `<moduleIntlKey>.customProperties.defaultVisibility` | Override for the display of field "defaultVisibility" | | |
25
+ description | `<moduleIntlKey>.customProperties.description` | Override for the display of field "description" | | |
26
+ editModalTitle | `<moduleIntlKey>.customProperties.config.editModal` | Override for the modal header on editing a custom property | name: Label of custom property, falling back to name. |
27
+ label | `<moduleIntlKey>.customProperties.label` | Override for the display of field "label" | | |
28
+ name | `<moduleIntlKey>.customProperties.name` | Override for the display of field "name" | | |newModalTitle | `<moduleIntlKey>.customProperties.config.newModal` | Override for the modal header on attempting to create a custom property | "Edit custom property" |
29
+ paneTitle | `<moduleIntlKey>.customProperties` | Override for the pane title displayed in the main lookup section. | | |
30
+ primary | `<moduleIntlKey>.customProperties.primary` | Override for the display of field "primary" | | |primaryRetired | `<moduleIntlKey>.customProperties.errors.primaryRetired` | Override for the warning message on validation, preventing a custom property being set both as primary AND as retired | | |
31
+ retired | `<moduleIntlKey>.customProperties.retired` | Override for the display of field "retired" | | |
32
+ searchAriaLabel | `<moduleIntlKey>.customProperties.config.searchAriaLabel` | Override for the aria label provided by the search field in the main custom property lookup section | | 'custom-property-search-field' |
33
+ type | `<moduleIntlKey>.customProperties.type` | Override for the display of field "type" | | |
34
+ viewPaneTitle | `<moduleIntlKey>.customProperties.config.viewPaneTitle` | Label override for the title of the custom property view pane once one has been selected. | label: customProperty label if exists, falls back to customProperty name | customProperty label if exists, falls back to customProperty name |
35
+ weight | `<moduleIntlKey>.customProperties.weight` | Override for the display of field "weight" | | |DATE_CLASS_NAME (See customPropertyConstants) | `<moduleIntlKey>.customProperties.type.${DATE_CLASS_NAME}` | Override for the "Date" type custom property display. | | |
36
+ DECIMAL_CLASS_NAME (See customPropertyConstants) | `<moduleIntlKey>.customProperties.type.${DECIMAL_CLASS_NAME}` | Override for the "Decimal" type custom property display. | | |
37
+ INTEGER_CLASS_NAME (See customPropertyConstants) | `<moduleIntlKey>.customProperties.type.${INTEGER_CLASS_NAME}` | Override for the "Integer" type custom property display. | | |
38
+ MULTI_REFDATA_CLASS_NAME (See customPropertyConstants) | `<moduleIntlKey>.customProperties.type.${MULTI_REFDATA_CLASS_NAME}` | Override for the "MultiRefdata" type custom property display. | | |
39
+ REFDATA_CLASS_NAME (See customPropertyConstants) | `<moduleIntlKey>.customProperties.type.${REFDATA_CLASS_NAME}` | Override for the "Refdata" type custom property display. | | |
40
+ TEXT_CLASS_NAME (See customPropertyConstants) | `<moduleIntlKey>.customProperties.type.${TEXT_CLASS_NAME}` | Override for the "Text" type custom property display. | | |
@@ -5,6 +5,8 @@ const CustomPropertiesEdit = ({
5
5
  contexts = [],
6
6
  customPropertiesEndpoint,
7
7
  id,
8
+ intlKey: passedIntlKey,
9
+ intlNS: passedIntlNS,
8
10
  labelOverrides = {},
9
11
  nameOverride
10
12
  }) => {
@@ -16,6 +18,8 @@ const CustomPropertiesEdit = ({
16
18
  ctx,
17
19
  customPropertiesEndpoint,
18
20
  id,
21
+ intlKey: passedIntlKey,
22
+ intlNS: passedIntlNS,
19
23
  labelOverrides,
20
24
  nameOverride
21
25
  }}
@@ -28,6 +32,8 @@ CustomPropertiesEdit.propTypes = {
28
32
  contexts: PropTypes.arrayOf(PropTypes.string),
29
33
  customPropertiesEndpoint: PropTypes.string,
30
34
  id: PropTypes.string,
35
+ intlKey: PropTypes.string,
36
+ intlNS: PropTypes.string,
31
37
  labelOverrides: PropTypes.object,
32
38
  nameOverride: PropTypes.string
33
39
  };
@@ -3,10 +3,9 @@ import '@folio/stripes-erm-components/test/jest/__mock__';
3
3
  import { waitFor } from '@testing-library/react';
4
4
 
5
5
  import { MemoryRouter } from 'react-router-dom';
6
- import { renderWithKintHarness } from '../../../../test/jest/helpers';
7
6
 
8
- import { custPropEdit } from './testResources';
9
7
  import CustomPropertiesEdit from './CustomPropertiesEdit';
8
+ import { renderWithKintHarness } from '../../../../test/jest';
10
9
 
11
10
  jest.mock('./CustomPropertiesEditCtx', () => () => <div>CustomPropertiesEditCtx</div>);
12
11
 
@@ -16,7 +15,12 @@ describe('CustomPropertiesEdit', () => {
16
15
  renderComponent = renderWithKintHarness(
17
16
  <MemoryRouter>
18
17
  <CustomPropertiesEdit
19
- {...custPropEdit}
18
+ contexts={[
19
+ 'isNull',
20
+ 'OpenAccess'
21
+ ]}
22
+ customPropertiesEndpoint="erm/custprops"
23
+ id="supplementaryProperties"
20
24
  />
21
25
  </MemoryRouter>
22
26
  );
@@ -1,43 +1,43 @@
1
1
  import PropTypes from 'prop-types';
2
- import { FormattedMessage } from 'react-intl';
3
2
  import { Accordion } from '@folio/stripes/components';
4
3
 
5
4
  import CustomPropertiesListField from './CustomPropertiesListField';
6
- import { useCustomProperties } from '../../hooks';
5
+ import { useCustomProperties, useKintIntl } from '../../hooks';
7
6
 
8
7
  const CustomPropertiesEditCtx = ({
9
8
  ctx,
10
9
  customPropertiesEndpoint,
11
10
  id,
11
+ intlKey: passedIntlKey,
12
+ intlNS: passedIntlNS,
12
13
  labelOverrides = {},
13
14
  nameOverride
14
15
  }) => {
16
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
17
+
15
18
  // Deal with all the possible label override options
16
19
  const getAccordionLabel = () => {
17
20
  // Special case for null context
18
21
  if (ctx === 'isNull') {
19
22
  return (
20
- labelOverrides.noContext ??
21
- <FormattedMessage id="stripes-kint-components.customProperties" />
22
- );
23
- }
24
-
25
- // Label overrides for specific contexts
26
- if (labelOverrides[ctx]) {
27
- return labelOverrides[ctx];
28
- }
29
-
30
- // Label override for default title, taking ctx into account
31
- if (labelOverrides.defaultTitle && typeof labelOverrides.defaultTitle === 'function') {
32
- return (
33
- labelOverrides.defaultTitle(ctx)
23
+ kintIntl.formatKintMessage({
24
+ id: 'customProperties',
25
+ overrideValue: labelOverrides.noContext
26
+ })
34
27
  );
35
28
  }
36
29
 
37
- // Label override for default title or finally built in default
30
+ // Chain formatKintMessages together using provided fallbackMessage to
31
+ // allow for "If override or translation exists, use it, else use default"
38
32
  return (
39
- labelOverrides.defaultTitle ??
40
- <FormattedMessage id="stripes-kint-components.customProperties.ctx.title" values={{ ctx }} />
33
+ kintIntl.formatKintMessage({
34
+ id: `customProperties.ctx.${ctx}`,
35
+ overrideValue: labelOverrides[ctx],
36
+ fallbackMessage: kintIntl.formatKintMessage({
37
+ id: 'customProperties.defaultTitle',
38
+ overrideValue: labelOverrides.defaultTitle
39
+ }, { ctx })
40
+ }, { ctx })
41
41
  );
42
42
  };
43
43
 
@@ -67,6 +67,8 @@ const CustomPropertiesEditCtx = ({
67
67
  <CustomPropertiesListField
68
68
  ctx={ctx}
69
69
  customProperties={custprops}
70
+ intlKey={passedIntlKey}
71
+ intlNS={passedIntlNS}
70
72
  labelOverrides={labelOverrides}
71
73
  name={nameOverride ?? 'customProperties'}
72
74
  />
@@ -78,6 +80,8 @@ CustomPropertiesEditCtx.propTypes = {
78
80
  ctx: PropTypes.string,
79
81
  customPropertiesEndpoint: PropTypes.string,
80
82
  id: PropTypes.string,
83
+ intlKey: PropTypes.string,
84
+ intlNS: PropTypes.string,
81
85
  labelOverrides: PropTypes.object,
82
86
  nameOverride: PropTypes.string
83
87
  };
@@ -3,12 +3,12 @@ import '@folio/stripes-erm-components/test/jest/__mock__';
3
3
  import { waitFor } from '@testing-library/react';
4
4
 
5
5
  import { MemoryRouter } from 'react-router-dom';
6
- import { renderWithKintHarness } from '../../../../test/jest/helpers';
7
6
 
8
- import { custPropEditCtx } from './testResources';
9
7
  import CustomPropertiesEditCtx from './CustomPropertiesEditCtx';
8
+ import { renderWithKintHarness } from '../../../../test/jest';
10
9
 
11
10
  jest.mock('./CustomPropertiesListField', () => () => <div>CustomPropertiesListField</div>);
11
+ jest.mock('../../hooks');
12
12
 
13
13
  describe('CustomPropertiesEditCtx', () => {
14
14
  let renderComponent;
@@ -16,7 +16,9 @@ describe('CustomPropertiesEditCtx', () => {
16
16
  renderComponent = renderWithKintHarness(
17
17
  <MemoryRouter>
18
18
  <CustomPropertiesEditCtx
19
- {...custPropEditCtx}
19
+ ctx="OpenAccess"
20
+ customPropertiesEndpoint="erm/custprops"
21
+ id="supplementaryProperties"
20
22
  />
21
23
  </MemoryRouter>
22
24
  );
@@ -2,9 +2,8 @@ import { useEffect, useRef, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Field, useFormState } from 'react-final-form';
4
4
 
5
- import { Button, KeyValue } from '@folio/stripes/components';
6
- import { FormattedMessage } from 'react-intl';
7
- import { useAvailableCustomProperties } from '../../hooks';
5
+ import { Button, Headline, KeyValue } from '@folio/stripes/components';
6
+ import { useKintIntl } from '../../hooks';
8
7
  import CustomPropertyFormCard from './CustomPropertyFormCard';
9
8
 
10
9
  const CustomPropertiesList = ({
@@ -14,11 +13,15 @@ const CustomPropertiesList = ({
14
13
  onChange,
15
14
  value
16
15
  },
16
+ intlKey: passedIntlKey,
17
+ intlNS: passedIntlNS,
17
18
  labelOverrides = {},
18
19
  meta: {
19
20
  pristine
20
21
  },
21
22
  }) => {
23
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
24
+
22
25
  const [customProperties, setCustomProperties] = useState([]); // This is the list of customProperties we're currently displaying for edit.
23
26
  const [dirtying, setDirtying] = useState(false);
24
27
 
@@ -78,6 +81,8 @@ const CustomPropertiesList = ({
78
81
  handleDeleteCustomProperty,
79
82
  index,
80
83
  internalPropertyCounter,
84
+ intlKey: passedIntlKey,
85
+ intlNS: passedIntlNS,
81
86
  labelOverrides,
82
87
  name,
83
88
  onChange,
@@ -94,14 +99,28 @@ const CustomPropertiesList = ({
94
99
  {
95
100
  availableCustomProperties.some((customProperty = {}) => customProperty.primary) &&
96
101
  <KeyValue
97
- label={labelOverrides.primaryProperties ?? <FormattedMessage id="stripes-kint-components.customProperties.primaryProperties" />}
102
+ label={
103
+ <Headline margin="x-small" size="large" tag="h4">
104
+ {kintIntl.formatKintMessage({
105
+ id: 'customProperties.primaryProperties',
106
+ overrideValue: labelOverrides.primaryProperties
107
+ })}
108
+ </Headline>
109
+ }
98
110
  value={renderCustomProperties('primary')}
99
111
  />
100
112
  }
101
113
  {
102
114
  availableCustomProperties.some((customProperty = {}) => !customProperty.primary) &&
103
115
  <KeyValue
104
- label={labelOverrides.optionalProperties ?? <FormattedMessage id="stripes-kint-components.customProperties.optionalProperties" />}
116
+ label={
117
+ <Headline margin="x-small" size="large" tag="h4">
118
+ {kintIntl.formatKintMessage({
119
+ id: 'customProperties.optionalProperties',
120
+ overrideValue: labelOverrides.optionalProperties
121
+ })}
122
+ </Headline>
123
+ }
105
124
  value={renderCustomProperties('optional')}
106
125
  />
107
126
  }
@@ -114,10 +133,10 @@ const CustomPropertiesList = ({
114
133
  setDirtying(true);
115
134
  }}
116
135
  >
117
- {
118
- labelOverrides.addProperty ??
119
- <FormattedMessage id="stripes-kint-components.customProperties.addProperty" />
120
- }
136
+ {kintIntl.formatKintMessage({
137
+ id: 'customProperties.addProperty',
138
+ overrideValue: labelOverrides.addProperty
139
+ })}
121
140
  </Button>
122
141
  }
123
142
  </>
@@ -127,11 +146,40 @@ const CustomPropertiesList = ({
127
146
  const CustomPropertiesListField = ({
128
147
  ctx,
129
148
  customProperties,
130
- labelOverrides,
149
+ intlKey: passedIntlKey,
150
+ intlNS: passedIntlNS,
151
+ labelOverrides = {},
131
152
  ...fieldProps
132
153
  }) => {
133
154
  const fieldRef = useRef();
134
- const availableCustomProperties = useAvailableCustomProperties(customProperties);
155
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
156
+
157
+ // Map customProperties to bring together the options and the definition values
158
+ const availableCustomProperties = customProperties?.map(customProperty => {
159
+ let options = customProperty?.category?.values;
160
+ if (options) {
161
+ options = [
162
+ {
163
+ label: kintIntl.formatKintMessage({
164
+ id: 'notSet',
165
+ overrideValue: labelOverrides.notSet
166
+ }),
167
+ value: '',
168
+ },
169
+ ...options,
170
+ ];
171
+ }
172
+
173
+ return {
174
+ description: customProperty.description,
175
+ label: customProperty.label,
176
+ primary: customProperty.primary,
177
+ type: customProperty.type,
178
+ options,
179
+ value: customProperty.name,
180
+ defaultInternal: customProperty.defaultInternal,
181
+ };
182
+ });
135
183
 
136
184
  const { initialValues } = useFormState();
137
185
  const getInitialValue = () => {
@@ -163,6 +211,8 @@ const CustomPropertiesListField = ({
163
211
  ref={fieldRef}
164
212
  availableCustomProperties={availableCustomProperties}
165
213
  ctx={ctx}
214
+ intlKey={passedIntlKey}
215
+ intlNS={passedIntlNS}
166
216
  labelOverrides={labelOverrides}
167
217
  {...p}
168
218
  />
@@ -175,6 +225,8 @@ const CustomPropertiesListField = ({
175
225
  CustomPropertiesListField.propTypes = {
176
226
  ctx: PropTypes.string,
177
227
  customProperties: PropTypes.arrayOf(PropTypes.object),
228
+ intlKey: PropTypes.string,
229
+ intlNS: PropTypes.string,
178
230
  labelOverrides: PropTypes.object,
179
231
  };
180
232
 
@@ -186,6 +238,8 @@ CustomPropertiesList.propTypes = {
186
238
  value: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
187
239
  onChange: PropTypes.func,
188
240
  }),
241
+ intlKey: PropTypes.string,
242
+ intlNS: PropTypes.string,
189
243
  labelOverrides: PropTypes.object,
190
244
  meta: PropTypes.object,
191
245
  };