@alpaca-editor/core 1.0.3767 → 1.0.3768
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/dist/client-components/api.d.ts +1 -0
- package/dist/client-components/api.js +1 -4
- package/dist/client-components/index.d.ts +16 -0
- package/dist/client-components/index.js +16 -36
- package/dist/components/ActionButton.d.ts +12 -0
- package/dist/components/ActionButton.js +4 -8
- package/dist/components/Error.d.ts +9 -0
- package/dist/components/Error.js +8 -13
- package/dist/config/config.d.ts +6 -0
- package/dist/config/config.js +145 -153
- package/dist/config/types.d.ts +223 -0
- package/dist/config/types.js +1 -2
- package/dist/editor/ComponentInfo.d.ts +4 -0
- package/dist/editor/ComponentInfo.js +12 -15
- package/dist/editor/ConfirmationDialog.d.ts +19 -0
- package/dist/editor/ConfirmationDialog.js +11 -13
- package/dist/editor/ContentTree.d.ts +35 -0
- package/dist/editor/ContentTree.js +56 -59
- package/dist/editor/ContextMenu.d.ts +13 -0
- package/dist/editor/ContextMenu.js +9 -13
- package/dist/editor/Editor.d.ts +11 -0
- package/dist/editor/Editor.js +21 -27
- package/dist/editor/EditorWarning.d.ts +5 -0
- package/dist/editor/EditorWarning.js +4 -7
- package/dist/editor/EditorWarnings.d.ts +9 -0
- package/dist/editor/EditorWarnings.js +6 -12
- package/dist/editor/FieldEditorPopup.d.ts +10 -0
- package/dist/editor/FieldEditorPopup.js +10 -13
- package/dist/editor/FieldHistory.d.ts +6 -0
- package/dist/editor/FieldHistory.js +17 -20
- package/dist/editor/FieldList.d.ts +16 -0
- package/dist/editor/FieldList.js +17 -23
- package/dist/editor/FieldListField.d.ts +14 -0
- package/dist/editor/FieldListField.js +44 -48
- package/dist/editor/FieldListFieldWithFallbacks.d.ts +10 -0
- package/dist/editor/FieldListFieldWithFallbacks.js +21 -27
- package/dist/editor/FloatingToolbar.d.ts +7 -0
- package/dist/editor/FloatingToolbar.js +20 -23
- package/dist/editor/ImageEditor.d.ts +5 -0
- package/dist/editor/ImageEditor.js +11 -14
- package/dist/editor/InsertMenu.d.ts +8 -0
- package/dist/editor/InsertMenu.js +37 -44
- package/dist/editor/ItemInfo.d.ts +4 -0
- package/dist/editor/ItemInfo.js +11 -14
- package/dist/editor/LinkEditorDialog.d.ts +15 -0
- package/dist/editor/LinkEditorDialog.js +27 -33
- package/dist/editor/MainLayout.d.ts +9 -0
- package/dist/editor/MainLayout.js +16 -22
- package/dist/editor/NewEditorClient.d.ts +5 -0
- package/dist/editor/NewEditorClient.js +3 -6
- package/dist/editor/PictureCropper.d.ts +6 -0
- package/dist/editor/PictureCropper.js +31 -37
- package/dist/editor/PictureEditor.d.ts +8 -0
- package/dist/editor/PictureEditor.js +15 -18
- package/dist/editor/PictureEditorDialog.d.ts +8 -0
- package/dist/editor/PictureEditorDialog.js +28 -34
- package/dist/editor/ScrollingContentTree.d.ts +6 -0
- package/dist/editor/ScrollingContentTree.js +10 -16
- package/dist/editor/Terminal.d.ts +14 -0
- package/dist/editor/Terminal.js +20 -23
- package/dist/editor/Titlebar.d.ts +1 -0
- package/dist/editor/Titlebar.js +5 -8
- package/dist/editor/ai/AiPopup.d.ts +10 -0
- package/dist/editor/ai/AiPopup.js +10 -13
- package/dist/editor/ai/AiResponseMessage.d.ts +8 -0
- package/dist/editor/ai/AiResponseMessage.js +12 -15
- package/dist/editor/ai/AiTerminal.d.ts +34 -0
- package/dist/editor/ai/AiTerminal.js +41 -47
- package/dist/editor/ai/AiToolCall.d.ts +9 -0
- package/dist/editor/ai/AiToolCall.js +8 -11
- package/dist/editor/ai/EditorAiTerminal.d.ts +5 -0
- package/dist/editor/ai/EditorAiTerminal.js +5 -8
- package/dist/editor/ai/editorAiContext.d.ts +11 -0
- package/dist/editor/ai/editorAiContext.js +1 -4
- package/dist/editor/client/DialogContext.d.ts +12 -0
- package/dist/editor/client/DialogContext.js +9 -14
- package/dist/editor/client/EditorClient.d.ts +26 -0
- package/dist/editor/client/EditorClient.js +177 -216
- package/dist/editor/client/GenericDialog.d.ts +10 -0
- package/dist/editor/client/GenericDialog.js +11 -14
- package/dist/editor/client/editContext.d.ts +199 -0
- package/dist/editor/client/editContext.js +14 -54
- package/dist/editor/client/helpers.d.ts +12 -0
- package/dist/editor/client/helpers.js +1 -4
- package/dist/editor/client/itemsRepository.d.ts +24 -0
- package/dist/editor/client/itemsRepository.js +22 -25
- package/dist/editor/client/operations.d.ts +57 -0
- package/dist/editor/client/operations.js +47 -53
- package/dist/editor/client/pageModelBuilder.d.ts +6 -0
- package/dist/editor/client/pageModelBuilder.js +10 -13
- package/dist/editor/commands/commands.d.ts +19 -0
- package/dist/editor/commands/commands.js +1 -2
- package/dist/editor/commands/componentCommands.d.ts +13 -0
- package/dist/editor/commands/componentCommands.js +7 -14
- package/dist/editor/commands/createVersionCommand.d.ts +4 -0
- package/dist/editor/commands/createVersionCommand.js +5 -8
- package/dist/editor/commands/deleteVersionCommand.d.ts +4 -0
- package/dist/editor/commands/deleteVersionCommand.js +5 -8
- package/dist/editor/commands/itemCommands.d.ts +17 -0
- package/dist/editor/commands/itemCommands.js +9 -12
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.d.ts +8 -0
- package/dist/editor/commands/localizeItem/LocalizeItemDialog.js +23 -29
- package/dist/editor/commands/undo.d.ts +15 -0
- package/dist/editor/commands/undo.js +2 -6
- package/dist/editor/component-designer/ComponentDesigner.d.ts +1 -0
- package/dist/editor/component-designer/ComponentDesigner.js +21 -24
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.d.ts +1 -0
- package/dist/editor/component-designer/ComponentDesignerAiTerminal.js +5 -8
- package/dist/editor/component-designer/ComponentDesignerMenu.d.ts +1 -0
- package/dist/editor/component-designer/ComponentDesignerMenu.js +14 -17
- package/dist/editor/component-designer/ComponentEditor.d.ts +4 -0
- package/dist/editor/component-designer/ComponentEditor.js +19 -22
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.d.ts +5 -0
- package/dist/editor/component-designer/ComponentRenderingCodeEditor.js +5 -11
- package/dist/editor/component-designer/ComponentRenderingEditor.d.ts +1 -0
- package/dist/editor/component-designer/ComponentRenderingEditor.js +18 -21
- package/dist/editor/component-designer/ComponentsDropdown.d.ts +4 -0
- package/dist/editor/component-designer/ComponentsDropdown.js +8 -11
- package/dist/editor/component-designer/PlaceholdersEditor.d.ts +4 -0
- package/dist/editor/component-designer/PlaceholdersEditor.js +17 -20
- package/dist/editor/component-designer/RenderingsDropdown.d.ts +1 -0
- package/dist/editor/component-designer/RenderingsDropdown.js +6 -9
- package/dist/editor/component-designer/TemplateEditor.d.ts +1 -0
- package/dist/editor/component-designer/TemplateEditor.js +21 -24
- package/dist/editor/component-designer/aiContext.d.ts +5 -0
- package/dist/editor/component-designer/aiContext.js +3 -6
- package/dist/editor/componentTreeHelper.d.ts +16 -0
- package/dist/editor/componentTreeHelper.js +8 -19
- package/dist/editor/control-center/ControlCenterMenu.d.ts +1 -0
- package/dist/editor/control-center/ControlCenterMenu.js +15 -18
- package/dist/editor/control-center/IndexOverview.d.ts +1 -0
- package/dist/editor/control-center/IndexOverview.js +12 -15
- package/dist/editor/control-center/IndexSettings.d.ts +5 -0
- package/dist/editor/control-center/IndexSettings.js +29 -32
- package/dist/editor/control-center/Status.d.ts +1 -0
- package/dist/editor/control-center/Status.js +3 -6
- package/dist/editor/editor-warnings/ItemLocked.d.ts +2 -0
- package/dist/editor/editor-warnings/ItemLocked.js +7 -10
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.d.ts +2 -0
- package/dist/editor/editor-warnings/NoLanguageWriteAccess.js +6 -9
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.d.ts +2 -0
- package/dist/editor/editor-warnings/NoWorkflowWriteAccess.js +6 -9
- package/dist/editor/editor-warnings/NoWriteAccess.d.ts +2 -0
- package/dist/editor/editor-warnings/NoWriteAccess.js +6 -9
- package/dist/editor/editor-warnings/ValidationErrors.d.ts +2 -0
- package/dist/editor/editor-warnings/ValidationErrors.js +5 -8
- package/dist/editor/field-types/AttachmentEditor.d.ts +4 -0
- package/dist/editor/field-types/AttachmentEditor.js +3 -6
- package/dist/editor/field-types/CheckboxEditor.d.ts +5 -0
- package/dist/editor/field-types/CheckboxEditor.js +11 -14
- package/dist/editor/field-types/DropLinkEditor.d.ts +5 -0
- package/dist/editor/field-types/DropLinkEditor.js +14 -17
- package/dist/editor/field-types/DropListEditor.d.ts +5 -0
- package/dist/editor/field-types/DropListEditor.js +12 -15
- package/dist/editor/field-types/ImageFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/ImageFieldEditor.js +10 -13
- package/dist/editor/field-types/InternalLinkFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/InternalLinkFieldEditor.js +20 -26
- package/dist/editor/field-types/LinkFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/LinkFieldEditor.js +12 -15
- package/dist/editor/field-types/MultiLineText.d.ts +6 -0
- package/dist/editor/field-types/MultiLineText.js +11 -14
- package/dist/editor/field-types/PictureFieldEditor.d.ts +5 -0
- package/dist/editor/field-types/PictureFieldEditor.js +13 -16
- package/dist/editor/field-types/RawEditor.d.ts +5 -0
- package/dist/editor/field-types/RawEditor.js +12 -15
- package/dist/editor/field-types/ReactQuill.d.ts +125 -0
- package/dist/editor/field-types/ReactQuill.js +100 -82
- package/dist/editor/field-types/RichTextEditor.d.ts +5 -0
- package/dist/editor/field-types/RichTextEditor.js +5 -44
- package/dist/editor/field-types/RichTextEditorComponent.d.ts +6 -0
- package/dist/editor/field-types/RichTextEditorComponent.js +16 -19
- package/dist/editor/field-types/SingleLineText.d.ts +6 -0
- package/dist/editor/field-types/SingleLineText.js +13 -16
- package/dist/editor/field-types/TreeListEditor.d.ts +5 -0
- package/dist/editor/field-types/TreeListEditor.js +33 -39
- package/dist/editor/fieldTypes.d.ts +117 -0
- package/dist/editor/fieldTypes.js +1 -2
- package/dist/editor/media-selector/AiImageSearch.d.ts +4 -0
- package/dist/editor/media-selector/AiImageSearch.js +30 -36
- package/dist/editor/media-selector/AiImageSearchPrompt.d.ts +3 -0
- package/dist/editor/media-selector/AiImageSearchPrompt.js +18 -21
- package/dist/editor/media-selector/MediaSelector.d.ts +9 -0
- package/dist/editor/media-selector/MediaSelector.js +5 -9
- package/dist/editor/media-selector/Preview.d.ts +4 -0
- package/dist/editor/media-selector/Preview.js +3 -6
- package/dist/editor/media-selector/Thumbnails.d.ts +13 -0
- package/dist/editor/media-selector/Thumbnails.js +5 -8
- package/dist/editor/media-selector/TreeSelector.d.ts +7 -0
- package/dist/editor/media-selector/TreeSelector.js +39 -46
- package/dist/editor/media-selector/UploadZone.d.ts +4 -0
- package/dist/editor/media-selector/UploadZone.js +17 -20
- package/dist/editor/menubar/ActionsMenu.d.ts +1 -0
- package/dist/editor/menubar/ActionsMenu.js +10 -13
- package/dist/editor/menubar/ActiveUsers.d.ts +1 -0
- package/dist/editor/menubar/ActiveUsers.js +7 -10
- package/dist/editor/menubar/ApproveAndPublish.d.ts +1 -0
- package/dist/editor/menubar/ApproveAndPublish.js +5 -8
- package/dist/editor/menubar/BrowseHistory.d.ts +6 -0
- package/dist/editor/menubar/BrowseHistory.js +6 -9
- package/dist/editor/menubar/ItemLanguageVersion.d.ts +1 -0
- package/dist/editor/menubar/ItemLanguageVersion.js +16 -19
- package/dist/editor/menubar/LanguageSelector.d.ts +9 -0
- package/dist/editor/menubar/LanguageSelector.js +12 -15
- package/dist/editor/menubar/Menu.d.ts +1 -0
- package/dist/editor/menubar/Menu.js +12 -15
- package/dist/editor/menubar/NavButtons.d.ts +1 -0
- package/dist/editor/menubar/NavButtons.js +8 -11
- package/dist/editor/menubar/PageSelector.d.ts +4 -0
- package/dist/editor/menubar/PageSelector.js +16 -19
- package/dist/editor/menubar/PageViewerControls.d.ts +1 -0
- package/dist/editor/menubar/PageViewerControls.js +13 -16
- package/dist/editor/menubar/Separator.d.ts +3 -0
- package/dist/editor/menubar/Separator.js +4 -7
- package/dist/editor/menubar/SiteInfo.d.ts +1 -0
- package/dist/editor/menubar/SiteInfo.js +13 -16
- package/dist/editor/menubar/User.d.ts +4 -0
- package/dist/editor/menubar/User.js +5 -8
- package/dist/editor/menubar/VersionSelector.d.ts +9 -0
- package/dist/editor/menubar/VersionSelector.js +18 -21
- package/dist/editor/page-editor-chrome/CommentHighlighting.d.ts +6 -0
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +16 -19
- package/dist/editor/page-editor-chrome/CommentHighlightings.d.ts +4 -0
- package/dist/editor/page-editor-chrome/CommentHighlightings.js +10 -13
- package/dist/editor/page-editor-chrome/FieldActionIndicator.d.ts +4 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicator.js +6 -9
- package/dist/editor/page-editor-chrome/FieldActionIndicators.d.ts +1 -0
- package/dist/editor/page-editor-chrome/FieldActionIndicators.js +7 -10
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.d.ts +8 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicator.js +7 -10
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.d.ts +6 -0
- package/dist/editor/page-editor-chrome/FieldEditedIndicators.js +7 -10
- package/dist/editor/page-editor-chrome/FrameMenu.d.ts +7 -0
- package/dist/editor/page-editor-chrome/FrameMenu.js +18 -21
- package/dist/editor/page-editor-chrome/FrameMenus.d.ts +5 -0
- package/dist/editor/page-editor-chrome/FrameMenus.js +11 -14
- package/dist/editor/page-editor-chrome/InlineEditor.d.ts +5 -0
- package/dist/editor/page-editor-chrome/InlineEditor.js +13 -16
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.d.ts +1 -0
- package/dist/editor/page-editor-chrome/LockedFieldIndicator.js +9 -12
- package/dist/editor/page-editor-chrome/NoLayout.d.ts +1 -0
- package/dist/editor/page-editor-chrome/NoLayout.js +8 -11
- package/dist/editor/page-editor-chrome/PageEditorChrome.d.ts +6 -0
- package/dist/editor/page-editor-chrome/PageEditorChrome.js +16 -19
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.d.ts +1 -0
- package/dist/editor/page-editor-chrome/PictureEditorOverlay.js +18 -21
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.d.ts +14 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +15 -18
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.d.ts +5 -0
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +13 -16
- package/dist/editor/page-viewer/DeviceToolbar.d.ts +6 -0
- package/dist/editor/page-viewer/DeviceToolbar.js +11 -14
- package/dist/editor/page-viewer/EditorForm.d.ts +5 -0
- package/dist/editor/page-viewer/EditorForm.js +22 -25
- package/dist/editor/page-viewer/MiniMap.d.ts +9 -0
- package/dist/editor/page-viewer/MiniMap.js +27 -63
- package/dist/editor/page-viewer/PageViewer.d.ts +8 -0
- package/dist/editor/page-viewer/PageViewer.js +21 -24
- package/dist/editor/page-viewer/PageViewerFrame.d.ts +11 -0
- package/dist/editor/page-viewer/PageViewerFrame.js +62 -69
- package/dist/editor/page-viewer/pageViewContext.d.ts +38 -0
- package/dist/editor/page-viewer/pageViewContext.js +26 -29
- package/dist/editor/pageModel.d.ts +171 -0
- package/dist/editor/pageModel.js +1 -2
- package/dist/editor/picture-shared.d.ts +16 -0
- package/dist/editor/picture-shared.js +2 -6
- package/dist/editor/reviews/Comment.d.ts +4 -0
- package/dist/editor/reviews/Comment.js +32 -35
- package/dist/editor/reviews/Comments.d.ts +1 -0
- package/dist/editor/reviews/Comments.js +14 -17
- package/dist/editor/reviews/PreviewInfo.d.ts +1 -0
- package/dist/editor/reviews/PreviewInfo.js +6 -9
- package/dist/editor/reviews/Reviews.d.ts +1 -0
- package/dist/editor/reviews/Reviews.js +36 -42
- package/dist/editor/reviews/reviewCommands.d.ts +3 -0
- package/dist/editor/reviews/reviewCommands.js +8 -11
- package/dist/editor/reviews/useReviews.d.ts +12 -0
- package/dist/editor/reviews/useReviews.js +11 -17
- package/dist/editor/services/aiService.d.ts +34 -0
- package/dist/editor/services/aiService.js +5 -10
- package/dist/editor/services/componentDesignerService.d.ts +46 -0
- package/dist/editor/services/componentDesignerService.js +14 -22
- package/dist/editor/services/contentService.d.ts +34 -0
- package/dist/editor/services/contentService.js +18 -31
- package/dist/editor/services/editService.d.ts +34 -0
- package/dist/editor/services/editService.js +48 -77
- package/dist/editor/services/indexService.d.ts +6 -0
- package/dist/editor/services/indexService.js +11 -18
- package/dist/editor/services/reviewsService.d.ts +12 -0
- package/dist/editor/services/reviewsService.js +30 -42
- package/dist/editor/services/serviceHelper.d.ts +9 -0
- package/dist/editor/services/serviceHelper.js +2 -6
- package/dist/editor/services/systemService.d.ts +2 -0
- package/dist/editor/services/systemService.js +3 -6
- package/dist/editor/services/translationService.d.ts +11 -0
- package/dist/editor/services/translationService.js +7 -12
- package/dist/editor/services-server/api.d.ts +19 -0
- package/dist/editor/services-server/api.js +10 -19
- package/dist/editor/services-server/graphQL.d.ts +29 -0
- package/dist/editor/services-server/graphQL.js +5 -9
- package/dist/editor/sidebar/ComponentPalette.d.ts +1 -0
- package/dist/editor/sidebar/ComponentPalette.js +19 -22
- package/dist/editor/sidebar/ComponentTree.d.ts +1 -0
- package/dist/editor/sidebar/ComponentTree.js +26 -29
- package/dist/editor/sidebar/Debug.d.ts +1 -0
- package/dist/editor/sidebar/Debug.js +20 -23
- package/dist/editor/sidebar/DictionaryEditor.d.ts +1 -0
- package/dist/editor/sidebar/DictionaryEditor.js +45 -48
- package/dist/editor/sidebar/EditHistory.d.ts +1 -0
- package/dist/editor/sidebar/EditHistory.js +22 -25
- package/dist/editor/sidebar/GraphQL.d.ts +1 -0
- package/dist/editor/sidebar/GraphQL.js +17 -20
- package/dist/editor/sidebar/Insert.d.ts +1 -0
- package/dist/editor/sidebar/Insert.js +10 -13
- package/dist/editor/sidebar/MainContentTree.d.ts +4 -0
- package/dist/editor/sidebar/MainContentTree.js +16 -22
- package/dist/editor/sidebar/Performance.d.ts +1 -0
- package/dist/editor/sidebar/Performance.js +7 -10
- package/dist/editor/sidebar/Sessions.d.ts +1 -0
- package/dist/editor/sidebar/Sessions.js +7 -10
- package/dist/editor/sidebar/Sidebar.d.ts +1 -0
- package/dist/editor/sidebar/Sidebar.js +6 -9
- package/dist/editor/sidebar/SidebarView.d.ts +8 -0
- package/dist/editor/sidebar/SidebarView.js +18 -21
- package/dist/editor/sidebar/Translations.d.ts +1 -0
- package/dist/editor/sidebar/Translations.js +31 -34
- package/dist/editor/sidebar/Validation.d.ts +1 -0
- package/dist/editor/sidebar/Validation.js +11 -14
- package/dist/editor/sidebar/ViewSelector.d.ts +1 -0
- package/dist/editor/sidebar/ViewSelector.js +8 -11
- package/dist/editor/sidebar/Workbox.d.ts +1 -0
- package/dist/editor/sidebar/Workbox.js +20 -23
- package/dist/editor/ui/CenteredMessage.d.ts +3 -0
- package/dist/editor/ui/CenteredMessage.js +3 -6
- package/dist/editor/ui/CopyToClipboardButton.d.ts +3 -0
- package/dist/editor/ui/CopyToClipboardButton.js +5 -8
- package/dist/editor/ui/DialogButtons.d.ts +3 -0
- package/dist/editor/ui/DialogButtons.js +3 -6
- package/dist/editor/ui/Icons.d.ts +38 -0
- package/dist/editor/ui/Icons.js +54 -74
- package/dist/editor/ui/ItemNameDialog.d.ts +11 -0
- package/dist/editor/ui/ItemNameDialog.js +16 -22
- package/dist/editor/ui/ItemNameDialogNew.d.ts +10 -0
- package/dist/editor/ui/ItemNameDialogNew.js +22 -28
- package/dist/editor/ui/ItemSearch.d.ts +23 -0
- package/dist/editor/ui/ItemSearch.js +24 -28
- package/dist/editor/ui/PerfectTree.d.ts +60 -0
- package/dist/editor/ui/PerfectTree.js +39 -76
- package/dist/editor/ui/Section.d.ts +4 -0
- package/dist/editor/ui/Section.js +7 -10
- package/dist/editor/ui/SimpleIconButton.d.ts +11 -0
- package/dist/editor/ui/SimpleIconButton.js +4 -7
- package/dist/editor/ui/SimpleMenu.d.ts +13 -0
- package/dist/editor/ui/SimpleMenu.js +4 -7
- package/dist/editor/ui/SimpleTable.d.ts +14 -0
- package/dist/editor/ui/SimpleTable.js +5 -8
- package/dist/editor/ui/SimpleTabs.d.ts +12 -0
- package/dist/editor/ui/SimpleTabs.js +4 -7
- package/dist/editor/ui/SimpleToolbar.d.ts +3 -0
- package/dist/editor/ui/SimpleToolbar.js +3 -6
- package/dist/editor/ui/Spinner.d.ts +3 -0
- package/dist/editor/ui/Spinner.js +3 -6
- package/dist/editor/ui/Splitter.d.ts +15 -0
- package/dist/editor/ui/Splitter.js +16 -53
- package/dist/editor/ui/StackedPanels.d.ts +5 -0
- package/dist/editor/ui/StackedPanels.js +18 -21
- package/dist/editor/ui/Toolbar.d.ts +3 -0
- package/dist/editor/ui/Toolbar.js +3 -6
- package/dist/editor/utils/id-helper.d.ts +1 -0
- package/dist/editor/utils/id-helper.js +1 -4
- package/dist/editor/utils/insertOptions.d.ts +3 -0
- package/dist/editor/utils/insertOptions.js +3 -6
- package/dist/editor/utils/itemutils.d.ts +3 -0
- package/dist/editor/utils/itemutils.js +3 -7
- package/dist/editor/utils/useMemoDebug.d.ts +1 -0
- package/dist/editor/utils/useMemoDebug.js +4 -7
- package/dist/editor/utils.d.ts +44 -0
- package/dist/editor/utils.js +27 -48
- package/dist/editor/views/CompareView.d.ts +1 -0
- package/dist/editor/views/CompareView.js +31 -34
- package/dist/editor/views/EditView.d.ts +1 -0
- package/dist/editor/views/EditView.js +9 -12
- package/dist/editor/views/ItemEditor.d.ts +7 -0
- package/dist/editor/views/ItemEditor.js +9 -12
- package/dist/editor/views/SingleEditView.d.ts +8 -0
- package/dist/editor/views/SingleEditView.js +12 -15
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -22
- package/dist/page-wizard/PageWizard.d.ts +70 -0
- package/dist/page-wizard/PageWizard.js +16 -19
- package/dist/page-wizard/SelectWizard.d.ts +7 -0
- package/dist/page-wizard/SelectWizard.js +16 -19
- package/dist/page-wizard/WizardSteps.d.ts +8 -0
- package/dist/page-wizard/WizardSteps.js +20 -23
- package/dist/page-wizard/service.d.ts +15 -0
- package/dist/page-wizard/service.js +6 -11
- package/dist/page-wizard/startPageWizardCommand.d.ts +13 -0
- package/dist/page-wizard/startPageWizardCommand.js +1 -4
- package/dist/page-wizard/steps/BuildPageStep.d.ts +2 -0
- package/dist/page-wizard/steps/BuildPageStep.js +27 -33
- package/dist/page-wizard/steps/CollectStep.d.ts +2 -0
- package/dist/page-wizard/steps/CollectStep.js +21 -27
- package/dist/page-wizard/steps/ComponentTypesSelector.d.ts +11 -0
- package/dist/page-wizard/steps/ComponentTypesSelector.js +21 -24
- package/dist/page-wizard/steps/Components.d.ts +9 -0
- package/dist/page-wizard/steps/Components.js +16 -22
- package/dist/page-wizard/steps/CreatePage.d.ts +12 -0
- package/dist/page-wizard/steps/CreatePage.js +25 -28
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.d.ts +2 -0
- package/dist/page-wizard/steps/CreatePageAndLayoutStep.js +38 -41
- package/dist/page-wizard/steps/EditButton.d.ts +8 -0
- package/dist/page-wizard/steps/EditButton.js +3 -6
- package/dist/page-wizard/steps/FieldEditor.d.ts +5 -0
- package/dist/page-wizard/steps/FieldEditor.js +9 -12
- package/dist/page-wizard/steps/Generate.d.ts +5 -0
- package/dist/page-wizard/steps/Generate.js +6 -8
- package/dist/page-wizard/steps/ImagesStep.d.ts +2 -0
- package/dist/page-wizard/steps/ImagesStep.js +32 -36
- package/dist/page-wizard/steps/LayoutStep.d.ts +2 -0
- package/dist/page-wizard/steps/LayoutStep.js +27 -30
- package/dist/page-wizard/steps/SelectStep.d.ts +2 -0
- package/dist/page-wizard/steps/SelectStep.js +29 -35
- package/dist/page-wizard/steps/schema.d.ts +13 -0
- package/dist/page-wizard/steps/schema.js +2 -6
- package/dist/page-wizard/steps/usePageCreator.d.ts +6 -0
- package/dist/page-wizard/steps/usePageCreator.js +13 -16
- package/dist/splash-screen/NewPage.d.ts +3 -0
- package/dist/splash-screen/NewPage.js +39 -42
- package/dist/splash-screen/SectionHeadline.d.ts +4 -0
- package/dist/splash-screen/SectionHeadline.js +5 -8
- package/dist/splash-screen/SplashScreen.d.ts +1 -0
- package/dist/splash-screen/SplashScreen.js +23 -26
- package/dist/tour/Tour.d.ts +3 -0
- package/dist/tour/Tour.js +17 -20
- package/dist/tour/default-tour.d.ts +9 -0
- package/dist/tour/default-tour.js +10 -13
- package/dist/tour/preview-tour.d.ts +2 -0
- package/dist/tour/preview-tour.js +12 -15
- package/dist/types.d.ts +259 -0
- package/dist/types.js +1 -2
- package/package.json +1 -1
- package/tsconfig.build.json +16 -12
- package/dist/tsconfig.build.tsbuildinfo +0 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { ComponentType, ReactNode, Dispatch, SetStateAction } from "react";
|
|
2
|
+
import { EditContextType } from "../editor/client/editContext";
|
|
3
|
+
import { Command, CommandData } from "../editor/commands/commands";
|
|
4
|
+
import { EditorWarningProps } from "../editor/EditorWarnings";
|
|
5
|
+
import { Field, FieldButton, FullItem, ItemDescriptor } from "../editor/pageModel";
|
|
6
|
+
import { InsertItemCommand, ItemCommand } from "../editor/commands/itemCommands";
|
|
7
|
+
import { User } from "../types";
|
|
8
|
+
import { WizardData, WizardPageModel } from "../page-wizard/PageWizard";
|
|
9
|
+
import { Wizard } from "../page-wizard/PageWizard";
|
|
10
|
+
import { DialogContextValue } from "../editor/client/DialogContext";
|
|
11
|
+
export type RichTextEditorProfile = {
|
|
12
|
+
toolbar: {
|
|
13
|
+
groups: RichTextEditorToolbarGroup[];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type ClientFieldButton = FieldButton & {
|
|
17
|
+
clientAction?: FieldAction;
|
|
18
|
+
};
|
|
19
|
+
export type FieldAction = ({ editContext, dialogContext, }: FieldActionProps) => Promise<any> | void;
|
|
20
|
+
export type FieldActionProps = {
|
|
21
|
+
editContext: EditContextType;
|
|
22
|
+
dialogContext: DialogContextValue;
|
|
23
|
+
field: Field;
|
|
24
|
+
};
|
|
25
|
+
export type RichTextEditorToolbarGroup = {
|
|
26
|
+
items: RichTextEditorToolbarItem[];
|
|
27
|
+
};
|
|
28
|
+
export type RichTextEditorToolbarItem = string | {};
|
|
29
|
+
export type EditorClientBuilderProps = {
|
|
30
|
+
configuration: EditorConfiguration;
|
|
31
|
+
buildClient: (configuration: EditorConfiguration) => ReactNode;
|
|
32
|
+
user: User;
|
|
33
|
+
};
|
|
34
|
+
export type Panel = {
|
|
35
|
+
name: string;
|
|
36
|
+
title: string;
|
|
37
|
+
icon?: string | React.JSX.Element;
|
|
38
|
+
header?: ComponentType;
|
|
39
|
+
content: ReactNode;
|
|
40
|
+
initialSize: number;
|
|
41
|
+
noOverflow?: boolean;
|
|
42
|
+
};
|
|
43
|
+
export type PanelFactory = (editContext: EditContextType) => Panel;
|
|
44
|
+
export type Sidebar = {
|
|
45
|
+
panels: (Panel | PanelFactory)[];
|
|
46
|
+
title?: string;
|
|
47
|
+
};
|
|
48
|
+
export type EditorView = {
|
|
49
|
+
name: string;
|
|
50
|
+
extends?: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
icon?: string | React.JSX.Element;
|
|
53
|
+
defaultCenterPanelView?: ReactNode;
|
|
54
|
+
menuBar?: ReactNode;
|
|
55
|
+
leftSidebar?: Sidebar;
|
|
56
|
+
rightSidebar?: Sidebar;
|
|
57
|
+
hidden?: boolean;
|
|
58
|
+
primaryControls?: ReactNode;
|
|
59
|
+
secondaryControls?: ReactNode;
|
|
60
|
+
hideViewSelector?: boolean;
|
|
61
|
+
};
|
|
62
|
+
export type ViewPanel = {
|
|
63
|
+
name: string;
|
|
64
|
+
content: ReactNode;
|
|
65
|
+
};
|
|
66
|
+
export type MenuItem = {
|
|
67
|
+
id: string;
|
|
68
|
+
label: string;
|
|
69
|
+
icon: ReactNode;
|
|
70
|
+
items?: MenuItem[];
|
|
71
|
+
command?: (event: any) => Promise<void>;
|
|
72
|
+
};
|
|
73
|
+
export type EditorConfiguration = {
|
|
74
|
+
extensions: {
|
|
75
|
+
[key: string]: unknown;
|
|
76
|
+
};
|
|
77
|
+
commands: {
|
|
78
|
+
renameItem: ItemCommand;
|
|
79
|
+
deleteItem: ItemCommand;
|
|
80
|
+
insertItem: InsertItemCommand;
|
|
81
|
+
publishItem: ItemCommand;
|
|
82
|
+
allItemCommands: ItemCommand[];
|
|
83
|
+
reviewcommands: Command<CommandData>[];
|
|
84
|
+
};
|
|
85
|
+
events: {
|
|
86
|
+
onUnauthorized?: () => void;
|
|
87
|
+
};
|
|
88
|
+
services: {
|
|
89
|
+
renderService: {
|
|
90
|
+
path?: string;
|
|
91
|
+
};
|
|
92
|
+
editorService: {};
|
|
93
|
+
aiService: {
|
|
94
|
+
promptUrl: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
editorWarnings: ComponentType<EditorWarningProps>[];
|
|
98
|
+
fieldTypes: {
|
|
99
|
+
[key: string]: FieldTypeConfiguration;
|
|
100
|
+
};
|
|
101
|
+
outline: {
|
|
102
|
+
width: number;
|
|
103
|
+
};
|
|
104
|
+
debounceFieldEditsInterval: number;
|
|
105
|
+
devices: Device[];
|
|
106
|
+
pageWizard: {
|
|
107
|
+
getWizards: (parentItem: ItemDescriptor) => Promise<Wizard[]>;
|
|
108
|
+
startWizardCommand: Command<{
|
|
109
|
+
wizard: Wizard;
|
|
110
|
+
item: ItemDescriptor;
|
|
111
|
+
}>;
|
|
112
|
+
stepComponents: {
|
|
113
|
+
[key: string]: ComponentType<StepComponentProps>;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
editor: {
|
|
117
|
+
defaultPanelSizes: [number, number];
|
|
118
|
+
dialogs: {
|
|
119
|
+
newPage: {
|
|
120
|
+
expandTreeNode?: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
views: EditorView[];
|
|
124
|
+
actionsMenu?: {
|
|
125
|
+
itemsFactory: (editContext: EditContextType) => MenuItem[];
|
|
126
|
+
};
|
|
127
|
+
mainNavigation?: (MenuItem | Command<any>)[];
|
|
128
|
+
embedded?: boolean;
|
|
129
|
+
titlebar: ReactNode;
|
|
130
|
+
contentTree: {
|
|
131
|
+
contextMenu: {
|
|
132
|
+
factory: (props: {
|
|
133
|
+
items: FullItem[];
|
|
134
|
+
editContext: EditContextType;
|
|
135
|
+
commandCallback?: (command: ItemCommand, result: any) => void;
|
|
136
|
+
}) => Promise<MenuItem[] | undefined>;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
controlCenter: {
|
|
141
|
+
groups: {
|
|
142
|
+
title: string;
|
|
143
|
+
icon: ReactNode;
|
|
144
|
+
panels: ControlCenterPanel[];
|
|
145
|
+
}[];
|
|
146
|
+
};
|
|
147
|
+
tours: {
|
|
148
|
+
default: Tour;
|
|
149
|
+
preview: Tour;
|
|
150
|
+
};
|
|
151
|
+
activeTour: string;
|
|
152
|
+
};
|
|
153
|
+
export type Tour = {
|
|
154
|
+
getSteps: (params: GetEditorTourStepsParams) => Record<string, TourStep>;
|
|
155
|
+
};
|
|
156
|
+
export type ControlCenterPanel = {
|
|
157
|
+
id: string;
|
|
158
|
+
title: string;
|
|
159
|
+
icon?: ReactNode;
|
|
160
|
+
content: ReactNode;
|
|
161
|
+
};
|
|
162
|
+
export type Device = {
|
|
163
|
+
name: string;
|
|
164
|
+
width: number | undefined;
|
|
165
|
+
height: number | undefined;
|
|
166
|
+
};
|
|
167
|
+
export type FieldTypeConfiguration = {
|
|
168
|
+
editor: React.ComponentType<any>;
|
|
169
|
+
buttons?: FieldButton[];
|
|
170
|
+
custom?: any;
|
|
171
|
+
};
|
|
172
|
+
export type TourButton = {
|
|
173
|
+
label: ReactNode;
|
|
174
|
+
onClick: () => void;
|
|
175
|
+
className?: string;
|
|
176
|
+
};
|
|
177
|
+
export type TourStep = {
|
|
178
|
+
title?: ReactNode;
|
|
179
|
+
description?: ReactNode;
|
|
180
|
+
focusElement?: string;
|
|
181
|
+
extendFocus?: number;
|
|
182
|
+
prepareAction?: () => Promise<void>;
|
|
183
|
+
action?: () => Promise<void>;
|
|
184
|
+
bubblePosition?: "left" | "right" | "bottom" | "top-right";
|
|
185
|
+
flipArrow?: boolean;
|
|
186
|
+
waitForUserInput?: () => Promise<string | void>;
|
|
187
|
+
buttons?: TourButton[];
|
|
188
|
+
nextStep?: string;
|
|
189
|
+
waitForElement?: string;
|
|
190
|
+
getPointTo?: () => DOMRect | undefined;
|
|
191
|
+
pointToElement?: string;
|
|
192
|
+
};
|
|
193
|
+
export type GetEditorTourStepsParams = {
|
|
194
|
+
editContext: EditContextType;
|
|
195
|
+
nextStep: (stepId: string) => void;
|
|
196
|
+
stopTour: () => void;
|
|
197
|
+
waitForElement: (selector: string, timeout?: number) => Promise<DOMRect | undefined>;
|
|
198
|
+
waitForElementToDisappear: (selector: string) => Promise<void>;
|
|
199
|
+
setFocusRect: (rect: DOMRect) => void;
|
|
200
|
+
delay: (ms: number) => Promise<void>;
|
|
201
|
+
waitForInput: (selector: string, minNumberOfCharacters: number) => Promise<void>;
|
|
202
|
+
simulateTyping: (element: HTMLInputElement | HTMLTextAreaElement, text: string, interval?: number) => Promise<void>;
|
|
203
|
+
};
|
|
204
|
+
export type TranslationStatus = {
|
|
205
|
+
itemId: string;
|
|
206
|
+
targetLanguage: string;
|
|
207
|
+
sourceLanguage: string;
|
|
208
|
+
status: string;
|
|
209
|
+
timestamp: string;
|
|
210
|
+
message?: string;
|
|
211
|
+
};
|
|
212
|
+
export interface StepComponentProps {
|
|
213
|
+
step: any;
|
|
214
|
+
data: WizardData;
|
|
215
|
+
setData: React.Dispatch<React.SetStateAction<WizardData>>;
|
|
216
|
+
wizard: Wizard;
|
|
217
|
+
parentItem?: ItemDescriptor;
|
|
218
|
+
setStepCompleted: (completed: boolean) => void;
|
|
219
|
+
internalState: any;
|
|
220
|
+
setInternalState: Dispatch<SetStateAction<any>>;
|
|
221
|
+
pageModel: WizardPageModel;
|
|
222
|
+
setPageModel: Dispatch<SetStateAction<WizardPageModel>>;
|
|
223
|
+
}
|
package/dist/config/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const Section_1 = require("./ui/Section");
|
|
9
|
-
const editContext_1 = require("./client/editContext");
|
|
10
|
-
function ComponentInfo({ component }) {
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { CopyToClipboardButton } from "./ui/CopyToClipboardButton";
|
|
5
|
+
import { Section } from "./ui/Section";
|
|
6
|
+
import { useEditContext } from "./client/editContext";
|
|
7
|
+
export function ComponentInfo({ component }) {
|
|
11
8
|
if (!component)
|
|
12
9
|
return null;
|
|
13
|
-
const editContext =
|
|
14
|
-
const [layoutItem, setLayoutItem] =
|
|
15
|
-
|
|
10
|
+
const editContext = useEditContext();
|
|
11
|
+
const [layoutItem, setLayoutItem] = useState();
|
|
12
|
+
useEffect(() => {
|
|
16
13
|
if (!component.layoutId) {
|
|
17
14
|
setLayoutItem(undefined);
|
|
18
15
|
return;
|
|
@@ -25,7 +22,7 @@ function ComponentInfo({ component }) {
|
|
|
25
22
|
})
|
|
26
23
|
.then(setLayoutItem);
|
|
27
24
|
}, [component.layoutId]);
|
|
28
|
-
const hostingPageItem = layoutItem ? ((
|
|
29
|
-
const linkedComponent = component.datasourceItem ? ((
|
|
30
|
-
return ((
|
|
25
|
+
const hostingPageItem = layoutItem ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "font-bold", children: "Source:" }), _jsxs("div", { children: [layoutItem.path, " ID: ", layoutItem.id] })] })) : null;
|
|
26
|
+
const linkedComponent = component.datasourceItem ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "font-bold", children: "Source:" }), _jsxs("div", { children: [component.datasourceItem.path, " (", component.datasourceItem.id, ")"] })] })) : null;
|
|
27
|
+
return (_jsxs("div", { children: [_jsx("h2", { className: "py-3 px-3 text-l font-bold my-2", children: component.name }), _jsx(Section, { title: "Info", children: _jsxs("div", { className: "grid grid-cols-[min-content_1fr] gap-3 text-xs bg-gray-100", children: [_jsx("div", { className: "font-bold", children: "ID:" }), _jsxs("div", { children: [component.id, " ", _jsx(CopyToClipboardButton, { text: component.id })] }), _jsx("div", { className: "font-bold", children: "Template" }), _jsxs("div", { children: ["(", component.datasourceItem?.templateId, component.datasourceItem && (_jsx(CopyToClipboardButton, { text: component.datasourceItem.templateId })), ")"] }), _jsx("div", { className: "font-bold", children: "Languages" }), _jsx("div", { children: component.datasourceItem?.translations?.join(", ") }), hostingPageItem, linkedComponent] }) })] }));
|
|
31
28
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ConfirmationDialogProps = {};
|
|
2
|
+
export type ConfirmationProps = {
|
|
3
|
+
message: React.ReactNode;
|
|
4
|
+
acceptIcon?: string;
|
|
5
|
+
rejectIcon?: string;
|
|
6
|
+
header?: React.ReactNode;
|
|
7
|
+
acceptLabel?: string;
|
|
8
|
+
rejectLabel?: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
accept: () => void;
|
|
11
|
+
reject?: () => void;
|
|
12
|
+
showCancel?: boolean;
|
|
13
|
+
showAccept?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export interface ConfirmationDialogHandle {
|
|
16
|
+
confirm: (props: ConfirmationProps) => void;
|
|
17
|
+
}
|
|
18
|
+
declare const ConfirmationDialog: import("react").ForwardRefExoticComponent<import("react").RefAttributes<ConfirmationDialogHandle>>;
|
|
19
|
+
export default ConfirmationDialog;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const [visible, setVisible] = (0, react_1.useState)(false);
|
|
9
|
-
const [props, setProps] = (0, react_1.useState)();
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, forwardRef, useImperativeHandle } from "react";
|
|
3
|
+
import { Dialog } from "primereact/dialog";
|
|
4
|
+
import { Button } from "primereact/button";
|
|
5
|
+
const ConfirmationDialog = forwardRef((_props, ref) => {
|
|
6
|
+
const [visible, setVisible] = useState(false);
|
|
7
|
+
const [props, setProps] = useState();
|
|
10
8
|
const showAccept = props?.accept === undefined ? true : props.accept;
|
|
11
|
-
|
|
9
|
+
useImperativeHandle(ref, () => ({
|
|
12
10
|
confirm: (props) => {
|
|
13
11
|
setVisible(true);
|
|
14
12
|
setProps(props);
|
|
@@ -26,7 +24,7 @@ const ConfirmationDialog = (0, react_1.forwardRef)((_props, ref) => {
|
|
|
26
24
|
const handleCancel = () => {
|
|
27
25
|
setVisible(false);
|
|
28
26
|
};
|
|
29
|
-
const dialogFooter = ((
|
|
30
|
-
return (visible && ((
|
|
27
|
+
const dialogFooter = (_jsxs("div", { children: [showAccept && (_jsx(Button, { label: props?.acceptLabel || "Yes", icon: props?.acceptIcon || "pi pi-check", onClick: handleAccept, className: "p-button-text" })), props?.rejectLabel && (_jsx(Button, { label: props?.rejectLabel, icon: props?.rejectIcon || "pi pi-times", onClick: handleReject, className: "p-button-text" })), props?.showCancel && (_jsx(Button, { label: "Cancel", icon: "pi pi-ban", onClick: handleCancel, className: "p-button-text" }))] }));
|
|
28
|
+
return (visible && (_jsx(Dialog, { header: props?.header || "Confirm", visible: visible, style: { maxWidth: "50vw" }, footer: dialogFooter, onHide: handleCancel, children: _jsxs("div", { className: "flex items-center gap-2 p-3", children: [props?.icon && _jsx("i", { className: props.icon + " text-3xl" }), props?.message] }) })));
|
|
31
29
|
});
|
|
32
|
-
|
|
30
|
+
export default ConfirmationDialog;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ItemTreeNodeData } from "./services/contentService";
|
|
2
|
+
import { ItemDescriptor } from "./pageModel";
|
|
3
|
+
import { TreeNode } from "./ui/PerfectTree";
|
|
4
|
+
type CustomTreeNode = TreeNode & {
|
|
5
|
+
isDraggable?: boolean;
|
|
6
|
+
iconUrl?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
parent?: CustomTreeNode;
|
|
10
|
+
selectable?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
export default function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionMode, selectedItemIds, rootItemId, rootItemIds, onSelectionChange, filter, templateIds, className, includeEmbeddedItems, onDoubleClick, selectPagesOnly, renderNode, onItemInserted, language, includeItemPath, }: {
|
|
14
|
+
isDraggable?: (item: ItemTreeNodeData) => boolean;
|
|
15
|
+
dragStart?: (item: ItemTreeNodeData) => void;
|
|
16
|
+
dragEnd?: () => void;
|
|
17
|
+
expandIdPath?: string;
|
|
18
|
+
selectionMode?: "single" | "multiple" | "none";
|
|
19
|
+
rootItemId?: string;
|
|
20
|
+
rootItemIds?: string[];
|
|
21
|
+
selectedItemIds?: string[];
|
|
22
|
+
onSelectionChange?: (itemIds: ItemTreeNodeData[]) => void;
|
|
23
|
+
onNodeClick?: (item: ItemTreeNodeData) => void;
|
|
24
|
+
filter?: (items: ItemTreeNodeData[]) => ItemTreeNodeData[];
|
|
25
|
+
templateIds?: string[];
|
|
26
|
+
className?: string;
|
|
27
|
+
includeEmbeddedItems?: boolean;
|
|
28
|
+
onDoubleClick?: (item: ItemTreeNodeData) => void;
|
|
29
|
+
selectPagesOnly?: boolean;
|
|
30
|
+
onItemInserted?: (item: ItemDescriptor) => void;
|
|
31
|
+
renderNode?: (node: CustomTreeNode, defaultRenderer: (node: CustomTreeNode) => React.ReactNode) => React.ReactNode;
|
|
32
|
+
language: string;
|
|
33
|
+
includeItemPath?: boolean;
|
|
34
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export {};
|
|
@@ -1,41 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const utils_1 = require("./utils");
|
|
12
|
-
const Spinner_1 = require("./ui/Spinner");
|
|
13
|
-
const PerfectTree_1 = require("./ui/PerfectTree");
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEditContext, useEditContextRef } from "./client/editContext";
|
|
4
|
+
import { useCallback, useEffect, useRef, useState, useMemo, memo } from "react";
|
|
5
|
+
import { getChildren } from "./services/contentService";
|
|
6
|
+
import { ContextMenu } from "primereact/contextmenu";
|
|
7
|
+
import { ItemNameDialog } from "./ui/ItemNameDialog";
|
|
8
|
+
import { getAbsoluteIconUrl } from "./utils";
|
|
9
|
+
import { Spinner } from "./ui/Spinner";
|
|
10
|
+
import { PerfectTree } from "./ui/PerfectTree";
|
|
14
11
|
// Create a memoized version of PerfectTree
|
|
15
|
-
const MemoizedPerfectTree =
|
|
16
|
-
function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionMode, selectedItemIds, rootItemId, rootItemIds, onSelectionChange, filter, templateIds, className, includeEmbeddedItems, onDoubleClick, selectPagesOnly, renderNode, onItemInserted, language, includeItemPath, }) {
|
|
17
|
-
const [treeNodes, setTreeNodes] =
|
|
18
|
-
const [selectedNodeElement, setSelectedNodeElement] =
|
|
19
|
-
const [selectedKeys, setSelectedKeys] =
|
|
20
|
-
const [expandedKeys, setExpandedKeys] =
|
|
21
|
-
const treeContainerRef =
|
|
22
|
-
const editContext =
|
|
23
|
-
const nodeDictionary =
|
|
24
|
-
const cm =
|
|
25
|
-
const [menu, setMenu] =
|
|
26
|
-
const itemNameDialogRef =
|
|
27
|
-
const editContextRef =
|
|
28
|
-
const lastSelectedItemId =
|
|
29
|
-
const loadNodeChildren =
|
|
12
|
+
const MemoizedPerfectTree = memo(PerfectTree);
|
|
13
|
+
export default function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionMode, selectedItemIds, rootItemId, rootItemIds, onSelectionChange, filter, templateIds, className, includeEmbeddedItems, onDoubleClick, selectPagesOnly, renderNode, onItemInserted, language, includeItemPath, }) {
|
|
14
|
+
const [treeNodes, setTreeNodes] = useState([]);
|
|
15
|
+
const [selectedNodeElement, setSelectedNodeElement] = useState(null);
|
|
16
|
+
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
17
|
+
const [expandedKeys, setExpandedKeys] = useState([]);
|
|
18
|
+
const treeContainerRef = useRef(null);
|
|
19
|
+
const editContext = useEditContext();
|
|
20
|
+
const nodeDictionary = useRef({});
|
|
21
|
+
const cm = useRef(null);
|
|
22
|
+
const [menu, setMenu] = useState([]);
|
|
23
|
+
const itemNameDialogRef = useRef(null);
|
|
24
|
+
const editContextRef = useEditContextRef();
|
|
25
|
+
const lastSelectedItemId = useRef(undefined);
|
|
26
|
+
const loadNodeChildren = useCallback(async (node) => {
|
|
30
27
|
if (!editContext)
|
|
31
28
|
return [];
|
|
32
|
-
let children = await
|
|
29
|
+
let children = await getChildren(node.key, editContext.sessionId, templateIds, includeEmbeddedItems ?? false, language, includeItemPath ? "path,idPath" : undefined);
|
|
33
30
|
if (filter)
|
|
34
31
|
children = filter(children);
|
|
35
32
|
return children.map((x) => ({
|
|
36
33
|
key: x.id,
|
|
37
34
|
label: x.name,
|
|
38
|
-
iconUrl:
|
|
35
|
+
iconUrl: getAbsoluteIconUrl(x.icon),
|
|
39
36
|
isDraggable: isDraggable && isDraggable(x),
|
|
40
37
|
selectable: !selectPagesOnly || x.hasLayout,
|
|
41
38
|
data: x,
|
|
@@ -52,12 +49,12 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
52
49
|
templateIds,
|
|
53
50
|
includeItemPath,
|
|
54
51
|
]);
|
|
55
|
-
const updateCorrespondingNode =
|
|
52
|
+
const updateCorrespondingNode = useCallback((x, parent) => {
|
|
56
53
|
const node = nodeDictionary.current[x.id];
|
|
57
54
|
if (!node)
|
|
58
55
|
return;
|
|
59
56
|
node.label = x.name;
|
|
60
|
-
node.iconUrl =
|
|
57
|
+
node.iconUrl = getAbsoluteIconUrl(x.icon);
|
|
61
58
|
node.isDraggable =
|
|
62
59
|
isDraggable &&
|
|
63
60
|
isDraggable({
|
|
@@ -71,14 +68,14 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
71
68
|
node.hasChildren = x.hasChildren;
|
|
72
69
|
node.parent = parent;
|
|
73
70
|
}, [isDraggable, selectPagesOnly]);
|
|
74
|
-
const loadNode =
|
|
71
|
+
const loadNode = useCallback(async (descriptor) => {
|
|
75
72
|
const item = await editContext?.itemsRepository.getItem(descriptor);
|
|
76
73
|
if (!item)
|
|
77
74
|
return;
|
|
78
75
|
return {
|
|
79
76
|
key: item.id,
|
|
80
77
|
label: item.name,
|
|
81
|
-
iconUrl:
|
|
78
|
+
iconUrl: getAbsoluteIconUrl(item.icon),
|
|
82
79
|
isDraggable: isDraggable &&
|
|
83
80
|
isDraggable({
|
|
84
81
|
...item,
|
|
@@ -91,7 +88,7 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
91
88
|
hasChildren: item.hasChildren,
|
|
92
89
|
};
|
|
93
90
|
}, [editContext?.itemsRepository, isDraggable, selectPagesOnly]);
|
|
94
|
-
const loadRootNodes =
|
|
91
|
+
const loadRootNodes = useCallback(async (force = false) => {
|
|
95
92
|
if (!force && treeNodes.length > 0)
|
|
96
93
|
return treeNodes;
|
|
97
94
|
if (rootItemId)
|
|
@@ -104,7 +101,7 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
104
101
|
}))
|
|
105
102
|
.filter((x) => x) || []);
|
|
106
103
|
}, [loadNode, loadNodeChildren, rootItemId, rootItemIds, language]);
|
|
107
|
-
const doPreloadNodes =
|
|
104
|
+
const doPreloadNodes = useCallback(async (expandedKeys, treeNodes) => {
|
|
108
105
|
for (let i = 0; i < treeNodes.length; i++) {
|
|
109
106
|
const node = treeNodes[i];
|
|
110
107
|
if (!node)
|
|
@@ -121,12 +118,12 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
121
118
|
}
|
|
122
119
|
}
|
|
123
120
|
}, [loadNodeChildren]);
|
|
124
|
-
const preLoadNodes =
|
|
121
|
+
const preLoadNodes = useCallback(async (expandedKeys, force) => {
|
|
125
122
|
const rootNodes = await loadRootNodes(force);
|
|
126
123
|
await doPreloadNodes(expandedKeys, rootNodes);
|
|
127
124
|
setTreeNodes([...rootNodes.filter((x) => x)]);
|
|
128
125
|
}, [doPreloadNodes, loadRootNodes]);
|
|
129
|
-
const refreshNode =
|
|
126
|
+
const refreshNode = useCallback(async (node) => {
|
|
130
127
|
const tempNode = { ...node };
|
|
131
128
|
tempNode.children = undefined;
|
|
132
129
|
await doPreloadNodes(expandedKeys || [], [tempNode]);
|
|
@@ -140,10 +137,10 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
140
137
|
doPreloadNodes,
|
|
141
138
|
updateCorrespondingNode,
|
|
142
139
|
]);
|
|
143
|
-
|
|
140
|
+
useEffect(() => {
|
|
144
141
|
preLoadNodes(expandedKeys || [], false);
|
|
145
142
|
}, [language, preLoadNodes, expandedKeys]);
|
|
146
|
-
|
|
143
|
+
useEffect(() => {
|
|
147
144
|
if (!editContext?.itemsRepository)
|
|
148
145
|
return;
|
|
149
146
|
const unsubscribe = editContext.itemsRepository.subscribeItemsChanged(async (items) => {
|
|
@@ -177,14 +174,14 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
177
174
|
});
|
|
178
175
|
return newExpandedKeys;
|
|
179
176
|
}
|
|
180
|
-
|
|
177
|
+
useEffect(() => {
|
|
181
178
|
const newExpandedKeys = getExpandedKeys();
|
|
182
179
|
const hasNewKeys = newExpandedKeys.some((key) => !expandedKeys.includes(key));
|
|
183
180
|
if (hasNewKeys) {
|
|
184
181
|
setExpandedKeys([...new Set([...expandedKeys, ...newExpandedKeys])]);
|
|
185
182
|
}
|
|
186
183
|
}, [expandIdPath, preLoadNodes]);
|
|
187
|
-
|
|
184
|
+
useEffect(() => {
|
|
188
185
|
const newNodeDictionary = {};
|
|
189
186
|
createMap(treeNodes, newNodeDictionary);
|
|
190
187
|
nodeDictionary.current = newNodeDictionary;
|
|
@@ -197,23 +194,23 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
197
194
|
createMap(n.children, nodeDictionary);
|
|
198
195
|
});
|
|
199
196
|
}
|
|
200
|
-
const nodeTemplate =
|
|
201
|
-
let label = (
|
|
197
|
+
const nodeTemplate = useCallback((node) => {
|
|
198
|
+
let label = _jsx("span", { children: node.label });
|
|
202
199
|
if (node.url) {
|
|
203
|
-
label = ((
|
|
200
|
+
label = (_jsx("a", { onDragStart: (e) => e.preventDefault(), href: node.url, className: "text-primary font-semibold hover:underline", children: node.label }));
|
|
204
201
|
}
|
|
205
202
|
const getNodeCursor = (node) => {
|
|
206
203
|
if (node.isDraggable)
|
|
207
204
|
return "cursor-grab";
|
|
208
205
|
return "";
|
|
209
206
|
};
|
|
210
|
-
return ((
|
|
207
|
+
return (_jsxs("span", {
|
|
211
208
|
// onDragStart={(event: React.DragEvent<HTMLDivElement>) => {
|
|
212
209
|
// handleDragStart(node, event);
|
|
213
210
|
// }}
|
|
214
211
|
// onDragEnd={handleDragEnd}
|
|
215
212
|
// draggable={node.isDraggable}
|
|
216
|
-
className: `flex items-center gap-2 text-xs ${getNodeCursor(node)} ${node.className}`, children: [(
|
|
213
|
+
className: `flex items-center gap-2 text-xs ${getNodeCursor(node)} ${node.className}`, children: [_jsx("img", { src: node.iconUrl, style: { height: "16px" }, width: "16", height: "16", onDragStart: (e) => e.preventDefault() }), label] }));
|
|
217
214
|
}, []);
|
|
218
215
|
function handleDragStart(data) {
|
|
219
216
|
const items = data.isMultiSelect
|
|
@@ -243,7 +240,7 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
243
240
|
if (dragEnd)
|
|
244
241
|
dragEnd();
|
|
245
242
|
}
|
|
246
|
-
|
|
243
|
+
useEffect(() => {
|
|
247
244
|
if (!selectedNodeElement)
|
|
248
245
|
return;
|
|
249
246
|
const container = treeContainerRef.current;
|
|
@@ -262,11 +259,11 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
262
259
|
});
|
|
263
260
|
}
|
|
264
261
|
}, [selectedNodeElement]);
|
|
265
|
-
|
|
262
|
+
useEffect(() => {
|
|
266
263
|
setSelectedKeys(selectedItemIds || []);
|
|
267
264
|
}, [selectedItemIds]);
|
|
268
265
|
const itemCommands = editContext?.configuration.commands.allItemCommands || [];
|
|
269
|
-
const onContextMenu =
|
|
266
|
+
const onContextMenu = useCallback(async (node, originalEvent) => {
|
|
270
267
|
console.log("CONTEXT MENU", node);
|
|
271
268
|
const key = node.key;
|
|
272
269
|
let itemIds = selectedItemIds;
|
|
@@ -310,7 +307,7 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
310
307
|
onItemInserted,
|
|
311
308
|
]);
|
|
312
309
|
// Memoize the toggle expand handler
|
|
313
|
-
const handleToggleExpand =
|
|
310
|
+
const handleToggleExpand = useCallback((nodeKey) => {
|
|
314
311
|
setExpandedKeys((value) => {
|
|
315
312
|
if (value.includes(nodeKey))
|
|
316
313
|
return value.filter((x) => x !== nodeKey);
|
|
@@ -319,7 +316,7 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
319
316
|
});
|
|
320
317
|
}, []);
|
|
321
318
|
// Memoize the node selection handler
|
|
322
|
-
const handleNodeSelect =
|
|
319
|
+
const handleNodeSelect = useCallback((nodeKey, ev) => {
|
|
323
320
|
let newSelection = [...selectedKeys];
|
|
324
321
|
if (selectionMode == "multiple" &&
|
|
325
322
|
ev.shiftKey &&
|
|
@@ -369,19 +366,19 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
369
366
|
}
|
|
370
367
|
}, [onSelectionChange, selectionMode, selectedKeys]);
|
|
371
368
|
// Memoize the renderNode function
|
|
372
|
-
const memoizedRenderNode =
|
|
369
|
+
const memoizedRenderNode = useMemo(() => {
|
|
373
370
|
if (renderNode) {
|
|
374
371
|
return (node) => renderNode(node, (n) => nodeTemplate(n));
|
|
375
372
|
}
|
|
376
373
|
return nodeTemplate;
|
|
377
374
|
}, [renderNode, nodeTemplate]);
|
|
378
375
|
// Memoize the double click handler
|
|
379
|
-
const handleDoubleClick =
|
|
376
|
+
const handleDoubleClick = useCallback((node) => {
|
|
380
377
|
onDoubleClick?.(nodeDictionary.current[node.key]?.data);
|
|
381
378
|
}, [onDoubleClick]);
|
|
382
379
|
// Memoize treeNodes to prevent unnecessary re-renders
|
|
383
|
-
const memoizedTreeNodes =
|
|
384
|
-
const loadChildren =
|
|
380
|
+
const memoizedTreeNodes = useMemo(() => treeNodes, [treeNodes]);
|
|
381
|
+
const loadChildren = useCallback(async (node, forceReload = false) => {
|
|
385
382
|
if (!node.children || forceReload) {
|
|
386
383
|
const nodes = await loadNodeChildren(node);
|
|
387
384
|
node.children = nodes;
|
|
@@ -389,17 +386,17 @@ function ContentTree({ isDraggable, dragStart, dragEnd, expandIdPath, selectionM
|
|
|
389
386
|
setTreeNodes((prev) => [...prev]);
|
|
390
387
|
}
|
|
391
388
|
}, [loadNodeChildren]);
|
|
392
|
-
const loadOnExpand =
|
|
389
|
+
const loadOnExpand = useCallback(async (node) => {
|
|
393
390
|
node.children = null;
|
|
394
391
|
setTreeNodes([...treeNodes]);
|
|
395
392
|
await loadChildren(node);
|
|
396
393
|
}, [loadChildren, treeNodes]);
|
|
397
|
-
const handleDragOverZone =
|
|
394
|
+
const handleDragOverZone = useCallback((node, index, event) => {
|
|
398
395
|
return true;
|
|
399
396
|
}, []);
|
|
400
397
|
if (!memoizedTreeNodes.length)
|
|
401
|
-
return ((
|
|
402
|
-
return ((
|
|
398
|
+
return (_jsxs("div", { className: "flex h-full items-center justify-center gap-2 bg-gray-50 text-sm text-gray-500", children: [_jsx(Spinner, { size: "3xl" }), " Loading..."] }));
|
|
399
|
+
return (_jsxs(_Fragment, { children: [_jsx(ItemNameDialog, { ref: itemNameDialogRef }), _jsx(ContextMenu, { model: menu, ref: cm, className: "text-sm" }), _jsx("div", { className: className, ref: treeContainerRef, children: _jsx(MemoizedPerfectTree, { nodes: memoizedTreeNodes, expandedKeys: expandedKeys, onToggleExpand: handleToggleExpand, renderNode: memoizedRenderNode, onLazyLoad: loadOnExpand, onDoubleClick: handleDoubleClick, onSelect: handleNodeSelect, selectedKeys: selectedKeys, onContextMenu: onContextMenu, enableDragAndDrop: true, onStartDrag: handleDragStart, onDragOverZone: handleDragOverZone, onDragEnd: handleDragEnd, isDragging: editContext?.dragObject !== undefined, onDrop: (parent, index, event) => {
|
|
403
400
|
console.log("DROP", parent, index, event);
|
|
404
401
|
handleDrop(parent, index, event);
|
|
405
402
|
} }) })] }));
|