@webiny/app-headless-cms 5.33.5-beta.0 → 5.34.0-beta.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 (461) hide show
  1. package/HeadlessCMS.js +4 -0
  2. package/HeadlessCMS.js.map +1 -1
  3. package/admin/components/ContentEntryForm/ContentEntryForm.js +35 -32
  4. package/admin/components/ContentEntryForm/ContentEntryForm.js.map +1 -1
  5. package/admin/components/ContentEntryForm/Fields.d.ts +2 -2
  6. package/admin/components/ContentEntryForm/Fields.js.map +1 -1
  7. package/admin/components/ContentEntryForm/Label.js +1 -1
  8. package/admin/components/ContentEntryForm/Label.js.map +1 -1
  9. package/admin/components/ContentEntryForm/RenderFieldElement.d.ts +2 -2
  10. package/admin/components/ContentEntryForm/RenderFieldElement.js +6 -2
  11. package/admin/components/ContentEntryForm/RenderFieldElement.js.map +1 -1
  12. package/admin/components/ContentEntryForm/functions/getValue.d.ts +2 -2
  13. package/admin/components/ContentEntryForm/functions/getValue.js.map +1 -1
  14. package/admin/components/ContentEntryForm/functions/setValue.d.ts +2 -2
  15. package/admin/components/ContentEntryForm/functions/setValue.js.map +1 -1
  16. package/admin/components/ContentEntryForm/useBind.d.ts +2 -2
  17. package/admin/components/ContentEntryForm/useBind.js +11 -8
  18. package/admin/components/ContentEntryForm/useBind.js.map +1 -1
  19. package/admin/components/ContentEntryForm/useContentEntryForm.d.ts +1 -2
  20. package/admin/components/ContentEntryForm/useContentEntryForm.js +187 -147
  21. package/admin/components/ContentEntryForm/useContentEntryForm.js.map +1 -1
  22. package/admin/components/ContentModelEditor/{Context.d.ts → ContentModelEditorProvider.d.ts} +10 -4
  23. package/admin/components/ContentModelEditor/{Context.js → ContentModelEditorProvider.js} +60 -116
  24. package/admin/components/ContentModelEditor/ContentModelEditorProvider.js.map +1 -0
  25. package/admin/components/ContentModelEditor/Editor.js +5 -5
  26. package/admin/components/ContentModelEditor/Editor.js.map +1 -1
  27. package/admin/components/ContentModelEditor/FieldsSidebar.js.map +1 -1
  28. package/admin/components/ContentModelEditor/PreviewTab.js +3 -3
  29. package/admin/components/ContentModelEditor/PreviewTab.js.map +1 -1
  30. package/admin/components/ContentModelEditor/index.d.ts +2 -0
  31. package/admin/components/ContentModelEditor/index.js +31 -0
  32. package/admin/components/ContentModelEditor/index.js.map +1 -0
  33. package/admin/components/ContentModelEditor/useModelEditor.d.ts +1 -0
  34. package/admin/components/ContentModelEditor/{useContentModelEditor.js → useModelEditor.js} +4 -4
  35. package/admin/components/ContentModelEditor/useModelEditor.js.map +1 -0
  36. package/admin/{views/contentModelGroups → components}/DelayedOnChange.d.ts +0 -0
  37. package/admin/{views/contentModelGroups → components}/DelayedOnChange.js +0 -0
  38. package/admin/{views/contentModelGroups → components}/DelayedOnChange.js.map +0 -0
  39. package/admin/components/Dialog.d.ts +4 -0
  40. package/admin/components/Dialog.js +32 -0
  41. package/admin/components/Dialog.js.map +1 -0
  42. package/admin/components/DropZone/Center.d.ts +2 -1
  43. package/admin/components/DropZone/Center.js +38 -44
  44. package/admin/components/DropZone/Center.js.map +1 -1
  45. package/admin/components/Droppable.d.ts +1 -0
  46. package/admin/components/Droppable.js +12 -1
  47. package/admin/components/Droppable.js.map +1 -1
  48. package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.d.ts +2 -8
  49. package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.js +20 -9
  50. package/admin/components/FieldEditor/EditFieldDialog/AppearanceTab.js.map +1 -1
  51. package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.d.ts +2 -9
  52. package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js +35 -21
  53. package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js.map +1 -1
  54. package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.d.ts +2 -9
  55. package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.js +14 -12
  56. package/admin/components/FieldEditor/EditFieldDialog/PredefinedValues.js.map +1 -1
  57. package/admin/components/FieldEditor/EditFieldDialog/ValidationsSection.d.ts +10 -0
  58. package/admin/components/FieldEditor/EditFieldDialog/ValidationsSection.js +42 -0
  59. package/admin/components/FieldEditor/EditFieldDialog/ValidationsSection.js.map +1 -0
  60. package/admin/components/FieldEditor/EditFieldDialog/ValidatorsList.d.ts +8 -0
  61. package/admin/components/FieldEditor/EditFieldDialog/ValidatorsList.js +227 -0
  62. package/admin/components/FieldEditor/EditFieldDialog/ValidatorsList.js.map +1 -0
  63. package/admin/components/FieldEditor/EditFieldDialog/getValidators.d.ts +13 -0
  64. package/admin/components/FieldEditor/EditFieldDialog/getValidators.js +115 -0
  65. package/admin/components/FieldEditor/EditFieldDialog/getValidators.js.map +1 -0
  66. package/admin/components/FieldEditor/EditFieldDialog.d.ts +3 -3
  67. package/admin/components/FieldEditor/EditFieldDialog.js +117 -260
  68. package/admin/components/FieldEditor/EditFieldDialog.js.map +1 -1
  69. package/admin/components/FieldEditor/Field.d.ts +5 -5
  70. package/admin/components/FieldEditor/Field.js +17 -14
  71. package/admin/components/FieldEditor/Field.js.map +1 -1
  72. package/admin/components/FieldEditor/FieldEditor.d.ts +4 -4
  73. package/admin/components/FieldEditor/FieldEditor.js +85 -31
  74. package/admin/components/FieldEditor/FieldEditor.js.map +1 -1
  75. package/admin/components/FieldEditor/FieldEditorContext.d.ts +16 -16
  76. package/admin/components/FieldEditor/FieldEditorContext.js +18 -18
  77. package/admin/components/FieldEditor/FieldEditorContext.js.map +1 -1
  78. package/admin/components/FieldEditor/Styled.js +4 -13
  79. package/admin/components/FieldEditor/Styled.js.map +1 -1
  80. package/admin/components/FieldEditor/index.d.ts +1 -1
  81. package/admin/components/FieldEditor/index.js +3 -3
  82. package/admin/components/FieldEditor/index.js.map +1 -1
  83. package/admin/components/FieldEditor/useModelFieldEditor.d.ts +2 -0
  84. package/admin/components/FieldEditor/useModelFieldEditor.js +20 -0
  85. package/admin/components/FieldEditor/useModelFieldEditor.js.map +1 -0
  86. package/admin/components/FieldEditor/utils/deleteField.d.ts +2 -2
  87. package/admin/components/FieldEditor/utils/deleteField.js.map +1 -1
  88. package/admin/components/FieldEditor/utils/getFieldPosition.d.ts +2 -2
  89. package/admin/components/FieldEditor/utils/getFieldPosition.js.map +1 -1
  90. package/admin/components/FieldEditor/utils/moveField.d.ts +3 -3
  91. package/admin/components/FieldEditor/utils/moveField.js.map +1 -1
  92. package/admin/components/IconPicker.d.ts +7 -0
  93. package/admin/{views/contentModelGroups → components}/IconPicker.js +34 -31
  94. package/admin/components/IconPicker.js.map +1 -0
  95. package/admin/components/ModelFieldProvider/ModelFieldContext.d.ts +36 -0
  96. package/admin/components/ModelFieldProvider/ModelFieldContext.js +24 -0
  97. package/admin/components/ModelFieldProvider/ModelFieldContext.js.map +1 -0
  98. package/admin/components/ModelFieldProvider/index.d.ts +2 -0
  99. package/admin/components/ModelFieldProvider/index.js +31 -0
  100. package/admin/components/ModelFieldProvider/index.js.map +1 -0
  101. package/admin/components/ModelFieldProvider/useModelField.d.ts +35 -0
  102. package/admin/components/ModelFieldProvider/useModelField.js +42 -0
  103. package/admin/components/ModelFieldProvider/useModelField.js.map +1 -0
  104. package/admin/components/ModelProvider/ModelContext.d.ts +9 -0
  105. package/admin/components/ModelProvider/ModelContext.js +24 -0
  106. package/admin/components/ModelProvider/ModelContext.js.map +1 -0
  107. package/admin/components/ModelProvider/index.d.ts +2 -0
  108. package/admin/components/ModelProvider/index.js +31 -0
  109. package/admin/components/ModelProvider/index.js.map +1 -0
  110. package/admin/components/ModelProvider/useModel.d.ts +9 -0
  111. package/admin/components/ModelProvider/useModel.js +25 -0
  112. package/admin/components/ModelProvider/useModel.js.map +1 -0
  113. package/admin/constants/statusLabels.js +2 -4
  114. package/admin/constants/statusLabels.js.map +1 -1
  115. package/admin/graphql/contentEntries.d.ts +2 -29
  116. package/admin/graphql/contentEntries.js +28 -42
  117. package/admin/graphql/contentEntries.js.map +1 -1
  118. package/admin/graphql/contentModels.d.ts +1 -1
  119. package/admin/graphql/contentModels.js +2 -2
  120. package/admin/graphql/contentModels.js.map +1 -1
  121. package/admin/graphql/createFieldsList.d.ts +7 -2
  122. package/admin/graphql/createFieldsList.js +5 -1
  123. package/admin/graphql/createFieldsList.js.map +1 -1
  124. package/admin/hooks/index.d.ts +5 -0
  125. package/admin/hooks/index.js +47 -2
  126. package/admin/hooks/index.js.map +1 -1
  127. package/admin/hooks/usePermission.d.ts +0 -2
  128. package/admin/hooks/usePermission.js +5 -37
  129. package/admin/hooks/usePermission.js.map +1 -1
  130. package/admin/menus/NothingToShowElement.js +4 -1
  131. package/admin/menus/NothingToShowElement.js.map +1 -1
  132. package/admin/plugins/arrayUtils.d.ts +12 -0
  133. package/admin/plugins/arrayUtils.js +53 -0
  134. package/admin/plugins/arrayUtils.js.map +1 -0
  135. package/admin/plugins/editor/defaultBar/CreateContentButton.js +4 -4
  136. package/admin/plugins/editor/defaultBar/CreateContentButton.js.map +1 -1
  137. package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.js +5 -5
  138. package/admin/plugins/editor/defaultBar/FormSettings/FormSettings.js.map +1 -1
  139. package/admin/plugins/editor/defaultBar/Name/Name.js +4 -4
  140. package/admin/plugins/editor/defaultBar/Name/Name.js.map +1 -1
  141. package/admin/plugins/editor/defaultBar/SaveContentModelButton.js +3 -3
  142. package/admin/plugins/editor/defaultBar/SaveContentModelButton.js.map +1 -1
  143. package/admin/plugins/editor/formSettings/components/GeneralSettings.js +9 -1
  144. package/admin/plugins/editor/formSettings/components/GeneralSettings.js.map +1 -1
  145. package/admin/plugins/fieldRenderers/DynamicSection.d.ts +3 -3
  146. package/admin/plugins/fieldRenderers/DynamicSection.js.map +1 -1
  147. package/admin/plugins/fieldRenderers/dateTime/DateOnly.d.ts +2 -2
  148. package/admin/plugins/fieldRenderers/dateTime/DateOnly.js.map +1 -1
  149. package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.d.ts +2 -2
  150. package/admin/plugins/fieldRenderers/dateTime/DateTimeWithTimezone.js.map +1 -1
  151. package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.d.ts +2 -2
  152. package/admin/plugins/fieldRenderers/dateTime/DateTimeWithoutTimezone.js.map +1 -1
  153. package/admin/plugins/fieldRenderers/dateTime/Input.d.ts +2 -2
  154. package/admin/plugins/fieldRenderers/dateTime/Input.js.map +1 -1
  155. package/admin/plugins/fieldRenderers/dateTime/utils.d.ts +2 -2
  156. package/admin/plugins/fieldRenderers/dateTime/utils.js.map +1 -1
  157. package/admin/plugins/fieldRenderers/dynamicZone/AddTemplate.d.ts +12 -0
  158. package/admin/plugins/fieldRenderers/dynamicZone/AddTemplate.js +107 -0
  159. package/admin/plugins/fieldRenderers/dynamicZone/AddTemplate.js.map +1 -0
  160. package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.d.ts +11 -0
  161. package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.js +139 -0
  162. package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.js.map +1 -0
  163. package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.d.ts +11 -0
  164. package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.js +68 -0
  165. package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.js.map +1 -0
  166. package/admin/plugins/fieldRenderers/dynamicZone/TemplateCard.d.ts +8 -0
  167. package/admin/plugins/fieldRenderers/dynamicZone/TemplateCard.js +63 -0
  168. package/admin/plugins/fieldRenderers/dynamicZone/TemplateCard.js.map +1 -0
  169. package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.d.ts +8 -0
  170. package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js +53 -0
  171. package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js.map +1 -0
  172. package/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.d.ts +6 -0
  173. package/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.js +22 -0
  174. package/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.js.map +1 -0
  175. package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.d.ts +2 -0
  176. package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.js +66 -0
  177. package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.js.map +1 -0
  178. package/admin/plugins/fieldRenderers/file/fileFields.js.map +1 -1
  179. package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.d.ts +2 -2
  180. package/admin/plugins/fieldRenderers/ref/components/ContentEntriesAutocomplete.js.map +1 -1
  181. package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.d.ts +2 -2
  182. package/admin/plugins/fieldRenderers/ref/components/ContentEntriesMultiAutoComplete.js.map +1 -1
  183. package/admin/plugins/fieldRenderers/ref/components/NewRefEntryFormDialog.js +10 -9
  184. package/admin/plugins/fieldRenderers/ref/components/NewRefEntryFormDialog.js.map +1 -1
  185. package/admin/plugins/fieldRenderers/ref/components/useReference.d.ts +2 -2
  186. package/admin/plugins/fieldRenderers/ref/components/useReference.js.map +1 -1
  187. package/admin/plugins/fieldRenderers/ref/components/useReferences.d.ts +2 -2
  188. package/admin/plugins/fieldRenderers/ref/components/useReferences.js.map +1 -1
  189. package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntry.d.ts +2 -2
  190. package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntry.js +15 -14
  191. package/admin/plugins/fieldRenderers/ref/hooks/useNewRefEntry.js.map +1 -1
  192. package/admin/plugins/fieldRenderers/ref/refInputs.js.map +1 -1
  193. package/admin/plugins/fieldRenderers/richText/richTextInput.js.map +1 -1
  194. package/admin/plugins/fieldRenderers/richText/richTextInputs.js.map +1 -1
  195. package/admin/plugins/fieldValidators/date/createDateInputField.d.ts +2 -2
  196. package/admin/plugins/fieldValidators/date/createDateInputField.js.map +1 -1
  197. package/admin/plugins/fieldValidators/dateGte.d.ts +2 -2
  198. package/admin/plugins/fieldValidators/dateGte.js +79 -23
  199. package/admin/plugins/fieldValidators/dateGte.js.map +1 -1
  200. package/admin/plugins/fieldValidators/dateLte.d.ts +2 -2
  201. package/admin/plugins/fieldValidators/dateLte.js +79 -23
  202. package/admin/plugins/fieldValidators/dateLte.js.map +1 -1
  203. package/admin/plugins/fieldValidators/dynamicZone.d.ts +2 -0
  204. package/admin/plugins/fieldValidators/dynamicZone.js +215 -0
  205. package/admin/plugins/fieldValidators/dynamicZone.js.map +1 -0
  206. package/admin/plugins/fieldValidators/gte.d.ts +2 -2
  207. package/admin/plugins/fieldValidators/gte.js +44 -5
  208. package/admin/plugins/fieldValidators/gte.js.map +1 -1
  209. package/admin/plugins/fieldValidators/in.d.ts +2 -2
  210. package/admin/plugins/fieldValidators/in.js +44 -5
  211. package/admin/plugins/fieldValidators/in.js.map +1 -1
  212. package/admin/plugins/fieldValidators/lte.d.ts +2 -2
  213. package/admin/plugins/fieldValidators/lte.js +44 -5
  214. package/admin/plugins/fieldValidators/lte.js.map +1 -1
  215. package/admin/plugins/fieldValidators/maxLength.d.ts +2 -2
  216. package/admin/plugins/fieldValidators/maxLength.js +55 -6
  217. package/admin/plugins/fieldValidators/maxLength.js.map +1 -1
  218. package/admin/plugins/fieldValidators/minLength.d.ts +2 -2
  219. package/admin/plugins/fieldValidators/minLength.js +55 -6
  220. package/admin/plugins/fieldValidators/minLength.js.map +1 -1
  221. package/admin/plugins/fieldValidators/pattern.d.ts +2 -2
  222. package/admin/plugins/fieldValidators/pattern.js +129 -60
  223. package/admin/plugins/fieldValidators/pattern.js.map +1 -1
  224. package/admin/plugins/fieldValidators/patternPlugins/email.d.ts +2 -2
  225. package/admin/plugins/fieldValidators/patternPlugins/email.js +6 -4
  226. package/admin/plugins/fieldValidators/patternPlugins/email.js.map +1 -1
  227. package/admin/plugins/fieldValidators/patternPlugins/lowerCase.d.ts +2 -2
  228. package/admin/plugins/fieldValidators/patternPlugins/lowerCase.js +5 -3
  229. package/admin/plugins/fieldValidators/patternPlugins/lowerCase.js.map +1 -1
  230. package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.d.ts +2 -2
  231. package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.js +5 -3
  232. package/admin/plugins/fieldValidators/patternPlugins/lowerCaseSpace.js.map +1 -1
  233. package/admin/plugins/fieldValidators/patternPlugins/upperCase.d.ts +2 -2
  234. package/admin/plugins/fieldValidators/patternPlugins/upperCase.js +5 -3
  235. package/admin/plugins/fieldValidators/patternPlugins/upperCase.js.map +1 -1
  236. package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.d.ts +2 -2
  237. package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.js +5 -3
  238. package/admin/plugins/fieldValidators/patternPlugins/upperCaseSpace.js.map +1 -1
  239. package/admin/plugins/fieldValidators/patternPlugins/url.d.ts +2 -2
  240. package/admin/plugins/fieldValidators/patternPlugins/url.js +5 -3
  241. package/admin/plugins/fieldValidators/patternPlugins/url.js.map +1 -1
  242. package/admin/plugins/fieldValidators/required.d.ts +2 -2
  243. package/admin/plugins/fieldValidators/required.js +8 -2
  244. package/admin/plugins/fieldValidators/required.js.map +1 -1
  245. package/admin/plugins/fieldValidators/unique.d.ts +2 -2
  246. package/admin/plugins/fieldValidators/unique.js +30 -2
  247. package/admin/plugins/fieldValidators/unique.js.map +1 -1
  248. package/admin/plugins/fields/PredefinedValuesDynamicFieldset.d.ts +1 -2
  249. package/admin/plugins/fields/PredefinedValuesDynamicFieldset.js +25 -26
  250. package/admin/plugins/fields/PredefinedValuesDynamicFieldset.js.map +1 -1
  251. package/admin/plugins/fields/boolean.d.ts +2 -2
  252. package/admin/plugins/fields/boolean.js +6 -5
  253. package/admin/plugins/fields/boolean.js.map +1 -1
  254. package/admin/plugins/fields/dateTime.d.ts +2 -2
  255. package/admin/plugins/fields/dateTime.js +58 -48
  256. package/admin/plugins/fields/dateTime.js.map +1 -1
  257. package/admin/plugins/fields/dynamicZone/AddTemplate.d.ts +11 -0
  258. package/admin/plugins/fields/dynamicZone/AddTemplate.js +114 -0
  259. package/admin/plugins/fields/dynamicZone/AddTemplate.js.map +1 -0
  260. package/admin/plugins/fields/dynamicZone/DynamicZone.d.ts +2 -0
  261. package/admin/plugins/fields/dynamicZone/DynamicZone.js +82 -0
  262. package/admin/plugins/fields/dynamicZone/DynamicZone.js.map +1 -0
  263. package/admin/plugins/fields/dynamicZone/DynamicZoneTemplate.d.ts +11 -0
  264. package/admin/plugins/fields/dynamicZone/DynamicZoneTemplate.js +127 -0
  265. package/admin/plugins/fields/dynamicZone/DynamicZoneTemplate.js.map +1 -0
  266. package/admin/plugins/fields/dynamicZone/TemplateDialog.d.ts +9 -0
  267. package/admin/plugins/fields/dynamicZone/TemplateDialog.js +174 -0
  268. package/admin/plugins/fields/dynamicZone/TemplateDialog.js.map +1 -0
  269. package/admin/plugins/fields/dynamicZone/commonValidators.d.ts +2 -0
  270. package/admin/plugins/fields/dynamicZone/commonValidators.js +26 -0
  271. package/admin/plugins/fields/dynamicZone/commonValidators.js.map +1 -0
  272. package/admin/plugins/fields/dynamicZone.d.ts +2 -0
  273. package/admin/plugins/fields/dynamicZone.js +97 -0
  274. package/admin/plugins/fields/dynamicZone.js.map +1 -0
  275. package/admin/plugins/fields/file.d.ts +2 -2
  276. package/admin/plugins/fields/file.js +6 -5
  277. package/admin/plugins/fields/file.js.map +1 -1
  278. package/admin/plugins/fields/longText.d.ts +2 -2
  279. package/admin/plugins/fields/longText.js +4 -3
  280. package/admin/plugins/fields/longText.js.map +1 -1
  281. package/admin/plugins/fields/number.d.ts +2 -2
  282. package/admin/plugins/fields/number.js +6 -5
  283. package/admin/plugins/fields/number.js.map +1 -1
  284. package/admin/plugins/fields/object/ObjectFields.d.ts +2 -2
  285. package/admin/plugins/fields/object/ObjectFields.js +3 -3
  286. package/admin/plugins/fields/object/ObjectFields.js.map +1 -1
  287. package/admin/plugins/fields/object.d.ts +2 -2
  288. package/admin/plugins/fields/object.js +9 -4
  289. package/admin/plugins/fields/object.js.map +1 -1
  290. package/admin/plugins/fields/ref.d.ts +2 -2
  291. package/admin/plugins/fields/ref.js +108 -100
  292. package/admin/plugins/fields/ref.js.map +1 -1
  293. package/admin/plugins/fields/richText.d.ts +2 -2
  294. package/admin/plugins/fields/richText.js +6 -5
  295. package/admin/plugins/fields/richText.js.map +1 -1
  296. package/admin/plugins/fields/text.d.ts +2 -2
  297. package/admin/plugins/fields/text.js +4 -3
  298. package/admin/plugins/fields/text.js.map +1 -1
  299. package/admin/plugins/index.d.ts +28 -1
  300. package/admin/plugins/permissionRenderer/CmsPermissions.js +2 -7
  301. package/admin/plugins/permissionRenderer/CmsPermissions.js.map +1 -1
  302. package/admin/plugins/permissionRenderer/components/ContentEntryPermission.js +11 -17
  303. package/admin/plugins/permissionRenderer/components/ContentEntryPermission.js.map +1 -1
  304. package/admin/plugins/transformers/dateTransformer.d.ts +1 -2
  305. package/admin/plugins/transformers/dateTransformer.js +3 -3
  306. package/admin/plugins/transformers/dateTransformer.js.map +1 -1
  307. package/admin/plugins/transformers/dynamicZoneTransformer.d.ts +2 -0
  308. package/admin/plugins/transformers/dynamicZoneTransformer.js +45 -0
  309. package/admin/plugins/transformers/dynamicZoneTransformer.js.map +1 -0
  310. package/admin/plugins/transformers/index.js +5 -5
  311. package/admin/plugins/transformers/index.js.map +1 -1
  312. package/admin/plugins/transformers/numberTransformer.d.ts +1 -2
  313. package/admin/plugins/transformers/numberTransformer.js +3 -3
  314. package/admin/plugins/transformers/numberTransformer.js.map +1 -1
  315. package/admin/views/contentEntries/ContentEntries.js +6 -2
  316. package/admin/views/contentEntries/ContentEntries.js.map +1 -1
  317. package/admin/views/contentEntries/ContentEntriesContext.d.ts +4 -4
  318. package/admin/views/contentEntries/ContentEntriesContext.js +1 -9
  319. package/admin/views/contentEntries/ContentEntriesContext.js.map +1 -1
  320. package/admin/views/contentEntries/ContentEntriesList.js +23 -8
  321. package/admin/views/contentEntries/ContentEntriesList.js.map +1 -1
  322. package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js +19 -4
  323. package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js.map +1 -1
  324. package/admin/views/contentEntries/ContentEntry/RevisionListItem.js +60 -60
  325. package/admin/views/contentEntries/ContentEntry/RevisionListItem.js.map +1 -1
  326. package/admin/views/contentEntries/ContentEntry/cache.js +5 -1
  327. package/admin/views/contentEntries/ContentEntry/cache.js.map +1 -1
  328. package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.d.ts +1 -1
  329. package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.js +3 -80
  330. package/admin/views/contentEntries/ContentEntry/header/requestChanges/RequestChanges.js.map +1 -1
  331. package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.d.ts +1 -1
  332. package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.js +3 -84
  333. package/admin/views/contentEntries/ContentEntry/header/requestReview/RequestReview.js.map +1 -1
  334. package/admin/views/contentEntries/ContentEntry/prepareFormData.d.ts +2 -2
  335. package/admin/views/contentEntries/ContentEntry/prepareFormData.js.map +1 -1
  336. package/admin/views/contentEntries/ContentEntry/useRevision.d.ts +0 -8
  337. package/admin/views/contentEntries/ContentEntry/useRevision.js +10 -122
  338. package/admin/views/contentEntries/ContentEntry/useRevision.js.map +1 -1
  339. package/admin/views/contentEntries/ContentEntry.js +0 -2
  340. package/admin/views/contentEntries/ContentEntry.js.map +1 -1
  341. package/admin/views/contentEntries/experiment/ContentEntriesModule.d.ts +2 -2
  342. package/admin/views/contentEntries/experiment/ContentEntriesModule.js +27 -14
  343. package/admin/views/contentEntries/experiment/ContentEntriesModule.js.map +1 -1
  344. package/admin/views/contentEntries/hooks/useContentEntries.js +7 -1
  345. package/admin/views/contentEntries/hooks/useContentEntries.js.map +1 -1
  346. package/admin/views/contentEntries/hooks/useContentEntriesList.d.ts +1 -1
  347. package/admin/views/contentEntries/hooks/useContentEntriesList.js.map +1 -1
  348. package/admin/views/contentModelGroups/ContentModelGroupsForm.js +2 -2
  349. package/admin/views/contentModelGroups/ContentModelGroupsForm.js.map +1 -1
  350. package/admin/views/contentModels/CloneContentModelDialog.js +4 -17
  351. package/admin/views/contentModels/CloneContentModelDialog.js.map +1 -1
  352. package/admin/views/contentModels/ContentModelEditor.js +2 -2
  353. package/admin/views/contentModels/ContentModelEditor.js.map +1 -1
  354. package/admin/views/contentModels/NewContentModelDialog.js +5 -17
  355. package/admin/views/contentModels/NewContentModelDialog.js.map +1 -1
  356. package/admin/viewsGraphql.js +1 -1
  357. package/admin/viewsGraphql.js.map +1 -1
  358. package/allPlugins.d.ts +34 -0
  359. package/allPlugins.js +95 -0
  360. package/allPlugins.js.map +1 -0
  361. package/index.d.ts +1 -0
  362. package/index.js +15 -1
  363. package/index.js.map +1 -1
  364. package/package.json +29 -29
  365. package/{types.d.ts → types/index.d.ts} +59 -176
  366. package/types/index.js +44 -0
  367. package/types/index.js.map +1 -0
  368. package/types/model.d.ts +83 -0
  369. package/{types.js → types/model.js} +0 -0
  370. package/types/model.js.map +1 -0
  371. package/types/shared.d.ts +5 -0
  372. package/types/shared.js +5 -0
  373. package/types/shared.js.map +1 -0
  374. package/types/validation.d.ts +70 -0
  375. package/types/validation.js +5 -0
  376. package/types/validation.js.map +1 -0
  377. package/utils/CmsModelFieldValidatorConfigAdapter.d.ts +15 -0
  378. package/utils/CmsModelFieldValidatorConfigAdapter.js +91 -0
  379. package/utils/CmsModelFieldValidatorConfigAdapter.js.map +1 -0
  380. package/utils/createTypeName.d.ts +1 -0
  381. package/utils/createTypeName.js +18 -0
  382. package/utils/createTypeName.js.map +1 -0
  383. package/utils/createValidators.d.ts +3 -0
  384. package/{admin/components/ContentEntryForm/functions → utils}/createValidators.js +37 -16
  385. package/utils/createValidators.js.map +1 -0
  386. package/utils/getFetchPolicy.d.ts +6 -0
  387. package/utils/getFetchPolicy.js +19 -0
  388. package/utils/getFetchPolicy.js.map +1 -0
  389. package/utils/getModelTitleFieldId.d.ts +2 -0
  390. package/utils/getModelTitleFieldId.js +16 -0
  391. package/utils/getModelTitleFieldId.js.map +1 -0
  392. package/admin/components/ContentEntryForm/functions/createValidators.d.ts +0 -3
  393. package/admin/components/ContentEntryForm/functions/createValidators.js.map +0 -1
  394. package/admin/components/ContentModelEditor/Context.js.map +0 -1
  395. package/admin/components/ContentModelEditor/useContentModelEditor.d.ts +0 -1
  396. package/admin/components/ContentModelEditor/useContentModelEditor.js.map +0 -1
  397. package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.d.ts +0 -15
  398. package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.js +0 -148
  399. package/admin/components/FieldEditor/EditFieldDialog/ValidatorsTab.js.map +0 -1
  400. package/admin/components/FieldEditor/useFieldEditor.d.ts +0 -1
  401. package/admin/components/FieldEditor/useFieldEditor.js +0 -14
  402. package/admin/components/FieldEditor/useFieldEditor.js.map +0 -1
  403. package/admin/plugins/validators/dateGte.d.ts +0 -3
  404. package/admin/plugins/validators/dateGte.js +0 -68
  405. package/admin/plugins/validators/dateGte.js.map +0 -1
  406. package/admin/plugins/validators/dateLte.d.ts +0 -3
  407. package/admin/plugins/validators/dateLte.js +0 -68
  408. package/admin/plugins/validators/dateLte.js.map +0 -1
  409. package/admin/plugins/validators/gte.d.ts +0 -3
  410. package/admin/plugins/validators/gte.js +0 -57
  411. package/admin/plugins/validators/gte.js.map +0 -1
  412. package/admin/plugins/validators/in.d.ts +0 -3
  413. package/admin/plugins/validators/in.js +0 -57
  414. package/admin/plugins/validators/in.js.map +0 -1
  415. package/admin/plugins/validators/lte.d.ts +0 -3
  416. package/admin/plugins/validators/lte.js +0 -57
  417. package/admin/plugins/validators/lte.js.map +0 -1
  418. package/admin/plugins/validators/maxLength.d.ts +0 -3
  419. package/admin/plugins/validators/maxLength.js +0 -57
  420. package/admin/plugins/validators/maxLength.js.map +0 -1
  421. package/admin/plugins/validators/minLength.d.ts +0 -3
  422. package/admin/plugins/validators/minLength.js +0 -57
  423. package/admin/plugins/validators/minLength.js.map +0 -1
  424. package/admin/plugins/validators/pattern.d.ts +0 -3
  425. package/admin/plugins/validators/pattern.js +0 -77
  426. package/admin/plugins/validators/pattern.js.map +0 -1
  427. package/admin/plugins/validators/patternPlugins/email.d.ts +0 -3
  428. package/admin/plugins/validators/patternPlugins/email.js +0 -17
  429. package/admin/plugins/validators/patternPlugins/email.js.map +0 -1
  430. package/admin/plugins/validators/patternPlugins/lowerCase.d.ts +0 -3
  431. package/admin/plugins/validators/patternPlugins/lowerCase.js +0 -17
  432. package/admin/plugins/validators/patternPlugins/lowerCase.js.map +0 -1
  433. package/admin/plugins/validators/patternPlugins/lowerCaseSpace.d.ts +0 -3
  434. package/admin/plugins/validators/patternPlugins/lowerCaseSpace.js +0 -17
  435. package/admin/plugins/validators/patternPlugins/lowerCaseSpace.js.map +0 -1
  436. package/admin/plugins/validators/patternPlugins/upperCase.d.ts +0 -3
  437. package/admin/plugins/validators/patternPlugins/upperCase.js +0 -17
  438. package/admin/plugins/validators/patternPlugins/upperCase.js.map +0 -1
  439. package/admin/plugins/validators/patternPlugins/upperCaseSpace.d.ts +0 -3
  440. package/admin/plugins/validators/patternPlugins/upperCaseSpace.js +0 -17
  441. package/admin/plugins/validators/patternPlugins/upperCaseSpace.js.map +0 -1
  442. package/admin/plugins/validators/patternPlugins/url.d.ts +0 -3
  443. package/admin/plugins/validators/patternPlugins/url.js +0 -17
  444. package/admin/plugins/validators/patternPlugins/url.js.map +0 -1
  445. package/admin/plugins/validators/required.d.ts +0 -3
  446. package/admin/plugins/validators/required.js +0 -21
  447. package/admin/plugins/validators/required.js.map +0 -1
  448. package/admin/plugins/validators/timeGte.d.ts +0 -3
  449. package/admin/plugins/validators/timeGte.js +0 -59
  450. package/admin/plugins/validators/timeGte.js.map +0 -1
  451. package/admin/plugins/validators/timeLte.d.ts +0 -3
  452. package/admin/plugins/validators/timeLte.js +0 -59
  453. package/admin/plugins/validators/timeLte.js.map +0 -1
  454. package/admin/plugins/validators/unique.d.ts +0 -7
  455. package/admin/plugins/validators/unique.js +0 -50
  456. package/admin/plugins/validators/unique.js.map +0 -1
  457. package/admin/views/contentEntries/ContentEntry/header/requestChanges/rule-24px.svg +0 -1
  458. package/admin/views/contentEntries/ContentEntry/header/requestReview/emoji_people-24px.svg +0 -1
  459. package/admin/views/contentModelGroups/IconPicker.d.ts +0 -8
  460. package/admin/views/contentModelGroups/IconPicker.js.map +0 -1
  461. package/types.js.map +0 -1
