@gravity-ui/page-constructor 5.14.4-alpha.0 → 5.14.4-alpha.2
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/README.md +31 -1
- package/build/cjs/blocks/CardLayout/index.d.ts +1 -1
- package/build/cjs/blocks/ContentLayout/index.d.ts +1 -1
- package/build/cjs/blocks/ExtendedFeatures/index.d.ts +1 -1
- package/build/cjs/blocks/FilterBlock/index.d.ts +1 -1
- package/build/cjs/blocks/Form/index.d.ts +1 -1
- package/build/cjs/blocks/Header/dynamic-form.d.ts +2 -2
- package/build/cjs/blocks/Header/index.d.ts +1 -1
- package/build/cjs/blocks/HeaderSlider/index.d.ts +1 -1
- package/build/cjs/blocks/Icons/index.d.ts +1 -1
- package/build/cjs/blocks/Info/index.d.ts +1 -1
- package/build/cjs/blocks/Map/index.d.ts +1 -1
- package/build/cjs/blocks/Media/index.d.ts +1 -1
- package/build/cjs/blocks/PromoFeaturesBlock/index.d.ts +1 -1
- package/build/cjs/blocks/Questions/index.d.ts +1 -1
- package/build/cjs/blocks/Share/index.d.ts +1 -1
- package/build/cjs/blocks/Slider/dynamic-form.d.ts +3 -3
- package/build/cjs/blocks/Slider/index.d.ts +1 -1
- package/build/cjs/blocks/Table/index.d.ts +1 -1
- package/build/cjs/blocks/Tabs/index.d.ts +1 -1
- package/build/cjs/blocks/TestEditorBlock/form.d.ts +1 -1
- package/build/cjs/blocks/TestEditorBlock/index.d.ts +1 -1
- package/build/cjs/common/hooks/usePostMessage.d.ts +11 -0
- package/build/cjs/common/hooks/usePostMessage.js +94 -0
- package/build/{esm → cjs/common}/types/actions/initial.d.ts +1 -1
- package/build/{esm → cjs/common}/types/actions/other.d.ts +1 -1
- package/build/cjs/{types → common/types}/actions/reorder.d.ts +3 -1
- package/build/cjs/{types/index.d.ts → common/types/common.d.ts} +3 -3
- package/build/cjs/{types/dynamic-form.d.ts → common/types/forms.d.ts} +2 -1
- package/build/cjs/common/types/index.d.ts +4 -0
- package/build/cjs/common/types/index.js +7 -0
- package/build/cjs/{context/messagesContext/types.d.ts → common/types/messages.d.ts} +1 -1
- package/build/cjs/components/Image/dynamic-form.d.ts +1 -1
- package/build/cjs/constructor-items.d.ts +7 -1
- package/build/cjs/constructor-items.js +6 -0
- package/build/cjs/containers/PageConstructor/components/ConstructorBlock/hooks/useEditorBlockMouseEvents.js +1 -1
- package/build/cjs/context/editorContext/store.d.ts +1 -1
- package/build/cjs/context/editorContext/store.js +7 -7
- package/build/cjs/context/messagesContext/hooks/useMessageObserver.d.ts +1 -1
- package/build/cjs/context/messagesContext/hooks/useMessageSender.d.ts +1 -1
- package/build/cjs/context/messagesContext/messagesContext.d.ts +1 -2
- package/build/cjs/context/messagesContext/messagesProvider.js +7 -53
- package/build/cjs/context/messagesContext/store.d.ts +1 -2
- package/build/cjs/editor/data/templates/test-editor-block.json +18 -0
- package/build/cjs/editor-v2/components/BigOverlay/BigOverlay.css +33 -0
- package/build/cjs/editor-v2/components/BigOverlay/BigOverlay.d.ts +6 -0
- package/build/cjs/editor-v2/components/BigOverlay/BigOverlay.js +40 -0
- package/build/cjs/editor-v2/components/BlockConfig/BlockConfig.css +33 -0
- package/build/cjs/editor-v2/components/BlockConfig/BlockConfig.d.ts +6 -0
- package/build/cjs/editor-v2/components/BlockConfig/BlockConfig.js +35 -0
- package/build/cjs/editor-v2/components/BlocksList/BlocksList.css +42 -0
- package/build/cjs/editor-v2/components/BlocksList/BlocksList.d.ts +7 -0
- package/build/cjs/editor-v2/components/BlocksList/BlocksList.js +22 -0
- package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.css +2 -0
- package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.d.ts +11 -0
- package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.js +118 -0
- package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.css +61 -0
- package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.d.ts +12 -0
- package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.js +32 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.css +38 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.d.ts +13 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.js +83 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.d.ts +11 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js +28 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.d.ts +9 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.js +14 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Number/Number.d.ts +9 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Number/Number.js +17 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Object/Object.css +5 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Object/Object.d.ts +12 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Object/Object.js +16 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.css +8 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.d.ts +11 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js +34 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.d.ts +12 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.js +16 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Text/Text.d.ts +9 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Text/Text.js +14 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.d.ts +9 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js +14 -0
- package/build/cjs/editor-v2/components/DynamicForm/utils.d.ts +3 -0
- package/build/cjs/editor-v2/components/DynamicForm/utils.js +22 -0
- package/build/cjs/editor-v2/components/GlobalConfig/GlobalConfig.css +22 -0
- package/build/cjs/editor-v2/components/GlobalConfig/GlobalConfig.d.ts +6 -0
- package/build/cjs/editor-v2/components/GlobalConfig/GlobalConfig.js +18 -0
- package/build/cjs/editor-v2/components/MiddleScreen/MiddleScreen.css +53 -0
- package/build/cjs/editor-v2/components/MiddleScreen/MiddleScreen.d.ts +6 -0
- package/build/cjs/editor-v2/components/MiddleScreen/MiddleScreen.js +34 -0
- package/build/cjs/editor-v2/components/Overlay/Overlay.css +56 -0
- package/build/cjs/editor-v2/components/Overlay/Overlay.d.ts +6 -0
- package/build/cjs/editor-v2/components/Overlay/Overlay.js +71 -0
- package/build/cjs/editor-v2/components/Sidebar/Sidebar.css +66 -0
- package/build/cjs/editor-v2/components/Sidebar/Sidebar.d.ts +7 -0
- package/build/cjs/editor-v2/components/Sidebar/Sidebar.js +68 -0
- package/build/cjs/editor-v2/components/Source/Source.css +21 -0
- package/build/cjs/editor-v2/components/Source/Source.d.ts +6 -0
- package/build/cjs/editor-v2/components/Source/Source.js +30 -0
- package/build/cjs/editor-v2/components/SourceCode/SourceCode.css +44 -0
- package/build/cjs/editor-v2/components/SourceCode/SourceCode.d.ts +6 -0
- package/build/cjs/editor-v2/components/SourceCode/SourceCode.js +55 -0
- package/build/cjs/editor-v2/components/TopBar/TopBar.css +34 -0
- package/build/cjs/editor-v2/components/TopBar/TopBar.d.ts +10 -0
- package/build/cjs/editor-v2/components/TopBar/TopBar.js +15 -0
- package/build/cjs/editor-v2/components/Tree/Tree.css +148 -0
- package/build/cjs/editor-v2/components/Tree/Tree.d.ts +7 -0
- package/build/cjs/editor-v2/components/Tree/Tree.js +32 -0
- package/build/cjs/editor-v2/components/ViewSwitches/ViewSwitches.css +23 -0
- package/build/cjs/editor-v2/components/ViewSwitches/ViewSwitches.d.ts +10 -0
- package/build/cjs/editor-v2/components/ViewSwitches/ViewSwitches.js +22 -0
- package/build/cjs/editor-v2/constants.d.ts +1 -0
- package/build/cjs/editor-v2/constants.js +4 -0
- package/build/cjs/editor-v2/containers/Editor/Editor.css +54 -0
- package/build/cjs/editor-v2/containers/Editor/Editor.d.ts +9 -0
- package/build/cjs/editor-v2/containers/Editor/Editor.js +66 -0
- package/build/cjs/editor-v2/containers/Editor/hooks/useAdminInitialize.d.ts +2 -0
- package/build/cjs/editor-v2/containers/Editor/hooks/useAdminInitialize.js +25 -0
- package/build/cjs/editor-v2/context/contentConfig/contentConfigContext.d.ts +10 -0
- package/build/cjs/editor-v2/context/contentConfig/contentConfigContext.js +9 -0
- package/build/cjs/editor-v2/context/contentConfig/contentConfigProvider.d.ts +8 -0
- package/build/cjs/editor-v2/context/contentConfig/contentConfigProvider.js +19 -0
- package/build/cjs/editor-v2/context/contentConfig/hooks/useContentConfigStore.d.ts +2 -0
- package/build/cjs/editor-v2/context/contentConfig/hooks/useContentConfigStore.js +15 -0
- package/build/cjs/editor-v2/context/contentConfig/index.d.ts +4 -0
- package/build/cjs/editor-v2/context/contentConfig/index.js +7 -0
- package/build/cjs/editor-v2/context/contentConfig/store.d.ts +35 -0
- package/build/cjs/editor-v2/context/contentConfig/store.js +106 -0
- package/build/cjs/editor-v2/context/editorContext/editorContext.d.ts +11 -0
- package/build/cjs/editor-v2/context/editorContext/editorContext.js +10 -0
- package/build/cjs/editor-v2/context/editorContext/editorProvider.d.ts +2 -0
- package/build/cjs/editor-v2/context/editorContext/editorProvider.js +15 -0
- package/build/cjs/editor-v2/context/editorContext/hooks/useEditorStore.d.ts +2 -0
- package/build/cjs/editor-v2/context/editorContext/hooks/useEditorStore.js +15 -0
- package/build/cjs/editor-v2/context/editorContext/index.d.ts +4 -0
- package/build/cjs/editor-v2/context/editorContext/index.js +7 -0
- package/build/cjs/editor-v2/context/editorContext/store.d.ts +26 -0
- package/build/cjs/editor-v2/context/editorContext/store.js +55 -0
- package/build/cjs/editor-v2/context/iframeContext/hooks/useIframeStore.d.ts +2 -0
- package/build/cjs/editor-v2/context/iframeContext/hooks/useIframeStore.js +15 -0
- package/build/cjs/editor-v2/context/iframeContext/iframeContext.d.ts +13 -0
- package/build/cjs/editor-v2/context/iframeContext/iframeContext.js +9 -0
- package/build/cjs/editor-v2/context/iframeContext/iframeProvider.d.ts +7 -0
- package/build/cjs/editor-v2/context/iframeContext/iframeProvider.js +23 -0
- package/build/cjs/editor-v2/context/iframeContext/index.d.ts +4 -0
- package/build/cjs/editor-v2/context/iframeContext/index.js +7 -0
- package/build/cjs/editor-v2/context/iframeContext/store.d.ts +26 -0
- package/build/cjs/editor-v2/context/iframeContext/store.js +45 -0
- package/build/cjs/editor-v2/context/messagesContext/hooks/useMessageObserver.d.ts +4 -0
- package/build/cjs/editor-v2/context/messagesContext/hooks/useMessageObserver.js +17 -0
- package/build/cjs/editor-v2/context/messagesContext/hooks/useMessageSender.d.ts +2 -0
- package/build/cjs/editor-v2/context/messagesContext/hooks/useMessageSender.js +11 -0
- package/build/cjs/editor-v2/context/messagesContext/hooks/useMessagesStore.d.ts +2 -0
- package/build/cjs/editor-v2/context/messagesContext/hooks/useMessagesStore.js +15 -0
- package/build/cjs/editor-v2/context/messagesContext/index.d.ts +5 -0
- package/build/cjs/editor-v2/context/messagesContext/index.js +8 -0
- package/build/cjs/editor-v2/context/messagesContext/messagesContext.d.ts +13 -0
- package/build/cjs/editor-v2/context/messagesContext/messagesContext.js +12 -0
- package/build/cjs/editor-v2/context/messagesContext/messagesProvider.d.ts +2 -0
- package/build/cjs/editor-v2/context/messagesContext/messagesProvider.js +35 -0
- package/build/cjs/editor-v2/context/messagesContext/store.d.ts +22 -0
- package/build/cjs/editor-v2/context/messagesContext/store.js +17 -0
- package/build/cjs/editor-v2/icons/Tablet.d.ts +2 -0
- package/build/cjs/editor-v2/icons/Tablet.js +9 -0
- package/build/cjs/editor-v2/index.d.ts +2 -0
- package/build/cjs/editor-v2/index.js +7 -0
- package/build/cjs/editor-v2/styles/mixins.css +0 -0
- package/build/cjs/editor-v2/styles/root.css +9 -0
- package/build/cjs/editor-v2/styles/variables.css +0 -0
- package/build/cjs/editor-v2/utils/code.d.ts +6 -0
- package/build/cjs/editor-v2/utils/code.js +11 -0
- package/build/cjs/editor-v2/utils/index.d.ts +17 -0
- package/build/cjs/editor-v2/utils/index.js +151 -0
- package/build/cjs/editor-v2/utils/store.d.ts +14 -0
- package/build/cjs/editor-v2/utils/store.js +9 -0
- package/build/cjs/hooks/useEditorInitialize.js +9 -9
- package/build/cjs/sub-blocks/BackgroundCard/dynamic-form.d.ts +2 -2
- package/build/cjs/sub-blocks/LayoutItem/form.d.ts +1 -1
- package/build/cjs/utils/form-generator.d.ts +1 -1
- package/build/esm/blocks/CardLayout/index.d.ts +1 -1
- package/build/esm/blocks/ContentLayout/index.d.ts +1 -1
- package/build/esm/blocks/ExtendedFeatures/index.d.ts +1 -1
- package/build/esm/blocks/FilterBlock/index.d.ts +1 -1
- package/build/esm/blocks/Form/index.d.ts +1 -1
- package/build/esm/blocks/Header/dynamic-form.d.ts +2 -2
- package/build/esm/blocks/Header/index.d.ts +1 -1
- package/build/esm/blocks/HeaderSlider/index.d.ts +1 -1
- package/build/esm/blocks/Icons/index.d.ts +1 -1
- package/build/esm/blocks/Info/index.d.ts +1 -1
- package/build/esm/blocks/Map/index.d.ts +1 -1
- package/build/esm/blocks/Media/index.d.ts +1 -1
- package/build/esm/blocks/PromoFeaturesBlock/index.d.ts +1 -1
- package/build/esm/blocks/Questions/index.d.ts +1 -1
- package/build/esm/blocks/Share/index.d.ts +1 -1
- package/build/esm/blocks/Slider/dynamic-form.d.ts +3 -3
- package/build/esm/blocks/Slider/index.d.ts +1 -1
- package/build/esm/blocks/Table/index.d.ts +1 -1
- package/build/esm/blocks/Tabs/index.d.ts +1 -1
- package/build/esm/blocks/TestEditorBlock/form.d.ts +1 -1
- package/build/esm/blocks/TestEditorBlock/index.d.ts +1 -1
- package/build/esm/common/hooks/usePostMessage.d.ts +11 -0
- package/build/esm/common/hooks/usePostMessage.js +90 -0
- package/build/{cjs → esm/common}/types/actions/initial.d.ts +1 -1
- package/build/{cjs → esm/common}/types/actions/other.d.ts +1 -1
- package/build/esm/{types → common/types}/actions/reorder.d.ts +3 -1
- package/build/esm/{types/index.d.ts → common/types/common.d.ts} +3 -3
- package/build/esm/{types/dynamic-form.d.ts → common/types/forms.d.ts} +2 -1
- package/build/esm/common/types/index.d.ts +4 -0
- package/build/esm/common/types/index.js +4 -0
- package/build/esm/{context/messagesContext/types.d.ts → common/types/messages.d.ts} +1 -1
- package/build/esm/components/Image/dynamic-form.d.ts +1 -1
- package/build/esm/constructor-items.d.ts +7 -1
- package/build/esm/constructor-items.js +6 -0
- package/build/esm/containers/PageConstructor/components/ConstructorBlock/hooks/useEditorBlockMouseEvents.js +1 -1
- package/build/esm/context/editorContext/store.d.ts +1 -1
- package/build/esm/context/editorContext/store.js +1 -1
- package/build/esm/context/messagesContext/hooks/useMessageObserver.d.ts +1 -1
- package/build/esm/context/messagesContext/hooks/useMessageSender.d.ts +1 -1
- package/build/esm/context/messagesContext/messagesContext.d.ts +1 -2
- package/build/esm/context/messagesContext/messagesProvider.js +8 -54
- package/build/esm/context/messagesContext/store.d.ts +1 -2
- package/build/esm/editor/data/templates/test-editor-block.json +18 -0
- package/build/esm/editor-v2/components/BigOverlay/BigOverlay.css +33 -0
- package/build/esm/editor-v2/components/BigOverlay/BigOverlay.d.ts +7 -0
- package/build/esm/editor-v2/components/BigOverlay/BigOverlay.js +38 -0
- package/build/esm/editor-v2/components/BlockConfig/BlockConfig.css +33 -0
- package/build/esm/editor-v2/components/BlockConfig/BlockConfig.d.ts +7 -0
- package/build/esm/editor-v2/components/BlockConfig/BlockConfig.js +33 -0
- package/build/esm/editor-v2/components/BlocksList/BlocksList.css +42 -0
- package/build/esm/editor-v2/components/BlocksList/BlocksList.d.ts +8 -0
- package/build/esm/editor-v2/components/BlocksList/BlocksList.js +20 -0
- package/build/esm/editor-v2/components/DynamicForm/DynamicForm.css +2 -0
- package/build/esm/editor-v2/components/DynamicForm/DynamicForm.d.ts +12 -0
- package/build/esm/editor-v2/components/DynamicForm/DynamicForm.js +116 -0
- package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.css +61 -0
- package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.d.ts +13 -0
- package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.js +30 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.css +38 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.d.ts +14 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.js +81 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.d.ts +11 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js +25 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.d.ts +9 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.js +11 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Number/Number.d.ts +9 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Number/Number.js +14 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Object/Object.css +5 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Object/Object.d.ts +13 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Object/Object.js +14 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.css +8 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.d.ts +12 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js +32 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Select/Select.d.ts +12 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Select/Select.js +13 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Text/Text.d.ts +9 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Text/Text.js +11 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.d.ts +9 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js +11 -0
- package/build/esm/editor-v2/components/DynamicForm/utils.d.ts +3 -0
- package/build/esm/editor-v2/components/DynamicForm/utils.js +16 -0
- package/build/esm/editor-v2/components/GlobalConfig/GlobalConfig.css +22 -0
- package/build/esm/editor-v2/components/GlobalConfig/GlobalConfig.d.ts +7 -0
- package/build/esm/editor-v2/components/GlobalConfig/GlobalConfig.js +16 -0
- package/build/esm/editor-v2/components/MiddleScreen/MiddleScreen.css +53 -0
- package/build/esm/editor-v2/components/MiddleScreen/MiddleScreen.d.ts +7 -0
- package/build/esm/editor-v2/components/MiddleScreen/MiddleScreen.js +32 -0
- package/build/esm/editor-v2/components/Overlay/Overlay.css +56 -0
- package/build/esm/editor-v2/components/Overlay/Overlay.d.ts +7 -0
- package/build/esm/editor-v2/components/Overlay/Overlay.js +69 -0
- package/build/esm/editor-v2/components/Sidebar/Sidebar.css +66 -0
- package/build/esm/editor-v2/components/Sidebar/Sidebar.d.ts +8 -0
- package/build/esm/editor-v2/components/Sidebar/Sidebar.js +64 -0
- package/build/esm/editor-v2/components/Source/Source.css +21 -0
- package/build/esm/editor-v2/components/Source/Source.d.ts +7 -0
- package/build/esm/editor-v2/components/Source/Source.js +28 -0
- package/build/esm/editor-v2/components/SourceCode/SourceCode.css +44 -0
- package/build/esm/editor-v2/components/SourceCode/SourceCode.d.ts +7 -0
- package/build/esm/editor-v2/components/SourceCode/SourceCode.js +53 -0
- package/build/esm/editor-v2/components/TopBar/TopBar.css +34 -0
- package/build/esm/editor-v2/components/TopBar/TopBar.d.ts +11 -0
- package/build/esm/editor-v2/components/TopBar/TopBar.js +13 -0
- package/build/esm/editor-v2/components/Tree/Tree.css +148 -0
- package/build/esm/editor-v2/components/Tree/Tree.d.ts +8 -0
- package/build/esm/editor-v2/components/Tree/Tree.js +30 -0
- package/build/esm/editor-v2/components/ViewSwitches/ViewSwitches.css +23 -0
- package/build/esm/editor-v2/components/ViewSwitches/ViewSwitches.d.ts +11 -0
- package/build/esm/editor-v2/components/ViewSwitches/ViewSwitches.js +20 -0
- package/build/esm/editor-v2/constants.d.ts +1 -0
- package/build/esm/editor-v2/constants.js +1 -0
- package/build/esm/editor-v2/containers/Editor/Editor.css +54 -0
- package/build/esm/editor-v2/containers/Editor/Editor.d.ts +10 -0
- package/build/esm/editor-v2/containers/Editor/Editor.js +62 -0
- package/build/esm/editor-v2/containers/Editor/hooks/useAdminInitialize.d.ts +2 -0
- package/build/esm/editor-v2/containers/Editor/hooks/useAdminInitialize.js +23 -0
- package/build/esm/editor-v2/context/contentConfig/contentConfigContext.d.ts +10 -0
- package/build/esm/editor-v2/context/contentConfig/contentConfigContext.js +5 -0
- package/build/esm/editor-v2/context/contentConfig/contentConfigProvider.d.ts +8 -0
- package/build/esm/editor-v2/context/contentConfig/contentConfigProvider.js +14 -0
- package/build/esm/editor-v2/context/contentConfig/hooks/useContentConfigStore.d.ts +2 -0
- package/build/esm/editor-v2/context/contentConfig/hooks/useContentConfigStore.js +11 -0
- package/build/esm/editor-v2/context/contentConfig/index.d.ts +4 -0
- package/build/esm/editor-v2/context/contentConfig/index.js +4 -0
- package/build/esm/editor-v2/context/contentConfig/store.d.ts +35 -0
- package/build/esm/editor-v2/context/contentConfig/store.js +102 -0
- package/build/esm/editor-v2/context/editorContext/editorContext.d.ts +11 -0
- package/build/esm/editor-v2/context/editorContext/editorContext.js +6 -0
- package/build/esm/editor-v2/context/editorContext/editorProvider.d.ts +2 -0
- package/build/esm/editor-v2/context/editorContext/editorProvider.js +10 -0
- package/build/esm/editor-v2/context/editorContext/hooks/useEditorStore.d.ts +2 -0
- package/build/esm/editor-v2/context/editorContext/hooks/useEditorStore.js +11 -0
- package/build/esm/editor-v2/context/editorContext/index.d.ts +4 -0
- package/build/esm/editor-v2/context/editorContext/index.js +4 -0
- package/build/esm/editor-v2/context/editorContext/store.d.ts +26 -0
- package/build/esm/editor-v2/context/editorContext/store.js +52 -0
- package/build/esm/editor-v2/context/iframeContext/hooks/useIframeStore.d.ts +2 -0
- package/build/esm/editor-v2/context/iframeContext/hooks/useIframeStore.js +11 -0
- package/build/esm/editor-v2/context/iframeContext/iframeContext.d.ts +13 -0
- package/build/esm/editor-v2/context/iframeContext/iframeContext.js +5 -0
- package/build/esm/editor-v2/context/iframeContext/iframeProvider.d.ts +7 -0
- package/build/esm/editor-v2/context/iframeContext/iframeProvider.js +18 -0
- package/build/esm/editor-v2/context/iframeContext/index.d.ts +4 -0
- package/build/esm/editor-v2/context/iframeContext/index.js +4 -0
- package/build/esm/editor-v2/context/iframeContext/store.d.ts +26 -0
- package/build/esm/editor-v2/context/iframeContext/store.js +42 -0
- package/build/esm/editor-v2/context/messagesContext/hooks/useMessageObserver.d.ts +4 -0
- package/build/esm/editor-v2/context/messagesContext/hooks/useMessageObserver.js +12 -0
- package/build/esm/editor-v2/context/messagesContext/hooks/useMessageSender.d.ts +2 -0
- package/build/esm/editor-v2/context/messagesContext/hooks/useMessageSender.js +7 -0
- package/build/esm/editor-v2/context/messagesContext/hooks/useMessagesStore.d.ts +2 -0
- package/build/esm/editor-v2/context/messagesContext/hooks/useMessagesStore.js +11 -0
- package/build/esm/editor-v2/context/messagesContext/index.d.ts +5 -0
- package/build/esm/editor-v2/context/messagesContext/index.js +5 -0
- package/build/esm/editor-v2/context/messagesContext/messagesContext.d.ts +13 -0
- package/build/esm/editor-v2/context/messagesContext/messagesContext.js +8 -0
- package/build/esm/editor-v2/context/messagesContext/messagesProvider.d.ts +2 -0
- package/build/esm/editor-v2/context/messagesContext/messagesProvider.js +30 -0
- package/build/esm/editor-v2/context/messagesContext/store.d.ts +22 -0
- package/build/esm/editor-v2/context/messagesContext/store.js +14 -0
- package/build/esm/editor-v2/icons/Tablet.d.ts +2 -0
- package/build/esm/editor-v2/icons/Tablet.js +4 -0
- package/build/esm/editor-v2/index.d.ts +2 -0
- package/build/esm/editor-v2/index.js +2 -0
- package/build/esm/editor-v2/styles/mixins.css +0 -0
- package/build/esm/editor-v2/styles/root.css +9 -0
- package/build/esm/editor-v2/styles/variables.css +0 -0
- package/build/esm/editor-v2/utils/code.d.ts +6 -0
- package/build/esm/editor-v2/utils/code.js +6 -0
- package/build/esm/editor-v2/utils/index.d.ts +17 -0
- package/build/esm/editor-v2/utils/index.js +134 -0
- package/build/esm/editor-v2/utils/store.d.ts +14 -0
- package/build/esm/editor-v2/utils/store.js +5 -0
- package/build/esm/hooks/useEditorInitialize.js +1 -1
- package/build/esm/sub-blocks/BackgroundCard/dynamic-form.d.ts +2 -2
- package/build/esm/sub-blocks/LayoutItem/form.d.ts +1 -1
- package/build/esm/utils/form-generator.d.ts +1 -1
- package/package.json +12 -3
- package/widget/index.js +1 -1
- package/build/cjs/{types → common/types}/actions/codes.d.ts +0 -0
- package/build/cjs/{types → common/types}/actions/codes.js +0 -0
- package/build/cjs/{types → common/types}/actions/index.d.ts +1 -1
- package/build/cjs/{types → common/types}/actions/index.js +1 -1
- package/build/cjs/{types → common/types}/actions/initial.js +0 -0
- package/build/cjs/{types → common/types}/actions/insert.d.ts +0 -0
- package/build/cjs/{types → common/types}/actions/insert.js +0 -0
- package/build/cjs/{types → common/types}/actions/other.js +0 -0
- package/build/cjs/{types → common/types}/actions/overlay.d.ts +0 -0
- package/build/cjs/{types → common/types}/actions/overlay.js +0 -0
- package/build/cjs/{types → common/types}/actions/reorder.js +0 -0
- package/build/cjs/{types → common/types}/actions/select.d.ts +0 -0
- package/build/cjs/{types → common/types}/actions/select.js +0 -0
- package/build/cjs/{context/messagesContext/types.js → common/types/common.js} +0 -0
- package/build/cjs/{types/dynamic-form.js → common/types/forms.js} +0 -0
- package/build/cjs/{types/index.js → common/types/messages.js} +0 -0
- package/build/esm/{types → common/types}/actions/codes.d.ts +0 -0
- package/build/esm/{types → common/types}/actions/codes.js +0 -0
- package/build/esm/{types → common/types}/actions/index.d.ts +1 -1
- package/build/esm/{types → common/types}/actions/index.js +1 -1
- /package/build/esm/{types → common/types}/actions/initial.js +0 -0
- /package/build/esm/{types → common/types}/actions/insert.d.ts +0 -0
- /package/build/esm/{types → common/types}/actions/insert.js +0 -0
- /package/build/esm/{types → common/types}/actions/other.js +0 -0
- /package/build/esm/{types → common/types}/actions/overlay.d.ts +0 -0
- /package/build/esm/{types → common/types}/actions/overlay.js +0 -0
- /package/build/esm/{types → common/types}/actions/reorder.js +0 -0
- /package/build/esm/{types → common/types}/actions/select.d.ts +0 -0
- /package/build/esm/{types → common/types}/actions/select.js +0 -0
- /package/build/esm/{context/messagesContext/types.js → common/types/common.js} +0 -0
- /package/build/esm/{types/dynamic-form.js → common/types/forms.js} +0 -0
- /package/build/esm/{types/index.js → common/types/messages.js} +0 -0
|
@@ -3,68 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PostMessageProvider = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const usePostMessage_1 = require("../../common/hooks/usePostMessage");
|
|
6
7
|
const editorContext_1 = require("../editorContext");
|
|
7
8
|
const messagesContext_1 = require("./messagesContext");
|
|
8
9
|
const store_1 = require("./store");
|
|
9
|
-
const DEBUG_MODE = false;
|
|
10
10
|
const PostMessageProvider = ({ children }) => {
|
|
11
|
+
var _a;
|
|
11
12
|
const storeRef = (0, react_1.useRef)();
|
|
12
13
|
if (!storeRef.current) {
|
|
13
14
|
storeRef.current = (0, store_1.createMessagesStore)();
|
|
14
15
|
}
|
|
15
16
|
const editorStore = (0, editorContext_1.useEditorStore)();
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const storesWithReducer = [editorStore];
|
|
22
|
-
const { type, payload } = action;
|
|
23
|
-
const store = storeRef.current;
|
|
24
|
-
if (!type) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (store) {
|
|
28
|
-
const { subscribers } = store.getState();
|
|
29
|
-
const foundedSubscribers = subscribers.filter((subscriber) => subscriber.action === type);
|
|
30
|
-
for (const storeWithReducer of storesWithReducer) {
|
|
31
|
-
storeWithReducer.reducer(action, meta);
|
|
32
|
-
}
|
|
33
|
-
if (foundedSubscribers.length) {
|
|
34
|
-
for (const subscriber of foundedSubscribers) {
|
|
35
|
-
subscriber.handler(payload, meta);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}, [editorStore]);
|
|
40
|
-
(0, react_1.useEffect)(() => {
|
|
41
|
-
const onMessage = (e) => {
|
|
42
|
-
const { action, debug } = e.data;
|
|
43
|
-
if (action && action.type) {
|
|
44
|
-
if (debug) {
|
|
45
|
-
// eslint-disable-next-line no-console
|
|
46
|
-
console.log(`🔵 ➡️ Editor ${action.type}`, action.payload);
|
|
47
|
-
}
|
|
48
|
-
notifySubscribers(action, 'editor');
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
window.addEventListener('message', onMessage);
|
|
52
|
-
return () => {
|
|
53
|
-
window.removeEventListener('message', onMessage);
|
|
54
|
-
};
|
|
55
|
-
}, [notifySubscribers]);
|
|
56
|
-
const sendMessage = (0, react_1.useCallback)((action, { debug = DEBUG_MODE, direction = 'both' } = {}) => {
|
|
57
|
-
if (debug) {
|
|
58
|
-
// eslint-disable-next-line no-console
|
|
59
|
-
console.log(`🟢 Website ➡️ ${action.type}`, action.payload);
|
|
60
|
-
}
|
|
61
|
-
if (direction === 'both' || direction === 'editor') {
|
|
62
|
-
sendPostMessage({ action, debug });
|
|
63
|
-
}
|
|
64
|
-
if (direction === 'both' || direction === 'pc') {
|
|
65
|
-
notifySubscribers(action, 'pc');
|
|
66
|
-
}
|
|
67
|
-
}, [notifySubscribers, sendPostMessage]);
|
|
17
|
+
const storesWithReducer = [editorStore];
|
|
18
|
+
const { sendMessage } = (0, usePostMessage_1.usePostMessage)({
|
|
19
|
+
subscribers: (_a = storeRef.current) === null || _a === void 0 ? void 0 : _a.getState().subscribers,
|
|
20
|
+
storesWithReducer,
|
|
21
|
+
});
|
|
68
22
|
return (react_1.default.createElement(messagesContext_1.PostMessageContext.Provider, { value: {
|
|
69
23
|
state: storeRef.current,
|
|
70
24
|
sendMessage: sendMessage,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"template": {
|
|
3
|
+
"type": "test-editor-block",
|
|
4
|
+
"title": "Lorem ipsum dolor sit amet",
|
|
5
|
+
"table": {
|
|
6
|
+
"content": [
|
|
7
|
+
["Lorem", "ipsum 1", "dolor 2", "sit 3"],
|
|
8
|
+
["Lorem 1", "0", "0", "0"],
|
|
9
|
+
["Lorem 2", "0", "0", "1"],
|
|
10
|
+
["Lorem 3", "0", "0", "1"],
|
|
11
|
+
["Lorem 4", "0", "1", "1"],
|
|
12
|
+
["Lorem 5", "1", "1", "1"]
|
|
13
|
+
],
|
|
14
|
+
"legend": ["ipsum 1", "ipsum 2"],
|
|
15
|
+
"justify": ["start", "center", "center", "center"]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
body {
|
|
4
|
+
--pc-editor-header-height: 48px;
|
|
5
|
+
--pc-editor-code-header-height: 36px;
|
|
6
|
+
--pc-editor-divider-width: 12px;
|
|
7
|
+
--pc-editor-left-column-width: calc(400px + var(--pc-editor-divider-width));
|
|
8
|
+
--pc-editor-base-color: var(--g-color-base-brand);
|
|
9
|
+
--pc-editor-control-color: var(--g-color-base-brand);
|
|
10
|
+
--pc-editor-control-icon-color: var(--g-color-text-dark-primary);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.pc-big-overlay {
|
|
14
|
+
position: absolute;
|
|
15
|
+
left: 0;
|
|
16
|
+
top: 0;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
}
|
|
21
|
+
.pc-big-overlay__border {
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
position: absolute;
|
|
24
|
+
width: 40px;
|
|
25
|
+
height: 40px;
|
|
26
|
+
margin-left: -20px;
|
|
27
|
+
margin-top: -20px;
|
|
28
|
+
background-color: var(--g-color-base-brand);
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
border-radius: 10px;
|
|
33
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const icons_1 = require("@gravity-ui/icons");
|
|
6
|
+
const types_1 = require("../../../common/types");
|
|
7
|
+
const utils_1 = require("../../../utils");
|
|
8
|
+
const iframeContext_1 = require("../../context/iframeContext");
|
|
9
|
+
const messagesContext_1 = require("../../context/messagesContext");
|
|
10
|
+
const b = (0, utils_1.block)('big-overlay');
|
|
11
|
+
const BigOverlay = ({ className }) => {
|
|
12
|
+
const { zoom } = (0, iframeContext_1.useIframeStore)();
|
|
13
|
+
const { iframeElement } = (0, react_1.useContext)(iframeContext_1.IframeContext);
|
|
14
|
+
const [mousePosition, setMousePosition] = (0, react_1.useState)(undefined);
|
|
15
|
+
(0, messagesContext_1.useMessageObserver)(types_1.ActionTypes.OverlayModeOnMove, (payload, meta) => {
|
|
16
|
+
if (payload && payload.cursor) {
|
|
17
|
+
const { x, y } = payload.cursor;
|
|
18
|
+
const iframeRect = iframeElement === null || iframeElement === void 0 ? void 0 : iframeElement.getClientRects().item(0);
|
|
19
|
+
if (iframeRect) {
|
|
20
|
+
const zoomedX = (x * zoom) / 100;
|
|
21
|
+
const zoomedY = (y * zoom) / 100;
|
|
22
|
+
const newX = meta.source === 'editor' ? x : zoomedX + iframeRect.x;
|
|
23
|
+
const newY = meta.source === 'editor' ? y : zoomedY + iframeRect.y;
|
|
24
|
+
setMousePosition({ x: newX, y: newY });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}, [iframeElement, zoom]);
|
|
28
|
+
(0, messagesContext_1.useMessageObserver)(types_1.ActionTypes.InsertModeDisable, () => {
|
|
29
|
+
setMousePosition(undefined);
|
|
30
|
+
});
|
|
31
|
+
(0, messagesContext_1.useMessageObserver)(types_1.ActionTypes.ReorderModeDisable, () => {
|
|
32
|
+
setMousePosition(undefined);
|
|
33
|
+
});
|
|
34
|
+
return (react_1.default.createElement("div", { className: b(null, className) }, mousePosition ? (react_1.default.createElement("div", { className: b('border'), style: {
|
|
35
|
+
top: mousePosition.y,
|
|
36
|
+
left: mousePosition.x,
|
|
37
|
+
} },
|
|
38
|
+
react_1.default.createElement(icons_1.Stop, { height: 20, width: 20 }))) : null));
|
|
39
|
+
};
|
|
40
|
+
exports.default = BigOverlay;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
body {
|
|
4
|
+
--pc-editor-header-height: 48px;
|
|
5
|
+
--pc-editor-code-header-height: 36px;
|
|
6
|
+
--pc-editor-divider-width: 12px;
|
|
7
|
+
--pc-editor-left-column-width: calc(400px + var(--pc-editor-divider-width));
|
|
8
|
+
--pc-editor-base-color: var(--g-color-base-brand);
|
|
9
|
+
--pc-editor-control-color: var(--g-color-base-brand);
|
|
10
|
+
--pc-editor-control-icon-color: var(--g-color-text-dark-primary);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.pc-block-config {
|
|
14
|
+
padding: 12px;
|
|
15
|
+
}
|
|
16
|
+
.pc-block-config__title {
|
|
17
|
+
margin-bottom: 16px;
|
|
18
|
+
margin-top: 8px;
|
|
19
|
+
font-size: var(--g-text-subheader-3-font-size);
|
|
20
|
+
line-height: var(--g-text-subheader-3-line-height);
|
|
21
|
+
font-weight: var(--g-text-subheader-font-weight);
|
|
22
|
+
}
|
|
23
|
+
.pc-block-config__empty {
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
align-items: center;
|
|
27
|
+
text-align: center;
|
|
28
|
+
height: 100%;
|
|
29
|
+
width: 100%;
|
|
30
|
+
font-size: var(--g-text-body-2-font-size);
|
|
31
|
+
line-height: var(--g-text-body-2-line-height);
|
|
32
|
+
font-weight: var(--g-text-body-font-weight);
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
const contentConfig_1 = require("../../context/contentConfig");
|
|
8
|
+
const editorContext_1 = require("../../context/editorContext");
|
|
9
|
+
const utils_2 = require("../../utils");
|
|
10
|
+
const DynamicForm_1 = tslib_1.__importDefault(require("../DynamicForm/DynamicForm"));
|
|
11
|
+
const b = (0, utils_1.block)('block-config');
|
|
12
|
+
const BlockConfig = ({ className }) => {
|
|
13
|
+
const { selectedBlock } = (0, editorContext_1.useEditorStore)();
|
|
14
|
+
const { config, blocks, subBlocks, updateField } = (0, contentConfig_1.useContentConfigStore)();
|
|
15
|
+
const currentBlockPath = (selectedBlock === null || selectedBlock === void 0 ? void 0 : selectedBlock.path)
|
|
16
|
+
? (0, utils_2.generateChildrenPathFromArray)(selectedBlock === null || selectedBlock === void 0 ? void 0 : selectedBlock.path)
|
|
17
|
+
: '[]';
|
|
18
|
+
const currentConfig = lodash_1.default.get(config.blocks, currentBlockPath || '');
|
|
19
|
+
const currentSchema = [...blocks, ...subBlocks].find(({ type }) => type === (currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.type));
|
|
20
|
+
const onUpdate = (key, value) => {
|
|
21
|
+
updateField('blocks' + currentBlockPath + '.' + key, value);
|
|
22
|
+
};
|
|
23
|
+
if (!currentConfig) {
|
|
24
|
+
return react_1.default.createElement("div", { className: b('empty') }, "Select block for start");
|
|
25
|
+
}
|
|
26
|
+
if (!currentSchema) {
|
|
27
|
+
return react_1.default.createElement("div", { className: b('empty') },
|
|
28
|
+
"Not supported: ",
|
|
29
|
+
currentConfig.type);
|
|
30
|
+
}
|
|
31
|
+
return (react_1.default.createElement("div", { className: b(null, className) },
|
|
32
|
+
react_1.default.createElement("div", { className: b('title') }, currentSchema.schema.name),
|
|
33
|
+
react_1.default.createElement(DynamicForm_1.default, { contentConfig: currentConfig, blockConfig: currentSchema.schema.inputs, onUpdate: onUpdate })));
|
|
34
|
+
};
|
|
35
|
+
exports.default = BlockConfig;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
body {
|
|
4
|
+
--pc-editor-header-height: 48px;
|
|
5
|
+
--pc-editor-code-header-height: 36px;
|
|
6
|
+
--pc-editor-divider-width: 12px;
|
|
7
|
+
--pc-editor-left-column-width: calc(400px + var(--pc-editor-divider-width));
|
|
8
|
+
--pc-editor-base-color: var(--g-color-base-brand);
|
|
9
|
+
--pc-editor-control-color: var(--g-color-base-brand);
|
|
10
|
+
--pc-editor-control-icon-color: var(--g-color-text-dark-primary);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.pc-blocks-list {
|
|
14
|
+
padding: 12px;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: 8px;
|
|
18
|
+
}
|
|
19
|
+
.pc-blocks-list__card {
|
|
20
|
+
padding: 8px;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
user-select: none;
|
|
23
|
+
margin-bottom: 8px;
|
|
24
|
+
}
|
|
25
|
+
.pc-blocks-list__card:last-child {
|
|
26
|
+
margin-bottom: 0;
|
|
27
|
+
}
|
|
28
|
+
.pc-blocks-list__card:active {
|
|
29
|
+
background-color: var(--g-color-base-generic-hover);
|
|
30
|
+
}
|
|
31
|
+
.pc-blocks-list__title {
|
|
32
|
+
font-size: var(--g-text-subheader-3-font-size);
|
|
33
|
+
line-height: var(--g-text-subheader-3-line-height);
|
|
34
|
+
font-weight: var(--g-text-subheader-font-weight);
|
|
35
|
+
margin-bottom: 10px;
|
|
36
|
+
}
|
|
37
|
+
.pc-blocks-list__section {
|
|
38
|
+
margin-bottom: 20px;
|
|
39
|
+
}
|
|
40
|
+
.pc-blocks-list__section:last-child {
|
|
41
|
+
margin-bottom: 0;
|
|
42
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { ItemConfig } from '../../../common/types';
|
|
3
|
+
export interface BlocksListProps {
|
|
4
|
+
blocks: ItemConfig[];
|
|
5
|
+
}
|
|
6
|
+
declare const BlocksList: (_p: PropsWithChildren<BlocksListProps>) => JSX.Element;
|
|
7
|
+
export default BlocksList;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
6
|
+
const types_1 = require("../../../common/types");
|
|
7
|
+
const utils_1 = require("../../../utils");
|
|
8
|
+
const contentConfig_1 = require("../../context/contentConfig");
|
|
9
|
+
const messagesContext_1 = require("../../context/messagesContext");
|
|
10
|
+
const b = (0, utils_1.block)('blocks-list');
|
|
11
|
+
const BlocksList = (_p) => {
|
|
12
|
+
const { blocks } = (0, contentConfig_1.useContentConfigStore)();
|
|
13
|
+
const sendMessage = (0, messagesContext_1.useMessageSender)();
|
|
14
|
+
const onMouseDown = (0, react_1.useCallback)((blockType) => {
|
|
15
|
+
sendMessage({ type: types_1.ActionTypes.InsertModeEnable, payload: { blockType } });
|
|
16
|
+
}, [sendMessage]);
|
|
17
|
+
return (react_1.default.createElement("div", { className: b() },
|
|
18
|
+
react_1.default.createElement("div", { className: b('section') },
|
|
19
|
+
react_1.default.createElement("div", { className: b('title') }, "Blocks"),
|
|
20
|
+
blocks.map(({ type, schema: { name } }) => (react_1.default.createElement(uikit_1.Card, { key: type, className: b('card'), onMouseDown: () => onMouseDown(type) }, name))))));
|
|
21
|
+
};
|
|
22
|
+
exports.default = BlocksList;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ConfigInput } from '../../../common/types';
|
|
3
|
+
import { ClassNameProps, PageContent } from '../../../models';
|
|
4
|
+
export type DynamicFormValue = string | number | [] | object | boolean | PageContent | undefined;
|
|
5
|
+
interface DynamicFormProps extends ClassNameProps {
|
|
6
|
+
blockConfig: Array<ConfigInput>;
|
|
7
|
+
contentConfig: PageContent;
|
|
8
|
+
onUpdate: (key: string, value: DynamicFormValue) => void;
|
|
9
|
+
}
|
|
10
|
+
declare const DynamicForm: React.FC<DynamicFormProps>;
|
|
11
|
+
export default DynamicForm;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
const Array_1 = tslib_1.__importDefault(require("./Fields/Array/Array"));
|
|
8
|
+
const Boolean_1 = tslib_1.__importDefault(require("./Fields/Boolean/Boolean"));
|
|
9
|
+
const Number_1 = tslib_1.__importDefault(require("./Fields/Number/Number"));
|
|
10
|
+
const Object_1 = tslib_1.__importDefault(require("./Fields/Object/Object"));
|
|
11
|
+
const OneOf_1 = tslib_1.__importDefault(require("./Fields/OneOf/OneOf"));
|
|
12
|
+
const Select_1 = tslib_1.__importDefault(require("./Fields/Select/Select"));
|
|
13
|
+
const Text_1 = tslib_1.__importDefault(require("./Fields/Text/Text"));
|
|
14
|
+
const TextArea_1 = tslib_1.__importDefault(require("./Fields/TextArea/TextArea"));
|
|
15
|
+
const utils_2 = require("./utils");
|
|
16
|
+
const b = (0, utils_1.block)('dynamic-form');
|
|
17
|
+
const DynamicForm = (props) => {
|
|
18
|
+
const { blockConfig, onUpdate, contentConfig } = props;
|
|
19
|
+
const inputs = blockConfig;
|
|
20
|
+
const getData = (0, react_1.useCallback)((variable) => {
|
|
21
|
+
if (variable.startsWith('block.')) {
|
|
22
|
+
const purePath = variable.replace('block.', '');
|
|
23
|
+
return lodash_1.default.get(contentConfig, purePath);
|
|
24
|
+
}
|
|
25
|
+
if ((variable.startsWith(`'`) && variable.endsWith(`'`)) ||
|
|
26
|
+
(variable.startsWith(`"`) && variable.endsWith(`"`))) {
|
|
27
|
+
// @ts-ignore TODO: replaceAll types
|
|
28
|
+
return variable.replaceAll(`'`, '').replaceAll(`"`, '');
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
}, [contentConfig]);
|
|
32
|
+
const decide = (0, react_1.useCallback)((showIf) => {
|
|
33
|
+
const parts = showIf.split(' ');
|
|
34
|
+
if (!(parts.length === 3)) {
|
|
35
|
+
// eslint-disable-next-line no-console
|
|
36
|
+
console.log('Something bad happened in showIf, ignored');
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
const [firstVariable, equals, secondVariable] = parts;
|
|
40
|
+
const data1 = getData(firstVariable);
|
|
41
|
+
const data2 = getData(secondVariable);
|
|
42
|
+
if (equals === '===') {
|
|
43
|
+
return data1 === data2;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return data1 !== data2;
|
|
47
|
+
}
|
|
48
|
+
}, [getData]);
|
|
49
|
+
const renderInput = (0, react_1.useCallback)((input) => {
|
|
50
|
+
const fieldPath = input.name;
|
|
51
|
+
const fieldValue = (0, utils_2.getContent)(contentConfig, input.name);
|
|
52
|
+
if (input.showIf) {
|
|
53
|
+
const decision = decide(input.showIf);
|
|
54
|
+
if (!decision) {
|
|
55
|
+
return react_1.default.createElement("div", null,
|
|
56
|
+
"Hidden Field: ",
|
|
57
|
+
input.name);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Text, Select, Boolean and etc
|
|
61
|
+
const onSimpleDynamicFieldUpdate = (value) => {
|
|
62
|
+
onUpdate(fieldPath, value);
|
|
63
|
+
};
|
|
64
|
+
// Array and Objects
|
|
65
|
+
const onComplexDynamicFieldUpdate = (key, value) => {
|
|
66
|
+
onUpdate((0, utils_2.getFullPath)(fieldPath, key), value);
|
|
67
|
+
};
|
|
68
|
+
switch (input.type) {
|
|
69
|
+
case 'text': {
|
|
70
|
+
return (react_1.default.createElement(Text_1.default, { onRefresh: (value) => onUpdate(fieldPath, value), title: input.title, value: fieldValue, onUpdate: onSimpleDynamicFieldUpdate }));
|
|
71
|
+
}
|
|
72
|
+
case 'boolean': {
|
|
73
|
+
return (react_1.default.createElement(Boolean_1.default, { onRefresh: (value) => onUpdate(fieldPath, value), title: input.title, value: fieldValue, onUpdate: onSimpleDynamicFieldUpdate }));
|
|
74
|
+
}
|
|
75
|
+
case 'textarea': {
|
|
76
|
+
return (react_1.default.createElement(TextArea_1.default, { onRefresh: (value) => onUpdate(fieldPath, value), title: input.title, value: fieldValue, onUpdate: onSimpleDynamicFieldUpdate }));
|
|
77
|
+
}
|
|
78
|
+
case 'select': {
|
|
79
|
+
return (react_1.default.createElement(Select_1.default, { onRefresh: (value) => onUpdate(fieldPath, value), input: input, value: fieldValue, onUpdate: onSimpleDynamicFieldUpdate }));
|
|
80
|
+
}
|
|
81
|
+
case 'number': {
|
|
82
|
+
return (react_1.default.createElement(Number_1.default, { onRefresh: (value) => onUpdate(fieldPath, value), title: input.title, value: fieldValue, onUpdate: onSimpleDynamicFieldUpdate }));
|
|
83
|
+
}
|
|
84
|
+
case 'object': {
|
|
85
|
+
if (!input || !('properties' in input)) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
return (react_1.default.createElement(Object_1.default, { onRefresh: (value) => onUpdate(fieldPath, value), blockConfig: input.properties, title: input.title, value: fieldValue, onUpdate: onComplexDynamicFieldUpdate }));
|
|
89
|
+
}
|
|
90
|
+
case 'array': {
|
|
91
|
+
return (react_1.default.createElement(Array_1.default, { blockConfig: input, title: input.title, values: fieldValue, onUpdate: onComplexDynamicFieldUpdate }));
|
|
92
|
+
}
|
|
93
|
+
case 'oneOf': {
|
|
94
|
+
if (!input || !('options' in input)) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return (react_1.default.createElement(OneOf_1.default, { inputConfig: input, contentConfig: contentConfig, onUpdate: onComplexDynamicFieldUpdate }));
|
|
98
|
+
}
|
|
99
|
+
default: {
|
|
100
|
+
return react_1.default.createElement("div", null,
|
|
101
|
+
"Ignore ",
|
|
102
|
+
JSON.stringify(input));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, [contentConfig, decide, onUpdate]);
|
|
106
|
+
const sortedInputs = inputs.sort((x, y) => {
|
|
107
|
+
const nestingFieldTypes = ['object', 'array', 'oneOf'];
|
|
108
|
+
if (nestingFieldTypes.includes(x.type)) {
|
|
109
|
+
return 1;
|
|
110
|
+
}
|
|
111
|
+
if (nestingFieldTypes.includes(y.type)) {
|
|
112
|
+
return -1;
|
|
113
|
+
}
|
|
114
|
+
return 0;
|
|
115
|
+
});
|
|
116
|
+
return (react_1.default.createElement("div", { className: b() }, sortedInputs.map((input, index) => (react_1.default.createElement(react_1.default.Fragment, { key: index }, renderInput(input))))));
|
|
117
|
+
};
|
|
118
|
+
exports.default = DynamicForm;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
body {
|
|
4
|
+
--pc-editor-header-height: 48px;
|
|
5
|
+
--pc-editor-code-header-height: 36px;
|
|
6
|
+
--pc-editor-divider-width: 12px;
|
|
7
|
+
--pc-editor-left-column-width: calc(400px + var(--pc-editor-divider-width));
|
|
8
|
+
--pc-editor-base-color: var(--g-color-base-brand);
|
|
9
|
+
--pc-editor-control-color: var(--g-color-base-brand);
|
|
10
|
+
--pc-editor-control-icon-color: var(--g-color-text-dark-primary);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.pc-field-base {
|
|
14
|
+
position: relative;
|
|
15
|
+
margin-top: 20px;
|
|
16
|
+
}
|
|
17
|
+
.pc-field-base:hover > .pc-field-base__top > .pc-field-base__button {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
}
|
|
20
|
+
.pc-field-base__top {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: 4px;
|
|
24
|
+
margin-bottom: 8px;
|
|
25
|
+
}
|
|
26
|
+
.pc-field-base__foldable {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
}
|
|
31
|
+
.pc-field-base__non-foldable:before {
|
|
32
|
+
position: absolute;
|
|
33
|
+
right: calc(100% + 5px);
|
|
34
|
+
}
|
|
35
|
+
.pc-field-base__button {
|
|
36
|
+
transition: opacity 0.3s ease;
|
|
37
|
+
opacity: 0;
|
|
38
|
+
}
|
|
39
|
+
.pc-field-base__title {
|
|
40
|
+
font-size: var(--g-text-body-2-font-size);
|
|
41
|
+
line-height: var(--g-text-body-2-line-height);
|
|
42
|
+
font-weight: var(--g-text-body-font-weight);
|
|
43
|
+
}
|
|
44
|
+
.pc-field-base__title_size_s {
|
|
45
|
+
font-size: var(--g-text-body-1-font-size);
|
|
46
|
+
line-height: var(--g-text-body-1-line-height);
|
|
47
|
+
font-weight: var(--g-text-body-font-weight);
|
|
48
|
+
}
|
|
49
|
+
.pc-field-base__title_size_m {
|
|
50
|
+
font-size: var(--g-text-body-2-font-size);
|
|
51
|
+
line-height: var(--g-text-body-2-line-height);
|
|
52
|
+
font-weight: var(--g-text-body-font-weight);
|
|
53
|
+
}
|
|
54
|
+
.pc-field-base__title_size_l {
|
|
55
|
+
font-size: var(--g-text-body-3-font-size);
|
|
56
|
+
line-height: var(--g-text-body-3-line-height);
|
|
57
|
+
font-weight: var(--g-text-body-font-weight);
|
|
58
|
+
}
|
|
59
|
+
.pc-field-base:first-child {
|
|
60
|
+
margin-top: 0;
|
|
61
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { ClassNameProps } from '../../../../models';
|
|
3
|
+
export interface FieldBaseParams {
|
|
4
|
+
title?: string;
|
|
5
|
+
textSize?: 's' | 'm' | 'l';
|
|
6
|
+
onRefresh?: (value: undefined) => void;
|
|
7
|
+
expandable?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface FieldBaseProps extends ClassNameProps, PropsWithChildren, FieldBaseParams {
|
|
10
|
+
}
|
|
11
|
+
declare const FieldBase: React.FC<FieldBaseProps>;
|
|
12
|
+
export default FieldBase;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
const icons_1 = require("@gravity-ui/icons");
|
|
6
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
8
|
+
const utils_1 = require("../../../../utils");
|
|
9
|
+
const b = (0, utils_1.block)('field-base');
|
|
10
|
+
const FieldBase = (props) => {
|
|
11
|
+
const { className, title, textSize, children, onRefresh, expandable = false } = props;
|
|
12
|
+
const [showChildren, setShowChildren] = (0, react_1.useState)(!expandable);
|
|
13
|
+
const titleComponent = react_1.default.useMemo(() => {
|
|
14
|
+
if (title) {
|
|
15
|
+
const defaultTitle = (react_1.default.createElement("div", { className: b('title', { size: textSize }) }, lodash_1.default.capitalize(title)));
|
|
16
|
+
if (expandable) {
|
|
17
|
+
return (react_1.default.createElement("div", { className: b('foldable'), onClick: () => setShowChildren(!showChildren) },
|
|
18
|
+
react_1.default.createElement(uikit_1.ArrowToggle, { direction: showChildren ? 'bottom' : 'right', className: b('arrow-toggle') }),
|
|
19
|
+
defaultTitle));
|
|
20
|
+
}
|
|
21
|
+
return react_1.default.createElement("div", { className: b('non-foldable') }, defaultTitle);
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}, [expandable, showChildren, textSize, title]);
|
|
25
|
+
return (react_1.default.createElement("div", { className: b(null, className) },
|
|
26
|
+
title && (react_1.default.createElement("div", { className: b('top') },
|
|
27
|
+
titleComponent,
|
|
28
|
+
onRefresh && (react_1.default.createElement(uikit_1.Button, { className: b('button'), onClick: () => onRefresh(undefined), view: 'flat', size: 'xs' },
|
|
29
|
+
react_1.default.createElement(uikit_1.Icon, { data: icons_1.ArrowRotateLeft, size: 14 }))))),
|
|
30
|
+
(!title || showChildren) && react_1.default.createElement("div", { className: b('children') }, children)));
|
|
31
|
+
};
|
|
32
|
+
exports.default = FieldBase;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-array-dynamic-field__card {
|
|
4
|
+
padding: 12px;
|
|
5
|
+
margin-top: 12px;
|
|
6
|
+
}
|
|
7
|
+
.pc-array-dynamic-field__card:first-child {
|
|
8
|
+
margin-bottom: 0;
|
|
9
|
+
}
|
|
10
|
+
.pc-array-dynamic-field__row {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
gap: 10px;
|
|
15
|
+
margin-top: 10px;
|
|
16
|
+
}
|
|
17
|
+
.pc-array-dynamic-field__row:first-child {
|
|
18
|
+
margin-top: 0;
|
|
19
|
+
}
|
|
20
|
+
.pc-array-dynamic-field__card-head {
|
|
21
|
+
margin-bottom: 8px;
|
|
22
|
+
}
|
|
23
|
+
.pc-array-dynamic-field__row-title {
|
|
24
|
+
font-size: var(--g-text-subheader-3-font-size);
|
|
25
|
+
line-height: var(--g-text-subheader-3-line-height);
|
|
26
|
+
font-weight: var(--g-text-subheader-font-weight);
|
|
27
|
+
}
|
|
28
|
+
.pc-array-dynamic-field__row-title, .pc-array-dynamic-field__row-field {
|
|
29
|
+
flex: 1;
|
|
30
|
+
}
|
|
31
|
+
.pc-array-dynamic-field__empty {
|
|
32
|
+
padding: 10px;
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
}
|
|
36
|
+
.pc-array-dynamic-field__add-button {
|
|
37
|
+
margin-top: 12px;
|
|
38
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArrayObjectInput, ArrayTextInput } from '../../../../../common/types';
|
|
3
|
+
import { ClassNameProps } from '../../../../../models';
|
|
4
|
+
import { DynamicFormValue } from '../../DynamicForm';
|
|
5
|
+
type ArrayInput = ArrayTextInput | ArrayObjectInput;
|
|
6
|
+
interface ArrayFieldProps extends ClassNameProps {
|
|
7
|
+
title: string;
|
|
8
|
+
values: Array<DynamicFormValue>;
|
|
9
|
+
onUpdate: (key: string, value: DynamicFormValue) => void;
|
|
10
|
+
blockConfig: ArrayInput;
|
|
11
|
+
}
|
|
12
|
+
declare const ArrayDynamicField: React.FC<ArrayFieldProps>;
|
|
13
|
+
export default ArrayDynamicField;
|