@alpaca-editor/core 1.0.3939 → 1.0.3941
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/components/ActionButton.d.ts +1 -0
- package/dist/components/ActionButton.js +2 -2
- package/dist/components/ActionButton.js.map +1 -1
- package/dist/editor/FieldActionsOverlay.d.ts +1 -0
- package/dist/editor/FieldActionsOverlay.js +2 -11
- package/dist/editor/FieldActionsOverlay.js.map +1 -1
- package/dist/editor/PictureCropper.js +65 -23
- package/dist/editor/PictureCropper.js.map +1 -1
- package/dist/editor/PictureEditor.js +16 -2
- package/dist/editor/PictureEditor.js.map +1 -1
- package/dist/editor/Titlebar.js +1 -1
- package/dist/editor/Titlebar.js.map +1 -1
- package/dist/editor/ai/GhostWriter.js +21 -2
- package/dist/editor/ai/GhostWriter.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +7 -3
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/media-selector/MediaFolderBrowser.d.ts +5 -0
- package/dist/editor/media-selector/MediaFolderBrowser.js +77 -0
- package/dist/editor/media-selector/MediaFolderBrowser.js.map +1 -0
- package/dist/editor/media-selector/MediaSelector.js +1 -1
- package/dist/editor/media-selector/MediaSelector.js.map +1 -1
- package/dist/editor/media-selector/Thumbnails.js +2 -2
- package/dist/editor/media-selector/index.d.ts +8 -0
- package/dist/editor/media-selector/index.js +9 -0
- package/dist/editor/media-selector/index.js.map +1 -0
- package/dist/editor/menubar/BrowseHistory.js +1 -1
- package/dist/editor/menubar/PageSelector.js +39 -15
- package/dist/editor/menubar/PageSelector.js.map +1 -1
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js +37 -11
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js.map +1 -1
- package/dist/editor/reviews/Comment.js +1 -1
- package/dist/editor/reviews/Comment.js.map +1 -1
- package/dist/editor/services/aiService.js +0 -1
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/editor/sidebar/ComponentTree.js +3 -4
- package/dist/editor/sidebar/ComponentTree.js.map +1 -1
- package/dist/editor/ui/SimpleTabs.d.ts +1 -0
- package/dist/editor/ui/SimpleTabs.js +3 -3
- package/dist/editor/ui/SimpleTabs.js.map +1 -1
- package/dist/editor/ui/Splitter.js +61 -6
- package/dist/editor/ui/Splitter.js.map +1 -1
- package/dist/editor/views/MediaFolderEditView.d.ts +4 -0
- package/dist/editor/views/MediaFolderEditView.js +40 -0
- package/dist/editor/views/MediaFolderEditView.js.map +1 -0
- package/dist/editor/views/SingleEditView.js +9 -1
- package/dist/editor/views/SingleEditView.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/styles.css +61 -5
- package/package.json +8 -2
- package/.prettierrc +0 -3
- package/build.css +0 -3
- package/components.json +0 -21
- package/eslint.config.mjs +0 -4
- package/images/bg-shape-black.webp +0 -0
- package/images/wizard-bg.png +0 -0
- package/images/wizard-tour.png +0 -0
- package/images/wizard.png +0 -0
- package/src/client-components/api.ts +0 -6
- package/src/client-components/index.ts +0 -19
- package/src/components/ActionButton.tsx +0 -41
- package/src/components/Error.tsx +0 -57
- package/src/components/ui/CardConnector.tsx +0 -56
- package/src/components/ui/button.tsx +0 -62
- package/src/components/ui/card.tsx +0 -372
- package/src/components/ui/context-menu.tsx +0 -250
- package/src/config/config.tsx +0 -917
- package/src/config/types.ts +0 -286
- package/src/editor/ComponentInfo.tsx +0 -90
- package/src/editor/ConfirmationDialog.tsx +0 -103
- package/src/editor/ContentTree.tsx +0 -730
- package/src/editor/ContextMenu.tsx +0 -230
- package/src/editor/Editor.tsx +0 -90
- package/src/editor/EditorWarning.tsx +0 -34
- package/src/editor/EditorWarnings.tsx +0 -33
- package/src/editor/FieldActionsOverlay.tsx +0 -307
- package/src/editor/FieldEditorPopup.tsx +0 -65
- package/src/editor/FieldHistory.tsx +0 -75
- package/src/editor/FieldList.tsx +0 -190
- package/src/editor/FieldListField.tsx +0 -391
- package/src/editor/FieldListFieldWithFallbacks.tsx +0 -217
- package/src/editor/FloatingToolbar.tsx +0 -163
- package/src/editor/ImageEditor.tsx +0 -128
- package/src/editor/ItemInfo.tsx +0 -90
- package/src/editor/LinkEditorDialog.tsx +0 -196
- package/src/editor/MainLayout.tsx +0 -95
- package/src/editor/MobileLayout.tsx +0 -68
- package/src/editor/NewEditorClient.tsx +0 -11
- package/src/editor/PictureCropper.tsx +0 -503
- package/src/editor/PictureEditor.tsx +0 -277
- package/src/editor/PictureEditorDialog.tsx +0 -381
- package/src/editor/PublishDialog.ignore +0 -74
- package/src/editor/ScrollingContentTree.tsx +0 -67
- package/src/editor/Terminal.tsx +0 -227
- package/src/editor/Titlebar.tsx +0 -104
- package/src/editor/ai/AiPopup.tsx +0 -59
- package/src/editor/ai/AiResponseMessage.tsx +0 -106
- package/src/editor/ai/AiTerminal.tsx +0 -503
- package/src/editor/ai/AiToolCall.tsx +0 -61
- package/src/editor/ai/EditorAiTerminal.tsx +0 -20
- package/src/editor/ai/GhostWriter.tsx +0 -432
- package/src/editor/ai/aiPageModel.ts +0 -108
- package/src/editor/ai/editorAiContext.ts +0 -18
- package/src/editor/client/AboutDialog.tsx +0 -44
- package/src/editor/client/EditorClient.tsx +0 -2241
- package/src/editor/client/GenericDialog.tsx +0 -50
- package/src/editor/client/editContext.ts +0 -416
- package/src/editor/client/helpers.ts +0 -44
- package/src/editor/client/itemsRepository.ts +0 -574
- package/src/editor/client/operations.ts +0 -768
- package/src/editor/client/pageModelBuilder.ts +0 -219
- package/src/editor/commands/commands.ts +0 -22
- package/src/editor/commands/componentCommands.tsx +0 -424
- package/src/editor/commands/createVersionCommand.ts +0 -33
- package/src/editor/commands/deleteVersionCommand.ts +0 -71
- package/src/editor/commands/itemCommands.tsx +0 -351
- package/src/editor/commands/localizeItem/LocalizeItemDialog.tsx +0 -201
- package/src/editor/commands/localizeItem/LocalizeItemUtils.ts +0 -27
- package/src/editor/commands/undo.ts +0 -39
- package/src/editor/component-designer/ComponentDesigner.tsx +0 -70
- package/src/editor/component-designer/ComponentDesignerAiTerminal.tsx +0 -11
- package/src/editor/component-designer/ComponentDesignerMenu.tsx +0 -91
- package/src/editor/component-designer/ComponentEditor.tsx +0 -97
- package/src/editor/component-designer/ComponentRenderingCodeEditor.tsx +0 -31
- package/src/editor/component-designer/ComponentRenderingEditor.tsx +0 -104
- package/src/editor/component-designer/ComponentsDropdown.tsx +0 -39
- package/src/editor/component-designer/PlaceholdersEditor.tsx +0 -179
- package/src/editor/component-designer/RenderingsDropdown.tsx +0 -36
- package/src/editor/component-designer/TemplateEditor.tsx +0 -236
- package/src/editor/component-designer/aiContext.ts +0 -23
- package/src/editor/componentTreeHelper.tsx +0 -116
- package/src/editor/context-menu/CopyMoveMenu.tsx +0 -103
- package/src/editor/context-menu/InsertMenu.tsx +0 -347
- package/src/editor/control-center/About.tsx +0 -342
- package/src/editor/control-center/ControlCenterMenu.tsx +0 -76
- package/src/editor/control-center/IndexOverview.tsx +0 -50
- package/src/editor/control-center/IndexSettings.tsx +0 -266
- package/src/editor/control-center/Info.tsx +0 -104
- package/src/editor/control-center/QuotaInfo.tsx +0 -301
- package/src/editor/control-center/Status.tsx +0 -113
- package/src/editor/control-center/WebSocketMessages.tsx +0 -155
- package/src/editor/editor-warnings/ItemLocked.tsx +0 -63
- package/src/editor/editor-warnings/NoLanguageWriteAccess.tsx +0 -22
- package/src/editor/editor-warnings/NoWorkflowWriteAccess.tsx +0 -23
- package/src/editor/editor-warnings/NoWriteAccess.tsx +0 -16
- package/src/editor/editor-warnings/ValidationErrors.tsx +0 -54
- package/src/editor/field-types/AttachmentEditor.tsx +0 -9
- package/src/editor/field-types/CheckboxEditor.tsx +0 -47
- package/src/editor/field-types/DropLinkEditor.tsx +0 -80
- package/src/editor/field-types/DropListEditor.tsx +0 -84
- package/src/editor/field-types/ImageFieldEditor.tsx +0 -65
- package/src/editor/field-types/InternalLinkFieldEditor.tsx +0 -117
- package/src/editor/field-types/LinkFieldEditor.tsx +0 -85
- package/src/editor/field-types/MultiLineText.tsx +0 -82
- package/src/editor/field-types/PictureFieldEditor.tsx +0 -121
- package/src/editor/field-types/RawEditor.tsx +0 -53
- package/src/editor/field-types/ReactQuill.tsx +0 -580
- package/src/editor/field-types/RichTextEditor.tsx +0 -22
- package/src/editor/field-types/RichTextEditorComponent.tsx +0 -127
- package/src/editor/field-types/SingleLineText.tsx +0 -174
- package/src/editor/field-types/TreeListEditor.tsx +0 -261
- package/src/editor/fieldTypes.ts +0 -140
- package/src/editor/media-selector/AiImageSearch.tsx +0 -185
- package/src/editor/media-selector/AiImageSearchPrompt.tsx +0 -94
- package/src/editor/media-selector/MediaSelector.tsx +0 -42
- package/src/editor/media-selector/Preview.tsx +0 -14
- package/src/editor/media-selector/Thumbnails.tsx +0 -48
- package/src/editor/media-selector/TreeSelector.tsx +0 -292
- package/src/editor/media-selector/UploadZone.tsx +0 -137
- package/src/editor/menubar/ActionsMenu.tsx +0 -94
- package/src/editor/menubar/ActiveUsers.tsx +0 -17
- package/src/editor/menubar/ApproveAndPublish.tsx +0 -18
- package/src/editor/menubar/BrowseHistory.tsx +0 -28
- package/src/editor/menubar/ItemLanguageVersion.tsx +0 -76
- package/src/editor/menubar/LanguageSelector.tsx +0 -226
- package/src/editor/menubar/Menu.tsx +0 -83
- package/src/editor/menubar/NavButtons.tsx +0 -74
- package/src/editor/menubar/PageSelector.tsx +0 -166
- package/src/editor/menubar/PageViewerControls.tsx +0 -120
- package/src/editor/menubar/PreviewSecondaryControls.tsx +0 -18
- package/src/editor/menubar/SecondaryControls.tsx +0 -45
- package/src/editor/menubar/Separator.tsx +0 -12
- package/src/editor/menubar/SiteInfo.tsx +0 -53
- package/src/editor/menubar/User.tsx +0 -27
- package/src/editor/menubar/VersionSelector.tsx +0 -142
- package/src/editor/page-editor-chrome/CommentHighlighting.tsx +0 -307
- package/src/editor/page-editor-chrome/CommentHighlightings.tsx +0 -35
- package/src/editor/page-editor-chrome/FieldActionIndicator.tsx +0 -59
- package/src/editor/page-editor-chrome/FieldActionIndicators.tsx +0 -23
- package/src/editor/page-editor-chrome/FieldEditedIndicator.tsx +0 -64
- package/src/editor/page-editor-chrome/FieldEditedIndicators.tsx +0 -35
- package/src/editor/page-editor-chrome/FrameMenu.tsx +0 -338
- package/src/editor/page-editor-chrome/FrameMenus.tsx +0 -48
- package/src/editor/page-editor-chrome/InlineEditor.tsx +0 -765
- package/src/editor/page-editor-chrome/LockedFieldIndicator.tsx +0 -61
- package/src/editor/page-editor-chrome/NoLayout.tsx +0 -36
- package/src/editor/page-editor-chrome/PageEditorChrome.tsx +0 -122
- package/src/editor/page-editor-chrome/PictureEditorOverlay.tsx +0 -161
- package/src/editor/page-editor-chrome/PlaceholderDropZone.tsx +0 -169
- package/src/editor/page-editor-chrome/PlaceholderDropZones.tsx +0 -315
- package/src/editor/page-editor-chrome/SuggestionHighlighting.tsx +0 -300
- package/src/editor/page-editor-chrome/SuggestionHighlightings.tsx +0 -40
- package/src/editor/page-editor-chrome/useInlineAICompletion.tsx +0 -791
- package/src/editor/page-viewer/DeviceToolbar.tsx +0 -70
- package/src/editor/page-viewer/EditorForm.tsx +0 -258
- package/src/editor/page-viewer/MiniMap.tsx +0 -362
- package/src/editor/page-viewer/PageViewer.tsx +0 -169
- package/src/editor/page-viewer/PageViewerFrame.tsx +0 -1022
- package/src/editor/page-viewer/pageModelSkeletonBuilder.ts +0 -412
- package/src/editor/page-viewer/pageViewContext.ts +0 -186
- package/src/editor/pageModel.ts +0 -220
- package/src/editor/picture-shared.tsx +0 -53
- package/src/editor/reviews/Comment.tsx +0 -307
- package/src/editor/reviews/Comments.tsx +0 -125
- package/src/editor/reviews/DiffView.tsx +0 -109
- package/src/editor/reviews/PreviewInfo.tsx +0 -35
- package/src/editor/reviews/Reviews.tsx +0 -280
- package/src/editor/reviews/SuggestedEdit.tsx +0 -316
- package/src/editor/reviews/reviewCommands.tsx +0 -47
- package/src/editor/reviews/useReviews.tsx +0 -70
- package/src/editor/services/aiService.ts +0 -174
- package/src/editor/services/componentDesignerService.ts +0 -151
- package/src/editor/services/contentService.ts +0 -180
- package/src/editor/services/editService.ts +0 -488
- package/src/editor/services/indexService.ts +0 -24
- package/src/editor/services/reviewsService.ts +0 -53
- package/src/editor/services/serviceHelper.ts +0 -95
- package/src/editor/services/suggestedEditsService.ts +0 -39
- package/src/editor/services/systemService.ts +0 -5
- package/src/editor/services/translationService.ts +0 -21
- package/src/editor/services-server/api.ts +0 -150
- package/src/editor/services-server/graphQL.ts +0 -106
- package/src/editor/sidebar/ComponentPalette.tsx +0 -161
- package/src/editor/sidebar/ComponentTree.tsx +0 -548
- package/src/editor/sidebar/ComponentTree2.tsxx +0 -490
- package/src/editor/sidebar/Debug.tsx +0 -111
- package/src/editor/sidebar/DictionaryEditor.tsx +0 -261
- package/src/editor/sidebar/EditHistory.tsx +0 -134
- package/src/editor/sidebar/GraphQL.tsx +0 -164
- package/src/editor/sidebar/Insert.tsx +0 -35
- package/src/editor/sidebar/MainContentTree.tsx +0 -102
- package/src/editor/sidebar/Performance.tsx +0 -53
- package/src/editor/sidebar/Sessions.tsx +0 -35
- package/src/editor/sidebar/Sidebar.tsx +0 -20
- package/src/editor/sidebar/SidebarView.tsx +0 -152
- package/src/editor/sidebar/Translations.tsx +0 -295
- package/src/editor/sidebar/Validation.tsx +0 -102
- package/src/editor/sidebar/ViewSelector.tsx +0 -60
- package/src/editor/sidebar/Workbox.tsx +0 -209
- package/src/editor/ui/CenteredMessage.tsx +0 -7
- package/src/editor/ui/CopyMoveTargetSelectorDialog.tsx +0 -81
- package/src/editor/ui/CopyToClipboardButton.tsx +0 -24
- package/src/editor/ui/DialogButtons.tsx +0 -11
- package/src/editor/ui/Icons.tsx +0 -709
- package/src/editor/ui/ItemList.tsx +0 -76
- package/src/editor/ui/ItemNameDialogNew.tsx +0 -118
- package/src/editor/ui/ItemSearch.tsx +0 -153
- package/src/editor/ui/PerfectTree.tsx +0 -571
- package/src/editor/ui/Section.tsx +0 -35
- package/src/editor/ui/SimpleIconButton.tsx +0 -54
- package/src/editor/ui/SimpleMenu.tsx +0 -40
- package/src/editor/ui/SimpleTable.tsx +0 -60
- package/src/editor/ui/SimpleTabs.tsx +0 -55
- package/src/editor/ui/SimpleToolbar.tsx +0 -7
- package/src/editor/ui/Spinner.tsx +0 -9
- package/src/editor/ui/Splitter.tsx +0 -314
- package/src/editor/ui/StackedPanels.tsx +0 -134
- package/src/editor/ui/Toolbar.tsx +0 -7
- package/src/editor/utils/id-helper.ts +0 -3
- package/src/editor/utils/insertOptions.ts +0 -69
- package/src/editor/utils/itemutils.ts +0 -29
- package/src/editor/utils/useMemoDebug.ts +0 -28
- package/src/editor/utils.ts +0 -486
- package/src/editor/views/CompareView.tsx +0 -245
- package/src/editor/views/EditView.tsx +0 -27
- package/src/editor/views/ItemEditor.tsx +0 -58
- package/src/editor/views/SingleEditView.tsx +0 -46
- package/src/fonts/Geist-Black.woff2 +0 -0
- package/src/fonts/Geist-Bold.woff2 +0 -0
- package/src/fonts/Geist-ExtraBold.woff2 +0 -0
- package/src/fonts/Geist-ExtraLight.woff2 +0 -0
- package/src/fonts/Geist-Light.woff2 +0 -0
- package/src/fonts/Geist-Medium.woff2 +0 -0
- package/src/fonts/Geist-Regular.woff2 +0 -0
- package/src/fonts/Geist-SemiBold.woff2 +0 -0
- package/src/fonts/Geist-Thin.woff2 +0 -0
- package/src/fonts/Geist[wght].woff2 +0 -0
- package/src/fonts/index.ts +0 -10
- package/src/index.ts +0 -23
- package/src/lib/safelist.tsx +0 -16
- package/src/lib/utils.ts +0 -6
- package/src/page-wizard/PageWizard.tsx +0 -139
- package/src/page-wizard/WizardBox.tsx +0 -4
- package/src/page-wizard/WizardBoxConnector.tsx +0 -56
- package/src/page-wizard/WizardSteps.tsx +0 -458
- package/src/page-wizard/service.ts +0 -35
- package/src/page-wizard/startPageWizardCommand.ts +0 -26
- package/src/page-wizard/steps/BuildPageStep.tsx +0 -259
- package/src/page-wizard/steps/CollectStep.tsx +0 -296
- package/src/page-wizard/steps/ComponentTypesSelector.tsx +0 -454
- package/src/page-wizard/steps/Components.tsx +0 -193
- package/src/page-wizard/steps/ContentStep.tsx +0 -890
- package/src/page-wizard/steps/EditButton.tsx +0 -34
- package/src/page-wizard/steps/FieldEditor.tsx +0 -102
- package/src/page-wizard/steps/Generate.tsx +0 -60
- package/src/page-wizard/steps/ImagesStep.tsx +0 -382
- package/src/page-wizard/steps/LayoutStep.tsx +0 -227
- package/src/page-wizard/steps/MetaDataStep.tsx +0 -173
- package/src/page-wizard/steps/SelectStep.tsx +0 -281
- package/src/page-wizard/steps/schema.ts +0 -180
- package/src/page-wizard/steps/usePageCreator.ts +0 -325
- package/src/page-wizard/usePageWizard.ts +0 -79
- package/src/revision.ts +0 -2
- package/src/splash-screen/NewPage.tsx +0 -294
- package/src/splash-screen/OpenPage.tsx +0 -113
- package/src/splash-screen/RecentPages.tsx +0 -123
- package/src/splash-screen/SectionHeadline.tsx +0 -21
- package/src/splash-screen/SplashScreen.tsx +0 -195
- package/src/tour/Tour.tsx +0 -566
- package/src/tour/default-tour.tsx +0 -301
- package/src/tour/preview-tour.tsx +0 -128
- package/src/types.ts +0 -335
- package/styles.css +0 -765
- package/tsconfig.build.json +0 -31
- package/tsconfig.json +0 -14
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { ComponentRenderingEditor } from "./ComponentRenderingEditor";
|
|
2
|
-
import { Splitter, SplitterPanel } from "primereact/splitter";
|
|
3
|
-
import { StackedPanels } from "../ui/StackedPanels";
|
|
4
|
-
import { Panel } from "../../config/types";
|
|
5
|
-
|
|
6
|
-
import { PlaceholdersEditor } from "./PlaceholdersEditor";
|
|
7
|
-
import { PuzzleIcon } from "../ui/Icons";
|
|
8
|
-
import { ComponentEditor } from "./ComponentEditor";
|
|
9
|
-
import { useEffect, useState } from "react";
|
|
10
|
-
import { useEditContext } from "../client/editContext";
|
|
11
|
-
import {
|
|
12
|
-
Component,
|
|
13
|
-
getAllComponents,
|
|
14
|
-
} from "../services/componentDesignerService";
|
|
15
|
-
import { PageViewerFrame } from "../page-viewer/PageViewerFrame";
|
|
16
|
-
|
|
17
|
-
export function ComponentDesigner() {
|
|
18
|
-
const [allComponents, setAllComponents] = useState<Component[]>([]);
|
|
19
|
-
const context = useEditContext();
|
|
20
|
-
if (!context?.page) return null;
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
async function loadComponents() {
|
|
24
|
-
if (context?.page) {
|
|
25
|
-
const components = await getAllComponents(context.page.item.id);
|
|
26
|
-
setAllComponents(components);
|
|
27
|
-
} else setAllComponents([]);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
loadComponents();
|
|
31
|
-
}, [context.page]);
|
|
32
|
-
|
|
33
|
-
const mainPanels: Panel[] = [
|
|
34
|
-
{
|
|
35
|
-
name: "template",
|
|
36
|
-
title: "Component",
|
|
37
|
-
initialSize: 30,
|
|
38
|
-
icon: <PuzzleIcon />,
|
|
39
|
-
noOverflow: true,
|
|
40
|
-
content: <ComponentEditor allComponents={allComponents} />,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "placeholders",
|
|
44
|
-
title: "Placeholders",
|
|
45
|
-
icon: "pi pi-th-large",
|
|
46
|
-
initialSize: 30,
|
|
47
|
-
noOverflow: true,
|
|
48
|
-
content: <PlaceholdersEditor allComponents={allComponents} />,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: "rendering",
|
|
52
|
-
title: "Rendering",
|
|
53
|
-
icon: "pi pi-palette",
|
|
54
|
-
initialSize: 40,
|
|
55
|
-
content: <ComponentRenderingEditor />,
|
|
56
|
-
noOverflow: true,
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<Splitter className="h-full">
|
|
62
|
-
<SplitterPanel>
|
|
63
|
-
<StackedPanels panels={mainPanels} />
|
|
64
|
-
</SplitterPanel>
|
|
65
|
-
<SplitterPanel>
|
|
66
|
-
<PageViewerFrame compareView={false} />
|
|
67
|
-
</SplitterPanel>
|
|
68
|
-
</Splitter>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AiTerminal } from "../ai/AiTerminal";
|
|
2
|
-
import { createDesignerAiContext } from "./aiContext";
|
|
3
|
-
|
|
4
|
-
export function ComponentDesignerAiTerminal() {
|
|
5
|
-
return (
|
|
6
|
-
<AiTerminal
|
|
7
|
-
createAiContext={createDesignerAiContext}
|
|
8
|
-
defaultProfile="Component Designer"
|
|
9
|
-
/>
|
|
10
|
-
);
|
|
11
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { Menubar } from "primereact/menubar";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
createNewComponent,
|
|
5
|
-
createRendering,
|
|
6
|
-
loadComponentDetails,
|
|
7
|
-
} from "../services/componentDesignerService";
|
|
8
|
-
import { ItemNameDialog } from "../ui/ItemNameDialogNew";
|
|
9
|
-
import { useRef } from "react";
|
|
10
|
-
import { useEditContext } from "../client/editContext";
|
|
11
|
-
import { ItemLanguageVersion } from "../menubar/ItemLanguageVersion";
|
|
12
|
-
|
|
13
|
-
export function ComponentDesignerMenu() {
|
|
14
|
-
const context = useEditContext();
|
|
15
|
-
if (!context) return;
|
|
16
|
-
|
|
17
|
-
// const menuItems = [
|
|
18
|
-
// {
|
|
19
|
-
// id: "newComponent",
|
|
20
|
-
// label: "New Component",
|
|
21
|
-
// icon: "pi pi-fw pi-plus",
|
|
22
|
-
// command: () => createNew(),
|
|
23
|
-
// // disabled: !context.componentRenderingFolder,
|
|
24
|
-
// },
|
|
25
|
-
// {
|
|
26
|
-
// id: "newRendering",
|
|
27
|
-
// label: "New Rendering",
|
|
28
|
-
// icon: "pi pi-fw pi-palette",
|
|
29
|
-
// command: () => createNewRendering(),
|
|
30
|
-
// disabled: !context.componentDesignerComponent,
|
|
31
|
-
// },
|
|
32
|
-
// {
|
|
33
|
-
// id: "delete",
|
|
34
|
-
// label: "Delete rendering",
|
|
35
|
-
// icon: "pi pi-fw pi-trash",
|
|
36
|
-
// disabled: !context.componentDesignerRendering,
|
|
37
|
-
// },
|
|
38
|
-
// ];
|
|
39
|
-
// const itemNameDialogRef = useRef<ItemNameDialogHandle>(null);
|
|
40
|
-
|
|
41
|
-
// const createNew = async () => {
|
|
42
|
-
// itemNameDialogRef.current?.show({
|
|
43
|
-
// title: "Choose Component Name",
|
|
44
|
-
// accept: async (name) => {
|
|
45
|
-
// await createNewComponent(name, context.page!.item);
|
|
46
|
-
// },
|
|
47
|
-
// });
|
|
48
|
-
// };
|
|
49
|
-
|
|
50
|
-
// const createNewRendering = async () => {
|
|
51
|
-
// itemNameDialogRef.current?.show({
|
|
52
|
-
// title: "Choose Rendering Name",
|
|
53
|
-
// accept: async (name) => {
|
|
54
|
-
// if (!context.componentDesignerComponent) return;
|
|
55
|
-
// const details = await createRendering(
|
|
56
|
-
// name,
|
|
57
|
-
// context.page!.item,
|
|
58
|
-
// context.componentDesignerComponent.templateId
|
|
59
|
-
// );
|
|
60
|
-
// if (!("id" in details)) return;
|
|
61
|
-
|
|
62
|
-
// const component = await loadComponentDetails(
|
|
63
|
-
// context.componentDesignerComponent.templateId,
|
|
64
|
-
// context!.page!.item.id
|
|
65
|
-
// );
|
|
66
|
-
// // const rendering = await getItem({
|
|
67
|
-
// // id: details.id,
|
|
68
|
-
// // language: "en",
|
|
69
|
-
// // version: 0,
|
|
70
|
-
// // });
|
|
71
|
-
// context.setComponentDesignerComponent(component);
|
|
72
|
-
// // context.setComponentDesignerRendering(rendering);
|
|
73
|
-
// },
|
|
74
|
-
// });
|
|
75
|
-
// };
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<>
|
|
79
|
-
{/* <Menubar
|
|
80
|
-
model={menuItems}
|
|
81
|
-
end={
|
|
82
|
-
<div className="flex items-center space-x-2">
|
|
83
|
-
<ItemLanguageVersion />
|
|
84
|
-
</div>
|
|
85
|
-
}
|
|
86
|
-
className="rounded-none border-0 border-b bg-gray-50 p-1 text-sm"
|
|
87
|
-
></Menubar>
|
|
88
|
-
<ItemNameDialog ref={itemNameDialogRef} /> */}
|
|
89
|
-
</>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { Toolbar } from "../ui/Toolbar";
|
|
3
|
-
import { ComponentsDropdown } from "./ComponentsDropdown";
|
|
4
|
-
import { TemplateEditor } from "./TemplateEditor";
|
|
5
|
-
import { getSelectedComponents } from "../componentTreeHelper";
|
|
6
|
-
import { useEditContext } from "../client/editContext";
|
|
7
|
-
import {
|
|
8
|
-
Component,
|
|
9
|
-
loadComponentDetails,
|
|
10
|
-
saveComponentDetails,
|
|
11
|
-
} from "../services/componentDesignerService";
|
|
12
|
-
|
|
13
|
-
import { Button } from "primereact/button";
|
|
14
|
-
|
|
15
|
-
export function ComponentEditor({
|
|
16
|
-
allComponents,
|
|
17
|
-
}: {
|
|
18
|
-
allComponents: Component[];
|
|
19
|
-
}) {
|
|
20
|
-
const context = useEditContext()!;
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
const loadSelectedComponent = async () => {
|
|
24
|
-
const selectedComponents = getSelectedComponents(context!);
|
|
25
|
-
if (selectedComponents.length !== 1) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const component = selectedComponents[0];
|
|
29
|
-
|
|
30
|
-
if (!component) {
|
|
31
|
-
context.setComponentDesignerComponent(undefined);
|
|
32
|
-
context.setComponentDesignerRendering(undefined);
|
|
33
|
-
} else {
|
|
34
|
-
context.setComponentDesignerComponent(
|
|
35
|
-
await loadComponentDetails(
|
|
36
|
-
component.datasourceItem!.templateId,
|
|
37
|
-
context!.page!.item.id
|
|
38
|
-
)
|
|
39
|
-
);
|
|
40
|
-
// if (component.rendering) {
|
|
41
|
-
// context.setComponentDesignerRendering(
|
|
42
|
-
// await getItem({
|
|
43
|
-
// id: component.rendering.id,
|
|
44
|
-
// language: "en",
|
|
45
|
-
// version: 0,
|
|
46
|
-
// })
|
|
47
|
-
// );
|
|
48
|
-
// } else context.setComponentDesignerRendering(undefined);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
loadSelectedComponent();
|
|
52
|
-
}, [context.selection]);
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
const refresh = async () => {
|
|
56
|
-
if (context.componentDesignerComponent) {
|
|
57
|
-
context.setComponentDesignerComponent(
|
|
58
|
-
await loadComponentDetails(
|
|
59
|
-
context.componentDesignerComponent.templateId,
|
|
60
|
-
context!.page!.item.id
|
|
61
|
-
)
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
refresh();
|
|
66
|
-
}, [context.refreshCompletedFlag]);
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<div className="flex flex-col h-full">
|
|
70
|
-
<Toolbar>
|
|
71
|
-
<ComponentsDropdown allComponents={allComponents} />{" "}
|
|
72
|
-
<Button
|
|
73
|
-
icon="pi pi-fw pi-save"
|
|
74
|
-
text
|
|
75
|
-
size="small"
|
|
76
|
-
disabled={!context.componentDesignerComponent}
|
|
77
|
-
onClick={() => {
|
|
78
|
-
const save = async () => {
|
|
79
|
-
await saveComponentDetails(
|
|
80
|
-
context.componentDesignerComponent!,
|
|
81
|
-
context.page!.item
|
|
82
|
-
);
|
|
83
|
-
context.showToast({
|
|
84
|
-
content: "Component saved",
|
|
85
|
-
severity: "success",
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
save();
|
|
89
|
-
}}
|
|
90
|
-
/>
|
|
91
|
-
</Toolbar>
|
|
92
|
-
<div className="flex-1 overflow-auto">
|
|
93
|
-
<TemplateEditor />
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import "@uiw/react-textarea-code-editor/dist.css";
|
|
2
|
-
|
|
3
|
-
import CodeEditor from "@uiw/react-textarea-code-editor";
|
|
4
|
-
|
|
5
|
-
export function ComponentRenderingCodeEditor({
|
|
6
|
-
code,
|
|
7
|
-
setCode,
|
|
8
|
-
}: {
|
|
9
|
-
code: string;
|
|
10
|
-
setCode: (code: string) => void;
|
|
11
|
-
}): React.ReactNode {
|
|
12
|
-
return (
|
|
13
|
-
<div className="size-full relative">
|
|
14
|
-
<div className="absolute inset-0 overflow-auto">
|
|
15
|
-
<CodeEditor
|
|
16
|
-
value={code}
|
|
17
|
-
language="js"
|
|
18
|
-
placeholder="Please enter TSX code."
|
|
19
|
-
onChange={(evn: any) => setCode(evn.target.value)}
|
|
20
|
-
padding={15}
|
|
21
|
-
style={{
|
|
22
|
-
fontSize: 12,
|
|
23
|
-
backgroundColor: "#f5f5f5",
|
|
24
|
-
fontFamily:
|
|
25
|
-
"ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace",
|
|
26
|
-
}}
|
|
27
|
-
/>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { Toolbar } from "../ui/Toolbar";
|
|
3
|
-
import { ComponentRenderingCodeEditor } from "./ComponentRenderingCodeEditor";
|
|
4
|
-
import { RenderingsDropdown } from "./RenderingsDropdown";
|
|
5
|
-
import { useEditContext } from "../client/editContext";
|
|
6
|
-
import { getSelectedComponents } from "../componentTreeHelper";
|
|
7
|
-
import { Button } from "primereact/button";
|
|
8
|
-
|
|
9
|
-
export function ComponentRenderingEditor() {
|
|
10
|
-
const context = useEditContext()!;
|
|
11
|
-
const [code, setCode] = useState<string>("");
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
async function loadRendering() {
|
|
15
|
-
const selectedComponents = getSelectedComponents(context!);
|
|
16
|
-
|
|
17
|
-
if (selectedComponents.length !== 1) {
|
|
18
|
-
context;
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const component = selectedComponents[0];
|
|
23
|
-
const renderingId = component?.rendering?.id;
|
|
24
|
-
|
|
25
|
-
if (renderingId) {
|
|
26
|
-
const renderingItem = await context.itemsRepository.getItem({
|
|
27
|
-
id: renderingId,
|
|
28
|
-
language: "en",
|
|
29
|
-
version: 0,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
context?.setComponentDesignerRendering(renderingItem);
|
|
33
|
-
} else {
|
|
34
|
-
context?.setComponentDesignerRendering(undefined);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
loadRendering();
|
|
39
|
-
}, [context.selection]);
|
|
40
|
-
|
|
41
|
-
const codeField = context.componentDesignerRendering?.fields.find(
|
|
42
|
-
(x) => x.name === "code"
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
if (codeField) {
|
|
47
|
-
setCode(codeField.value as string);
|
|
48
|
-
} else {
|
|
49
|
-
setCode("");
|
|
50
|
-
}
|
|
51
|
-
}, [context.componentDesignerRendering]);
|
|
52
|
-
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
const refresh = async () => {
|
|
55
|
-
if (context.componentDesignerRendering) {
|
|
56
|
-
const renderingItem = await context.itemsRepository.getItem({
|
|
57
|
-
id: context.componentDesignerRendering.id,
|
|
58
|
-
language: "en",
|
|
59
|
-
version: 0,
|
|
60
|
-
});
|
|
61
|
-
context?.setComponentDesignerRendering(renderingItem);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
refresh();
|
|
65
|
-
}, [context.refreshCompletedFlag]);
|
|
66
|
-
|
|
67
|
-
if (!context.componentDesignerComponent)
|
|
68
|
-
return (
|
|
69
|
-
<div className="flex items-center justify-center h-full text-xs">
|
|
70
|
-
Select a component
|
|
71
|
-
</div>
|
|
72
|
-
);
|
|
73
|
-
else
|
|
74
|
-
return (
|
|
75
|
-
<div className="flex flex-col h-full">
|
|
76
|
-
<Toolbar>
|
|
77
|
-
<RenderingsDropdown />
|
|
78
|
-
<Button
|
|
79
|
-
icon="pi pi-fw pi-save"
|
|
80
|
-
text
|
|
81
|
-
size="small"
|
|
82
|
-
disabled={!codeField}
|
|
83
|
-
onClick={() => {
|
|
84
|
-
if (!codeField) return;
|
|
85
|
-
context.operations.editField({
|
|
86
|
-
field: codeField.descriptor,
|
|
87
|
-
value: code,
|
|
88
|
-
});
|
|
89
|
-
}}
|
|
90
|
-
/>
|
|
91
|
-
</Toolbar>
|
|
92
|
-
<div className="flex-1">
|
|
93
|
-
{!codeField && (
|
|
94
|
-
<div className="flex items-center justify-center h-full text-xs">
|
|
95
|
-
Select a rendering
|
|
96
|
-
</div>
|
|
97
|
-
)}
|
|
98
|
-
{codeField && (
|
|
99
|
-
<ComponentRenderingCodeEditor code={code} setCode={setCode} />
|
|
100
|
-
)}
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useEditContext } from "../client/editContext";
|
|
2
|
-
import {
|
|
3
|
-
Component,
|
|
4
|
-
loadComponentDetails,
|
|
5
|
-
} from "../services/componentDesignerService";
|
|
6
|
-
|
|
7
|
-
import { Dropdown } from "primereact/dropdown";
|
|
8
|
-
|
|
9
|
-
export function ComponentsDropdown({
|
|
10
|
-
allComponents,
|
|
11
|
-
}: {
|
|
12
|
-
allComponents: Component[];
|
|
13
|
-
}) {
|
|
14
|
-
const context = useEditContext();
|
|
15
|
-
if (!context?.page) return null;
|
|
16
|
-
|
|
17
|
-
async function loadComponent(id: string) {
|
|
18
|
-
const component = await loadComponentDetails(id, context!.page!.item.id);
|
|
19
|
-
context!.setComponentDesignerComponent(component);
|
|
20
|
-
}
|
|
21
|
-
const value = allComponents.find(
|
|
22
|
-
(x) => x.templateId === context.componentDesignerComponent?.templateId
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<Dropdown
|
|
27
|
-
value={value}
|
|
28
|
-
filter
|
|
29
|
-
options={allComponents}
|
|
30
|
-
optionLabel="name"
|
|
31
|
-
placeholder="Select a Component"
|
|
32
|
-
onChange={(e) => {
|
|
33
|
-
loadComponent(e.value.templateId);
|
|
34
|
-
context.setComponentDesignerRendering(undefined);
|
|
35
|
-
context.select([]);
|
|
36
|
-
}}
|
|
37
|
-
/>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { useEditContext } from "../client/editContext";
|
|
2
|
-
import {
|
|
3
|
-
Component,
|
|
4
|
-
PlaceholderDefinition,
|
|
5
|
-
saveComponentDetails,
|
|
6
|
-
} from "../services/componentDesignerService";
|
|
7
|
-
import { ArrowDownIcon } from "../ui/Icons";
|
|
8
|
-
import { Toolbar } from "../ui/Toolbar";
|
|
9
|
-
import { Button } from "primereact/button";
|
|
10
|
-
import { ItemNameDialog } from "../ui/ItemNameDialogNew";
|
|
11
|
-
|
|
12
|
-
import { InsertOption } from "../../types";
|
|
13
|
-
|
|
14
|
-
export function PlaceholdersEditor({
|
|
15
|
-
allComponents,
|
|
16
|
-
}: {
|
|
17
|
-
allComponents: Component[];
|
|
18
|
-
}) {
|
|
19
|
-
const context = useEditContext()!;
|
|
20
|
-
const component = context.componentDesignerComponent;
|
|
21
|
-
// const itemNameDialogRef = useRef<ItemNameDialogHandle>(null);
|
|
22
|
-
|
|
23
|
-
const handleDragStart = (
|
|
24
|
-
event: React.DragEvent<HTMLDivElement>,
|
|
25
|
-
component: Component | InsertOption,
|
|
26
|
-
) => {
|
|
27
|
-
event.dataTransfer.setData("text/plain", JSON.stringify(component));
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const handleDragOver = (event: React.DragEvent<HTMLDivElement>) => {
|
|
31
|
-
event.preventDefault();
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const handleDrop = (
|
|
35
|
-
event: React.DragEvent<HTMLDivElement>,
|
|
36
|
-
placeholderName: string,
|
|
37
|
-
) => {
|
|
38
|
-
event.preventDefault();
|
|
39
|
-
const componentData = JSON.parse(event.dataTransfer.getData("text/plain"));
|
|
40
|
-
const placeholder = component?.placeholders.find(
|
|
41
|
-
(x) => x.name == placeholderName,
|
|
42
|
-
);
|
|
43
|
-
if (!placeholder) return;
|
|
44
|
-
console.log(placeholder, componentData);
|
|
45
|
-
|
|
46
|
-
if (placeholder.components.find((x) => x.typeId === componentData.typeId))
|
|
47
|
-
return;
|
|
48
|
-
placeholder.components.push(componentData);
|
|
49
|
-
context.setComponentDesignerComponent({
|
|
50
|
-
...context.componentDesignerComponent!,
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const removeInsertOption = (
|
|
55
|
-
placeholder: PlaceholderDefinition,
|
|
56
|
-
insertOption: InsertOption,
|
|
57
|
-
) => {
|
|
58
|
-
placeholder.components = placeholder.components.filter(
|
|
59
|
-
(x) => x.typeId !== insertOption.typeId,
|
|
60
|
-
);
|
|
61
|
-
context.setComponentDesignerComponent({
|
|
62
|
-
...context.componentDesignerComponent!,
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// const addNewPlaceholder = async () => {
|
|
67
|
-
// itemNameDialogRef.current?.show({
|
|
68
|
-
// title: "Choose Placeholder Name",
|
|
69
|
-
// accept: async (name: string) => {
|
|
70
|
-
// if (!context.componentDesignerComponent) return;
|
|
71
|
-
// const placeholder = {
|
|
72
|
-
// name: name,
|
|
73
|
-
// components: [],
|
|
74
|
-
// };
|
|
75
|
-
// context.componentDesignerComponent.placeholders.push(placeholder);
|
|
76
|
-
// context.setComponentDesignerComponent({
|
|
77
|
-
// ...context.componentDesignerComponent!,
|
|
78
|
-
// });
|
|
79
|
-
// },
|
|
80
|
-
// });
|
|
81
|
-
// };
|
|
82
|
-
|
|
83
|
-
if (!component)
|
|
84
|
-
return (
|
|
85
|
-
<div className="flex h-full items-center justify-center text-xs">
|
|
86
|
-
Select a component
|
|
87
|
-
</div>
|
|
88
|
-
);
|
|
89
|
-
else
|
|
90
|
-
return (
|
|
91
|
-
<div className="flex h-full flex-col">
|
|
92
|
-
<Toolbar>
|
|
93
|
-
{/* <Button
|
|
94
|
-
icon="pi pi-fw pi-plus"
|
|
95
|
-
label="New Placeholder"
|
|
96
|
-
text
|
|
97
|
-
size="small"
|
|
98
|
-
className="text-xs font-normal text-gray-800"
|
|
99
|
-
disabled={!component}
|
|
100
|
-
onClick={() => {
|
|
101
|
-
addNewPlaceholder();
|
|
102
|
-
}}
|
|
103
|
-
/> */}
|
|
104
|
-
<Button
|
|
105
|
-
icon="pi pi-fw pi-save"
|
|
106
|
-
label="Save"
|
|
107
|
-
text
|
|
108
|
-
size="small"
|
|
109
|
-
className="text-xs font-normal text-gray-800"
|
|
110
|
-
disabled={!component}
|
|
111
|
-
onClick={() => {
|
|
112
|
-
saveComponentDetails(component, context.page!.item);
|
|
113
|
-
}}
|
|
114
|
-
/>
|
|
115
|
-
</Toolbar>
|
|
116
|
-
<div className="flex flex-1">
|
|
117
|
-
<div className="relative h-full flex-1">
|
|
118
|
-
<div className="absolute inset-1 overflow-y-auto">
|
|
119
|
-
{component.placeholders.map((x) => (
|
|
120
|
-
<div
|
|
121
|
-
key={x.name}
|
|
122
|
-
className="mb-2"
|
|
123
|
-
onDragOver={handleDragOver}
|
|
124
|
-
onDrop={(event) => handleDrop(event, x.name)}
|
|
125
|
-
>
|
|
126
|
-
<div className="flex items-center gap-1 text-xs">
|
|
127
|
-
<ArrowDownIcon /> {x.name}
|
|
128
|
-
</div>
|
|
129
|
-
<div className="mt-1.5 flex flex-wrap gap-4 p-1 text-xs">
|
|
130
|
-
{x.components.map((y) => (
|
|
131
|
-
<div className="relative" key={y.typeId}>
|
|
132
|
-
<div
|
|
133
|
-
className="absolute top-[-12px] right-[-12px] cursor-pointer rounded-full border bg-white p-1"
|
|
134
|
-
onClick={() => removeInsertOption(x, y)}
|
|
135
|
-
>
|
|
136
|
-
<i className="pi pi-times text-xs" />
|
|
137
|
-
</div>
|
|
138
|
-
{renderComponent(y)}
|
|
139
|
-
</div>
|
|
140
|
-
))}
|
|
141
|
-
</div>
|
|
142
|
-
</div>
|
|
143
|
-
))}
|
|
144
|
-
</div>
|
|
145
|
-
</div>
|
|
146
|
-
<div className="relative w-24">
|
|
147
|
-
<div className="absolute inset-0 overflow-y-auto border-l text-xs">
|
|
148
|
-
{allComponents.map((x) => (
|
|
149
|
-
<div
|
|
150
|
-
key={x.templateId}
|
|
151
|
-
className="mb-2 cursor-grab"
|
|
152
|
-
draggable
|
|
153
|
-
onDragStart={(event) => handleDragStart(event, x)}
|
|
154
|
-
>
|
|
155
|
-
{renderComponent(x)}
|
|
156
|
-
</div>
|
|
157
|
-
))}
|
|
158
|
-
</div>
|
|
159
|
-
</div>
|
|
160
|
-
</div>
|
|
161
|
-
{/* <ItemNameDialog ref={itemNameDialogRef} /> */}
|
|
162
|
-
</div>
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function renderComponent(y: Component | InsertOption) {
|
|
167
|
-
return (
|
|
168
|
-
<div className="flex flex-col items-center border border-gray-200 p-2">
|
|
169
|
-
{y.svg && (
|
|
170
|
-
<div
|
|
171
|
-
className="h-8 w-8"
|
|
172
|
-
dangerouslySetInnerHTML={{ __html: y.svg }}
|
|
173
|
-
></div>
|
|
174
|
-
)}
|
|
175
|
-
{!y.svg && <img src={y.icon} width="32" height="32"></img>}
|
|
176
|
-
{y.name}
|
|
177
|
-
</div>
|
|
178
|
-
);
|
|
179
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { useEditContext } from "../client/editContext";
|
|
2
|
-
import { Dropdown } from "primereact/dropdown";
|
|
3
|
-
|
|
4
|
-
import { Rendering } from "../../types";
|
|
5
|
-
|
|
6
|
-
export function RenderingsDropdown() {
|
|
7
|
-
const context = useEditContext()!;
|
|
8
|
-
|
|
9
|
-
if (!context.componentDesignerComponent) return null;
|
|
10
|
-
|
|
11
|
-
const compatibleRenderings = [
|
|
12
|
-
...context.componentDesignerComponent.compatibleRenderings,
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
if (!compatibleRenderings) return null;
|
|
16
|
-
|
|
17
|
-
const loadRendering = async (value: Rendering) => {
|
|
18
|
-
const item = await context.itemsRepository.getItem({
|
|
19
|
-
id: value.id,
|
|
20
|
-
language: "en",
|
|
21
|
-
version: 0,
|
|
22
|
-
});
|
|
23
|
-
context.setComponentDesignerRendering(item);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<Dropdown
|
|
28
|
-
options={compatibleRenderings}
|
|
29
|
-
optionLabel="name"
|
|
30
|
-
value={compatibleRenderings.find(
|
|
31
|
-
(x) => x.id === (context.componentDesignerRendering?.id || "")
|
|
32
|
-
)}
|
|
33
|
-
onChange={(e) => loadRendering(e.value as Rendering)}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
}
|