@@ -12,18 +12,9 @@ var _emotion = require("emotion");
12
12
  var _styled = _interopRequireDefault(require("@emotion/styled"));
13
13
 
14
14
  var RowContainer = /*#__PURE__*/(0, _styled.default)("div", {
15
- target: "e1pk1rsi0",
16
- label: "RowContainer"
17
- })({
18
- position: "relative",
19
- display: "flex",
20
- flexDirection: "column",
21
- marginBottom: 20,
22
- borderRadius: 2,
23
- backgroundColor: "var(--mdc-theme-surface)",
24
- border: "1px solid var(--mdc-theme-on-background)",
25
- boxShadow: "var(--mdc-theme-on-background) 1px 1px 1px, var(--mdc-theme-on-background) 1px 1px 2px"
26
- });
15
+ label: "RowContainer",
16
+ target: "e1pk1rsi0"
17
+ })("position:relative;display:flex;flex-direction:column;margin-bottom:20px;border-radius:2px;background-color:var(--mdc-theme-surface);border:1px solid var(--mdc-theme-on-background);box-shadow:var(--mdc-theme-on-background) 1px 1px 1px,var(--mdc-theme-on-background) 1px 1px 2px;:last-child{margin-bottom:5px;}");
27
18
  exports.RowContainer = RowContainer;
