@gravity-ui/page-constructor 6.3.2-alpha.0 → 6.3.2-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/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/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/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/index.d.ts +1 -1
- package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.css +0 -0
- package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.d.ts +9 -0
- package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.js +115 -0
- package/build/cjs/editor-v2/components/DynamicForm/DynamicForm.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.css +89 -0
- package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.d.ts +12 -0
- package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.js +27 -0
- package/build/cjs/editor-v2/components/DynamicForm/FieldBase/FieldBase.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.css +37 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.d.ts +11 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.js +68 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/Array.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.d.ts +10 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js +22 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.css +3 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.d.ts +8 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.js +13 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Number/Number.d.ts +8 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Number/Number.js +16 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Number/Number.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Object/Object.d.ts +10 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Object/Object.js +12 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Object/Object.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.css +6 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.d.ts +9 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js +35 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.css +3 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.d.ts +11 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.js +14 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Select/Select.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Text/Text.d.ts +8 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Text/Text.js +13 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/Text/Text.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.d.ts +8 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js +13 -0
- package/build/cjs/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js.map +1 -0
- package/build/cjs/editor-v2/components/DynamicForm/utils.d.ts +3 -0
- package/build/cjs/editor-v2/components/DynamicForm/utils.js +23 -0
- package/build/cjs/editor-v2/components/DynamicForm/utils.js.map +1 -0
- package/build/cjs/editor-v2/components/Panels/Panels.css +37 -0
- package/build/cjs/editor-v2/components/Panels/Panels.d.ts +8 -0
- package/build/cjs/editor-v2/components/Panels/Panels.js +28 -0
- package/build/cjs/editor-v2/components/Panels/Panels.js.map +1 -0
- package/build/cjs/editor-v2/components/Sidebar/Sidebar.css +24 -0
- package/build/cjs/editor-v2/components/Sidebar/Sidebar.d.ts +10 -0
- package/build/cjs/editor-v2/components/Sidebar/Sidebar.js +13 -0
- package/build/cjs/editor-v2/components/Sidebar/Sidebar.js.map +1 -0
- package/build/cjs/editor-v2/components/StoreViewer/StoreViewer.css +29 -0
- package/build/cjs/editor-v2/components/StoreViewer/StoreViewer.d.ts +6 -0
- package/build/cjs/editor-v2/components/StoreViewer/StoreViewer.js +17 -0
- package/build/cjs/editor-v2/components/StoreViewer/StoreViewer.js.map +1 -0
- package/build/cjs/editor-v2/components/Tabs/Tabs.css +26 -0
- package/build/cjs/editor-v2/components/Tabs/Tabs.d.ts +13 -0
- package/build/cjs/editor-v2/components/Tabs/Tabs.js +32 -0
- package/build/cjs/editor-v2/components/Tabs/Tabs.js.map +1 -0
- package/build/cjs/editor-v2/constants.d.ts +1 -0
- package/build/cjs/editor-v2/constants.js +5 -0
- package/build/cjs/editor-v2/constants.js.map +1 -0
- package/build/cjs/editor-v2/containers/BigOverlay/BigOverlay.css +35 -0
- package/build/cjs/editor-v2/containers/BigOverlay/BigOverlay.d.ts +4 -0
- package/build/cjs/editor-v2/containers/BigOverlay/BigOverlay.js +58 -0
- package/build/cjs/editor-v2/containers/BigOverlay/BigOverlay.js.map +1 -0
- package/build/cjs/editor-v2/containers/BlockConfig/BlockConfig.css +33 -0
- package/build/cjs/editor-v2/containers/BlockConfig/BlockConfig.d.ts +5 -0
- package/build/cjs/editor-v2/containers/BlockConfig/BlockConfig.js +28 -0
- package/build/cjs/editor-v2/containers/BlockConfig/BlockConfig.js.map +1 -0
- package/build/cjs/editor-v2/containers/BlocksList/BlocksList.css +65 -0
- package/build/cjs/editor-v2/containers/BlocksList/BlocksList.d.ts +2 -0
- package/build/cjs/editor-v2/containers/BlocksList/BlocksList.js +43 -0
- package/build/cjs/editor-v2/containers/BlocksList/BlocksList.js.map +1 -0
- package/build/cjs/editor-v2/containers/Editor/Editor.css +51 -0
- package/build/cjs/editor-v2/containers/Editor/Editor.d.ts +21 -0
- package/build/cjs/editor-v2/containers/Editor/Editor.js +40 -0
- package/build/cjs/editor-v2/containers/Editor/Editor.js.map +1 -0
- package/build/cjs/editor-v2/containers/GlobalConfig/GlobalConfig.css +24 -0
- package/build/cjs/editor-v2/containers/GlobalConfig/GlobalConfig.d.ts +5 -0
- package/build/cjs/editor-v2/containers/GlobalConfig/GlobalConfig.js +17 -0
- package/build/cjs/editor-v2/containers/GlobalConfig/GlobalConfig.js.map +1 -0
- package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.css +62 -0
- package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.d.ts +7 -0
- package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.js +34 -0
- package/build/cjs/editor-v2/containers/MiddleScreen/MiddleScreen.js.map +1 -0
- package/build/cjs/editor-v2/containers/Overlay/Overlay.css +60 -0
- package/build/cjs/editor-v2/containers/Overlay/Overlay.d.ts +6 -0
- package/build/cjs/editor-v2/containers/Overlay/Overlay.js +90 -0
- package/build/cjs/editor-v2/containers/Overlay/Overlay.js.map +1 -0
- package/build/cjs/editor-v2/containers/Source/Source.css +27 -0
- package/build/cjs/editor-v2/containers/Source/Source.d.ts +2 -0
- package/build/cjs/editor-v2/containers/Source/Source.js +28 -0
- package/build/cjs/editor-v2/containers/Source/Source.js.map +1 -0
- package/build/cjs/editor-v2/containers/SourceCode/SourceCode.css +50 -0
- package/build/cjs/editor-v2/containers/SourceCode/SourceCode.d.ts +6 -0
- package/build/cjs/editor-v2/containers/SourceCode/SourceCode.js +41 -0
- package/build/cjs/editor-v2/containers/SourceCode/SourceCode.js.map +1 -0
- package/build/cjs/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.css +3 -0
- package/build/cjs/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.d.ts +7 -0
- package/build/cjs/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.js +18 -0
- package/build/cjs/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.js.map +1 -0
- package/build/cjs/editor-v2/containers/Tree/DragContext.css +38 -0
- package/build/cjs/editor-v2/containers/Tree/DragContext.d.ts +14 -0
- package/build/cjs/editor-v2/containers/Tree/DragContext.js +49 -0
- package/build/cjs/editor-v2/containers/Tree/DragContext.js.map +1 -0
- package/build/cjs/editor-v2/containers/Tree/Tree.css +23 -0
- package/build/cjs/editor-v2/containers/Tree/Tree.d.ts +2 -0
- package/build/cjs/editor-v2/containers/Tree/Tree.js +36 -0
- package/build/cjs/editor-v2/containers/Tree/Tree.js.map +1 -0
- package/build/cjs/editor-v2/containers/Tree/TreeContent.css +28 -0
- package/build/cjs/editor-v2/containers/Tree/TreeContent.d.ts +16 -0
- package/build/cjs/editor-v2/containers/Tree/TreeContent.js +61 -0
- package/build/cjs/editor-v2/containers/Tree/TreeContent.js.map +1 -0
- package/build/cjs/editor-v2/containers/Tree/TreeItem.css +66 -0
- package/build/cjs/editor-v2/containers/Tree/TreeItem.d.ts +13 -0
- package/build/cjs/editor-v2/containers/Tree/TreeItem.js +144 -0
- package/build/cjs/editor-v2/containers/Tree/TreeItem.js.map +1 -0
- package/build/cjs/editor-v2/containers/Tree/index.d.ts +4 -0
- package/build/cjs/editor-v2/containers/Tree/index.js +10 -0
- package/build/cjs/editor-v2/containers/Tree/index.js.map +1 -0
- package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.css +23 -0
- package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.d.ts +3 -0
- package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.js +54 -0
- package/build/cjs/editor-v2/containers/ViewSwitches/ViewSwitches.js.map +1 -0
- package/build/cjs/editor-v2/context/editorStore/MainEditorStoreContext.d.ts +7 -0
- package/build/cjs/editor-v2/context/editorStore/MainEditorStoreContext.js +10 -0
- package/build/cjs/editor-v2/context/editorStore/MainEditorStoreContext.js.map +1 -0
- package/build/cjs/editor-v2/context/editorStore/MainEditorStoreProvider.d.ts +5 -0
- package/build/cjs/editor-v2/context/editorStore/MainEditorStoreProvider.js +35 -0
- package/build/cjs/editor-v2/context/editorStore/MainEditorStoreProvider.js.map +1 -0
- package/build/cjs/editor-v2/context/editorStore/index.d.ts +2 -0
- package/build/cjs/editor-v2/context/editorStore/index.js +6 -0
- package/build/cjs/editor-v2/context/editorStore/index.js.map +1 -0
- package/build/cjs/editor-v2/context/iframeContext/IframeContext.d.ts +12 -0
- package/build/cjs/editor-v2/context/iframeContext/IframeContext.js +14 -0
- package/build/cjs/editor-v2/context/iframeContext/IframeContext.js.map +1 -0
- package/build/cjs/editor-v2/context/iframeContext/IframeProvider.d.ts +7 -0
- package/build/cjs/editor-v2/context/iframeContext/IframeProvider.js +21 -0
- package/build/cjs/editor-v2/context/iframeContext/IframeProvider.js.map +1 -0
- package/build/cjs/editor-v2/context/iframeContext/index.d.ts +2 -0
- package/build/cjs/editor-v2/context/iframeContext/index.js +6 -0
- package/build/cjs/editor-v2/context/iframeContext/index.js.map +1 -0
- package/build/cjs/editor-v2/hooks/useEditorTabs.d.ts +16 -0
- package/build/cjs/editor-v2/hooks/useEditorTabs.js +77 -0
- package/build/cjs/editor-v2/hooks/useEditorTabs.js.map +1 -0
- package/build/cjs/editor-v2/hooks/useMainEditorInitialize.d.ts +2 -0
- package/build/cjs/editor-v2/hooks/useMainEditorInitialize.js +31 -0
- package/build/cjs/editor-v2/hooks/useMainEditorInitialize.js.map +1 -0
- package/build/cjs/editor-v2/hooks/useMainEditorStore.d.ts +1 -0
- package/build/cjs/editor-v2/hooks/useMainEditorStore.js +13 -0
- package/build/cjs/editor-v2/hooks/useMainEditorStore.js.map +1 -0
- package/build/cjs/editor-v2/hooks/usePostMessageEvents.d.ts +6 -0
- package/build/cjs/editor-v2/hooks/usePostMessageEvents.js +19 -0
- package/build/cjs/editor-v2/hooks/usePostMessageEvents.js.map +1 -0
- package/build/cjs/editor-v2/index.d.ts +2 -0
- package/build/cjs/editor-v2/index.js +8 -0
- package/build/cjs/editor-v2/index.js.map +1 -0
- package/build/cjs/editor-v2/store.d.ts +48 -0
- package/build/cjs/editor-v2/store.js +181 -0
- package/build/cjs/editor-v2/store.js.map +1 -0
- package/build/cjs/editor-v2/styles/mixins.css +0 -0
- package/build/cjs/editor-v2/styles/root.css +12 -0
- package/build/cjs/editor-v2/styles/variables.css +0 -0
- package/build/cjs/editor-v2/utils/cn.d.ts +2 -0
- package/build/cjs/editor-v2/utils/cn.js +7 -0
- package/build/cjs/editor-v2/utils/cn.js.map +1 -0
- package/build/cjs/editor-v2/utils/code.d.ts +6 -0
- package/build/cjs/editor-v2/utils/code.js +13 -0
- package/build/cjs/editor-v2/utils/code.js.map +1 -0
- package/build/cjs/editor-v2/utils/index.d.ts +18 -0
- package/build/cjs/editor-v2/utils/index.js +159 -0
- package/build/cjs/editor-v2/utils/index.js.map +1 -0
- 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/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/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/index.d.ts +1 -1
- package/build/esm/editor-v2/components/DynamicForm/DynamicForm.css +0 -0
- package/build/esm/editor-v2/components/DynamicForm/DynamicForm.d.ts +10 -0
- package/build/esm/editor-v2/components/DynamicForm/DynamicForm.js +113 -0
- package/build/esm/editor-v2/components/DynamicForm/DynamicForm.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.css +89 -0
- package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.d.ts +13 -0
- package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.js +25 -0
- package/build/esm/editor-v2/components/DynamicForm/FieldBase/FieldBase.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.css +37 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.d.ts +12 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.js +66 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/Array.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.d.ts +10 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js +19 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Array/ItemButton/ItemButton.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Boolean/Boolean.css +3 -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/Boolean/Boolean.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Number/Number.d.ts +8 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Number/Number.js +13 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Number/Number.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Object/Object.d.ts +10 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Object/Object.js +9 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Object/Object.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.css +6 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.d.ts +10 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js +33 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/OneOf/OneOf.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Select/Select.css +3 -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 +12 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Select/Select.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Text/Text.d.ts +8 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Text/Text.js +10 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/Text/Text.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.d.ts +8 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js +10 -0
- package/build/esm/editor-v2/components/DynamicForm/Fields/TextArea/TextArea.js.map +1 -0
- package/build/esm/editor-v2/components/DynamicForm/utils.d.ts +3 -0
- package/build/esm/editor-v2/components/DynamicForm/utils.js +17 -0
- package/build/esm/editor-v2/components/DynamicForm/utils.js.map +1 -0
- package/build/esm/editor-v2/components/Panels/Panels.css +37 -0
- package/build/esm/editor-v2/components/Panels/Panels.d.ts +9 -0
- package/build/esm/editor-v2/components/Panels/Panels.js +24 -0
- package/build/esm/editor-v2/components/Panels/Panels.js.map +1 -0
- package/build/esm/editor-v2/components/Sidebar/Sidebar.css +24 -0
- package/build/esm/editor-v2/components/Sidebar/Sidebar.d.ts +11 -0
- package/build/esm/editor-v2/components/Sidebar/Sidebar.js +9 -0
- package/build/esm/editor-v2/components/Sidebar/Sidebar.js.map +1 -0
- package/build/esm/editor-v2/components/StoreViewer/StoreViewer.css +29 -0
- package/build/esm/editor-v2/components/StoreViewer/StoreViewer.d.ts +7 -0
- package/build/esm/editor-v2/components/StoreViewer/StoreViewer.js +15 -0
- package/build/esm/editor-v2/components/StoreViewer/StoreViewer.js.map +1 -0
- package/build/esm/editor-v2/components/Tabs/Tabs.css +26 -0
- package/build/esm/editor-v2/components/Tabs/Tabs.d.ts +14 -0
- package/build/esm/editor-v2/components/Tabs/Tabs.js +30 -0
- package/build/esm/editor-v2/components/Tabs/Tabs.js.map +1 -0
- package/build/esm/editor-v2/constants.d.ts +1 -0
- package/build/esm/editor-v2/constants.js +2 -0
- package/build/esm/editor-v2/constants.js.map +1 -0
- package/build/esm/editor-v2/containers/BigOverlay/BigOverlay.css +35 -0
- package/build/esm/editor-v2/containers/BigOverlay/BigOverlay.d.ts +5 -0
- package/build/esm/editor-v2/containers/BigOverlay/BigOverlay.js +56 -0
- package/build/esm/editor-v2/containers/BigOverlay/BigOverlay.js.map +1 -0
- package/build/esm/editor-v2/containers/BlockConfig/BlockConfig.css +33 -0
- package/build/esm/editor-v2/containers/BlockConfig/BlockConfig.d.ts +6 -0
- package/build/esm/editor-v2/containers/BlockConfig/BlockConfig.js +26 -0
- package/build/esm/editor-v2/containers/BlockConfig/BlockConfig.js.map +1 -0
- package/build/esm/editor-v2/containers/BlocksList/BlocksList.css +65 -0
- package/build/esm/editor-v2/containers/BlocksList/BlocksList.d.ts +3 -0
- package/build/esm/editor-v2/containers/BlocksList/BlocksList.js +41 -0
- package/build/esm/editor-v2/containers/BlocksList/BlocksList.js.map +1 -0
- package/build/esm/editor-v2/containers/Editor/Editor.css +51 -0
- package/build/esm/editor-v2/containers/Editor/Editor.d.ts +22 -0
- package/build/esm/editor-v2/containers/Editor/Editor.js +36 -0
- package/build/esm/editor-v2/containers/Editor/Editor.js.map +1 -0
- package/build/esm/editor-v2/containers/GlobalConfig/GlobalConfig.css +24 -0
- package/build/esm/editor-v2/containers/GlobalConfig/GlobalConfig.d.ts +6 -0
- package/build/esm/editor-v2/containers/GlobalConfig/GlobalConfig.js +15 -0
- package/build/esm/editor-v2/containers/GlobalConfig/GlobalConfig.js.map +1 -0
- package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.css +62 -0
- package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.d.ts +8 -0
- package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.js +32 -0
- package/build/esm/editor-v2/containers/MiddleScreen/MiddleScreen.js.map +1 -0
- package/build/esm/editor-v2/containers/Overlay/Overlay.css +60 -0
- package/build/esm/editor-v2/containers/Overlay/Overlay.d.ts +7 -0
- package/build/esm/editor-v2/containers/Overlay/Overlay.js +88 -0
- package/build/esm/editor-v2/containers/Overlay/Overlay.js.map +1 -0
- package/build/esm/editor-v2/containers/Source/Source.css +27 -0
- package/build/esm/editor-v2/containers/Source/Source.d.ts +3 -0
- package/build/esm/editor-v2/containers/Source/Source.js +26 -0
- package/build/esm/editor-v2/containers/Source/Source.js.map +1 -0
- package/build/esm/editor-v2/containers/SourceCode/SourceCode.css +50 -0
- package/build/esm/editor-v2/containers/SourceCode/SourceCode.d.ts +7 -0
- package/build/esm/editor-v2/containers/SourceCode/SourceCode.js +39 -0
- package/build/esm/editor-v2/containers/SourceCode/SourceCode.js.map +1 -0
- package/build/esm/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.css +3 -0
- package/build/esm/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.d.ts +8 -0
- package/build/esm/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.js +14 -0
- package/build/esm/editor-v2/containers/SourceCode/UpdateModal/UpdateModal.js.map +1 -0
- package/build/esm/editor-v2/containers/Tree/DragContext.css +38 -0
- package/build/esm/editor-v2/containers/Tree/DragContext.d.ts +15 -0
- package/build/esm/editor-v2/containers/Tree/DragContext.js +45 -0
- package/build/esm/editor-v2/containers/Tree/DragContext.js.map +1 -0
- package/build/esm/editor-v2/containers/Tree/Tree.css +23 -0
- package/build/esm/editor-v2/containers/Tree/Tree.d.ts +3 -0
- package/build/esm/editor-v2/containers/Tree/Tree.js +34 -0
- package/build/esm/editor-v2/containers/Tree/Tree.js.map +1 -0
- package/build/esm/editor-v2/containers/Tree/TreeContent.css +28 -0
- package/build/esm/editor-v2/containers/Tree/TreeContent.d.ts +17 -0
- package/build/esm/editor-v2/containers/Tree/TreeContent.js +57 -0
- package/build/esm/editor-v2/containers/Tree/TreeContent.js.map +1 -0
- package/build/esm/editor-v2/containers/Tree/TreeItem.css +66 -0
- package/build/esm/editor-v2/containers/Tree/TreeItem.d.ts +14 -0
- package/build/esm/editor-v2/containers/Tree/TreeItem.js +140 -0
- package/build/esm/editor-v2/containers/Tree/TreeItem.js.map +1 -0
- package/build/esm/editor-v2/containers/Tree/index.d.ts +4 -0
- package/build/esm/editor-v2/containers/Tree/index.js +5 -0
- package/build/esm/editor-v2/containers/Tree/index.js.map +1 -0
- package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.css +23 -0
- package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.d.ts +4 -0
- package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.js +52 -0
- package/build/esm/editor-v2/containers/ViewSwitches/ViewSwitches.js.map +1 -0
- package/build/esm/editor-v2/context/editorStore/MainEditorStoreContext.d.ts +7 -0
- package/build/esm/editor-v2/context/editorStore/MainEditorStoreContext.js +6 -0
- package/build/esm/editor-v2/context/editorStore/MainEditorStoreContext.js.map +1 -0
- package/build/esm/editor-v2/context/editorStore/MainEditorStoreProvider.d.ts +5 -0
- package/build/esm/editor-v2/context/editorStore/MainEditorStoreProvider.js +30 -0
- package/build/esm/editor-v2/context/editorStore/MainEditorStoreProvider.js.map +1 -0
- package/build/esm/editor-v2/context/editorStore/index.d.ts +2 -0
- package/build/esm/editor-v2/context/editorStore/index.js +3 -0
- package/build/esm/editor-v2/context/editorStore/index.js.map +1 -0
- package/build/esm/editor-v2/context/iframeContext/IframeContext.d.ts +12 -0
- package/build/esm/editor-v2/context/iframeContext/IframeContext.js +10 -0
- package/build/esm/editor-v2/context/iframeContext/IframeContext.js.map +1 -0
- package/build/esm/editor-v2/context/iframeContext/IframeProvider.d.ts +7 -0
- package/build/esm/editor-v2/context/iframeContext/IframeProvider.js +16 -0
- package/build/esm/editor-v2/context/iframeContext/IframeProvider.js.map +1 -0
- package/build/esm/editor-v2/context/iframeContext/index.d.ts +2 -0
- package/build/esm/editor-v2/context/iframeContext/index.js +3 -0
- package/build/esm/editor-v2/context/iframeContext/index.js.map +1 -0
- package/build/esm/editor-v2/hooks/useEditorTabs.d.ts +16 -0
- package/build/esm/editor-v2/hooks/useEditorTabs.js +72 -0
- package/build/esm/editor-v2/hooks/useEditorTabs.js.map +1 -0
- package/build/esm/editor-v2/hooks/useMainEditorInitialize.d.ts +2 -0
- package/build/esm/editor-v2/hooks/useMainEditorInitialize.js +29 -0
- package/build/esm/editor-v2/hooks/useMainEditorInitialize.js.map +1 -0
- package/build/esm/editor-v2/hooks/useMainEditorStore.d.ts +1 -0
- package/build/esm/editor-v2/hooks/useMainEditorStore.js +8 -0
- package/build/esm/editor-v2/hooks/useMainEditorStore.js.map +1 -0
- package/build/esm/editor-v2/hooks/usePostMessageEvents.d.ts +6 -0
- package/build/esm/editor-v2/hooks/usePostMessageEvents.js +15 -0
- package/build/esm/editor-v2/hooks/usePostMessageEvents.js.map +1 -0
- package/build/esm/editor-v2/index.d.ts +2 -0
- package/build/esm/editor-v2/index.js +3 -0
- package/build/esm/editor-v2/index.js.map +1 -0
- package/build/esm/editor-v2/store.d.ts +48 -0
- package/build/esm/editor-v2/store.js +177 -0
- package/build/esm/editor-v2/store.js.map +1 -0
- package/build/esm/editor-v2/styles/mixins.css +0 -0
- package/build/esm/editor-v2/styles/root.css +12 -0
- package/build/esm/editor-v2/styles/variables.css +0 -0
- package/build/esm/editor-v2/utils/cn.d.ts +2 -0
- package/build/esm/editor-v2/utils/cn.js +4 -0
- package/build/esm/editor-v2/utils/cn.js.map +1 -0
- package/build/esm/editor-v2/utils/code.d.ts +6 -0
- package/build/esm/editor-v2/utils/code.js +9 -0
- package/build/esm/editor-v2/utils/code.js.map +1 -0
- package/build/esm/editor-v2/utils/index.d.ts +18 -0
- package/build/esm/editor-v2/utils/index.js +141 -0
- package/build/esm/editor-v2/utils/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"../../../src","sources":["editor-v2/store.ts"],"names":[],"mappings":";;;;AAAA,4DAAuB;AAEvB,iDAA6D;AAE7D,iDAAmD;AAGnD,8CAAuC;AACvC,4CASiB;AA0BJ,QAAA,iBAAiB,GAAG,IAAA,uBAAe,EAC5C,oBAAY,EACZ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACX,SAAS,CAAC,MAAc;QACpB,gFAAgF;QAChF,sDAAsD;QACtD,MAAM,SAAS,GAAG,MAAM,GAAG,GAAG,CAAC;QAC/B,GAAG,CAAC,CAAC,KAAK,EA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AAE,EAAC,GAAG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAC;YACpD,aAAa,EAAE,oBAAoB;SACtC,CAAC,CAAC,CAAC;IACR,CAAC;IACD,eAAe,EAAE,GAAG,EAAE;QAClB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACZ,GAAG,KAAK;YACR,WAAW,EAAE,KAAK;SACrB,CAAC,CAAC,CAAC;IACR,CAAC;IACD,WAAW,EAAE,GAAG,EAAE;QACd,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACZ,GAAG,KAAK;YACR,OAAO,EAAE,EAAC,GAAG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAC;SAC1C,CAAC,CAAC,CAAC;IACR,CAAC;CACJ,CAAC,CACL,CAAC","sourcesContent":["import _ from 'lodash';\n\nimport {EditorState, initialStore} from '../../common/store';\nimport {DynamicFormValue} from '../../common/types';\nimport {initializeStore} from '../../common/utils';\nimport {ConstructorBlock, PageContentWithNavigation} from '../models';\n\nimport {ZOOM_STEPS} from './constants';\nimport {\n duplicateArrayItem,\n generateChildrenPathFromArray,\n getDestinationShiftBeforeReorder,\n insert,\n isItemsNeighbours,\n modifyObjectByPath,\n removeFromArray,\n reorderArrayItems,\n} from './utils';\n\nexport interface EditorMethods {\n initialize(): void;\n setSelectedBlock(path: number[] | null): void;\n setHeight(height: number): void;\n setDeviceWidth(deviceWidth: string): void;\n setZoom(zoom: number): void;\n increaseZoom(): void;\n decreaseZoom(): void;\n setConfig(data: Pick<EditorState, 'blocks' | 'subBlocks' | 'global'>): void;\n setContent(data: PageContentWithNavigation): void;\n insertBlock(path: number[], blockType: string, position?: 'prepend' | 'append'): void;\n enableInsertMode(blockType: string): void;\n enableReorderMode(path: number[]): void;\n disableMode(): void;\n updateField(path: string, value: DynamicFormValue): void;\n deleteBlock(path: number[]): void;\n duplicateBlock(path: number[]): void;\n reorderBlock(path: number[], destination: number[], position?: 'prepend' | 'append'): void;\n resetInitialize(): void;\n resetBlocks(): void;\n}\n\nexport type EditorStore = EditorState & EditorMethods;\n\nexport const createEditorStore = initializeStore<EditorState, EditorMethods>(\n initialStore,\n (set, get) => ({\n setHeight(height: number) {\n // We have to add 200-500px, because of bottom padding or margin of last element\n // which is not taken into calculation of final height\n const newHeight = height + 500;\n set((state) => ({...state, height: newHeight}));\n },\n setDeviceWidth(deviceWidth: string) {\n set((state) => ({...state, deviceWidth}));\n },\n setZoom(zoom) {\n if (zoom > 0) {\n set((state) => ({...state, zoom}));\n }\n },\n increaseZoom() {\n const currentZoom = get().zoom;\n\n for (const step of ZOOM_STEPS) {\n if (currentZoom < step) {\n get().setZoom(step);\n break;\n }\n }\n },\n decreaseZoom() {\n const currentZoom = get().zoom;\n const reverseSteps = ZOOM_STEPS.slice().reverse();\n\n for (const step of reverseSteps) {\n if (currentZoom > step) {\n get().setZoom(step);\n break;\n }\n }\n },\n setConfig(data) {\n set((state) => ({...state, ...data}));\n },\n insertBlock: (arrayPath, blockType, position = 'append') => {\n if (position === 'append') {\n // TODO: fix\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign\n arrayPath[arrayPath.length - 1] = arrayPath[arrayPath.length - 1] + 1;\n }\n\n const blocksConfig = get().content.blocks;\n const blocksData = get().blocks;\n\n const foundBlock = blocksData.find(({type}) => type === blockType);\n const defaultValue =\n foundBlock && foundBlock.schema.default\n ? {...foundBlock.schema.default, type: blockType}\n : {type: blockType};\n\n const newBlocksConfig = modifyObjectByPath(\n blocksConfig,\n arrayPath,\n (parentBlocks, index) =>\n insert(parentBlocks, index, defaultValue as ConstructorBlock),\n );\n\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n selectedBlock: arrayPath,\n }));\n },\n enableInsertMode(blockType: string) {\n set((state) => ({\n ...state,\n manipulateOverlayMode: 'insert',\n preInsertBlockType: blockType,\n }));\n },\n disableMode() {\n set((state) => ({\n ...state,\n manipulateOverlayMode: false,\n preInsertBlockType: undefined,\n preReorderBlockPath: undefined,\n }));\n },\n enableReorderMode(path) {\n set((state) => ({\n ...state,\n manipulateOverlayMode: 'reorder',\n preReorderBlockPath: path,\n }));\n },\n setContent(content) {\n set((state) => ({\n ...state,\n content: content,\n }));\n },\n initialize() {\n set((state) => ({\n ...state,\n initialized: true,\n }));\n },\n setSelectedBlock(path) {\n set((state) => ({\n ...state,\n selectedBlock: path,\n }));\n },\n updateField(path, value) {\n set((state) => {\n const newConfig = _.set(state.content, path, value);\n return {\n ...state,\n content: newConfig,\n };\n });\n },\n deleteBlock: (arrayPath) => {\n const blocksConfig = get().content.blocks;\n\n const newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, removeFromArray);\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n selectedBlock: null,\n }));\n },\n duplicateBlock: (arrayPath) => {\n const blocksConfig = get().content.blocks;\n\n const newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, duplicateArrayItem);\n\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n }));\n },\n reorderBlock: (arrayPath, destination, position = 'append') => {\n // Create a copy of the destination array before any modifications\n let finalDestinationPath: number[] = _.cloneDeep(destination);\n\n if (position === 'append') {\n // TODO: fix\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign\n destination[destination.length - 1] = destination[destination.length - 1] + 1;\n }\n\n let newBlocksConfig: ConstructorBlock[];\n const blocksConfig = get().content.blocks;\n // Copy\n const copiedBlock = _.get(blocksConfig, generateChildrenPathFromArray(arrayPath));\n\n if (isItemsNeighbours(arrayPath, destination)) {\n newBlocksConfig = modifyObjectByPath(blocksConfig, arrayPath, (parentBlocks) => {\n return reorderArrayItems(\n parentBlocks,\n arrayPath[arrayPath.length - 1],\n destination[destination.length - 1],\n );\n });\n\n if (\n position === 'append' &&\n destination[destination.length - 1] < arrayPath[arrayPath.length - 1]\n ) {\n finalDestinationPath[finalDestinationPath.length - 1] =\n finalDestinationPath[finalDestinationPath.length - 1] + 1;\n }\n } else {\n const arrayDest = getDestinationShiftBeforeReorder(arrayPath, destination);\n finalDestinationPath = _.cloneDeep(arrayDest);\n\n // Delete\n const blocksConfigWithoutBlock = modifyObjectByPath(\n blocksConfig,\n arrayPath,\n removeFromArray,\n );\n // Paste\n newBlocksConfig = modifyObjectByPath(\n blocksConfigWithoutBlock,\n arrayDest,\n (parentBlocks, index) => insert(parentBlocks, index, copiedBlock),\n );\n }\n\n set((state) => ({\n ...state,\n content: {...state.content, blocks: newBlocksConfig},\n selectedBlock: finalDestinationPath,\n }));\n },\n resetInitialize: () => {\n set((state) => ({\n ...state,\n initialized: false,\n }));\n },\n resetBlocks: () => {\n set((state) => ({\n ...state,\n content: {...state.content, blocks: []},\n }));\n },\n }),\n);\n"]}
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.g-root {
|
|
2
|
+
--g-color-base-brand: var(--g-color-private-black-550-solid);
|
|
3
|
+
--g-color-base-brand-hover: var(--g-color-private-black-600-solid);
|
|
4
|
+
--g-color-base-selection: var(--g-color-private-black-200);
|
|
5
|
+
--g-color-base-selection-hover: var(--g-color-private-black-300);
|
|
6
|
+
--g-color-base-brand: var(--g-color-text-primary);
|
|
7
|
+
--g-color-base-brand-hover: var(--g-color-text-complementary);
|
|
8
|
+
--g-color-text-brand-contrast: var(--g-color-text-light-primary);
|
|
9
|
+
--g-color-line-brand: var(--g-color-text-primary);
|
|
10
|
+
--g-color-text-brand: var(--g-color-private-brand-700-solid);
|
|
11
|
+
--g-color-text-brand-heavy: var(--g-color-private-black-700-solid);
|
|
12
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.editorCn = exports.EDITOR_NAMESPACE = void 0;
|
|
4
|
+
const classname_1 = require("@bem-react/classname");
|
|
5
|
+
exports.EDITOR_NAMESPACE = 'pceditor-';
|
|
6
|
+
exports.editorCn = (0, classname_1.withNaming)({ n: exports.EDITOR_NAMESPACE, e: '__', m: '_' });
|
|
7
|
+
//# sourceMappingURL=cn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.js","sourceRoot":"../../../../src","sources":["editor-v2/utils/cn.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAEnC,QAAA,gBAAgB,GAAG,WAAW,CAAC;AAE/B,QAAA,QAAQ,GAAG,IAAA,sBAAU,EAAC,EAAC,CAAC,EAAE,wBAAgB,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAC,CAAC,CAAC","sourcesContent":["import {withNaming} from '@bem-react/classname';\n\nexport const EDITOR_NAMESPACE = 'pceditor-';\n\nexport const editorCn = withNaming({n: EDITOR_NAMESPACE, e: '__', m: '_'});\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseCode = parseCode;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
|
|
6
|
+
function parseCode(code) {
|
|
7
|
+
const pageContent = js_yaml_1.default.load(code);
|
|
8
|
+
return {
|
|
9
|
+
...pageContent,
|
|
10
|
+
blocks: pageContent.blocks?.filter(Boolean),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.js","sourceRoot":"../../../../src","sources":["editor-v2/utils/code.ts"],"names":[],"mappings":";;AAIA,8BAOC;;AAXD,8DAA2B;AAI3B,SAAgB,SAAS,CAAC,IAAY;IAClC,MAAM,WAAW,GAAG,iBAAI,CAAC,IAAI,CAAC,IAAI,CAAgB,CAAC;IAEnD,OAAO;QACH,GAAG,WAAW;QACd,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC;KAC9C,CAAC;AACN,CAAC","sourcesContent":["import yaml from 'js-yaml';\n\nimport {PageContent} from '../../models';\n\nexport function parseCode(code: string) {\n const pageContent = yaml.load(code) as PageContent;\n\n return {\n ...pageContent,\n blocks: pageContent.blocks?.filter(Boolean),\n };\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ConstructorBlock } from "../../models/index.js";
|
|
2
|
+
export declare function insert<T>(arr: Array<T>, index: number, newItem: T): T[];
|
|
3
|
+
export declare function removeFromArray<T>(array: Array<T>, index: number): T[];
|
|
4
|
+
export declare function swapArrayItems<T>(array: Array<T>, firstIndex: number, secondIndex: number): T[];
|
|
5
|
+
export declare function reorderArrayItems<T>(array: Array<T>, index: number, destination: number): T[];
|
|
6
|
+
export declare function duplicateArrayItem<T>(array: Array<T>, index: number): T[];
|
|
7
|
+
export declare function insertByPath<T extends object>(object: T, path: string, value: any): T;
|
|
8
|
+
export declare function splitPathAndIndex(path: string): {
|
|
9
|
+
path: string;
|
|
10
|
+
index: number;
|
|
11
|
+
} | undefined;
|
|
12
|
+
export declare function generateChildrenPathFromArray(indexes: number[]): string;
|
|
13
|
+
export declare function modifyObjectByPath(blocks: ConstructorBlock[], arrayPath: number[], modifyCallback: (parentBlocks: ConstructorBlock[], index: number) => ConstructorBlock[]): ConstructorBlock[];
|
|
14
|
+
export declare function isItemsNeighbours(arrayA: number[], arrayB: number[]): boolean;
|
|
15
|
+
export declare function getDestinationShiftBeforeReorder(arrayInit: number[], arrayDest: number[]): number[];
|
|
16
|
+
export declare function prepareShift(arrayInit: number[], arrayDest: number[]): number[];
|
|
17
|
+
export declare const getUrlOrigin: (url: string) => string | undefined;
|
|
18
|
+
export declare const getItemTitle: (item: object) => string | undefined;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getItemTitle = exports.getUrlOrigin = void 0;
|
|
4
|
+
exports.insert = insert;
|
|
5
|
+
exports.removeFromArray = removeFromArray;
|
|
6
|
+
exports.swapArrayItems = swapArrayItems;
|
|
7
|
+
exports.reorderArrayItems = reorderArrayItems;
|
|
8
|
+
exports.duplicateArrayItem = duplicateArrayItem;
|
|
9
|
+
exports.insertByPath = insertByPath;
|
|
10
|
+
exports.splitPathAndIndex = splitPathAndIndex;
|
|
11
|
+
exports.generateChildrenPathFromArray = generateChildrenPathFromArray;
|
|
12
|
+
exports.modifyObjectByPath = modifyObjectByPath;
|
|
13
|
+
exports.isItemsNeighbours = isItemsNeighbours;
|
|
14
|
+
exports.getDestinationShiftBeforeReorder = getDestinationShiftBeforeReorder;
|
|
15
|
+
exports.prepareShift = prepareShift;
|
|
16
|
+
const tslib_1 = require("tslib");
|
|
17
|
+
const lodash_1 = tslib_1.__importDefault(require("lodash"));
|
|
18
|
+
function insert(arr, index, newItem) {
|
|
19
|
+
return [...arr.slice(0, index), newItem, ...arr.slice(index)];
|
|
20
|
+
}
|
|
21
|
+
function removeFromArray(array, index) {
|
|
22
|
+
return [...array.slice(0, index), ...array.slice(index + 1)];
|
|
23
|
+
}
|
|
24
|
+
function swapArrayItems(array, firstIndex, secondIndex) {
|
|
25
|
+
const results = array.slice();
|
|
26
|
+
const firstItem = array[firstIndex];
|
|
27
|
+
results[firstIndex] = array[secondIndex];
|
|
28
|
+
results[secondIndex] = firstItem;
|
|
29
|
+
return results;
|
|
30
|
+
}
|
|
31
|
+
function reorderArrayItems(array, index, destination) {
|
|
32
|
+
const min = Math.min(index, destination);
|
|
33
|
+
const max = Math.max(index, destination);
|
|
34
|
+
const firstOperationRemove = index < destination;
|
|
35
|
+
const result = [];
|
|
36
|
+
result.push(...array.slice(0, min));
|
|
37
|
+
if (!firstOperationRemove) {
|
|
38
|
+
result.push(array[index]);
|
|
39
|
+
}
|
|
40
|
+
result.push(...array.slice(firstOperationRemove ? min + 1 : min, max));
|
|
41
|
+
if (firstOperationRemove) {
|
|
42
|
+
result.push(array[index]);
|
|
43
|
+
}
|
|
44
|
+
result.push(...array.slice(firstOperationRemove ? max : max + 1, array.length));
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
function duplicateArrayItem(array, index) {
|
|
48
|
+
const duplicatedItem = lodash_1.default.cloneDeep(array[index]);
|
|
49
|
+
return [...array.slice(0, index), duplicatedItem, ...array.slice(index)];
|
|
50
|
+
}
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
+
function insertByPath(object, path, value) {
|
|
53
|
+
if (!path) {
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
return lodash_1.default.setWith(lodash_1.default.clone(object), path, value, lodash_1.default.clone);
|
|
57
|
+
}
|
|
58
|
+
/*
|
|
59
|
+
* path: string;
|
|
60
|
+
* Example:
|
|
61
|
+
* 1. blocks[0] => {path: blocks, index: 0}
|
|
62
|
+
* 2. blocks[2].children[10] => {path: blocks[2].children, index: 10}
|
|
63
|
+
**/
|
|
64
|
+
function splitPathAndIndex(path) {
|
|
65
|
+
// Match blocks[3], blocks[0].children[12], blocks[0], blocks[999999]
|
|
66
|
+
const bracketsRegExp = /(.*)\[(\d+)]$/g;
|
|
67
|
+
const regexpMatches = [...path.matchAll(bracketsRegExp)];
|
|
68
|
+
if (regexpMatches.length) {
|
|
69
|
+
return {
|
|
70
|
+
// blocks, blocks[0].children
|
|
71
|
+
path: regexpMatches[0][1],
|
|
72
|
+
// 3, 12, 0, 9999
|
|
73
|
+
index: Number(regexpMatches[0][2]),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
// eslint-disable-next-line no-console
|
|
77
|
+
console.error('Non correct path for splitting');
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
/*
|
|
81
|
+
* [0, 4, 3] => [0].children[4].children[3]
|
|
82
|
+
* */
|
|
83
|
+
function generateChildrenPathFromArray(indexes) {
|
|
84
|
+
if (!indexes.length) {
|
|
85
|
+
return '';
|
|
86
|
+
}
|
|
87
|
+
let resultPath = `[${indexes[0]}]`;
|
|
88
|
+
if (indexes.length > 1) {
|
|
89
|
+
for (let i = 1; i < indexes.length; i++) {
|
|
90
|
+
resultPath += `.children[${indexes[i]}]`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return resultPath;
|
|
94
|
+
}
|
|
95
|
+
function modifyObjectByPath(blocks, arrayPath, modifyCallback) {
|
|
96
|
+
// [1]
|
|
97
|
+
// [4].children[3]
|
|
98
|
+
const insertPath = generateChildrenPathFromArray(arrayPath);
|
|
99
|
+
// path: '' index: 1
|
|
100
|
+
// path: '[4].children' index: 3
|
|
101
|
+
const splitPath = splitPathAndIndex(insertPath);
|
|
102
|
+
if (splitPath) {
|
|
103
|
+
const { path: parentPath, index } = splitPath;
|
|
104
|
+
// Get Array that lies on path
|
|
105
|
+
const parentArray = parentPath ? lodash_1.default.get(blocks, parentPath) : blocks;
|
|
106
|
+
const value = Array.isArray(parentArray) ? parentArray : [];
|
|
107
|
+
// Modify Array
|
|
108
|
+
const newModifiedArray = modifyCallback(value, index);
|
|
109
|
+
// Return it back
|
|
110
|
+
return insertByPath(blocks, parentPath, newModifiedArray);
|
|
111
|
+
}
|
|
112
|
+
return blocks;
|
|
113
|
+
}
|
|
114
|
+
function isItemsNeighbours(arrayA, arrayB) {
|
|
115
|
+
if (arrayA.length !== arrayB.length) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
for (let i = 0; i < arrayA.length - 1; i++) {
|
|
119
|
+
if (arrayA[i] !== arrayB[i]) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
function getDestinationShiftBeforeReorder(arrayInit, arrayDest) {
|
|
126
|
+
if (arrayInit.length === arrayDest.length || arrayInit.length > arrayDest.length) {
|
|
127
|
+
return arrayDest;
|
|
128
|
+
}
|
|
129
|
+
for (let i = 0; i < arrayInit.length; i++) {
|
|
130
|
+
if (arrayInit[i] < arrayDest[i]) {
|
|
131
|
+
return prepareShift(arrayInit, arrayDest);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return arrayDest;
|
|
135
|
+
}
|
|
136
|
+
function prepareShift(arrayInit, arrayDest) {
|
|
137
|
+
if (arrayInit.length === arrayDest.length || arrayInit.length > arrayDest.length) {
|
|
138
|
+
return arrayDest;
|
|
139
|
+
}
|
|
140
|
+
return arrayDest.map((pathIndex, index) => index === arrayInit.length - 1 ? pathIndex - 1 : pathIndex);
|
|
141
|
+
}
|
|
142
|
+
const getUrlOrigin = (url) => {
|
|
143
|
+
try {
|
|
144
|
+
const urlObject = new URL(url);
|
|
145
|
+
return urlObject.origin;
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
exports.getUrlOrigin = getUrlOrigin;
|
|
152
|
+
const getItemTitle = (item) => {
|
|
153
|
+
return (lodash_1.default.get(item, 'title.text') ||
|
|
154
|
+
lodash_1.default.get(item, 'title') ||
|
|
155
|
+
lodash_1.default.get(item, 'textContent.title') ||
|
|
156
|
+
lodash_1.default.get(item, 'content.title'));
|
|
157
|
+
};
|
|
158
|
+
exports.getItemTitle = getItemTitle;
|
|
159
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../src","sources":["editor-v2/utils/index.ts"],"names":[],"mappings":";;;AAIA,wBAEC;AAED,0CAEC;AAED,wCAMC;AAED,8CAeC;AAED,gDAGC;AAGD,oCAMC;AAQD,8CAgBC;AAKD,sEAcC;AAED,gDA0BC;AAED,8CAYC;AAED,4EAYC;AAED,oCAQC;;AA9JD,4DAAuB;AAIvB,SAAgB,MAAM,CAAI,GAAa,EAAE,KAAa,EAAE,OAAU;IAC9D,OAAO,CAAC,GAAG,G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AAC;AACrB,CAAC;AAED,SAAgB,YAAY,CAAC,SAAmB,EAAE,SAAmB;IACjE,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC;QAC/E,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,CACtC,KAAK,KAAK,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAC7D,CAAC;AACN,CAAC;AAEM,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,EAAE;IACxC,IAAI,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,OAAO,SAAS,CAAC,MAAM,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,SAAS,CAAC;IACrB,CAAC;AACL,CAAC,CAAC;AAPW,QAAA,YAAY,gBAOvB;AAEK,MAAM,YAAY,GAAG,CAAC,IAAY,EAAsB,EAAE;IAC7D,OAAO,CACH,gBAAC,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC;QACzB,gBAAC,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;QACpB,gBAAC,CAAC,GAAG,CAAC,IAAI,EAAE,mBAAmB,CAAC;QAChC,gBAAC,CAAC,GAAG,CAAC,IAAI,EAAE,eAAe,CAAC,CAC/B,CAAC;AACN,CAAC,CAAC;AAPW,QAAA,YAAY,gBAOvB","sourcesContent":["import _ from 'lodash';\n\nimport {ConstructorBlock} from '../../models';\n\nexport function insert<T>(arr: Array<T>, index: number, newItem: T) {\n return [...arr.slice(0, index), newItem, ...arr.slice(index)];\n}\n\nexport function removeFromArray<T>(array: Array<T>, index: number) {\n return [...array.slice(0, index), ...array.slice(index + 1)];\n}\n\nexport function swapArrayItems<T>(array: Array<T>, firstIndex: number, secondIndex: number) {\n const results = array.slice();\n const firstItem = array[firstIndex];\n results[firstIndex] = array[secondIndex];\n results[secondIndex] = firstItem;\n return results;\n}\n\nexport function reorderArrayItems<T>(array: Array<T>, index: number, destination: number) {\n const min = Math.min(index, destination);\n const max = Math.max(index, destination);\n const firstOperationRemove = index < destination;\n const result = [];\n result.push(...array.slice(0, min));\n if (!firstOperationRemove) {\n result.push(array[index]);\n }\n result.push(...array.slice(firstOperationRemove ? min + 1 : min, max));\n if (firstOperationRemove) {\n result.push(array[index]);\n }\n result.push(...array.slice(firstOperationRemove ? max : max + 1, array.length));\n return result;\n}\n\nexport function duplicateArrayItem<T>(array: Array<T>, index: number) {\n const duplicatedItem = _.cloneDeep(array[index]);\n return [...array.slice(0, index), duplicatedItem, ...array.slice(index)];\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function insertByPath<T extends object>(object: T, path: string, value: any) {\n if (!path) {\n return value as T;\n }\n\n return _.setWith(_.clone(object), path, value, _.clone);\n}\n\n/*\n * path: string;\n * Example:\n * 1. blocks[0] => {path: blocks, index: 0}\n * 2. blocks[2].children[10] => {path: blocks[2].children, index: 10}\n **/\nexport function splitPathAndIndex(path: string) {\n // Match blocks[3], blocks[0].children[12], blocks[0], blocks[999999]\n const bracketsRegExp = /(.*)\\[(\\d+)]$/g;\n const regexpMatches = [...path.matchAll(bracketsRegExp)];\n if (regexpMatches.length) {\n return {\n // blocks, blocks[0].children\n path: regexpMatches[0][1],\n // 3, 12, 0, 9999\n index: Number(regexpMatches[0][2]),\n };\n }\n\n // eslint-disable-next-line no-console\n console.error('Non correct path for splitting');\n return undefined;\n}\n\n/*\n * [0, 4, 3] => [0].children[4].children[3]\n * */\nexport function generateChildrenPathFromArray(indexes: number[]) {\n if (!indexes.length) {\n return '';\n }\n\n let resultPath = `[${indexes[0]}]`;\n\n if (indexes.length > 1) {\n for (let i = 1; i < indexes.length; i++) {\n resultPath += `.children[${indexes[i]}]`;\n }\n }\n\n return resultPath;\n}\n\nexport function modifyObjectByPath(\n blocks: ConstructorBlock[],\n arrayPath: number[],\n modifyCallback: (parentBlocks: ConstructorBlock[], index: number) => ConstructorBlock[],\n) {\n // [1]\n // [4].children[3]\n const insertPath = generateChildrenPathFromArray(arrayPath);\n // path: '' index: 1\n // path: '[4].children' index: 3\n const splitPath = splitPathAndIndex(insertPath);\n\n if (splitPath) {\n const {path: parentPath, index} = splitPath;\n // Get Array that lies on path\n const parentArray = parentPath ? _.get(blocks, parentPath) : blocks;\n\n const value = Array.isArray(parentArray) ? parentArray : [];\n // Modify Array\n const newModifiedArray = modifyCallback(value, index);\n\n // Return it back\n return insertByPath(blocks, parentPath, newModifiedArray);\n }\n\n return blocks;\n}\n\nexport function isItemsNeighbours(arrayA: number[], arrayB: number[]) {\n if (arrayA.length !== arrayB.length) {\n return false;\n }\n\n for (let i = 0; i < arrayA.length - 1; i++) {\n if (arrayA[i] !== arrayB[i]) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function getDestinationShiftBeforeReorder(arrayInit: number[], arrayDest: number[]) {\n if (arrayInit.length === arrayDest.length || arrayInit.length > arrayDest.length) {\n return arrayDest;\n }\n\n for (let i = 0; i < arrayInit.length; i++) {\n if (arrayInit[i] < arrayDest[i]) {\n return prepareShift(arrayInit, arrayDest);\n }\n }\n\n return arrayDest;\n}\n\nexport function prepareShift(arrayInit: number[], arrayDest: number[]) {\n if (arrayInit.length === arrayDest.length || arrayInit.length > arrayDest.length) {\n return arrayDest;\n }\n\n return arrayDest.map((pathIndex, index) =>\n index === arrayInit.length - 1 ? pathIndex - 1 : pathIndex,\n );\n}\n\nexport const getUrlOrigin = (url: string) => {\n try {\n const urlObject = new URL(url);\n return urlObject.origin;\n } catch {\n return undefined;\n }\n};\n\nexport const getItemTitle = (item: object): string | undefined => {\n return (\n _.get(item, 'title.text') ||\n _.get(item, 'title') ||\n _.get(item, 'textContent.title') ||\n _.get(item, 'content.title')\n );\n};\n"]}
|
|
@@ -2,7 +2,7 @@ declare const TestEditorBlockConfig: {
|
|
|
2
2
|
component: (props: import("./TestEditorBlock.js").TestEditorBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
schema: {
|
|
4
4
|
name: string;
|
|
5
|
-
inputs: (import("
|
|
5
|
+
inputs: (import("../../editor-v2/index.js").TextInput | import("../../editor-v2/index.js").BooleanInput | import("../../editor-v2/index.js").NumberInput | import("../../editor-v2/index.js").TextAreaInput | import("../../editor-v2/index.js").SelectSingleInput | import("../../editor-v2/index.js").SelectMultipleInput | import("../../editor-v2/index.js").ObjectInput | import("../../editor-v2/index.js").ArrayTextInput | import("../../editor-v2/index.js").ArrayObjectInput | import("../../editor-v2/index.js").OneOfInput)[];
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
8
|
export declare const TestEditorBlockSchema: {
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ConfigInput, DynamicFormValue } from "../../../../common/types/index.js";
|
|
2
|
+
import './DynamicForm.css';
|
|
3
|
+
interface DynamicFormProps {
|
|
4
|
+
blockConfig: Array<ConfigInput>;
|
|
5
|
+
contentConfig?: DynamicFormValue;
|
|
6
|
+
onUpdate: (key: string, value: DynamicFormValue) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const DynamicForm: ({ blockConfig, onUpdate, contentConfig }: DynamicFormProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default DynamicForm;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import _ from 'lodash';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { editorCn } from "../../utils/cn.js";
|
|
5
|
+
import './DynamicForm.css';
|
|
6
|
+
import ArrayDynamicField from "./Fields/Array/Array.js";
|
|
7
|
+
import BooleanDynamicField from "./Fields/Boolean/Boolean.js";
|
|
8
|
+
import NumberDynamicField from "./Fields/Number/Number.js";
|
|
9
|
+
import ObjectDynamicField from "./Fields/Object/Object.js";
|
|
10
|
+
import OneOfDynamicField from "./Fields/OneOf/OneOf.js";
|
|
11
|
+
import SelectDynamicField from "./Fields/Select/Select.js";
|
|
12
|
+
import TextDynamicField from "./Fields/Text/Text.js";
|
|
13
|
+
import TextAreaDynamicField from "./Fields/TextArea/TextArea.js";
|
|
14
|
+
import { getContent, getFullPath } from "./utils.js";
|
|
15
|
+
const b = editorCn('dynamic-form');
|
|
16
|
+
const DynamicForm = ({ blockConfig, onUpdate, contentConfig }) => {
|
|
17
|
+
const inputs = blockConfig;
|
|
18
|
+
const getData = React.useCallback((variable) => {
|
|
19
|
+
if (variable.startsWith('block.')) {
|
|
20
|
+
const purePath = variable.replace('block.', '');
|
|
21
|
+
return _.get(contentConfig, purePath);
|
|
22
|
+
}
|
|
23
|
+
if ((variable.startsWith(`'`) && variable.endsWith(`'`)) ||
|
|
24
|
+
(variable.startsWith(`"`) && variable.endsWith(`"`))) {
|
|
25
|
+
// @ts-ignore TODO: replaceAll types
|
|
26
|
+
return variable.replaceAll(`'`, '').replaceAll(`"`, '');
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}, [contentConfig]);
|
|
30
|
+
const decide = React.useCallback((showIf) => {
|
|
31
|
+
const parts = showIf.split(' ');
|
|
32
|
+
if (!(parts.length === 3)) {
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.log('Something bad happened in showIf, ignored');
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
const [firstVariable, equals, secondVariable] = parts;
|
|
38
|
+
const data1 = getData(firstVariable);
|
|
39
|
+
const data2 = getData(secondVariable);
|
|
40
|
+
if (equals === '===') {
|
|
41
|
+
return data1 === data2;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return data1 !== data2;
|
|
45
|
+
}
|
|
46
|
+
}, [getData]);
|
|
47
|
+
const renderInput = React.useCallback((input) => {
|
|
48
|
+
const fieldPath = input.name;
|
|
49
|
+
const fieldValue = getContent(contentConfig, input.name);
|
|
50
|
+
if (input.showIf) {
|
|
51
|
+
const decision = decide(input.showIf);
|
|
52
|
+
if (!decision) {
|
|
53
|
+
return _jsxs("div", { children: ["Hidden Field: ", input.name] });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Text, Select, Boolean and etc
|
|
57
|
+
const onSimpleDynamicFieldUpdate = (value) => {
|
|
58
|
+
onUpdate(fieldPath, value);
|
|
59
|
+
};
|
|
60
|
+
// Array and Objects
|
|
61
|
+
const onComplexDynamicFieldUpdate = (key, value) => {
|
|
62
|
+
onUpdate(getFullPath(fieldPath, key), value);
|
|
63
|
+
};
|
|
64
|
+
switch (input.type) {
|
|
65
|
+
case 'text': {
|
|
66
|
+
return (_jsx(TextDynamicField, { onRefresh: (value) => onUpdate(fieldPath, value), title: input.title, value: fieldValue, onUpdate: onSimpleDynamicFieldUpdate }));
|
|
67
|
+
}
|
|
68
|
+
case 'boolean': {
|
|
69
|
+
return (_jsx(BooleanDynamicField, { onRefresh: (value) => onUpdate(fieldPath, value), title: input.title, value: fieldValue, onUpdate: onSimpleDynamicFieldUpdate }));
|
|
70
|
+
}
|
|
71
|
+
case 'textarea': {
|
|
72
|
+
return (_jsx(TextAreaDynamicField, { onRefresh: (value) => onUpdate(fieldPath, value), title: input.title, value: fieldValue, onUpdate: onSimpleDynamicFieldUpdate }));
|
|
73
|
+
}
|
|
74
|
+
case 'select': {
|
|
75
|
+
return (_jsx(SelectDynamicField, { onRefresh: (value) => onUpdate(fieldPath, value), input: input, value: fieldValue, onUpdate: onSimpleDynamicFieldUpdate }));
|
|
76
|
+
}
|
|
77
|
+
case 'number': {
|
|
78
|
+
return (_jsx(NumberDynamicField, { onRefresh: (value) => onUpdate(fieldPath, value), title: input.title, value: fieldValue, onUpdate: onSimpleDynamicFieldUpdate }));
|
|
79
|
+
}
|
|
80
|
+
case 'object': {
|
|
81
|
+
if (!input || !('properties' in input)) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
return (_jsx(ObjectDynamicField, { onRefresh: (value) => onUpdate(fieldPath, value), blockConfig: input.properties, title: input.title, value: fieldValue, onUpdate: onComplexDynamicFieldUpdate }));
|
|
85
|
+
}
|
|
86
|
+
case 'array': {
|
|
87
|
+
return (_jsx(ArrayDynamicField, { blockConfig: input, title: input.title, values: fieldValue, onUpdate: onComplexDynamicFieldUpdate }));
|
|
88
|
+
}
|
|
89
|
+
case 'oneOf': {
|
|
90
|
+
if (!input || !('options' in input)) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return (_jsx(OneOfDynamicField, { inputConfig: input, contentConfig: contentConfig, onUpdate: onComplexDynamicFieldUpdate }));
|
|
94
|
+
}
|
|
95
|
+
default: {
|
|
96
|
+
return _jsxs("div", { children: ["Ignore ", JSON.stringify(input)] });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, [contentConfig, decide, onUpdate]);
|
|
100
|
+
const sortedInputs = inputs.sort((x, y) => {
|
|
101
|
+
const nestingFieldTypes = ['object', 'array', 'oneOf'];
|
|
102
|
+
if (nestingFieldTypes.includes(x.type)) {
|
|
103
|
+
return 1;
|
|
104
|
+
}
|
|
105
|
+
if (nestingFieldTypes.includes(y.type)) {
|
|
106
|
+
return -1;
|
|
107
|
+
}
|
|
108
|
+
return 0;
|
|
109
|
+
});
|
|
110
|
+
return (_jsx("div", { className: b(), children: sortedInputs.map((input, index) => (_jsx(React.Fragment, { children: renderInput(input) }, index))) }));
|
|
111
|
+
};
|
|
112
|
+
export default DynamicForm;
|
|
113
|
+
//# sourceMappingURL=DynamicForm.js.map
|