@rjsf/utils 6.7.1 → 6.10.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 (477) hide show
  1. package/dist/index.cjs +521 -425
  2. package/dist/index.cjs.map +4 -4
  3. package/dist/utils.esm.js +520 -424
  4. package/dist/utils.esm.js.map +4 -4
  5. package/dist/utils.umd.js +579 -333
  6. package/lib/ErrorSchemaBuilder.d.ts +8 -7
  7. package/lib/ErrorSchemaBuilder.d.ts.map +1 -0
  8. package/lib/ErrorSchemaBuilder.js +29 -27
  9. package/lib/ErrorSchemaBuilder.js.map +1 -1
  10. package/lib/SelectedOptionDescription.d.ts +2 -1
  11. package/lib/SelectedOptionDescription.d.ts.map +1 -0
  12. package/lib/SelectedOptionDescription.js +6 -7
  13. package/lib/SelectedOptionDescription.js.map +1 -1
  14. package/lib/allowAdditionalItems.d.ts +2 -1
  15. package/lib/allowAdditionalItems.d.ts.map +1 -0
  16. package/lib/allowAdditionalItems.js +1 -1
  17. package/lib/allowAdditionalItems.js.map +1 -1
  18. package/lib/asNumber.d.ts +1 -0
  19. package/lib/asNumber.d.ts.map +1 -0
  20. package/lib/asNumber.js +1 -1
  21. package/lib/asNumber.js.map +1 -1
  22. package/lib/canExpand.d.ts +2 -1
  23. package/lib/canExpand.d.ts.map +1 -0
  24. package/lib/canExpand.js +1 -1
  25. package/lib/canExpand.js.map +1 -1
  26. package/lib/constIsAjvDataReference.d.ts +2 -1
  27. package/lib/constIsAjvDataReference.d.ts.map +1 -0
  28. package/lib/constIsAjvDataReference.js +2 -3
  29. package/lib/constIsAjvDataReference.js.map +1 -1
  30. package/lib/constants.d.ts +1 -0
  31. package/lib/constants.d.ts.map +1 -0
  32. package/lib/createErrorHandler.d.ts +2 -1
  33. package/lib/createErrorHandler.d.ts.map +1 -0
  34. package/lib/createErrorHandler.js +3 -4
  35. package/lib/createErrorHandler.js.map +1 -1
  36. package/lib/createSchemaUtils.d.ts +2 -1
  37. package/lib/createSchemaUtils.d.ts.map +1 -0
  38. package/lib/createSchemaUtils.js +10 -7
  39. package/lib/createSchemaUtils.js.map +1 -1
  40. package/lib/dataURItoBlob.d.ts +1 -0
  41. package/lib/dataURItoBlob.d.ts.map +1 -0
  42. package/lib/dataURItoBlob.js +1 -2
  43. package/lib/dataURItoBlob.js.map +1 -1
  44. package/lib/dateRangeOptions.d.ts +2 -1
  45. package/lib/dateRangeOptions.d.ts.map +1 -0
  46. package/lib/dateRangeOptions.js +1 -1
  47. package/lib/dateRangeOptions.js.map +1 -1
  48. package/lib/deepEquals.d.ts +1 -0
  49. package/lib/deepEquals.d.ts.map +1 -0
  50. package/lib/englishStringTranslator.d.ts +2 -1
  51. package/lib/englishStringTranslator.d.ts.map +1 -0
  52. package/lib/englishStringTranslator.js +1 -1
  53. package/lib/englishStringTranslator.js.map +1 -1
  54. package/lib/enumOptionSelectedValue.d.ts +2 -1
  55. package/lib/enumOptionSelectedValue.d.ts.map +1 -0
  56. package/lib/enumOptionSelectedValue.js +1 -1
  57. package/lib/enumOptionSelectedValue.js.map +1 -1
  58. package/lib/enumOptionValueDecoder.d.ts +2 -1
  59. package/lib/enumOptionValueDecoder.d.ts.map +1 -0
  60. package/lib/enumOptionValueDecoder.js +1 -1
  61. package/lib/enumOptionValueDecoder.js.map +1 -1
  62. package/lib/enumOptionValueEncoder.d.ts +2 -1
  63. package/lib/enumOptionValueEncoder.d.ts.map +1 -0
  64. package/lib/enumOptionValueEncoder.js +1 -2
  65. package/lib/enumOptionValueEncoder.js.map +1 -1
  66. package/lib/enumOptionsDeselectValue.d.ts +2 -1
  67. package/lib/enumOptionsDeselectValue.d.ts.map +1 -0
  68. package/lib/enumOptionsDeselectValue.js +2 -2
  69. package/lib/enumOptionsDeselectValue.js.map +1 -1
  70. package/lib/enumOptionsIndexForValue.d.ts +2 -1
  71. package/lib/enumOptionsIndexForValue.d.ts.map +1 -0
  72. package/lib/enumOptionsIndexForValue.js +1 -1
  73. package/lib/enumOptionsIndexForValue.js.map +1 -1
  74. package/lib/enumOptionsIsSelected.d.ts +2 -1
  75. package/lib/enumOptionsIsSelected.d.ts.map +1 -0
  76. package/lib/enumOptionsIsSelected.js +1 -1
  77. package/lib/enumOptionsIsSelected.js.map +1 -1
  78. package/lib/enumOptionsSelectValue.d.ts +2 -1
  79. package/lib/enumOptionsSelectValue.d.ts.map +1 -0
  80. package/lib/enumOptionsSelectValue.js +2 -3
  81. package/lib/enumOptionsSelectValue.js.map +1 -1
  82. package/lib/enumOptionsValueForIndex.d.ts +2 -1
  83. package/lib/enumOptionsValueForIndex.d.ts.map +1 -0
  84. package/lib/enums.d.ts +1 -0
  85. package/lib/enums.d.ts.map +1 -0
  86. package/lib/findSchemaDefinition.d.ts +2 -1
  87. package/lib/findSchemaDefinition.d.ts.map +1 -0
  88. package/lib/findSchemaDefinition.js +7 -11
  89. package/lib/findSchemaDefinition.js.map +1 -1
  90. package/lib/getChangedFields.d.ts +11 -2
  91. package/lib/getChangedFields.d.ts.map +1 -0
  92. package/lib/getChangedFields.js +57 -18
  93. package/lib/getChangedFields.js.map +1 -1
  94. package/lib/getDateElementProps.d.ts +2 -1
  95. package/lib/getDateElementProps.d.ts.map +1 -0
  96. package/lib/getDecimalSeparator.d.ts +1 -0
  97. package/lib/getDecimalSeparator.d.ts.map +1 -0
  98. package/lib/getDecimalSeparator.js +1 -2
  99. package/lib/getDecimalSeparator.js.map +1 -1
  100. package/lib/getDiscriminatorFieldFromSchema.d.ts +2 -1
  101. package/lib/getDiscriminatorFieldFromSchema.d.ts.map +1 -0
  102. package/lib/getDiscriminatorFieldFromSchema.js +4 -5
  103. package/lib/getDiscriminatorFieldFromSchema.js.map +1 -1
  104. package/lib/getInputProps.d.ts +2 -1
  105. package/lib/getInputProps.d.ts.map +1 -0
  106. package/lib/getInputProps.js +4 -1
  107. package/lib/getInputProps.js.map +1 -1
  108. package/lib/getOptionMatchingSimpleDiscriminator.d.ts +2 -1
  109. package/lib/getOptionMatchingSimpleDiscriminator.d.ts.map +1 -0
  110. package/lib/getOptionMatchingSimpleDiscriminator.js +6 -6
  111. package/lib/getOptionMatchingSimpleDiscriminator.js.map +1 -1
  112. package/lib/getOptionValueFormat.d.ts +2 -1
  113. package/lib/getOptionValueFormat.d.ts.map +1 -0
  114. package/lib/getOptionValueFormat.js +1 -2
  115. package/lib/getOptionValueFormat.js.map +1 -1
  116. package/lib/getPropertySchema.d.ts +12 -0
  117. package/lib/getPropertySchema.d.ts.map +1 -0
  118. package/lib/getPropertySchema.js +14 -0
  119. package/lib/getPropertySchema.js.map +1 -0
  120. package/lib/getSchemaType.d.ts +2 -1
  121. package/lib/getSchemaType.d.ts.map +1 -0
  122. package/lib/getSchemaType.js +1 -1
  123. package/lib/getSchemaType.js.map +1 -1
  124. package/lib/getSubmitButtonOptions.d.ts +2 -1
  125. package/lib/getSubmitButtonOptions.d.ts.map +1 -0
  126. package/lib/getSubmitButtonOptions.js +3 -3
  127. package/lib/getSubmitButtonOptions.js.map +1 -1
  128. package/lib/getTemplate.d.ts +2 -1
  129. package/lib/getTemplate.d.ts.map +1 -0
  130. package/lib/getTestIds.d.ts +2 -1
  131. package/lib/getTestIds.d.ts.map +1 -0
  132. package/lib/getTestIds.js +6 -5
  133. package/lib/getTestIds.js.map +1 -1
  134. package/lib/getUiOptions.d.ts +2 -1
  135. package/lib/getUiOptions.d.ts.map +1 -0
  136. package/lib/getUiOptions.js +2 -2
  137. package/lib/getUiOptions.js.map +1 -1
  138. package/lib/getWidget.d.ts +2 -1
  139. package/lib/getWidget.d.ts.map +1 -0
  140. package/lib/getWidget.js +6 -7
  141. package/lib/getWidget.js.map +1 -1
  142. package/lib/guessType.d.ts +2 -1
  143. package/lib/guessType.d.ts.map +1 -0
  144. package/lib/hasWidget.d.ts +2 -1
  145. package/lib/hasWidget.d.ts.map +1 -0
  146. package/lib/hasWidget.js +1 -1
  147. package/lib/hasWidget.js.map +1 -1
  148. package/lib/hashForSchema.d.ts +4 -2
  149. package/lib/hashForSchema.d.ts.map +1 -0
  150. package/lib/hashForSchema.js +17 -8
  151. package/lib/hashForSchema.js.map +1 -1
  152. package/lib/idGenerators.d.ts +2 -1
  153. package/lib/idGenerators.d.ts.map +1 -0
  154. package/lib/idGenerators.js +2 -3
  155. package/lib/idGenerators.js.map +1 -1
  156. package/lib/index.d.ts +93 -87
  157. package/lib/index.d.ts.map +1 -0
  158. package/lib/index.js +85 -81
  159. package/lib/index.js.map +1 -1
  160. package/lib/isConstant.d.ts +2 -1
  161. package/lib/isConstant.d.ts.map +1 -0
  162. package/lib/isConstant.js +1 -1
  163. package/lib/isConstant.js.map +1 -1
  164. package/lib/isCustomWidget.d.ts +2 -1
  165. package/lib/isCustomWidget.d.ts.map +1 -0
  166. package/lib/isCustomWidget.js +1 -1
  167. package/lib/isCustomWidget.js.map +1 -1
  168. package/lib/isFixedItems.d.ts +2 -1
  169. package/lib/isFixedItems.d.ts.map +1 -0
  170. package/lib/isFixedItems.js +1 -1
  171. package/lib/isFixedItems.js.map +1 -1
  172. package/lib/isFormDataAvailable.d.ts +1 -0
  173. package/lib/isFormDataAvailable.d.ts.map +1 -0
  174. package/lib/isFormDataAvailable.js +7 -4
  175. package/lib/isFormDataAvailable.js.map +1 -1
  176. package/lib/isObject.d.ts +3 -1
  177. package/lib/isObject.d.ts.map +1 -0
  178. package/lib/isObject.js +8 -2
  179. package/lib/isObject.js.map +1 -1
  180. package/lib/isPlainObject.d.ts +9 -0
  181. package/lib/isPlainObject.d.ts.map +1 -0
  182. package/lib/isPlainObject.js +15 -0
  183. package/lib/isPlainObject.js.map +1 -0
  184. package/lib/isRootSchema.d.ts +2 -1
  185. package/lib/isRootSchema.d.ts.map +1 -0
  186. package/lib/isRootSchema.js +2 -2
  187. package/lib/isRootSchema.js.map +1 -1
  188. package/lib/jsonSchemaAugmentation.d.ts +1 -0
  189. package/lib/jsonSchemaAugmentation.d.ts.map +1 -0
  190. package/lib/labelValue.d.ts +1 -0
  191. package/lib/labelValue.d.ts.map +1 -0
  192. package/lib/localToUTC.d.ts +1 -0
  193. package/lib/localToUTC.d.ts.map +1 -0
  194. package/lib/logUnsupportedDefaultForEnum.d.ts +2 -1
  195. package/lib/logUnsupportedDefaultForEnum.d.ts.map +1 -0
  196. package/lib/logUnsupportedDefaultForEnum.js +1 -1
  197. package/lib/logUnsupportedDefaultForEnum.js.map +1 -1
  198. package/lib/lookupFromFormContext.d.ts +3 -2
  199. package/lib/lookupFromFormContext.d.ts.map +1 -0
  200. package/lib/lookupFromFormContext.js +4 -5
  201. package/lib/lookupFromFormContext.js.map +1 -1
  202. package/lib/mergeDefaultsWithFormData.d.ts +1 -0
  203. package/lib/mergeDefaultsWithFormData.d.ts.map +1 -0
  204. package/lib/mergeDefaultsWithFormData.js +20 -16
  205. package/lib/mergeDefaultsWithFormData.js.map +1 -1
  206. package/lib/mergeObjects.d.ts +2 -1
  207. package/lib/mergeObjects.d.ts.map +1 -0
  208. package/lib/mergeObjects.js +1 -1
  209. package/lib/mergeObjects.js.map +1 -1
  210. package/lib/mergeSchemas.d.ts +2 -1
  211. package/lib/mergeSchemas.d.ts.map +1 -0
  212. package/lib/mergeSchemas.js +4 -5
  213. package/lib/mergeSchemas.js.map +1 -1
  214. package/lib/nameGenerators.d.ts +2 -1
  215. package/lib/nameGenerators.d.ts.map +1 -0
  216. package/lib/noop.d.ts +5 -0
  217. package/lib/noop.d.ts.map +1 -0
  218. package/lib/noop.js +5 -0
  219. package/lib/noop.js.map +1 -0
  220. package/lib/optionsList.d.ts +2 -1
  221. package/lib/optionsList.d.ts.map +1 -0
  222. package/lib/optionsList.js +15 -15
  223. package/lib/optionsList.js.map +1 -1
  224. package/lib/orderProperties.d.ts +1 -0
  225. package/lib/orderProperties.d.ts.map +1 -0
  226. package/lib/pad.d.ts +1 -0
  227. package/lib/pad.d.ts.map +1 -0
  228. package/lib/parseDateString.d.ts +2 -1
  229. package/lib/parseDateString.d.ts.map +1 -0
  230. package/lib/parser/ParserValidator.d.ts +2 -1
  231. package/lib/parser/ParserValidator.d.ts.map +1 -0
  232. package/lib/parser/ParserValidator.js +8 -7
  233. package/lib/parser/ParserValidator.js.map +1 -1
  234. package/lib/parser/index.d.ts +3 -2
  235. package/lib/parser/index.d.ts.map +1 -0
  236. package/lib/parser/index.js +1 -1
  237. package/lib/parser/index.js.map +1 -1
  238. package/lib/parser/schemaParser.d.ts +3 -2
  239. package/lib/parser/schemaParser.d.ts.map +1 -0
  240. package/lib/parser/schemaParser.js +6 -7
  241. package/lib/parser/schemaParser.js.map +1 -1
  242. package/lib/pathUtils.d.ts +77 -0
  243. package/lib/pathUtils.d.ts.map +1 -0
  244. package/lib/pathUtils.js +192 -0
  245. package/lib/pathUtils.js.map +1 -0
  246. package/lib/rangeSpec.d.ts +2 -1
  247. package/lib/rangeSpec.d.ts.map +1 -0
  248. package/lib/removeOptionalEmptyObjects.d.ts +2 -1
  249. package/lib/removeOptionalEmptyObjects.d.ts.map +1 -0
  250. package/lib/removeOptionalEmptyObjects.js +2 -2
  251. package/lib/removeOptionalEmptyObjects.js.map +1 -1
  252. package/lib/replaceStringParameters.d.ts +1 -0
  253. package/lib/replaceStringParameters.d.ts.map +1 -0
  254. package/lib/resolveUiSchema.d.ts +2 -1
  255. package/lib/resolveUiSchema.d.ts.map +1 -0
  256. package/lib/resolveUiSchema.js +6 -8
  257. package/lib/resolveUiSchema.js.map +1 -1
  258. package/lib/schema/findFieldInSchema.d.ts +2 -1
  259. package/lib/schema/findFieldInSchema.d.ts.map +1 -0
  260. package/lib/schema/findFieldInSchema.js +10 -11
  261. package/lib/schema/findFieldInSchema.js.map +1 -1
  262. package/lib/schema/findSelectedOptionInXxxOf.d.ts +2 -1
  263. package/lib/schema/findSelectedOptionInXxxOf.d.ts.map +1 -0
  264. package/lib/schema/findSelectedOptionInXxxOf.js +7 -7
  265. package/lib/schema/findSelectedOptionInXxxOf.js.map +1 -1
  266. package/lib/schema/getClosestMatchingOption.d.ts +2 -1
  267. package/lib/schema/getClosestMatchingOption.d.ts.map +1 -0
  268. package/lib/schema/getClosestMatchingOption.js +18 -23
  269. package/lib/schema/getClosestMatchingOption.js.map +1 -1
  270. package/lib/schema/getDefaultFormState.d.ts +2 -1
  271. package/lib/schema/getDefaultFormState.d.ts.map +1 -0
  272. package/lib/schema/getDefaultFormState.js +78 -56
  273. package/lib/schema/getDefaultFormState.js.map +1 -1
  274. package/lib/schema/getDisplayLabel.d.ts +2 -1
  275. package/lib/schema/getDisplayLabel.d.ts.map +1 -0
  276. package/lib/schema/getDisplayLabel.js +7 -7
  277. package/lib/schema/getDisplayLabel.js.map +1 -1
  278. package/lib/schema/getFirstMatchingOption.d.ts +2 -1
  279. package/lib/schema/getFirstMatchingOption.d.ts.map +1 -0
  280. package/lib/schema/getFirstMatchingOption.js +9 -9
  281. package/lib/schema/getFirstMatchingOption.js.map +1 -1
  282. package/lib/schema/getFromSchema.d.ts +3 -2
  283. package/lib/schema/getFromSchema.d.ts.map +1 -0
  284. package/lib/schema/getFromSchema.js +10 -11
  285. package/lib/schema/getFromSchema.js.map +1 -1
  286. package/lib/schema/index.d.ts +15 -14
  287. package/lib/schema/index.d.ts.map +1 -0
  288. package/lib/schema/index.js +14 -14
  289. package/lib/schema/index.js.map +1 -1
  290. package/lib/schema/isFilesArray.d.ts +2 -1
  291. package/lib/schema/isFilesArray.d.ts.map +1 -0
  292. package/lib/schema/isFilesArray.js +2 -2
  293. package/lib/schema/isFilesArray.js.map +1 -1
  294. package/lib/schema/isMultiSelect.d.ts +2 -1
  295. package/lib/schema/isMultiSelect.d.ts.map +1 -0
  296. package/lib/schema/isMultiSelect.js +1 -1
  297. package/lib/schema/isMultiSelect.js.map +1 -1
  298. package/lib/schema/isSelect.d.ts +2 -1
  299. package/lib/schema/isSelect.d.ts.map +1 -0
  300. package/lib/schema/isSelect.js +2 -2
  301. package/lib/schema/isSelect.js.map +1 -1
  302. package/lib/schema/omitExtraData.d.ts +2 -1
  303. package/lib/schema/omitExtraData.d.ts.map +1 -0
  304. package/lib/schema/omitExtraData.js +100 -64
  305. package/lib/schema/omitExtraData.js.map +1 -1
  306. package/lib/schema/retrieveSchema.d.ts +2 -1
  307. package/lib/schema/retrieveSchema.d.ts.map +1 -0
  308. package/lib/schema/retrieveSchema.js +32 -40
  309. package/lib/schema/retrieveSchema.js.map +1 -1
  310. package/lib/schema/sanitizeDataForNewSchema.d.ts +4 -3
  311. package/lib/schema/sanitizeDataForNewSchema.d.ts.map +1 -0
  312. package/lib/schema/sanitizeDataForNewSchema.js +41 -39
  313. package/lib/schema/sanitizeDataForNewSchema.js.map +1 -1
  314. package/lib/schema/shallowAllOfMerge.d.ts +1 -0
  315. package/lib/schema/shallowAllOfMerge.d.ts.map +1 -0
  316. package/lib/schema/toPathSchema.d.ts +2 -1
  317. package/lib/schema/toPathSchema.d.ts.map +1 -0
  318. package/lib/schema/toPathSchema.js +14 -14
  319. package/lib/schema/toPathSchema.js.map +1 -1
  320. package/lib/schemaRequiresTrueValue.d.ts +2 -1
  321. package/lib/schemaRequiresTrueValue.d.ts.map +1 -0
  322. package/lib/schemaRequiresTrueValue.js +3 -4
  323. package/lib/schemaRequiresTrueValue.js.map +1 -1
  324. package/lib/shallowEquals.d.ts +1 -0
  325. package/lib/shallowEquals.d.ts.map +1 -0
  326. package/lib/shouldRender.d.ts +2 -1
  327. package/lib/shouldRender.d.ts.map +1 -0
  328. package/lib/shouldRender.js +2 -2
  329. package/lib/shouldRender.js.map +1 -1
  330. package/lib/shouldRenderOptionalField.d.ts +2 -1
  331. package/lib/shouldRenderOptionalField.d.ts.map +1 -0
  332. package/lib/shouldRenderOptionalField.js +11 -10
  333. package/lib/shouldRenderOptionalField.js.map +1 -1
  334. package/lib/toConstant.d.ts +2 -1
  335. package/lib/toConstant.d.ts.map +1 -0
  336. package/lib/toConstant.js +1 -1
  337. package/lib/toConstant.js.map +1 -1
  338. package/lib/toDateString.d.ts +2 -1
  339. package/lib/toDateString.d.ts.map +1 -0
  340. package/lib/toErrorList.d.ts +2 -1
  341. package/lib/toErrorList.d.ts.map +1 -0
  342. package/lib/toErrorList.js +20 -21
  343. package/lib/toErrorList.js.map +1 -1
  344. package/lib/toErrorSchema.d.ts +2 -1
  345. package/lib/toErrorSchema.d.ts.map +1 -0
  346. package/lib/toErrorSchema.js +4 -9
  347. package/lib/toErrorSchema.js.map +1 -1
  348. package/lib/toFieldPathId.d.ts +2 -1
  349. package/lib/toFieldPathId.d.ts.map +1 -0
  350. package/lib/toFieldPathId.js +2 -2
  351. package/lib/toFieldPathId.js.map +1 -1
  352. package/lib/types.d.ts +15 -5
  353. package/lib/types.d.ts.map +1 -0
  354. package/lib/types.js +1 -1
  355. package/lib/types.js.map +1 -1
  356. package/lib/unwrapErrorHandler.d.ts +2 -1
  357. package/lib/unwrapErrorHandler.d.ts.map +1 -0
  358. package/lib/unwrapErrorHandler.js +13 -4
  359. package/lib/unwrapErrorHandler.js.map +1 -1
  360. package/lib/useAltDateWidgetProps.d.ts +3 -2
  361. package/lib/useAltDateWidgetProps.d.ts.map +1 -0
  362. package/lib/useAltDateWidgetProps.js +5 -5
  363. package/lib/useAltDateWidgetProps.js.map +1 -1
  364. package/lib/useDeepCompareMemo.d.ts +1 -0
  365. package/lib/useDeepCompareMemo.d.ts.map +1 -0
  366. package/lib/useDeepCompareMemo.js +1 -1
  367. package/lib/useDeepCompareMemo.js.map +1 -1
  368. package/lib/useFileWidgetProps.d.ts +1 -0
  369. package/lib/useFileWidgetProps.d.ts.map +1 -0
  370. package/lib/useFileWidgetProps.js +3 -4
  371. package/lib/useFileWidgetProps.js.map +1 -1
  372. package/lib/utcToLocal.d.ts +1 -0
  373. package/lib/utcToLocal.d.ts.map +1 -0
  374. package/lib/utcToLocal.js +1 -1
  375. package/lib/utcToLocal.js.map +1 -1
  376. package/lib/validationDataMerge.d.ts +2 -1
  377. package/lib/validationDataMerge.d.ts.map +1 -0
  378. package/lib/validationDataMerge.js +3 -4
  379. package/lib/validationDataMerge.js.map +1 -1
  380. package/lib/withIdRefPrefix.d.ts +2 -1
  381. package/lib/withIdRefPrefix.d.ts.map +1 -0
  382. package/lib/withIdRefPrefix.js +2 -2
  383. package/lib/withIdRefPrefix.js.map +1 -1
  384. package/package.json +5 -6
  385. package/src/ErrorSchemaBuilder.ts +25 -24
  386. package/src/SelectedOptionDescription.tsx +5 -5
  387. package/src/allowAdditionalItems.ts +2 -2
  388. package/src/asNumber.ts +1 -1
  389. package/src/canExpand.ts +2 -2
  390. package/src/constIsAjvDataReference.ts +5 -4
  391. package/src/createErrorHandler.ts +5 -7
  392. package/src/createSchemaUtils.ts +8 -10
  393. package/src/dateRangeOptions.ts +2 -2
  394. package/src/englishStringTranslator.ts +2 -2
  395. package/src/enumOptionSelectedValue.ts +2 -2
  396. package/src/enumOptionValueDecoder.ts +2 -2
  397. package/src/enumOptionValueEncoder.ts +2 -4
  398. package/src/enumOptionsDeselectValue.ts +3 -3
  399. package/src/enumOptionsIndexForValue.ts +2 -2
  400. package/src/enumOptionsIsSelected.ts +2 -2
  401. package/src/enumOptionsSelectValue.ts +3 -5
  402. package/src/enumOptionsValueForIndex.ts +1 -1
  403. package/src/findSchemaDefinition.ts +8 -12
  404. package/src/getChangedFields.ts +57 -18
  405. package/src/getDateElementProps.ts +1 -1
  406. package/src/getDiscriminatorFieldFromSchema.ts +5 -7
  407. package/src/getInputProps.ts +6 -2
  408. package/src/getOptionMatchingSimpleDiscriminator.ts +7 -7
  409. package/src/getOptionValueFormat.ts +1 -1
  410. package/src/getPropertySchema.ts +18 -0
  411. package/src/getSchemaType.ts +2 -2
  412. package/src/getSubmitButtonOptions.ts +3 -3
  413. package/src/getTemplate.ts +1 -1
  414. package/src/getTestIds.ts +7 -6
  415. package/src/getUiOptions.ts +3 -3
  416. package/src/getWidget.tsx +6 -6
  417. package/src/hasWidget.ts +2 -2
  418. package/src/hashForSchema.ts +20 -9
  419. package/src/idGenerators.ts +3 -5
  420. package/src/index.ts +99 -85
  421. package/src/isConstant.ts +2 -2
  422. package/src/isCustomWidget.ts +2 -2
  423. package/src/isFixedItems.ts +2 -2
  424. package/src/isFormDataAvailable.ts +7 -5
  425. package/src/isObject.ts +15 -3
  426. package/src/isPlainObject.ts +14 -0
  427. package/src/isRootSchema.ts +3 -3
  428. package/src/logUnsupportedDefaultForEnum.ts +2 -2
  429. package/src/lookupFromFormContext.ts +7 -8
  430. package/src/mergeDefaultsWithFormData.ts +22 -18
  431. package/src/mergeObjects.ts +2 -2
  432. package/src/mergeSchemas.ts +5 -7
  433. package/src/nameGenerators.ts +1 -1
  434. package/src/noop.ts +4 -0
  435. package/src/optionsList.ts +9 -9
  436. package/src/orderProperties.ts +1 -1
  437. package/src/parseDateString.ts +1 -1
  438. package/src/parser/ParserValidator.ts +5 -7
  439. package/src/parser/index.ts +2 -2
  440. package/src/parser/schemaParser.ts +8 -10
  441. package/src/pathUtils.ts +203 -0
  442. package/src/rangeSpec.ts +1 -1
  443. package/src/removeOptionalEmptyObjects.ts +3 -3
  444. package/src/resolveUiSchema.ts +5 -7
  445. package/src/schema/findFieldInSchema.ts +11 -13
  446. package/src/schema/findSelectedOptionInXxxOf.ts +9 -10
  447. package/src/schema/getClosestMatchingOption.ts +73 -83
  448. package/src/schema/getDefaultFormState.ts +62 -34
  449. package/src/schema/getDisplayLabel.ts +7 -7
  450. package/src/schema/getFirstMatchingOption.ts +10 -11
  451. package/src/schema/getFromSchema.ts +12 -14
  452. package/src/schema/index.ts +14 -14
  453. package/src/schema/isFilesArray.ts +3 -3
  454. package/src/schema/isMultiSelect.ts +2 -2
  455. package/src/schema/isSelect.ts +3 -3
  456. package/src/schema/omitExtraData.ts +104 -68
  457. package/src/schema/retrieveSchema.ts +47 -60
  458. package/src/schema/sanitizeDataForNewSchema.ts +42 -41
  459. package/src/schema/toPathSchema.ts +14 -14
  460. package/src/schemaRequiresTrueValue.ts +1 -1
  461. package/src/shouldRender.ts +3 -3
  462. package/src/shouldRenderOptionalField.ts +14 -14
  463. package/src/toConstant.ts +2 -2
  464. package/src/toDateString.ts +1 -1
  465. package/src/toErrorList.ts +22 -25
  466. package/src/toErrorSchema.ts +5 -11
  467. package/src/toFieldPathId.ts +2 -2
  468. package/src/types.ts +14 -5
  469. package/src/unwrapErrorHandler.ts +15 -6
  470. package/src/useAltDateWidgetProps.tsx +7 -7
  471. package/src/useDeepCompareMemo.ts +1 -1
  472. package/src/useFileWidgetProps.ts +1 -1
  473. package/src/utcToLocal.ts +1 -1
  474. package/src/validationDataMerge.ts +4 -6
  475. package/src/withIdRefPrefix.ts +3 -4
  476. package/lib/tsconfig.tsbuildinfo +0 -1
  477. package/src/tsconfig.json +0 -9