28
19
  var Row = /*#__PURE__*/(0, _styled.default)("div", {
29
20
  target: "e1pk1rsi1",
@@ -41,7 +32,7 @@ var fieldContainer = /*#__PURE__*/(0, _emotion.css)({
41
32
  position: "relative",
42
33
  flex: "1 100%",
43
34
  backgroundColor: "var(--mdc-theme-background)",
44
- padding: "0 15px",
35
+ padding: "0 15px 5px",
45
36
  margin: 10,
46
37
  borderRadius: 2,
47
38
  border: "1px solid var(--mdc-theme-on-background)",
@@ -1 +1 @@
1
- {"version":3,"names":["RowContainer","styled","position","display","flexDirection","marginBottom","borderRadius","backgroundColor","border","boxShadow","Row","paddingLeft","paddingRight","fieldContainer","css","flex","padding","margin","transition","color","cursor","rowHandle","width","left","top","transform","zIndex","fieldHandle"],"sources":["Styled.ts"],"sourcesContent":["import { css } from \"emotion\";\nimport styled from \"@emotion/styled\";\n\nexport const RowContainer = styled(\"div\")({\n position: \"relative\",\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: 20,\n borderRadius: 2,\n backgroundColor: \"var(--mdc-theme-surface)\",\n border: \"1px solid var(--mdc-theme-on-background)\",\n boxShadow:\n \"var(--mdc-theme-on-background) 1px 1px 1px, var(--mdc-theme-on-background) 1px 1px 2px\"\n});\n\nexport const Row = styled(\"div\")({\n display: \"flex\",\n flexDirection: \"row\",\n backgroundColor: \"var(--mdc-theme-surface)\",\n paddingLeft: 40,\n paddingRight: 10,\n position: \"relative\"\n});\n\nexport const fieldContainer = css({\n position: \"relative\",\n flex: \"1 100%\",\n backgroundColor: \"var(--mdc-theme-background)\",\n padding: \"0 15px\",\n margin: 10,\n borderRadius: 2,\n border: \"1px solid var(--mdc-theme-on-background)\",\n transition: \"box-shadow 225ms\",\n color: \"var(--mdc-theme-on-surface)\",\n cursor: \"grab\",\n \"&:hover\": {\n boxShadow:\n \"var(--mdc-theme-on-background) 1px 1px 1px, var(--mdc-theme-on-background) 1px 1px 2px\"\n }\n});\n\nexport const rowHandle = css({\n width: 30,\n cursor: \"grab\",\n position: \"absolute\",\n left: 10,\n top: \"50%\",\n transform: \"translateY(-50%)\",\n zIndex: 1,\n color: \"var(--mdc-theme-on-surface)\"\n});\n\nexport const fieldHandle = css({\n cursor: \"grab\"\n});\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEO,IAAMA,YAAY,oBAAGC,eAAH,EAAU,KAAV;EAAA;EAAA;AAAA,GAAiB;EACtCC,QAAQ,EAAE,UAD4B;EAEtCC,OAAO,EAAE,MAF6B;EAGtCC,aAAa,EAAE,Q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ainer","css","flex","padding","margin","borderRadius","border","transition","color","cursor","boxShadow","rowHandle","width","left","top","transform","zIndex","fieldHandle"],"sources":["Styled.ts"],"sourcesContent":["import { css } from \"emotion\";\nimport styled from \"@emotion/styled\";\n\nexport const RowContainer = styled.div`\n position: relative;\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n border-radius: 2px;\n background-color: var(--mdc-theme-surface);\n border: 1px solid var(--mdc-theme-on-background);\n box-shadow: var(--mdc-theme-on-background) 1px 1px 1px,\n var(--mdc-theme-on-background) 1px 1px 2px;\n :last-child {\n margin-bottom: 5px;\n }\n`;\n\nexport const Row = styled(\"div\")({\n display: \"flex\",\n flexDirection: \"row\",\n backgroundColor: \"var(--mdc-theme-surface)\",\n paddingLeft: 40,\n paddingRight: 10,\n position: \"relative\"\n});\n\nexport const fieldContainer = css({\n position: \"relative\",\n flex: \"1 100%\",\n backgroundColor: \"var(--mdc-theme-background)\",\n padding: \"0 15px 5px\",\n margin: 10,\n borderRadius: 2,\n border: \"1px solid var(--mdc-theme-on-background)\",\n transition: \"box-shadow 225ms\",\n color: \"var(--mdc-theme-on-surface)\",\n cursor: \"grab\",\n \"&:hover\": {\n boxShadow:\n \"var(--mdc-theme-on-background) 1px 1px 1px, var(--mdc-theme-on-background) 1px 1px 2px\"\n }\n});\n\nexport const rowHandle = css({\n width: 30,\n cursor: \"grab\",\n position: \"absolute\",\n left: 10,\n top: \"50%\",\n transform: \"translateY(-50%)\",\n zIndex: 1,\n color: \"var(--mdc-theme-on-surface)\"\n});\n\nexport const fieldHandle = css({\n cursor: \"grab\"\n});\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEO,IAAMA,YAAY,oBAAGC,eAAH;EAAA;EAAA;AAAA,0TAAlB;;AAeA,IAAMC,GAAG,oBAAGD,eAAH,EAAU,KAAV;EAAA;EAAA;AAAA,GAAiB;EAC7BE,OAAO,EAAE,MADoB;EAE7BC,aAAa,EAAE,KAFc;EAG7BC,eAAe,EAAE,0BAHY;EAI7BC,WAAW,EAAE,EAJgB;EAK7BC,YAAY,EAAE,EALe;EAM7BC,QAAQ,EAAE;AANmB,CAAjB,CAAT;;AASA,IAAMC,cAAc,gBAAG,IAAAC,YAAA,EAAI;EAC9BF,QAAQ,EAAE,UADoB;EAE9BG,IAAI,EAAE,QAFwB;EAG9BN,eAAe,EAAE,6BAHa;EAI9BO,OAAO,EAAE,YAJqB;EAK9BC,MAAM,EAAE,EALsB;EAM9BC,YAAY,EAAE,CANgB;EAO9BC,MAAM,EAAE,0CAPsB;EAQ9BC,UAAU,EAAE,kBARkB;EAS9BC,KAAK,EAAE,6BATuB;EAU9BC,MAAM,EAAE,MAVsB;EAW9B,WAAW;IACPC,SAAS,EACL;EAFG;AAXmB,CAAJ,0BAAvB;;AAiBA,IAAMC,SAAS,gBAAG,IAAAV,YAAA,EAAI;EACzBW,KAAK,EAAE,EADkB;EAEzBH,MAAM,EAAE,MAFiB;EAGzBV,QAAQ,EAAE,UAHe;EAIzBc,IAAI,EAAE,EAJmB;EAKzBC,GAAG,EAAE,KALoB;EAMzBC,SAAS,EAAE,kBANc;EAOzBC,MAAM,EAAE,CAPiB;EAQzBR,KAAK,EAAE;AARkB,CAAJ,qBAAlB;;AAWA,IAAMS,WAAW,gBAAG,IAAAhB,YAAA,EAAI;EAC3BQ,MAAM,EAAE;AADmB,CAAJ,uBAApB"}
@@ -1,2 +1,2 @@
1
1
  export { FieldEditor } from "./FieldEditor";
2
- export { useFieldEditor } from "./useFieldEditor";
2
+ export { useModelFieldEditor } from "./useModelFieldEditor";
@@ -9,13 +9,13 @@ Object.defineProperty(exports, "FieldEditor", {
9
9
  return _FieldEditor.FieldEditor;
10
10
  }
11
11
  });
12
- Object.defineProperty(exports, "useFieldEditor", {
12
+ Object.defineProperty(exports, "useModelFieldEditor", {
13
13
  enumerable: true,
14
14
  get: function get() {
15
- return _useFieldEditor.useFieldEditor;
15
+ return _useModelFieldEditor.useModelFieldEditor;
16
16
  }
17
17
  });
18
18
 
19
19
  var _FieldEditor = require("./FieldEditor");
20
20
 
21
- var _useFieldEditor = require("./useFieldEditor");
21
+ var _useModelFieldEditor = require("./useModelFieldEditor");
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { FieldEditor } from \"./FieldEditor\";\nexport { useFieldEditor } from \"./useFieldEditor\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { FieldEditor } from \"./FieldEditor\";\nexport { useModelFieldEditor } from \"./useModelFieldEditor\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;AACA"}
@@ -0,0 +1,2 @@
1
+ import { FieldEditorContext } from "./FieldEditorContext";
2
+ export declare function useModelFieldEditor(): FieldEditorContext;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useModelFieldEditor = useModelFieldEditor;
7
+
8
+ var _react = require("react");
9
+
10
+ var _FieldEditorContext = require("./FieldEditorContext");
11
+
12
+ function useModelFieldEditor() {
13
+ var context = (0, _react.useContext)(_FieldEditorContext.FieldEditorContext);
14
+
15
+ if (!context) {
16
+ throw Error("FieldEditorContext is missing in the component tree. Are you useing the \"useFieldEditor()\" hook in the right place?");
17
+ }
18
+
19
+ return context;
20
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useModelFieldEditor","context","useContext","FieldEditorContext","Error"],"sources":["useModelFieldEditor.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { FieldEditorContext } from \"./FieldEditorContext\";\n\nexport function useModelFieldEditor() {\n const context = useContext(FieldEditorContext);\n if (!context) {\n throw Error(\n `FieldEditorContext is missing in the component tree. Are you useing the \"useFieldEditor()\" hook in the right place?`\n );\n }\n\n return context;\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,SAASA,mBAAT,GAA+B;EAClC,IAAMC,OAAO,GAAG,IAAAC,iBAAA,EAAWC,sCAAX,CAAhB;;EACA,IAAI,CAACF,OAAL,EAAc;IACV,MAAMG,KAAK,yHAAX;EAGH;;EAED,OAAOH,OAAP;AACH"}
@@ -1,7 +1,7 @@
1
- import { CmsEditorField, CmsModel } from "../../../../types";
1
+ import { CmsModelField, CmsModel } from "../../../../types";
2
2
  declare type DeleteFieldParamsData = Pick<CmsModel, "fields" | "layout">;
3
3
  interface DeleteFieldParams {
4
- field: Pick<CmsEditorField, "id">;
4
+ field: Pick<CmsModelField, "id">;
5
5
  data: DeleteFieldParamsData;
6
6
  }
7
7
  declare const _default: (params: DeleteFieldParams) => any;
@@ -1 +1 @@
1
- {"version":3,"names":["params","field","prev","data","fieldIndex","fields","findIndex","item","id","dot","delete","set","layout","newLayout","currentRowIndex","forEach","row","fieldId","find","Array","isArray","push","length"],"sources":["deleteField.ts"],"sourcesContent":["import dot from \"dot-prop-immutable\";\nimport { CmsEditorField, CmsModel } from \"~/types\";\n\ntype DeleteFieldParamsData = Pick<CmsModel, \"fields\" | \"layout\">;\ninterface DeleteFieldParams {\n field: Pick<CmsEditorField, \"id\">;\n data: DeleteFieldParamsData;\n}\nexport default (params: DeleteFieldParams) => {\n const { field, data: prev } = params;\n // Remove the field from fields list...\n const fieldIndex = prev.fields.findIndex(item => item.id === field.id);\n const data = dot.delete(prev, `fields.${fieldIndex}`) as DeleteFieldParamsData;\n\n // ...and rebuild the layout object.\n return dot.set(data, \"layout\", (layout: DeleteFieldParamsData[\"layout\"]) => {\n if (!layout) {\n return [];\n }\n const newLayout: DeleteFieldParamsData[\"layout\"] = [];\n let currentRowIndex = 0;\n layout.forEach(row => {\n row.forEach(fieldId => {\n const field = data.fields.find(item => item.id === fieldId);\n if (!field) {\n return;\n }\n if (!Array.isArray(newLayout[currentRowIndex])) {\n newLayout[currentRowIndex] = [];\n }\n\n newLayout[currentRowIndex].push(fieldId);\n });\n newLayout[currentRowIndex] && newLayout[currentRowIndex].length && currentRowIndex++;\n });\n\n return newLayout;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lF;IACH,CAbD;IAeA,OAAOD,SAAP;EACH,CAtBM,CAAP;AAuBH,C"}
1
+ {"version":3,"names":["params","field","prev","data","fieldIndex","fields","findIndex","item","id","dot","delete","set","layout","newLayout","currentRowIndex","forEach","row","fieldId","find","Array","isArray","push","length"],"sources":["deleteField.ts"],"sourcesContent":["import dot from \"dot-prop-immutable\";\nimport { CmsModelField, CmsModel } from \"~/types\";\n\ntype DeleteFieldParamsData = Pick<CmsModel, \"fields\" | \"layout\">;\ninterface DeleteFieldParams {\n field: Pick<CmsModelField, \"id\">;\n data: DeleteFieldParamsData;\n}\nexport default (params: DeleteFieldParams) => {\n const { field, data: prev } = params;\n // Remove the field from fields list...\n const fieldIndex = prev.fields.findIndex(item => item.id === field.id);\n const data = dot.delete(prev, `fields.${fieldIndex}`) as DeleteFieldParamsData;\n\n // ...and rebuild the layout object.\n return dot.set(data, \"layout\", (layout: DeleteFieldParamsData[\"layout\"]) => {\n if (!layout) {\n return [];\n }\n const newLayout: DeleteFieldParamsData[\"layout\"] = [];\n let currentRowIndex = 0;\n layout.forEach(row => {\n row.forEach(fieldId => {\n const field = data.fields.find(item => item.id === fieldId);\n if (!field) {\n return;\n }\n if (!Array.isArray(newLayout[currentRowIndex])) {\n newLayout[currentRowIndex] = [];\n }\n\n newLayout[currentRowIndex].push(fieldId);\n });\n newLayout[currentRowIndex] && newLayout[currentRowIndex].length && currentRowIndex++;\n });\n\n return newLayout;\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;eAQe,kBAACA,MAAD,EAA+B;EAC1C,IAAQC,KAAR,GAA8BD,MAA9B,CAAQC,KAAR;EAAA,IAAqBC,IAArB,GAA8BF,MAA9B,CAAeG,IAAf,CAD0C,CAE1C;;EACA,IAAMC,UAAU,GAAGF,IAAI,CAACG,MAAL,CAAYC,SAAZ,CAAsB,UAAAC,IAAI;IAAA,OAAIA,IAAI,CAACC,EAAL,KAAYP,KAAK,CAACO,EAAtB;EAAA,CAA1B,CAAnB;;EACA,IAAML,IAAI,GAAGM,yBAAA,CAAIC,MAAJ,CAAWR,IAAX,mBAA2BE,UAA3B,EAAb,CAJ0C,CAM1C;;;EACA,OAAOK,yBAAA,CAAIE,GAAJ,CAAQR,IAAR,EAAc,QAAd,EAAwB,UAACS,MAAD,EAA6C;IACxE,IAAI,CAACA,MAAL,EAAa;MACT,OAAO,EAAP;IACH;;IACD,IAAMC,SAA0C,GAAG,EAAnD;IACA,IAAIC,eAAe,GAAG,CAAtB;IACAF,MAAM,CAACG,OAAP,CAAe,UAAAC,GAAG,EAAI;MAClBA,GAAG,CAACD,OAAJ,CAAY,UAAAE,OAAO,EAAI;QACnB,IAAMhB,KAAK,GAAGE,IAAI,CAACE,MAAL,CAAYa,IAAZ,CAAiB,UAAAX,IAAI;UAAA,OAAIA,IAAI,CAACC,EAAL,KAAYS,OAAhB;QAAA,CAArB,CAAd;;QACA,IAAI,CAAChB,KAAL,EAAY;UACR;QACH;;QACD,IAAI,CAACkB,KAAK,CAACC,OAAN,CAAcP,SAAS,CAACC,eAAD,CAAvB,CAAL,EAAgD;UAC5CD,SAAS,CAACC,eAAD,CAAT,GAA6B,EAA7B;QACH;;QAEDD,SAAS,CAACC,eAAD,CAAT,CAA2BO,IAA3B,CAAgCJ,OAAhC;MACH,CAVD;MAWAJ,SAAS,CAACC,eAAD,CAAT,IAA8BD,SAAS,CAACC,eAAD,CAAT,CAA2BQ,MAAzD,IAAmER,eAAe,EAAlF;IACH,CAbD;IAeA,OAAOD,SAAP;EACH,CAtBM,CAAP;AAuBH,C"}
@@ -1,6 +1,6 @@
1
- import { CmsEditorField, CmsModel, FieldLayoutPosition } from "../../../../types";
1
+ import { CmsModelField, CmsModel, FieldLayoutPosition } from "../../../../types";
2
2
  interface GetFieldPositionParams {
3
- field: string | CmsEditorField;
3
+ field: string | CmsModelField;
4
4
  data: Pick<CmsModel, "layout">;
5
5
  }
6
6
  declare const _default: (params: GetFieldPositionParams) => FieldLayoutPosition | null;
@@ -1 +1 @@
1
- {"version":3,"names":["params","field","data","id","layout","i","length","row","j","index"],"sources":["getFieldPosition.ts"],"sourcesContent":["import { CmsEditorField, CmsModel, FieldLayoutPosition } from \"~/types\";\n\ninterface GetFieldPositionParams {\n field: string | CmsEditorField;\n data: Pick<CmsModel, \"layout\">;\n}\nexport default (params: GetFieldPositionParams): FieldLayoutPosition | null => {\n const { field, data } = params;\n const id = typeof field === \"string\" ? field : field.id;\n const layout = data.layout ? data.layout : [];\n for (let i = 0; i < layout.length; i++) {\n const row = layout[i];\n for (let j = 0; j < row.length; j++) {\n if (row[j] === id) {\n return { row: i, index: j };\n }\n }\n }\n\n return null;\n};\n"],"mappings":";;;;;;;eAMe,kBAACA,MAAD,EAAgE;EAC3E,IAAQC,KAAR,GAAwBD,MAAxB,CAAQC,KAAR;EAAA,IAAeC,IAAf,GAAwBF,MAAxB,CAAeE,IAAf;EACA,IAAMC,EAAE,GAAG,OAAOF,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoCA,KAAK,CAACE,EAArD;EACA,IAAMC,MAAM,GAAGF,IAAI,CAACE,MAAL,GAAcF,IAAI,CAACE,MAAnB,GAA4B,EAA3C;;EACA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAAM,CAACE,MAA3B,EAAmCD,CAAC,EAApC,EAAwC;IACpC,IAAME,GAAG,GAAGH,MAAM,CAACC,CAAD,CAAlB;;IACA,KAAK,IAAIG,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,GAAG,CAACD,MAAxB,EAAgCE,CAAC,EAAjC,EAAqC;MACjC,IAAID,GAAG,CAACC,CAAD,CAAH,KAAWL,EAAf,EAAmB;QACf,OAAO;UAAEI,GAAG,EAAEF,CAAP;UAAUI,KAAK,EAAED;QAAjB,CAAP;MACH;IACJ;EACJ;;EAED,OAAO,IAAP;AACH,C"}
1
+ {"version":3,"names":["params","field","data","id","layout","i","length","row","j","index"],"sources":["getFieldPosition.ts"],"sourcesContent":["import { CmsModelField, CmsModel, FieldLayoutPosition } from \"~/types\";\n\ninterface GetFieldPositionParams {\n field: string | CmsModelField;\n data: Pick<CmsModel, \"layout\">;\n}\nexport default (params: GetFieldPositionParams): FieldLayoutPosition | null => {\n const { field, data } = params;\n const id = typeof field === \"string\" ? field : field.id;\n const layout = data.layout ? data.layout : [];\n for (let i = 0; i < layout.length; i++) {\n const row = layout[i];\n for (let j = 0; j < row.length; j++) {\n if (row[j] === id) {\n return { row: i, index: j };\n }\n }\n }\n\n return null;\n};\n"],"mappings":";;;;;;;eAMe,kBAACA,MAAD,EAAgE;EAC3E,IAAQC,KAAR,GAAwBD,MAAxB,CAAQC,KAAR;EAAA,IAAeC,IAAf,GAAwBF,MAAxB,CAAeE,IAAf;EACA,IAAMC,EAAE,GAAG,OAAOF,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoCA,KAAK,CAACE,EAArD;EACA,IAAMC,MAAM,GAAGF,IAAI,CAACE,MAAL,GAAcF,IAAI,CAACE,MAAnB,GAA4B,EAA3C;;EACA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,MAAM,CAACE,MAA3B,EAAmCD,CAAC,EAApC,EAAwC;IACpC,IAAME,GAAG,GAAGH,MAAM,CAACC,CAAD,CAAlB;;IACA,KAAK,IAAIG,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGD,GAAG,CAACD,MAAxB,EAAgCE,CAAC,EAAjC,EAAqC;MACjC,IAAID,GAAG,CAACC,CAAD,CAAH,KAAWL,EAAf,EAAmB;QACf,OAAO;UAAEI,GAAG,EAAEF,CAAP;UAAUI,KAAK,EAAED;QAAjB,CAAP;MACH;IACJ;EACJ;;EAED,OAAO,IAAP;AACH,C"}
@@ -1,8 +1,8 @@
1
- import { CmsEditorField, CmsEditorFieldId, FieldLayoutPosition } from "../../../../types";
1
+ import { CmsModelField, CmsEditorFieldId, CmsModel as BaseCmsModel, FieldLayoutPosition } from "../../../../types";
2
2
  interface MoveFieldParams<T> {
3
- field: CmsEditorFieldId | Pick<CmsEditorField, "id">;
3
+ field: CmsEditorFieldId | Pick<CmsModelField, "id">;
4
4
  position: FieldLayoutPosition;
5
5
  data: T;
6
6
  }
7
- declare const _default: <T extends Required<Pick<import("../../../../types").CmsEditorContentModel, "layout" | "fields">>>(params: MoveFieldParams<T>) => T;
7
+ declare const _default: <T extends Required<Pick<BaseCmsModel, "layout" | "fields">>>(params: MoveFieldParams<T>) => T;
8
8
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"names":["moveField","params","field","position","prev","data","row","index","fieldId","id","next","layout","existingPosition","getFieldPosition","dot","delete","set","newLayout","splice","filter","length"],"sources":["moveField.ts"],"sourcesContent":["import dot from \"dot-prop-immutable\";\nimport {\n CmsEditorField,\n CmsEditorFieldId,\n CmsModel as BaseCmsModel,\n FieldLayoutPosition\n} from \"~/types\";\nimport getFieldPosition from \"./getFieldPosition\";\n\ntype CmsModel = Required<Pick<BaseCmsModel, \"fields\" | \"layout\">>;\n\ninterface MoveFieldParams<T> {\n field: CmsEditorFieldId | Pick<CmsEditorField, \"id\">;\n position: FieldLayoutPosition;\n data: T;\n}\n\nconst moveField = <T extends CmsModel>(params: MoveFieldParams<T>) => {\n const { field, position, data: prev } = params;\n const { row, index } = position;\n const fieldId = typeof field === \"string\" ? field : field.id;\n\n let next: T = {\n ...prev,\n layout: prev.layout ? prev.layout || [] : []\n };\n\n const existingPosition = getFieldPosition({ field: fieldId, data: prev });\n\n if (existingPosition) {\n next = dot.delete(prev, `layout.${existingPosition.row}.${existingPosition.index}`) as T;\n }\n\n // Setting a form field into a new non-existing row.\n if (!next.layout[row]) {\n return dot.set(next, `layout.${row}`, [fieldId]);\n }\n\n // Drop the field at the specified index.\n if (index === null) {\n // Create a new row with the new field at the given row index,\n return dot.set(next, \"layout\", (layout: string[][]) => {\n const newLayout = [...layout];\n newLayout.splice(row, 0, [fieldId]);\n return newLayout;\n });\n }\n\n return dot.set(next, `layout.${row}`, (layout: string[]) => {\n const newLayout = [...layout];\n newLayout.splice(index, 0, fieldId);\n return newLayout;\n });\n};\n\nexport default <T extends CmsModel>(params: MoveFieldParams<T>): T => {\n return dot.set(moveField<T>(params), \"layout\", (layout: string[][]) => {\n return [...layout].filter(row => row.length > 0);\n });\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AAOA;;AAUA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAAqBC,MAArB,EAAoD;EAClE,IAAQC,KAAR,GAAwCD,MAAxC,CAAQC,KAAR;EAAA,IAAeC,QAAf,GAAwCF,MAAxC,CAAeE,QAAf;EAAA,IAA+BC,IAA/B,GAAwCH,MAAxC,CAAyBI,IAAzB;EACA,IAAQC,GAAR,GAAuBH,QAAvB,CAAQG,GAAR;EAAA,IAAaC,KAAb,GAAuBJ,QAAvB,CAAaI,KAAb;EACA,IAAMC,OAAO,GAAG,OAAON,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoCA,KAAK,CAACO,EAA1D;EAEA,IAAIC,IAAO,+DACJN,IADI;IAEPO,MAAM,EAAEP,IAAI,CAACO,MAAL,GAAcP,IAAI,CAACO,MAAL,IAAe,EAA7B,GAAkC;EAFnC,EAAX;EAKA,IAAMC,gBAAgB,GAAG,IAAAC,yBAAA,EAAiB;IAAEX,KAAK,EAAEM,OAAT;IAAkBH,IAAI,EAAED;EAAxB,CAAjB,CAAzB;;EAEA,IAAIQ,gBAAJ,EAAsB;IAClBF,IAAI,GAAGI,yBAAA,CAAIC,MAAJ,CAAWX,IAAX,mBAA2BQ,gBAAgB,CAACN,GAA5C,cAAmDM,gBAAgB,CAACL,KAApE,EAAP;EACH,CAdiE,CAgBlE;;;EACA,IAAI,CAACG,IAAI,CAACC,MAAL,CAAYL,GAAZ,CAAL,EAAuB;IACnB,OAAOQ,yBAAA,CAAIE,GAAJ,CAAQN,IAAR,mBAAwBJ,GAAxB,GAA+B,CAACE,OAAD,CAA/B,CAAP;EACH,CAnBiE,CAqBlE;;;EACA,IAAID,KAAK,KAAK,IAAd,EAAoB;IAChB;IACA,OAAOO,yBAAA,CAAIE,GAAJ,CAAQN,IAAR,EAAc,QAAd,EAAwB,UAACC,MAAD,EAAwB;MACnD,IAAMM,SAAS,oCAAON,MAAP,CAAf;MACAM,SAAS,CAACC,MAAV,CAAiBZ,GAAjB,EAAsB,CAAtB,EAAyB,CAACE,OAAD,CAAzB;MACA,OAAOS,SAAP;IACH,CAJM,CAAP;EAKH;;EAED,OAAOH,yBAAA,CAAIE,GAAJ,CAAQN,IAAR,mBAAwBJ,GAAxB,GAA+B,UAACK,MAAD,EAAsB;IACxD,IAAMM,SAAS,oCAAON,MAAP,CAAf;IACAM,SAAS,CAACC,MAAV,CAAiBX,KAAjB,EAAwB,CAAxB,EAA2BC,OAA3B;IACA,OAAOS,SAAP;EACH,CAJM,CAAP;AAKH,CApCD;;eAsCe,kBAAqBhB,MAArB,EAAuD;EAClE,OAAOa,yBAAA,CAAIE,GAAJ,CAAQhB,SAAS,CAAIC,MAAJ,CAAjB,EAA8B,QAA9B,EAAwC,UAACU,MAAD,EAAwB;IACnE,OAAO,iCAAIA,MAAJ,EAAYQ,MAAZ,CAAmB,UAAAb,GAAG;MAAA,OAAIA,GAAG,CAACc,MAAJ,GAAa,CAAjB;IAAA,CAAtB,CAAP;EACH,CAFM,CAAP;AAGH,C"}
1
+ {"version":3,"names":["moveField","params","field","position","prev","data","row","index","fieldId","id","next","layout","existingPosition","getFieldPosition","dot","delete","set","newLayout","splice","filter","length"],"sources":["moveField.ts"],"sourcesContent":["import dot from \"dot-prop-immutable\";\nimport {\n CmsModelField,\n CmsEditorFieldId,\n CmsModel as BaseCmsModel,\n FieldLayoutPosition\n} from \"~/types\";\nimport getFieldPosition from \"./getFieldPosition\";\n\ntype CmsModel = Required<Pick<BaseCmsModel, \"fields\" | \"layout\">>;\n\ninterface MoveFieldParams<T> {\n field: CmsEditorFieldId | Pick<CmsModelField, \"id\">;\n position: FieldLayoutPosition;\n data: T;\n}\n\nconst moveField = <T extends CmsModel>(params: MoveFieldParams<T>) => {\n const { field, position, data: prev } = params;\n const { row, index } = position;\n const fieldId = typeof field === \"string\" ? field : field.id;\n\n let next: T = {\n ...prev,\n layout: prev.layout ? prev.layout || [] : []\n };\n\n const existingPosition = getFieldPosition({ field: fieldId, data: prev });\n\n if (existingPosition) {\n next = dot.delete(prev, `layout.${existingPosition.row}.${existingPosition.index}`) as T;\n }\n\n // Setting a form field into a new non-existing row.\n if (!next.layout[row]) {\n return dot.set(next, `layout.${row}`, [fieldId]);\n }\n\n // Drop the field at the specified index.\n if (index === null) {\n // Create a new row with the new field at the given row index,\n return dot.set(next, \"layout\", (layout: string[][]) => {\n const newLayout = [...layout];\n newLayout.splice(row, 0, [fieldId]);\n return newLayout;\n });\n }\n\n return dot.set(next, `layout.${row}`, (layout: string[]) => {\n const newLayout = [...layout];\n newLayout.splice(index, 0, fieldId);\n return newLayout;\n });\n};\n\nexport default <T extends CmsModel>(params: MoveFieldParams<T>): T => {\n return dot.set(moveField<T>(params), \"layout\", (layout: string[][]) => {\n return [...layout].filter(row => row.length > 0);\n });\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AAOA;;AAUA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAAqBC,MAArB,EAAoD;EAClE,IAAQC,KAAR,GAAwCD,MAAxC,CAAQC,KAAR;EAAA,IAAeC,QAAf,GAAwCF,MAAxC,CAAeE,QAAf;EAAA,IAA+BC,IAA/B,GAAwCH,MAAxC,CAAyBI,IAAzB;EACA,IAAQC,GAAR,GAAuBH,QAAvB,CAAQG,GAAR;EAAA,IAAaC,KAAb,GAAuBJ,QAAvB,CAAaI,KAAb;EACA,IAAMC,OAAO,GAAG,OAAON,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoCA,KAAK,CAACO,EAA1D;EAEA,IAAIC,IAAO,+DACJN,IADI;IAEPO,MAAM,EAAEP,IAAI,CAACO,MAAL,GAAcP,IAAI,CAACO,MAAL,IAAe,EAA7B,GA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AAAb,GAAG;MAAA,OAAIA,GAAG,CAACc,MAAJ,GAAa,CAAjB;IAAA,CAAtB,CAAP;EACH,CAFM,CAAP;AAGH,C"}
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { FormComponentProps } from "@webiny/ui/types";
3
+ export interface IconPickerProps extends FormComponentProps {
4
+ label?: React.ReactNode;
5
+ description?: React.ReactNode;
6
+ }
7
+ export declare const IconPicker: React.FC<IconPickerProps>;
@@ -7,11 +7,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.default = void 0;
10
+ exports.IconPicker = void 0;
11
11
 
12
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
13
 
14
- var React = _interopRequireWildcard(require("react"));
14
+ var _react = _interopRequireWildcard(require("react"));
15
15
 
16
16
  var _emotion = require("emotion");
17
17
 
@@ -39,11 +39,7 @@ var iconPickerLabel = /*#__PURE__*/(0, _emotion.css)({
39
39
  marginBottom: 5,
40
40
  marginLeft: 2
41
41
  }, "label:iconPickerLabel;");
42
- var MenuWrapper = /*#__PURE__*/(0, _emotion.css)({
43
- color: "var(--mdc-theme-text-secondary-on-background)",
44
- backgroundColor: "var(--mdc-theme-on-background)",
45
- padding: "16px 8px"
46
- }, "label:MenuWrapper;");
42
+ var MenuWrapper = /*#__PURE__*/(0, _emotion.css)("color:var(--mdc-theme-text-secondary-on-background);background-color:var(--mdc-theme-on-background);border-bottom:1px solid var(--mdc-theme-text-secondary-on-background,rgba(0,0,0,0.54));padding:16px 8px;cursor:pointer;:hover{border-bottom:1px solid rgba(0,0,0,1);}label:MenuWrapper;");
47
43
  var NoResultWrapper = /*#__PURE__*/(0, _emotion.css)({
48
44
  width: 640,
49
45
  color: "var(--mdc-theme-text-secondary-on-background)",
@@ -100,9 +96,9 @@ var searchInput = /*#__PURE__*/(0, _emotion.css)({
100
96
  padding: "20px 12px 20px"
101
97
  }
102
98
  }, "label:searchInput;");
103
- var useState = React.useState,
104
- useCallback = React.useCallback,
105
- useMemo = React.useMemo;
99
+ var useState = _react.default.useState,
100
+ useCallback = _react.default.useCallback,
101
+ useMemo = _react.default.useMemo;
106
102
 
107
103
  var IconPicker = function IconPicker(_ref) {
108
104
  var value = _ref.value,
@@ -121,6 +117,14 @@ var IconPicker = function IconPicker(_ref) {
121
117
  mustRenderGrid = _useState4[0],
122
118
  setMustRenderGrid = _useState4[1];
123
119
 
120
+ var inputRef = (0, _react.useRef)(null);
121
+ (0, _react.useEffect)(function () {
122
+ setTimeout(function () {
123
+ if (mustRenderGrid && inputRef.current) {
124
+ inputRef.current.focus();
125
+ }
126
+ }, 50);
127
+ }, [mustRenderGrid]);
124
128
  var onFilterChange = useCallback(function (value, cb) {
125
129
  setFilter(value);
126
130
  cb();
@@ -150,7 +154,7 @@ var IconPicker = function IconPicker(_ref) {
150
154
  return null;
151
155
  }
152
156
 
153
- return /*#__PURE__*/React.createElement("div", {
157
+ return /*#__PURE__*/_react.default.createElement("div", {
154
158
  key: key,
155
159
  style: style,
156
160
  className: gridItem,
@@ -161,34 +165,34 @@ var IconPicker = function IconPicker(_ref) {
161
165
 
162
166
  closeMenu();
163
167
  }
164
- }, /*#__PURE__*/React.createElement(_reactFontawesome.FontAwesomeIcon, {
168
+ }, /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
165
169
  icon: item.id,
166
170
  size: "2x"
167
- }), /*#__PURE__*/React.createElement(_Typography.Typography, {
171
+ }), /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
168
172
  use: "body2"
169
173
  }, item.name));
170
174
  };
171
175
  }, [icons]);
172
176
  var renderGrid = useCallback(function (_ref4) {
173
177
  var closeMenu = _ref4.closeMenu;
174
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_DelayedOnChange.default, {
178
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_DelayedOnChange.default, {
175
179
  value: filter,
176
180
  onChange: onFilterChange
177
181
  }, function (_ref5) {
178
182
  var value = _ref5.value,
179
183
  onChange = _ref5.onChange;
180
- return /*#__PURE__*/React.createElement(_Input.Input, {
181
- autoFocus: true,
184
+ return /*#__PURE__*/_react.default.createElement(_Input.Input, {
185
+ inputRef: inputRef,
182
186
  className: searchInput,
183
187
  value: value,
184
188
  onChange: onChange,
185
189
  placeholder: "Search icons..."
186
190
  });
187
- }), icons.length === 0 ? /*#__PURE__*/React.createElement("div", {
191
+ }), icons.length === 0 ? /*#__PURE__*/_react.default.createElement("div", {
188
192
  className: NoResultWrapper
189
- }, /*#__PURE__*/React.createElement(_Typography.Typography, {
193
+ }, /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
190
194
  use: "body1"
191
- }, "No results found.")) : /*#__PURE__*/React.createElement(_reactVirtualized.Grid, {
195
+ }, "No results found.")) : /*#__PURE__*/_react.default.createElement(_reactVirtualized.Grid, {
192
196
  className: grid,
193
197
  cellRenderer: renderCell({
194
198
  closeMenu: closeMenu
@@ -207,29 +211,28 @@ var IconPicker = function IconPicker(_ref) {
207
211
  validationIsValid = _ref6.isValid,
208
212
  validationMessage = _ref6.message;
209
213
 
210
- return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement("div", {
214
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, label && /*#__PURE__*/_react.default.createElement("div", {
211
215
  className: iconPickerLabel
212
- }, /*#__PURE__*/React.createElement(_Typography.Typography, {
216
+ }, /*#__PURE__*/_react.default.createElement(_Typography.Typography, {
213
217
  use: "body1"
214
- }, label)), /*#__PURE__*/React.createElement("div", {
215
- className: MenuWrapper
216
- }, /*#__PURE__*/React.createElement(_Menu.Menu, {
218
+ }, label)), /*#__PURE__*/_react.default.createElement(_Menu.Menu, {
217
219
  onOpen: function onOpen() {
218
220
  return setMustRenderGrid(true);
219
221
  },
220
222
  onClose: function onClose() {
221
223
  return setMustRenderGrid(false);
222
224
  },
223
- handle: /*#__PURE__*/React.createElement("div", {
225
+ handle: /*#__PURE__*/_react.default.createElement("div", {
226
+ className: MenuWrapper
227
+ }, /*#__PURE__*/_react.default.createElement("div", {
224
228
  className: pickIcon
225
- }, /*#__PURE__*/React.createElement(_reactFontawesome.FontAwesomeIcon, {
229
+ }, /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
226
230
  icon: fontAwesomeIconValue,
227
231
  size: "2x"
228
- }))
229
- }, mustRenderGrid && renderGrid)), validationIsValid === false && /*#__PURE__*/React.createElement(_FormElementMessage.FormElementMessage, {
232
+ })))
233
+ }, mustRenderGrid && renderGrid), validationIsValid === false && /*#__PURE__*/_react.default.createElement(_FormElementMessage.FormElementMessage, {
230
234
  error: true
231
- }, validationMessage), validationIsValid !== false && description && /*#__PURE__*/React.createElement(_FormElementMessage.FormElementMessage, null, description));
235
+ }, validationMessage), validationIsValid !== false && description && /*#__PURE__*/_react.default.createElement(_FormElementMessage.FormElementMessage, null, description));
232
236
  };
233
237
 
234
- var _default = IconPicker;
235
- exports.default = _default;
238
+ exports.IconPicker = IconPicker;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["iconPickerLabel","css","marginBottom","marginLeft","MenuWrapper","NoResultWrapper","width","color","padding","COLUMN_COUNT","gridItem","display","flexDirection","justifyContent","boxSizing","paddingTop","alignItems","textAlign","cursor","transform","borderRadius","transition","boxShadow","content","position","top","left","height","zIndex","opacity","backgroundColor","grid","pickIcon","searchInput","input","useState","React","useCallback","useMemo","IconPicker","value","onChange","label","description","validation","filter","setFilter","mustRenderGrid","setMustRenderGrid","inputRef","useRef","useEffect","setTimeout","current","focus","onFilterChange","cb","allIcons","iconPlugins","plugins","byType","reduce","icons","pl","concat","getIcons","ic","name","includes","renderCell","closeMenu","columnIndex","key","rowIndex","style","item","id","join","renderGrid","length","Math","ceil","fontAwesomeIconValue","split","validationIsValid","isValid","validationMessage","message"],"sources":["IconPicker.tsx"],"sourcesContent":["import React, { useEffect, useRef } from \"react\";\nimport { css } from \"emotion\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Grid } from \"react-virtualized\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport DelayedOnChange from \"./DelayedOnChange\";\nimport { Menu } from \"@webiny/ui/Menu\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { CmsIcon, CmsIconsPlugin } from \"~/types\";\nimport { FormComponentProps } from \"@webiny/ui/types\";\nimport { FormElementMessage } from \"@webiny/ui/FormElementMessage\";\nimport { GridCellProps } from \"react-virtualized/dist/es/Grid\";\n\n/**\n * Controls the helper text below the checkbox.\n * @type {string}\n */\nconst iconPickerLabel = css({ marginBottom: 5, marginLeft: 2 });\n\nconst MenuWrapper = css`\n color: var(--mdc-theme-text-secondary-on-background);\n background-color: var(--mdc-theme-on-background);\n border-bottom: 1px solid var(--mdc-theme-text-secondary-on-background, rgba(0, 0, 0, 0.54));\n padding: 16px 8px;\n cursor: pointer;\n :hover {\n border-bottom: 1px solid rgba(0, 0, 0, 1);\n }\n`;\n\nconst NoResultWrapper = css({\n width: 640,\n color: \"var(--mdc-theme-text-secondary-on-background)\",\n padding: \"16px 12px\"\n});\n\nconst COLUMN_COUNT = 6;\n\nconst gridItem = css({\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"flex-start\",\n boxSizing: \"border-box\",\n paddingTop: 15,\n alignItems: \"center\",\n textAlign: \"center\",\n cursor: \"pointer\",\n transform: \"translateZ(0)\",\n borderRadius: 2,\n color: \"var(--mdc-theme-text-secondary-on-background)\",\n transition: \"all 0.5s cubic-bezier(0.165, 0.84, 0.44, 1)\",\n \"&::after\": {\n boxShadow: \"0 0.25rem 0.125rem 0 rgba(0,0,0,0.05)\",\n transition: \"opacity 0.5s cubic-bezier(0.165, 0.84, 0.44, 1)\",\n content: '\"\"',\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n zIndex: -1,\n opacity: 0\n },\n \"&:hover\": {\n backgroundColor: \"var(--mdc-theme-background)\",\n color: \"var(--mdc-theme-text-primary-on-background)\",\n \"&::after\": {\n opacity: 1\n }\n },\n \">svg\": {\n width: 42,\n marginBottom: 5\n }\n});\n\nconst grid = css({\n padding: 20\n});\n\nconst pickIcon = css({\n width: 50,\n textAlign: \"center\",\n cursor: \"pointer\"\n});\n\nconst searchInput = css({\n input: {\n padding: \"20px 12px 20px\"\n }\n});\n\nconst { useState, useCallback, useMemo } = React;\n\nexport interface IconPickerProps extends FormComponentProps {\n label?: React.ReactNode;\n description?: React.ReactNode;\n}\n\nexport const IconPicker: React.FC<IconPickerProps> = ({\n value,\n onChange,\n label,\n description,\n validation\n}) => {\n const [filter, setFilter] = useState(\"\");\n const [mustRenderGrid, setMustRenderGrid] = useState(false);\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n setTimeout(() => {\n if (mustRenderGrid && inputRef.current) {\n inputRef.current.focus();\n }\n }, 50);\n }, [mustRenderGrid]);\n\n const onFilterChange = useCallback(\n (value, cb) => {\n setFilter(value);\n cb();\n },\n [filter]\n );\n\n const allIcons: CmsIcon[] = useMemo(() => {\n const iconPlugins = plugins.byType<CmsIconsPlugin>(\"cms-icons\");\n return iconPlugins.reduce((icons: Array<CmsIcon>, pl) => {\n return icons.concat(pl.getIcons());\n }, []);\n }, []);\n\n const icons = useMemo(() => {\n return filter ? allIcons.filter(ic => ic.name.includes(filter)) : allIcons;\n }, [filter]);\n\n const renderCell = useCallback(\n ({ closeMenu }) => {\n return function renderCell({\n columnIndex,\n key,\n rowIndex,\n style\n }: GridCellProps): React.ReactNode {\n const item = icons[rowIndex * COLUMN_COUNT + columnIndex];\n if (!item) {\n return null;\n }\n\n return (\n <div\n key={key}\n style={style}\n className={gridItem}\n onClick={() => {\n if (onChange) {\n onChange(item.id.join(\"/\"));\n }\n closeMenu();\n }}\n >\n <FontAwesomeIcon icon={item.id} size={\"2x\"} />\n <Typography use={\"body2\"}>{item.name}</Typography>\n </div>\n );\n };\n },\n [icons]\n );\n\n const renderGrid = useCallback(\n ({ closeMenu }) => {\n return (\n <>\n <DelayedOnChange value={filter} onChange={onFilterChange}>\n {({ value, onChange }) => (\n <Input\n inputRef={inputRef}\n className={searchInput}\n value={value}\n onChange={onChange}\n placeholder={\"Search icons...\"}\n />\n )}\n </DelayedOnChange>\n {icons.length === 0 ? (\n <div className={NoResultWrapper}>\n <Typography use=\"body1\">No results found.</Typography>\n </div>\n ) : (\n <Grid\n className={grid}\n cellRenderer={renderCell({ closeMenu })}\n columnCount={COLUMN_COUNT}\n columnWidth={100}\n height={440}\n rowCount={Math.ceil(icons.length / COLUMN_COUNT)}\n rowHeight={100}\n width={640}\n />\n )}\n </>\n );\n },\n [icons]\n );\n\n const fontAwesomeIconValue: any =\n typeof value === \"string\" && value.includes(\"/\") ? value.split(\"/\") : [\"fas\", \"star\"];\n\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n\n return (\n <>\n {label && (\n <div className={iconPickerLabel}>\n <Typography use={\"body1\"}>{label}</Typography>\n </div>\n )}\n\n <Menu\n onOpen={() => setMustRenderGrid(true)}\n onClose={() => setMustRenderGrid(false)}\n handle={\n <div className={MenuWrapper}>\n <div className={pickIcon}>\n <FontAwesomeIcon icon={fontAwesomeIconValue} size={\"2x\"} />\n </div>\n </div>\n }\n >\n {mustRenderGrid && renderGrid}\n </Menu>\n\n {validationIsValid === false && (\n <FormElementMessage error>{validationMessage}</FormElementMessage>\n )}\n {validationIsValid !== false && description && (\n <FormElementMessage>{description}</FormElementMessage>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AAGA;AACA;AACA;AACA;AACA,IAAMA,eAAe,gBAAG,IAAAC,YAAA,EAAI;EAAEC,YAAY,EAAE,CAAhB;EAAmBC,UAAU,EAAE;A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AA7B,GAAmD5B,KAAK,CAAC2C,KAAN,CAAY,GAAZ,CAAnD,GAAsE,CAAC,KAAD,EAAQ,MAAR,CAD1E;;EAGA,YAAmEvC,UAAU,IAAI,EAAjF;EAAA,IAAiBwC,iBAAjB,SAAQC,OAAR;EAAA,IAA6CC,iBAA7C,SAAoCC,OAApC;;EAEA,oBACI,4DACK7C,KAAK,iBACF;IAAK,SAAS,EAAE1C;EAAhB,gBACI,6BAAC,sBAAD;IAAY,GAAG,EAAE;EAAjB,GAA2B0C,KAA3B,CADJ,CAFR,eAOI,6BAAC,UAAD;IACI,MAAM,EAAE;MAAA,OAAMM,iBAAiB,CAAC,IAAD,CAAvB;IAAA,CADZ;IAEI,OAAO,EAAE;MAAA,OAAMA,iBAAiB,CAAC,KAAD,CAAvB;IAAA,CAFb;IAGI,MAAM,eACF;MAAK,SAAS,EAAE5C;IAAhB,gBACI;MAAK,SAAS,EAAE4B;IAAhB,gBACI,6BAAC,iCAAD;MAAiB,IAAI,EAAEkD,oBAAvB;MAA6C,IAAI,EAAE;IAAnD,EADJ,CADJ;EAJR,GAWKnC,cAAc,IAAI+B,UAXvB,CAPJ,EAqBKM,iBAAiB,KAAK,KAAtB,iBACG,6BAAC,sCAAD;IAAoB,KAAK;EAAzB,GAA2BE,iBAA3B,CAtBR,EAwBKF,iBAAiB,KAAK,KAAtB,IAA+BzC,WAA/B,iBACG,6BAAC,sCAAD,QAAqBA,WAArB,CAzBR,CADJ;AA8BH,CAhJM"}
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+ import { CmsModelField } from "../../../types";
3
+ export declare type ModelFieldContext = CmsModelField;
4
+ export declare const ModelFieldContext: React.Context<{
5
+ id: string;
6
+ type: string;
7
+ fieldId: string;
8
+ storageId?: string | undefined;
9
+ label?: string | undefined;
10
+ helpText?: string | undefined;
11
+ placeholderText?: string | undefined;
12
+ validation?: import("../../../types").CmsModelFieldValidator[] | undefined;
13
+ listValidation?: import("../../../types").CmsModelFieldValidator[] | undefined;
14
+ multipleValues?: boolean | undefined;
15
+ predefinedValues?: import("../../../types").CmsEditorFieldPredefinedValues | undefined;
16
+ settings?: {
17
+ [key: string]: any;
18
+ defaultValue?: string | null | undefined;
19
+ defaultSetValue?: string | undefined;
20
+ type?: string | undefined;
21
+ fields?: any[] | undefined;
22
+ layout?: string[][] | undefined;
23
+ models?: Pick<import("../../../types").CmsModel, "name" | "modelId">[] | undefined;
24
+ templates?: import("../../../types").CmsDynamicZoneTemplate[] | undefined;
25
+ imagesOnly?: boolean | undefined;
26
+ } | undefined;
27
+ renderer: {
28
+ name: string;
29
+ };
30
+ tags?: string[] | undefined;
31
+ } | undefined>;
32
+ export interface ModelFieldProviderProps {
33
+ field: CmsModelField;
34
+ children: React.ReactNode;
35
+ }
36
+ export declare const ModelFieldProvider: ({ field, children }: ModelFieldProviderProps) => JSX.Element;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.ModelFieldProvider = exports.ModelFieldContext = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var ModelFieldContext = /*#__PURE__*/_react.default.createContext(undefined);
13
+
14
+ exports.ModelFieldContext = ModelFieldContext;
15
+
16
+ var ModelFieldProvider = function ModelFieldProvider(_ref) {
17
+ var field = _ref.field,
18
+ children = _ref.children;
19
+ return /*#__PURE__*/_react.default.createElement(ModelFieldContext.Provider, {
20
+ value: field
21
+ }, children);
22
+ };
23
+
24
+ exports.ModelFieldProvider = ModelFieldProvider;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ModelFieldContext","React","createContext","undefined","ModelFieldProvider","field","children"],"sources":["ModelFieldContext.tsx"],"sourcesContent":["import React from \"react\";\nimport { CmsModelField } from \"~/types\";\n\nexport type ModelFieldContext = CmsModelField;\n\nexport const ModelFieldContext = React.createContext<ModelFieldContext | undefined>(undefined);\n\nexport interface ModelFieldProviderProps {\n field: CmsModelField;\n children: React.ReactNode;\n}\n\nexport const ModelFieldProvider = ({ field, children }: ModelFieldProviderProps) => {\n return <ModelFieldContext.Provider value={field}>{children}</ModelFieldContext.Provider>;\n};\n"],"mappings":";;;;;;;;;AAAA;;AAKO,IAAMA,iBAAiB,gBAAGC,cAAA,CAAMC,aAAN,CAAmDC,SAAnD,CAA1B;;;;AAOA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB,OAAkD;EAAA,IAA/CC,KAA+C,QAA/CA,KAA+C;EAAA,IAAxCC,QAAwC,QAAxCA,QAAwC;EAChF,oBAAO,6BAAC,iBAAD,CAAmB,QAAnB;IAA4B,KAAK,EAAED;EAAnC,GAA2CC,QAA3C,CAAP;AACH,CAFM"}
@@ -0,0 +1,2 @@
1
+ export * from "./ModelFieldContext";
2
+ export * from "./useModelField";
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _ModelFieldContext = require("./ModelFieldContext");
8
+
9
+ Object.keys(_ModelFieldContext).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _ModelFieldContext[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _ModelFieldContext[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _useModelField = require("./useModelField");
21
+
22
+ Object.keys(_useModelField).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _useModelField[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _useModelField[key];
29
+ }
30
+ });
31
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./ModelFieldContext\";\nexport * from \"./useModelField\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,35 @@
1
+ import { CmsModelFieldTypePlugin } from "../../../types";
2
+ /**
3
+ * Get model field from the current context.
4
+ */
5
+ export declare function useModelField(): {
6
+ field: {
7
+ id: string;
8
+ type: string;
9
+ fieldId: string;
10
+ storageId?: string | undefined;
11
+ label?: string | undefined;
12
+ helpText?: string | undefined;
13
+ placeholderText?: string | undefined;
14
+ validation?: import("../../../types").CmsModelFieldValidator[] | undefined;
15
+ listValidation?: import("../../../types").CmsModelFieldValidator[] | undefined;
16
+ multipleValues?: boolean | undefined;
17
+ predefinedValues?: import("../../../types").CmsEditorFieldPredefinedValues | undefined;
18
+ settings?: {
19
+ [key: string]: any;
20
+ defaultValue?: string | null | undefined;
21
+ defaultSetValue?: string | undefined;
22
+ type?: string | undefined;
23
+ fields?: any[] | undefined;
24
+ layout?: string[][] | undefined;
25
+ models?: Pick<import("../../../types").CmsModel, "name" | "modelId">[] | undefined;
26
+ templates?: import("../../../types").CmsDynamicZoneTemplate[] | undefined;
27
+ imagesOnly?: boolean | undefined;
28
+ } | undefined;
29
+ renderer: {
30
+ name: string;
31
+ };
32
+ tags?: string[] | undefined;
33
+ };
34
+ fieldPlugin: CmsModelFieldTypePlugin;
35
+ };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useModelField = useModelField;
7
+
8
+ var _react = require("react");
9
+
10
+ var _ModelFieldContext = require("./ModelFieldContext");
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ var getFieldPlugin = function getFieldPlugin(type) {
15
+ var plugin = _plugins.plugins.byType("cms-editor-field-type").find(function (plugin) {
16
+ return plugin.field.type === type;
17
+ });
18
+
19
+ if (!plugin) {
20
+ throw Error("Missing plugin for field type \"".concat(type, "\"!"));
21
+ }
22
+
23
+ return plugin;
24
+ };
25
+ /**
26
+ * Get model field from the current context.
27
+ */
28
+
29
+
30
+ function useModelField() {
31
+ var field = (0, _react.useContext)(_ModelFieldContext.ModelFieldContext);
32
+
33
+ if (!field) {
34
+ throw Error("Missing \"ModelFieldProvider\" in the component tree. Are you using the \"useModelField()\" hook in the right place?");
35
+ }
36
+
37
+ var fieldPlugin = getFieldPlugin(field.type);
38
+ return {
39
+ field: field,
40
+ fieldPlugin: fieldPlugin
41
+ };
42
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getFieldPlugin","type","plugin","plugins","byType","find","field","Error","useModelField","useContext","ModelFieldContext","fieldPlugin"],"sources":["useModelField.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport { ModelFieldContext } from \"./ModelFieldContext\";\nimport { plugins } from \"@webiny/plugins\";\nimport { CmsModelFieldTypePlugin } from \"~/types\";\n\ninterface GetFieldPlugin {\n (type: string): CmsModelFieldTypePlugin;\n}\n\nconst getFieldPlugin: GetFieldPlugin = type => {\n const plugin = plugins\n .byType<CmsModelFieldTypePlugin>(\"cms-editor-field-type\")\n .find(plugin => plugin.field.type === type);\n\n if (!plugin) {\n throw Error(`Missing plugin for field type \"${type}\"!`);\n }\n\n return plugin;\n};\n\n/**\n * Get model field from the current context.\n */\nexport function useModelField() {\n const field = useContext(ModelFieldContext);\n if (!field) {\n throw Error(\n `Missing \"ModelFieldProvider\" in the component tree. Are you using the \"useModelField()\" hook in the right place?`\n );\n }\n\n const fieldPlugin = getFieldPlugin(field.type);\n\n return { field, fieldPlugin };\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAOA,IAAMA,cAA8B,GAAG,SAAjCA,cAAiC,CAAAC,IAAI,EAAI;EAC3C,IAAMC,MAAM,GAAGC,gBAAA,CACVC,MADU,CACsB,uBADtB,EAEVC,IAFU,CAEL,UAAAH,MAAM;IAAA,OAAIA,MAAM,CAACI,KAAP,CAAaL,IAAb,KAAsBA,IAA1B;EAAA,CAFD,CAAf;;EAIA,IAAI,CAACC,MAAL,EAAa;IACT,MAAMK,KAAK,2CAAmCN,IAAnC,SAAX;EACH;;EAED,OAAOC,MAAP;AACH,CAVD;AAYA;AACA;AACA;;;AACO,SAASM,aAAT,GAAyB;EAC5B,IAAMF,KAAK,GAAG,IAAAG,iBAAA,EAAWC,oCAAX,CAAd;;EACA,IAAI,CAACJ,KAAL,EAAY;IACR,MAAMC,KAAK,wHAAX;EAGH;;EAED,IAAMI,WAAW,GAAGX,cAAc,CAACM,KAAK,CAACL,IAAP,CAAlC;EAEA,OAAO;IAAEK,KAAK,EAALA,KAAF;IAASK,WAAW,EAAXA;EAAT,CAAP;AACH"}
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { CmsModel } from "../../../types";
3
+ export declare type ModelContext = CmsModel;
4
+ export declare const ModelContext: React.Context<CmsModel | undefined>;
5
+ export interface ModelProviderProps {
6
+ model: CmsModel;
7
+ children: React.ReactNode;
8
+ }
9
+ export declare const ModelProvider: ({ model, children }: ModelProviderProps) => JSX.Element;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.ModelProvider = exports.ModelContext = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var ModelContext = /*#__PURE__*/_react.default.createContext(undefined);
13
+
14
+ exports.ModelContext = ModelContext;
15
+
16
+ var ModelProvider = function ModelProvider(_ref) {
17
+ var model = _ref.model,
18
+ children = _ref.children;
19
+ return /*#__PURE__*/_react.default.createElement(ModelContext.Provider, {
20
+ value: model
21
+ }, children);
22
+ };
23
+
24
+ exports.ModelProvider = ModelProvider;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ModelContext","React","createContext","undefined","ModelProvider","model","children"],"sources":["ModelContext.tsx"],"sourcesContent":["import React from \"react\";\nimport { CmsModel } from \"~/types\";\n\nexport type ModelContext = CmsModel;\n\nexport const ModelContext = React.createContext<ModelContext | undefined>(undefined);\n\nexport interface ModelProviderProps {\n model: CmsModel;\n children: React.ReactNode;\n}\n\nexport const ModelProvider = ({ model, children }: ModelProviderProps) => {\n return <ModelContext.Provider value={model}>{children}</ModelContext.Provider>;\n};\n"],"mappings":";;;;;;;;;AAAA;;AAKO,IAAMA,YAAY,gBAAGC,cAAA,CAAMC,aAAN,CAA8CC,SAA9C,CAArB;;;;AAOA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,OAA6C;EAAA,IAA1CC,KAA0C,QAA1CA,KAA0C;EAAA,IAAnCC,QAAmC,QAAnCA,QAAmC;EACtE,oBAAO,6BAAC,YAAD,CAAc,QAAd;IAAuB,KAAK,EAAED;EAA9B,GAAsCC,QAAtC,CAAP;AACH,CAFM"}