@webiny/app-headless-cms 6.6.0-alpha.1 → 6.6.0-alpha.11

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 (360) hide show
  1. package/ContentEntriesModule.js +20 -3
  2. package/ContentEntriesModule.js.map +1 -1
  3. package/admin/RoutesConfig.js +5 -1
  4. package/admin/RoutesConfig.js.map +1 -1
  5. package/admin/components/ContentEntries/BulkActions/ActionDelete.js +2 -1
  6. package/admin/components/ContentEntries/BulkActions/ActionDelete.js.map +1 -1
  7. package/admin/components/ContentEntries/BulkActions/ActionDelete.test.d.ts +1 -0
  8. package/admin/components/ContentEntries/BulkActions/ActionDelete.test.js +125 -0
  9. package/admin/components/ContentEntries/BulkActions/ActionDelete.test.js.map +1 -0
  10. package/admin/components/ContentEntries/Filters/RefFieldRenderer.d.ts +2 -0
  11. package/admin/components/ContentEntries/Filters/RefFieldRenderer.js +85 -0
  12. package/admin/components/ContentEntries/Filters/RefFieldRenderer.js.map +1 -0
  13. package/admin/components/ContentEntries/Table/Actions/DuplicateEntry.d.ts +2 -0
  14. package/admin/components/ContentEntries/Table/Actions/DuplicateEntry.js +34 -0
  15. package/admin/components/ContentEntries/Table/Actions/DuplicateEntry.js.map +1 -0
  16. package/admin/components/ContentEntries/Table/Actions/index.d.ts +1 -0
  17. package/admin/components/ContentEntries/Table/Actions/index.js +1 -0
  18. package/admin/components/ContentEntries/Table/Cells/CellLive.js +9 -2
  19. package/admin/components/ContentEntries/Table/Cells/CellLive.js.map +1 -1
  20. package/admin/components/ContentModelEditor/ContentModelEditor.js +1 -1
  21. package/admin/components/ContentModelEditor/ContentModelEditor.js.map +1 -1
  22. package/admin/components/ContentModelEditor/evaluateExpression.d.ts +1 -1
  23. package/admin/components/ContentModelEditor/evaluateExpression.js +6 -0
  24. package/admin/components/ContentModelEditor/evaluateExpression.js.map +1 -1
  25. package/admin/components/ContentModelEditor/operatorOptions.js +12 -0
  26. package/admin/components/ContentModelEditor/operatorOptions.js.map +1 -1
  27. package/admin/components/Dialogs/DuplicateEntryConfirmDialog.d.ts +2 -0
  28. package/admin/components/Dialogs/DuplicateEntryConfirmDialog.js +22 -0
  29. package/admin/components/Dialogs/DuplicateEntryConfirmDialog.js.map +1 -0
  30. package/admin/components/Dialogs/EditRevisionNoteDialog.d.ts +2 -0
  31. package/admin/components/Dialogs/EditRevisionNoteDialog.js +33 -0
  32. package/admin/components/Dialogs/EditRevisionNoteDialog.js.map +1 -0
  33. package/admin/components/FieldEditor/Field.js +4 -4
  34. package/admin/components/FieldEditor/Field.js.map +1 -1
  35. package/admin/components/ModelFieldProvider/ModelFieldContext.d.ts +1 -0
  36. package/admin/config/contentEntries/editor/ContentEntryEditorConfig.d.ts +1 -1
  37. package/admin/graphql/contentModels.d.ts +2 -2
  38. package/admin/graphql/contentModels.js +1 -0
  39. package/admin/graphql/contentModels.js.map +1 -1
  40. package/admin/hooks/usePermission.js +6 -34
  41. package/admin/hooks/usePermission.js.map +1 -1
  42. package/admin/plugins/editor/defaultBar/Name/Name.d.ts +0 -5
  43. package/admin/plugins/editor/defaultBar/Name/Name.js +0 -2
  44. package/admin/plugins/editor/defaultBar/Name/Name.js.map +1 -1
  45. package/admin/plugins/editor/formSettings/components/GeneralSettings.js +0 -16
  46. package/admin/plugins/editor/formSettings/components/GeneralSettings.js.map +1 -1
  47. package/domain/permissions/checkCmsPermission.d.ts +14 -0
  48. package/domain/permissions/checkCmsPermission.js +20 -0
  49. package/domain/permissions/checkCmsPermission.js.map +1 -0
  50. package/domain/permissions/hasAccessForModel.d.ts +11 -0
  51. package/domain/permissions/hasAccessForModel.js +20 -0
  52. package/domain/permissions/hasAccessForModel.js.map +1 -0
  53. package/domain/permissions/isModelAllowed.d.ts +2 -0
  54. package/domain/permissions/isModelAllowed.js +11 -0
  55. package/domain/permissions/isModelAllowed.js.map +1 -0
  56. package/features/contentEntry/CmsEntryError.d.ts +10 -0
  57. package/features/contentEntry/CmsEntryError.js +11 -0
  58. package/features/contentEntry/CmsEntryError.js.map +1 -0
  59. package/features/contentEntry/bulkAction/BulkActionGateway.js +6 -1
  60. package/features/contentEntry/bulkAction/BulkActionGateway.js.map +1 -1
  61. package/features/contentEntry/bulkAction/BulkActionGateway.test.d.ts +1 -0
  62. package/features/contentEntry/bulkAction/BulkActionGateway.test.js +134 -0
  63. package/features/contentEntry/bulkAction/BulkActionGateway.test.js.map +1 -0
  64. package/features/contentEntry/createEntry/CreateEntryGateway.d.ts +0 -1
  65. package/features/contentEntry/createEntry/CreateEntryGateway.js +3 -10
  66. package/features/contentEntry/createEntry/CreateEntryGateway.js.map +1 -1
  67. package/features/contentEntry/createRevisionFrom/CreateRevisionFromGateway.d.ts +3 -1
  68. package/features/contentEntry/createRevisionFrom/CreateRevisionFromGateway.js +8 -3
  69. package/features/contentEntry/createRevisionFrom/CreateRevisionFromGateway.js.map +1 -1
  70. package/features/contentEntry/deleteEntry/DeleteEntryGateway.js +6 -1
  71. package/features/contentEntry/deleteEntry/DeleteEntryGateway.js.map +1 -1
  72. package/features/contentEntry/deleteEntry/DeleteEntryGateway.test.d.ts +1 -0
  73. package/features/contentEntry/deleteEntry/DeleteEntryGateway.test.js +116 -0
  74. package/features/contentEntry/deleteEntry/DeleteEntryGateway.test.js.map +1 -0
  75. package/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.js +6 -1
  76. package/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.js.map +1 -1
  77. package/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.test.d.ts +1 -0
  78. package/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.test.js +112 -0
  79. package/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.test.js.map +1 -0
  80. package/features/contentEntry/duplicateEntry/DuplicateEntryGateway.d.ts +14 -0
  81. package/features/contentEntry/duplicateEntry/DuplicateEntryGateway.js +43 -0
  82. package/features/contentEntry/duplicateEntry/DuplicateEntryGateway.js.map +1 -0
  83. package/features/contentEntry/duplicateEntry/DuplicateEntryRepository.d.ts +15 -0
  84. package/features/contentEntry/duplicateEntry/DuplicateEntryRepository.js +34 -0
  85. package/features/contentEntry/duplicateEntry/DuplicateEntryRepository.js.map +1 -0
  86. package/features/contentEntry/duplicateEntry/DuplicateEntryUseCase.d.ts +11 -0
  87. package/features/contentEntry/duplicateEntry/DuplicateEntryUseCase.js +18 -0
  88. package/features/contentEntry/duplicateEntry/DuplicateEntryUseCase.js.map +1 -0
  89. package/features/contentEntry/duplicateEntry/abstractions.d.ts +26 -0
  90. package/features/contentEntry/duplicateEntry/abstractions.js +7 -0
  91. package/features/contentEntry/duplicateEntry/abstractions.js.map +1 -0
  92. package/features/contentEntry/duplicateEntry/feature.d.ts +3 -0
  93. package/features/contentEntry/duplicateEntry/feature.js +21 -0
  94. package/features/contentEntry/duplicateEntry/feature.js.map +1 -0
  95. package/features/contentEntry/entryValueGateways.test.d.ts +1 -0
  96. package/features/contentEntry/entryValueGateways.test.js +106 -0
  97. package/features/contentEntry/entryValueGateways.test.js.map +1 -0
  98. package/features/contentEntry/feature.js +4 -2
  99. package/features/contentEntry/feature.js.map +1 -1
  100. package/features/contentEntry/permanentlyDeleteEntry/PermanentlyDeleteEntryGateway.js +6 -1
  101. package/features/contentEntry/permanentlyDeleteEntry/PermanentlyDeleteEntryGateway.js.map +1 -1
  102. package/features/contentEntry/permanentlyDeleteEntry/PermanentlyDeleteEntryGateway.test.d.ts +1 -0
  103. package/features/contentEntry/permanentlyDeleteEntry/PermanentlyDeleteEntryGateway.test.js +130 -0
  104. package/features/contentEntry/permanentlyDeleteEntry/PermanentlyDeleteEntryGateway.test.js.map +1 -0
  105. package/features/contentEntry/referenceTitles/ReferenceTitles.d.ts +18 -0
  106. package/features/contentEntry/referenceTitles/ReferenceTitles.js +58 -0
  107. package/features/contentEntry/referenceTitles/ReferenceTitles.js.map +1 -0
  108. package/features/contentEntry/referenceTitles/ReferenceTitles.test.d.ts +1 -0
  109. package/features/contentEntry/referenceTitles/ReferenceTitles.test.js +173 -0
  110. package/features/contentEntry/referenceTitles/ReferenceTitles.test.js.map +1 -0
  111. package/features/contentEntry/referenceTitles/RememberTitlesDecorators.d.ts +22 -0
  112. package/features/contentEntry/referenceTitles/RememberTitlesDecorators.js +40 -0
  113. package/features/contentEntry/referenceTitles/RememberTitlesDecorators.js.map +1 -0
  114. package/features/contentEntry/referenceTitles/abstractions.d.ts +16 -0
  115. package/features/contentEntry/referenceTitles/abstractions.js +5 -0
  116. package/features/contentEntry/referenceTitles/abstractions.js.map +1 -0
  117. package/features/contentEntry/referenceTitles/feature.d.ts +3 -0
  118. package/features/contentEntry/referenceTitles/feature.js +20 -0
  119. package/features/contentEntry/referenceTitles/feature.js.map +1 -0
  120. package/features/contentEntry/singletonEntry/UpdateSingletonEntryGateway.d.ts +0 -1
  121. package/features/contentEntry/singletonEntry/UpdateSingletonEntryGateway.js +3 -10
  122. package/features/contentEntry/singletonEntry/UpdateSingletonEntryGateway.js.map +1 -1
  123. package/features/contentEntry/updateEntry/UpdateEntryGateway.d.ts +0 -1
  124. package/features/contentEntry/updateEntry/UpdateEntryGateway.js +3 -10
  125. package/features/contentEntry/updateEntry/UpdateEntryGateway.js.map +1 -1
  126. package/features/contentEntry/valueTransformers/DynamicZoneValueTransformer.js +7 -2
  127. package/features/contentEntry/valueTransformers/DynamicZoneValueTransformer.js.map +1 -1
  128. package/features/contentEntry/valueTransformers/EntryDataPreparer.d.ts +9 -0
  129. package/features/contentEntry/valueTransformers/EntryDataPreparer.js +8 -0
  130. package/features/contentEntry/valueTransformers/EntryDataPreparer.js.map +1 -1
  131. package/features/contentEntry/valueTransformers/EntryDataPreparer.test.d.ts +1 -0
  132. package/features/contentEntry/valueTransformers/EntryDataPreparer.test.js +113 -0
  133. package/features/contentEntry/valueTransformers/EntryDataPreparer.test.js.map +1 -0
  134. package/features/contentEntry/valueTransformers/ObjectValueTransformer.js +16 -2
  135. package/features/contentEntry/valueTransformers/ObjectValueTransformer.js.map +1 -1
  136. package/features/contentEntry/valueTransformers/entryValueFixtures.d.ts +146 -0
  137. package/features/contentEntry/valueTransformers/entryValueFixtures.js +171 -0
  138. package/features/contentEntry/valueTransformers/entryValueFixtures.js.map +1 -0
  139. package/features/formModel/CmsFormModelBuilder.d.ts +9 -1
  140. package/features/formModel/CmsFormModelBuilder.js +26 -15
  141. package/features/formModel/CmsFormModelBuilder.js.map +1 -1
  142. package/features/formModel/CmsFormModelBuilder.test.d.ts +1 -0
  143. package/features/formModel/CmsFormModelBuilder.test.js +465 -0
  144. package/features/formModel/CmsFormModelBuilder.test.js.map +1 -0
  145. package/features/formModel/CmsLayoutMapper.d.ts +8 -1
  146. package/features/formModel/CmsLayoutMapper.js +27 -5
  147. package/features/formModel/CmsLayoutMapper.js.map +1 -1
  148. package/features/formModel/CmsRefFieldValueFormatter.d.ts +12 -0
  149. package/features/formModel/CmsRefFieldValueFormatter.js +29 -0
  150. package/features/formModel/CmsRefFieldValueFormatter.js.map +1 -0
  151. package/features/formModel/CmsValidationMapper.d.ts +9 -0
  152. package/features/formModel/CmsValidationMapper.js +25 -19
  153. package/features/formModel/CmsValidationMapper.js.map +1 -1
  154. package/features/formModel/feature.js +2 -2
  155. package/features/formModel/feature.js.map +1 -1
  156. package/features/formModel/mappers/DateTimeFieldMapper.js +3 -0
  157. package/features/formModel/mappers/DateTimeFieldMapper.js.map +1 -1
  158. package/features/formModel/mappers/DynamicZoneFieldMapper.js +8 -2
  159. package/features/formModel/mappers/DynamicZoneFieldMapper.js.map +1 -1
  160. package/features/formModel/mappers/ObjectFieldMapper.js +12 -5
  161. package/features/formModel/mappers/ObjectFieldMapper.js.map +1 -1
  162. package/features/formModel/mappers/applyFieldProps.js +2 -1
  163. package/features/formModel/mappers/applyFieldProps.js.map +1 -1
  164. package/features/formModel/mappers/applyFieldProps.test.d.ts +1 -0
  165. package/features/formModel/mappers/applyFieldProps.test.js +59 -0
  166. package/features/formModel/mappers/applyFieldProps.test.js.map +1 -0
  167. package/features/model/deleteModel/DeleteModelGateway.js +6 -1
  168. package/features/model/deleteModel/DeleteModelGateway.js.map +1 -1
  169. package/features/model/deleteModel/DeleteModelGateway.test.d.ts +1 -0
  170. package/features/model/deleteModel/DeleteModelGateway.test.js +71 -0
  171. package/features/model/deleteModel/DeleteModelGateway.test.js.map +1 -0
  172. package/features/model/exportModels/ExportModelsGateway.d.ts +1 -1
  173. package/features/model/exportModels/ExportModelsGateway.js.map +1 -1
  174. package/features/model/exportModels/ExportModelsUseCase.js +7 -1
  175. package/features/model/exportModels/ExportModelsUseCase.js.map +1 -1
  176. package/features/model/exportModels/abstractions.d.ts +8 -2
  177. package/features/model/exportModels/abstractions.js.map +1 -1
  178. package/package.json +30 -28
  179. package/presentation/cloneContentModel/CloneContentModelPresenter.d.ts +1 -0
  180. package/presentation/cloneContentModel/CloneContentModelPresenter.js +8 -6
  181. package/presentation/cloneContentModel/CloneContentModelPresenter.js.map +1 -1
  182. package/presentation/contentEntries/bulkActions/BulkDeletePresenter.d.ts +1 -1
  183. package/presentation/contentEntries/bulkActions/BulkDeletePresenter.js +6 -1
  184. package/presentation/contentEntries/bulkActions/BulkDeletePresenter.js.map +1 -1
  185. package/presentation/contentEntries/bulkActions/BulkDeletePresenter.test.d.ts +1 -0
  186. package/presentation/contentEntries/bulkActions/BulkDeletePresenter.test.js +124 -0
  187. package/presentation/contentEntries/bulkActions/BulkDeletePresenter.test.js.map +1 -0
  188. package/presentation/contentEntries/bulkActions/abstractions.d.ts +1 -1
  189. package/presentation/contentEntries/bulkActions/abstractions.js.map +1 -1
  190. package/presentation/contentEntries/form/ContentEntryFormPresenter.d.ts +2 -0
  191. package/presentation/contentEntries/form/ContentEntryFormPresenter.deleteEntry.test.d.ts +1 -0
  192. package/presentation/contentEntries/form/ContentEntryFormPresenter.deleteEntry.test.js +107 -0
  193. package/presentation/contentEntries/form/ContentEntryFormPresenter.deleteEntry.test.js.map +1 -0
  194. package/presentation/contentEntries/form/ContentEntryFormPresenter.js +47 -30
  195. package/presentation/contentEntries/form/ContentEntryFormPresenter.js.map +1 -1
  196. package/presentation/contentEntries/form/ContentEntryFormPresenter.test.d.ts +1 -0
  197. package/presentation/contentEntries/form/ContentEntryFormPresenter.test.js +244 -0
  198. package/presentation/contentEntries/form/ContentEntryFormPresenter.test.js.map +1 -0
  199. package/presentation/contentEntries/form/abstractions.d.ts +1 -0
  200. package/presentation/contentEntries/form/abstractions.js.map +1 -1
  201. package/presentation/contentEntries/form/getFieldBuilders.test.js +4 -2
  202. package/presentation/contentEntries/form/getFieldBuilders.test.js.map +1 -1
  203. package/presentation/contentEntries/form/toFormErrors.d.ts +7 -0
  204. package/presentation/contentEntries/form/toFormErrors.js +49 -0
  205. package/presentation/contentEntries/form/toFormErrors.js.map +1 -0
  206. package/presentation/contentEntries/form/toFormErrors.test.d.ts +1 -0
  207. package/presentation/contentEntries/form/toFormErrors.test.js +175 -0
  208. package/presentation/contentEntries/form/toFormErrors.test.js.map +1 -0
  209. package/presentation/contentEntries/list/ContentEntriesDataSource.d.ts +5 -0
  210. package/presentation/contentEntries/list/ContentEntriesDataSource.js +16 -4
  211. package/presentation/contentEntries/list/ContentEntriesDataSource.js.map +1 -1
  212. package/presentation/contentEntries/list/ContentEntriesPresenter.d.ts +6 -2
  213. package/presentation/contentEntries/list/ContentEntriesPresenter.js +27 -2
  214. package/presentation/contentEntries/list/ContentEntriesPresenter.js.map +1 -1
  215. package/presentation/contentEntries/list/ContentEntriesPresenter.test.js +130 -5
  216. package/presentation/contentEntries/list/ContentEntriesPresenter.test.js.map +1 -1
  217. package/presentation/contentEntries/list/abstractions.d.ts +12 -0
  218. package/presentation/contentEntries/list/abstractions.js.map +1 -1
  219. package/presentation/contentEntries/preview/ComponentDiscoveryIframe.d.ts +3 -2
  220. package/presentation/contentEntries/preview/ComponentDiscoveryIframe.js +2 -2
  221. package/presentation/contentEntries/preview/ComponentDiscoveryIframe.js.map +1 -1
  222. package/presentation/contentEntries/preview/LivePreviewPresenter.d.ts +12 -1
  223. package/presentation/contentEntries/preview/LivePreviewPresenter.js +48 -5
  224. package/presentation/contentEntries/preview/LivePreviewPresenter.js.map +1 -1
  225. package/presentation/contentEntries/preview/LivePreviewPresenter.test.d.ts +1 -0
  226. package/presentation/contentEntries/preview/LivePreviewPresenter.test.js +81 -0
  227. package/presentation/contentEntries/preview/LivePreviewPresenter.test.js.map +1 -0
  228. package/presentation/contentEntries/preview/ModelEditorComponentDiscovery.js +8 -5
  229. package/presentation/contentEntries/preview/ModelEditorComponentDiscovery.js.map +1 -1
  230. package/presentation/contentEntries/preview/PreviewDecorator.js +30 -10
  231. package/presentation/contentEntries/preview/PreviewDecorator.js.map +1 -1
  232. package/presentation/contentEntries/preview/PreviewDomainStatus.d.ts +10 -0
  233. package/presentation/contentEntries/preview/PreviewDomainStatus.js +19 -0
  234. package/presentation/contentEntries/preview/PreviewDomainStatus.js.map +1 -0
  235. package/presentation/contentEntries/preview/PreviewPane.d.ts +12 -3
  236. package/presentation/contentEntries/preview/PreviewPane.js +82 -46
  237. package/presentation/contentEntries/preview/PreviewPane.js.map +1 -1
  238. package/presentation/contentEntries/preview/abstractions.d.ts +8 -0
  239. package/presentation/contentEntries/preview/abstractions.js.map +1 -1
  240. package/presentation/contentEntries/preview/resolvePreviewUrl.d.ts +23 -2
  241. package/presentation/contentEntries/preview/resolvePreviewUrl.js +62 -10
  242. package/presentation/contentEntries/preview/resolvePreviewUrl.js.map +1 -1
  243. package/presentation/contentEntries/preview/resolvePreviewUrl.test.d.ts +1 -0
  244. package/presentation/contentEntries/preview/resolvePreviewUrl.test.js +127 -0
  245. package/presentation/contentEntries/preview/resolvePreviewUrl.test.js.map +1 -0
  246. package/presentation/contentEntries/revisionsList/RevisionsListPresenter.d.ts +21 -2
  247. package/presentation/contentEntries/revisionsList/RevisionsListPresenter.js +143 -6
  248. package/presentation/contentEntries/revisionsList/RevisionsListPresenter.js.map +1 -1
  249. package/presentation/contentEntries/revisionsList/RevisionsListPresenter.test.d.ts +1 -0
  250. package/presentation/contentEntries/revisionsList/RevisionsListPresenter.test.js +384 -0
  251. package/presentation/contentEntries/revisionsList/RevisionsListPresenter.test.js.map +1 -0
  252. package/presentation/contentEntries/revisionsList/abstractions.d.ts +16 -0
  253. package/presentation/contentEntries/revisionsList/abstractions.js.map +1 -1
  254. package/presentation/contentEntries/singleEntry/SingleEntryPresenter.js +9 -4
  255. package/presentation/contentEntries/singleEntry/SingleEntryPresenter.js.map +1 -1
  256. package/presentation/contentEntries/singleEntry/SingleEntryPresenter.test.d.ts +1 -0
  257. package/presentation/contentEntries/singleEntry/SingleEntryPresenter.test.js +122 -0
  258. package/presentation/contentEntries/singleEntry/SingleEntryPresenter.test.js.map +1 -0
  259. package/presentation/contentEntries/views/ContentEntriesListLayout.js +1 -0
  260. package/presentation/contentEntries/views/ContentEntriesListLayout.js.map +1 -1
  261. package/presentation/contentEntries/views/ContentEntriesView.js +2 -0
  262. package/presentation/contentEntries/views/ContentEntriesView.js.map +1 -1
  263. package/presentation/contentEntries/views/ContentEntryFormView.js +4 -1
  264. package/presentation/contentEntries/views/ContentEntryFormView.js.map +1 -1
  265. package/presentation/contentEntries/views/OlderRevisionAlert.d.ts +4 -0
  266. package/presentation/contentEntries/views/OlderRevisionAlert.js +43 -0
  267. package/presentation/contentEntries/views/OlderRevisionAlert.js.map +1 -0
  268. package/presentation/contentEntries/views/RevisionDrawer.js +4 -0
  269. package/presentation/contentEntries/views/RevisionDrawer.js.map +1 -1
  270. package/presentation/contentEntries/views/RevisionListItem.d.ts +3 -3
  271. package/presentation/contentEntries/views/RevisionListItem.js +82 -14
  272. package/presentation/contentEntries/views/RevisionListItem.js.map +1 -1
  273. package/presentation/contentEntries/views/RevisionsList.js +3 -3
  274. package/presentation/contentEntries/views/RevisionsList.js.map +1 -1
  275. package/presentation/contentEntries/views/actions/CreateNewRevisionButton.js +11 -0
  276. package/presentation/contentEntries/views/actions/CreateNewRevisionButton.js.map +1 -1
  277. package/presentation/contentModels/ContentModelsPresenter.d.ts +5 -5
  278. package/presentation/contentModels/ContentModelsPresenter.js +1 -1
  279. package/presentation/contentModels/ContentModelsPresenter.js.map +1 -1
  280. package/presentation/contentModels/abstractions.d.ts +7 -2
  281. package/presentation/contentModels/abstractions.js.map +1 -1
  282. package/presentation/contentModels/components/ContentModelsDataList.js +6 -5
  283. package/presentation/contentModels/components/ContentModelsDataList.js.map +1 -1
  284. package/presentation/contentModels/components/fullDelete/FullyDeleteModelDialog.js +8 -3
  285. package/presentation/contentModels/components/fullDelete/FullyDeleteModelDialog.js.map +1 -1
  286. package/presentation/contentModels/components/fullDelete/dialog/Content.js +7 -2
  287. package/presentation/contentModels/components/fullDelete/dialog/Content.js.map +1 -1
  288. package/presentation/contentModels/components/fullDelete/dialog/Content.test.d.ts +1 -0
  289. package/presentation/contentModels/components/fullDelete/dialog/Content.test.js +54 -0
  290. package/presentation/contentModels/components/fullDelete/dialog/Content.test.js.map +1 -0
  291. package/presentation/contentModels/components/fullDelete/dialog/FullyDeleteModelError.d.ts +25 -0
  292. package/presentation/contentModels/components/fullDelete/dialog/FullyDeleteModelError.js +9 -0
  293. package/presentation/contentModels/components/fullDelete/dialog/FullyDeleteModelError.js.map +1 -0
  294. package/presentation/fieldEditor/groups/AppearanceGroup.js +12 -0
  295. package/presentation/fieldEditor/groups/AppearanceGroup.js.map +1 -1
  296. package/presentation/fieldEditor/groups/GeneralGroup.d.ts +5 -5
  297. package/presentation/fieldEditor/groups/GeneralGroup.js +5 -1
  298. package/presentation/fieldEditor/groups/GeneralGroup.js.map +1 -1
  299. package/presentation/fieldEditor/groups/GeneralGroup.test.d.ts +1 -0
  300. package/presentation/fieldEditor/groups/GeneralGroup.test.js +68 -0
  301. package/presentation/fieldEditor/groups/GeneralGroup.test.js.map +1 -0
  302. package/presentation/fieldEditor/groups/ValidationsGroup.d.ts +2 -0
  303. package/presentation/fieldEditor/groups/ValidationsGroup.js +20 -6
  304. package/presentation/fieldEditor/groups/ValidationsGroup.js.map +1 -1
  305. package/presentation/fieldEditor/renderers/CmsValidatorsRenderer.js +2 -2
  306. package/presentation/fieldEditor/renderers/CmsValidatorsRenderer.js.map +1 -1
  307. package/presentation/fieldRenderers/feature.js +2 -1
  308. package/presentation/fieldRenderers/feature.js.map +1 -1
  309. package/presentation/fieldRenderers/ref/CmsRefInputRenderer.js +1 -0
  310. package/presentation/fieldRenderers/ref/CmsRefInputRenderer.js.map +1 -1
  311. package/presentation/fieldRenderers/ref/CmsRefInputsRenderer.js +1 -0
  312. package/presentation/fieldRenderers/ref/CmsRefInputsRenderer.js.map +1 -1
  313. package/presentation/fieldRenderers/ref/autocomplete/BaseAutocompletePresenter.d.ts +1 -0
  314. package/presentation/fieldRenderers/ref/autocomplete/BaseAutocompletePresenter.js +8 -2
  315. package/presentation/fieldRenderers/ref/autocomplete/BaseAutocompletePresenter.js.map +1 -1
  316. package/presentation/fieldRenderers/ref/autocomplete/RefAutocompletePresenters.test.d.ts +1 -0
  317. package/presentation/fieldRenderers/ref/autocomplete/RefAutocompletePresenters.test.js +185 -0
  318. package/presentation/fieldRenderers/ref/autocomplete/RefAutocompletePresenters.test.js.map +1 -0
  319. package/presentation/fieldRenderers/ref/autocomplete/multi/RefMultiAutocompletePresenter.js +1 -1
  320. package/presentation/fieldRenderers/ref/autocomplete/multi/RefMultiAutocompletePresenter.js.map +1 -1
  321. package/presentation/fieldRenderers/ref/autocomplete/single/RefSingleAutocompletePresenter.js +1 -1
  322. package/presentation/fieldRenderers/ref/autocomplete/single/RefSingleAutocompletePresenter.js.map +1 -1
  323. package/presentation/fieldRenderers/ref/components/RefFieldOptions.js +3 -2
  324. package/presentation/fieldRenderers/ref/components/RefFieldOptions.js.map +1 -1
  325. package/presentation/fieldTypes/renderers/dateTime/BirthdayInputRenderer.d.ts +15 -0
  326. package/presentation/fieldTypes/renderers/dateTime/BirthdayInputRenderer.js +19 -0
  327. package/presentation/fieldTypes/renderers/dateTime/BirthdayInputRenderer.js.map +1 -0
  328. package/presentation/fieldTypes/renderers/index.d.ts +1 -0
  329. package/presentation/fieldTypes/renderers/index.js +1 -0
  330. package/presentation/fieldValidators/abstractions.d.ts +7 -0
  331. package/presentation/fieldValidators/abstractions.js.map +1 -1
  332. package/presentation/fieldValidators/validators/DateGteValidator.d.ts +6 -0
  333. package/presentation/fieldValidators/validators/DateGteValidator.js +17 -25
  334. package/presentation/fieldValidators/validators/DateGteValidator.js.map +1 -1
  335. package/presentation/fieldValidators/validators/DateLteValidator.d.ts +6 -0
  336. package/presentation/fieldValidators/validators/DateLteValidator.js +17 -25
  337. package/presentation/fieldValidators/validators/DateLteValidator.js.map +1 -1
  338. package/presentation/fieldValidators/validators/dateLimitSettings.d.ts +20 -0
  339. package/presentation/fieldValidators/validators/dateLimitSettings.js +124 -0
  340. package/presentation/fieldValidators/validators/dateLimitSettings.js.map +1 -0
  341. package/presentation/fieldValidators/validators/dateLimitSettings.test.d.ts +1 -0
  342. package/presentation/fieldValidators/validators/dateLimitSettings.test.js +111 -0
  343. package/presentation/fieldValidators/validators/dateLimitSettings.test.js.map +1 -0
  344. package/presentation/importContentModels/ImportContentModelsPresenter.js +1 -1
  345. package/presentation/importContentModels/ImportContentModelsPresenter.js.map +1 -1
  346. package/presentation/importContentModels/components/Model/DataListModelItem.js +3 -3
  347. package/presentation/importContentModels/components/Model/DataListModelItem.js.map +1 -1
  348. package/presentation/importContentModels/components/Model/DataListModelItemInfo.js +2 -2
  349. package/presentation/importContentModels/components/Model/DataListModelItemInfo.js.map +1 -1
  350. package/presentation/modelGroup/ModelGroupPresenter.js +1 -2
  351. package/presentation/modelGroup/ModelGroupPresenter.js.map +1 -1
  352. package/presentation/newContentModel/NewContentModelPresenter.d.ts +1 -0
  353. package/presentation/newContentModel/NewContentModelPresenter.js +8 -6
  354. package/presentation/newContentModel/NewContentModelPresenter.js.map +1 -1
  355. package/utils/normalizeIcon.d.ts +4 -0
  356. package/utils/normalizeIcon.js +9 -6
  357. package/utils/normalizeIcon.js.map +1 -1
  358. package/features/formModel/CmsAccessControlRuleEvaluator.d.ts +0 -9
  359. package/features/formModel/CmsAccessControlRuleEvaluator.js +0 -16
  360. package/features/formModel/CmsAccessControlRuleEvaluator.js.map +0 -1