@@ -1,4 +1,4 @@
1
- import type { ErrorSchema, ValidationData } from './types.js';
1
+ import type { ErrorSchema, ValidationData } from './types.ts';
2
2
  /** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in the
3
3
  * two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling
4
4
  * `toErrorList()` on the `errors` in the `validationData`. If no `additionalErrorSchema` is passed, then
@@ -10,3 +10,4 @@ import type { ErrorSchema, ValidationData } from './types.js';
10
10
  * @returns - The `validationData` with the additional errors from `additionalErrorSchema` merged into it, if provided.
11
11
  */
12
12
  export default function validationDataMerge<T = any>(validationData: ValidationData<T>, additionalErrorSchema?: ErrorSchema<T>, preventDuplicates?: boolean): ValidationData<T>;
13
+ //# sourceMappingURL=validationDataMerge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validationDataMerge.d.ts","sourceRoot":"","sources":["../src/validationDataMerge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE9D;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,CAAC,GAAG,GAAG,EACjD,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,EACjC,qBAAqB,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EACtC,iBAAiB,UAAQ,GACxB,cAAc,CAAC,CAAC,CAAC,CAgBnB"}
@@ -1,6 +1,5 @@
1
- import isEmpty from 'lodash-es/isEmpty.js';
2
- import mergeObjects from './mergeObjects.js';
3
- import toErrorList from './toErrorList.js';
1
+ import mergeObjects from "./mergeObjects.js";
2
+ import toErrorList from "./toErrorList.js";
4
3
  /** Merges the errors in `additionalErrorSchema` into the existing `validationData` by combining the hierarchies in the
5
4
  * two `ErrorSchema`s and then appending the error list from the `additionalErrorSchema` obtained by calling
6
5
  * `toErrorList()` on the `errors` in the `validationData`. If no `additionalErrorSchema` is passed, then
@@ -18,7 +17,7 @@ export default function validationDataMerge(validationData, additionalErrorSchem
18
17
  const { errors: oldErrors, errorSchema: oldErrorSchema } = validationData;
19
18
  let errors = toErrorList(additionalErrorSchema);
20
19
  let errorSchema = additionalErrorSchema;
21
- if (!isEmpty(oldErrorSchema)) {
20
+ if (oldErrorSchema && Object.keys(oldErrorSchema).length > 0) {
22
21
  errorSchema = mergeObjects(oldErrorSchema, additionalErrorSchema, preventDuplicates ? 'preventDuplicates' : true);
23
22
  errors = [...oldErrors].concat(errors);
24
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validationDataMerge.js","sourceRoot":"","sources":["../src/validationDataMerge.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,WAAW,MAAM,eAAe,CAAC;AAGxC;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CACzC,cAAiC,EACjC,qBAAsC,EACtC,iBAAiB,GAAG,KAAK;IAEzB,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC3B,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,cAAc,CAAC;IAC1E,IAAI,MAAM,GAAG,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAChD,IAA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AAM,EAAE,CAAC;AACjC,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { RJSFSchema, StrictRJSFSchema } from './types.js';
1
+ import type { RJSFSchema, StrictRJSFSchema } from './types.ts';
2
2
  /** Recursively prefixes all `$ref`s in a schema with the value of the `ROOT_SCHEMA_PREFIX` constant.
3
3
  * This is used in isValid to make references to the rootSchema
4
4
  *
@@ -6,3 +6,4 @@ import type { RJSFSchema, StrictRJSFSchema } from './types.js';
6
6
  * @returns - A copy of the `schemaNode` with updated `$ref`s
7
7
  */
