@formily-design/react 1.0.0
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/LICENSE.md +20 -0
- package/README.md +1 -0
- package/copy.ts +6 -0
- package/dist/designable.react.umd.production.css +1 -0
- package/dist/designable.react.umd.production.js +6 -0
- package/dist/designable.react.umd.production.min.css +1 -0
- package/dist/designable.react.umd.production.min.js +3769 -0
- package/esm/containers/Designer.d.ts +3 -0
- package/esm/containers/Designer.js +38 -0
- package/esm/containers/Layout.d.ts +3 -0
- package/esm/containers/Layout.js +32 -0
- package/esm/containers/Simulator.d.ts +3 -0
- package/esm/containers/Simulator.js +18 -0
- package/esm/containers/Viewport.d.ts +6 -0
- package/esm/containers/Viewport.js +49 -0
- package/esm/containers/Workbench.d.ts +4 -0
- package/esm/containers/Workbench.js +9 -0
- package/esm/containers/Workspace.d.ts +8 -0
- package/esm/containers/Workspace.js +26 -0
- package/esm/containers/index.d.ts +7 -0
- package/esm/containers/index.js +7 -0
- package/esm/containers/styles.less +19 -0
- package/esm/context.d.ts +7 -0
- package/esm/context.js +6 -0
- package/esm/hooks/index.d.ts +25 -0
- package/esm/hooks/index.js +25 -0
- package/esm/hooks/useComponents.d.ts +1 -0
- package/esm/hooks/useComponents.js +3 -0
- package/esm/hooks/useCursor.d.ts +1 -0
- package/esm/hooks/useCursor.js +5 -0
- package/esm/hooks/useDesigner.d.ts +5 -0
- package/esm/hooks/useDesigner.js +13 -0
- package/esm/hooks/useHistory.d.ts +1 -0
- package/esm/hooks/useHistory.js +5 -0
- package/esm/hooks/useHover.d.ts +1 -0
- package/esm/hooks/useHover.js +5 -0
- package/esm/hooks/useLayout.d.ts +2 -0
- package/esm/hooks/useLayout.js +7 -0
- package/esm/hooks/useMoveHelper.d.ts +1 -0
- package/esm/hooks/useMoveHelper.js +5 -0
- package/esm/hooks/useNodeIdProps.d.ts +4 -0
- package/esm/hooks/useNodeIdProps.js +9 -0
- package/esm/hooks/useOperation.d.ts +1 -0
- package/esm/hooks/useOperation.js +5 -0
- package/esm/hooks/useOutline.d.ts +1 -0
- package/esm/hooks/useOutline.js +5 -0
- package/esm/hooks/usePosition.d.ts +1 -0
- package/esm/hooks/usePosition.js +5 -0
- package/esm/hooks/usePrefix.d.ts +1 -0
- package/esm/hooks/usePrefix.js +5 -0
- package/esm/hooks/useRegistry.d.ts +2 -0
- package/esm/hooks/useRegistry.js +5 -0
- package/esm/hooks/useScreen.d.ts +1 -0
- package/esm/hooks/useScreen.js +4 -0
- package/esm/hooks/useSelected.d.ts +1 -0
- package/esm/hooks/useSelected.js +5 -0
- package/esm/hooks/useSelectedNode.d.ts +6 -0
- package/esm/hooks/useSelectedNode.js +13 -0
- package/esm/hooks/useSelection.d.ts +1 -0
- package/esm/hooks/useSelection.js +5 -0
- package/esm/hooks/useTheme.d.ts +1 -0
- package/esm/hooks/useTheme.js +5 -0
- package/esm/hooks/useTransformHelper.d.ts +1 -0
- package/esm/hooks/useTransformHelper.js +5 -0
- package/esm/hooks/useTree.d.ts +1 -0
- package/esm/hooks/useTree.js +5 -0
- package/esm/hooks/useTreeNode.d.ts +1 -0
- package/esm/hooks/useTreeNode.js +5 -0
- package/esm/hooks/useValidNodeOffsetRect.d.ts +2 -0
- package/esm/hooks/useValidNodeOffsetRect.js +37 -0
- package/esm/hooks/useViewport.d.ts +1 -0
- package/esm/hooks/useViewport.js +5 -0
- package/esm/hooks/useWorkbench.d.ts +1 -0
- package/esm/hooks/useWorkbench.js +5 -0
- package/esm/hooks/useWorkspace.d.ts +2 -0
- package/esm/hooks/useWorkspace.js +15 -0
- package/esm/icons/actions.d.ts +7 -0
- package/esm/icons/actions.js +28 -0
- package/esm/icons/add.d.ts +2 -0
- package/esm/icons/add.js +4 -0
- package/esm/icons/animations.d.ts +24 -0
- package/esm/icons/animations.js +323 -0
- package/esm/icons/boolean.d.ts +2 -0
- package/esm/icons/boolean.js +3 -0
- package/esm/icons/clone.d.ts +3 -0
- package/esm/icons/clone.js +3 -0
- package/esm/icons/close.d.ts +2 -0
- package/esm/icons/close.js +3 -0
- package/esm/icons/code.d.ts +2 -0
- package/esm/icons/code.js +2 -0
- package/esm/icons/command.d.ts +2 -0
- package/esm/icons/command.js +4 -0
- package/esm/icons/component.d.ts +2 -0
- package/esm/icons/component.js +2 -0
- package/esm/icons/container.d.ts +2 -0
- package/esm/icons/container.js +4 -0
- package/esm/icons/corner.d.ts +5 -0
- package/esm/icons/corner.js +5 -0
- package/esm/icons/delete.d.ts +2 -0
- package/esm/icons/delete.js +5 -0
- package/esm/icons/design.d.ts +2 -0
- package/esm/icons/design.js +3 -0
- package/esm/icons/display.d.ts +5 -0
- package/esm/icons/display.js +5 -0
- package/esm/icons/dragmove.d.ts +2 -0
- package/esm/icons/dragmove.js +3 -0
- package/esm/icons/expand.d.ts +2 -0
- package/esm/icons/expand.js +2 -0
- package/esm/icons/expression.d.ts +2 -0
- package/esm/icons/expression.js +2 -0
- package/esm/icons/eyes.d.ts +3 -0
- package/esm/icons/eyes.js +7 -0
- package/esm/icons/flex.d.ts +22 -0
- package/esm/icons/flex.js +22 -0
- package/esm/icons/flip.d.ts +2 -0
- package/esm/icons/flip.js +2 -0
- package/esm/icons/focus.d.ts +2 -0
- package/esm/icons/focus.js +2 -0
- package/esm/icons/font.d.ts +16 -0
- package/esm/icons/font.js +16 -0
- package/esm/icons/formula.d.ts +2 -0
- package/esm/icons/formula.js +2 -0
- package/esm/icons/freemove.d.ts +2 -0
- package/esm/icons/freemove.js +3 -0
- package/esm/icons/help.d.ts +2 -0
- package/esm/icons/help.js +4 -0
- package/esm/icons/hidden.d.ts +2 -0
- package/esm/icons/hidden.js +2 -0
- package/esm/icons/history.d.ts +2 -0
- package/esm/icons/history.js +3 -0
- package/esm/icons/image.d.ts +3 -0
- package/esm/icons/image.js +3 -0
- package/esm/icons/index.d.ts +53 -0
- package/esm/icons/index.js +53 -0
- package/esm/icons/json.d.ts +2 -0
- package/esm/icons/json.js +2 -0
- package/esm/icons/logo.d.ts +4 -0
- package/esm/icons/logo.js +4 -0
- package/esm/icons/menu.d.ts +2 -0
- package/esm/icons/menu.js +3 -0
- package/esm/icons/mobile.d.ts +2 -0
- package/esm/icons/mobile.js +4 -0
- package/esm/icons/move.d.ts +2 -0
- package/esm/icons/move.js +2 -0
- package/esm/icons/number.d.ts +2 -0
- package/esm/icons/number.js +3 -0
- package/esm/icons/outline.d.ts +2 -0
- package/esm/icons/outline.js +2 -0
- package/esm/icons/page.d.ts +2 -0
- package/esm/icons/page.js +5 -0
- package/esm/icons/pc.d.ts +2 -0
- package/esm/icons/pc.js +3 -0
- package/esm/icons/play.d.ts +2 -0
- package/esm/icons/play.js +2 -0
- package/esm/icons/position.d.ts +6 -0
- package/esm/icons/position.js +6 -0
- package/esm/icons/pushpin.d.ts +3 -0
- package/esm/icons/pushpin.js +5 -0
- package/esm/icons/recover.d.ts +2 -0
- package/esm/icons/recover.js +2 -0
- package/esm/icons/redo.d.ts +2 -0
- package/esm/icons/redo.js +2 -0
- package/esm/icons/remove.d.ts +2 -0
- package/esm/icons/remove.js +2 -0
- package/esm/icons/responsive.d.ts +2 -0
- package/esm/icons/responsive.js +5 -0
- package/esm/icons/return.d.ts +2 -0
- package/esm/icons/return.js +2 -0
- package/esm/icons/selection.d.ts +2 -0
- package/esm/icons/selection.js +2 -0
- package/esm/icons/setting.d.ts +2 -0
- package/esm/icons/setting.js +2 -0
- package/esm/icons/shadow.d.ts +5 -0
- package/esm/icons/shadow.js +5 -0
- package/esm/icons/shift.d.ts +2 -0
- package/esm/icons/shift.js +2 -0
- package/esm/icons/sources.d.ts +75 -0
- package/esm/icons/sources.js +544 -0
- package/esm/icons/text.d.ts +3 -0
- package/esm/icons/text.js +5 -0
- package/esm/icons/undo.d.ts +2 -0
- package/esm/icons/undo.js +3 -0
- package/esm/icons/upload.d.ts +2 -0
- package/esm/icons/upload.js +4 -0
- package/esm/index.d.ts +9 -0
- package/esm/index.js +9 -0
- package/esm/locales/global.d.ts +17 -0
- package/esm/locales/global.js +16 -0
- package/esm/locales/icons.d.ts +133 -0
- package/esm/locales/icons.js +132 -0
- package/esm/locales/index.d.ts +1 -0
- package/esm/locales/index.js +6 -0
- package/esm/locales/operations.d.ts +51 -0
- package/esm/locales/operations.js +50 -0
- package/esm/locales/panels.d.ts +27 -0
- package/esm/locales/panels.js +26 -0
- package/esm/panels/CompositePanel.d.ts +24 -0
- package/esm/panels/CompositePanel.js +112 -0
- package/esm/panels/SettingsPanel.d.ts +7 -0
- package/esm/panels/SettingsPanel.js +53 -0
- package/esm/panels/StudioPanel.d.ts +13 -0
- package/esm/panels/StudioPanel.js +21 -0
- package/esm/panels/ToolbarPanel.d.ts +3 -0
- package/esm/panels/ToolbarPanel.js +11 -0
- package/esm/panels/ViewPanel.d.ts +9 -0
- package/esm/panels/ViewPanel.js +41 -0
- package/esm/panels/ViewportPanel.d.ts +3 -0
- package/esm/panels/ViewportPanel.js +7 -0
- package/esm/panels/WorkspacePanel.d.ts +11 -0
- package/esm/panels/WorkspacePanel.js +14 -0
- package/esm/panels/index.d.ts +8 -0
- package/esm/panels/index.js +8 -0
- package/esm/panels/styles.less +331 -0
- package/esm/simulators/MobileSimulator/body.d.ts +4 -0
- package/esm/simulators/MobileSimulator/body.js +57 -0
- package/esm/simulators/MobileSimulator/index.d.ts +7 -0
- package/esm/simulators/MobileSimulator/index.js +11 -0
- package/esm/simulators/MobileSimulator/styles.less +29 -0
- package/esm/simulators/PCSimulator/index.d.ts +7 -0
- package/esm/simulators/PCSimulator/index.js +8 -0
- package/esm/simulators/PCSimulator/styles.less +11 -0
- package/esm/simulators/ResponsiveSimulator/handle.d.ts +11 -0
- package/esm/simulators/ResponsiveSimulator/handle.js +16 -0
- package/esm/simulators/ResponsiveSimulator/index.d.ts +7 -0
- package/esm/simulators/ResponsiveSimulator/index.js +152 -0
- package/esm/simulators/ResponsiveSimulator/styles.less +56 -0
- package/esm/simulators/index.d.ts +3 -0
- package/esm/simulators/index.js +3 -0
- package/esm/theme.less +224 -0
- package/esm/types.d.ts +35 -0
- package/esm/types.js +1 -0
- package/esm/variables.less +1 -0
- package/esm/widgets/AuxToolWidget/Copy.d.ts +7 -0
- package/esm/widgets/AuxToolWidget/Copy.js +15 -0
- package/esm/widgets/AuxToolWidget/Cover.d.ts +2 -0
- package/esm/widgets/AuxToolWidget/Cover.js +52 -0
- package/esm/widgets/AuxToolWidget/DashedBox.d.ts +2 -0
- package/esm/widgets/AuxToolWidget/DashedBox.js +43 -0
- package/esm/widgets/AuxToolWidget/Delete.d.ts +7 -0
- package/esm/widgets/AuxToolWidget/Delete.js +15 -0
- package/esm/widgets/AuxToolWidget/DragHandler.d.ts +7 -0
- package/esm/widgets/AuxToolWidget/DragHandler.js +17 -0
- package/esm/widgets/AuxToolWidget/FreeSelection.d.ts +2 -0
- package/esm/widgets/AuxToolWidget/FreeSelection.js +43 -0
- package/esm/widgets/AuxToolWidget/Helpers.d.ts +15 -0
- package/esm/widgets/AuxToolWidget/Helpers.js +82 -0
- package/esm/widgets/AuxToolWidget/Insertion.d.ts +2 -0
- package/esm/widgets/AuxToolWidget/Insertion.js +70 -0
- package/esm/widgets/AuxToolWidget/ResizeHandler.d.ts +6 -0
- package/esm/widgets/AuxToolWidget/ResizeHandler.js +27 -0
- package/esm/widgets/AuxToolWidget/Selection.d.ts +8 -0
- package/esm/widgets/AuxToolWidget/Selection.js +57 -0
- package/esm/widgets/AuxToolWidget/Selector.d.ts +7 -0
- package/esm/widgets/AuxToolWidget/Selector.js +84 -0
- package/esm/widgets/AuxToolWidget/SnapLine.d.ts +2 -0
- package/esm/widgets/AuxToolWidget/SnapLine.js +30 -0
- package/esm/widgets/AuxToolWidget/SpaceBlock.d.ts +2 -0
- package/esm/widgets/AuxToolWidget/SpaceBlock.js +66 -0
- package/esm/widgets/AuxToolWidget/TranslateHandler.d.ts +6 -0
- package/esm/widgets/AuxToolWidget/TranslateHandler.js +20 -0
- package/esm/widgets/AuxToolWidget/index.d.ts +6 -0
- package/esm/widgets/AuxToolWidget/index.js +34 -0
- package/esm/widgets/AuxToolWidget/styles.less +383 -0
- package/esm/widgets/ComponentTreeWidget/index.d.ts +15 -0
- package/esm/widgets/ComponentTreeWidget/index.js +73 -0
- package/esm/widgets/ComponentTreeWidget/styles.less +6 -0
- package/esm/widgets/DesignerToolsWidget/index.d.ts +10 -0
- package/esm/widgets/DesignerToolsWidget/index.js +109 -0
- package/esm/widgets/DesignerToolsWidget/styles.less +29 -0
- package/esm/widgets/DroppableWidget/index.d.ts +15 -0
- package/esm/widgets/DroppableWidget/index.js +20 -0
- package/esm/widgets/DroppableWidget/styles.less +11 -0
- package/esm/widgets/EmptyWidget/index.d.ts +7 -0
- package/esm/widgets/EmptyWidget/index.js +46 -0
- package/esm/widgets/EmptyWidget/styles.less +27 -0
- package/esm/widgets/GhostWidget/index.d.ts +3 -0
- package/esm/widgets/GhostWidget/index.js +33 -0
- package/esm/widgets/GhostWidget/styles.less +20 -0
- package/esm/widgets/HistoryWidget/index.d.ts +3 -0
- package/esm/widgets/HistoryWidget/index.js +28 -0
- package/esm/widgets/HistoryWidget/styles.less +23 -0
- package/esm/widgets/IconWidget/index.d.ts +23 -0
- package/esm/widgets/IconWidget/index.js +102 -0
- package/esm/widgets/IconWidget/styles.less +17 -0
- package/esm/widgets/NodeActionsWidget/index.d.ts +18 -0
- package/esm/widgets/NodeActionsWidget/index.js +25 -0
- package/esm/widgets/NodeActionsWidget/styles.less +51 -0
- package/esm/widgets/NodePathWidget/index.d.ts +7 -0
- package/esm/widgets/NodePathWidget/index.js +36 -0
- package/esm/widgets/NodePathWidget/styles.less +16 -0
- package/esm/widgets/NodeTitleWidget/index.d.ts +6 -0
- package/esm/widgets/NodeTitleWidget/index.js +13 -0
- package/esm/widgets/OutlineWidget/Insertion.d.ts +5 -0
- package/esm/widgets/OutlineWidget/Insertion.js +51 -0
- package/esm/widgets/OutlineWidget/OutlineNode.d.ts +10 -0
- package/esm/widgets/OutlineWidget/OutlineNode.js +139 -0
- package/esm/widgets/OutlineWidget/context.d.ts +8 -0
- package/esm/widgets/OutlineWidget/context.js +2 -0
- package/esm/widgets/OutlineWidget/index.d.ts +10 -0
- package/esm/widgets/OutlineWidget/index.js +42 -0
- package/esm/widgets/OutlineWidget/styles.less +195 -0
- package/esm/widgets/ResourceWidget/index.d.ts +12 -0
- package/esm/widgets/ResourceWidget/index.js +53 -0
- package/esm/widgets/ResourceWidget/styles.less +87 -0
- package/esm/widgets/TextWidget/index.d.ts +10 -0
- package/esm/widgets/TextWidget/index.js +32 -0
- package/esm/widgets/ViewToolsWidget/index.d.ts +8 -0
- package/esm/widgets/ViewToolsWidget/index.js +30 -0
- package/esm/widgets/index.d.ts +15 -0
- package/esm/widgets/index.js +15 -0
- package/lib/containers/Designer.d.ts +3 -0
- package/lib/containers/Designer.js +75 -0
- package/lib/containers/Layout.d.ts +3 -0
- package/lib/containers/Layout.js +72 -0
- package/lib/containers/Simulator.d.ts +3 -0
- package/lib/containers/Simulator.js +24 -0
- package/lib/containers/Viewport.d.ts +6 -0
- package/lib/containers/Viewport.js +89 -0
- package/lib/containers/Workbench.d.ts +4 -0
- package/lib/containers/Workbench.js +15 -0
- package/lib/containers/Workspace.d.ts +8 -0
- package/lib/containers/Workspace.js +63 -0
- package/lib/containers/index.d.ts +7 -0
- package/lib/containers/index.js +23 -0
- package/lib/containers/styles.less +19 -0
- package/lib/context.d.ts +7 -0
- package/lib/context.js +9 -0
- package/lib/hooks/index.d.ts +25 -0
- package/lib/hooks/index.js +41 -0
- package/lib/hooks/useComponents.d.ts +1 -0
- package/lib/hooks/useComponents.js +7 -0
- package/lib/hooks/useCursor.d.ts +1 -0
- package/lib/hooks/useCursor.js +9 -0
- package/lib/hooks/useDesigner.d.ts +5 -0
- package/lib/hooks/useDesigner.js +17 -0
- package/lib/hooks/useHistory.d.ts +1 -0
- package/lib/hooks/useHistory.js +9 -0
- package/lib/hooks/useHover.d.ts +1 -0
- package/lib/hooks/useHover.js +9 -0
- package/lib/hooks/useLayout.d.ts +2 -0
- package/lib/hooks/useLayout.js +11 -0
- package/lib/hooks/useMoveHelper.d.ts +1 -0
- package/lib/hooks/useMoveHelper.js +9 -0
- package/lib/hooks/useNodeIdProps.d.ts +4 -0
- package/lib/hooks/useNodeIdProps.js +13 -0
- package/lib/hooks/useOperation.d.ts +1 -0
- package/lib/hooks/useOperation.js +9 -0
- package/lib/hooks/useOutline.d.ts +1 -0
- package/lib/hooks/useOutline.js +9 -0
- package/lib/hooks/usePosition.d.ts +1 -0
- package/lib/hooks/usePosition.js +9 -0
- package/lib/hooks/usePrefix.d.ts +1 -0
- package/lib/hooks/usePrefix.js +9 -0
- package/lib/hooks/useRegistry.d.ts +2 -0
- package/lib/hooks/useRegistry.js +9 -0
- package/lib/hooks/useScreen.d.ts +1 -0
- package/lib/hooks/useScreen.js +8 -0
- package/lib/hooks/useSelected.d.ts +1 -0
- package/lib/hooks/useSelected.js +9 -0
- package/lib/hooks/useSelectedNode.d.ts +6 -0
- package/lib/hooks/useSelectedNode.js +17 -0
- package/lib/hooks/useSelection.d.ts +1 -0
- package/lib/hooks/useSelection.js +9 -0
- package/lib/hooks/useTheme.d.ts +1 -0
- package/lib/hooks/useTheme.js +9 -0
- package/lib/hooks/useTransformHelper.d.ts +1 -0
- package/lib/hooks/useTransformHelper.js +9 -0
- package/lib/hooks/useTree.d.ts +1 -0
- package/lib/hooks/useTree.js +9 -0
- package/lib/hooks/useTreeNode.d.ts +1 -0
- package/lib/hooks/useTreeNode.js +9 -0
- package/lib/hooks/useValidNodeOffsetRect.d.ts +2 -0
- package/lib/hooks/useValidNodeOffsetRect.js +41 -0
- package/lib/hooks/useViewport.d.ts +1 -0
- package/lib/hooks/useViewport.js +9 -0
- package/lib/hooks/useWorkbench.d.ts +1 -0
- package/lib/hooks/useWorkbench.js +9 -0
- package/lib/hooks/useWorkspace.d.ts +2 -0
- package/lib/hooks/useWorkspace.js +19 -0
- package/lib/icons/actions.d.ts +7 -0
- package/lib/icons/actions.js +34 -0
- package/lib/icons/add.d.ts +2 -0
- package/lib/icons/add.js +10 -0
- package/lib/icons/animations.d.ts +24 -0
- package/lib/icons/animations.js +326 -0
- package/lib/icons/boolean.d.ts +2 -0
- package/lib/icons/boolean.js +9 -0
- package/lib/icons/clone.d.ts +3 -0
- package/lib/icons/clone.js +9 -0
- package/lib/icons/close.d.ts +2 -0
- package/lib/icons/close.js +9 -0
- package/lib/icons/code.d.ts +2 -0
- package/lib/icons/code.js +8 -0
- package/lib/icons/command.d.ts +2 -0
- package/lib/icons/command.js +10 -0
- package/lib/icons/component.d.ts +2 -0
- package/lib/icons/component.js +8 -0
- package/lib/icons/container.d.ts +2 -0
- package/lib/icons/container.js +10 -0
- package/lib/icons/corner.d.ts +5 -0
- package/lib/icons/corner.js +11 -0
- package/lib/icons/delete.d.ts +2 -0
- package/lib/icons/delete.js +11 -0
- package/lib/icons/design.d.ts +2 -0
- package/lib/icons/design.js +9 -0
- package/lib/icons/display.d.ts +5 -0
- package/lib/icons/display.js +11 -0
- package/lib/icons/dragmove.d.ts +2 -0
- package/lib/icons/dragmove.js +9 -0
- package/lib/icons/expand.d.ts +2 -0
- package/lib/icons/expand.js +8 -0
- package/lib/icons/expression.d.ts +2 -0
- package/lib/icons/expression.js +8 -0
- package/lib/icons/eyes.d.ts +3 -0
- package/lib/icons/eyes.js +13 -0
- package/lib/icons/flex.d.ts +22 -0
- package/lib/icons/flex.js +28 -0
- package/lib/icons/flip.d.ts +2 -0
- package/lib/icons/flip.js +8 -0
- package/lib/icons/focus.d.ts +2 -0
- package/lib/icons/focus.js +8 -0
- package/lib/icons/font.d.ts +16 -0
- package/lib/icons/font.js +22 -0
- package/lib/icons/formula.d.ts +2 -0
- package/lib/icons/formula.js +8 -0
- package/lib/icons/freemove.d.ts +2 -0
- package/lib/icons/freemove.js +9 -0
- package/lib/icons/help.d.ts +2 -0
- package/lib/icons/help.js +10 -0
- package/lib/icons/hidden.d.ts +2 -0
- package/lib/icons/hidden.js +8 -0
- package/lib/icons/history.d.ts +2 -0
- package/lib/icons/history.js +9 -0
- package/lib/icons/image.d.ts +3 -0
- package/lib/icons/image.js +9 -0
- package/lib/icons/index.d.ts +53 -0
- package/lib/icons/index.js +69 -0
- package/lib/icons/json.d.ts +2 -0
- package/lib/icons/json.js +8 -0
- package/lib/icons/logo.d.ts +4 -0
- package/lib/icons/logo.js +7 -0
- package/lib/icons/menu.d.ts +2 -0
- package/lib/icons/menu.js +9 -0
- package/lib/icons/mobile.d.ts +2 -0
- package/lib/icons/mobile.js +10 -0
- package/lib/icons/move.d.ts +2 -0
- package/lib/icons/move.js +8 -0
- package/lib/icons/number.d.ts +2 -0
- package/lib/icons/number.js +9 -0
- package/lib/icons/outline.d.ts +2 -0
- package/lib/icons/outline.js +8 -0
- package/lib/icons/page.d.ts +2 -0
- package/lib/icons/page.js +11 -0
- package/lib/icons/pc.d.ts +2 -0
- package/lib/icons/pc.js +9 -0
- package/lib/icons/play.d.ts +2 -0
- package/lib/icons/play.js +8 -0
- package/lib/icons/position.d.ts +6 -0
- package/lib/icons/position.js +12 -0
- package/lib/icons/pushpin.d.ts +3 -0
- package/lib/icons/pushpin.js +11 -0
- package/lib/icons/recover.d.ts +2 -0
- package/lib/icons/recover.js +8 -0
- package/lib/icons/redo.d.ts +2 -0
- package/lib/icons/redo.js +8 -0
- package/lib/icons/remove.d.ts +2 -0
- package/lib/icons/remove.js +8 -0
- package/lib/icons/responsive.d.ts +2 -0
- package/lib/icons/responsive.js +11 -0
- package/lib/icons/return.d.ts +2 -0
- package/lib/icons/return.js +8 -0
- package/lib/icons/selection.d.ts +2 -0
- package/lib/icons/selection.js +8 -0
- package/lib/icons/setting.d.ts +2 -0
- package/lib/icons/setting.js +8 -0
- package/lib/icons/shadow.d.ts +5 -0
- package/lib/icons/shadow.js +11 -0
- package/lib/icons/shift.d.ts +2 -0
- package/lib/icons/shift.js +8 -0
- package/lib/icons/sources.d.ts +75 -0
- package/lib/icons/sources.js +551 -0
- package/lib/icons/text.d.ts +3 -0
- package/lib/icons/text.js +11 -0
- package/lib/icons/undo.d.ts +2 -0
- package/lib/icons/undo.js +9 -0
- package/lib/icons/upload.d.ts +2 -0
- package/lib/icons/upload.js +10 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +25 -0
- package/lib/locales/global.d.ts +17 -0
- package/lib/locales/global.js +18 -0
- package/lib/locales/icons.d.ts +133 -0
- package/lib/locales/icons.js +134 -0
- package/lib/locales/index.d.ts +1 -0
- package/lib/locales/index.js +11 -0
- package/lib/locales/operations.d.ts +51 -0
- package/lib/locales/operations.js +52 -0
- package/lib/locales/panels.d.ts +27 -0
- package/lib/locales/panels.js +28 -0
- package/lib/panels/CompositePanel.d.ts +24 -0
- package/lib/panels/CompositePanel.js +152 -0
- package/lib/panels/SettingsPanel.d.ts +7 -0
- package/lib/panels/SettingsPanel.js +92 -0
- package/lib/panels/StudioPanel.d.ts +13 -0
- package/lib/panels/StudioPanel.js +28 -0
- package/lib/panels/ToolbarPanel.d.ts +3 -0
- package/lib/panels/ToolbarPanel.js +18 -0
- package/lib/panels/ViewPanel.d.ts +9 -0
- package/lib/panels/ViewPanel.js +77 -0
- package/lib/panels/ViewportPanel.d.ts +3 -0
- package/lib/panels/ViewportPanel.js +14 -0
- package/lib/panels/WorkspacePanel.d.ts +11 -0
- package/lib/panels/WorkspacePanel.js +21 -0
- package/lib/panels/index.d.ts +8 -0
- package/lib/panels/index.js +24 -0
- package/lib/panels/styles.less +331 -0
- package/lib/simulators/MobileSimulator/body.d.ts +4 -0
- package/lib/simulators/MobileSimulator/body.js +63 -0
- package/lib/simulators/MobileSimulator/index.d.ts +7 -0
- package/lib/simulators/MobileSimulator/index.js +18 -0
- package/lib/simulators/MobileSimulator/styles.less +29 -0
- package/lib/simulators/PCSimulator/index.d.ts +7 -0
- package/lib/simulators/PCSimulator/index.js +15 -0
- package/lib/simulators/PCSimulator/styles.less +11 -0
- package/lib/simulators/ResponsiveSimulator/handle.d.ts +11 -0
- package/lib/simulators/ResponsiveSimulator/handle.js +23 -0
- package/lib/simulators/ResponsiveSimulator/index.d.ts +7 -0
- package/lib/simulators/ResponsiveSimulator/index.js +191 -0
- package/lib/simulators/ResponsiveSimulator/styles.less +56 -0
- package/lib/simulators/index.d.ts +3 -0
- package/lib/simulators/index.js +19 -0
- package/lib/theme.less +224 -0
- package/lib/types.d.ts +35 -0
- package/lib/types.js +2 -0
- package/lib/variables.less +1 -0
- package/lib/widgets/AuxToolWidget/Copy.d.ts +7 -0
- package/lib/widgets/AuxToolWidget/Copy.js +22 -0
- package/lib/widgets/AuxToolWidget/Cover.d.ts +2 -0
- package/lib/widgets/AuxToolWidget/Cover.js +91 -0
- package/lib/widgets/AuxToolWidget/DashedBox.d.ts +2 -0
- package/lib/widgets/AuxToolWidget/DashedBox.js +49 -0
- package/lib/widgets/AuxToolWidget/Delete.d.ts +7 -0
- package/lib/widgets/AuxToolWidget/Delete.js +22 -0
- package/lib/widgets/AuxToolWidget/DragHandler.d.ts +7 -0
- package/lib/widgets/AuxToolWidget/DragHandler.js +23 -0
- package/lib/widgets/AuxToolWidget/FreeSelection.d.ts +2 -0
- package/lib/widgets/AuxToolWidget/FreeSelection.js +49 -0
- package/lib/widgets/AuxToolWidget/Helpers.d.ts +15 -0
- package/lib/widgets/AuxToolWidget/Helpers.js +122 -0
- package/lib/widgets/AuxToolWidget/Insertion.d.ts +2 -0
- package/lib/widgets/AuxToolWidget/Insertion.js +76 -0
- package/lib/widgets/AuxToolWidget/ResizeHandler.d.ts +6 -0
- package/lib/widgets/AuxToolWidget/ResizeHandler.js +34 -0
- package/lib/widgets/AuxToolWidget/Selection.d.ts +8 -0
- package/lib/widgets/AuxToolWidget/Selection.js +94 -0
- package/lib/widgets/AuxToolWidget/Selector.d.ts +7 -0
- package/lib/widgets/AuxToolWidget/Selector.js +120 -0
- package/lib/widgets/AuxToolWidget/SnapLine.d.ts +2 -0
- package/lib/widgets/AuxToolWidget/SnapLine.js +36 -0
- package/lib/widgets/AuxToolWidget/SpaceBlock.d.ts +2 -0
- package/lib/widgets/AuxToolWidget/SpaceBlock.js +102 -0
- package/lib/widgets/AuxToolWidget/TranslateHandler.d.ts +6 -0
- package/lib/widgets/AuxToolWidget/TranslateHandler.js +27 -0
- package/lib/widgets/AuxToolWidget/index.d.ts +6 -0
- package/lib/widgets/AuxToolWidget/index.js +71 -0
- package/lib/widgets/AuxToolWidget/styles.less +383 -0
- package/lib/widgets/ComponentTreeWidget/index.d.ts +15 -0
- package/lib/widgets/ComponentTreeWidget/index.js +112 -0
- package/lib/widgets/ComponentTreeWidget/styles.less +6 -0
- package/lib/widgets/DesignerToolsWidget/index.d.ts +10 -0
- package/lib/widgets/DesignerToolsWidget/index.js +148 -0
- package/lib/widgets/DesignerToolsWidget/styles.less +29 -0
- package/lib/widgets/DroppableWidget/index.d.ts +15 -0
- package/lib/widgets/DroppableWidget/index.js +26 -0
- package/lib/widgets/DroppableWidget/styles.less +11 -0
- package/lib/widgets/EmptyWidget/index.d.ts +7 -0
- package/lib/widgets/EmptyWidget/index.js +52 -0
- package/lib/widgets/EmptyWidget/styles.less +27 -0
- package/lib/widgets/GhostWidget/index.d.ts +3 -0
- package/lib/widgets/GhostWidget/index.js +69 -0
- package/lib/widgets/GhostWidget/styles.less +20 -0
- package/lib/widgets/HistoryWidget/index.d.ts +3 -0
- package/lib/widgets/HistoryWidget/index.js +34 -0
- package/lib/widgets/HistoryWidget/styles.less +23 -0
- package/lib/widgets/IconWidget/index.d.ts +23 -0
- package/lib/widgets/IconWidget/index.js +141 -0
- package/lib/widgets/IconWidget/styles.less +17 -0
- package/lib/widgets/NodeActionsWidget/index.d.ts +18 -0
- package/lib/widgets/NodeActionsWidget/index.js +31 -0
- package/lib/widgets/NodeActionsWidget/styles.less +51 -0
- package/lib/widgets/NodePathWidget/index.d.ts +7 -0
- package/lib/widgets/NodePathWidget/index.js +42 -0
- package/lib/widgets/NodePathWidget/styles.less +16 -0
- package/lib/widgets/NodeTitleWidget/index.d.ts +6 -0
- package/lib/widgets/NodeTitleWidget/index.js +49 -0
- package/lib/widgets/OutlineWidget/Insertion.d.ts +5 -0
- package/lib/widgets/OutlineWidget/Insertion.js +57 -0
- package/lib/widgets/OutlineWidget/OutlineNode.d.ts +10 -0
- package/lib/widgets/OutlineWidget/OutlineNode.js +178 -0
- package/lib/widgets/OutlineWidget/context.d.ts +8 -0
- package/lib/widgets/OutlineWidget/context.js +5 -0
- package/lib/widgets/OutlineWidget/index.d.ts +10 -0
- package/lib/widgets/OutlineWidget/index.js +81 -0
- package/lib/widgets/OutlineWidget/styles.less +195 -0
- package/lib/widgets/ResourceWidget/index.d.ts +12 -0
- package/lib/widgets/ResourceWidget/index.js +92 -0
- package/lib/widgets/ResourceWidget/styles.less +87 -0
- package/lib/widgets/TextWidget/index.d.ts +10 -0
- package/lib/widgets/TextWidget/index.js +68 -0
- package/lib/widgets/ViewToolsWidget/index.d.ts +8 -0
- package/lib/widgets/ViewToolsWidget/index.js +36 -0
- package/lib/widgets/index.d.ts +15 -0
- package/lib/widgets/index.js +31 -0
- package/package.json +45 -0
- package/rollup.config.js +3 -0
- package/src/containers/Designer.tsx +50 -0
- package/src/containers/Layout.tsx +50 -0
- package/src/containers/Simulator.tsx +30 -0
- package/src/containers/Viewport.tsx +69 -0
- package/src/containers/Workbench.tsx +15 -0
- package/src/containers/Workspace.tsx +41 -0
- package/src/containers/index.ts +7 -0
- package/src/containers/styles.less +19 -0
- package/src/context.ts +17 -0
- package/src/hooks/index.ts +25 -0
- package/src/hooks/useComponents.ts +3 -0
- package/src/hooks/useCursor.ts +6 -0
- package/src/hooks/useDesigner.ts +19 -0
- package/src/hooks/useHistory.ts +6 -0
- package/src/hooks/useHover.ts +6 -0
- package/src/hooks/useLayout.ts +11 -0
- package/src/hooks/useMoveHelper.ts +6 -0
- package/src/hooks/useNodeIdProps.ts +11 -0
- package/src/hooks/useOperation.ts +6 -0
- package/src/hooks/useOutline.ts +6 -0
- package/src/hooks/usePosition.ts +5 -0
- package/src/hooks/usePrefix.ts +5 -0
- package/src/hooks/useRegistry.ts +6 -0
- package/src/hooks/useScreen.ts +5 -0
- package/src/hooks/useSelected.ts +6 -0
- package/src/hooks/useSelectedNode.ts +14 -0
- package/src/hooks/useSelection.ts +6 -0
- package/src/hooks/useTheme.ts +5 -0
- package/src/hooks/useTransformHelper.ts +6 -0
- package/src/hooks/useTree.ts +6 -0
- package/src/hooks/useTreeNode.ts +6 -0
- package/src/hooks/useValidNodeOffsetRect.ts +48 -0
- package/src/hooks/useViewport.ts +6 -0
- package/src/hooks/useWorkbench.ts +6 -0
- package/src/hooks/useWorkspace.ts +16 -0
- package/src/icons/actions.tsx +138 -0
- package/src/icons/add.tsx +8 -0
- package/src/icons/animations.tsx +325 -0
- package/src/icons/boolean.tsx +7 -0
- package/src/icons/clone.tsx +9 -0
- package/src/icons/close.tsx +7 -0
- package/src/icons/code.tsx +5 -0
- package/src/icons/command.tsx +8 -0
- package/src/icons/component.tsx +5 -0
- package/src/icons/container.tsx +8 -0
- package/src/icons/corner.tsx +26 -0
- package/src/icons/delete.tsx +9 -0
- package/src/icons/design.tsx +7 -0
- package/src/icons/display.tsx +17 -0
- package/src/icons/dragmove.tsx +10 -0
- package/src/icons/expand.tsx +5 -0
- package/src/icons/expression.tsx +5 -0
- package/src/icons/eyes.tsx +15 -0
- package/src/icons/flex.tsx +85 -0
- package/src/icons/flip.tsx +5 -0
- package/src/icons/focus.tsx +5 -0
- package/src/icons/font.tsx +61 -0
- package/src/icons/formula.tsx +5 -0
- package/src/icons/freemove.tsx +10 -0
- package/src/icons/help.tsx +8 -0
- package/src/icons/hidden.tsx +5 -0
- package/src/icons/history.tsx +7 -0
- package/src/icons/image.tsx +9 -0
- package/src/icons/index.ts +53 -0
- package/src/icons/json.tsx +5 -0
- package/src/icons/logo.tsx +5 -0
- package/src/icons/menu.tsx +7 -0
- package/src/icons/mobile.tsx +8 -0
- package/src/icons/move.tsx +5 -0
- package/src/icons/number.tsx +7 -0
- package/src/icons/outline.tsx +5 -0
- package/src/icons/page.tsx +9 -0
- package/src/icons/pc.tsx +7 -0
- package/src/icons/play.tsx +8 -0
- package/src/icons/position.tsx +30 -0
- package/src/icons/pushpin.tsx +29 -0
- package/src/icons/recover.tsx +5 -0
- package/src/icons/redo.tsx +5 -0
- package/src/icons/remove.tsx +5 -0
- package/src/icons/responsive.tsx +9 -0
- package/src/icons/return.tsx +5 -0
- package/src/icons/selection.tsx +5 -0
- package/src/icons/setting.tsx +5 -0
- package/src/icons/shadow.tsx +20 -0
- package/src/icons/shift.tsx +5 -0
- package/src/icons/sources.tsx +3377 -0
- package/src/icons/text.tsx +13 -0
- package/src/icons/undo.tsx +7 -0
- package/src/icons/upload.tsx +8 -0
- package/src/index.ts +9 -0
- package/src/locales/global.ts +16 -0
- package/src/locales/icons.ts +132 -0
- package/src/locales/index.ts +7 -0
- package/src/locales/operations.ts +50 -0
- package/src/locales/panels.ts +26 -0
- package/src/panels/CompositePanel.tsx +195 -0
- package/src/panels/SettingsPanel.tsx +85 -0
- package/src/panels/StudioPanel.tsx +54 -0
- package/src/panels/ToolbarPanel.tsx +19 -0
- package/src/panels/ViewPanel.tsx +62 -0
- package/src/panels/ViewportPanel.tsx +10 -0
- package/src/panels/WorkspacePanel.tsx +31 -0
- package/src/panels/index.ts +8 -0
- package/src/panels/styles.less +331 -0
- package/src/simulators/MobileSimulator/body.tsx +78 -0
- package/src/simulators/MobileSimulator/index.tsx +21 -0
- package/src/simulators/MobileSimulator/styles.less +29 -0
- package/src/simulators/PCSimulator/index.tsx +17 -0
- package/src/simulators/PCSimulator/styles.less +11 -0
- package/src/simulators/ResponsiveSimulator/handle.tsx +29 -0
- package/src/simulators/ResponsiveSimulator/index.tsx +193 -0
- package/src/simulators/ResponsiveSimulator/styles.less +56 -0
- package/src/simulators/index.tsx +3 -0
- package/src/theme.less +224 -0
- package/src/types.ts +41 -0
- package/src/variables.less +1 -0
- package/src/widgets/AuxToolWidget/Copy.tsx +28 -0
- package/src/widgets/AuxToolWidget/Cover.tsx +76 -0
- package/src/widgets/AuxToolWidget/DashedBox.tsx +55 -0
- package/src/widgets/AuxToolWidget/Delete.tsx +29 -0
- package/src/widgets/AuxToolWidget/DragHandler.tsx +29 -0
- package/src/widgets/AuxToolWidget/FreeSelection.tsx +53 -0
- package/src/widgets/AuxToolWidget/Helpers.tsx +116 -0
- package/src/widgets/AuxToolWidget/Insertion.tsx +80 -0
- package/src/widgets/AuxToolWidget/ResizeHandler.tsx +35 -0
- package/src/widgets/AuxToolWidget/Selection.tsx +85 -0
- package/src/widgets/AuxToolWidget/Selector.tsx +125 -0
- package/src/widgets/AuxToolWidget/SnapLine.tsx +40 -0
- package/src/widgets/AuxToolWidget/SpaceBlock.tsx +112 -0
- package/src/widgets/AuxToolWidget/TranslateHandler.tsx +29 -0
- package/src/widgets/AuxToolWidget/index.tsx +40 -0
- package/src/widgets/AuxToolWidget/styles.less +383 -0
- package/src/widgets/ComponentTreeWidget/index.tsx +99 -0
- package/src/widgets/ComponentTreeWidget/styles.less +6 -0
- package/src/widgets/DesignerToolsWidget/index.tsx +206 -0
- package/src/widgets/DesignerToolsWidget/styles.less +29 -0
- package/src/widgets/DroppableWidget/index.tsx +63 -0
- package/src/widgets/DroppableWidget/styles.less +11 -0
- package/src/widgets/EmptyWidget/index.tsx +58 -0
- package/src/widgets/EmptyWidget/styles.less +27 -0
- package/src/widgets/GhostWidget/index.tsx +47 -0
- package/src/widgets/GhostWidget/styles.less +20 -0
- package/src/widgets/HistoryWidget/index.tsx +42 -0
- package/src/widgets/HistoryWidget/styles.less +23 -0
- package/src/widgets/IconWidget/index.tsx +152 -0
- package/src/widgets/IconWidget/styles.less +17 -0
- package/src/widgets/NodeActionsWidget/index.tsx +56 -0
- package/src/widgets/NodeActionsWidget/styles.less +51 -0
- package/src/widgets/NodePathWidget/index.tsx +57 -0
- package/src/widgets/NodePathWidget/styles.less +16 -0
- package/src/widgets/NodeTitleWidget/index.tsx +20 -0
- package/src/widgets/OutlineWidget/Insertion.tsx +63 -0
- package/src/widgets/OutlineWidget/OutlineNode.tsx +198 -0
- package/src/widgets/OutlineWidget/context.ts +9 -0
- package/src/widgets/OutlineWidget/index.tsx +66 -0
- package/src/widgets/OutlineWidget/styles.less +195 -0
- package/src/widgets/ResourceWidget/index.tsx +110 -0
- package/src/widgets/ResourceWidget/styles.less +87 -0
- package/src/widgets/TextWidget/index.tsx +43 -0
- package/src/widgets/ViewToolsWidget/index.tsx +72 -0
- package/src/widgets/index.ts +15 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +5 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TreeNode } from '@formily-design/core';
|
|
3
|
+
import { IconWidget } from '../IconWidget';
|
|
4
|
+
import { usePrefix } from '../../hooks';
|
|
5
|
+
import { Button } from 'antd';
|
|
6
|
+
export const Delete = ({ node, style }) => {
|
|
7
|
+
const prefix = usePrefix('aux-copy');
|
|
8
|
+
if (node === node.root)
|
|
9
|
+
return null;
|
|
10
|
+
return (React.createElement(Button, { className: prefix, style: style, type: "primary", onClick: () => {
|
|
11
|
+
TreeNode.remove([node]);
|
|
12
|
+
} },
|
|
13
|
+
React.createElement(IconWidget, { infer: "Remove" })));
|
|
14
|
+
};
|
|
15
|
+
Delete.displayName = 'Delete';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { observer } from '@formily/reactive-react';
|
|
3
|
+
import { IconWidget } from '../IconWidget';
|
|
4
|
+
import { useDesigner, usePrefix } from '../../hooks';
|
|
5
|
+
import { Button } from 'antd';
|
|
6
|
+
export const DragHandler = observer(({ node, style }) => {
|
|
7
|
+
const designer = useDesigner();
|
|
8
|
+
const prefix = usePrefix('aux-drag-handler');
|
|
9
|
+
if (node === node.root || !node.allowDrag())
|
|
10
|
+
return null;
|
|
11
|
+
const handlerProps = {
|
|
12
|
+
[designer.props.nodeDragHandlerAttrName]: 'true',
|
|
13
|
+
};
|
|
14
|
+
return (React.createElement(Button, { ...handlerProps, className: prefix, style: style, type: "primary" },
|
|
15
|
+
React.createElement(IconWidget, { infer: "Move" })));
|
|
16
|
+
});
|
|
17
|
+
DragHandler.displayName = 'DragHandler';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useCursor, usePrefix, useViewport, useOperation } from '../../hooks';
|
|
3
|
+
import { observer } from '@formily/reactive-react';
|
|
4
|
+
import { CursorDragType, CursorStatus } from '@formily-design/core';
|
|
5
|
+
import { calcRectByStartEndPoint } from '@formily-design/shared';
|
|
6
|
+
import cls from 'classnames';
|
|
7
|
+
export const FreeSelection = observer(() => {
|
|
8
|
+
const cursor = useCursor();
|
|
9
|
+
const viewport = useViewport();
|
|
10
|
+
const operation = useOperation();
|
|
11
|
+
const prefix = usePrefix('aux-free-selection');
|
|
12
|
+
const createSelectionStyle = () => {
|
|
13
|
+
const startDragPoint = viewport.getOffsetPoint({
|
|
14
|
+
x: cursor.dragStartPosition.topClientX,
|
|
15
|
+
y: cursor.dragStartPosition.topClientY,
|
|
16
|
+
});
|
|
17
|
+
const currentPoint = viewport.getOffsetPoint({
|
|
18
|
+
x: cursor.position.topClientX,
|
|
19
|
+
y: cursor.position.topClientY,
|
|
20
|
+
});
|
|
21
|
+
const rect = calcRectByStartEndPoint(startDragPoint, currentPoint, viewport.dragScrollXDelta, viewport.dragScrollYDelta);
|
|
22
|
+
const baseStyle = {
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
top: 0,
|
|
25
|
+
left: 0,
|
|
26
|
+
opacity: 0.2,
|
|
27
|
+
borderWidth: 1,
|
|
28
|
+
borderStyle: 'solid',
|
|
29
|
+
transform: `perspective(1px) translate3d(${rect.x}px,${rect.y}px,0)`,
|
|
30
|
+
height: rect.height,
|
|
31
|
+
width: rect.width,
|
|
32
|
+
pointerEvents: 'none',
|
|
33
|
+
boxSizing: 'border-box',
|
|
34
|
+
zIndex: 1,
|
|
35
|
+
};
|
|
36
|
+
return baseStyle;
|
|
37
|
+
};
|
|
38
|
+
if (operation.moveHelper.hasDragNodes ||
|
|
39
|
+
cursor.status !== CursorStatus.Dragging ||
|
|
40
|
+
cursor.dragType !== CursorDragType.Move)
|
|
41
|
+
return null;
|
|
42
|
+
return React.createElement("div", { className: cls(prefix), style: createSelectionStyle() });
|
|
43
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TreeNode } from '@formily-design/core';
|
|
3
|
+
export interface IHelpersProps {
|
|
4
|
+
node: TreeNode;
|
|
5
|
+
nodeRect: DOMRect;
|
|
6
|
+
}
|
|
7
|
+
export interface IViewportState {
|
|
8
|
+
viewportWidth?: number;
|
|
9
|
+
viewportHeight?: number;
|
|
10
|
+
viewportScrollX?: number;
|
|
11
|
+
viewportScrollY?: number;
|
|
12
|
+
viewportIsScrollTop?: boolean;
|
|
13
|
+
viewportIsScrollBottom?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const Helpers: React.FC<IHelpersProps>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useRef, useState, useLayoutEffect } from 'react';
|
|
2
|
+
import { reaction } from '@formily/reactive';
|
|
3
|
+
import { usePrefix, useViewport } from '../../hooks';
|
|
4
|
+
import { Selector } from './Selector';
|
|
5
|
+
import { Copy } from './Copy';
|
|
6
|
+
import { Delete } from './Delete';
|
|
7
|
+
import { DragHandler } from './DragHandler';
|
|
8
|
+
import cls from 'classnames';
|
|
9
|
+
const HELPER_DEBOUNCE_TIMEOUT = 100;
|
|
10
|
+
export const Helpers = ({ node, nodeRect }) => {
|
|
11
|
+
const prefix = usePrefix('aux-helpers');
|
|
12
|
+
const viewport = useViewport();
|
|
13
|
+
const unmountRef = useRef(false);
|
|
14
|
+
const ref = useRef();
|
|
15
|
+
const [position, setPosition] = useState('top-right');
|
|
16
|
+
useLayoutEffect(() => {
|
|
17
|
+
let request = null;
|
|
18
|
+
const getYInViewport = (nodeRect, helpersRect) => {
|
|
19
|
+
if (nodeRect.top - viewport.scrollY > helpersRect.height) {
|
|
20
|
+
return 'top';
|
|
21
|
+
}
|
|
22
|
+
else if (viewport.isScrollTop &&
|
|
23
|
+
nodeRect.height + helpersRect.height > viewport.height) {
|
|
24
|
+
return 'inner-top';
|
|
25
|
+
}
|
|
26
|
+
else if (nodeRect.bottom >= viewport.scrollY + viewport.height &&
|
|
27
|
+
nodeRect.height + helpersRect.height > viewport.height) {
|
|
28
|
+
return 'inner-bottom';
|
|
29
|
+
}
|
|
30
|
+
return 'bottom';
|
|
31
|
+
};
|
|
32
|
+
const getXInViewport = (nodeRect, helpersRect) => {
|
|
33
|
+
const widthDelta = helpersRect.width - nodeRect.width;
|
|
34
|
+
if (widthDelta >= 0) {
|
|
35
|
+
if (nodeRect.x < widthDelta) {
|
|
36
|
+
return 'left';
|
|
37
|
+
}
|
|
38
|
+
else if (nodeRect.right + widthDelta > viewport.width) {
|
|
39
|
+
return 'right';
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return 'center';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return 'right';
|
|
46
|
+
};
|
|
47
|
+
const update = () => {
|
|
48
|
+
var _a;
|
|
49
|
+
const helpersRect = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
50
|
+
if (!helpersRect || !nodeRect)
|
|
51
|
+
return;
|
|
52
|
+
if (unmountRef.current)
|
|
53
|
+
return;
|
|
54
|
+
setPosition(getYInViewport(nodeRect, helpersRect) +
|
|
55
|
+
'-' +
|
|
56
|
+
getXInViewport(nodeRect, helpersRect));
|
|
57
|
+
};
|
|
58
|
+
update();
|
|
59
|
+
return reaction(() => [
|
|
60
|
+
viewport.width,
|
|
61
|
+
viewport.height,
|
|
62
|
+
viewport.scrollX,
|
|
63
|
+
viewport.scrollY,
|
|
64
|
+
viewport.isScrollBottom,
|
|
65
|
+
viewport.isScrollTop,
|
|
66
|
+
], () => {
|
|
67
|
+
clearTimeout(request);
|
|
68
|
+
request = setTimeout(update, HELPER_DEBOUNCE_TIMEOUT);
|
|
69
|
+
});
|
|
70
|
+
}, [viewport, nodeRect]);
|
|
71
|
+
if (!nodeRect || !node)
|
|
72
|
+
return null;
|
|
73
|
+
return (React.createElement("div", { className: cls(prefix, {
|
|
74
|
+
[position]: true,
|
|
75
|
+
}), ref: ref },
|
|
76
|
+
React.createElement("div", { className: cls(prefix + '-content') },
|
|
77
|
+
React.createElement(Selector, { node: node }),
|
|
78
|
+
(node === null || node === void 0 ? void 0 : node.allowClone()) === false ? null : React.createElement(Copy, { node: node }),
|
|
79
|
+
(node === null || node === void 0 ? void 0 : node.allowDrag()) === false ? null : React.createElement(DragHandler, { node: node }),
|
|
80
|
+
(node === null || node === void 0 ? void 0 : node.allowDelete()) === false ? null : React.createElement(Delete, { node: node }))));
|
|
81
|
+
};
|
|
82
|
+
Helpers.displayName = 'Helpers';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useMoveHelper, usePrefix } from '../../hooks';
|
|
3
|
+
import { ClosestPosition } from '@formily-design/core';
|
|
4
|
+
import { observer } from '@formily/reactive-react';
|
|
5
|
+
export const Insertion = observer(() => {
|
|
6
|
+
const moveHelper = useMoveHelper();
|
|
7
|
+
const prefix = usePrefix('aux-insertion');
|
|
8
|
+
const createInsertionStyle = () => {
|
|
9
|
+
var _a;
|
|
10
|
+
const closestDirection = moveHelper.viewportClosestDirection;
|
|
11
|
+
const closestRect = moveHelper.viewportClosestOffsetRect;
|
|
12
|
+
const isInlineLayout = ((_a = moveHelper.closestNode) === null || _a === void 0 ? void 0 : _a.moveLayout) === 'horizontal';
|
|
13
|
+
const baseStyle = {
|
|
14
|
+
position: 'absolute',
|
|
15
|
+
transform: 'perspective(1px) translate3d(0,0,0)',
|
|
16
|
+
top: 0,
|
|
17
|
+
left: 0,
|
|
18
|
+
};
|
|
19
|
+
if (!closestRect)
|
|
20
|
+
return baseStyle;
|
|
21
|
+
if (closestDirection === ClosestPosition.Before ||
|
|
22
|
+
closestDirection === ClosestPosition.ForbidBefore) {
|
|
23
|
+
baseStyle.width = 2;
|
|
24
|
+
baseStyle.height = closestRect.height;
|
|
25
|
+
baseStyle.transform = `perspective(1px) translate3d(${closestRect.x}px,${closestRect.y}px,0)`;
|
|
26
|
+
}
|
|
27
|
+
else if (closestDirection === ClosestPosition.After ||
|
|
28
|
+
closestDirection === ClosestPosition.ForbidAfter) {
|
|
29
|
+
baseStyle.width = 2;
|
|
30
|
+
baseStyle.height = closestRect.height;
|
|
31
|
+
baseStyle.transform = `perspective(1px) translate3d(${closestRect.x + closestRect.width - 2}px,${closestRect.y}px,0)`;
|
|
32
|
+
}
|
|
33
|
+
else if (closestDirection === ClosestPosition.InnerAfter ||
|
|
34
|
+
closestDirection === ClosestPosition.Under ||
|
|
35
|
+
closestDirection === ClosestPosition.ForbidInnerAfter ||
|
|
36
|
+
closestDirection === ClosestPosition.ForbidUnder) {
|
|
37
|
+
if (isInlineLayout) {
|
|
38
|
+
baseStyle.width = 2;
|
|
39
|
+
baseStyle.height = closestRect.height;
|
|
40
|
+
baseStyle.transform = `perspective(1px) translate3d(${closestRect.x + closestRect.width - 2}px,${closestRect.y}px,0)`;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
baseStyle.width = closestRect.width;
|
|
44
|
+
baseStyle.height = 2;
|
|
45
|
+
baseStyle.transform = `perspective(1px) translate3d(${closestRect.x}px,${closestRect.y + closestRect.height - 2}px,0)`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else if (closestDirection === ClosestPosition.InnerBefore ||
|
|
49
|
+
closestDirection === ClosestPosition.Upper ||
|
|
50
|
+
closestDirection === ClosestPosition.ForbidInnerBefore ||
|
|
51
|
+
closestDirection === ClosestPosition.ForbidUpper) {
|
|
52
|
+
if (isInlineLayout) {
|
|
53
|
+
baseStyle.width = 2;
|
|
54
|
+
baseStyle.height = closestRect.height;
|
|
55
|
+
baseStyle.transform = `perspective(1px) translate3d(${closestRect.x}px,${closestRect.y}px,0)`;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
baseStyle.width = closestRect.width;
|
|
59
|
+
baseStyle.height = 2;
|
|
60
|
+
baseStyle.transform = `perspective(1px) translate3d(${closestRect.x}px,${closestRect.y}px,0)`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (closestDirection.includes('FORBID')) {
|
|
64
|
+
baseStyle.backgroundColor = 'red';
|
|
65
|
+
}
|
|
66
|
+
return baseStyle;
|
|
67
|
+
};
|
|
68
|
+
return React.createElement("div", { className: prefix, style: createInsertionStyle() });
|
|
69
|
+
});
|
|
70
|
+
Insertion.displayName = 'Insertion';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cls from 'classnames';
|
|
3
|
+
import { useDesigner, usePrefix } from '../../hooks';
|
|
4
|
+
export const ResizeHandler = (props) => {
|
|
5
|
+
const designer = useDesigner();
|
|
6
|
+
const prefix = usePrefix('aux-node-resize-handler');
|
|
7
|
+
const createHandler = (value) => {
|
|
8
|
+
return {
|
|
9
|
+
[designer.props.nodeResizeHandlerAttrName]: value,
|
|
10
|
+
className: cls(prefix, value),
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const allowResize = props.node.allowResize();
|
|
14
|
+
if (!allowResize)
|
|
15
|
+
return null;
|
|
16
|
+
const allowX = allowResize.includes('x');
|
|
17
|
+
const allowY = allowResize.includes('y');
|
|
18
|
+
return (React.createElement(React.Fragment, null,
|
|
19
|
+
allowX && React.createElement("div", { ...createHandler('left-center') }),
|
|
20
|
+
allowX && React.createElement("div", { ...createHandler('right-center') }),
|
|
21
|
+
allowY && React.createElement("div", { ...createHandler('center-top') }),
|
|
22
|
+
allowY && React.createElement("div", { ...createHandler('center-bottom') }),
|
|
23
|
+
allowX && allowY && React.createElement("div", { ...createHandler('left-top') }),
|
|
24
|
+
allowY && allowY && React.createElement("div", { ...createHandler('right-top') }),
|
|
25
|
+
allowX && allowY && React.createElement("div", { ...createHandler('left-bottom') }),
|
|
26
|
+
allowY && allowY && React.createElement("div", { ...createHandler('right-bottom') })));
|
|
27
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TreeNode } from '@formily-design/core';
|
|
3
|
+
export interface ISelectionBoxProps {
|
|
4
|
+
node: TreeNode;
|
|
5
|
+
showHelpers: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const SelectionBox: React.FC<ISelectionBoxProps>;
|
|
8
|
+
export declare const Selection: React.MemoExoticComponent<import("@formily/reactive-react").ReactFC<unknown>>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { Helpers } from './Helpers';
|
|
3
|
+
import { ResizeHandler } from './ResizeHandler';
|
|
4
|
+
import { useSelection, useValidNodeOffsetRect, useTree, useCursor, useMoveHelper, usePrefix, useDesigner, } from '../../hooks';
|
|
5
|
+
import { observer } from '@formily/reactive-react';
|
|
6
|
+
import { TranslateHandler } from './TranslateHandler';
|
|
7
|
+
export const SelectionBox = (props) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const designer = useDesigner();
|
|
10
|
+
const prefix = usePrefix('aux-selection-box');
|
|
11
|
+
const innerPrefix = usePrefix('aux-selection-box-inner');
|
|
12
|
+
const nodeRect = useValidNodeOffsetRect(props.node);
|
|
13
|
+
const createSelectionStyle = () => {
|
|
14
|
+
const baseStyle = {
|
|
15
|
+
position: 'absolute',
|
|
16
|
+
top: 0,
|
|
17
|
+
left: 0,
|
|
18
|
+
boxSizing: 'border-box',
|
|
19
|
+
zIndex: 4,
|
|
20
|
+
};
|
|
21
|
+
if (nodeRect) {
|
|
22
|
+
baseStyle.transform = `perspective(1px) translate3d(${nodeRect.x}px,${nodeRect.y}px,0)`;
|
|
23
|
+
baseStyle.height = nodeRect.height;
|
|
24
|
+
baseStyle.width = nodeRect.width;
|
|
25
|
+
}
|
|
26
|
+
return baseStyle;
|
|
27
|
+
};
|
|
28
|
+
if (!nodeRect)
|
|
29
|
+
return null;
|
|
30
|
+
if (!nodeRect.width || !nodeRect.height)
|
|
31
|
+
return null;
|
|
32
|
+
const selectionId = {
|
|
33
|
+
[(_a = designer.props) === null || _a === void 0 ? void 0 : _a.nodeSelectionIdAttrName]: props.node.id,
|
|
34
|
+
};
|
|
35
|
+
return (React.createElement("div", { ...selectionId, className: prefix, style: createSelectionStyle() },
|
|
36
|
+
React.createElement("div", { className: innerPrefix }),
|
|
37
|
+
React.createElement(ResizeHandler, { node: props.node }),
|
|
38
|
+
React.createElement(TranslateHandler, { node: props.node }),
|
|
39
|
+
props.showHelpers && (React.createElement(Helpers, { ...props, node: props.node, nodeRect: nodeRect }))));
|
|
40
|
+
};
|
|
41
|
+
export const Selection = observer(() => {
|
|
42
|
+
const selection = useSelection();
|
|
43
|
+
const tree = useTree();
|
|
44
|
+
const cursor = useCursor();
|
|
45
|
+
const viewportMoveHelper = useMoveHelper();
|
|
46
|
+
if (cursor.status !== 'NORMAL' && viewportMoveHelper.touchNode)
|
|
47
|
+
return null;
|
|
48
|
+
return (React.createElement(Fragment, null, selection.selected.map((id) => {
|
|
49
|
+
const node = tree.findById(id);
|
|
50
|
+
if (!node)
|
|
51
|
+
return;
|
|
52
|
+
if (node.hidden)
|
|
53
|
+
return;
|
|
54
|
+
return (React.createElement(SelectionBox, { key: id, node: node, showHelpers: selection.selected.length === 1 }));
|
|
55
|
+
})));
|
|
56
|
+
});
|
|
57
|
+
Selection.displayName = 'Selection';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
+
import { useHover, useSelection, usePrefix } from '../../hooks';
|
|
3
|
+
import { IconWidget } from '../IconWidget';
|
|
4
|
+
import { NodeTitleWidget } from '../NodeTitleWidget';
|
|
5
|
+
import { Button } from 'antd';
|
|
6
|
+
import { observer } from '@formily/reactive-react';
|
|
7
|
+
const useMouseHover = (ref, enter, leave) => {
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
let timer = null;
|
|
10
|
+
let unmounted = false;
|
|
11
|
+
const onMouseOver = (e) => {
|
|
12
|
+
const target = e.target;
|
|
13
|
+
clearTimeout(timer);
|
|
14
|
+
timer = setTimeout(() => {
|
|
15
|
+
var _a;
|
|
16
|
+
if (unmounted)
|
|
17
|
+
return;
|
|
18
|
+
if ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.contains(target)) {
|
|
19
|
+
enter && enter();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
leave && leave();
|
|
23
|
+
}
|
|
24
|
+
}, 100);
|
|
25
|
+
};
|
|
26
|
+
document.addEventListener('mouseover', onMouseOver);
|
|
27
|
+
return () => {
|
|
28
|
+
unmounted = true;
|
|
29
|
+
document.removeEventListener('mouseover', onMouseOver);
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
};
|
|
33
|
+
export const Selector = observer(({ node }) => {
|
|
34
|
+
const hover = useHover();
|
|
35
|
+
const [expand, setExpand] = useState(false);
|
|
36
|
+
const ref = useRef(null);
|
|
37
|
+
const selection = useSelection();
|
|
38
|
+
const prefix = usePrefix('aux-selector');
|
|
39
|
+
const renderIcon = (node) => {
|
|
40
|
+
var _a;
|
|
41
|
+
const icon = node.designerProps.icon;
|
|
42
|
+
if (icon) {
|
|
43
|
+
return React.createElement(IconWidget, { infer: icon });
|
|
44
|
+
}
|
|
45
|
+
if (node === node.root) {
|
|
46
|
+
return React.createElement(IconWidget, { infer: "Page" });
|
|
47
|
+
}
|
|
48
|
+
else if ((_a = node.designerProps) === null || _a === void 0 ? void 0 : _a.droppable) {
|
|
49
|
+
return React.createElement(IconWidget, { infer: "Container" });
|
|
50
|
+
}
|
|
51
|
+
return React.createElement(IconWidget, { infer: "Component" });
|
|
52
|
+
};
|
|
53
|
+
const renderMenu = () => {
|
|
54
|
+
const parents = node.getParents();
|
|
55
|
+
return (React.createElement("div", { className: prefix + '-menu', style: {
|
|
56
|
+
position: 'absolute',
|
|
57
|
+
top: '100%',
|
|
58
|
+
left: 0,
|
|
59
|
+
} }, parents.slice(0, 4).map((parent) => {
|
|
60
|
+
return (React.createElement(Button, { key: parent.id, type: "primary", onClick: () => {
|
|
61
|
+
selection.select(parent.id);
|
|
62
|
+
}, onMouseEnter: () => {
|
|
63
|
+
hover.setHover(parent);
|
|
64
|
+
} },
|
|
65
|
+
renderIcon(parent),
|
|
66
|
+
React.createElement("span", { style: { transform: 'scale(0.85)', marginLeft: 2 } },
|
|
67
|
+
React.createElement(NodeTitleWidget, { node: parent }))));
|
|
68
|
+
})));
|
|
69
|
+
};
|
|
70
|
+
useMouseHover(ref, () => {
|
|
71
|
+
setExpand(true);
|
|
72
|
+
}, () => {
|
|
73
|
+
setExpand(false);
|
|
74
|
+
});
|
|
75
|
+
return (React.createElement("div", { ref: ref, className: prefix },
|
|
76
|
+
React.createElement(Button, { className: prefix + '-title', type: "primary", onMouseEnter: () => {
|
|
77
|
+
hover.setHover(node);
|
|
78
|
+
} },
|
|
79
|
+
renderIcon(node),
|
|
80
|
+
React.createElement("span", null,
|
|
81
|
+
React.createElement(NodeTitleWidget, { node: node }))),
|
|
82
|
+
expand && renderMenu()));
|
|
83
|
+
});
|
|
84
|
+
Selector.displayName = 'Selector';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTransformHelper, useCursor, usePrefix } from '../../hooks';
|
|
3
|
+
import { observer } from '@formily/reactive-react';
|
|
4
|
+
import { CursorStatus } from '@formily-design/core';
|
|
5
|
+
export const SnapLine = observer(() => {
|
|
6
|
+
const cursor = useCursor();
|
|
7
|
+
const transformHelper = useTransformHelper();
|
|
8
|
+
const prefix = usePrefix('aux-snap-line');
|
|
9
|
+
const createLineStyle = (rect) => {
|
|
10
|
+
const baseStyle = {
|
|
11
|
+
top: 0,
|
|
12
|
+
left: 0,
|
|
13
|
+
height: rect.height || 1,
|
|
14
|
+
width: rect.width || 1,
|
|
15
|
+
transform: `perspective(1px) translate3d(${rect.x}px,${rect.y}px,0)`,
|
|
16
|
+
background: `#b0b1f3`,
|
|
17
|
+
position: 'absolute',
|
|
18
|
+
zIndex: 2,
|
|
19
|
+
};
|
|
20
|
+
return baseStyle;
|
|
21
|
+
};
|
|
22
|
+
if (cursor.status !== CursorStatus.Dragging)
|
|
23
|
+
return null;
|
|
24
|
+
return (React.createElement(React.Fragment, null, transformHelper.closestSnapLines.map((line, key) => {
|
|
25
|
+
if (line.type !== 'normal')
|
|
26
|
+
return null;
|
|
27
|
+
return (React.createElement("div", { key: key, className: prefix, style: createLineStyle(line.rect) }));
|
|
28
|
+
})));
|
|
29
|
+
});
|
|
30
|
+
SnapLine.displayName = 'SnapLine';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { useTransformHelper, useCursor, usePrefix } from '../../hooks';
|
|
3
|
+
import { observer } from '@formily/reactive-react';
|
|
4
|
+
import { CursorStatus } from '@formily-design/core';
|
|
5
|
+
import { calcRectOfAxisLineSegment } from '@formily-design/shared';
|
|
6
|
+
export const SpaceBlock = observer(() => {
|
|
7
|
+
const cursor = useCursor();
|
|
8
|
+
const transformHelper = useTransformHelper();
|
|
9
|
+
const prefix = usePrefix('aux-space-block');
|
|
10
|
+
if (cursor.status !== CursorStatus.Dragging)
|
|
11
|
+
return null;
|
|
12
|
+
const renderRulerBox = (distance, type) => {
|
|
13
|
+
if (type === 'top' || type === 'bottom') {
|
|
14
|
+
return (React.createElement("div", { className: prefix + '-ruler-v' },
|
|
15
|
+
React.createElement("div", { className: prefix + '-ruler-indicator' },
|
|
16
|
+
React.createElement("span", null, distance === null || distance === void 0 ? void 0 : distance.toFixed(0)))));
|
|
17
|
+
}
|
|
18
|
+
else if (type === 'left' || type === 'right') {
|
|
19
|
+
return (React.createElement("div", { className: prefix + '-ruler-h' },
|
|
20
|
+
React.createElement("div", { className: prefix + '-ruler-indicator' },
|
|
21
|
+
React.createElement("span", null, distance === null || distance === void 0 ? void 0 : distance.toFixed(0)))));
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const renderDashedLine = (line) => {
|
|
25
|
+
const rect = calcRectOfAxisLineSegment(line);
|
|
26
|
+
if (!rect)
|
|
27
|
+
return null;
|
|
28
|
+
const width = rect.width || 2;
|
|
29
|
+
const height = rect.height || 2;
|
|
30
|
+
return (React.createElement("svg", { width: width + 'px', height: height + 'px', viewBox: `0 0 ${width} ${height}`, style: {
|
|
31
|
+
top: 0,
|
|
32
|
+
left: 0,
|
|
33
|
+
transform: `perspective(1px) translate3d(${line.start.x}px,${line.start.y}px,0)`,
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
zIndex: 3,
|
|
36
|
+
} },
|
|
37
|
+
React.createElement("line", { x1: line.start.x - rect.x, y1: line.start.y - rect.y, x2: line.end.x - rect.x, y2: line.end.y - rect.y, strokeDasharray: 4, stroke: "#745BFF", strokeWidth: 2 })));
|
|
38
|
+
};
|
|
39
|
+
return (React.createElement(React.Fragment, null,
|
|
40
|
+
transformHelper.measurerSpaceBlocks.map(({ type, crossDragNodesRect, distance, extendsLine }, key) => {
|
|
41
|
+
return (React.createElement(Fragment, null,
|
|
42
|
+
renderDashedLine(extendsLine),
|
|
43
|
+
React.createElement("div", { key: key, style: {
|
|
44
|
+
top: 0,
|
|
45
|
+
left: 0,
|
|
46
|
+
height: crossDragNodesRect.height,
|
|
47
|
+
width: crossDragNodesRect.width,
|
|
48
|
+
transform: `perspective(1px) translate3d(${crossDragNodesRect.x}px,${crossDragNodesRect.y}px,0)`,
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
zIndex: 3,
|
|
51
|
+
} }, renderRulerBox(distance, type))));
|
|
52
|
+
}),
|
|
53
|
+
transformHelper.thresholdSpaceBlocks.map(({ rect }, key) => {
|
|
54
|
+
return (React.createElement("div", { key: key, className: prefix, style: {
|
|
55
|
+
top: 0,
|
|
56
|
+
left: 0,
|
|
57
|
+
height: rect.height,
|
|
58
|
+
width: rect.width,
|
|
59
|
+
transform: `perspective(1px) translate3d(${rect.x}px,${rect.y}px,0)`,
|
|
60
|
+
position: 'absolute',
|
|
61
|
+
background: 'rgba(255, 0, 0, 0.2)',
|
|
62
|
+
zIndex: 1,
|
|
63
|
+
} }));
|
|
64
|
+
})));
|
|
65
|
+
});
|
|
66
|
+
SpaceBlock.displayName = 'SpaceBlock';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cls from 'classnames';
|
|
3
|
+
import { useDesigner, usePrefix } from '../../hooks';
|
|
4
|
+
import { IconWidget } from '../IconWidget';
|
|
5
|
+
export const TranslateHandler = (props) => {
|
|
6
|
+
const designer = useDesigner();
|
|
7
|
+
const prefix = usePrefix('aux-node-translate-handler');
|
|
8
|
+
const createHandler = (value) => {
|
|
9
|
+
return {
|
|
10
|
+
[designer.props.nodeTranslateAttrName]: value,
|
|
11
|
+
className: cls(prefix, value),
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const allowTranslate = props.node.allowTranslate();
|
|
15
|
+
if (!allowTranslate)
|
|
16
|
+
return null;
|
|
17
|
+
return (React.createElement(React.Fragment, null,
|
|
18
|
+
React.createElement("div", { ...createHandler('translate') },
|
|
19
|
+
React.createElement(IconWidget, { infer: "FreeMove" }))));
|
|
20
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { useViewport, useDesigner, usePrefix } from '../../hooks';
|
|
3
|
+
import { Insertion } from './Insertion';
|
|
4
|
+
import { Selection } from './Selection';
|
|
5
|
+
import { FreeSelection } from './FreeSelection';
|
|
6
|
+
import { Cover } from './Cover';
|
|
7
|
+
import { DashedBox } from './DashedBox';
|
|
8
|
+
import { SpaceBlock } from './SpaceBlock';
|
|
9
|
+
import { SnapLine } from './SnapLine';
|
|
10
|
+
import './styles.less';
|
|
11
|
+
export const AuxToolWidget = () => {
|
|
12
|
+
const engine = useDesigner();
|
|
13
|
+
const viewport = useViewport();
|
|
14
|
+
const prefix = usePrefix('auxtool');
|
|
15
|
+
const ref = useRef();
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
return engine.subscribeWith('viewport:scroll', () => {
|
|
18
|
+
if (viewport.isIframe && ref.current) {
|
|
19
|
+
ref.current.style.transform = `perspective(1px) translate3d(${-viewport.scrollX}px,${-viewport.scrollY}px,0)`;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}, [engine, viewport]);
|
|
23
|
+
if (!viewport)
|
|
24
|
+
return null;
|
|
25
|
+
return (React.createElement("div", { ref: ref, className: prefix },
|
|
26
|
+
React.createElement(Insertion, null),
|
|
27
|
+
React.createElement(SpaceBlock, null),
|
|
28
|
+
React.createElement(SnapLine, null),
|
|
29
|
+
React.createElement(DashedBox, null),
|
|
30
|
+
React.createElement(Selection, null),
|
|
31
|
+
React.createElement(Cover, null),
|
|
32
|
+
React.createElement(FreeSelection, null)));
|
|
33
|
+
};
|
|
34
|
+
AuxToolWidget.displayName = 'AuxToolWidget';
|