@webiny/app-admin 6.3.0 → 6.4.0-beta.1
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.
- package/assets/icons/add-18px.js +20 -0
- package/assets/icons/add-18px.js.map +1 -0
- package/assets/icons/arrow_drop_down-24px.js +20 -0
- package/assets/icons/arrow_drop_down-24px.js.map +1 -0
- package/assets/icons/attach_file_black_24dp.js +20 -0
- package/assets/icons/attach_file_black_24dp.js.map +1 -0
- package/assets/icons/baseline-menu-24px.js +20 -0
- package/assets/icons/baseline-menu-24px.js.map +1 -0
- package/assets/icons/baseline-notification_important-24px.js +19 -0
- package/assets/icons/baseline-notification_important-24px.js.map +1 -0
- package/assets/icons/baseline-security-24px.js +19 -0
- package/assets/icons/baseline-security-24px.js.map +1 -0
- package/assets/icons/file_download.js +19 -0
- package/assets/icons/file_download.js.map +1 -0
- package/assets/icons/file_upload.js +19 -0
- package/assets/icons/file_upload.js.map +1 -0
- package/assets/icons/filter-24px.js +23 -0
- package/assets/icons/filter-24px.js.map +1 -0
- package/assets/icons/github-brands.js +19 -0
- package/assets/icons/github-brands.js.map +1 -0
- package/assets/icons/highlight-24px.js +19 -0
- package/assets/icons/highlight-24px.js.map +1 -0
- package/assets/icons/icon-community.js +18 -0
- package/assets/icons/icon-community.js.map +1 -0
- package/assets/icons/icon-documentation.js +18 -0
- package/assets/icons/icon-documentation.js.map +1 -0
- package/assets/icons/info.js +19 -0
- package/assets/icons/info.js.map +1 -0
- package/assets/icons/insert_drive_file-24px.js +19 -0
- package/assets/icons/insert_drive_file-24px.js.map +1 -0
- package/assets/icons/insert_photo-24px.js +19 -0
- package/assets/icons/insert_photo-24px.js.map +1 -0
- package/assets/icons/label-24px.js +19 -0
- package/assets/icons/label-24px.js.map +1 -0
- package/assets/icons/round-account_circle-24px.js +19 -0
- package/assets/icons/round-account_circle-24px.js.map +1 -0
- package/assets/icons/round-add-24px.js +20 -0
- package/assets/icons/round-add-24px.js.map +1 -0
- package/assets/icons/round-arrow_drop_down-24px.js +19 -0
- package/assets/icons/round-arrow_drop_down-24px.js.map +1 -0
- package/assets/icons/round-chevron_right-24px.js +20 -0
- package/assets/icons/round-chevron_right-24px.js.map +1 -0
- package/assets/icons/round-feedback-24px.js +20 -0
- package/assets/icons/round-feedback-24px.js.map +1 -0
- package/assets/icons/round-help-24px.js +19 -0
- package/assets/icons/round-help-24px.js.map +1 -0
- package/assets/icons/round-invert_colors-24px.js +20 -0
- package/assets/icons/round-invert_colors-24px.js.map +1 -0
- package/assets/icons/round-keyboard_arrow_down-24px.js +17 -0
- package/assets/icons/round-keyboard_arrow_down-24px.js.map +1 -0
- package/assets/icons/round-keyboard_arrow_up-24px.js +17 -0
- package/assets/icons/round-keyboard_arrow_up-24px.js.map +1 -0
- package/assets/icons/round-lock_open-24px.js +22 -0
- package/assets/icons/round-lock_open-24px.js.map +1 -0
- package/assets/icons/round-more_vert-24px.js +20 -0
- package/assets/icons/round-more_vert-24px.js.map +1 -0
- package/assets/icons/round-open_in_new-24px.js +20 -0
- package/assets/icons/round-open_in_new-24px.js.map +1 -0
- package/assets/icons/round-settings-24px.js +20 -0
- package/assets/icons/round-settings-24px.js.map +1 -0
- package/assets/icons/search-24px.js +21 -0
- package/assets/icons/search-24px.js.map +1 -0
- package/assets/icons/slack-logo.js +14 -0
- package/assets/icons/slack-logo.js.map +1 -0
- package/assets/icons/today-24px.js +19 -0
- package/assets/icons/today-24px.js.map +1 -0
- package/assets/icons/touch_app.js +20 -0
- package/assets/icons/touch_app.js.map +1 -0
- package/assets/images/webiny-logo.js +34 -0
- package/assets/images/webiny-logo.js.map +1 -0
- package/assets/images/webiny-orange-logo.js +34 -0
- package/assets/images/webiny-orange-logo.js.map +1 -0
- package/base/Admin.js +37 -28
- package/base/Admin.js.map +1 -1
- package/base/Base/DefaultFieldRenderers.js +73 -70
- package/base/Base/DefaultFieldRenderers.js.map +1 -1
- package/base/Base/DefaultLayoutRenderers.js +9 -10
- package/base/Base/DefaultLayoutRenderers.js.map +1 -1
- package/base/Base/FieldRenderers/CheckboxesRenderer.js +22 -23
- package/base/Base/FieldRenderers/CheckboxesRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/CodeEditorRenderer.js +10 -13
- package/base/Base/FieldRenderers/CodeEditorRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/DateTimeInputsRenderer.js +60 -60
- package/base/Base/FieldRenderers/DateTimeInputsRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/DateTimeRenderer.js +38 -39
- package/base/Base/FieldRenderers/DateTimeRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/FilePickerRenderer.d.ts +2 -1
- package/base/Base/FieldRenderers/FilePickerRenderer.js +37 -40
- package/base/Base/FieldRenderers/FilePickerRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/FileUrlPickerRenderer.js +15 -20
- package/base/Base/FieldRenderers/FileUrlPickerRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/HiddenRenderer.js +3 -3
- package/base/Base/FieldRenderers/HiddenRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/HorizontalTabsRenderer.js +20 -21
- package/base/Base/FieldRenderers/HorizontalTabsRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/InputRenderer.js +16 -20
- package/base/Base/FieldRenderers/InputRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/MultiFilePickerRenderer.d.ts +13 -0
- package/base/Base/FieldRenderers/MultiFilePickerRenderer.js +70 -0
- package/base/Base/FieldRenderers/MultiFilePickerRenderer.js.map +1 -0
- package/base/Base/FieldRenderers/NumberInputRenderer.js +16 -19
- package/base/Base/FieldRenderers/NumberInputRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/NumberInputsRenderer.js +45 -44
- package/base/Base/FieldRenderers/NumberInputsRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/DynamicZoneRenderer.js +10 -13
- package/base/Base/FieldRenderers/ObjectRenderer/DynamicZoneRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/KeyValueTagsRenderer.js +50 -56
- package/base/Base/FieldRenderers/ObjectRenderer/KeyValueTagsRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone.js +87 -99
- package/base/Base/FieldRenderers/ObjectRenderer/MultiValueDynamicZone.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectAccordionMultipleRenderer.js +41 -48
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectAccordionMultipleRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectFieldComponents.d.ts +1 -2
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectFieldComponents.js +62 -78
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectFieldComponents.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectRenderer.js +12 -15
- package/base/Base/FieldRenderers/ObjectRenderer/ObjectRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/SingleValueDynamicZone.js +48 -54
- package/base/Base/FieldRenderers/ObjectRenderer/SingleValueDynamicZone.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker.js +62 -79
- package/base/Base/FieldRenderers/ObjectRenderer/TemplatePicker.js.map +1 -1
- package/base/Base/FieldRenderers/ObjectRenderer/resolveItemTitle.js +14 -17
- package/base/Base/FieldRenderers/ObjectRenderer/resolveItemTitle.js.map +1 -1
- package/base/Base/FieldRenderers/PassthroughRenderer.js +8 -11
- package/base/Base/FieldRenderers/PassthroughRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/RadioButtonsRenderer.js +21 -22
- package/base/Base/FieldRenderers/RadioButtonsRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/SelectRenderer.js +23 -24
- package/base/Base/FieldRenderers/SelectRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/SwitchRenderer.js +12 -15
- package/base/Base/FieldRenderers/SwitchRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/TagsRenderer.js +15 -16
- package/base/Base/FieldRenderers/TagsRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/TextInputsRenderer.js +44 -43
- package/base/Base/FieldRenderers/TextInputsRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/TextareaRenderer.js +17 -21
- package/base/Base/FieldRenderers/TextareaRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/TextareasRenderer.js +47 -46
- package/base/Base/FieldRenderers/TextareasRenderer.js.map +1 -1
- package/base/Base/FieldRenderers/VerticalTabsRenderer.js +35 -36
- package/base/Base/FieldRenderers/VerticalTabsRenderer.js.map +1 -1
- package/base/Base/LexicalPreset.js +56 -60
- package/base/Base/LexicalPreset.js.map +1 -1
- package/base/Base/Menus/SupportMenuItems.js +9 -13
- package/base/Base/Menus/SupportMenuItems.js.map +1 -1
- package/base/Base/Menus/WebinyVersion.js +19 -20
- package/base/Base/Menus/WebinyVersion.js.map +1 -1
- package/base/Base/Menus.js +52 -66
- package/base/Base/Menus.js.map +1 -1
- package/base/Base/RoutesConfig.js +21 -29
- package/base/Base/RoutesConfig.js.map +1 -1
- package/base/Base/Tenant/wby-horizontal.js +33 -0
- package/base/Base/Tenant/wby-horizontal.js.map +1 -0
- package/base/Base/Tenant/wby-square.js +20 -0
- package/base/Base/Tenant/wby-square.js.map +1 -0
- package/base/Base/Tenant.js +17 -19
- package/base/Base/Tenant.js.map +1 -1
- package/base/Base/UserMenu/ExitTenant.js +18 -29
- package/base/Base/UserMenu/ExitTenant.js.map +1 -1
- package/base/Base/UserMenu/SignOut.js +13 -14
- package/base/Base/UserMenu/SignOut.js.map +1 -1
- package/base/Base/UserMenu/UserInfo.js +23 -36
- package/base/Base/UserMenu/UserInfo.js.map +1 -1
- package/base/Base/UserMenu.js +12 -13
- package/base/Base/UserMenu.js.map +1 -1
- package/base/Base.js +4 -5
- package/base/Base.js.map +1 -1
- package/base/TelemetryAdminAppStart.js +9 -12
- package/base/TelemetryAdminAppStart.js.map +1 -1
- package/base/WebinyVersion.js +19 -20
- package/base/WebinyVersion.js.map +1 -1
- package/base/createRootContainer.js +42 -40
- package/base/createRootContainer.js.map +1 -1
- package/base/plugins/AddGraphQLQuerySelection.js +12 -11
- package/base/plugins/AddGraphQLQuerySelection.js.map +1 -1
- package/base/providers/AdminUiStateProvider.js +5 -10
- package/base/providers/AdminUiStateProvider.js.map +1 -1
- package/base/providers/ApolloProvider.js +8 -11
- package/base/providers/ApolloProvider.js.map +1 -1
- package/base/providers/UiProviders.js +18 -27
- package/base/providers/UiProviders.js.map +1 -1
- package/base/providers/UiStateProvider.js +5 -10
- package/base/providers/UiStateProvider.js.map +1 -1
- package/base/ui/Brand.js +4 -5
- package/base/ui/Brand.js.map +1 -1
- package/base/ui/CenteredView.d.ts +1 -1
- package/base/ui/CenteredView.js +9 -13
- package/base/ui/CenteredView.js.map +1 -1
- package/base/ui/Dashboard.js +4 -5
- package/base/ui/Dashboard.js.map +1 -1
- package/base/ui/FileManager.js +38 -60
- package/base/ui/FileManager.js.map +1 -1
- package/base/ui/Layout.js +4 -8
- package/base/ui/Layout.js.map +1 -1
- package/base/ui/LoginScreen.js +16 -21
- package/base/ui/LoginScreen.js.map +1 -1
- package/base/ui/Logo.js +4 -5
- package/base/ui/Logo.js.map +1 -1
- package/base/ui/Navigation.js +11 -14
- package/base/ui/Navigation.js.map +1 -1
- package/base/ui/NotFound.js +4 -5
- package/base/ui/NotFound.js.map +1 -1
- package/base/ui/Tags.js +12 -16
- package/base/ui/Tags.js.map +1 -1
- package/base/ui/TenantSelector.js +4 -5
- package/base/ui/TenantSelector.js.map +1 -1
- package/base/ui/UserMenu/UserMenu.js +4 -5
- package/base/ui/UserMenu/UserMenu.js.map +1 -1
- package/base/ui/UserMenu/UserMenuHandle.js +4 -5
- package/base/ui/UserMenu/UserMenuHandle.js.map +1 -1
- package/base/ui/UserMenu/UserMenuItem.d.ts +4 -4
- package/base/ui/UserMenu/UserMenuItem.js +5 -15
- package/base/ui/UserMenu/UserMenuItem.js.map +1 -1
- package/base/ui/UserMenu/UserMenuLink.d.ts +4 -4
- package/base/ui/UserMenu/UserMenuLink.js +5 -15
- package/base/ui/UserMenu/UserMenuLink.js.map +1 -1
- package/base/ui/UserMenu/UserMenuSeparator.d.ts +2 -2
- package/base/ui/UserMenu/UserMenuSeparator.js +3 -5
- package/base/ui/UserMenu/UserMenuSeparator.js.map +1 -1
- package/base/ui/UserMenu.js +6 -13
- package/base/ui/UserMenu.js.map +1 -1
- package/components/AdminLayout.js +6 -10
- package/components/AdminLayout.js.map +1 -1
- package/components/BulkActions/Worker.js +57 -120
- package/components/BulkActions/Worker.js.map +1 -1
- package/components/BulkActions/index.js +0 -2
- package/components/BulkActions/useDialogWithReport/DialogMessage.js +17 -21
- package/components/BulkActions/useDialogWithReport/DialogMessage.js.map +1 -1
- package/components/BulkActions/useDialogWithReport/index.js +0 -2
- package/components/BulkActions/useDialogWithReport/useDialogWithReport.js +33 -44
- package/components/BulkActions/useDialogWithReport/useDialogWithReport.js.map +1 -1
- package/components/Buttons/Buttons.js +44 -71
- package/components/Buttons/Buttons.js.map +1 -1
- package/components/Buttons/Buttons.styles.js +9 -15
- package/components/Buttons/Buttons.styles.js.map +1 -1
- package/components/Buttons/index.js +1 -3
- package/components/Buttons/useButtons.js +15 -20
- package/components/Buttons/useButtons.js.map +1 -1
- package/components/DeveloperMode/DeveloperMode.js +5 -14
- package/components/DeveloperMode/DeveloperMode.js.map +1 -1
- package/components/DeveloperMode/index.js +0 -2
- package/components/Dialogs/Dialog.d.ts +2 -2
- package/components/Dialogs/Dialog.js +46 -59
- package/components/Dialogs/Dialog.js.map +1 -1
- package/components/Dialogs/DialogParamsContext.js +6 -7
- package/components/Dialogs/DialogParamsContext.js.map +1 -1
- package/components/Dialogs/DialogsContext.d.ts +2 -2
- package/components/Dialogs/DialogsContext.js +129 -149
- package/components/Dialogs/DialogsContext.js.map +1 -1
- package/components/Dialogs/useDialogs.js +5 -6
- package/components/Dialogs/useDialogs.js.map +1 -1
- package/components/EmptyView.js +26 -31
- package/components/EmptyView.js.map +1 -1
- package/components/Filters/Filters.js +15 -16
- package/components/Filters/Filters.js.map +1 -1
- package/components/Filters/FiltersToggle.js +18 -23
- package/components/Filters/FiltersToggle.js.map +1 -1
- package/components/Filters/index.js +0 -2
- package/components/FloatingActionButton.js +13 -15
- package/components/FloatingActionButton.js.map +1 -1
- package/components/IconPicker/IconPicker.js +24 -26
- package/components/IconPicker/IconPicker.js.map +1 -1
- package/components/IconPicker/IconPickerComponent.js +56 -72
- package/components/IconPicker/IconPickerComponent.js.map +1 -1
- package/components/IconPicker/IconPickerPresenter.js +64 -70
- package/components/IconPicker/IconPickerPresenter.js.map +1 -1
- package/components/IconPicker/IconPickerPresenter.test.js +79 -105
- package/components/IconPicker/IconPickerPresenter.test.js.map +1 -1
- package/components/IconPicker/IconPickerPresenterProvider.js +10 -16
- package/components/IconPicker/IconPickerPresenterProvider.js.map +1 -1
- package/components/IconPicker/IconPickerTab.js +97 -140
- package/components/IconPicker/IconPickerTab.js.map +1 -1
- package/components/IconPicker/IconRenderer.js +15 -23
- package/components/IconPicker/IconRenderer.js.map +1 -1
- package/components/IconPicker/IconRepository.js +41 -40
- package/components/IconPicker/IconRepository.js.map +1 -1
- package/components/IconPicker/IconRepository.test.js +56 -63
- package/components/IconPicker/IconRepository.test.js.map +1 -1
- package/components/IconPicker/IconRepositoryFactory.js +15 -11
- package/components/IconPicker/IconRepositoryFactory.js.map +1 -1
- package/components/IconPicker/Loading.js +47 -46
- package/components/IconPicker/Loading.js.map +1 -1
- package/components/IconPicker/components/IconPickerCell.js +18 -20
- package/components/IconPicker/components/IconPickerCell.js.map +1 -1
- package/components/IconPicker/components/IconPickerContent.js +27 -35
- package/components/IconPicker/components/IconPickerContent.js.map +1 -1
- package/components/IconPicker/components/IconPickerRow.js +5 -10
- package/components/IconPicker/components/IconPickerRow.js.map +1 -1
- package/components/IconPicker/components/IconPickerTrigger.js +42 -44
- package/components/IconPicker/components/IconPickerTrigger.js.map +1 -1
- package/components/IconPicker/components/index.js +0 -2
- package/components/IconPicker/config/Emojis.js +19 -21
- package/components/IconPicker/config/Emojis.js.map +1 -1
- package/components/IconPicker/config/FontAwesomeIcons.js +54 -58
- package/components/IconPicker/config/FontAwesomeIcons.js.map +1 -1
- package/components/IconPicker/config/IconPackProvider.js +17 -19
- package/components/IconPicker/config/IconPackProvider.js.map +1 -1
- package/components/IconPicker/config/IconType.js +48 -80
- package/components/IconPicker/config/IconType.js.map +1 -1
- package/components/IconPicker/config/index.js +28 -31
- package/components/IconPicker/config/index.js.map +1 -1
- package/components/IconPicker/defaultIcon.js +6 -5
- package/components/IconPicker/defaultIcon.js.map +1 -1
- package/components/IconPicker/index.js +0 -2
- package/components/IconPicker/plugins/customPlugin.js +87 -110
- package/components/IconPicker/plugins/customPlugin.js.map +1 -1
- package/components/IconPicker/plugins/emojisPlugin.js +90 -115
- package/components/IconPicker/plugins/emojisPlugin.js.map +1 -1
- package/components/IconPicker/plugins/graphql.js +3 -8
- package/components/IconPicker/plugins/graphql.js.map +1 -1
- package/components/IconPicker/plugins/iconsPlugin.js +73 -104
- package/components/IconPicker/plugins/iconsPlugin.js.map +1 -1
- package/components/IconPicker/types.js +4 -7
- package/components/IconPicker/types.js.map +1 -1
- package/components/LexicalEditor/LexicalEditor.js +40 -38
- package/components/LexicalEditor/LexicalEditor.js.map +1 -1
- package/components/LexicalEditor/LexicalLinkForm.js +80 -86
- package/components/LexicalEditor/LexicalLinkForm.js.map +1 -1
- package/components/LexicalEditor/index.js +0 -2
- package/components/LexicalEditor/lexicalValueFromHtml.js +21 -28
- package/components/LexicalEditor/lexicalValueFromHtml.js.map +1 -1
- package/components/LexicalEditor/lexicalValueWithHtml.js +24 -30
- package/components/LexicalEditor/lexicalValueWithHtml.js.map +1 -1
- package/components/MultiImageUpload.js +4 -13
- package/components/MultiImageUpload.js.map +1 -1
- package/components/NotAuthorizedError/NotAuthorizedError.js +16 -17
- package/components/NotAuthorizedError/NotAuthorizedError.js.map +1 -1
- package/components/NotAuthorizedError/SecureRouteError.js +297 -0
- package/components/NotAuthorizedError/SecureRouteError.js.map +1 -0
- package/components/NotAuthorizedError/index.js +0 -2
- package/components/OptionsMenu/OptionsMenu.js +20 -19
- package/components/OptionsMenu/OptionsMenu.js.map +1 -1
- package/components/OptionsMenu/OptionsMenuItem.js +15 -14
- package/components/OptionsMenu/OptionsMenuItem.js.map +1 -1
- package/components/OptionsMenu/OptionsMenuLink.js +13 -14
- package/components/OptionsMenu/OptionsMenuLink.js.map +1 -1
- package/components/OptionsMenu/index.js +0 -2
- package/components/OptionsMenu/useOptionsMenuItem.js +13 -18
- package/components/OptionsMenu/useOptionsMenuItem.js.map +1 -1
- package/components/OverlayLayout/OverlayLayout.js +35 -38
- package/components/OverlayLayout/OverlayLayout.js.map +1 -1
- package/components/OverlayLayout/components/OverlayBackdrop.js +6 -11
- package/components/OverlayLayout/components/OverlayBackdrop.js.map +1 -1
- package/components/OverlayLayout/components/OverlayContent.js +18 -17
- package/components/OverlayLayout/components/OverlayContent.js.map +1 -1
- package/components/OverlayLayout/components/OverlayHeader.js +30 -37
- package/components/OverlayLayout/components/OverlayHeader.js.map +1 -1
- package/components/OverlayLayout/components/OverlayRoot.js +13 -17
- package/components/OverlayLayout/components/OverlayRoot.js.map +1 -1
- package/components/OverlayLayout/components/index.js +0 -2
- package/components/OverlayLayout/index.js +0 -2
- package/components/Permissions/CannotUseAaclAlert.js +10 -11
- package/components/Permissions/CannotUseAaclAlert.js.map +1 -1
- package/components/Permissions/Permissions.js +32 -41
- package/components/Permissions/Permissions.js.map +1 -1
- package/components/Permissions/PermissionsGroup.js +9 -15
- package/components/Permissions/PermissionsGroup.js.map +1 -1
- package/components/Permissions/StyledComponents.js +9 -16
- package/components/Permissions/StyledComponents.js.map +1 -1
- package/components/Permissions/index.js +1 -3
- package/components/RegisterFeature.js +14 -21
- package/components/RegisterFeature.js.map +1 -1
- package/components/ResizablePanels/index.js +0 -2
- package/components/RoleAutocomplete/graphql.js +3 -2
- package/components/RoleAutocomplete/graphql.js.map +1 -1
- package/components/RoleAutocomplete/index.d.ts +5 -3
- package/components/RoleAutocomplete/index.js +21 -13
- package/components/RoleAutocomplete/index.js.map +1 -1
- package/components/RolesMultiAutocomplete/graphql.js +3 -2
- package/components/RolesMultiAutocomplete/graphql.js.map +1 -1
- package/components/RolesMultiAutocomplete/index.d.ts +5 -3
- package/components/RolesMultiAutocomplete/index.js +21 -14
- package/components/RolesMultiAutocomplete/index.js.map +1 -1
- package/components/SearchUI.js +18 -25
- package/components/SearchUI.js.map +1 -1
- package/components/SimpleForm/SimpleForm.d.ts +1 -1
- package/components/SimpleForm/SimpleForm.js +54 -73
- package/components/SimpleForm/SimpleForm.js.map +1 -1
- package/components/SimpleForm/index.js +1 -3
- package/components/SimpleUI/InputField.js +71 -64
- package/components/SimpleUI/InputField.js.map +1 -1
- package/components/SingleImageUpload.d.ts +2 -2
- package/components/SingleImageUpload.js +37 -58
- package/components/SingleImageUpload.js.map +1 -1
- package/components/SplitView/SplitView.js +47 -57
- package/components/SplitView/SplitView.js.map +1 -1
- package/components/SplitView/index.js +1 -3
- package/components/TeamAutocomplete/graphql.js +3 -2
- package/components/TeamAutocomplete/graphql.js.map +1 -1
- package/components/TeamAutocomplete/index.d.ts +5 -3
- package/components/TeamAutocomplete/index.js +21 -13
- package/components/TeamAutocomplete/index.js.map +1 -1
- package/components/TeamsMultiAutocomplete/graphql.js +3 -2
- package/components/TeamsMultiAutocomplete/graphql.js.map +1 -1
- package/components/TeamsMultiAutocomplete/index.d.ts +5 -3
- package/components/TeamsMultiAutocomplete/index.js +21 -14
- package/components/TeamsMultiAutocomplete/index.js.map +1 -1
- package/components/Wcp.js +27 -38
- package/components/Wcp.js.map +1 -1
- package/components/index.js +10 -13
- package/config/AdminConfig/Dashboard.js +3 -2
- package/config/AdminConfig/Dashboard.js.map +1 -1
- package/config/AdminConfig/Dialog.js +15 -17
- package/config/AdminConfig/Dialog.js.map +1 -1
- package/config/AdminConfig/FieldRenderer.js +15 -17
- package/config/AdminConfig/FieldRenderer.js.map +1 -1
- package/config/AdminConfig/Form.js +4 -3
- package/config/AdminConfig/Form.js.map +1 -1
- package/config/AdminConfig/LayoutRenderer.js +15 -17
- package/config/AdminConfig/LayoutRenderer.js.map +1 -1
- package/config/AdminConfig/LexicalTheme/Color.js +34 -41
- package/config/AdminConfig/LexicalTheme/Color.js.map +1 -1
- package/config/AdminConfig/LexicalTheme/Typography.js +61 -74
- package/config/AdminConfig/LexicalTheme/Typography.js.map +1 -1
- package/config/AdminConfig/LexicalTheme.js +4 -3
- package/config/AdminConfig/LexicalTheme.js.map +1 -1
- package/config/AdminConfig/Logo.d.ts +1 -1
- package/config/AdminConfig/Logo.js +15 -17
- package/config/AdminConfig/Logo.js.map +1 -1
- package/config/AdminConfig/Menu/MenuGroup.d.ts +3 -3
- package/config/AdminConfig/Menu/MenuGroup.js +7 -9
- package/config/AdminConfig/Menu/MenuGroup.js.map +1 -1
- package/config/AdminConfig/Menu/MenuItem.d.ts +2 -2
- package/config/AdminConfig/Menu/MenuItem.js +5 -7
- package/config/AdminConfig/Menu/MenuItem.js.map +1 -1
- package/config/AdminConfig/Menu/MenuLink.d.ts +2 -2
- package/config/AdminConfig/Menu/MenuLink.js +12 -15
- package/config/AdminConfig/Menu/MenuLink.js.map +1 -1
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuItem.d.ts +2 -2
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuItem.js +6 -8
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuItem.js.map +1 -1
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuLink.d.ts +1 -1
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuLink.js +4 -6
- package/config/AdminConfig/Menu/SupportMenu/SupportMenuLink.js.map +1 -1
- package/config/AdminConfig/Menu/SupportMenu.d.ts +3 -3
- package/config/AdminConfig/Menu/SupportMenu.js +30 -41
- package/config/AdminConfig/Menu/SupportMenu.js.map +1 -1
- package/config/AdminConfig/Menu/UserMenu/UserMenuItem.js +4 -4
- package/config/AdminConfig/Menu/UserMenu/UserMenuItem.js.map +1 -1
- package/config/AdminConfig/Menu/UserMenu/UserMenuLink.js +4 -4
- package/config/AdminConfig/Menu/UserMenu/UserMenuLink.js.map +1 -1
- package/config/AdminConfig/Menu/UserMenu/UserMenuSeparator.js +0 -2
- package/config/AdminConfig/Menu/UserMenu/types.js +0 -3
- package/config/AdminConfig/Menu/UserMenu.d.ts +31 -31
- package/config/AdminConfig/Menu/UserMenu.js +39 -52
- package/config/AdminConfig/Menu/UserMenu.js.map +1 -1
- package/config/AdminConfig/Menu/types.js +0 -3
- package/config/AdminConfig/Menu.d.ts +42 -42
- package/config/AdminConfig/Menu.js +57 -73
- package/config/AdminConfig/Menu.js.map +1 -1
- package/config/AdminConfig/Route.js +4 -5
- package/config/AdminConfig/Route.js.map +1 -1
- package/config/AdminConfig/Security.js +3 -2
- package/config/AdminConfig/Security.js.map +1 -1
- package/config/AdminConfig/SecurityPermissions.js +20 -27
- package/config/AdminConfig/SecurityPermissions.js.map +1 -1
- package/config/AdminConfig/Tenant/TenantLogo.d.ts +1 -1
- package/config/AdminConfig/Tenant/TenantLogo.js +18 -20
- package/config/AdminConfig/Tenant/TenantLogo.js.map +1 -1
- package/config/AdminConfig/Tenant/TenantName.d.ts +1 -1
- package/config/AdminConfig/Tenant/TenantName.js +14 -15
- package/config/AdminConfig/Tenant/TenantName.js.map +1 -1
- package/config/AdminConfig/Tenant.js +6 -9
- package/config/AdminConfig/Tenant.js.map +1 -1
- package/config/AdminConfig/Theme/assignColor.js +51 -18
- package/config/AdminConfig/Theme/assignColor.js.map +1 -1
- package/config/AdminConfig/Theme/consts.js +20 -2
- package/config/AdminConfig/Theme/consts.js.map +1 -1
- package/config/AdminConfig/Theme/types.js +0 -3
- package/config/AdminConfig/Theme.js +8 -15
- package/config/AdminConfig/Theme.js.map +1 -1
- package/config/AdminConfig/Title.d.ts +1 -1
- package/config/AdminConfig/Title.js +11 -12
- package/config/AdminConfig/Title.js.map +1 -1
- package/config/AdminConfig/Widget.js +24 -31
- package/config/AdminConfig/Widget.js.map +1 -1
- package/config/AdminConfig.js +47 -59
- package/config/AdminConfig.js.map +1 -1
- package/config/createAdminConfig.js +55 -86
- package/config/createAdminConfig.js.map +1 -1
- package/domain/Identity.js +78 -88
- package/domain/Identity.js.map +1 -1
- package/errors/ErrorOverlayNetworkErrorHandler.js +37 -52
- package/errors/ErrorOverlayNetworkErrorHandler.js.map +1 -1
- package/errors/TenantIsDisabled.js +19 -20
- package/errors/TenantIsDisabled.js.map +1 -1
- package/exports/admin/build-params.js +0 -5
- package/exports/admin/configs.js +0 -2
- package/exports/admin/form.js +3 -18
- package/exports/admin/security.js +1 -7
- package/exports/admin/tenancy.js +0 -2
- package/exports/admin/ui.js +1 -4
- package/exports/admin.js +1 -4
- package/features/apolloClient/abstraction.js +2 -1
- package/features/apolloClient/abstraction.js.map +1 -1
- package/features/apolloClient/feature.js +22 -30
- package/features/apolloClient/feature.js.map +1 -1
- package/features/buildParams/BuildParams.js +20 -14
- package/features/buildParams/BuildParams.js.map +1 -1
- package/features/buildParams/abstractions.js +3 -2
- package/features/buildParams/abstractions.js.map +1 -1
- package/features/buildParams/feature.js +11 -10
- package/features/buildParams/feature.js.map +1 -1
- package/features/buildParams/index.js +0 -2
- package/features/formModel/ConditionRuleEvaluator.js +39 -46
- package/features/formModel/ConditionRuleEvaluator.js.map +1 -1
- package/features/formModel/Field.d.ts +1 -0
- package/features/formModel/Field.js +334 -411
- package/features/formModel/Field.js.map +1 -1
- package/features/formModel/FieldBuilder.d.ts +2 -1
- package/features/formModel/FieldBuilder.js +148 -171
- package/features/formModel/FieldBuilder.js.map +1 -1
- package/features/formModel/FieldBuilder.test.js +217 -201
- package/features/formModel/FieldBuilder.test.js.map +1 -1
- package/features/formModel/FieldBuilderRegistry.js +23 -25
- package/features/formModel/FieldBuilderRegistry.js.map +1 -1
- package/features/formModel/FocusManager.js +69 -95
- package/features/formModel/FocusManager.js.map +1 -1
- package/features/formModel/FormErrors.d.ts +9 -0
- package/features/formModel/FormErrors.js +35 -0
- package/features/formModel/FormErrors.js.map +1 -0
- package/features/formModel/FormModel.d.ts +2 -0
- package/features/formModel/FormModel.js +391 -396
- package/features/formModel/FormModel.js.map +1 -1
- package/features/formModel/FormModel.test.js +3791 -3354
- package/features/formModel/FormModel.test.js.map +1 -1
- package/features/formModel/FormModelFactory.js +27 -17
- package/features/formModel/FormModelFactory.js.map +1 -1
- package/features/formModel/FormView.d.ts +2 -1
- package/features/formModel/FormView.js +168 -156
- package/features/formModel/FormView.js.map +1 -1
- package/features/formModel/LayoutBuilderFactory.js +300 -370
- package/features/formModel/LayoutBuilderFactory.js.map +1 -1
- package/features/formModel/LayoutMutator.js +118 -125
- package/features/formModel/LayoutMutator.js.map +1 -1
- package/features/formModel/LayoutResolver.js +174 -214
- package/features/formModel/LayoutResolver.js.map +1 -1
- package/features/formModel/ObjectField.js +524 -724
- package/features/formModel/ObjectField.js.map +1 -1
- package/features/formModel/PresenterErrors.d.ts +9 -0
- package/features/formModel/PresenterErrors.js +32 -0
- package/features/formModel/PresenterErrors.js.map +1 -0
- package/features/formModel/Rules.test.js +311 -276
- package/features/formModel/Rules.test.js.map +1 -1
- package/features/formModel/abstractions.d.ts +10 -0
- package/features/formModel/abstractions.js +5 -114
- package/features/formModel/abstractions.js.map +1 -1
- package/features/formModel/createFieldRenderer.js +33 -10
- package/features/formModel/createFieldRenderer.js.map +1 -1
- package/features/formModel/demo/FieldRenderersDemoPresenter.js +289 -220
- package/features/formModel/demo/FieldRenderersDemoPresenter.js.map +1 -1
- package/features/formModel/demo/FormModelDemo.js +191 -215
- package/features/formModel/demo/FormModelDemo.js.map +1 -1
- package/features/formModel/demo/FormModelDemoPresenter.js +132 -113
- package/features/formModel/demo/FormModelDemoPresenter.js.map +1 -1
- package/features/formModel/demo/FormModelPhase11Presenter.js +101 -98
- package/features/formModel/demo/FormModelPhase11Presenter.js.map +1 -1
- package/features/formModel/demo/FormModelPhase8c1Presenter.js +64 -57
- package/features/formModel/demo/FormModelPhase8c1Presenter.js.map +1 -1
- package/features/formModel/feature.js +23 -22
- package/features/formModel/feature.js.map +1 -1
- package/features/formModel/fieldTypes/BooleanFieldType.js +18 -15
- package/features/formModel/fieldTypes/BooleanFieldType.js.map +1 -1
- package/features/formModel/fieldTypes/DateTimeFieldType.js +218 -341
- package/features/formModel/fieldTypes/DateTimeFieldType.js.map +1 -1
- package/features/formModel/fieldTypes/FileFieldType.d.ts +12 -1
- package/features/formModel/fieldTypes/FileFieldType.js +48 -12
- package/features/formModel/fieldTypes/FileFieldType.js.map +1 -1
- package/features/formModel/fieldTypes/FileUrlFieldType.js +15 -12
- package/features/formModel/fieldTypes/FileUrlFieldType.js.map +1 -1
- package/features/formModel/fieldTypes/NumberFieldType.js +19 -18
- package/features/formModel/fieldTypes/NumberFieldType.js.map +1 -1
- package/features/formModel/fieldTypes/ObjectFieldType.js +80 -94
- package/features/formModel/fieldTypes/ObjectFieldType.js.map +1 -1
- package/features/formModel/fieldTypes/TextFieldType.js +15 -12
- package/features/formModel/fieldTypes/TextFieldType.js.map +1 -1
- package/features/formModel/fieldTypes/index.js +7 -9
- package/features/formModel/index.d.ts +2 -0
- package/features/formModel/index.js +11 -29
- package/features/formModel/renderers.js +0 -4
- package/features/formModel/useFieldRenderers.js +10 -14
- package/features/formModel/useFieldRenderers.js.map +1 -1
- package/features/formModel/useLayoutRenderers.js +10 -14
- package/features/formModel/useLayoutRenderers.js.map +1 -1
- package/features/listCache/ListCache.d.ts +28 -0
- package/features/listCache/ListCache.js +48 -0
- package/features/listCache/ListCache.js.map +1 -0
- package/features/listCache/index.d.ts +2 -0
- package/features/listCache/index.js +1 -0
- package/features/security/AuthenticationContext/AuthenticationContext.js +27 -26
- package/features/security/AuthenticationContext/AuthenticationContext.js.map +1 -1
- package/features/security/AuthenticationContext/GraphQLClientDecorator.js +23 -22
- package/features/security/AuthenticationContext/GraphQLClientDecorator.js.map +1 -1
- package/features/security/AuthenticationContext/InternalIdTokenProvider.js +15 -12
- package/features/security/AuthenticationContext/InternalIdTokenProvider.js.map +1 -1
- package/features/security/AuthenticationContext/abstractions.js +3 -2
- package/features/security/AuthenticationContext/abstractions.js.map +1 -1
- package/features/security/AuthenticationContext/feature.js +15 -14
- package/features/security/AuthenticationContext/feature.js.map +1 -1
- package/features/security/AuthenticationContext/index.js +0 -2
- package/features/security/AuthenticationContext/types.js +0 -3
- package/features/security/IdentityContext/IdentityContext.js +18 -17
- package/features/security/IdentityContext/IdentityContext.js.map +1 -1
- package/features/security/IdentityContext/abstractions.js +2 -1
- package/features/security/IdentityContext/abstractions.js.map +1 -1
- package/features/security/IdentityContext/feature.js +13 -12
- package/features/security/IdentityContext/feature.js.map +1 -1
- package/features/security/IdentityContext/index.js +0 -2
- package/features/security/LogIn/IdentityMapper.js +8 -7
- package/features/security/LogIn/IdentityMapper.js.map +1 -1
- package/features/security/LogIn/LogInGateway.js +17 -19
- package/features/security/LogIn/LogInGateway.js.map +1 -1
- package/features/security/LogIn/LogInRepository.js +16 -14
- package/features/security/LogIn/LogInRepository.js.map +1 -1
- package/features/security/LogIn/LogInUseCase.js +23 -31
- package/features/security/LogIn/LogInUseCase.js.map +1 -1
- package/features/security/LogIn/abstractions.js +5 -16
- package/features/security/LogIn/abstractions.js.map +1 -1
- package/features/security/LogIn/createLoginMutation.js +2 -3
- package/features/security/LogIn/createLoginMutation.js.map +1 -1
- package/features/security/LogIn/feature.js +16 -15
- package/features/security/LogIn/feature.js.map +1 -1
- package/features/security/LogIn/index.js +0 -2
- package/features/security/LogOut/LogOutUseCase.js +18 -16
- package/features/security/LogOut/LogOutUseCase.js.map +1 -1
- package/features/security/LogOut/abstractions.js +2 -1
- package/features/security/LogOut/abstractions.js.map +1 -1
- package/features/security/LogOut/feature.js +12 -11
- package/features/security/LogOut/feature.js.map +1 -1
- package/features/security/LogOut/index.js +0 -2
- package/features/security/SecurityFeature.js +9 -8
- package/features/security/SecurityFeature.js.map +1 -1
- package/features/telemetry/TelemetryService.js +11 -12
- package/features/telemetry/TelemetryService.js.map +1 -1
- package/features/telemetry/abstractions.js +2 -1
- package/features/telemetry/abstractions.js.map +1 -1
- package/features/telemetry/feature.js +13 -12
- package/features/telemetry/feature.js.map +1 -1
- package/features/telemetry/index.js +0 -2
- package/features/tenancy/GraphQLClientDecorator.js +23 -20
- package/features/tenancy/GraphQLClientDecorator.js.map +1 -1
- package/features/tenancy/TenantContext.js +46 -50
- package/features/tenancy/TenantContext.js.map +1 -1
- package/features/tenancy/abstractions.js +2 -1
- package/features/tenancy/abstractions.js.map +1 -1
- package/features/tenancy/feature.js +25 -35
- package/features/tenancy/feature.js.map +1 -1
- package/features/tenancy/types.js +0 -3
- package/features/tools/LexicalContext/LexicalContext.js +20 -17
- package/features/tools/LexicalContext/LexicalContext.js.map +1 -1
- package/features/tools/LexicalContext/abstractions.js +2 -1
- package/features/tools/LexicalContext/abstractions.js.map +1 -1
- package/features/tools/LexicalContext/index.js +0 -2
- package/features/tools/ToolPipelineRunner.js +26 -24
- package/features/tools/ToolPipelineRunner.js.map +1 -1
- package/features/tools/ToolRegistry.js +32 -23
- package/features/tools/ToolRegistry.js.map +1 -1
- package/features/tools/abstractions.js +4 -3
- package/features/tools/abstractions.js.map +1 -1
- package/features/tools/feature.js +17 -16
- package/features/tools/feature.js.map +1 -1
- package/features/tools/index.js +1 -3
- package/features/wcp/ReactLicense.js +53 -52
- package/features/wcp/ReactLicense.js.map +1 -1
- package/features/wcp/WcpGateway.js +21 -20
- package/features/wcp/WcpGateway.js.map +1 -1
- package/features/wcp/WcpService.js +57 -67
- package/features/wcp/WcpService.js.map +1 -1
- package/features/wcp/abstractions.js +3 -2
- package/features/wcp/abstractions.js.map +1 -1
- package/features/wcp/feature.js +14 -13
- package/features/wcp/feature.js.map +1 -1
- package/features/wcp/types.js +0 -3
- package/features/webinySdk/WebinySdk.js +19 -18
- package/features/webinySdk/WebinySdk.js.map +1 -1
- package/features/webinySdk/abstractions.js +2 -5
- package/features/webinySdk/abstractions.js.map +1 -1
- package/features/webinySdk/feature.js +13 -12
- package/features/webinySdk/feature.js.map +1 -1
- package/features/webinySdk/index.js +0 -2
- package/hooks/index.js +0 -2
- package/hooks/useConfirmationDialog.d.ts +1 -1
- package/hooks/useConfirmationDialog.js +31 -38
- package/hooks/useConfirmationDialog.js.map +1 -1
- package/hooks/useDialog.js +14 -15
- package/hooks/useDialog.js.map +1 -1
- package/hooks/useHotkeys.js +52 -85
- package/hooks/useHotkeys.js.map +1 -1
- package/hooks/useIsMounted.js +12 -11
- package/hooks/useIsMounted.js.map +1 -1
- package/hooks/useKeyHandler.js +45 -53
- package/hooks/useKeyHandler.js.map +1 -1
- package/hooks/useModKey.js +20 -25
- package/hooks/useModKey.js.map +1 -1
- package/hooks/useOpenDialog.js +13 -13
- package/hooks/useOpenDialog.js.map +1 -1
- package/hooks/useShiftKey.d.ts +5 -1
- package/hooks/useShiftKey.js +38 -29
- package/hooks/useShiftKey.js.map +1 -1
- package/hooks/useSnackbar.d.ts +3 -0
- package/hooks/useSnackbar.js +26 -28
- package/hooks/useSnackbar.js.map +1 -1
- package/hooks/useStateIfMounted.js +14 -12
- package/hooks/useStateIfMounted.js.map +1 -1
- package/hooks/useStateWithCallback.js +18 -14
- package/hooks/useStateWithCallback.js.map +1 -1
- package/hooks/useToggler.js +12 -11
- package/hooks/useToggler.js.map +1 -1
- package/index.d.ts +4 -1
- package/index.js +15 -31
- package/package.json +29 -29
- package/permissions/PermissionRenderer.js +179 -193
- package/permissions/PermissionRenderer.js.map +1 -1
- package/permissions/PermissionValueContext.js +13 -20
- package/permissions/PermissionValueContext.js.map +1 -1
- package/permissions/createHasPermission.js +32 -40
- package/permissions/createHasPermission.js.map +1 -1
- package/permissions/createPermissionSchema.js +6 -5
- package/permissions/createPermissionSchema.js.map +1 -1
- package/permissions/createPermissions.js +125 -185
- package/permissions/createPermissions.js.map +1 -1
- package/permissions/createPermissions.test.js +190 -158
- package/permissions/createPermissions.test.js.map +1 -1
- package/permissions/index.js +2 -4
- package/permissions/types.js +0 -3
- package/permissions/usePermissionForm.js +133 -232
- package/permissions/usePermissionForm.js.map +1 -1
- package/permissions/usePermissions.js +6 -5
- package/permissions/usePermissions.js.map +1 -1
- package/plugins/MenuPlugin.js +15 -14
- package/plugins/MenuPlugin.js.map +1 -1
- package/presentation/browserFilePicker/BrowserFilePicker.d.ts +3 -0
- package/presentation/browserFilePicker/BrowserFilePicker.js +88 -0
- package/presentation/browserFilePicker/BrowserFilePicker.js.map +1 -0
- package/presentation/browserFilePicker/BrowserFilePickerPresenter.d.ts +10 -0
- package/presentation/browserFilePicker/BrowserFilePickerPresenter.js +84 -0
- package/presentation/browserFilePicker/BrowserFilePickerPresenter.js.map +1 -0
- package/presentation/browserFilePicker/index.d.ts +3 -0
- package/presentation/browserFilePicker/index.js +2 -0
- package/presentation/browserFilePicker/types.d.ts +53 -0
- package/presentation/browserFilePicker/types.js +0 -0
- package/presentation/browserFilePicker/utils.d.ts +2 -0
- package/presentation/browserFilePicker/utils.js +16 -0
- package/presentation/browserFilePicker/utils.js.map +1 -0
- package/presentation/buildParams/useBuildParams.js +2 -3
- package/presentation/buildParams/useBuildParams.js.map +1 -1
- package/presentation/installation/components/SystemInstaller/SystemInstaller.js +46 -53
- package/presentation/installation/components/SystemInstaller/SystemInstaller.js.map +1 -1
- package/presentation/installation/components/SystemInstaller/SystemInstallerProvider.js +9 -14
- package/presentation/installation/components/SystemInstaller/SystemInstallerProvider.js.map +1 -1
- package/presentation/installation/components/SystemInstaller/index.js +0 -2
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep/createPasswordValidator.js +14 -29
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep/createPasswordValidator.js.map +1 -1
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep/usePasswordValidator.js +11 -10
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep/usePasswordValidator.js.map +1 -1
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep.js +60 -60
- package/presentation/installation/components/SystemInstaller/steps/AdminUserStep.js.map +1 -1
- package/presentation/installation/components/SystemInstaller/steps/BasicInfoStep.js +75 -85
- package/presentation/installation/components/SystemInstaller/steps/BasicInfoStep.js.map +1 -1
- package/presentation/installation/components/SystemInstaller/steps/Center.js +5 -8
- package/presentation/installation/components/SystemInstaller/steps/Center.js.map +1 -1
- package/presentation/installation/components/SystemInstaller/steps/Container.js +18 -24
- package/presentation/installation/components/SystemInstaller/steps/Container.js.map +1 -1
- package/presentation/installation/components/SystemInstaller/steps/FinishSetup.js +48 -53
- package/presentation/installation/components/SystemInstaller/steps/FinishSetup.js.map +1 -1
- package/presentation/installation/components/SystemInstaller/steps/IntroductionStep.js +13 -16
- package/presentation/installation/components/SystemInstaller/steps/IntroductionStep.js.map +1 -1
- package/presentation/installation/components/SystemInstaller/steps/introduction.js +723 -0
- package/presentation/installation/components/SystemInstaller/steps/introduction.js.map +1 -0
- package/presentation/installation/components/SystemInstaller/steps/referralSources.js +14 -1
- package/presentation/installation/components/SystemInstaller/steps/referralSources.js.map +1 -1
- package/presentation/installation/presenters/SystemInstaller/SystemInstallerGateway.js +27 -28
- package/presentation/installation/presenters/SystemInstaller/SystemInstallerGateway.js.map +1 -1
- package/presentation/installation/presenters/SystemInstaller/SystemInstallerPresenter.js +117 -124
- package/presentation/installation/presenters/SystemInstaller/SystemInstallerPresenter.js.map +1 -1
- package/presentation/installation/presenters/SystemInstaller/SystemInstallerRepository.js +23 -21
- package/presentation/installation/presenters/SystemInstaller/SystemInstallerRepository.js.map +1 -1
- package/presentation/installation/presenters/SystemInstaller/abstractions.js +4 -3
- package/presentation/installation/presenters/SystemInstaller/abstractions.js.map +1 -1
- package/presentation/installation/presenters/SystemInstaller/feature.js +15 -14
- package/presentation/installation/presenters/SystemInstaller/feature.js.map +1 -1
- package/presentation/installation/presenters/SystemInstaller/index.js +0 -2
- package/presentation/lexicalContext/useLexicalContext.js +11 -8
- package/presentation/lexicalContext/useLexicalContext.js.map +1 -1
- package/presentation/listPresenter/ListPresenter.d.ts +30 -0
- package/presentation/listPresenter/ListPresenter.js +216 -0
- package/presentation/listPresenter/ListPresenter.js.map +1 -0
- package/presentation/listPresenter/ListPresenter.test.d.ts +1 -0
- package/presentation/listPresenter/ListPresenter.test.js +816 -0
- package/presentation/listPresenter/ListPresenter.test.js.map +1 -0
- package/presentation/listPresenter/SelectionController.d.ts +21 -0
- package/presentation/listPresenter/SelectionController.js +74 -0
- package/presentation/listPresenter/SelectionController.js.map +1 -0
- package/presentation/listPresenter/abstractions.d.ts +107 -0
- package/presentation/listPresenter/abstractions.js +5 -0
- package/presentation/listPresenter/abstractions.js.map +1 -0
- package/presentation/listPresenter/feature.d.ts +3 -0
- package/presentation/listPresenter/feature.js +17 -0
- package/presentation/listPresenter/feature.js.map +1 -0
- package/presentation/listPresenter/index.d.ts +3 -0
- package/presentation/listPresenter/index.js +2 -0
- package/presentation/security/components/HasPermission.js +15 -25
- package/presentation/security/components/HasPermission.js.map +1 -1
- package/presentation/security/components/SecureRoute.js +6 -12
- package/presentation/security/components/SecureRoute.js.map +1 -1
- package/presentation/security/hooks/useAuthentication.js +11 -17
- package/presentation/security/hooks/useAuthentication.js.map +1 -1
- package/presentation/security/hooks/useIdentity.js +19 -18
- package/presentation/security/hooks/useIdentity.js.map +1 -1
- package/presentation/security/hooks/useSecurity.js +14 -24
- package/presentation/security/hooks/useSecurity.js.map +1 -1
- package/presentation/tenancy/TenancyProvider.js +23 -36
- package/presentation/tenancy/TenancyProvider.js.map +1 -1
- package/presentation/tenancy/createTenancyProvider.js +6 -11
- package/presentation/tenancy/createTenancyProvider.js.map +1 -1
- package/presentation/tenancy/useTenantContext.js +17 -18
- package/presentation/tenancy/useTenantContext.js.map +1 -1
- package/presentation/textToLexicalTool/TextToLexicalTool.js +20 -18
- package/presentation/textToLexicalTool/TextToLexicalTool.js.map +1 -1
- package/presentation/textToLexicalTool/feature.js +6 -5
- package/presentation/textToLexicalTool/feature.js.map +1 -1
- package/presentation/textToLexicalTool/textToLexicalState.js +28 -28
- package/presentation/textToLexicalTool/textToLexicalState.js.map +1 -1
- package/presentation/wcp/WcpProvider.js +16 -26
- package/presentation/wcp/WcpProvider.js.map +1 -1
- package/presentation/wcp/useWcp.js +11 -12
- package/presentation/wcp/useWcp.js.map +1 -1
- package/routes.d.ts +0 -1
- package/routes.js +14 -17
- package/routes.js.map +1 -1
- package/static/svg/SecureRouteError.e8b15981.svg +1 -0
- package/static/svg/add-18px.b3062af6.svg +3 -0
- package/static/svg/arrow_drop_down-24px.da74d713.svg +4 -0
- package/static/svg/attach_file_black_24dp.7fb13a7e.svg +1 -0
- package/static/svg/baseline-menu-24px.071b179d.svg +4 -0
- package/static/svg/baseline-notification_important-24px.29277e73.svg +4 -0
- package/static/svg/baseline-security-24px.12e519cc.svg +4 -0
- package/static/svg/file_download.afe3fbec.svg +1 -0
- package/static/svg/file_upload.6865d820.svg +1 -0
- package/static/svg/filter-24px.886d9ff0.svg +8 -0
- package/static/svg/github-brands.6311f0fa.svg +1 -0
- package/static/svg/highlight-24px.959a97f7.svg +1 -0
- package/static/svg/icon-community.cd087355.svg +16 -0
- package/static/svg/icon-documentation.a189d24c.svg +16 -0
- package/static/svg/info.fe810b72.svg +1 -0
- package/static/svg/insert_drive_file-24px.39d490eb.svg +1 -0
- package/static/svg/insert_photo-24px.81a5f945.svg +1 -0
- package/static/svg/introduction.108720aa.svg +154 -0
- package/static/svg/label-24px.9deafa4f.svg +1 -0
- package/static/svg/round-account_circle-24px.f0b48cb7.svg +1 -0
- package/static/svg/round-add-24px.4a5219b4.svg +16 -0
- package/static/svg/round-arrow_drop_down-24px.5fdf92d1.svg +1 -0
- package/static/svg/round-chevron_right-24px.34936511.svg +12 -0
- package/static/svg/round-feedback-24px.4dae7231.svg +54 -0
- package/static/svg/round-help-24px.a61b1d66.svg +1 -0
- package/static/svg/round-invert_colors-24px.a229a1dd.svg +52 -0
- package/static/svg/round-keyboard_arrow_down-24px.6febe804.svg +16 -0
- package/static/svg/round-keyboard_arrow_up-24px.b1f7db34.svg +16 -0
- package/static/svg/round-lock_open-24px.d527f6a5.svg +60 -0
- package/static/svg/round-more_vert-24px.68d41b07.svg +12 -0
- package/static/svg/round-open_in_new-24px.be5b4ddd.svg +44 -0
- package/static/svg/round-settings-24px.c0b3056f.svg +4 -0
- package/static/svg/search-24px.3c0f88dd.svg +20 -0
- package/static/svg/slack-logo.7ee35e7f.svg +1 -0
- package/static/svg/today-24px.df206362.svg +1 -0
- package/static/svg/touch_app.debf3744.svg +1 -0
- package/static/svg/wby-horizontal.03327bf6.svg +23 -0
- package/static/svg/wby-square.ff8f47c3.svg +3 -0
- package/static/svg/webiny-logo.ef56725c.svg +20 -0
- package/static/svg/webiny-orange-logo.4eccf0f2.svg +20 -0
- package/types.js +0 -3
- package/components/BulkActions/index.js.map +0 -1
- package/components/BulkActions/useDialogWithReport/index.js.map +0 -1
- package/components/Buttons/index.js.map +0 -1
- package/components/DeveloperMode/index.js.map +0 -1
- package/components/Filters/index.js.map +0 -1
- package/components/IconPicker/components/index.js.map +0 -1
- package/components/IconPicker/index.js.map +0 -1
- package/components/LexicalEditor/index.js.map +0 -1
- package/components/NotAuthorizedError/index.js.map +0 -1
- package/components/OptionsMenu/index.js.map +0 -1
- package/components/OverlayLayout/components/index.js.map +0 -1
- package/components/OverlayLayout/index.js.map +0 -1
- package/components/Permissions/index.js.map +0 -1
- package/components/ResizablePanels/index.js.map +0 -1
- package/components/SimpleForm/index.js.map +0 -1
- package/components/SplitView/index.js.map +0 -1
- package/components/index.js.map +0 -1
- package/config/AdminConfig/Menu/UserMenu/UserMenuSeparator.js.map +0 -1
- package/config/AdminConfig/Menu/UserMenu/types.js.map +0 -1
- package/config/AdminConfig/Menu/types.js.map +0 -1
- package/config/AdminConfig/Theme/types.js.map +0 -1
- package/exports/admin/build-params.js.map +0 -1
- package/exports/admin/configs.js.map +0 -1
- package/exports/admin/form.js.map +0 -1
- package/exports/admin/security.js.map +0 -1
- package/exports/admin/tenancy.js.map +0 -1
- package/exports/admin/ui.js.map +0 -1
- package/exports/admin.js.map +0 -1
- package/features/buildParams/index.js.map +0 -1
- package/features/formModel/fieldTypes/index.js.map +0 -1
- package/features/formModel/index.js.map +0 -1
- package/features/formModel/renderers.js.map +0 -1
- package/features/security/AuthenticationContext/index.js.map +0 -1
- package/features/security/AuthenticationContext/types.js.map +0 -1
- package/features/security/IdentityContext/index.js.map +0 -1
- package/features/security/LogIn/index.js.map +0 -1
- package/features/security/LogOut/index.js.map +0 -1
- package/features/telemetry/index.js.map +0 -1
- package/features/tenancy/types.js.map +0 -1
- package/features/tools/LexicalContext/index.js.map +0 -1
- package/features/tools/index.js.map +0 -1
- package/features/wcp/types.js.map +0 -1
- package/features/webinySdk/index.js.map +0 -1
- package/hooks/index.js.map +0 -1
- package/index.js.map +0 -1
- package/permissions/index.js.map +0 -1
- package/permissions/types.js.map +0 -1
- package/presentation/installation/components/SystemInstaller/index.js.map +0 -1
- package/presentation/installation/presenters/SystemInstaller/index.js.map +0 -1
- package/types.js.map +0 -1
|
@@ -1,256 +1,157 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
|
2
2
|
function hasAction(entity, name) {
|
|
3
|
-
|
|
3
|
+
return entity.actions?.some((a)=>a.name === name) ?? false;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
/** Resolve fullAccess config into a concrete Permission object. */
|
|
7
5
|
function resolveFullAccess(schema) {
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const name = `${schema.prefix}.*`;
|
|
7
|
+
if (true === schema.fullAccess) return {
|
|
8
|
+
name
|
|
9
|
+
};
|
|
10
10
|
return {
|
|
11
|
-
|
|
11
|
+
name,
|
|
12
|
+
...schema.fullAccess
|
|
12
13
|
};
|
|
13
|
-
}
|
|
14
|
-
return {
|
|
15
|
-
name,
|
|
16
|
-
...schema.fullAccess
|
|
17
|
-
};
|
|
18
14
|
}
|
|
19
|
-
|
|
20
|
-
/** Resolve readOnlyAccess config into a concrete Permission[]. */
|
|
21
15
|
function resolveReadOnlyAccess(schema) {
|
|
22
|
-
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
return schema.readOnlyAccess;
|
|
16
|
+
if (!schema.readOnlyAccess) return;
|
|
17
|
+
if (true === schema.readOnlyAccess) return [
|
|
18
|
+
{
|
|
19
|
+
name: `${schema.prefix}.*`,
|
|
20
|
+
rwd: "r"
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
return schema.readOnlyAccess;
|
|
32
24
|
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Deserialize Permission[] into form data based on the schema.
|
|
36
|
-
*/
|
|
37
25
|
function deserializePermissions(schema, value) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
accessLevel: "no"
|
|
26
|
+
if (!Array.isArray(value)) return {
|
|
27
|
+
accessLevel: "no"
|
|
41
28
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// Check for read-only access by looking for the synthetic marker permission.
|
|
45
|
-
if (value.some(p => p.name === `$${schema.prefix}.readonly`)) {
|
|
46
|
-
return {
|
|
47
|
-
accessLevel: "read-only"
|
|
29
|
+
if (value.some((p)=>p.name === `$${schema.prefix}.readonly`)) return {
|
|
30
|
+
accessLevel: "read-only"
|
|
48
31
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const hasFullAccess = value.some(p => p.name === "*" || p.name === fullAccessName);
|
|
54
|
-
if (hasFullAccess) {
|
|
55
|
-
return {
|
|
56
|
-
accessLevel: "full"
|
|
32
|
+
const fullAccessName = `${schema.prefix}.*`;
|
|
33
|
+
const hasFullAccess = value.some((p)=>"*" === p.name || p.name === fullAccessName);
|
|
34
|
+
if (hasFullAccess) return {
|
|
35
|
+
accessLevel: "full"
|
|
57
36
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const ownPermissions = value.filter(p => p.name.startsWith(schema.prefix));
|
|
62
|
-
if (ownPermissions.length === 0) {
|
|
63
|
-
return {
|
|
64
|
-
accessLevel: "no"
|
|
37
|
+
const ownPermissions = value.filter((p)=>p.name.startsWith(schema.prefix));
|
|
38
|
+
if (0 === ownPermissions.length) return {
|
|
39
|
+
accessLevel: "no"
|
|
65
40
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// Access scope: "own" if perm.own === true, else "full".
|
|
80
|
-
if (perm.own === true) {
|
|
81
|
-
data[`${entity.id}AccessScope`] = "own";
|
|
82
|
-
} else {
|
|
83
|
-
data[`${entity.id}AccessScope`] = "full";
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Process actions.
|
|
87
|
-
for (const action of entity.actions ?? []) {
|
|
88
|
-
if (action.name === "rwd") {
|
|
89
|
-
data[`${entity.id}RWD`] = perm.rwd || "r";
|
|
90
|
-
} else if (action.name === "pw") {
|
|
91
|
-
data[`${entity.id}PW`] = perm.pw ? perm.pw.split("") : [];
|
|
92
|
-
} else {
|
|
93
|
-
// Custom boolean action.
|
|
94
|
-
data[`${entity.id}Action_${action.name}`] = perm[action.name] === true;
|
|
95
|
-
}
|
|
41
|
+
const data = {
|
|
42
|
+
accessLevel: "custom"
|
|
43
|
+
};
|
|
44
|
+
const entities = schema.entities || [];
|
|
45
|
+
for (const entity of entities){
|
|
46
|
+
const perm = ownPermissions.find((p)=>p.name === entity.permission);
|
|
47
|
+
if (perm) {
|
|
48
|
+
if (true === perm.own) data[`${entity.id}AccessScope`] = "own";
|
|
49
|
+
else data[`${entity.id}AccessScope`] = "full";
|
|
50
|
+
for (const action of entity.actions ?? [])if ("rwd" === action.name) data[`${entity.id}RWD`] = perm.rwd || "r";
|
|
51
|
+
else if ("pw" === action.name) data[`${entity.id}PW`] = perm.pw ? perm.pw.split("") : [];
|
|
52
|
+
else data[`${entity.id}Action_${action.name}`] = true === perm[action.name];
|
|
53
|
+
}
|
|
96
54
|
}
|
|
97
|
-
|
|
98
|
-
return data;
|
|
55
|
+
return data;
|
|
99
56
|
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Serialize form data into Permission[] based on the schema.
|
|
103
|
-
*/
|
|
104
57
|
function serializePermissions(schema, formData, currentValue) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (!scope || scope === "no") {
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
let resolvedScope = scope;
|
|
136
|
-
|
|
137
|
-
// If this entity depends on a parent and the parent scope is "own",
|
|
138
|
-
// force this entity's scope to "own" as well.
|
|
139
|
-
if (entity.dependsOn) {
|
|
140
|
-
const parentScope = resolvedScopes.get(entity.dependsOn.entity);
|
|
141
|
-
if (parentScope === "own") {
|
|
142
|
-
resolvedScope = "own";
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
resolvedScopes.set(entity.id, resolvedScope);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Prune resolved scopes based on dependencies (must run before building permissions
|
|
149
|
-
// so that transitive dependencies are properly pruned).
|
|
150
|
-
for (const entity of entities) {
|
|
151
|
-
if (!entity.dependsOn || !resolvedScopes.has(entity.id)) {
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
const parentScope = resolvedScopes.get(entity.dependsOn.entity);
|
|
155
|
-
if (!parentScope) {
|
|
156
|
-
// Parent entity is not enabled — prune child.
|
|
157
|
-
resolvedScopes.delete(entity.id);
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
const parentEntity = entityMap.get(entity.dependsOn.entity);
|
|
161
|
-
if (parentEntity && hasAction(parentEntity, "rwd")) {
|
|
162
|
-
const parentRwd = parentScope === "own" ? "rwd" : formData[`${entity.dependsOn.entity}RWD`] || "r";
|
|
163
|
-
if (!parentRwd.includes(entity.dependsOn.requires)) {
|
|
164
|
-
// Parent doesn't have the required action — prune child.
|
|
165
|
-
resolvedScopes.delete(entity.id);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Build permissions from the pruned resolved scopes.
|
|
171
|
-
const permissions = [];
|
|
172
|
-
for (const entity of entities) {
|
|
173
|
-
const scope = resolvedScopes.get(entity.id);
|
|
174
|
-
if (!scope) {
|
|
175
|
-
continue;
|
|
176
|
-
}
|
|
177
|
-
const perm = {
|
|
178
|
-
name: entity.permission
|
|
179
|
-
};
|
|
180
|
-
if (scope === "own") {
|
|
181
|
-
perm.own = true;
|
|
182
|
-
if (hasAction(entity, "rwd")) {
|
|
183
|
-
perm.rwd = "rwd";
|
|
184
|
-
}
|
|
185
|
-
} else if (hasAction(entity, "rwd")) {
|
|
186
|
-
perm.rwd = formData[`${entity.id}RWD`] || "r";
|
|
58
|
+
const filtered = Array.isArray(currentValue) ? currentValue.filter((p)=>!p.name.startsWith(schema.prefix) && !p.name.startsWith(`$${schema.prefix}`)) : [];
|
|
59
|
+
if ("no" === formData.accessLevel || !formData.accessLevel) return filtered;
|
|
60
|
+
if ("full" === formData.accessLevel) return [
|
|
61
|
+
...filtered,
|
|
62
|
+
resolveFullAccess(schema)
|
|
63
|
+
];
|
|
64
|
+
const readOnlyPermissions = resolveReadOnlyAccess(schema);
|
|
65
|
+
if ("read-only" === formData.accessLevel && readOnlyPermissions) return [
|
|
66
|
+
...filtered,
|
|
67
|
+
{
|
|
68
|
+
name: `$${schema.prefix}.readonly`
|
|
69
|
+
},
|
|
70
|
+
...readOnlyPermissions
|
|
71
|
+
];
|
|
72
|
+
const entities = schema.entities || [];
|
|
73
|
+
const entityMap = new Map();
|
|
74
|
+
for (const entity of entities)entityMap.set(entity.id, entity);
|
|
75
|
+
const resolvedScopes = new Map();
|
|
76
|
+
for (const entity of entities){
|
|
77
|
+
const scope = formData[`${entity.id}AccessScope`];
|
|
78
|
+
if (!scope || "no" === scope) continue;
|
|
79
|
+
let resolvedScope = scope;
|
|
80
|
+
if (entity.dependsOn) {
|
|
81
|
+
const parentScope = resolvedScopes.get(entity.dependsOn.entity);
|
|
82
|
+
if ("own" === parentScope) resolvedScope = "own";
|
|
83
|
+
}
|
|
84
|
+
resolvedScopes.set(entity.id, resolvedScope);
|
|
187
85
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
if (action.name === "pw") {
|
|
195
|
-
const pw = formData[`${entity.id}PW`] || [];
|
|
196
|
-
if (pw.length > 0) {
|
|
197
|
-
perm.pw = pw.join("");
|
|
86
|
+
for (const entity of entities){
|
|
87
|
+
if (!entity.dependsOn || !resolvedScopes.has(entity.id)) continue;
|
|
88
|
+
const parentScope = resolvedScopes.get(entity.dependsOn.entity);
|
|
89
|
+
if (!parentScope) {
|
|
90
|
+
resolvedScopes.delete(entity.id);
|
|
91
|
+
continue;
|
|
198
92
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
93
|
+
const parentEntity = entityMap.get(entity.dependsOn.entity);
|
|
94
|
+
if (parentEntity && hasAction(parentEntity, "rwd")) {
|
|
95
|
+
const parentRwd = "own" === parentScope ? "rwd" : formData[`${entity.dependsOn.entity}RWD`] || "r";
|
|
96
|
+
if (!parentRwd.includes(entity.dependsOn.requires)) resolvedScopes.delete(entity.id);
|
|
203
97
|
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
permissions.push(perm);
|
|
207
|
-
}
|
|
208
|
-
return [...filtered, ...permissions];
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Hook that bridges a permission schema with a Form component.
|
|
213
|
-
*
|
|
214
|
-
* Handles bidirectional transformation between Permission[] and form data,
|
|
215
|
-
* with optional custom serialize/deserialize callbacks for app-specific needs.
|
|
216
|
-
*/
|
|
217
|
-
export function usePermissionForm(schema, options) {
|
|
218
|
-
const {
|
|
219
|
-
value,
|
|
220
|
-
onChange
|
|
221
|
-
} = options;
|
|
222
|
-
const formData = useMemo(() => {
|
|
223
|
-
let data = deserializePermissions(schema, value);
|
|
224
|
-
|
|
225
|
-
// Merge custom deserialized data if provided.
|
|
226
|
-
if (options.deserialize) {
|
|
227
|
-
const extra = options.deserialize(Array.isArray(value) ? value : []);
|
|
228
|
-
data = {
|
|
229
|
-
...data,
|
|
230
|
-
...extra
|
|
231
|
-
};
|
|
232
98
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
99
|
+
const permissions = [];
|
|
100
|
+
for (const entity of entities){
|
|
101
|
+
const scope = resolvedScopes.get(entity.id);
|
|
102
|
+
if (!scope) continue;
|
|
103
|
+
const perm = {
|
|
104
|
+
name: entity.permission
|
|
105
|
+
};
|
|
106
|
+
if ("own" === scope) {
|
|
107
|
+
perm.own = true;
|
|
108
|
+
if (hasAction(entity, "rwd")) perm.rwd = "rwd";
|
|
109
|
+
} else if (hasAction(entity, "rwd")) perm.rwd = formData[`${entity.id}RWD`] || "r";
|
|
110
|
+
for (const action of entity.actions ?? [])if ("rwd" !== action.name) {
|
|
111
|
+
if ("pw" === action.name) {
|
|
112
|
+
const pw = formData[`${entity.id}PW`] || [];
|
|
113
|
+
if (pw.length > 0) perm.pw = pw.join("");
|
|
114
|
+
} else if (formData[`${entity.id}Action_${action.name}`]) perm[action.name] = true;
|
|
115
|
+
}
|
|
116
|
+
permissions.push(perm);
|
|
244
117
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
onFormChange
|
|
250
|
-
};
|
|
118
|
+
return [
|
|
119
|
+
...filtered,
|
|
120
|
+
...permissions
|
|
121
|
+
];
|
|
251
122
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
123
|
+
function usePermissionForm(schema, options) {
|
|
124
|
+
const { value, onChange } = options;
|
|
125
|
+
const formData = useMemo(()=>{
|
|
126
|
+
let data = deserializePermissions(schema, value);
|
|
127
|
+
if (options.deserialize) {
|
|
128
|
+
const extra = options.deserialize(Array.isArray(value) ? value : []);
|
|
129
|
+
data = {
|
|
130
|
+
...data,
|
|
131
|
+
...extra
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return data;
|
|
135
|
+
}, []);
|
|
136
|
+
const onFormChange = useCallback((data)=>{
|
|
137
|
+
let result = serializePermissions(schema, data, value);
|
|
138
|
+
if (options.serialize) {
|
|
139
|
+
result = options.serialize(data, result.filter((p)=>p.name.startsWith(schema.prefix)));
|
|
140
|
+
const nonSchemaPermissions = Array.isArray(value) ? value.filter((p)=>!p.name.startsWith(schema.prefix) && !p.name.startsWith(`$${schema.prefix}`)) : [];
|
|
141
|
+
result = [
|
|
142
|
+
...nonSchemaPermissions,
|
|
143
|
+
...result
|
|
144
|
+
];
|
|
145
|
+
}
|
|
146
|
+
onChange(result);
|
|
147
|
+
}, [
|
|
148
|
+
value
|
|
149
|
+
]);
|
|
150
|
+
return {
|
|
151
|
+
formData,
|
|
152
|
+
onFormChange
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export { deserializePermissions, serializePermissions, usePermissionForm };
|
|
255
156
|
|
|
256
157
|
//# sourceMappingURL=usePermissionForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","useCallback","hasAction","entity","name","actions","some","a","resolveFullAccess","schema","prefix","fullAccess","resolveReadOnlyAccess","readOnlyAccess","undefined","rwd","deserializePermissions","value","Array","isArray","accessLevel","p","fullAccessName","hasFullAccess","ownPermissions","filter","startsWith","length","data","entities","perm","find","permission","own","id","action","pw","split","serializePermissions","formData","currentValue","filtered","readOnlyPermissions","entityMap","Map","set","resolvedScopes","scope","resolvedScope","dependsOn","parentScope","get","has","delete","parentEntity","parentRwd","includes","requires","permissions","join","push","usePermissionForm","options","onChange","deserialize","extra","onFormChange","result","serialize","nonSchemaPermissions"],"sources":["usePermissionForm.ts"],"sourcesContent":["import { useMemo, useCallback } from \"react\";\nimport type {\n Permission,\n PermissionSchema,\n EntityDefinition,\n UsePermissionFormOptions,\n UsePermissionFormResult\n} from \"./types.js\";\n\nfunction hasAction(entity: EntityDefinition, name: string): boolean {\n return entity.actions?.some(a => a.name === name) ?? false;\n}\n\n/** Resolve fullAccess config into a concrete Permission object. */\nfunction resolveFullAccess(schema: PermissionSchema): Permission {\n const name = `${schema.prefix}.*`;\n if (schema.fullAccess === true) {\n return { name };\n }\n return { name, ...schema.fullAccess };\n}\n\n/** Resolve readOnlyAccess config into a concrete Permission[]. */\nfunction resolveReadOnlyAccess(schema: PermissionSchema): Permission[] | undefined {\n if (!schema.readOnlyAccess) {\n return undefined;\n }\n if (schema.readOnlyAccess === true) {\n return [{ name: `${schema.prefix}.*`, rwd: \"r\" }];\n }\n return schema.readOnlyAccess;\n}\n\n/**\n * Deserialize Permission[] into form data based on the schema.\n */\nfunction deserializePermissions(\n schema: PermissionSchema,\n value: Permission[]\n): Record<string, any> {\n if (!Array.isArray(value)) {\n return { accessLevel: \"no\" };\n }\n\n // Check for read-only access by looking for the synthetic marker permission.\n if (value.some(p => p.name === `$${schema.prefix}.readonly`)) {\n return { accessLevel: \"read-only\" };\n }\n\n // Check for full access: either wildcard or the schema's fullAccess permission.\n const fullAccessName = `${schema.prefix}.*`;\n const hasFullAccess = value.some(p => p.name === \"*\" || p.name === fullAccessName);\n if (hasFullAccess) {\n return { accessLevel: \"full\" };\n }\n\n // Filter permissions that belong to this schema's prefix.\n const ownPermissions = value.filter(p => p.name.startsWith(schema.prefix));\n if (ownPermissions.length === 0) {\n return { accessLevel: \"no\" };\n }\n\n // Custom access level — extract per-entity form fields.\n const data: Record<string, any> = { accessLevel: \"custom\" };\n const entities = schema.entities || [];\n\n for (const entity of entities) {\n const perm = ownPermissions.find(p => p.name === entity.permission);\n if (!perm) {\n continue;\n }\n\n // Access scope: \"own\" if perm.own === true, else \"full\".\n if (perm.own === true) {\n data[`${entity.id}AccessScope`] = \"own\";\n } else {\n data[`${entity.id}AccessScope`] = \"full\";\n }\n\n // Process actions.\n for (const action of entity.actions ?? []) {\n if (action.name === \"rwd\") {\n data[`${entity.id}RWD`] = perm.rwd || \"r\";\n } else if (action.name === \"pw\") {\n data[`${entity.id}PW`] = perm.pw ? perm.pw.split(\"\") : [];\n } else {\n // Custom boolean action.\n data[`${entity.id}Action_${action.name}`] = perm[action.name] === true;\n }\n }\n }\n\n return data;\n}\n\n/**\n * Serialize form data into Permission[] based on the schema.\n */\nfunction serializePermissions(\n schema: PermissionSchema,\n formData: Record<string, any>,\n currentValue: Permission[]\n): Permission[] {\n // Start by filtering out all permissions belonging to this schema's prefix.\n const filtered = Array.isArray(currentValue)\n ? currentValue.filter(\n p => !p.name.startsWith(schema.prefix) && !p.name.startsWith(`$${schema.prefix}`)\n )\n : [];\n\n if (formData.accessLevel === \"no\" || !formData.accessLevel) {\n return filtered;\n }\n\n if (formData.accessLevel === \"full\") {\n return [...filtered, resolveFullAccess(schema)];\n }\n\n const readOnlyPermissions = resolveReadOnlyAccess(schema);\n if (formData.accessLevel === \"read-only\" && readOnlyPermissions) {\n return [...filtered, { name: `$${schema.prefix}.readonly` }, ...readOnlyPermissions];\n }\n\n const entities = schema.entities || [];\n\n // Custom access — build entity permissions.\n // First, build a map of entity definitions by ID for dependency lookups.\n const entityMap = new Map<string, EntityDefinition>();\n for (const entity of entities) {\n entityMap.set(entity.id, entity);\n }\n\n // Resolve cascading \"own\" scopes: if a parent is \"own\", children must be \"own\" too.\n const resolvedScopes = new Map<string, string>();\n for (const entity of entities) {\n const scope = formData[`${entity.id}AccessScope`];\n if (!scope || scope === \"no\") {\n continue;\n }\n\n let resolvedScope = scope;\n\n // If this entity depends on a parent and the parent scope is \"own\",\n // force this entity's scope to \"own\" as well.\n if (entity.dependsOn) {\n const parentScope = resolvedScopes.get(entity.dependsOn.entity);\n if (parentScope === \"own\") {\n resolvedScope = \"own\";\n }\n }\n\n resolvedScopes.set(entity.id, resolvedScope);\n }\n\n // Prune resolved scopes based on dependencies (must run before building permissions\n // so that transitive dependencies are properly pruned).\n for (const entity of entities) {\n if (!entity.dependsOn || !resolvedScopes.has(entity.id)) {\n continue;\n }\n\n const parentScope = resolvedScopes.get(entity.dependsOn.entity);\n if (!parentScope) {\n // Parent entity is not enabled — prune child.\n resolvedScopes.delete(entity.id);\n continue;\n }\n\n const parentEntity = entityMap.get(entity.dependsOn.entity);\n if (parentEntity && hasAction(parentEntity, \"rwd\")) {\n const parentRwd =\n parentScope === \"own\" ? \"rwd\" : formData[`${entity.dependsOn.entity}RWD`] || \"r\";\n if (!parentRwd.includes(entity.dependsOn.requires)) {\n // Parent doesn't have the required action — prune child.\n resolvedScopes.delete(entity.id);\n }\n }\n }\n\n // Build permissions from the pruned resolved scopes.\n const permissions: Permission[] = [];\n\n for (const entity of entities) {\n const scope = resolvedScopes.get(entity.id);\n if (!scope) {\n continue;\n }\n\n const perm: Permission = {\n name: entity.permission\n };\n\n if (scope === \"own\") {\n perm.own = true;\n if (hasAction(entity, \"rwd\")) {\n perm.rwd = \"rwd\";\n }\n } else if (hasAction(entity, \"rwd\")) {\n perm.rwd = formData[`${entity.id}RWD`] || \"r\";\n }\n\n // Process non-rwd actions.\n for (const action of entity.actions ?? []) {\n if (action.name === \"rwd\") {\n continue; // Already handled above.\n }\n\n if (action.name === \"pw\") {\n const pw: string[] = formData[`${entity.id}PW`] || [];\n if (pw.length > 0) {\n perm.pw = pw.join(\"\");\n }\n } else {\n // Custom boolean action.\n if (formData[`${entity.id}Action_${action.name}`]) {\n perm[action.name] = true;\n }\n }\n }\n\n permissions.push(perm);\n }\n\n return [...filtered, ...permissions];\n}\n\n/**\n * Hook that bridges a permission schema with a Form component.\n *\n * Handles bidirectional transformation between Permission[] and form data,\n * with optional custom serialize/deserialize callbacks for app-specific needs.\n */\nexport function usePermissionForm(\n schema: PermissionSchema,\n options: UsePermissionFormOptions\n): UsePermissionFormResult {\n const { value, onChange } = options;\n\n const formData = useMemo(() => {\n let data = deserializePermissions(schema, value);\n\n // Merge custom deserialized data if provided.\n if (options.deserialize) {\n const extra = options.deserialize(Array.isArray(value) ? value : []);\n data = { ...data, ...extra };\n }\n\n return data;\n }, []);\n\n const onFormChange = useCallback(\n (data: Record<string, any>) => {\n let result = serializePermissions(schema, data, value);\n\n // Apply custom serializer if provided.\n if (options.serialize) {\n result = options.serialize(\n data,\n result.filter(p => p.name.startsWith(schema.prefix))\n );\n // Re-add non-schema permissions that were filtered out.\n const nonSchemaPermissions = Array.isArray(value)\n ? value.filter(\n p =>\n !p.name.startsWith(schema.prefix) &&\n !p.name.startsWith(`$${schema.prefix}`)\n )\n : [];\n result = [...nonSchemaPermissions, ...result];\n }\n\n onChange(result);\n },\n [value]\n );\n\n return { formData, onFormChange };\n}\n\n// Export the pure functions for unit testing.\nexport { deserializePermissions, serializePermissions };\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,WAAW,QAAQ,OAAO;AAS5C,SAASC,SAASA,CAACC,MAAwB,EAAEC,IAAY,EAAW;EAChE,OAAOD,MAAM,CAACE,OAAO,EA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AG7B,oBAAoB,CAAC7B,MAAM,EAAEmB,IAAI,EAAEX,KAAK,CAAC;;IAEtD;IACA,IAAI6C,OAAO,CAACM,SAAS,EAAE;MACnBD,MAAM,GAAGL,OAAO,CAACM,SAAS,CACtBxC,IAAI,EACJuC,MAAM,CAAC1C,MAAM,CAACJ,CAAC,IAAIA,CAAC,CAACjB,IAAI,CAACsB,UAAU,CAACjB,MAAM,CAACC,MAAM,CAAC,CACvD,CAAC;MACD;MACA,MAAM2D,oBAAoB,GAAGnD,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,GAC3CA,KAAK,CAACQ,MAAM,CACRJ,CAAC,IACG,CAACA,CAAC,CAACjB,IAAI,CAACsB,UAAU,CAACjB,MAAM,CAACC,MAAM,CAAC,IACjC,CAACW,CAAC,CAACjB,IAAI,CAACsB,UAAU,CAAC,IAAIjB,MAAM,CAACC,MAAM,EAAE,CAC9C,CAAC,GACD,EAAE;MACRyD,MAAM,GAAG,CAAC,GAAGE,oBAAoB,EAAE,GAAGF,MAAM,CAAC;IACjD;IAEAJ,QAAQ,CAACI,MAAM,CAAC;EACpB,CAAC,EACD,CAAClD,KAAK,CACV,CAAC;EAED,OAAO;IAAEsB,QAAQ;IAAE2B;EAAa,CAAC;AACrC;;AAEA;AACA,SAASlD,sBAAsB,EAAEsB,oBAAoB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"permissions/usePermissionForm.js","sources":["../../src/permissions/usePermissionForm.ts"],"sourcesContent":["import { useMemo, useCallback } from \"react\";\nimport type {\n Permission,\n PermissionSchema,\n EntityDefinition,\n UsePermissionFormOptions,\n UsePermissionFormResult\n} from \"./types.js\";\n\nfunction hasAction(entity: EntityDefinition, name: string): boolean {\n return entity.actions?.some(a => a.name === name) ?? false;\n}\n\n/** Resolve fullAccess config into a concrete Permission object. */\nfunction resolveFullAccess(schema: PermissionSchema): Permission {\n const name = `${schema.prefix}.*`;\n if (schema.fullAccess === true) {\n return { name };\n }\n return { name, ...schema.fullAccess };\n}\n\n/** Resolve readOnlyAccess config into a concrete Permission[]. */\nfunction resolveReadOnlyAccess(schema: PermissionSchema): Permission[] | undefined {\n if (!schema.readOnlyAccess) {\n return undefined;\n }\n if (schema.readOnlyAccess === true) {\n return [{ name: `${schema.prefix}.*`, rwd: \"r\" }];\n }\n return schema.readOnlyAccess;\n}\n\n/**\n * Deserialize Permission[] into form data based on the schema.\n */\nfunction deserializePermissions(\n schema: PermissionSchema,\n value: Permission[]\n): Record<string, any> {\n if (!Array.isArray(value)) {\n return { accessLevel: \"no\" };\n }\n\n // Check for read-only access by looking for the synthetic marker permission.\n if (value.some(p => p.name === `$${schema.prefix}.readonly`)) {\n return { accessLevel: \"read-only\" };\n }\n\n // Check for full access: either wildcard or the schema's fullAccess permission.\n const fullAccessName = `${schema.prefix}.*`;\n const hasFullAccess = value.some(p => p.name === \"*\" || p.name === fullAccessName);\n if (hasFullAccess) {\n return { accessLevel: \"full\" };\n }\n\n // Filter permissions that belong to this schema's prefix.\n const ownPermissions = value.filter(p => p.name.startsWith(schema.prefix));\n if (ownPermissions.length === 0) {\n return { accessLevel: \"no\" };\n }\n\n // Custom access level — extract per-entity form fields.\n const data: Record<string, any> = { accessLevel: \"custom\" };\n const entities = schema.entities || [];\n\n for (const entity of entities) {\n const perm = ownPermissions.find(p => p.name === entity.permission);\n if (!perm) {\n continue;\n }\n\n // Access scope: \"own\" if perm.own === true, else \"full\".\n if (perm.own === true) {\n data[`${entity.id}AccessScope`] = \"own\";\n } else {\n data[`${entity.id}AccessScope`] = \"full\";\n }\n\n // Process actions.\n for (const action of entity.actions ?? []) {\n if (action.name === \"rwd\") {\n data[`${entity.id}RWD`] = perm.rwd || \"r\";\n } else if (action.name === \"pw\") {\n data[`${entity.id}PW`] = perm.pw ? perm.pw.split(\"\") : [];\n } else {\n // Custom boolean action.\n data[`${entity.id}Action_${action.name}`] = perm[action.name] === true;\n }\n }\n }\n\n return data;\n}\n\n/**\n * Serialize form data into Permission[] based on the schema.\n */\nfunction serializePermissions(\n schema: PermissionSchema,\n formData: Record<string, any>,\n currentValue: Permission[]\n): Permission[] {\n // Start by filtering out all permissions belonging to this schema's prefix.\n const filtered = Array.isArray(currentValue)\n ? currentValue.filter(\n p => !p.name.startsWith(schema.prefix) && !p.name.startsWith(`$${schema.prefix}`)\n )\n : [];\n\n if (formData.accessLevel === \"no\" || !formData.accessLevel) {\n return filtered;\n }\n\n if (formData.accessLevel === \"full\") {\n return [...filtered, resolveFullAccess(schema)];\n }\n\n const readOnlyPermissions = resolveReadOnlyAccess(schema);\n if (formData.accessLevel === \"read-only\" && readOnlyPermissions) {\n return [...filtered, { name: `$${schema.prefix}.readonly` }, ...readOnlyPermissions];\n }\n\n const entities = schema.entities || [];\n\n // Custom access — build entity permissions.\n // First, build a map of entity definitions by ID for dependency lookups.\n const entityMap = new Map<string, EntityDefinition>();\n for (const entity of entities) {\n entityMap.set(entity.id, entity);\n }\n\n // Resolve cascading \"own\" scopes: if a parent is \"own\", children must be \"own\" too.\n const resolvedScopes = new Map<string, string>();\n for (const entity of entities) {\n const scope = formData[`${entity.id}AccessScope`];\n if (!scope || scope === \"no\") {\n continue;\n }\n\n let resolvedScope = scope;\n\n // If this entity depends on a parent and the parent scope is \"own\",\n // force this entity's scope to \"own\" as well.\n if (entity.dependsOn) {\n const parentScope = resolvedScopes.get(entity.dependsOn.entity);\n if (parentScope === \"own\") {\n resolvedScope = \"own\";\n }\n }\n\n resolvedScopes.set(entity.id, resolvedScope);\n }\n\n // Prune resolved scopes based on dependencies (must run before building permissions\n // so that transitive dependencies are properly pruned).\n for (const entity of entities) {\n if (!entity.dependsOn || !resolvedScopes.has(entity.id)) {\n continue;\n }\n\n const parentScope = resolvedScopes.get(entity.dependsOn.entity);\n if (!parentScope) {\n // Parent entity is not enabled — prune child.\n resolvedScopes.delete(entity.id);\n continue;\n }\n\n const parentEntity = entityMap.get(entity.dependsOn.entity);\n if (parentEntity && hasAction(parentEntity, \"rwd\")) {\n const parentRwd =\n parentScope === \"own\" ? \"rwd\" : formData[`${entity.dependsOn.entity}RWD`] || \"r\";\n if (!parentRwd.includes(entity.dependsOn.requires)) {\n // Parent doesn't have the required action — prune child.\n resolvedScopes.delete(entity.id);\n }\n }\n }\n\n // Build permissions from the pruned resolved scopes.\n const permissions: Permission[] = [];\n\n for (const entity of entities) {\n const scope = resolvedScopes.get(entity.id);\n if (!scope) {\n continue;\n }\n\n const perm: Permission = {\n name: entity.permission\n };\n\n if (scope === \"own\") {\n perm.own = true;\n if (hasAction(entity, \"rwd\")) {\n perm.rwd = \"rwd\";\n }\n } else if (hasAction(entity, \"rwd\")) {\n perm.rwd = formData[`${entity.id}RWD`] || \"r\";\n }\n\n // Process non-rwd actions.\n for (const action of entity.actions ?? []) {\n if (action.name === \"rwd\") {\n continue; // Already handled above.\n }\n\n if (action.name === \"pw\") {\n const pw: string[] = formData[`${entity.id}PW`] || [];\n if (pw.length > 0) {\n perm.pw = pw.join(\"\");\n }\n } else {\n // Custom boolean action.\n if (formData[`${entity.id}Action_${action.name}`]) {\n perm[action.name] = true;\n }\n }\n }\n\n permissions.push(perm);\n }\n\n return [...filtered, ...permissions];\n}\n\n/**\n * Hook that bridges a permission schema with a Form component.\n *\n * Handles bidirectional transformation between Permission[] and form data,\n * with optional custom serialize/deserialize callbacks for app-specific needs.\n */\nexport function usePermissionForm(\n schema: PermissionSchema,\n options: UsePermissionFormOptions\n): UsePermissionFormResult {\n const { value, onChange } = options;\n\n const formData = useMemo(() => {\n let data = deserializePermissions(schema, value);\n\n // Merge custom deserialized data if provided.\n if (options.deserialize) {\n const extra = options.deserialize(Array.isArray(value) ? value : []);\n data = { ...data, ...extra };\n }\n\n return data;\n }, []);\n\n const onFormChange = useCallback(\n (data: Record<string, any>) => {\n let result = serializePermissions(schema, data, value);\n\n // Apply custom serializer if provided.\n if (options.serialize) {\n result = options.serialize(\n data,\n result.filter(p => p.name.startsWith(schema.prefix))\n );\n // Re-add non-schema permissions that were filtered out.\n const nonSchemaPermissions = Array.isArray(value)\n ? value.filter(\n p =>\n !p.name.startsWith(schema.prefix) &&\n !p.name.startsWith(`$${schema.prefix}`)\n )\n : [];\n result = [...nonSchemaPermissions, ...result];\n }\n\n onChange(result);\n },\n [value]\n );\n\n return { formData, onFormChange };\n}\n\n// Export the pure functions for unit testing.\nexport { deserializePermissions, serializePermissions };\n"],"names":["hasAction","entity","name","a","resolveFullAccess","schema","resolveReadOnlyAccess","deserializePermissions","value","Array","p","fullAccessName","hasFullAccess","ownPermissions","data","entities","perm","action","serializePermissions","formData","currentValue","filtered","readOnlyPermissions","entityMap","Map","resolvedScopes","scope","resolvedScope","parentScope","parentEntity","parentRwd","permissions","pw","usePermissionForm","options","onChange","useMemo","extra","onFormChange","useCallback","result","nonSchemaPermissions"],"mappings":";AASA,SAASA,UAAUC,MAAwB,EAAEC,IAAY;IACrD,OAAOD,OAAO,OAAO,EAAE,KAAKE,CAAAA,IAAKA,EAAE,IAAI,KAAKD,SAAS;AACzD;AAGA,SAASE,kBAAkBC,MAAwB;IAC/C,MAAMH,OAAO,GAAGG,OAAO,MAAM,CAAC,EAAE,CAAC;IACjC,IAAIA,AAAsB,SAAtBA,OAAO,UAAU,EACjB,OAAO;QAAEH;IAAK;IAElB,OAAO;QAAEA;QAAM,GAAGG,OAAO,UAAU;IAAC;AACxC;AAGA,SAASC,sBAAsBD,MAAwB;IACnD,IAAI,CAACA,OAAO,cAAc,EACtB;IAEJ,IAAIA,AAA0B,SAA1BA,OAAO,cAAc,EACrB,OAAO;QAAC;YAAE,MAAM,GAAGA,OAAO,MAAM,CAAC,EAAE,CAAC;YAAE,KAAK;QAAI;KAAE;IAErD,OAAOA,OAAO,cAAc;AAChC;AAKA,SAASE,uBACLF,MAAwB,EACxBG,KAAmB;IAEnB,IAAI,CAACC,MAAM,OAAO,CAACD,QACf,OAAO;QAAE,aAAa;IAAK;IAI/B,IAAIA,MAAM,IAAI,CAACE,CAAAA,IAAKA,EAAE,IAAI,KAAK,CAAC,CAAC,EAAEL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,UAAU,CAAC,CAAC,CAAC,EAAEL,OAAO,MAAM,EAAE,KAE9C,EAAE;YACRmC,SAAS;mBAAIC;mBAAyBD;aAAO;QACjD;QAEAL,SAASK;IACb,GACA;QAAChC;KAAM;IAGX,OAAO;QAAEW;QAAUmB;IAAa;AACpC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useContainer } from "@webiny/app";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
function createUsePermissions(abstraction) {
|
|
3
|
+
return function() {
|
|
4
|
+
const container = useContainer();
|
|
5
|
+
return container.resolve(abstraction);
|
|
6
|
+
};
|
|
7
7
|
}
|
|
8
|
+
export { createUsePermissions };
|
|
8
9
|
|
|
9
10
|
//# sourceMappingURL=usePermissions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"permissions/usePermissions.js","sources":["../../src/permissions/usePermissions.ts"],"sourcesContent":["import { useContainer } from \"@webiny/app\";\nimport type { Abstraction } from \"@webiny/di\";\nimport type { PermissionSchemaConfig } from \"./types.js\";\nimport type { UsePermissionsResult } from \"./types.js\";\n\nexport function createUsePermissions<const S extends PermissionSchemaConfig>(\n abstraction: Abstraction<UsePermissionsResult<S>>\n): () => UsePermissionsResult<S> {\n return function usePermissions(): UsePermissionsResult<S> {\n const container = useContainer();\n return container.resolve(abstraction);\n };\n}\n"],"names":["createUsePermissions","abstraction","container","useContainer"],"mappings":";AAKO,SAASA,qBACZC,WAAiD;IAEjD,OAAO;QACH,MAAMC,YAAYC;QAClB,OAAOD,UAAU,OAAO,CAACD;IAC7B;AACJ"}
|
package/plugins/MenuPlugin.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { Plugin } from "@webiny/plugins";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
class MenuPlugin extends Plugin {
|
|
3
|
+
static{
|
|
4
|
+
this.type = "admin-menu";
|
|
5
|
+
}
|
|
6
|
+
constructor(config){
|
|
7
|
+
super();
|
|
8
|
+
this._config = config || {};
|
|
9
|
+
}
|
|
10
|
+
get order() {
|
|
11
|
+
return this._config.order;
|
|
12
|
+
}
|
|
13
|
+
render(props) {
|
|
14
|
+
if (!this._config.render) return null;
|
|
15
|
+
return this._config.render(props);
|
|
14
16
|
}
|
|
15
|
-
return this._config.render(props);
|
|
16
|
-
}
|
|
17
17
|
}
|
|
18
|
+
export { MenuPlugin };
|
|
18
19
|
|
|
19
20
|
//# sourceMappingURL=MenuPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"plugins/MenuPlugin.js","sources":["../../src/plugins/MenuPlugin.ts"],"sourcesContent":["import type * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\nexport interface MenuProps {\n name: string;\n label: React.ReactNode;\n icon: React.ReactElement;\n children: React.ReactNode;\n onClick?: (toggleSection: () => void) => void;\n}\n\nexport interface SectionProps {\n label: React.ReactNode;\n children: React.ReactNode;\n icon?: React.ReactElement;\n}\n\nexport interface ItemProps {\n label: React.ReactNode;\n path: string;\n style?: React.CSSProperties;\n onClick?: () => any;\n}\n\ninterface Props {\n Menu: React.ComponentType<MenuProps>;\n Section: React.ComponentType<SectionProps>;\n Item: React.ComponentType<ItemProps>;\n}\n\ninterface Config {\n render(props: Props): React.ReactNode;\n order?: number;\n}\n\nexport class MenuPlugin extends Plugin {\n public static override readonly type: string = \"admin-menu\";\n private readonly _config: Partial<Config>;\n\n public constructor(config?: Config) {\n super();\n this._config = config || {};\n }\n\n get order() {\n return this._config.order;\n }\n\n public render(props: Props): React.ReactNode {\n if (!this._config.render) {\n return null;\n }\n return this._config.render(props);\n }\n}\n"],"names":["MenuPlugin","Plugin","config","props"],"mappings":";AAmCO,MAAMA,mBAAmBC;;aACI,IAAI,GAAW;;IAG/C,YAAmBC,MAAe,CAAE;QAChC,KAAK;QACL,IAAI,CAAC,OAAO,GAAGA,UAAU,CAAC;IAC9B;IAEA,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK;IAC7B;IAEO,OAAOC,KAAY,EAAmB;QACzC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EACpB,OAAO;QAEX,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAACA;IAC/B;AACJ"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { BrowserFilePickerProps } from "./types.js";
|
|
3
|
+
export declare function BrowserFilePicker({ accept, multiple, maxSize, multipleMaxSize, multipleMaxCount, convertToBase64, onSuccess, onError, children, id: externalId }: BrowserFilePickerProps): React.JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import react, { useCallback, useId, useMemo, useRef } from "react";
|
|
2
|
+
import { BrowserFilePickerPresenter } from "./BrowserFilePickerPresenter.js";
|
|
3
|
+
function BrowserFilePicker({ accept = [], multiple = false, maxSize = "2mb", multipleMaxSize = "10mb", multipleMaxCount = null, convertToBase64 = false, onSuccess, onError, children, id: externalId }) {
|
|
4
|
+
const generatedId = useId();
|
|
5
|
+
const inputId = externalId ?? generatedId;
|
|
6
|
+
const inputRef = useRef(null);
|
|
7
|
+
const browseCallbacksRef = useRef(null);
|
|
8
|
+
const presenter = useMemo(()=>new BrowserFilePickerPresenter({
|
|
9
|
+
accept,
|
|
10
|
+
multiple,
|
|
11
|
+
maxSize,
|
|
12
|
+
multipleMaxSize,
|
|
13
|
+
multipleMaxCount,
|
|
14
|
+
convertToBase64
|
|
15
|
+
}), [
|
|
16
|
+
accept,
|
|
17
|
+
multiple,
|
|
18
|
+
maxSize,
|
|
19
|
+
multipleMaxSize,
|
|
20
|
+
multipleMaxCount,
|
|
21
|
+
convertToBase64
|
|
22
|
+
]);
|
|
23
|
+
const resolveCallbacks = useCallback(()=>{
|
|
24
|
+
const overrides = browseCallbacksRef.current;
|
|
25
|
+
return {
|
|
26
|
+
onSuccess: overrides?.onSuccess ?? onSuccess,
|
|
27
|
+
onError: overrides?.onError ?? onError
|
|
28
|
+
};
|
|
29
|
+
}, [
|
|
30
|
+
onSuccess,
|
|
31
|
+
onError
|
|
32
|
+
]);
|
|
33
|
+
const handleFiles = useCallback(async (files)=>{
|
|
34
|
+
await presenter.processFiles(files, resolveCallbacks());
|
|
35
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
36
|
+
browseCallbacksRef.current = null;
|
|
37
|
+
}, [
|
|
38
|
+
presenter,
|
|
39
|
+
resolveCallbacks
|
|
40
|
+
]);
|
|
41
|
+
const renderProps = useMemo(()=>({
|
|
42
|
+
browseFiles: (params)=>{
|
|
43
|
+
browseCallbacksRef.current = params ?? null;
|
|
44
|
+
inputRef.current?.click();
|
|
45
|
+
},
|
|
46
|
+
getDropZoneProps: (additionalProps = {})=>{
|
|
47
|
+
const { onDragOver, onDrop, ...rest } = additionalProps;
|
|
48
|
+
return {
|
|
49
|
+
...rest,
|
|
50
|
+
onDragOver: (e)=>{
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
"function" == typeof onDragOver && onDragOver(e);
|
|
53
|
+
},
|
|
54
|
+
onDrop: async (e)=>{
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
"function" == typeof onDrop && onDrop(e);
|
|
57
|
+
if (e.dataTransfer?.files) await handleFiles(Array.from(e.dataTransfer.files));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
getLabelProps: (additionalProps = {})=>({
|
|
62
|
+
...additionalProps,
|
|
63
|
+
htmlFor: inputId
|
|
64
|
+
}),
|
|
65
|
+
validateFiles: (files)=>presenter.validateFiles(files)
|
|
66
|
+
}), [
|
|
67
|
+
inputId,
|
|
68
|
+
presenter,
|
|
69
|
+
handleFiles
|
|
70
|
+
]);
|
|
71
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, children(renderProps), /*#__PURE__*/ react.createElement("input", {
|
|
72
|
+
id: inputId,
|
|
73
|
+
ref: inputRef,
|
|
74
|
+
accept: accept.join(","),
|
|
75
|
+
style: {
|
|
76
|
+
display: "none"
|
|
77
|
+
},
|
|
78
|
+
type: "file",
|
|
79
|
+
multiple: multiple,
|
|
80
|
+
onChange: (e)=>{
|
|
81
|
+
const files = e.target.files;
|
|
82
|
+
if (files) handleFiles(Array.from(files));
|
|
83
|
+
}
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
export { BrowserFilePicker };
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=BrowserFilePicker.js.map
|