8
8
  export default function withIdRefPrefix<S extends StrictRJSFSchema = RJSFSchema>(schemaNode: S | S[] | S[keyof S]): S | S[] | S[keyof S];
9
+ //# sourceMappingURL=withIdRefPrefix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withIdRefPrefix.d.ts","sourceRoot":"","sources":["../src/withIdRefPrefix.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAgC/D;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,CAAC,SAAS,gBAAgB,GAAG,UAAU,EAC7E,UAAU,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAC/B,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAQtB"}
@@ -1,5 +1,5 @@
1
- import isObject from 'lodash-es/isObject.js';
2
- import { REF_KEY, ROOT_SCHEMA_PREFIX } from './constants.js';
1
+ import { REF_KEY, ROOT_SCHEMA_PREFIX } from "./constants.js";
2
+ import isObject from "./isObject.js";
3
3
  /** Takes a `node` object and transforms any contained `$ref` node variables with a prefix, recursively calling
4
4
  * `withIdRefPrefix` for any other elements.
5
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"withIdRefPrefix.js","sourceRoot":"","sources":["../src/withIdRefPrefix.ts"],"names":[],"mappings":"AAAA,O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zB,OAAO,qBAAqB,CAAI,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@rjsf/utils",
3
- "version": "6.7.1",
3
+ "version": "6.10.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "type": "module",
8
+ "sideEffects": false,
8
9
  "description": "Utility functions for @rjsf/core",
9
10
  "exports": {
10
11
  ".": {
12
+ "@rjsf/source": "./src/index.ts",
11
13
  "types": "./lib/index.d.ts",
12
14
  "require": "./dist/index.cjs",
13
15
  "import": "./lib/index.js"
@@ -54,10 +56,8 @@
54
56
  "dependencies": {
55
57
  "@x0k/json-schema-merge": "^1.0.3",
56
58
  "fast-equals": "^6.0.0",
57
- "fast-uri": "^4.1.1",
59
+ "fast-uri": "^4.1.4",
58
60
  "jsonpointer": "^5.0.1",
59
- "lodash": "^4.18.1",
60
- "lodash-es": "^4.18.1",
61
61
  "react-is": "^18.3.1"
62
62
  },
63
63
  "devDependencies": {
@@ -84,8 +84,7 @@
84
84
  },
85
85
  "license": "Apache-2.0",
86
86
  "scripts": {
87
- "compileReplacer": "tsc -p tsconfig.replacer.json && move-file lodashReplacer.js lodashReplacer.cjs",
88
- "build:ts": "pnpm run compileReplacer && rimraf ./lib && tsc -b tsconfig.build.json && tsc-alias -p tsconfig.build.json",
87
+ "build:ts": "tsc -b",
89
88
  "build:cjs": "esbuild ./src/index.ts --bundle --outfile=dist/index.cjs --sourcemap --packages=external --format=cjs",
90
89
  "build:esm": "esbuild ./src/index.ts --bundle --outfile=dist/utils.esm.js --sourcemap --packages=external --format=esm",
91
90
  "build:umd": "rollup dist/utils.esm.js --format=umd --file=dist/utils.umd.js --name=@rjsf/utils",
@@ -1,10 +1,6 @@
1
- import cloneDeep from 'lodash/cloneDeep';
2
- import get from 'lodash/get';
3
- import set from 'lodash/set';
4
- import setWith from 'lodash/setWith';
5
-
6
- import { ERRORS_KEY } from './constants';
7
- import type { ErrorSchema, FieldPathList } from './types';
1
+ import { ERRORS_KEY } from './constants.ts';
2
+ import { getByPath, setByPath, toPath } from './pathUtils.ts';
3
+ import type { ErrorSchema, FieldPathList } from './types.ts';
8
4
 
9
5
  /** Represents the type of the path which can be a string of dotted path values or a list of string or numbers where
10
6
  * numbers represent array indexes/
@@ -44,12 +40,17 @@ export default class ErrorSchemaBuilder<T = any> {
44
40
  * @private
45
41
  */