@@ -72,9 +72,9 @@ const Checkbox = ({ model, toggle, selected })=>{
72
72
  };
73
73
  const Container = ({ model, children })=>{
74
74
  if (model.imported) return /*#__PURE__*/ react.createElement(ContainerImported, null, children);
75
- if ("create" === model.action) return /*#__PURE__*/ react.createElement(ContainerCreate, null, children);
76
- if ("update" === model.action) return /*#__PURE__*/ react.createElement(ContainerUpdate, null, children);
77
- if (model.error) return /*#__PURE__*/ react.createElement(ContainerError, null, children);
75
+ else if ("create" === model.action) return /*#__PURE__*/ react.createElement(ContainerCreate, null, children);
76
+ else if ("update" === model.action) return /*#__PURE__*/ react.createElement(ContainerUpdate, null, children);
77
+ else if (model.error) return /*#__PURE__*/ react.createElement(ContainerError, null, children);
78
78
  return /*#__PURE__*/ react.createElement(ContainerBase, null, children);
79
79
  };
80
80
  const DataListModelItem = ({ model, toggle, selected })=>/*#__PURE__*/ react.createElement(Container, {
@@ -1 +1 @@
1
- {"version":3,"file":"presentation/importContentModels/components/Model/DataListModelItem.js","sources":["../../../../../src/presentation/importContentModels/components/Model/DataListModelItem.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport styled from \"@emotion/styled\";\nimport type { ImportModelData } from \"../../types.js\";\nimport { DataListModelItemError } from \"./DataListModelItemError.js\";\nimport { DataListModelItemInfo } from \"./DataListModelItemInfo.js\";\n\ntype ToggleModelCb = (item: Pick<ImportModelData, \"id\" | \"name\" | \"related\">) => void;\n\nconst ContainerBase = styled(\"div\")(() => {\n return {\n width: \"100%\",\n padding: \"0px 5px 15px 5px\",\n margin: \"0\",\n boxSizing: \"border-box\" as const,\n \"&:last-child\": {\n paddingBottom: \"2px\"\n }\n };\n});\nconst ContainerCreate = styled(ContainerBase)(() => {\n return {\n // backgroundColor: \"var(--mdc-theme-secondary)\"\n };\n});\nconst ContainerImported = styled(ContainerBase)(() => {\n return {};\n});\nconst ContainerUpdate = styled(ContainerBase)(() => {\n return {};\n});\nconst ContainerError = styled(ContainerBase)(() => {\n return {};\n});\n\nconst ModelContainer = styled(\"div\")({\n display: \"flex\",\n width: \"100%\",\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\"\n});\nconst Name = styled(\"h4\")({\n fontSize: \"12px\",\n flex: \"1 0 auto\",\n lineHeight: \"18px\"\n});\nconst CheckboxContainer = styled(\"div\")({\n width: \"120px\",\n textAlign: \"right\",\n verticalAlign: \"middle\"\n});\n\nconst Button = styled(\"button\")({\n padding: \"1px 5px\",\n textAlign: \"right\",\n display: \"inline-block\",\n border: \"1px solid var(--mdc-theme-on-background)\",\n fontSize: \"10px\",\n lineHeight: \"12px\",\n cursor: \"pointer\",\n outline: \"0 none\",\n backgroundColor: \"var(--mdc-theme-background)\",\n \"&.selected\": {\n border: \"1px solid var(--mdc-theme-secondary)\"\n }\n});\n\nconst ImportedText = styled(\"div\")({\n padding: \"1px 5px\",\n textAlign: \"right\",\n display: \"inline-block\",\n border: \"1px solid var(--mdc-theme-on-background)\",\n fontSize: \"10px\",\n lineHeight: \"12px\",\n outline: \"0 none\",\n backgroundColor: \"var(--mdc-theme-secondary)\",\n color: \"#FFF\"\n});\n\nconst Imported = () => {\n return (\n <CheckboxContainer>\n <ImportedText>Imported.</ImportedText>\n </CheckboxContainer>\n );\n};\n\ninterface CheckboxProps {\n model: Pick<ImportModelData, \"id\" | \"name\" | \"error\" | \"related\">;\n toggle: ToggleModelCb;\n selected: boolean;\n}\n\nconst Checkbox = ({ model, toggle, selected }: CheckboxProps) => {\n const onClick = useCallback(() => {\n toggle(model);\n }, [toggle]);\n if (model.error) {\n return null;\n }\n return (\n <CheckboxContainer>\n <Button onClick={onClick} className={selected ? \"selected\" : \"\"}>\n {selected ? \"Model will be imported\" : \"Model will be skipped\"}\n </Button>\n </CheckboxContainer>\n );\n};\n\ninterface ContainerProps {\n model: Pick<ImportModelData, \"action\" | \"error\" | \"imported\">;\n children: React.ReactNode;\n}\n\nconst Container = ({ model, children }: ContainerProps) => {\n if (model.imported) {\n return <ContainerImported>{children}</ContainerImported>;\n } else if (model.action === \"create\") {\n return <ContainerCreate>{children}</ContainerCreate>;\n } else if (model.action === \"update\") {\n return <ContainerUpdate>{children}</ContainerUpdate>;\n } else if (model.error) {\n return <ContainerError>{children}</ContainerError>;\n }\n return <ContainerBase>{children}</ContainerBase>;\n};\n\ninterface DataListModelItemProps {\n model: ImportModelData;\n toggle: ToggleModelCb;\n selected: boolean;\n}\n\nexport const DataListModelItem = ({ model, toggle, selected }: DataListModelItemProps) => {\n return (\n <Container model={model}>\n <ModelContainer>\n <div>\n <Name>{model.name || model.id}</Name>\n {model.error ? (\n <DataListModelItemError error={model.error} />\n ) : (\n <DataListModelItemInfo model={model} />\n )}\n </div>\n {model.imported ? (\n <Imported />\n ) : (\n <Checkbox model={model} toggle={toggle} selected={selected} />\n )}\n </ModelContainer>\n </Container>\n );\n};\n"],"names":["ContainerBase","styled","ContainerCreate","ContainerImported","ContainerUpdate","ContainerError","ModelContainer","Name","CheckboxContainer","Button","ImportedText","Imported","Checkbox","model","toggle","selected","onClick","useCallback","Container","children","DataListModelItem","DataListModelItemError","DataListModelItemInfo"],"mappings":";;;;AAQA,MAAMA,gBAAgBC,OAAO,OAAO,IACzB;QACH,OAAO;QACP,SAAS;QACT,QAAQ;QACR,WAAW;QACX,gBAAgB;YACZ,eAAe;QACnB;IACJ;AAEJ,MAAMC,kBAAkBD,OAAOD,eAAe,IACnC,EAEP;AAEJ,MAAMG,oBAAoBF,OAAOD,eAAe,IACrC,EAAC;AAEZ,MAAMI,kBAAkBH,OAAOD,eAAe,IACnC,EAAC;AAEZ,MAAMK,iBAAiBJ,OAAOD,eAAe,IAClC,EAAC;AAGZ,MAAMM,iBAAiBL,OAAO,OAAO;IACjC,SAAS;IACT,OAAO;IACP,eAAe;IACf,YAAY;IACZ,gBAAgB;A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ACR,gBAAcA,MAAEc;IAE5B,OAAO,WAAP,GAAO,oBAACnB,eAAaA,MAAEmB;AAC3B;AAQO,MAAMC,oBAAoB,CAAC,EAAEP,KAAK,EAAEC,MAAM,EAAEC,QAAQ,EAA0B,GAC1E,WAAP,GACI,oBAACG,WAASA;QAAC,OAAOL;qBACd,oBAACP,gBAAcA,MAAAA,WAAAA,GACX,oBAAC,2BACG,oBAACC,MAAIA,MAAEM,MAAM,IAAI,IAAIA,MAAM,EAAE,GAC5BA,MAAM,KAAK,GAAG,WAAH,GACR,oBAACQ,wBAAsBA;QAAC,OAAOR,MAAM,KAAK;uBAE1C,oBAACS,uBAAqBA;QAAC,OAAOT;SAGrCA,MAAM,QAAQ,GAAG,WAAH,GACX,oBAACF,UAAQA,QAAAA,WAAAA,GAET,oBAACC,UAAQA;QAAC,OAAOC;QAAO,QAAQC;QAAQ,UAAUC"}
1
+ {"version":3,"file":"presentation/importContentModels/components/Model/DataListModelItem.js","sources":["../../../../../src/presentation/importContentModels/components/Model/DataListModelItem.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport styled from \"@emotion/styled\";\nimport type { ImportModelData } from \"../../types.js\";\nimport { DataListModelItemError } from \"./DataListModelItemError.js\";\nimport { DataListModelItemInfo } from \"./DataListModelItemInfo.js\";\n\ntype ToggleModelCb = (item: Pick<ImportModelData, \"id\" | \"name\" | \"related\">) => void;\n\nconst ContainerBase = styled(\"div\")(() => {\n return {\n width: \"100%\",\n padding: \"0px 5px 15px 5px\",\n margin: \"0\",\n boxSizing: \"border-box\" as const,\n \"&:last-child\": {\n paddingBottom: \"2px\"\n }\n };\n});\nconst ContainerCreate = styled(ContainerBase)(() => {\n return {\n // backgroundColor: \"var(--mdc-theme-secondary)\"\n };\n});\nconst ContainerImported = styled(ContainerBase)(() => {\n return {};\n});\nconst ContainerUpdate = styled(ContainerBase)(() => {\n return {};\n});\nconst ContainerError = styled(ContainerBase)(() => {\n return {};\n});\n\nconst ModelContainer = styled(\"div\")({\n display: \"flex\",\n width: \"100%\",\n flexDirection: \"row\",\n alignItems: \"center\",\n justifyContent: \"space-between\"\n});\nconst Name = styled(\"h4\")({\n fontSize: \"12px\",\n flex: \"1 0 auto\",\n lineHeight: \"18px\"\n});\nconst CheckboxContainer = styled(\"div\")({\n width: \"120px\",\n textAlign: \"right\",\n verticalAlign: \"middle\"\n});\n\nconst Button = styled(\"button\")({\n padding: \"1px 5px\",\n textAlign: \"right\",\n display: \"inline-block\",\n border: \"1px solid var(--mdc-theme-on-background)\",\n fontSize: \"10px\",\n lineHeight: \"12px\",\n cursor: \"pointer\",\n outline: \"0 none\",\n backgroundColor: \"var(--mdc-theme-background)\",\n \"&.selected\": {\n border: \"1px solid var(--mdc-theme-secondary)\"\n }\n});\n\nconst ImportedText = styled(\"div\")({\n padding: \"1px 5px\",\n textAlign: \"right\",\n display: \"inline-block\",\n border: \"1px solid var(--mdc-theme-on-background)\",\n fontSize: \"10px\",\n lineHeight: \"12px\",\n outline: \"0 none\",\n backgroundColor: \"var(--mdc-theme-secondary)\",\n color: \"#FFF\"\n});\n\nconst Imported = () => {\n return (\n <CheckboxContainer>\n <ImportedText>Imported.</ImportedText>\n </CheckboxContainer>\n );\n};\n\ninterface CheckboxProps {\n model: Pick<ImportModelData, \"id\" | \"name\" | \"error\" | \"related\">;\n toggle: ToggleModelCb;\n selected: boolean;\n}\n\nconst Checkbox = ({ model, toggle, selected }: CheckboxProps) => {\n const onClick = useCallback(() => {\n toggle(model);\n }, [toggle]);\n if (model.error) {\n return null;\n }\n return (\n <CheckboxContainer>\n <Button onClick={onClick} className={selected ? \"selected\" : \"\"}>\n {selected ? \"Model will be imported\" : \"Model will be skipped\"}\n </Button>\n </CheckboxContainer>\n );\n};\n\ninterface ContainerProps {\n model: Pick<ImportModelData, \"action\" | \"error\" | \"imported\">;\n children: React.ReactNode;\n}\n\nconst Container = ({ model, children }: ContainerProps) => {\n if (model.imported) {\n return <ContainerImported>{children}</ContainerImported>;\n } else if (model.action === \"create\") {\n return <ContainerCreate>{children}</ContainerCreate>;\n } else if (model.action === \"update\") {\n return <ContainerUpdate>{children}</ContainerUpdate>;\n } else if (model.error) {\n return <ContainerError>{children}</ContainerError>;\n }\n return <ContainerBase>{children}</ContainerBase>;\n};\n\ninterface DataListModelItemProps {\n model: ImportModelData;\n toggle: ToggleModelCb;\n selected: boolean;\n}\n\nexport const DataListModelItem = ({ model, toggle, selected }: DataListModelItemProps) => {\n return (\n <Container model={model}>\n <ModelContainer>\n <div>\n <Name>{model.name || model.id}</Name>\n {model.error ? (\n <DataListModelItemError error={model.error} />\n ) : (\n <DataListModelItemInfo model={model} />\n )}\n </div>\n {model.imported ? (\n <Imported />\n ) : (\n <Checkbox model={model} toggle={toggle} selected={selected} />\n )}\n </ModelContainer>\n </Container>\n );\n};\n"],"names":["ContainerBase","styled","ContainerCreate","ContainerImported","ContainerUpdate","ContainerError","ModelContainer","Name","CheckboxContainer","Button","ImportedText","Imported","Checkbox","model","toggle","selected","onClick","useCallback","Container","children","DataListModelItem","DataListModelItemError","DataListModelItemInfo"],"mappings":";;;;AAQA,MAAMA,gBAAgBC,OAAO,OAAO,IACzB;QACH,OAAO;QACP,SAAS;QACT,QAAQ;QACR,WAAW;QACX,gBAAgB;YACZ,eAAe;QACnB;IACJ;AAEJ,MAAMC,kBAAkBD,OAAOD,eAAe,IACnC,EAEP;AAEJ,MAAMG,oBAAoBF,OAAOD,eAAe,IACrC,EAAC;AAEZ,MAAMI,kBAAkBH,OAAOD,eAAe,IACnC,EAAC;AAEZ,MAAMK,iBAAiBJ,OAAOD,eAAe,IAClC,EAAC;AAGZ,MAAMM,iBAAiBL,OAAO,OAAO;IACjC,SAAS;IACT,OAAO;IACP,eAAe;IACf,YAAY;IACZ,gBAAgB;AACpB;AACA,MAAMM,OAAON,OAAO,MAAM;IACtB,UAAU;IACV,MAAM;IACN,YAAY;AAChB;AACA,MAAMO,oBAAoBP,OAAO,OAAO;IACpC,OAAO;IACP,WAAW;IACX,eAAe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Q,EAA0B,GAC1E,WAAP,GACI,oBAACG,WAASA;QAAC,OAAOL;qBACd,oBAACP,gBAAcA,MAAAA,WAAAA,GACX,oBAAC,2BACG,oBAACC,MAAIA,MAAEM,MAAM,IAAI,IAAIA,MAAM,EAAE,GAC5BA,MAAM,KAAK,GAAG,WAAH,GACR,oBAACQ,wBAAsBA;QAAC,OAAOR,MAAM,KAAK;uBAE1C,oBAACS,uBAAqBA;QAAC,OAAOT;SAGrCA,MAAM,QAAQ,GAAG,WAAH,GACX,oBAACF,UAAQA,QAAAA,WAAAA,GAET,oBAACC,UAAQA;QAAC,OAAOC;QAAO,QAAQC;QAAQ,UAAUC"}
@@ -9,8 +9,8 @@ const Text = styled("p")({
9
9
  });
10
10
  const getText = (action)=>{
11
11
  if ("create" === action) return "Model will be created.";
12
- if ("update" === action) return "Model will be updated.";
13
- if ("code" === action) return "Model cannot be updated because it was created via code.";
12
+ else if ("update" === action) return "Model will be updated.";
13
+ else if ("code" === action) return "Model cannot be updated because it was created via code.";
14
14
  return `Unknown action: ${action}`;
15
15
  };
16
16
  const DataListModelItemInfo = ({ model })=>{
@@ -1 +1 @@
1
- {"version":3,"file":"presentation/importContentModels/components/Model/DataListModelItemInfo.js","sources":["../../../../../src/presentation/importContentModels/components/Model/DataListModelItemInfo.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"@emotion/styled\";\nimport type { ImportModelData } from \"../../types.js\";\n\nconst Text = styled(\"p\")({\n fontSize: \"9px\",\n lineHeight: \"10px\",\n display: \"block\",\n padding: \"0\",\n margin: \"0\"\n});\n\nconst getText = (action?: string | null) => {\n if (action === \"create\") {\n return `Model will be created.`;\n } else if (action === \"update\") {\n return `Model will be updated.`;\n } else if (action === \"code\") {\n return \"Model cannot be updated because it was created via code.\";\n }\n return `Unknown action: ${action}`;\n};\n\ninterface DataListModelItemInfoProps {\n model: ImportModelData;\n}\n\nexport const DataListModelItemInfo = ({ model }: DataListModelItemInfoProps) => {\n const { action } = model;\n\n return <Text>{getText(action)}</Text>;\n};\n"],"names":["Text","styled","getText","action","DataListModelItemInfo","model"],"mappings":";;AAIA,MAAMA,OAAOC,OAAO,KAAK;IACrB,UAAU;IACV,YAAY;IACZ,SAAS;IACT,SAAS;IACT,QAAQ;AACZ;AAEA,MAAMC,UAAU,CAACC;IACb,IAAIA,AAAW,aAAXA,QACA,OAAO;IACJ,IAAIA,AAAW,aAAXA,QACP,OAAO;IACJ,IAAIA,AAAW,WAAXA,QACP,OAAO;IAEX,OAAO,CAAC,gBAAgB,EAAEA,QAAQ;AACtC;AAMO,MAAMC,wBAAwB,CAAC,EAAEC,KAAK,EAA8B;IACvE,MAAM,EAAEF,MAAM,EAAE,GAAGE;IAEnB,OAAO,WAAP,GAAO,oBAACL,MAAIA,MAAEE,QAAQC;AAC1B"}
1
+ {"version":3,"file":"presentation/importContentModels/components/Model/DataListModelItemInfo.js","sources":["../../../../../src/presentation/importContentModels/components/Model/DataListModelItemInfo.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"@emotion/styled\";\nimport type { ImportModelData } from \"../../types.js\";\n\nconst Text = styled(\"p\")({\n fontSize: \"9px\",\n lineHeight: \"10px\",\n display: \"block\",\n padding: \"0\",\n margin: \"0\"\n});\n\nconst getText = (action?: string | null) => {\n if (action === \"create\") {\n return `Model will be created.`;\n } else if (action === \"update\") {\n return `Model will be updated.`;\n } else if (action === \"code\") {\n return \"Model cannot be updated because it was created via code.\";\n }\n return `Unknown action: ${action}`;\n};\n\ninterface DataListModelItemInfoProps {\n model: ImportModelData;\n}\n\nexport const DataListModelItemInfo = ({ model }: DataListModelItemInfoProps) => {\n const { action } = model;\n\n return <Text>{getText(action)}</Text>;\n};\n"],"names":["Text","styled","getText","action","DataListModelItemInfo","model"],"mappings":";;AAIA,MAAMA,OAAOC,OAAO,KAAK;IACrB,UAAU;IACV,YAAY;IACZ,SAAS;IACT,SAAS;IACT,QAAQ;AACZ;AAEA,MAAMC,UAAU,CAACC;IACb,IAAIA,AAAW,aAAXA,QACA,OAAO;SACJ,IAAIA,AAAW,aAAXA,QACP,OAAO;SACJ,IAAIA,AAAW,WAAXA,QACP,OAAO;IAEX,OAAO,CAAC,gBAAgB,EAAEA,QAAQ;AACtC;AAMO,MAAMC,wBAAwB,CAAC,EAAEC,KAAK,EAA8B;IACvE,MAAM,EAAEF,MAAM,EAAE,GAAGE;IAEnB,OAAO,WAAP,GAAO,oBAACL,MAAIA,MAAEE,QAAQC;AAC1B"}
@@ -135,8 +135,7 @@ class ModelGroupPresenterImpl {
135
135
  this.selectedGroup = group;
136
136
  });
137
137
  return group;
138
- }
139
- {
138
+ } else {
140
139
  const group = await this.createModelGroupUseCase.execute({
141
140
  name: data.name,
142
141
  slug: data.slug,
@@ -1 +1 @@
1
- {"version":3,"file":"presentation/modelGroup/ModelGroupPresenter.js","sources":["../../../src/presentation/modelGroup/ModelGroupPresenter.ts"],"sourcesContent":["import { makeAutoObservable, runInAction, computed } from \"mobx\";\nimport { StringFormatter } from \"@webiny/app-admin/features/stringFormatter/abstractions.js\";\nimport { ListPresenter } from \"@webiny/app-admin/presentation/listPresenter/abstractions.js\";\nimport { FormModelFactory } from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport type { IFormModel } from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport type { ModelGroupDto } from \"~/features/modelGroup/listModelGroups/abstractions.js\";\nimport { ListModelGroupsUseCase } from \"~/features/modelGroup/listModelGroups/abstractions.js\";\nimport { GetModelGroupUseCase } from \"~/features/modelGroup/getModelGroup/abstractions.js\";\nimport { CreateModelGroupUseCase } from \"~/features/modelGroup/createModelGroup/abstractions.js\";\nimport { UpdateModelGroupUseCase } from \"~/features/modelGroup/updateModelGroup/abstractions.js\";\nimport { DeleteModelGroupUseCase } from \"~/features/modelGroup/deleteModelGroup/abstractions.js\";\nimport { ModelGroupsCache } from \"~/features/modelGroup/abstractions.js\";\nimport {\n ModelGroupPresenter as Abstraction,\n type IModelGroupPresenter,\n type IModelGroupPresenterViewModel\n} from \"./abstractions.js\";\nimport { ModelGroupDataSource } from \"./ModelGroupDataSource.js\";\n\nfunction extractIconName(icon: unknown): string {\n if (icon !== null && typeof icon === \"object\" && \"name\" in icon) {\n return (icon as { name: string }).name;\n }\n if (typeof icon === \"string\") {\n return icon;\n }\n return \"\";\n}\n\nfunction toIconValue(name: string): { type: string; name: string } {\n return { type: \"icon\", name };\n}\n\nclass ModelGroupPresenterImpl implements IModelGroupPresenter {\n private selectedGroup: ModelGroupDto | null = null;\n private loading = false;\n private saving = false;\n private showForm = false;\n private form: IFormModel;\n\n constructor(\n private listPresenter: ListPresenter.Interface<ModelGroupDto>,\n private formModelFactory: FormModelFactory.Interface,\n private listModelGroupsUseCase: ListModelGroupsUseCase.Interface,\n private getRoleUseCase: GetModelGroupUseCase.Interface,\n private createModelGroupUseCase: CreateModelGroupUseCase.Interface,\n private updateModelGroupUseCase: UpdateModelGroupUseCase.Interface,\n private deleteModelGroupUseCase: DeleteModelGroupUseCase.Interface,\n private cache: ModelGroupsCache.Interface,\n private stringFormatter: StringFormatter.Interface\n ) {\n this.form = this.buildForm(false, false);\n makeAutoObservable<\n ModelGroupPresenterImpl,\n | \"formModelFactory\"\n | \"listModelGroupsUseCase\"\n | \"getRoleUseCase\"\n | \"createModelGroupUseCase\"\n | \"updateModelGroupUseCase\"\n | \"deleteModelGroupUseCase\"\n | \"cache\"\n | \"stringFormatter\"\n >(this, {\n formModelFactory: false,\n listModelGroupsUseCase: false,\n getRoleUseCase: false,\n createModelGroupUseCase: false,\n updateModelGroupUseCase: false,\n deleteModelGroupUseCase: false,\n cache: false,\n stringFormatter: false,\n vm: computed\n });\n }\n\n get vm(): IModelGroupPresenterViewModel {\n const group = this.selectedGroup;\n const isPluginGroup = group !== null && (group.plugin ?? false);\n\n return {\n selectedGroup: this.selectedGroup,\n loading: this.loading,\n saving: this.saving,\n showForm: this.showForm,\n canModify: !isPluginGroup,\n isPluginGroup,\n form: this.form.vm\n };\n }\n\n get list(): ListPresenter.Interface<ModelGroupDto> {\n return this.listPresenter;\n }\n\n init(): void {\n const dataSource = new ModelGroupDataSource(this.listModelGroupsUseCase, this.cache);\n\n this.listPresenter.init({\n dataSource,\n initialSort: { field: \"createdOn\", direction: \"DESC\" },\n limit: 1000\n });\n }\n\n async selectGroup(id: string): Promise<void> {\n runInAction(() => {\n this.loading = true;\n this.showForm = true;\n });\n\n try {\n const group = await this.getRoleUseCase.execute(id);\n const isPluginGroup = group.plugin ?? false;\n const canModify = !isPluginGroup;\n\n runInAction(() => {\n this.selectedGroup = group;\n this.form = this.buildForm(false, canModify);\n this.form.setData({\n name: group.name,\n slug: group.slug,\n description: group.description,\n icon: extractIconName(group.icon)\n });\n });\n } finally {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n createNew(): void {\n this.selectedGroup = null;\n this.form = this.buildForm(true, true);\n this.form.setData({ icon: \"fas/star\", description: \"\" });\n this.showForm = true;\n }\n\n deselect(): void {\n this.selectedGroup = null;\n this.showForm = false;\n }\n\n async save(): Promise<ModelGroupDto | null> {\n const data = await this.form.submit<ModelGroupDto>();\n if (!data) {\n return null;\n }\n\n runInAction(() => {\n this.saving = true;\n });\n\n try {\n const isUpdate = this.selectedGroup !== null && this.selectedGroup.createdOn;\n\n const iconValue = toIconValue(data.icon as unknown as string);\n\n if (isUpdate) {\n const group = await this.updateModelGroupUseCase.execute({\n id: this.selectedGroup!.id,\n name: data.name as unknown as string,\n slug: this.selectedGroup!.slug,\n description: data.description as unknown as string,\n icon: iconValue as unknown as string\n });\n runInAction(() => {\n this.selectedGroup = group;\n });\n return group;\n } else {\n const group = await this.createModelGroupUseCase.execute({\n name: data.name as unknown as string,\n slug: data.slug as unknown as string,\n description: data.description as unknown as string,\n icon: iconValue as unknown as string\n });\n runInAction(() => {\n this.selectedGroup = group;\n this.form = this.buildForm(false, true);\n this.form.setData({\n name: group.name,\n slug: group.slug,\n description: group.description,\n icon: extractIconName(group.icon)\n });\n });\n return group;\n }\n } catch {\n return null;\n } finally {\n runInAction(() => {\n this.saving = false;\n });\n }\n }\n\n async deleteGroup(id: string): Promise<void> {\n await this.deleteModelGroupUseCase.execute(id);\n\n runInAction(() => {\n if (this.selectedGroup !== null && this.selectedGroup.id === id) {\n this.selectedGroup = null;\n this.showForm = false;\n }\n });\n }\n\n private buildForm(isNew: boolean, canModify: boolean): IFormModel {\n return this.formModelFactory.create({\n fields: fields => ({\n name: fields\n .text()\n .label(\"Name\")\n .required(\"Name is required.\")\n .disabled(!canModify)\n .onBlur((value, { form }) => {\n const slugValue = form.field(\"slug\").getValue();\n if (slugValue || !value) {\n return;\n }\n form.field(\"slug\").setValue(this.stringFormatter.slugify(String(value)));\n }),\n slug: fields\n .text()\n .label(\"Slug\")\n .required(\"Slug is required.\")\n .disabled(!isNew || !canModify),\n icon: fields\n .text()\n .label(\"Group icon\")\n .required(\"Icon is required.\")\n .disabled(!canModify)\n .renderer(\"cmsIconPicker\"),\n description: fields\n .text()\n .label(\"Description\")\n .defaultValue(\"\")\n .renderer(\"textarea\")\n .disabled(!canModify)\n }),\n layout: layout => [\n layout.row(\"name\"),\n layout.row(\"slug\"),\n layout.row(\"icon\"),\n layout.row(\"description\")\n ]\n });\n }\n}\n\nexport const ModelGroupPresenter = Abstraction.createImplementation({\n implementation: ModelGroupPresenterImpl,\n dependencies: [\n ListPresenter,\n FormModelFactory,\n ListModelGroupsUseCase,\n GetModelGroupUseCase,\n CreateModelGroupUseCase,\n UpdateModelGroupUseCase,\n DeleteModelGroupUseCase,\n ModelGroupsCache,\n StringFormatter\n ]\n});\n"],"names":["extractIconName","icon","toIconValue","name","ModelGroupPresenterImpl","listPresenter","formModelFactory","listModelGroupsUseCase","getRoleUseCase","createModelGroupUseCase","updateModelGroupUseCase","deleteModelGroupUseCase","cache","stringFormatter","makeAutoObservable","computed","group","isPluginGroup","dataSource","ModelGroupDataSource","id","runInAction","canModify","data","isUpdate","iconValue","isNew","fields","value","form","slugValue","String","layout","ModelGroupPresenter","Abstraction","ListPresenter","FormModelFactory","ListModelGroupsUseCase","GetModelGroupUseCase","CreateModelGroupUseCase","UpdateModelGroupUseCase","DeleteModelGroupUseCase","ModelGroupsCache","StringFormatter"],"mappings":";;;;;;;;;;;;AAmBA,SAASA,gBAAgBC,IAAa;IAClC,IAAIA,AAAS,SAATA,QAAiB,AAAgB,YAAhB,OAAOA,QAAqB,UAAUA,MACvD,OAAQA,KAA0B,IAAI;IAE1C,IAAI,AAAgB,YAAhB,OAAOA,MACP,OAAOA;IAEX,OAAO;AACX;AAEA,SAASC,YAAYC,IAAY;IAC7B,OAAO;QAAE,MAAM;QAAQA;IAAK;AAChC;AAEA,MAAMC;IAOF,YACYC,aAAqD,EACrDC,gBAA4C,EAC5CC,sBAAwD,EACxDC,cAA8C,EAC9CC,uBAA0D,EAC1DC,uBAA0D,EAC1DC,uBAA0D,EAC1DC,KAAiC,EACjCC,eAA0C,CACpD;aATUR,aAAa,GAAbA;aACAC,gBAAgB,GAAhBA;aACAC,sBAAsB,GAAtBA;aACAC,cAAc,GAAdA;aACAC,uBAAuB,GAAvBA;aACAC,uBAAuB,GAAvBA;aACAC,uBAAuB,GAAvBA;aACAC,KAAK,GAALA;aACAC,eAAe,GAAfA;aAfJ,aAAa,GAAyB;aACtC,OAAO,GAAG;aACV,MAAM,GAAG;aACT,QAAQ,GAAG;QAcf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO;QAClCC,mBAUE,IAAI,EAAE;YACJ,kBAAkB;YAClB,wBAAwB;YACxB,gBAAgB;YAChB,yBAAyB;YACzB,yBAAyB;YACzB,yBAAyB;YACzB,OAAO;YACP,iBAAiB;YACjB,IAAIC;QACR;IACJ;IAEA,IAAI,KAAoC;QACpC,MAAMC,QAAQ,IAAI,CAAC,aAAa;QAChC,MAAMC,gBAAgBD,AAAU,SAAVA,SAAmBA,CAAAA,MAAM,MAAM,IAAI,KAAI;QAE7D,OAAO;YACH,eAAe,IAAI,CAAC,aAAa;YACjC,SAAS,IAAI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,oBAAgC,CAAC;IAChE,gBAAgB9B;IAChB,cAAc;QACV+B;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
1
+ {"version":3,"file":"presentation/modelGroup/ModelGroupPresenter.js","sources":["../../../src/presentation/modelGroup/ModelGroupPresenter.ts"],"sourcesContent":["import { makeAutoObservable, runInAction, computed } from \"mobx\";\nimport { StringFormatter } from \"@webiny/app-admin/features/stringFormatter/abstractions.js\";\nimport { ListPresenter } from \"@webiny/app-admin/presentation/listPresenter/abstractions.js\";\nimport { FormModelFactory } from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport type { IFormModel } from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport type { ModelGroupDto } from \"~/features/modelGroup/listModelGroups/abstractions.js\";\nimport { ListModelGroupsUseCase } from \"~/features/modelGroup/listModelGroups/abstractions.js\";\nimport { GetModelGroupUseCase } from \"~/features/modelGroup/getModelGroup/abstractions.js\";\nimport { CreateModelGroupUseCase } from \"~/features/modelGroup/createModelGroup/abstractions.js\";\nimport { UpdateModelGroupUseCase } from \"~/features/modelGroup/updateModelGroup/abstractions.js\";\nimport { DeleteModelGroupUseCase } from \"~/features/modelGroup/deleteModelGroup/abstractions.js\";\nimport { ModelGroupsCache } from \"~/features/modelGroup/abstractions.js\";\nimport {\n ModelGroupPresenter as Abstraction,\n type IModelGroupPresenter,\n type IModelGroupPresenterViewModel\n} from \"./abstractions.js\";\nimport { ModelGroupDataSource } from \"./ModelGroupDataSource.js\";\n\nfunction extractIconName(icon: unknown): string {\n if (icon !== null && typeof icon === \"object\" && \"name\" in icon) {\n return (icon as { name: string }).name;\n }\n if (typeof icon === \"string\") {\n return icon;\n }\n return \"\";\n}\n\nfunction toIconValue(name: string): { type: string; name: string } {\n return { type: \"icon\", name };\n}\n\nclass ModelGroupPresenterImpl implements IModelGroupPresenter {\n private selectedGroup: ModelGroupDto | null = null;\n private loading = false;\n private saving = false;\n private showForm = false;\n private form: IFormModel;\n\n constructor(\n private listPresenter: ListPresenter.Interface<ModelGroupDto>,\n private formModelFactory: FormModelFactory.Interface,\n private listModelGroupsUseCase: ListModelGroupsUseCase.Interface,\n private getRoleUseCase: GetModelGroupUseCase.Interface,\n private createModelGroupUseCase: CreateModelGroupUseCase.Interface,\n private updateModelGroupUseCase: UpdateModelGroupUseCase.Interface,\n private deleteModelGroupUseCase: DeleteModelGroupUseCase.Interface,\n private cache: ModelGroupsCache.Interface,\n private stringFormatter: StringFormatter.Interface\n ) {\n this.form = this.buildForm(false, false);\n makeAutoObservable<\n ModelGroupPresenterImpl,\n | \"formModelFactory\"\n | \"listModelGroupsUseCase\"\n | \"getRoleUseCase\"\n | \"createModelGroupUseCase\"\n | \"updateModelGroupUseCase\"\n | \"deleteModelGroupUseCase\"\n | \"cache\"\n | \"stringFormatter\"\n >(this, {\n formModelFactory: false,\n listModelGroupsUseCase: false,\n getRoleUseCase: false,\n createModelGroupUseCase: false,\n updateModelGroupUseCase: false,\n deleteModelGroupUseCase: false,\n cache: false,\n stringFormatter: false,\n vm: computed\n });\n }\n\n get vm(): IModelGroupPresenterViewModel {\n const group = this.selectedGroup;\n const isPluginGroup = group !== null && (group.plugin ?? false);\n\n return {\n selectedGroup: this.selectedGroup,\n loading: this.loading,\n saving: this.saving,\n showForm: this.showForm,\n canModify: !isPluginGroup,\n isPluginGroup,\n form: this.form.vm\n };\n }\n\n get list(): ListPresenter.Interface<ModelGroupDto> {\n return this.listPresenter;\n }\n\n init(): void {\n const dataSource = new ModelGroupDataSource(this.listModelGroupsUseCase, this.cache);\n\n this.listPresenter.init({\n dataSource,\n initialSort: { field: \"createdOn\", direction: \"DESC\" },\n limit: 1000\n });\n }\n\n async selectGroup(id: string): Promise<void> {\n runInAction(() => {\n this.loading = true;\n this.showForm = true;\n });\n\n try {\n const group = await this.getRoleUseCase.execute(id);\n const isPluginGroup = group.plugin ?? false;\n const canModify = !isPluginGroup;\n\n runInAction(() => {\n this.selectedGroup = group;\n this.form = this.buildForm(false, canModify);\n this.form.setData({\n name: group.name,\n slug: group.slug,\n description: group.description,\n icon: extractIconName(group.icon)\n });\n });\n } finally {\n runInAction(() => {\n this.loading = false;\n });\n }\n }\n\n createNew(): void {\n this.selectedGroup = null;\n this.form = this.buildForm(true, true);\n this.form.setData({ icon: \"fas/star\", description: \"\" });\n this.showForm = true;\n }\n\n deselect(): void {\n this.selectedGroup = null;\n this.showForm = false;\n }\n\n async save(): Promise<ModelGroupDto | null> {\n const data = await this.form.submit<ModelGroupDto>();\n if (!data) {\n return null;\n }\n\n runInAction(() => {\n this.saving = true;\n });\n\n try {\n const isUpdate = this.selectedGroup !== null && this.selectedGroup.createdOn;\n\n const iconValue = toIconValue(data.icon as unknown as string);\n\n if (isUpdate) {\n const group = await this.updateModelGroupUseCase.execute({\n id: this.selectedGroup!.id,\n name: data.name as unknown as string,\n slug: this.selectedGroup!.slug,\n description: data.description as unknown as string,\n icon: iconValue as unknown as string\n });\n runInAction(() => {\n this.selectedGroup = group;\n });\n return group;\n } else {\n const group = await this.createModelGroupUseCase.execute({\n name: data.name as unknown as string,\n slug: data.slug as unknown as string,\n description: data.description as unknown as string,\n icon: iconValue as unknown as string\n });\n runInAction(() => {\n this.selectedGroup = group;\n this.form = this.buildForm(false, true);\n this.form.setData({\n name: group.name,\n slug: group.slug,\n description: group.description,\n icon: extractIconName(group.icon)\n });\n });\n return group;\n }\n } catch {\n return null;\n } finally {\n runInAction(() => {\n this.saving = false;\n });\n }\n }\n\n async deleteGroup(id: string): Promise<void> {\n await this.deleteModelGroupUseCase.execute(id);\n\n runInAction(() => {\n if (this.selectedGroup !== null && this.selectedGroup.id === id) {\n this.selectedGroup = null;\n this.showForm = false;\n }\n });\n }\n\n private buildForm(isNew: boolean, canModify: boolean): IFormModel {\n return this.formModelFactory.create({\n fields: fields => ({\n name: fields\n .text()\n .label(\"Name\")\n .required(\"Name is required.\")\n .disabled(!canModify)\n .onBlur((value, { form }) => {\n const slugValue = form.field(\"slug\").getValue();\n if (slugValue || !value) {\n return;\n }\n form.field(\"slug\").setValue(this.stringFormatter.slugify(String(value)));\n }),\n slug: fields\n .text()\n .label(\"Slug\")\n .required(\"Slug is required.\")\n .disabled(!isNew || !canModify),\n icon: fields\n .text()\n .label(\"Group icon\")\n .required(\"Icon is required.\")\n .disabled(!canModify)\n .renderer(\"cmsIconPicker\"),\n description: fields\n .text()\n .label(\"Description\")\n .defaultValue(\"\")\n .renderer(\"textarea\")\n .disabled(!canModify)\n }),\n layout: layout => [\n layout.row(\"name\"),\n layout.row(\"slug\"),\n layout.row(\"icon\"),\n layout.row(\"description\")\n ]\n });\n }\n}\n\nexport const ModelGroupPresenter = Abstraction.createImplementation({\n implementation: ModelGroupPresenterImpl,\n dependencies: [\n ListPresenter,\n FormModelFactory,\n ListModelGroupsUseCase,\n GetModelGroupUseCase,\n CreateModelGroupUseCase,\n UpdateModelGroupUseCase,\n DeleteModelGroupUseCase,\n ModelGroupsCache,\n StringFormatter\n ]\n});\n"],"names":["extractIconName","icon","toIconValue","name","ModelGroupPresenterImpl","listPresenter","formModelFactory","listModelGroupsUseCase","getRoleUseCase","createModelGroupUseCase","updateModelGroupUseCase","deleteModelGroupUseCase","cache","stringFormatter","makeAutoObservable","computed","group","isPluginGroup","dataSource","ModelGroupDataSource","id","runInAction","canModify","data","isUpdate","iconValue","isNew","fields","value","form","slugValue","String","layout","ModelGroupPresenter","Abstraction","ListPresenter","FormModelFactory","ListModelGroupsUseCase","GetModelGroupUseCase","CreateModelGroupUseCase","UpdateModelGroupUseCase","DeleteModelGroupUseCase","ModelGroupsCache","StringFormatter"],"mappings":";;;;;;;;;;;;AAmBA,SAASA,gBAAgBC,IAAa;IAClC,IAAIA,AAAS,SAATA,QAAiB,AAAgB,YAAhB,OAAOA,QAAqB,UAAUA,MACvD,OAAQA,KAA0B,IAAI;IAE1C,IAAI,AAAgB,YAAhB,OAAOA,MACP,OAAOA;IAEX,OAAO;AACX;AAEA,SAASC,YAAYC,IAAY;IAC7B,O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OAAO,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;YAChC,QAAQK,CAAAA,SAAW;oBACf,MAAMA,OACD,IAAI,GACJ,KAAK,CAAC,QACN,QAAQ,CAAC,qBACT,QAAQ,CAAC,CAACL,WACV,MAAM,CAAC,CAACM,OAAO,EAAEC,IAAI,EAAE;wBACpB,MAAMC,YAAYD,KAAK,KAAK,CAAC,QAAQ,QAAQ;wBAC7C,IAAIC,aAAa,CAACF,OACd;wBAEJC,KAAK,KAAK,CAAC,QAAQ,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAACE,OAAOH;oBACpE;oBACJ,MAAMD,OACD,IAAI,GACJ,KAAK,CAAC,QACN,QAAQ,CAAC,qBACT,QAAQ,CAAC,CAACD,SAAS,CAACJ;oBACzB,MAAMK,OACD,IAAI,GACJ,KAAK,CAAC,cACN,QAAQ,CAAC,qBACT,QAAQ,CAAC,CAACL,WACV,QAAQ,CAAC;oBACd,aAAaK,OACR,IAAI,GACJ,KAAK,CAAC,eACN,YAAY,CAAC,IACb,QAAQ,CAAC,YACT,QAAQ,CAAC,CAACL;gBACnB;YACA,QAAQU,CAAAA,SAAU;oBACdA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;iBACd;QACL;IACJ;AACJ;AAEO,MAAMC,0CAAsBC,oBAAAA,oBAAgC,CAAC;IAChE,gBAAgB9B;IAChB,cAAc;QACV+B;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -16,6 +16,7 @@ declare class NewContentModelPresenterImpl implements INewContentModelPresenter
16
16
  private form;
17
17
  constructor(formModelFactory: FormModelFactory.Interface, listModelGroupsUseCase: ListModelGroupsUseCase.Interface, createModelUseCase: CreateModelUseCase.Interface, groupsCache: ModelGroupsCache.Interface, modelsCache: ModelsCache.Interface);
18
18
  get vm(): INewContentModelPresenterViewModel;
19
+ private get groupOptions();
19
20
  init(): Promise<void>;
20
21
  save(): Promise<CmsModel | null>;
21
22
  reset(): void;
@@ -26,18 +26,20 @@ class NewContentModelPresenterImpl {
26
26
  });
27
27
  }
28
28
  get vm() {
29
- const groups = this.groupsCache.getItems().map((g)=>({
30
- value: g.slug,
31
- label: g.name
32
- }));
33
29
  return {
34
30
  loading: this.loading,
35
31
  saving: this.saving,
36
- groups,
32
+ groups: this.groupOptions,
37
33
  models: this.modelsCache.getItems(),
38
34
  form: this.form.vm
39
35
  };
40
36
  }
37
+ get groupOptions() {
38
+ return this.groupsCache.getItems().map((group)=>({
39
+ value: group.slug,
40
+ label: group.name
41
+ }));
42
+ }
41
43
  async init() {
42
44
  try {
43
45
  await this.listModelGroupsUseCase.execute();
@@ -97,7 +99,7 @@ class NewContentModelPresenterImpl {
97
99
  singularApiName: fields.text().label("Singular API Name").required("Singular API Name is required."),
98
100
  singleEntry: fields.boolean().label("Single entry model").defaultValue(false),
99
101
  pluralApiName: fields.text().label("Plural API Name"),
100
- group: fields.text().label("Content model group").required("Group is required."),
102
+ group: fields.text().label("Content model group").required("Group is required.").options(()=>this.groupOptions),
101
103
  icon: fields.text().label("Icon").renderer("cmsIconPicker"),
102
104
  description: fields.text().label("Description").renderer("textarea"),
103
105
  defaultFields: fields.boolean().label("Create model with default fields").defaultValue(true)
@@ -1 +1 @@
1
- {"version":3,"file":"presentation/newContentModel/NewContentModelPresenter.js","sources":["../../../src/presentation/newContentModel/NewContentModelPresenter.ts"],"sourcesContent":["import { makeAutoObservable, runInAction, computed } from \"mobx\";\nimport { FormModelFactory } from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport type { IFormModel } from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport type { CmsModel } from \"~/types.js\";\nimport { ListModelGroupsUseCase } from \"~/features/modelGroup/listModelGroups/abstractions.js\";\nimport { CreateModelUseCase } from \"~/features/model/createModel/abstractions.js\";\nimport { ModelGroupsCache } from \"~/features/modelGroup/abstractions.js\";\nimport { ModelsCache } from \"~/features/model/abstractions.js\";\nconst CMS_MODEL_SINGLETON_TAG = \"singleEntry\";\nimport {\n NewContentModelPresenter as Abstraction,\n type INewContentModelPresenter,\n type INewContentModelPresenterViewModel\n} from \"./abstractions.js\";\n\nclass NewContentModelPresenterImpl implements INewContentModelPresenter {\n private loading = true;\n private saving = false;\n private form: IFormModel;\n\n constructor(\n private formModelFactory: FormModelFactory.Interface,\n private listModelGroupsUseCase: ListModelGroupsUseCase.Interface,\n private createModelUseCase: CreateModelUseCase.Interface,\n private groupsCache: ModelGroupsCache.Interface,\n private modelsCache: ModelsCache.Interface\n ) {\n this.form = this.buildForm();\n makeAutoObservable<\n NewContentModelPresenterImpl,\n | \"formModelFactory\"\n | \"listModelGroupsUseCase\"\n | \"createModelUseCase\"\n | \"groupsCache\"\n | \"modelsCache\"\n >(this, {\n formModelFactory: false,\n listModelGroupsUseCase: false,\n createModelUseCase: false,\n groupsCache: false,\n modelsCache: false,\n vm: computed\n });\n }\n\n get vm(): INewContentModelPresenterViewModel {\n const groups = this.groupsCache.getItems().map(g => ({\n value: g.slug,\n label: g.name\n }));\n\n return {\n loading: this.loading,\n saving: this.saving,\n groups,\n models: this.modelsCache.getItems(),\n form: this.form.vm\n };\n }\n\n async init(): Promise<void> {\n try {\n await this.listModelGroupsUseCase.execute();\n } finally {\n runInAction(() => {\n this.loading = false;\n const groups = this.groupsCache.getItems();\n if (groups.length > 0) {\n this.form.setData({ group: groups[0].slug });\n }\n });\n }\n }\n\n async save(): Promise<CmsModel | null> {\n const data = await this.form.submit<Record<string, any>>();\n if (!data) {\n return null;\n }\n\n runInAction(() => {\n this.saving = true;\n });\n\n try {\n const tags: string[] = Array.isArray(data.tags) ? data.tags : [];\n let pluralApiName = data.pluralApiName as string;\n\n if (data.singleEntry) {\n tags.push(CMS_MODEL_SINGLETON_TAG);\n pluralApiName = `${data.singularApiName}Unused`;\n }\n\n const model = await this.createModelUseCase.execute({\n name: data.name as string,\n singularApiName: data.singularApiName as string,\n pluralApiName,\n group: data.group as string,\n icon: data.icon as string | undefined,\n description: data.description as string | undefined,\n defaultFields: data.defaultFields as boolean | undefined,\n tags\n });\n\n return model;\n } catch {\n return null;\n } finally {\n runInAction(() => {\n this.saving = false;\n });\n }\n }\n\n reset(): void {\n this.form = this.buildForm();\n const groups = this.groupsCache.getItems();\n if (groups.length > 0) {\n this.form.setData({ group: groups[0].slug });\n }\n }\n\n private buildForm(): IFormModel {\n return this.formModelFactory.create({\n fields: fields => ({\n name: fields.text().label(\"Name\").required(\"Name is required.\"),\n singularApiName: fields\n .text()\n .label(\"Singular API Name\")\n .required(\"Singular API Name is required.\"),\n singleEntry: fields.boolean().label(\"Single entry model\").defaultValue(false),\n pluralApiName: fields.text().label(\"Plural API Name\"),\n group: fields.text().label(\"Content model group\").required(\"Group is required.\"),\n icon: fields.text().label(\"Icon\").renderer(\"cmsIconPicker\"),\n description: fields.text().label(\"Description\").renderer(\"textarea\"),\n defaultFields: fields\n .boolean()\n .label(\"Create model with default fields\")\n .defaultValue(true)\n }),\n layout: layout => [\n layout.row(\"name\"),\n layout.row(\"singularApiName\"),\n layout.row(\"singleEntry\"),\n layout.row(\"pluralApiName\"),\n layout.row(\"group\"),\n layout.row(\"icon\"),\n layout.row(\"description\"),\n layout.row(\"defaultFields\")\n ]\n });\n }\n}\n\nexport const NewContentModelPresenter = Abstraction.createImplementation({\n implementation: NewContentModelPresenterImpl,\n dependencies: [\n FormModelFactory,\n ListModelGroupsUseCase,\n CreateModelUseCase,\n ModelGroupsCache,\n ModelsCache\n ]\n});\n"],"names":["CMS_MODEL_SINGLETON_TAG","NewContentModelPresenterImpl","formModelFactory","listModelGroupsUseCase","createModelUseCase","groupsCache","modelsCache","makeAutoObservable","computed","groups","g","runInAction","data","tags","Array","pluralApiName","model","fields","layout","NewContentModelPresenter","Abstraction","FormModelFactory","ListModelGroupsUseCase","CreateModelUseCase","ModelGroupsCache","ModelsCache"],"mappings":";;;;;;;AAQA,MAA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uB,QAAQ,CAAC;oBAC3D,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC,QAAQ,QAAQ,CAAC;oBAC3C,aAAaA,OAAO,IAAI,GAAG,KAAK,CAAC,eAAe,QAAQ,CAAC;oBACzD,eAAeA,OACV,OAAO,GACP,KAAK,CAAC,oCACN,YAAY,CAAC;gBACtB;YACA,QAAQC,CAAAA,SAAU;oBACdA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;iBACd;QACL;IACJ;AACJ;AAEO,MAAMC,oDAA2BC,yBAAAA,oBAAgC,CAAC;IACrE,gBAAgBnB;IAChB,cAAc;QACVoB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
1
+ {"version":3,"file":"presentation/newContentModel/NewContentModelPresenter.js","sources":["../../../src/presentation/newContentModel/NewContentModelPresenter.ts"],"sourcesContent":["import { makeAutoObservable, runInAction, computed } from \"mobx\";\nimport { FormModelFactory } from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport type { IFormModel } from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport type { CmsModel } from \"~/types.js\";\nimport { ListModelGroupsUseCase } from \"~/features/modelGroup/listModelGroups/abstractions.js\";\nimport { CreateModelUseCase } from \"~/features/model/createModel/abstractions.js\";\nimport { ModelGroupsCache } from \"~/features/modelGroup/abstractions.js\";\nimport { ModelsCache } from \"~/features/model/abstractions.js\";\nconst CMS_MODEL_SINGLETON_TAG = \"singleEntry\";\nimport {\n NewContentModelPresenter as Abstraction,\n type INewContentModelPresenter,\n type INewContentModelPresenterViewModel\n} from \"./abstractions.js\";\n\nclass NewContentModelPresenterImpl implements INewContentModelPresenter {\n private loading = true;\n private saving = false;\n private form: IFormModel;\n\n constructor(\n private formModelFactory: FormModelFactory.Interface,\n private listModelGroupsUseCase: ListModelGroupsUseCase.Interface,\n private createModelUseCase: CreateModelUseCase.Interface,\n private groupsCache: ModelGroupsCache.Interface,\n private modelsCache: ModelsCache.Interface\n ) {\n this.form = this.buildForm();\n makeAutoObservable<\n NewContentModelPresenterImpl,\n | \"formModelFactory\"\n | \"listModelGroupsUseCase\"\n | \"createModelUseCase\"\n | \"groupsCache\"\n | \"modelsCache\"\n >(this, {\n formModelFactory: false,\n listModelGroupsUseCase: false,\n createModelUseCase: false,\n groupsCache: false,\n modelsCache: false,\n vm: computed\n });\n }\n\n get vm(): INewContentModelPresenterViewModel {\n return {\n loading: this.loading,\n saving: this.saving,\n groups: this.groupOptions,\n models: this.modelsCache.getItems(),\n form: this.form.vm\n };\n }\n\n private get groupOptions() {\n return this.groupsCache.getItems().map(group => ({\n value: group.slug,\n label: group.name\n }));\n }\n\n async init(): Promise<void> {\n try {\n await this.listModelGroupsUseCase.execute();\n } finally {\n runInAction(() => {\n this.loading = false;\n const groups = this.groupsCache.getItems();\n if (groups.length > 0) {\n this.form.setData({ group: groups[0].slug });\n }\n });\n }\n }\n\n async save(): Promise<CmsModel | null> {\n const data = await this.form.submit<Record<string, any>>();\n if (!data) {\n return null;\n }\n\n runInAction(() => {\n this.saving = true;\n });\n\n try {\n const tags: string[] = Array.isArray(data.tags) ? data.tags : [];\n let pluralApiName = data.pluralApiName as string;\n\n if (data.singleEntry) {\n tags.push(CMS_MODEL_SINGLETON_TAG);\n pluralApiName = `${data.singularApiName}Unused`;\n }\n\n const model = await this.createModelUseCase.execute({\n name: data.name as string,\n singularApiName: data.singularApiName as string,\n pluralApiName,\n group: data.group as string,\n icon: data.icon as string | undefined,\n description: data.description as string | undefined,\n defaultFields: data.defaultFields as boolean | undefined,\n tags\n });\n\n return model;\n } catch {\n return null;\n } finally {\n runInAction(() => {\n this.saving = false;\n });\n }\n }\n\n reset(): void {\n this.form = this.buildForm();\n const groups = this.groupsCache.getItems();\n if (groups.length > 0) {\n this.form.setData({ group: groups[0].slug });\n }\n }\n\n private buildForm(): IFormModel {\n return this.formModelFactory.create({\n fields: fields => ({\n name: fields.text().label(\"Name\").required(\"Name is required.\"),\n singularApiName: fields\n .text()\n .label(\"Singular API Name\")\n .required(\"Singular API Name is required.\"),\n singleEntry: fields.boolean().label(\"Single entry model\").defaultValue(false),\n pluralApiName: fields.text().label(\"Plural API Name\"),\n group: fields\n .text()\n .label(\"Content model group\")\n .required(\"Group is required.\")\n /*\n * Options turn the text field into a select. The groups arrive after the form\n * is built, so they have to be read through a callback.\n */\n .options(() => this.groupOptions),\n icon: fields.text().label(\"Icon\").renderer(\"cmsIconPicker\"),\n description: fields.text().label(\"Description\").renderer(\"textarea\"),\n defaultFields: fields\n .boolean()\n .label(\"Create model with default fields\")\n .defaultValue(true)\n }),\n layout: layout => [\n layout.row(\"name\"),\n layout.row(\"singularApiName\"),\n layout.row(\"singleEntry\"),\n layout.row(\"pluralApiName\"),\n layout.row(\"group\"),\n layout.row(\"icon\"),\n layout.row(\"description\"),\n layout.row(\"defaultFields\")\n ]\n });\n }\n}\n\nexport const NewContentModelPresenter = Abstraction.createImplementation({\n implementation: NewContentModelPresenterImpl,\n dependencies: [\n FormModelFactory,\n ListModelGroupsUseCase,\n CreateModelUseCase,\n ModelGroupsCache,\n ModelsCache\n ]\n});\n"],"names":["CMS_MODEL_SINGLETON_TAG","NewContentModelPresenterImpl","formModelFactory","listModelGroupsUseCase","createModelUseCase","groupsCache","modelsCache","makeAutoObservable","computed","group","runInAction","groups","data","tags","Array","pluralApiName","model","fields","layout","NewContentModelPresenter","Abstraction","FormModelFactory","ListModelGroupsUseCase","CreateModelUseCase","ModelGroupsCache","ModelsCache"],"mappings":";;;;;;;AAQA,MAAMA,0BAA0B;AAOhC,MAAMC;IAKF,YACYC,gBAA4C,EAC5CC,sBAAwD,EACxDC,kBAAgD,EAChDC,WAAuC,EACvCC,WAAkC,CAC5C;aALUJ,gBAAgB,GAAhBA;aACAC,sBAAsB,G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AQ,CAAC;oBAC3C,aAAaA,OAAO,IAAI,GAAG,KAAK,CAAC,eAAe,QAAQ,CAAC;oBACzD,eAAeA,OACV,OAAO,GACP,KAAK,CAAC,oCACN,YAAY,CAAC;gBACtB;YACA,QAAQC,CAAAA,SAAU;oBACdA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;oBACXA,OAAO,GAAG,CAAC;iBACd;QACL;IACJ;AACJ;AAEO,MAAMC,oDAA2BC,yBAAAA,oBAAgC,CAAC;IACrE,gBAAgBnB;IAChB,cAAc;QACVoB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -1,3 +1,7 @@
1
1
  import type { IconProp } from "@fortawesome/fontawesome-svg-core";
2
2
  import type { CmsIcon } from "@webiny/app-headless-cms-common/types/index.js";
3
+ /**
4
+ * Converts a stored icon ("prefix/name") into a FontAwesome icon tuple.
5
+ * Returns undefined when the value is missing or not in the "prefix/name" format.
6
+ */
3
7
  export declare const normalizeIcon: (icon: string | CmsIcon | undefined) => IconProp | undefined;
@@ -1,10 +1,13 @@
1
1
  const normalizeIcon = (icon)=>{
2
- let iconName;
3
- if (icon) {
4
- const name = "string" == typeof icon ? icon : icon.name;
5
- iconName = name.split("/");
6
- }
7
- return iconName;
2
+ if (!icon) return;
3
+ const name = "string" == typeof icon ? icon : icon.name;
4
+ if (!name) return;
5
+ const [prefix, iconName, ...rest] = name.split("/");
6
+ if (!prefix || !iconName || rest.length > 0) return;
7
+ return [
8
+ prefix,
9
+ iconName
10
+ ];
8
11
  };
9
12
  export { normalizeIcon };
10
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"utils/normalizeIcon.js","sources":["../../src/utils/normalizeIcon.ts"],"sourcesContent":["import type { IconProp } from \"@fortawesome/fontawesome-svg-core\";\nimport type { CmsIcon } from \"@webiny/app-headless-cms-common/types/index.js\";\n\nexport const normalizeIcon = (icon: string | CmsIcon | undefined) => {\n let iconName: IconProp | undefined = undefined;\n if (icon) {\n const name = typeof icon === \"string\" ? icon : icon.name;\n iconName = name.split(\"/\") as IconProp;\n }\n return iconName;\n};\n"],"names":["normalizeIcon","icon","iconName","name"],"mappings":"AAGO,MAAMA,gBAAgB,CAACC;IAC1B,IAAIC;IACJ,IAAID,MAAM;QACN,MAAME,OAAO,AAAgB,YAAhB,OAAOF,OAAoBA,OAAOA,KAAK,IAAI;QACxDC,WAAWC,KAAK,KAAK,CAAC;IAC1B;IACA,OAAOD;AACX"}
1
+ {"version":3,"file":"utils/normalizeIcon.js","sources":["../../src/utils/normalizeIcon.ts"],"sourcesContent":["import type { IconProp } from \"@fortawesome/fontawesome-svg-core\";\nimport type { CmsIcon } from \"@webiny/app-headless-cms-common/types/index.js\";\n\n/**\n * Converts a stored icon (\"prefix/name\") into a FontAwesome icon tuple.\n * Returns undefined when the value is missing or not in the \"prefix/name\" format.\n */\nexport const normalizeIcon = (icon: string | CmsIcon | undefined): IconProp | undefined => {\n if (!icon) {\n return undefined;\n }\n const name = typeof icon === \"string\" ? icon : icon.name;\n if (!name) {\n return undefined;\n }\n const [prefix, iconName, ...rest] = name.split(\"/\");\n if (!prefix || !iconName || rest.length > 0) {\n return undefined;\n }\n return [prefix, iconName] as IconProp;\n};\n"],"names":["normalizeIcon","icon","name","prefix","iconName","rest"],"mappings":"AAOO,MAAMA,gBAAgB,CAACC;IAC1B,IAAI,CAACA,MACD;IAEJ,MAAMC,OAAO,AAAgB,YAAhB,OAAOD,OAAoBA,OAAOA,KAAK,IAAI;IACxD,IAAI,CAACC,MACD;IAEJ,MAAM,CAACC,QAAQC,UAAU,GAAGC,KAAK,GAAGH,KAAK,KAAK,CAAC;IAC/C,IAAI,CAACC,UAAU,CAACC,YAAYC,KAAK,MAAM,GAAG,GACtC;IAEJ,OAAO;QAACF;QAAQC;KAAS;AAC7B"}
@@ -1,9 +0,0 @@
1
- import type { IRuleEvaluator, IRule, IFormModel } from "@webiny/app-admin/features/formModel/abstractions.js";
2
- declare class CmsAccessControlRuleEvaluatorImpl implements IRuleEvaluator {
3
- canEvaluate(rule: IRule): boolean;
4
- evaluate(_rule: IRule, _form: IFormModel): boolean;
5
- }
6
- export declare const CmsAccessControlRuleEvaluator: typeof CmsAccessControlRuleEvaluatorImpl & {
7
- __abstraction: import("@webiny/di").Abstraction<IRuleEvaluator>;
8
- };
9
- export {};
@@ -1,16 +0,0 @@
1
- import { RuleEvaluator } from "@webiny/app-admin/features/formModel/abstractions.js";
2
- class CmsAccessControlRuleEvaluatorImpl {
3
- canEvaluate(rule) {
4
- return "accessControl" === rule.type;
5
- }
6
- evaluate(_rule, _form) {
7
- return false;
8
- }
9
- }
10
- const CmsAccessControlRuleEvaluator = RuleEvaluator.createImplementation({
11
- implementation: CmsAccessControlRuleEvaluatorImpl,
12
- dependencies: []
13
- });
14
- export { CmsAccessControlRuleEvaluator };
15
-
16
- //# sourceMappingURL=CmsAccessControlRuleEvaluator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"features/formModel/CmsAccessControlRuleEvaluator.js","sources":["../../../src/features/formModel/CmsAccessControlRuleEvaluator.ts"],"sourcesContent":["import type {\n IRuleEvaluator,\n IRule,\n IFormModel\n} from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport { RuleEvaluator } from \"@webiny/app-admin/features/formModel/abstractions.js\";\n\nclass CmsAccessControlRuleEvaluatorImpl implements IRuleEvaluator {\n canEvaluate(rule: IRule): boolean {\n return rule.type === \"accessControl\";\n }\n\n evaluate(_rule: IRule, _form: IFormModel): boolean {\n // TODO: implement actual access control check against current identity/permissions\n return false;\n }\n}\n\nexport const CmsAccessControlRuleEvaluator = RuleEvaluator.createImplementation({\n implementation: CmsAccessControlRuleEvaluatorImpl,\n dependencies: []\n});\n"],"names":["CmsAccessControlRuleEvaluatorImpl","rule","_rule","_form","CmsAccessControlRuleEvaluator","RuleEvaluator"],"mappings":";AAOA,MAAMA;IACF,YAAYC,IAAW,EAAW;QAC9B,OAAOA,AAAc,oBAAdA,KAAK,IAAI;IACpB;IAEA,SAASC,KAAY,EAAEC,KAAiB,EAAW;QAE/C,OAAO;IACX;AACJ;AAEO,MAAMC,gCAAgCC,cAAc,oBAAoB,CAAC;IAC5E,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}