@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,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { uniqueId } from 'lodash';
4
- import { FormattedMessage } from 'react-intl';
5
4
  import { Field } from 'react-final-form';
6
5
 
7
6
  import {
@@ -17,11 +16,15 @@ import { required as requiredValidator } from '../../utils/validators';
17
16
 
18
17
  import useValueProps from './useValueProps';
19
18
  import useOperators from './useOperators';
19
+ import { useKintIntl } from '../../hooks';
20
20
 
21
21
  const propTypes = {
22
22
  ariaLabelledby: PropTypes.string.isRequired,
23
23
  clearRuleValue: PropTypes.func.isRequired,
24
24
  index: PropTypes.number.isRequired,
25
+ intlKey: PropTypes.string,
26
+ intlNS: PropTypes.string,
27
+ labelOverrides: PropTypes.object,
25
28
  name: PropTypes.string.isRequired,
26
29
  onDelete: PropTypes.func.isRequired,
27
30
  custPropDefinition: PropTypes.shape({
@@ -40,13 +43,18 @@ const CustomPropertiesRule = ({
40
43
  ariaLabelledby,
41
44
  clearRuleValue,
42
45
  index,
46
+ intlKey: passedIntlKey,
47
+ intlNS: passedIntlNS,
48
+ labelOverrides = {},
43
49
  name,
44
50
  onDelete,
45
51
  custPropDefinition = {},
46
52
  value,
47
53
  }) => {
48
- const operators = useOperators(custPropDefinition.type);
49
- const valueProps = useValueProps(custPropDefinition);
54
+ const operators = useOperators(custPropDefinition.type, passedIntlKey, passedIntlNS, labelOverrides);
55
+ const valueProps = useValueProps(custPropDefinition, passedIntlKey, passedIntlNS, labelOverrides);
56
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
57
+
50
58
  const selectedOperator = operators.find(o => o.value === value?.operator);
51
59
 
52
60
  return (
@@ -55,7 +63,12 @@ const CustomPropertiesRule = ({
55
63
  >
56
64
  <Col xs={2}>
57
65
  <Layout className="textCentered">
58
- {index === 0 ? null : <FormattedMessage id="stripes-kint-components.OR" />}
66
+ {index === 0 ? null :
67
+ kintIntl.formatKintMessage({
68
+ id: 'OR',
69
+ overrideValue: labelOverrides.OR
70
+ })
71
+ }
59
72
  </Layout>
60
73
  </Col>
61
74
  <Col xs={4}>
@@ -100,7 +113,11 @@ const CustomPropertiesRule = ({
100
113
  { index ? (
101
114
  <Tooltip
102
115
  id={uniqueId('delete-rule-btn')}
103
- text={<FormattedMessage id="stripes-kint-components.customProperty.removeRule" values={{ number: index + 1 }} />}
116
+ text={
117
+ kintIntl.formatKintMessage({
118
+ id: 'customProperty.removeRule',
119
+ overrideValue: labelOverrides.removeRule
120
+ }, { number: index + 1 })}
104
121
  >
105
122
  {({ ref, ariaIds }) => (
106
123
  <IconButton
@@ -3,13 +3,15 @@ import '@folio/stripes-erm-components/test/jest/__mock__';
3
3
  import { MemoryRouter } from 'react-router-dom';
4
4
  import { Select } from '@folio/stripes-testing';
5
5
  import { TestForm } from '@folio/stripes-erm-components/test/jest/helpers';
6
- import { renderWithKintHarness } from '../../../../test/jest/helpers';
7
6
 
8
7
  import CustomPropertiesRule from './CustomPropertiesRule';
8
+ import { renderWithKintHarness } from '../../../../test/jest';
9
9
 
10
10
  const onSubmit = jest.fn();
11
11
  const onDelete = jest.fn();
12
12
 
13
+ jest.mock('../../hooks');
14
+
13
15
  const clearRuleValue = () => {};
14
16
 
15
17
  describe('CustomPropertiesRule', () => {
@@ -1,261 +1,23 @@
1
+ import { customProperties, refdata } from '../../../../test/jest';
2
+
1
3
  const activeFilters = {
2
- 'agreementStatus': [
3
- 'active',
4
- 'draft',
5
- 'in_negotiation',
6
- 'requested'
7
- ],
8
4
  'customProperties': [
9
- 'customProperties.AuthorIdentification.value==2c91809c813e654501813e6c3bc50061'
5
+ `customProperties.AuthorIdentification.value==${refdata?.find(rdc => rdc.desc === 'AuthIdent')?.values?.find(rdv => rdv.value === 'email_domain')?.id}`
10
6
  ]
11
7
  };
12
8
 
13
9
  const filterHandlers = {
14
- 'state': () => {},
15
- 'checkbox': () => {},
16
- 'clear': () => {},
17
- 'clearGroup': () => {},
18
- 'reset': () => {},
19
- };
20
-
21
- const labelOverrides = {
22
- 'customProperty': 'Supplementary property',
23
- 'customProperties': 'Supplementrary properties',
24
- 'filtersApplied': () => {},
25
- 'editCustomPropertyFilters': '<Memo />',
26
- 'filterBuilder': '<Memo />',
27
- 'customPropertyFilter': () => {},
28
- 'removeFilter': () => {},
29
- 'retiredName': () => {},
30
- };
31
-
32
- const customProperties = [{
33
- 'id': '2c91809c813e654501813e6c3c6a0066',
34
- 'retired': false,
35
- 'ctx': 'OpenAccess',
36
- 'name': 'AuthorIdentification',
37
- 'primary': true,
38
- 'category': {
39
- 'id': '2c91809c813e654501813e6c3bbb005e',
40
- 'desc': 'AuthIdent',
41
- 'internal': false,
42
- 'values': [{
43
- 'id': '2c91809c813e654501813e6c3bcf0064',
44
- 'value': 'ringgold_id',
45
- 'label': 'Ringgold ID'
46
- },
47
- {
48
- 'id': '2c91809c813e654501813e6c3bbd005f',
49
- 'value': 'other',
50
- 'label': 'Other'
51
- },
52
- {
53
- 'id': '2c91809c813e654501813e6c3bcc0063',
54
- 'value': 'over_ip_range',
55
- 'label': 'Over IP Range'
56
- },
57
- {
58
- 'id': '2c91809c813e654501813e6c3bc20060',
59
- 'value': 'email_domain',
60
- 'label': 'Email Domain'
61
- },
62
- {
63
- 'id': '2c91809c813e654501813e6c3bc50061',
64
- 'value': 'orcid',
65
- 'label': 'ORCID'
66
- },
67
- {
68
- 'id': '2c91809c813e654501813e6c3bc90062',
69
- 'value': 'over_institute',
70
- 'label': 'Over Institute'
71
- },
72
- {
73
- 'id': '2c91809c813e654501813e6c3bd20065',
74
- 'value': 'ror_id',
75
- 'label': 'ROR ID'
76
- }
77
- ]
78
- },
79
- 'defaultInternal': true,
80
- 'label': 'Author Identification',
81
- 'description': 'Author Identification',
82
- 'weight': 0,
83
- 'type': 'com.k_int.web.toolkit.custprops.types.CustomPropertyRefdata'
84
- },
85
- {
86
- 'id': '2c91809c813e654501813e6c3c7d0067',
87
- 'retired': false,
88
- 'ctx': 'OpenAccess',
89
- 'name': 'Eligible authors',
90
- 'primary': true,
91
- 'defaultInternal': true,
92
- 'label': 'Does this agreement support publishing',
93
- 'description': 'Does this agreement support publishing',
94
- 'weight': 0,
95
- 'type': 'com.k_int.web.toolkit.custprops.types.CustomPropertyText'
96
- },
97
- {
98
- 'id': '2c91809c813e654501814287324e0070',
99
- 'retired': false,
100
- 'ctx': 'OpenAccess',
101
- 'name': 'Test',
102
- 'primary': true,
103
- 'category': {
104
- 'id': '2096ecb6794fae7aa29074cf31970b17',
105
- 'desc': 'SubscriptionAgreement.AgreementStatus',
106
- 'internal': true,
107
- 'values': '[{…}, {…}, {…}, {…}, {…}]'
108
- },
109
- 'defaultInternal': true,
110
- 'label': 'test',
111
- 'description': 'test description',
112
- 'weight': 1,
113
- 'type': 'com.k_int.web.toolkit.custprops.types.CustomPropertyRefdata'
114
- },
115
- {
116
- 'id': '2c91809c813e6545018143f201040073',
117
- 'retired': false,
118
- 'name': 'TestTextSuppProp',
119
- 'primary': true,
120
- 'defaultInternal': false,
121
- 'label': 'TestTextSuppProp',
122
- 'description': 'TestTextSuppProp',
123
- 'weight': 0,
124
- 'type': 'com.k_int.web.toolkit.custprops.types.CustomPropertyText'
125
- }
126
- ];
127
-
128
- const fields = {
129
- 'name': 'filters',
130
- 'forEach': () => {},
131
- 'length': 2,
132
- 'map': () => {},
133
- 'insert': () => {},
134
- 'concat': () => {},
135
- 'move': () => {},
136
- 'pop': () => {},
137
- 'push': () => {},
138
- 'remove': () => {},
139
- 'removeBatch': () => {},
140
- 'shift': () => {},
141
- 'swap': () => {},
142
- 'unshift': () => {},
143
- 'update': () => {},
144
- 'value': [{
145
- 'customProperty': 'AuthorIdentification',
146
- 'rules': [{
147
- 'operator': '==',
148
- 'value': '2c91809c813e654501813e6c3bc50061'
149
- }]
150
- },
151
- {
152
- 'customProperty': 'AuthorIdentification',
153
- 'rules': [{
154
- 'operator': '==',
155
- 'value': '2c91809c813e654501813e6c3bd20065'
156
- }]
157
- }
158
- ]
10
+ 'state': () => ({}),
11
+ 'checkbox': () => ({}),
12
+ 'clear': () => ({}),
13
+ 'clearGroup': () => ({}),
14
+ 'reset': () => ({}),
159
15
  };
160
16
 
161
17
  const data = {
162
- 'customProperties': [{
163
- 'id': '2c91809c813e654501813e6c3c6a0066',
164
- 'retired': false,
165
- 'ctx': 'OpenAccess',
166
- 'name': 'AuthorIdentification',
167
- 'primary': true,
168
- 'category': {
169
- 'id': '2c91809c813e654501813e6c3bbb005e',
170
- 'desc': 'AuthIdent',
171
- 'internal': false,
172
- 'values': [{
173
- 'id': '2c91809c813e654501813e6c3bd20065',
174
- 'value': 'ror_id',
175
- 'label': 'ROR ID'
176
- },
177
- {
178
- 'id': '2c91809c813e654501813e6c3bc20060',
179
- 'value': 'email_domain',
180
- 'label': 'Email Domain'
181
- },
182
- {
183
- 'id': '2c91809c813e654501813e6c3bc50061',
184
- 'value': 'orcid',
185
- 'label': 'ORCID'
186
- },
187
- {
188
- 'id': '2c91809c813e654501813e6c3bcf0064',
189
- 'value': 'ringgold_id',
190
- 'label': 'Ringgold ID'
191
- },
192
- {
193
- 'id': '2c91809c813e654501813e6c3bbd005f',
194
- 'value': 'other',
195
- 'label': 'Other'
196
- },
197
- {
198
- 'id': '2c91809c813e654501813e6c3bc90062',
199
- 'value': 'over_institute',
200
- 'label': 'Over Institute'
201
- },
202
- {
203
- 'id': '2c91809c813e654501813e6c3bcc0063',
204
- 'value': 'over_ip_range',
205
- 'label': 'Over IP Range'
206
- }
207
- ]
208
- },
209
- 'defaultInternal': true,
210
- 'label': 'Author Identification',
211
- 'description': 'Author Identification',
212
- 'weight': 0,
213
- 'type': 'com.k_int.web.toolkit.custprops.types.CustomPropertyRefdata'
214
- },
215
- {
216
- 'id': '2c91809c813e654501813e6c3c7d0067',
217
- 'retired': false,
218
- 'ctx': 'OpenAccess',
219
- 'name': 'Eligible authors',
220
- 'primary': true,
221
- 'defaultInternal': true,
222
- 'label': 'Does this agreement support publishing',
223
- 'description': 'Does this agreement support publishing',
224
- 'weight': 0,
225
- 'type': 'com.k_int.web.toolkit.custprops.types.CustomPropertyText'
226
- },
227
- {
228
- 'id': '2c91809c813e654501814287324e0070',
229
- 'retired': false,
230
- 'ctx': 'OpenAccess',
231
- 'name': 'Test',
232
- 'primary': true,
233
- 'category': {
234
- 'id': '2096ecb6794fae7aa29074cf31970b17',
235
- 'desc': 'SubscriptionAgreement.AgreementStatus',
236
- 'internal': true,
237
- 'values': '[{…}, {…}, {…}, {…}, {…}]'
238
- },
239
- 'defaultInternal': true,
240
- 'label': 'test',
241
- 'description': 'test description',
242
- 'weight': 1,
243
- 'type': 'com.k_int.web.toolkit.custprops.types.CustomPropertyRefdata'
244
- },
245
- {
246
- 'id': '2c91809c813e6545018143f201040073',
247
- 'retired': false,
248
- 'name': 'TestTextSuppProp',
249
- 'primary': true,
250
- 'defaultInternal': false,
251
- 'label': 'TestTextSuppProp',
252
- 'description': 'TestTextSuppProp',
253
- 'weight': 0,
254
- 'type': 'com.k_int.web.toolkit.custprops.types.CustomPropertyText'
255
- }
256
- ],
257
- 'editingFilters': true,
258
- 'filters': [{
18
+ customProperties,
19
+ editingFilters: true,
20
+ filters: [{
259
21
  'customProperty': 'AuthorIdentification',
260
22
  'rules': [{
261
23
  'operator': '==',
@@ -271,27 +33,14 @@ const data = {
271
33
  }
272
34
  ],
273
35
  'handlers': {
274
- 'closeEditModal': () => {},
275
- 'openEditModal': () => {}
36
+ 'closeEditModal': () => ({}),
37
+ 'openEditModal': () => ({})
276
38
  },
277
- 'labelOverrides': {
278
- 'customProperty': '<Memo />',
279
- 'customProperties': '<Memo />',
280
- 'filtersApplied': () => {},
281
- 'editCustomPropertyFilters': 'Edit supplementary property filters',
282
- 'filterBuilder': '<Memo />',
283
- 'customPropertyFilter': () => {},
284
- 'removeFilter': () => {},
285
- 'retiredName': () => {}
286
- },
287
- 'onSubmit': () => {}
39
+ 'onSubmit': () => ({})
288
40
  };
289
41
 
290
42
  export {
291
43
  activeFilters,
292
44
  filterHandlers,
293
- labelOverrides,
294
- customProperties,
295
- fields,
296
45
  data
297
46
  };
@@ -1,5 +1,5 @@
1
- import { useIntl } from 'react-intl';
2
1
  import * as CUSTPROP_TYPES from '../../constants/customProperties';
2
+ import { useKintIntl } from '../../hooks';
3
3
 
4
4
  const {
5
5
  REFDATA_CLASS_NAME: REFDATA,
@@ -10,49 +10,49 @@ const {
10
10
  TEXT_CLASS_NAME: TEXT,
11
11
  } = CUSTPROP_TYPES;
12
12
 
13
- const useOperators = (type) => {
14
- const intl = useIntl();
15
- const getLabel = id => intl.formatMessage({ id });
13
+ const useOperators = (type = null, passedIntlKey = null, passedIntlNS = null, labelOverrides = {}) => {
14
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
15
+
16
16
  const operators = [
17
- { value: ' isSet', label: getLabel('stripes-kint-components.operator.isSet'), noValueAllowed: true },
18
- { value: ' isNotSet', label: getLabel('stripes-kint-components.operator.isNotSet'), noValueAllowed: true },
17
+ { value: ' isSet', label: kintIntl.formatKintMessage({ id: 'operator.isSet', overrideValue: labelOverrides.operatorIsSet }), noValueAllowed: true },
18
+ { value: ' isNotSet', label: kintIntl.formatKintMessage({ id: 'operator.isNotSet', overrideValue: labelOverrides.operatorIsNotSet }), noValueAllowed: true },
19
19
  ];
20
20
 
21
21
  if (!type || type === INTEGER || type === DECIMAL) {
22
22
  operators.push(
23
- { value: '==', label: getLabel('stripes-kint-components.operator.equals') },
24
- { value: '!=', label: getLabel('stripes-kint-components.operator.doesNotEqual') },
25
- { value: '>=', label: getLabel('stripes-kint-components.operator.isGreaterThanOrEqual') },
26
- { value: '<=', label: getLabel('stripes-kint-components.operator.isLessThanOrEqual') },
23
+ { value: '==', label: kintIntl.formatKintMessage({ id: 'operator.equals', overrideValue: labelOverrides.operatorEquals }) },
24
+ { value: '!=', label: kintIntl.formatKintMessage({ id: 'operator.doesNotEqual', overrideValue: labelOverrides.operatorDoesNotEqual }) },
25
+ { value: '>=', label: kintIntl.formatKintMessage({ id: 'operator.isGreaterThanOrEqual', overrideValue: labelOverrides.operatorIsGreaterThanOrEqual }) },
26
+ { value: '<=', label: kintIntl.formatKintMessage({ id: 'operator.isLessThanOrEqual', overrideValue: labelOverrides.operatorIsLessThanOrEqual }) },
27
27
  );
28
28
  }
29
29
 
30
30
  if (type === DATE) { // Basically the same as the "number" types above, so no need to reassign if there is no type
31
31
  operators.push(
32
- { value: '==', label: getLabel('stripes-kint-components.operator.equals') },
33
- { value: '!=', label: getLabel('stripes-kint-components.operator.doesNotEqual') },
34
- { value: '>=', label: getLabel('stripes-kint-components.operator.isOnOrAfter') },
35
- { value: '<=', label: getLabel('stripes-kint-components.operator.isOnOrBefore') },
32
+ { value: '==', label: kintIntl.formatKintMessage({ id: 'operator.equals', overrideValue: labelOverrides.operatorEquals }) },
33
+ { value: '!=', label: kintIntl.formatKintMessage({ id: 'operator.doesNotEqual', overrideValue: labelOverrides.operatorDoesNotEqual }) },
34
+ { value: '>=', label: kintIntl.formatKintMessage({ id: 'operator.isOnOrAfter', overrideValue: labelOverrides.operatorIsOnOrAfter }) },
35
+ { value: '<=', label: kintIntl.formatKintMessage({ id: 'operator.isOnOrBefore', overrideValue: labelOverrides.operatorIsOnOrBefore }) },
36
36
  );
37
37
  }
38
38
 
39
39
  if (!type || type === REFDATA) {
40
40
  operators.push(
41
- { value: '==', label: getLabel('stripes-kint-components.operator.is') },
42
- { value: '!=', label: getLabel('stripes-kint-components.operator.isNot') },
41
+ { value: '==', label: kintIntl.formatKintMessage({ id: 'operator.is', overrideValue: labelOverrides.operatorIs }) },
42
+ { value: '!=', label: kintIntl.formatKintMessage({ id: 'operator.isNot', overrideValue: labelOverrides.operatorIsNot }) },
43
43
  );
44
44
  }
45
45
 
46
- if (!type || type === MULTIREFDATA) {
46
+ if (type === MULTIREFDATA) {
47
47
  operators.push(
48
- { value: '==', label: getLabel('stripes-kint-components.operator.contains') },
48
+ { value: '==', label: kintIntl.formatKintMessage({ id: 'operator.contains', overrideValue: labelOverrides.operatorContains }) },
49
49
  );
50
50
  }
51
51
 
52
52
  if (!type || type === TEXT) {
53
53
  operators.push(
54
- { value: '=~', label: getLabel('stripes-kint-components.operator.contains') },
55
- { value: '!~', label: getLabel('stripes-kint-components.operator.doesNotContain') },
54
+ { value: '=~', label: kintIntl.formatKintMessage({ id: 'operator.contains', overrideValue: labelOverrides.operatorContains }) },
55
+ { value: '!~', label: kintIntl.formatKintMessage({ id: 'operator.doesNotContain', overrideValue: labelOverrides.operatorDoesNotContain }) },
56
56
  );
57
57
  }
58
58
 
@@ -1,7 +1,7 @@
1
1
  import useOperators from './useOperators';
2
2
 
3
- const useParseActiveFilterStrings = (filterStrings) => {
4
- const operators = useOperators().map(o => o.value);
3
+ const useParseActiveFilterStrings = (filterStrings, passedIntlKey, passedIntlNS, labelOverrides = {}) => {
4
+ const operators = useOperators(null, passedIntlKey, passedIntlNS, labelOverrides).map(o => o.value);
5
5
 
6
6
  let numberOfFilters = 0;
7
7
  const filters = filterStrings.map(filter => {
@@ -1,6 +1,6 @@
1
1
  import { Datepicker, Select, TextField } from '@folio/stripes/components';
2
2
  import * as CUSTPROP_TYPES from '../../constants/customProperties';
3
- import { invalidNumber as invalidNumberValidator, required as requiredValidator } from '../../utils/validators';
3
+ import { invalidNumber, required as requiredValidator } from '../../utils/validators';
4
4
 
5
5
  const {
6
6
  REFDATA_CLASS_NAME: REFDATA,
@@ -11,7 +11,12 @@ const {
11
11
  TEXT_CLASS_NAME: TEXT,
12
12
  } = CUSTPROP_TYPES;
13
13
 
14
- const useValueProps = (custPropDefinition) => {
14
+ const useValueProps = (
15
+ custPropDefinition,
16
+ intlKey,
17
+ intlNS,
18
+ labelOverrides = {},
19
+ ) => {
15
20
  const props = {
16
21
  validate: requiredValidator
17
22
  };
@@ -21,7 +26,7 @@ const useValueProps = (custPropDefinition) => {
21
26
  case DECIMAL:
22
27
  props.component = TextField;
23
28
  props.type = 'number';
24
- props.validate = invalidNumberValidator;
29
+ props.validate = (value) => invalidNumber(value, intlKey, intlNS, labelOverrides);
25
30
  break;
26
31
  case REFDATA:
27
32
  props.component = Select;
@@ -6,6 +6,8 @@ const CustomPropertiesView = ({
6
6
  customProperties,
7
7
  customPropertiesEndpoint,
8
8
  id,
9
+ intlKey: passedIntlKey,
10
+ intlNS: passedIntlNS,
9
11
  labelOverrides = {},
10
12
  }) => {
11
13
  return (
@@ -17,6 +19,8 @@ const CustomPropertiesView = ({
17
19
  customProperties,
18
20
  customPropertiesEndpoint,
19
21
  id,
22
+ intlKey: passedIntlKey,
23
+ intlNS: passedIntlNS,
20
24
  labelOverrides
21
25
  }}
22
26
  />
@@ -29,6 +33,8 @@ CustomPropertiesView.propTypes = {
29
33
  customProperties: PropTypes.object,
30
34
  customPropertiesEndpoint: PropTypes.string,
31
35
  id: PropTypes.string,
36
+ intlKey: PropTypes.string,
37
+ intlNS: PropTypes.string,
32
38
  labelOverrides: PropTypes.object,
33
39
  nameOverride: PropTypes.string
34
40
  };
@@ -2,11 +2,12 @@ import React from 'react';
2
2
  import '@folio/stripes-erm-components/test/jest/__mock__';
3
3
  import { waitFor } from '@testing-library/react';
4
4
  import { MemoryRouter } from 'react-router-dom';
5
- import { renderWithKintHarness } from '../../../../test/jest/helpers';
6
5
 
7
6
  import { contexts, customProperties, labelOverrides } from './testResources';
8
7
  import CustomPropertiesView from './CustomPropertiesView';
8
+ import { renderWithKintHarness } from '../../../../test/jest';
9
9
 
10
+ jest.mock('../../hooks');
10
11
  jest.mock('./CustomPropertiesViewCtx', () => () => <div>CustomPropertiesViewCtx</div>);
11
12
 
12
13
  describe('CustomPropertiesView', () => {
@@ -1,8 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
- import { FormattedMessage } from 'react-intl';
3
2
  import { Accordion, Badge, Spinner } from '@folio/stripes/components';
4
3
 
5
- import { useCustomProperties } from '../../hooks';
4
+ import { useCustomProperties, useKintIntl } from '../../hooks';
6
5
 
7
6
  import CustomPropertyCard from './CustomPropertyCard';
8
7
 
@@ -11,15 +10,21 @@ const CustomPropertiesViewCtx = ({
11
10
  customProperties = [],
12
11
  customPropertiesEndpoint,
13
12
  id,
13
+ intlKey: passedIntlKey,
14
+ intlNS: passedIntlNS,
14
15
  labelOverrides = {}
15
16
  }) => {
17
+ const kintIntl = useKintIntl(passedIntlKey, passedIntlNS);
18
+
16
19
  // Deal with all the possible label override options
17
20
  const getAccordionLabel = () => {
18
21
  // Special case for null context
19
22
  if (ctx === 'isNull') {
20
23
  return (
21
- labelOverrides.noContext ??
22
- <FormattedMessage id="stripes-kint-components.customProperties" />
24
+ kintIntl.formatKintMessage({
25
+ id: 'customProperties',
26
+ overrideValue: labelOverrides.noContext
27
+ })
23
28
  );
24
29
  }
25
30
 
@@ -28,17 +33,12 @@ const CustomPropertiesViewCtx = ({
28
33
  return labelOverrides[ctx];
29
34
  }
30
35
 
31
- // Label override for default title, taking ctx into account
32
- if (labelOverrides.defaultTitle && typeof labelOverrides.defaultTitle === 'function') {
33
- return (
34
- labelOverrides.defaultTitle(ctx)
35
- );
36
- }
37
-
38
36
  // Label override for default title or finally built in default
39
37
  return (
40
- labelOverrides.defaultTitle ??
41
- <FormattedMessage id="stripes-kint-components.customProperties.ctx.title" values={{ ctx }} />
38
+ kintIntl.formatKintMessage({
39
+ id: 'customProperties.defaultTitle',
40
+ overrideValue: labelOverrides.defaultTitle
41
+ }, { ctx })
42
42
  );
43
43
  };
44
44
 
@@ -112,6 +112,8 @@ CustomPropertiesViewCtx.propTypes = {
112
112
  customProperties: PropTypes.object,
113
113
  customPropertiesEndpoint: PropTypes.string,
114
114
  id: PropTypes.string,
115
+ intlKey: PropTypes.string,
116
+ intlNS: PropTypes.string,
115
117
  labelOverrides: PropTypes.object,
116
118
  };
117
119
 
@@ -2,15 +2,12 @@ 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 { waitFor } from '@testing-library/react';
5
- import { renderWithKintHarness } from '../../../../test/jest/helpers';
6
5
 
7
6
  import { data } from './testResources';
8
7
  import CustomPropertiesViewCtx from './CustomPropertiesViewCtx';
8
+ import { renderWithKintHarness } from '../../../../test/jest';
9
9
 
10
- jest.mock('../../hooks', () => ({
11
- useCustomProperties: () => [],
12
- }));
13
-
10
+ jest.mock('../../hooks');
14
11
  jest.mock('./CustomPropertyCard', () => () => <div>CustomPropertyCard</div>);
15
12
 
16
13
  describe('CustomPropertiesViewCtx', () => {