46
42
  private getOrCreateErrorBlock(pathOfError?: PathType) {
47
- const hasPath = (Array.isArray(pathOfError) && pathOfError.length > 0) || typeof pathOfError === 'string';
48
- // @ts-expect-error TS2590 to avoid "Expression produces a union type that is too complex to represent" error
49
- let errorBlock: ErrorSchema = hasPath ? get(this.errorSchema, pathOfError) : this.errorSchema;
50
- if (!errorBlock && pathOfError) {
43
+ // A string path is dotted-path notation, so parse it into its segments
44
+ const path = typeof pathOfError === 'string' ? toPath(pathOfError) : (pathOfError ?? []);
45
+ if (path.length === 0) {
46
+ return this.errorSchema;
47
+ }
48
+ // An `ErrorSchema` only ever nests `ErrorSchema` blocks, so create any missing block along the path,
49
+ // always as a plain object since an `ErrorSchema` is never an array
50
+ let errorBlock = getByPath<ErrorSchema | undefined>(this.errorSchema, path);
51
+ if (!errorBlock) {
51
52
  errorBlock = {};
52
- setWith(this.errorSchema, pathOfError, errorBlock, Object);
53
+ setByPath(this.errorSchema, path, errorBlock, true);
53
54
  }
54
55
  return errorBlock;
55
56
  }
@@ -60,13 +61,13 @@ export default class ErrorSchemaBuilder<T = any> {
60
61
  * @returns - The `ErrorSchemaBuilder` object for chaining purposes
61
62
  */
62
63
  resetAllErrors(initialSchema?: ErrorSchema<T>) {
63
- this.errorSchema = initialSchema ? cloneDeep(initialSchema) : {};
64
+ this.errorSchema = initialSchema ? structuredClone(initialSchema) : {};
64
65
  return this;
65
66
  }
66
67
 
67
68
  /** Adds the `errorOrList` to the list of errors in the `ErrorSchema` at either the root level or the location within
68
- * the schema described by the `pathOfError`. For more information about how to specify the path see the
69
- * [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
69
+ * the schema described by the `pathOfError`. The path is either a dotted string (with optional bracketed array
70
+ * indexes, e.g. `'a.b[0]'`) or a list of path segments; keys containing dots require the list form.
70
71
  *
71
72
  * @param errorOrList - The error or list of errors to add into the `ErrorSchema`
72
73
  * @param [pathOfError] - The optional path into the `ErrorSchema` at which to add the error(s)
@@ -74,23 +75,23 @@ export default class ErrorSchemaBuilder<T = any> {
74
75
  */
75
76
  addErrors(errorOrList: string | string[], pathOfError?: PathType) {
76
77
  const errorBlock: ErrorSchema = this.getOrCreateErrorBlock(pathOfError);
77
- let errorsList = get(errorBlock, ERRORS_KEY);
78
+ let errorsList = errorBlock[ERRORS_KEY];
78
79
  if (!Array.isArray(errorsList)) {
79
80
  errorsList = [];
80
81
  errorBlock[ERRORS_KEY] = errorsList;
81
82
  }
82
83
 
83
84
  if (Array.isArray(errorOrList)) {
84
- set(errorBlock, ERRORS_KEY, [...new Set([...errorsList, ...errorOrList])]);
85
+ errorBlock[ERRORS_KEY] = [...new Set([...errorsList, ...errorOrList])];
85
86
  } else {
86
- set(errorBlock, ERRORS_KEY, [...new Set([...errorsList, errorOrList])]);
87
+ errorBlock[ERRORS_KEY] = [...new Set([...errorsList, errorOrList])];
87
88
  }
88
89
  return this;
89
90
  }
90
91
 
91
92
  /** Sets/replaces the `errorOrList` as the error(s) in the `ErrorSchema` at either the root level or the location
92
- * within the schema described by the `pathOfError`. For more information about how to specify the path see the
93
- * [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
93
+ * within the schema described by the `pathOfError`. The path is either a dotted string (with optional bracketed array
94
+ * indexes, e.g. `'a.b[0]'`) or a list of path segments; keys containing dots require the list form.
94
95
  *
95
96
  * @param errorOrList - The error or list of errors to set into the `ErrorSchema`
96
97
  * @param [pathOfError] - The optional path into the `ErrorSchema` at which to set the error(s)
@@ -100,20 +101,20 @@ export default class ErrorSchemaBuilder<T = any> {
100
101
  const errorBlock: ErrorSchema = this.getOrCreateErrorBlock(pathOfError);
101
102
  // Effectively clone the array being given to prevent accidental outside manipulation of the given list
102
103
  const listToAdd = Array.isArray(errorOrList) ? [...new Set([...errorOrList])] : [errorOrList];
103
- set(errorBlock, ERRORS_KEY, listToAdd);
104
+ errorBlock[ERRORS_KEY] = listToAdd;
104
105
  return this;
105
106
  }
106
107
 
107
108
  /** Clears the error(s) in the `ErrorSchema` at either the root level or the location within the schema described by
108
- * the `pathOfError`. For more information about how to specify the path see the
109
- * [eslint lodash plugin docs](https://github.com/wix/eslint-plugin-lodash/blob/master/docs/rules/path-style.md).
109
+ * the `pathOfError`. The path is either a dotted string (with optional bracketed array
110
+ * indexes, e.g. `'a.b[0]'`) or a list of path segments; keys containing dots require the list form.
110
111
  *
111
112
  * @param [pathOfError] - The optional path into the `ErrorSchema` at which to clear the error(s)
112
113
  * @returns - The `ErrorSchemaBuilder` object for chaining purposes
113
114
  */
114
115
  clearErrors(pathOfError?: PathType) {
115
116
  const errorBlock: ErrorSchema = this.getOrCreateErrorBlock(pathOfError);
116
- set(errorBlock, ERRORS_KEY, []);
117
+ errorBlock[ERRORS_KEY] = [];
117
118
  return this;
118
119
  }
119
120
  }
@@ -1,8 +1,8 @@
1
- import enumOptionsIsSelected from './enumOptionsIsSelected';
2
- import getTemplate from './getTemplate';
3
- import getUiOptions from './getUiOptions';
4
- import { descriptionId } from './idGenerators';
5
- import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from './types';
1
+ import enumOptionsIsSelected from './enumOptionsIsSelected.ts';
2
+ import getTemplate from './getTemplate.ts';
3
+ import getUiOptions from './getUiOptions.ts';
4
+ import { descriptionId } from './idGenerators.ts';
5
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from './types.ts';
6
6
 
7
7
  export type SelectedOptionDescriptionProps<
8
8
  T = any,
@@ -1,5 +1,5 @@
1
- import isObject from './isObject';
2
- import type { RJSFSchema, StrictRJSFSchema } from './types';
1
+ import isObject from './isObject.ts';
2
+ import type { RJSFSchema, StrictRJSFSchema } from './types.ts';
3
3
 
4
4
  /** Checks the schema to see if it is allowing additional items, by verifying that `schema.additionalItems` is an
5
5
  * object. The user is warned in the console if `schema.additionalItems` has the value `true`.
package/src/asNumber.ts CHANGED
@@ -1,4 +1,4 @@
1
- import getDecimalSeparator from './getDecimalSeparator';
1
+ import getDecimalSeparator from './getDecimalSeparator.ts';
2
2
 
3
3
  /** Attempts to convert the string into a number. If an empty string is provided, then `undefined` is returned.
4
4
  * If a `null` is provided, it is returned. If the string ends in a `.` or the locale-specific separator then the
package/src/canExpand.ts CHANGED
@@ -1,5 +1,5 @@
1
- import getUiOptions from './getUiOptions';
2
- import type { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema } from './types';
1
+ import getUiOptions from './getUiOptions.ts';
2
+ import type { FormContextType, RJSFSchema, StrictRJSFSchema, UiSchema } from './types.ts';
3
3
 
4
4
  /** Checks whether the field described by `schema`, having the `uiSchema` and `formData` supports expanding. The UI for
5
5
  * the field can expand if it has additional properties, is not forced as non-expandable by the `uiSchema` and the
@@ -1,8 +1,7 @@
1
1
  import type { JSONSchema7Type } from 'json-schema';
2
- import isString from 'lodash/isString';
3
2
 
4
- import { CONST_KEY, getSchemaType, isObject } from './';
5
- import type { RJSFSchema, StrictRJSFSchema } from './types';
3
+ import { CONST_KEY, getSchemaType, isObject } from './index.ts';
4
+ import type { RJSFSchema, StrictRJSFSchema } from './types.ts';
6
5
 
7
6
  /**
8
7
  * Checks if the schema const property value is an AJV $data reference
@@ -14,5 +13,7 @@ import type { RJSFSchema, StrictRJSFSchema } from './types';
14
13
  export default function constIsAjvDataReference<S extends StrictRJSFSchema = RJSFSchema>(schema: S): boolean {
15
14
  const schemaConst = schema[CONST_KEY] as JSONSchema7Type & { $data: string };
16
15
  const schemaType = getSchemaType<S>(schema);
17
- return isObject(schemaConst) && isString(schemaConst?.$data) && schemaType !== 'object' && schemaType !== 'array';
16
+ return (
17
+ isObject(schemaConst) && typeof schemaConst?.$data === 'string' && schemaType !== 'object' && schemaType !== 'array'
18
+ );
18
19
  }
@@ -1,7 +1,6 @@
1
- import isPlainObject from 'lodash/isPlainObject';
2
-
3
- import { ERRORS_KEY } from './constants';
4
- import type { FieldValidation, FormValidation, GenericObjectType } from './types';
1
+ import { ERRORS_KEY } from './constants.ts';
2
+ import isPlainObject from './isPlainObject.ts';
3
+ import type { FieldValidation, FormValidation } from './types.ts';
5
4
 
6
5
  /** Given a `formData` object, recursively creates a `FormValidation` error handling structure around it
7
6
  *
@@ -22,9 +21,8 @@ export default function createErrorHandler<T = any>(formData: T): FormValidation
22
21
  return formData.reduce((acc, value, key) => ({ ...acc, [key]: createErrorHandler(value) }), handler);
23
22
  }
24
23
  if (isPlainObject(formData)) {
25
- const formObject: GenericObjectType = formData as GenericObjectType;
26
- return Object.keys(formObject).reduce(
27
- (acc, key) => ({ ...acc, [key]: createErrorHandler(formObject[key]) }),
24
+ return Object.keys(formData).reduce(
25
+ (acc, key) => ({ ...acc, [key]: createErrorHandler(formData[key]) }),
28
26
  handler as FormValidation<T>,
29
27
  );
30
28
  }
@@ -1,8 +1,6 @@
1
- import get from 'lodash/get';
2
-
3
- import { ID_KEY, JSON_SCHEMA_DRAFT_2020_12, SCHEMA_KEY } from './constants';
4
- import deepEquals from './deepEquals';
5
- import { makeAllReferencesAbsolute } from './findSchemaDefinition';
1
+ import { ID_KEY, JSON_SCHEMA_DRAFT_2020_12, SCHEMA_KEY } from './constants.ts';
2
+ import deepEquals from './deepEquals.ts';
3
+ import { makeAllReferencesAbsolute } from './findSchemaDefinition.ts';
6
4
  import {
7
5
  findFieldInSchema,
8
6
  findSelectedOptionInXxxOf,
@@ -18,7 +16,7 @@ import {
18
16
  retrieveSchema,
19
17
  sanitizeDataForNewSchema,
20
18
  toPathSchema,
21
- } from './schema';
19
+ } from './schema/index.ts';
22
20
  import type {
23
21
  Experimental_CustomMergeAllOf,
24
22
  Experimental_DefaultFormStateBehavior,
@@ -32,7 +30,7 @@ import type {
32
30
  StrictRJSFSchema,
33
31
  UiSchema,
34
32
  ValidatorType,
35
- } from './types';
33
+ } from './types.ts';
36
34
 
37
35
  /** The `SchemaUtils` class provides a wrapper around the publicly exported APIs in the `utils/schema` directory such
38
36
  * that one does not have to explicitly pass the `validator`, `rootSchema`, `experimental_defaultFormStateBehavior` or
@@ -64,7 +62,7 @@ class SchemaUtils<
64
62
  experimental_customMergeAllOf?: Experimental_CustomMergeAllOf<S>,
65
63
  ) {
66
64
  if (rootSchema?.[SCHEMA_KEY] === JSON_SCHEMA_DRAFT_2020_12) {
67
- this.rootSchema = makeAllReferencesAbsolute(rootSchema, get(rootSchema, ID_KEY, '#'));
65
+ this.rootSchema = makeAllReferencesAbsolute(rootSchema, rootSchema[ID_KEY] ?? '#');
68
66
  } else {
69
67
  this.rootSchema = rootSchema;
70
68
  }
@@ -253,8 +251,8 @@ class SchemaUtils<
253
251
  return getFirstMatchingOption<T, S, F>(this.validator, formData, options, this.rootSchema, discriminatorField);
254
252
  }
255
253
 
256
- /** Helper that acts like lodash's `get` but additionally retrieves `$ref`s as needed to get the path for schemas
257
- * containing potentially nested `$ref`s.
254
+ /** Reads the value at `path` within a schema, additionally retrieving `$ref`s as needed to resolve
255
+ * schemas containing potentially nested `$ref`s.
258
256
  *
259
257
  * @param schema - The current node within the JSON schema recursion
260
258
  * @param path - The remaining keys in the path to the desired property
@@ -1,5 +1,5 @@
1
- import pad from './pad';
2
- import type { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';
1
+ import pad from './pad.ts';
2
+ import type { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types.ts';
3
3
 
4
4
  /** Returns a list of options for a date range between `start` and `stop`. If the start date is greater than the end
5
5
  * date, then the date range is reversed. If `start` and `stop` are negative numbers (or zero), then they will be
@@ -1,5 +1,5 @@
1
- import type { TranslatableString } from './enums';
2
- import replaceStringParameters from './replaceStringParameters';
1
+ import type { TranslatableString } from './enums.ts';
2
+ import replaceStringParameters from './replaceStringParameters.ts';
3
3
 
4
4
  /** Translates a `TranslatableString` value `stringToTranslate` into english. When a `params` array is provided, each
5
5
  * value in the array is used to replace any of the replaceable parameters in the `stringToTranslate` using the `%1`,
@@ -1,5 +1,5 @@
1
- import enumOptionsIndexForValue from './enumOptionsIndexForValue';
2
- import type { EnumOptionsType, OptionValueFormat, StrictRJSFSchema, RJSFSchema } from './types';
1
+ import enumOptionsIndexForValue from './enumOptionsIndexForValue.ts';
2
+ import type { EnumOptionsType, OptionValueFormat, StrictRJSFSchema, RJSFSchema } from './types.ts';
3
3
 
4
4
  /** Computes the value to pass to a select element's `value` attribute.
5
5
  *
@@ -1,5 +1,5 @@
1
- import enumOptionsValueForIndex from './enumOptionsValueForIndex';
2
- import type { EnumOptionsType, OptionValueFormat, StrictRJSFSchema, RJSFSchema } from './types';
1
+ import enumOptionsValueForIndex from './enumOptionsValueForIndex.ts';
2
+ import type { EnumOptionsType, OptionValueFormat, StrictRJSFSchema, RJSFSchema } from './types.ts';
3
3
 
4
4
  /** Resolves a single DOM value string back to its typed enum value in `'realValue'` mode.
5
5
  *
@@ -1,6 +1,4 @@
1
- import isNil from 'lodash/isNil';
2
-
3
- import type { OptionValueFormat } from './types';
1
+ import type { OptionValueFormat } from './types.ts';
4
2
 
5
3
  /** Encodes an enum option value into a string for a DOM value attribute.
6
4
  *
@@ -23,7 +21,7 @@ export default function enumOptionValueEncoder(
23
21
  if (format !== 'realValue') {
24
22
  return String(index);
25
23
  }
26
- if (isNil(value)) {
24
+ if (value == null) {
27
25
  return '';
28
26
  }
29
27
  if (typeof value === 'object') {
@@ -1,6 +1,6 @@
1
- import deepEquals from './deepEquals';
2
- import enumOptionsValueForIndex from './enumOptionsValueForIndex';
3
- import type { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';
1
+ import deepEquals from './deepEquals.ts';
2
+ import enumOptionsValueForIndex from './enumOptionsValueForIndex.ts';
3
+ import type { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types.ts';
4
4
 
5
5
  /** Removes the enum option value at the `valueIndex` from the currently `selected` (list of) value(s). If `selected` is
6
6
  * a list, then that list is updated to remove the enum option value with the `valueIndex` in `allEnumOptions`. If it is
@@ -1,5 +1,5 @@
1
- import enumOptionsIsSelected from './enumOptionsIsSelected';
2
- import type { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';
1
+ import enumOptionsIsSelected from './enumOptionsIsSelected.ts';
2
+ import type { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types.ts';
3
3
 
4
4
  /** Returns the index(es) of the options in `allEnumOptions` whose value(s) match the ones in `value`. All the
5
5
  * `enumOptions` are filtered based on whether they are a "selected" `value` and the index of each selected one is then
@@ -1,5 +1,5 @@
1
- import deepEquals from './deepEquals';
2
- import type { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';
1
+ import deepEquals from './deepEquals.ts';
2
+ import type { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types.ts';
3
3
 
4
4
  /** Determines whether the given `value` is (one of) the `selected` value(s).
5
5
  *
@@ -1,7 +1,5 @@
1
- import isNil from 'lodash/isNil';
2
-
3
- import enumOptionsValueForIndex from './enumOptionsValueForIndex';
4
- import type { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';
1
+ import enumOptionsValueForIndex from './enumOptionsValueForIndex.ts';
2
+ import type { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types.ts';
5
3
 
6
4
  /** Add the enum option value at the `valueIndex` to the list of `selected` values in the proper order as defined by
7
5
  * `allEnumOptions`
@@ -17,7 +15,7 @@ export default function enumOptionsSelectValue<S extends StrictRJSFSchema = RJSF
17
15
  allEnumOptions: EnumOptionsType<S>[] = [],
18
16
  ) {
19
17
  const value = enumOptionsValueForIndex<S>(valueIndex, allEnumOptions);
20
- if (!isNil(value)) {
18
+ if (value != null) {
21
19
  const index = allEnumOptions.findIndex((opt) => value === opt.value);
22
20
  const all = allEnumOptions.map(({ value: val }) => val);
23
21
  const updated = selected.slice(0, index).concat(value, selected.slice(index));
@@ -1,4 +1,4 @@
1
- import type { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types';
1
+ import type { EnumOptionsType, RJSFSchema, StrictRJSFSchema } from './types.ts';
2
2
 
3
3
  /** Returns the value(s) from `allEnumOptions` at the index(es) provided by `valueIndex`. If `valueIndex` is not an
4
4
  * array AND the index is not valid for `allEnumOptions`, `emptyValue` is returned. If `valueIndex` is an array, AND it
@@ -1,9 +1,5 @@
1
1
  import UriResolver from 'fast-uri';
2
2
  import jsonpointer from 'jsonpointer';
3
- import get from 'lodash/get';
4
- import isEmpty from 'lodash/isEmpty';
5
- import isObject from 'lodash/isObject';
6
- import omit from 'lodash/omit';
7
3
 
8
4
  import {
9
5
  ALL_OF_KEY,
@@ -12,8 +8,9 @@ import {
12
8
  JSON_SCHEMA_DRAFT_2020_12,
13
9
  REF_KEY,
14
10
  SCHEMA_KEY,
15
- } from './constants';
16
- import type { GenericObjectType, RJSFSchema, StrictRJSFSchema } from './types';
11
+ } from './constants.ts';
12
+ import isObject from './isObject.ts';
13
+ import type { GenericObjectType, RJSFSchema, StrictRJSFSchema } from './types.ts';
17
14
 
18
15
  /** Looks for the `$id` pointed by `ref` in the schema definitions embedded in
19
16
  * a JSON Schema bundle
@@ -52,7 +49,7 @@ function findEmbeddedSchemaRecursive<S extends StrictRJSFSchema = RJSFSchema>(sc
52
49
  * @param baseURI - The base URI to be used for resolving relative references
53
50
  */
54
51
  export function makeAllReferencesAbsolute<S extends StrictRJSFSchema = RJSFSchema>(schema: S, baseURI: string): S {
55
- const currentURI = get(schema, ID_KEY, baseURI);
52
+ const currentURI = schema[ID_KEY] ?? baseURI;
56
53
  let result = schema;
57
54
  // Make all other references absolute
58
55
  if (REF_KEY in result) {
@@ -81,8 +78,7 @@ export function makeAllReferencesAbsolute<S extends StrictRJSFSchema = RJSFSchem
81
78
  * value from `object[key]`
82
79
  */
83
80
  export function splitKeyElementFromObject(key: string, object: GenericObjectType) {
84
- const value = object[key];
85
- const remaining = omit(object, [key]);
81
+ const { [key]: value, ...remaining } = object;
86
82
  return [remaining, value];
87
83
  }
88
84
 
@@ -102,7 +98,7 @@ export function findSchemaDefinitionRecursive<S extends StrictRJSFSchema = RJSFS
102
98
  $ref?: string,
103
99
  rootSchema: S = {} as S,
104
100
  recurseList: string[] = [],
105
- baseURI: string | undefined = get(rootSchema, [ID_KEY]),
101
+ baseURI: string | undefined = rootSchema[ID_KEY],
106
102
  ): S {
107
103
  const ref = $ref || '';
108
104
  let current: S | undefined = undefined;
@@ -124,7 +120,7 @@ export function findSchemaDefinitionRecursive<S extends StrictRJSFSchema = RJSFS
124
120
  current = findEmbeddedSchemaRecursive<S>(rootSchema, refId.replace(/\/$/, ''));
125
121
  if (current !== undefined) {
126
122
  currentBaseURI = current[ID_KEY];
127
- if (!isEmpty(refAnchor)) {
123
+ if (refAnchor.length > 0) {
128
124
  current = jsonpointer.get(current, decodeURIComponent(refAnchor.join('#')));
129
125
  }
130
126
  }
@@ -173,7 +169,7 @@ export function findSchemaDefinitionRecursive<S extends StrictRJSFSchema = RJSFS
173
169
  export default function findSchemaDefinition<S extends StrictRJSFSchema = RJSFSchema>(
174
170
  $ref?: string,
175
171
  rootSchema: S = {} as S,
176
- baseURI: string | undefined = get(rootSchema, [ID_KEY]),
172
+ baseURI: string | undefined = rootSchema[ID_KEY],
177
173
  ): S {
178
174
  const recurseList: string[] = [];
179
175
  return findSchemaDefinitionRecursive($ref, rootSchema, recurseList, baseURI);