@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,193 @@
|
|
|
1
|
+
import React, { useRef } from 'react'
|
|
2
|
+
import { observer } from '@formily/reactive-react'
|
|
3
|
+
import {
|
|
4
|
+
Engine,
|
|
5
|
+
DragStartEvent,
|
|
6
|
+
DragMoveEvent,
|
|
7
|
+
DragStopEvent,
|
|
8
|
+
CursorDragType,
|
|
9
|
+
} from '@formily-design/core'
|
|
10
|
+
import {
|
|
11
|
+
calcSpeedFactor,
|
|
12
|
+
createUniformSpeedAnimation,
|
|
13
|
+
} from '@formily-design/shared'
|
|
14
|
+
import { useScreen, useDesigner, usePrefix } from '../../hooks'
|
|
15
|
+
import { IconWidget } from '../../widgets'
|
|
16
|
+
import { ResizeHandle, ResizeHandleType } from './handle'
|
|
17
|
+
|
|
18
|
+
import cls from 'classnames'
|
|
19
|
+
import './styles.less'
|
|
20
|
+
|
|
21
|
+
const useResizeEffect = (
|
|
22
|
+
container: React.MutableRefObject<HTMLDivElement>,
|
|
23
|
+
content: React.MutableRefObject<HTMLDivElement>,
|
|
24
|
+
engine: Engine
|
|
25
|
+
) => {
|
|
26
|
+
let status: ResizeHandleType = null
|
|
27
|
+
let startX = 0
|
|
28
|
+
let startY = 0
|
|
29
|
+
let startWidth = 0
|
|
30
|
+
let startHeight = 0
|
|
31
|
+
let animationX = null
|
|
32
|
+
let animationY = null
|
|
33
|
+
|
|
34
|
+
const getStyle = (status: ResizeHandleType) => {
|
|
35
|
+
if (status === ResizeHandleType.Resize) return 'nwse-resize'
|
|
36
|
+
if (status === ResizeHandleType.ResizeHeight) return 'ns-resize'
|
|
37
|
+
if (status === ResizeHandleType.ResizeWidth) return 'ew-resize'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const updateSize = (deltaX: number, deltaY: number) => {
|
|
41
|
+
const containerRect = container.current?.getBoundingClientRect()
|
|
42
|
+
if (status === ResizeHandleType.Resize) {
|
|
43
|
+
engine.screen.setSize(startWidth + deltaX, startHeight + deltaY)
|
|
44
|
+
container.current.scrollBy(
|
|
45
|
+
containerRect.width + deltaX,
|
|
46
|
+
containerRect.height + deltaY
|
|
47
|
+
)
|
|
48
|
+
} else if (status === ResizeHandleType.ResizeHeight) {
|
|
49
|
+
engine.screen.setSize(startWidth, startHeight + deltaY)
|
|
50
|
+
container.current.scrollBy(
|
|
51
|
+
container.current.scrollLeft,
|
|
52
|
+
containerRect.height + deltaY
|
|
53
|
+
)
|
|
54
|
+
} else if (status === ResizeHandleType.ResizeWidth) {
|
|
55
|
+
engine.screen.setSize(startWidth + deltaX, startHeight)
|
|
56
|
+
container.current.scrollBy(
|
|
57
|
+
containerRect.width + deltaX,
|
|
58
|
+
container.current.scrollTop
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
engine.subscribeTo(DragStartEvent, (e) => {
|
|
64
|
+
if (!engine.workbench.currentWorkspace?.viewport) return
|
|
65
|
+
const target = e.data.target as HTMLElement
|
|
66
|
+
if (target?.closest(`*[${engine.props.screenResizeHandlerAttrName}]`)) {
|
|
67
|
+
const rect = content.current?.getBoundingClientRect()
|
|
68
|
+
if (!rect) return
|
|
69
|
+
status = target.getAttribute(
|
|
70
|
+
engine.props.screenResizeHandlerAttrName
|
|
71
|
+
) as ResizeHandleType
|
|
72
|
+
engine.cursor.setStyle(getStyle(status))
|
|
73
|
+
startX = e.data.topClientX
|
|
74
|
+
startY = e.data.topClientY
|
|
75
|
+
startWidth = rect.width
|
|
76
|
+
startHeight = rect.height
|
|
77
|
+
engine.cursor.setDragType(CursorDragType.Resize)
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
engine.subscribeTo(DragMoveEvent, (e) => {
|
|
81
|
+
if (!engine.workbench.currentWorkspace?.viewport) return
|
|
82
|
+
if (!status) return
|
|
83
|
+
const deltaX = e.data.topClientX - startX
|
|
84
|
+
const deltaY = e.data.topClientY - startY
|
|
85
|
+
const containerRect = container.current?.getBoundingClientRect()
|
|
86
|
+
const distanceX = Math.floor(containerRect.right - e.data.topClientX)
|
|
87
|
+
const distanceY = Math.floor(containerRect.bottom - e.data.topClientY)
|
|
88
|
+
const factorX = calcSpeedFactor(distanceX, 10)
|
|
89
|
+
const factorY = calcSpeedFactor(distanceY, 10)
|
|
90
|
+
updateSize(deltaX, deltaY)
|
|
91
|
+
if (distanceX <= 10) {
|
|
92
|
+
if (!animationX) {
|
|
93
|
+
animationX = createUniformSpeedAnimation(1000 * factorX, (delta) => {
|
|
94
|
+
updateSize(deltaX + delta, deltaY)
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
} else {
|
|
98
|
+
if (animationX) {
|
|
99
|
+
animationX = animationX()
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (distanceY <= 10) {
|
|
104
|
+
if (!animationY) {
|
|
105
|
+
animationY = createUniformSpeedAnimation(300 * factorY, (delta) => {
|
|
106
|
+
updateSize(deltaX, deltaY + delta)
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
if (animationY) {
|
|
111
|
+
animationY = animationY()
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
engine.subscribeTo(DragStopEvent, () => {
|
|
116
|
+
if (!status) return
|
|
117
|
+
status = null
|
|
118
|
+
engine.cursor.setStyle('')
|
|
119
|
+
engine.cursor.setDragType(CursorDragType.Move)
|
|
120
|
+
if (animationX) {
|
|
121
|
+
animationX = animationX()
|
|
122
|
+
}
|
|
123
|
+
if (animationY) {
|
|
124
|
+
animationY = animationY()
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface IResponsiveSimulatorProps
|
|
130
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
131
|
+
className?: string
|
|
132
|
+
style?: React.CSSProperties
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export const ResponsiveSimulator: React.FC<IResponsiveSimulatorProps> =
|
|
136
|
+
observer((props) => {
|
|
137
|
+
const container = useRef<HTMLDivElement>()
|
|
138
|
+
const content = useRef<HTMLDivElement>()
|
|
139
|
+
const prefix = usePrefix('responsive-simulator')
|
|
140
|
+
const screen = useScreen()
|
|
141
|
+
useDesigner((engine) => {
|
|
142
|
+
useResizeEffect(container, content, engine)
|
|
143
|
+
})
|
|
144
|
+
return (
|
|
145
|
+
<div
|
|
146
|
+
{...props}
|
|
147
|
+
className={cls(prefix, props.className)}
|
|
148
|
+
style={{
|
|
149
|
+
height: '100%',
|
|
150
|
+
width: '100%',
|
|
151
|
+
minHeight: 100,
|
|
152
|
+
position: 'relative',
|
|
153
|
+
...props.style,
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
<div
|
|
157
|
+
ref={container}
|
|
158
|
+
style={{
|
|
159
|
+
position: 'absolute',
|
|
160
|
+
top: 0,
|
|
161
|
+
left: 0,
|
|
162
|
+
height: '100%',
|
|
163
|
+
width: '100%',
|
|
164
|
+
overflow: 'overlay',
|
|
165
|
+
}}
|
|
166
|
+
>
|
|
167
|
+
<div
|
|
168
|
+
ref={content}
|
|
169
|
+
style={{
|
|
170
|
+
width: screen.width,
|
|
171
|
+
height: screen.height,
|
|
172
|
+
paddingRight: 15,
|
|
173
|
+
paddingBottom: 15,
|
|
174
|
+
position: 'relative',
|
|
175
|
+
boxSizing: 'border-box',
|
|
176
|
+
overflow: 'hidden',
|
|
177
|
+
}}
|
|
178
|
+
>
|
|
179
|
+
{props.children}
|
|
180
|
+
<ResizeHandle type={ResizeHandleType.Resize}>
|
|
181
|
+
<IconWidget infer="DragMove" style={{ pointerEvents: 'none' }} />
|
|
182
|
+
</ResizeHandle>
|
|
183
|
+
<ResizeHandle type={ResizeHandleType.ResizeHeight}>
|
|
184
|
+
<IconWidget infer="Menu" style={{ pointerEvents: 'none' }} />
|
|
185
|
+
</ResizeHandle>
|
|
186
|
+
<ResizeHandle type={ResizeHandleType.ResizeWidth}>
|
|
187
|
+
<IconWidget infer="Menu" style={{ pointerEvents: 'none' }} />
|
|
188
|
+
</ResizeHandle>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
)
|
|
193
|
+
})
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@import '../../variables.less';
|
|
2
|
+
|
|
3
|
+
.@{prefix-cls}-responsive-simulator {
|
|
4
|
+
background-color: var(--dn-responsive-simulator-bg-color);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.@{prefix-cls}-resize-handle {
|
|
8
|
+
position: absolute;
|
|
9
|
+
transition: 0.2s all ease-in-out;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
user-select: none;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
z-index: 10;
|
|
14
|
+
background: var(--dn-resize-handle-bg-color);
|
|
15
|
+
color: var(--dn-resize-handle-color);
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
|
|
20
|
+
&-RESIZE_WIDTH {
|
|
21
|
+
top: 0;
|
|
22
|
+
bottom: 15px;
|
|
23
|
+
cursor: ew-resize;
|
|
24
|
+
|
|
25
|
+
svg {
|
|
26
|
+
transform-origin: center;
|
|
27
|
+
transform: rotate(-90deg);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-RESIZE_HEIGHT {
|
|
32
|
+
left: 0;
|
|
33
|
+
right: 15px;
|
|
34
|
+
cursor: ns-resize;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&-RESIZE {
|
|
38
|
+
cursor: nwse-resize;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&-RESIZE_HEIGHT,
|
|
42
|
+
&-RESIZE {
|
|
43
|
+
height: 15px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&-RESIZE_WIDTH,
|
|
47
|
+
&-RESIZE {
|
|
48
|
+
right: 0;
|
|
49
|
+
width: 15px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&:hover {
|
|
53
|
+
background: var(--dn-resize-handle-hover-bg-color);
|
|
54
|
+
color: var(--dn-resize-handle-hover-color);
|
|
55
|
+
}
|
|
56
|
+
}
|
package/src/theme.less
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
@import './variables.less';
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
//品牌色
|
|
5
|
+
--dn-brand-color: rgba(24, 144, 255, 1);
|
|
6
|
+
--dn-brand-hovering: rgba(64, 169, 255, 1);
|
|
7
|
+
--dn-brand-dragging: rgba(24, 144, 255, 0.26);
|
|
8
|
+
--dn-brand-dropping: rgba(24, 144, 255, 0.34);
|
|
9
|
+
--dn-brand-moving: rgba(24, 144, 255, 0.5);
|
|
10
|
+
//白色调色版
|
|
11
|
+
--dn-white: #fff;
|
|
12
|
+
--dn-white-gray: #d9d9d9;
|
|
13
|
+
--dn-white-gray-light: #eee;
|
|
14
|
+
--dn-white-gray-lighter: #f0f0f0;
|
|
15
|
+
--dn-white-gray-dark: #aaa;
|
|
16
|
+
//灰色调色板
|
|
17
|
+
--dn-gray: #333;
|
|
18
|
+
--dn-gray-light: #444;
|
|
19
|
+
--dn-gray-lighter: #666;
|
|
20
|
+
--dn-gray-dark: #222;
|
|
21
|
+
--dn-black: #1a1a1a;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.@{prefix-cls}-light {
|
|
25
|
+
--dn-aux-cover-rect-dragging-color: var(--dn-brand-dragging);
|
|
26
|
+
--dn-aux-cover-rect-dropping-color: var(--dn-brand-dropping);
|
|
27
|
+
--dn-aux-free-selection-background-color: var(--dn-brand-color);
|
|
28
|
+
--dn-aux-free-selection-border-color: var(--dn-brand-color);
|
|
29
|
+
--dn-aux-insertion-color: var(--dn-brand-color);
|
|
30
|
+
--dn-aux-dashed-box-color: var(--dn-brand-color);
|
|
31
|
+
--dn-aux-dashed-box-title-color: var(--dn-gray);
|
|
32
|
+
--dn-aux-selection-box-border-color: var(--dn-brand-color);
|
|
33
|
+
--dn-aux-selection-box-color: var(--dn-gray);
|
|
34
|
+
--dn-ghost-color: var(--dn-white);
|
|
35
|
+
--dn-ghost-bg-color: var(--dn-brand-moving);
|
|
36
|
+
--dn-outline-tree-bg-color: var(--dn-white);
|
|
37
|
+
--dn-outline-tree-header-border-color: var(--dn-white-gray-light);
|
|
38
|
+
--dn-outline-tree-color: var(--dn-gray);
|
|
39
|
+
--dn-outline-tree-insertion-bg-color: var(--dn-brand-color);
|
|
40
|
+
--dn-outline-tree-node-header-color: var(--dn-gray);
|
|
41
|
+
--dn-outline-tree-node-hover-color: var(--dn-brand-color);
|
|
42
|
+
|
|
43
|
+
--dn-toolbar-input-color: var(--dn-gray-dark);
|
|
44
|
+
--dn-toolbar-input-bg-color: var(--dn-white);
|
|
45
|
+
--dn-toolbar-input-border-color: var(--dn-white-gray-light);
|
|
46
|
+
--dn-toolbar-input-hover-border-color: var(--dn-white-gray-light);
|
|
47
|
+
--dn-toolbar-input-handler-bg-color: var(--dn-white);
|
|
48
|
+
|
|
49
|
+
--dn-resize-handle-bg-color: var(--dn-white-gray-light);
|
|
50
|
+
--dn-resize-handle-hover-bg-color: var(--dn-white-gray-lighter);
|
|
51
|
+
--dn-resize-handle-color: var(--dn-gray-light);
|
|
52
|
+
--dn-resize-handle-hover-color: var(--dn-white-lighter);
|
|
53
|
+
|
|
54
|
+
--dn-mobile-simulator-bg-color: var(--dn-white-gray-light);
|
|
55
|
+
--dn-mobile-simulator-body-bg-color: var(--dn-white);
|
|
56
|
+
--dn-mobile-simulator-border-color: var(--dn-gray-dark);
|
|
57
|
+
--dn-responsive-simulator-bg-color: var(--dn-white);
|
|
58
|
+
--dn-pc-simulator-bg-color: var(--dn-white);
|
|
59
|
+
|
|
60
|
+
--dn-aux-selector-btn-color: var(--dn-white);
|
|
61
|
+
--dn-aux-selector-btn-bg-color: var(--dn-brand-color);
|
|
62
|
+
--dn-aux-selector-btn-border-color: var(--dn-brand-color);
|
|
63
|
+
--dn-aux-selector-btn-hover-color: var(--dn-white);
|
|
64
|
+
--dn-aux-selector-btn-hover-bg-color: var(--dn-brand-hovering);
|
|
65
|
+
--dn-aux-selector-btn-hover-border-color: var(--dn-brand-hovering);
|
|
66
|
+
--dn-aux-selector-btn-active-color: var(--dn-white);
|
|
67
|
+
--dn-aux-selector-btn-active-bg-color: var(--dn-brand-hovering);
|
|
68
|
+
--dn-aux-selector-btn-active-border-color: var(--dn-brand-hovering);
|
|
69
|
+
|
|
70
|
+
--dn-panel-border-color: var(--dn-white-gray);
|
|
71
|
+
--dn-panel-active-bg-color: var(--dn-white-gray-light);
|
|
72
|
+
--dn-resource-content-bg-color: var(--dn-white);
|
|
73
|
+
|
|
74
|
+
--dn-composite-panel-tabs-bg-color: var(--dn-white);
|
|
75
|
+
--dn-composite-panel-tabs-active-bg-color: var(--dn-white);
|
|
76
|
+
--dn-composite-panel-highlight-bg-color: var(--dn-white-gray-light);
|
|
77
|
+
--dn-composite-panel-tabs-color: var(--dn-gray-lighter);
|
|
78
|
+
--dn-composite-panel-tabs-hover-color: var(--dn-brand-color);
|
|
79
|
+
--dn-composite-panel-tabs-content-bg-color: var(--dn-white);
|
|
80
|
+
--dn-composite-panel-tabs-header-color: var(--dn-gray-lighter);
|
|
81
|
+
|
|
82
|
+
--dn-collapse-header-color: var(--dn-gray);
|
|
83
|
+
|
|
84
|
+
--dn-resource-item-color: var(--dn-gray);
|
|
85
|
+
--dn-resource-item-hover-border-color: var(--dn-brand-color);
|
|
86
|
+
--dn-resource-item-hover-color: var(--dn-brand-color);
|
|
87
|
+
|
|
88
|
+
--dn-main-panel-header-bg-color: var(--dn-white);
|
|
89
|
+
--dn-workspace-panel-bg-color: var(--dn-white-gray-light);
|
|
90
|
+
|
|
91
|
+
--dn-scrollbar-color: var(--dn-white-gray);
|
|
92
|
+
--dn-scrollbar-hover-color: var(--white-dn-gray-lighter);
|
|
93
|
+
|
|
94
|
+
--dn-empty-bg-color: var(--dn-white);
|
|
95
|
+
|
|
96
|
+
--dn-droppable-bg-color: var(--dn-white-gray-lighter);
|
|
97
|
+
--dn-droppable-border-color: var(--dn-white-gray-dark);
|
|
98
|
+
--dn-droppable-color: var(--dn-gray-lighter);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.@{prefix-cls}-dark {
|
|
102
|
+
--dn-aux-cover-rect-dragging-color: var(--dn-brand-dragging);
|
|
103
|
+
--dn-aux-cover-rect-dropping-color: var(--dn-brand-dropping);
|
|
104
|
+
--dn-aux-free-selection-background-color: var(--dn-brand-color);
|
|
105
|
+
--dn-aux-free-selection-border-color: var(--dn-brand-color);
|
|
106
|
+
--dn-aux-insertion-color: var(--dn-brand-color);
|
|
107
|
+
--dn-aux-dashed-box-color: var(--dn-brand-color);
|
|
108
|
+
--dn-aux-dashed-box-title-color: var(--dn-brand-color);
|
|
109
|
+
--dn-aux-selection-box-border-color: var(--dn-brand-color);
|
|
110
|
+
--dn-aux-selection-box-color: var(--dn-gray);
|
|
111
|
+
--dn-ghost-color: var(--dn-white);
|
|
112
|
+
--dn-ghost-bg-color: var(--dn-brand-moving);
|
|
113
|
+
--dn-outline-tree-bg-color: var(--dn-gray-dark);
|
|
114
|
+
--dn-outline-tree-header-border-color: var(--dn-gray);
|
|
115
|
+
--dn-outline-tree-color: var(--dn-white-gray);
|
|
116
|
+
--dn-outline-tree-insertion-bg-color: var(--dn-brand-color);
|
|
117
|
+
--dn-outline-tree-node-header-color: var(--dn-white-gray);
|
|
118
|
+
--dn-outline-tree-node-hover-color: var(--dn-white-gray);
|
|
119
|
+
|
|
120
|
+
--dn-toolbar-input-color: var(--dn-white-gray);
|
|
121
|
+
--dn-toolbar-input-bg-color: transparent;
|
|
122
|
+
--dn-toolbar-input-border-color: var(--dn-gray-light);
|
|
123
|
+
--dn-toolbar-input-hover-border-color: var(--dn-brand-color);
|
|
124
|
+
--dn-toolbar-input-handler-bg-color: var(--dn-gray-light);
|
|
125
|
+
--dn-resize-handle-bg-color: var(--dn-gray-light);
|
|
126
|
+
--dn-resize-handle-hover-bg-color: var(--dn-gray-lighter);
|
|
127
|
+
--dn-resize-handle-color: var(--dn-gray-lighter);
|
|
128
|
+
--dn-resize-handle-hover-color: var(--dn-white-gray-dark);
|
|
129
|
+
|
|
130
|
+
--dn-mobile-simulator-bg-color: var(--dn-black);
|
|
131
|
+
--dn-mobile-simulator-body-bg-color: var(--dn-black);
|
|
132
|
+
--dn-mobile-simulator-border-color: var(--dn-black);
|
|
133
|
+
--dn-responsive-simulator-bg-color: var(--dn-black);
|
|
134
|
+
--dn-pc-simulator-bg-color: var(--dn-black);
|
|
135
|
+
|
|
136
|
+
--dn-aux-selector-btn-color: var(--dn-white);
|
|
137
|
+
--dn-aux-selector-btn-bg-color: var(--dn-brand-color);
|
|
138
|
+
--dn-aux-selector-btn-border-color: var(--dn-brand-color);
|
|
139
|
+
--dn-aux-selector-btn-hover-color: var(--dn-white);
|
|
140
|
+
--dn-aux-selector-btn-hover-bg-color: var(--dn-brand-hovering);
|
|
141
|
+
--dn-aux-selector-btn-hover-border-color: var(--dn-brand-hovering);
|
|
142
|
+
--dn-aux-selector-btn-active-color: var(--dn-white);
|
|
143
|
+
--dn-aux-selector-btn-active-bg-color: var(--dn-brand-hovering);
|
|
144
|
+
--dn-aux-selector-btn-active-border-color: var(--dn-brand-hovering);
|
|
145
|
+
|
|
146
|
+
--dn-panel-border-color: var(--dn-gray-light);
|
|
147
|
+
--dn-panel-active-bg-color: var(--dn-gray);
|
|
148
|
+
--dn-resource-content-bg-color: var(--dn-gray-dark);
|
|
149
|
+
|
|
150
|
+
--dn-composite-panel-tabs-bg-color: var(--dn-gray-dark);
|
|
151
|
+
--dn-composite-panel-tabs-active-bg-color: var(--dn-gray-dark);
|
|
152
|
+
--dn-composite-panel-highlight-bg-color: var(--dn-black);
|
|
153
|
+
--dn-composite-panel-tabs-color: var(--dn-white-gray-dark);
|
|
154
|
+
--dn-composite-panel-tabs-hover-color: var(--dn-brand-color);
|
|
155
|
+
--dn-composite-panel-tabs-content-bg-color: var(--dn-gray-dark);
|
|
156
|
+
--dn-composite-panel-tabs-header-color: var(--dn-white-gray);
|
|
157
|
+
|
|
158
|
+
--dn-collapse-header-color: var(--dn-white-gray);
|
|
159
|
+
|
|
160
|
+
--dn-resource-item-color: var(--dn-white-gray);
|
|
161
|
+
--dn-resource-item-hover-color: var(--dn-brand-color);
|
|
162
|
+
|
|
163
|
+
--dn-main-panel-header-bg-color: var(--dn-gray-dark);
|
|
164
|
+
--dn-workspace-panel-bg-color: var(--dn-gray-dark);
|
|
165
|
+
|
|
166
|
+
--dn-scrollbar-color: var(--dn-gray-light);
|
|
167
|
+
--dn-scrollbar-hover-color: var(--dn-gray-lighter);
|
|
168
|
+
|
|
169
|
+
--dn-empty-bg-color: var(--dn-gray-dark);
|
|
170
|
+
|
|
171
|
+
--dn-droppable-bg-color: var(--dn-gray);
|
|
172
|
+
--dn-droppable-border-color: var(--dn-gray-light);
|
|
173
|
+
--dn-droppable-color: var(--dn-white);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.@{prefix-cls}-app {
|
|
177
|
+
::-webkit-scrollbar {
|
|
178
|
+
width: 5px;
|
|
179
|
+
height: 5px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
::-webkit-scrollbar-thumb {
|
|
183
|
+
background-color: var(--dn-scrollbar-color);
|
|
184
|
+
border-radius: 0;
|
|
185
|
+
transition: all 0.25s ease-in-out;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
::-webkit-scrollbar-thumb:hover {
|
|
189
|
+
background-color: var(--dn-scrollbar-hover-color);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
color: var(--dn-gray-dark);
|
|
193
|
+
font-size: 14px;
|
|
194
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
195
|
+
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji',
|
|
196
|
+
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
|
197
|
+
font-variant: tabular-nums;
|
|
198
|
+
line-height: 1.5715;
|
|
199
|
+
font-feature-settings: 'tnum';
|
|
200
|
+
|
|
201
|
+
* {
|
|
202
|
+
box-sizing: border-box;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
*[contenteditable='true'] {
|
|
206
|
+
min-width: 1px;
|
|
207
|
+
min-height: 14px;
|
|
208
|
+
cursor: text !important;
|
|
209
|
+
outline: none !important;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
*[data-content-editable]:not(*[contenteditable='true']) {
|
|
213
|
+
&:empty::before {
|
|
214
|
+
content: 'Please Input';
|
|
215
|
+
display: block;
|
|
216
|
+
opacity: 0.6;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
&:hover {
|
|
220
|
+
cursor: text !important;
|
|
221
|
+
opacity: 0.8;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Engine, IResource, IBehavior } from '@formily-design/core'
|
|
3
|
+
|
|
4
|
+
export interface IDesignerLayoutProps {
|
|
5
|
+
children?: React.ReactNode
|
|
6
|
+
prefixCls?: string
|
|
7
|
+
theme?: 'dark' | 'light' | (string & {})
|
|
8
|
+
variables?: Record<string, string>
|
|
9
|
+
position?: 'fixed' | 'absolute' | 'relative'
|
|
10
|
+
style?: React.CSSProperties
|
|
11
|
+
className?: string
|
|
12
|
+
}
|
|
13
|
+
export interface IDesignerProps extends IDesignerLayoutProps {
|
|
14
|
+
engine: Engine
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IDesignerComponents {
|
|
18
|
+
[key: string]: DnFC<any> | DnComponent<any>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface IDesignerLayoutContext {
|
|
22
|
+
theme?: 'dark' | 'light' | (string & {})
|
|
23
|
+
prefixCls: string
|
|
24
|
+
position: 'fixed' | 'absolute' | 'relative'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IWorkspaceContext {
|
|
28
|
+
id: string
|
|
29
|
+
title?: string
|
|
30
|
+
description?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type DnFC<P = {}> = React.FC<P> & {
|
|
34
|
+
Resource?: IResource[]
|
|
35
|
+
Behavior?: IBehavior[]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type DnComponent<P = {}> = React.ComponentType<P> & {
|
|
39
|
+
Resource?: IResource[]
|
|
40
|
+
Behavior?: IBehavior[]
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@prefix-cls: ~'dn';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { TreeNode } from '@formily-design/core'
|
|
3
|
+
import { usePrefix } from '../../hooks'
|
|
4
|
+
import { IconWidget } from '../IconWidget'
|
|
5
|
+
import { Button } from 'antd'
|
|
6
|
+
export interface ICopyProps {
|
|
7
|
+
node: TreeNode
|
|
8
|
+
style?: React.CSSProperties
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Copy: React.FC<ICopyProps> = ({ node, style }) => {
|
|
12
|
+
const prefix = usePrefix('aux-copy')
|
|
13
|
+
if (node === node.root) return null
|
|
14
|
+
return (
|
|
15
|
+
<Button
|
|
16
|
+
className={prefix}
|
|
17
|
+
style={style}
|
|
18
|
+
type="primary"
|
|
19
|
+
onClick={() => {
|
|
20
|
+
TreeNode.clone([node])
|
|
21
|
+
}}
|
|
22
|
+
>
|
|
23
|
+
<IconWidget infer="Clone" />
|
|
24
|
+
</Button>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Copy.displayName = 'Copy'
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { Fragment } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
useViewport,
|
|
4
|
+
useMoveHelper,
|
|
5
|
+
useCursor,
|
|
6
|
+
useValidNodeOffsetRect,
|
|
7
|
+
usePrefix,
|
|
8
|
+
} from '../../hooks'
|
|
9
|
+
import { observer } from '@formily/reactive-react'
|
|
10
|
+
import { CursorStatus, ClosestPosition, TreeNode } from '@formily-design/core'
|
|
11
|
+
import cls from 'classnames'
|
|
12
|
+
interface ICoverRectProps {
|
|
13
|
+
node: TreeNode
|
|
14
|
+
dragging?: boolean
|
|
15
|
+
dropping?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const CoverRect: React.FC<ICoverRectProps> = (props) => {
|
|
19
|
+
const prefix = usePrefix('aux-cover-rect')
|
|
20
|
+
const rect = useValidNodeOffsetRect(props.node)
|
|
21
|
+
const createCoverStyle = () => {
|
|
22
|
+
const baseStyle: React.CSSProperties = {
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
top: 0,
|
|
25
|
+
left: 0,
|
|
26
|
+
pointerEvents: 'none',
|
|
27
|
+
}
|
|
28
|
+
if (rect) {
|
|
29
|
+
baseStyle.transform = `perspective(1px) translate3d(${rect.x}px,${rect.y}px,0)`
|
|
30
|
+
baseStyle.height = rect.height
|
|
31
|
+
baseStyle.width = rect.width
|
|
32
|
+
}
|
|
33
|
+
return baseStyle
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div
|
|
38
|
+
className={cls(prefix, {
|
|
39
|
+
dragging: props.dragging,
|
|
40
|
+
dropping: props.dropping,
|
|
41
|
+
})}
|
|
42
|
+
style={createCoverStyle()}
|
|
43
|
+
></div>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const Cover = observer(() => {
|
|
48
|
+
const viewportMoveHelper = useMoveHelper()
|
|
49
|
+
const viewport = useViewport()
|
|
50
|
+
const cursor = useCursor()
|
|
51
|
+
const renderDropCover = () => {
|
|
52
|
+
if (
|
|
53
|
+
!viewportMoveHelper.closestNode ||
|
|
54
|
+
!viewportMoveHelper.closestNode?.allowAppend(
|
|
55
|
+
viewportMoveHelper.dragNodes
|
|
56
|
+
) ||
|
|
57
|
+
viewportMoveHelper.viewportClosestDirection !== ClosestPosition.Inner
|
|
58
|
+
)
|
|
59
|
+
return null
|
|
60
|
+
return <CoverRect node={viewportMoveHelper.closestNode} dropping />
|
|
61
|
+
}
|
|
62
|
+
if (cursor.status !== CursorStatus.Dragging) return null
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Fragment>
|
|
66
|
+
{viewportMoveHelper.dragNodes.map((node) => {
|
|
67
|
+
if (!node) return
|
|
68
|
+
if (!viewport.findElementById(node.id)) return
|
|
69
|
+
return <CoverRect key={node.id} node={node} dragging />
|
|
70
|
+
})}
|
|
71
|
+
{renderDropCover()}
|
|
72
|
+
</Fragment>
|
|
73
|
+
)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
Cover.displayName = 'Cover'
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
useHover,
|
|
4
|
+
usePrefix,
|
|
5
|
+
useValidNodeOffsetRect,
|
|
6
|
+
useSelection,
|
|
7
|
+
} from '../../hooks'
|
|
8
|
+
import { observer } from '@formily/reactive-react'
|
|
9
|
+
|
|
10
|
+
export const DashedBox = observer(() => {
|
|
11
|
+
const hover = useHover()
|
|
12
|
+
const prefix = usePrefix('aux-dashed-box')
|
|
13
|
+
const selection = useSelection()
|
|
14
|
+
const rect = useValidNodeOffsetRect(hover?.node)
|
|
15
|
+
const createTipsStyle = () => {
|
|
16
|
+
const baseStyle: React.CSSProperties = {
|
|
17
|
+
top: 0,
|
|
18
|
+
left: 0,
|
|
19
|
+
pointerEvents: 'none',
|
|
20
|
+
boxSizing: 'border-box',
|
|
21
|
+
visibility: 'hidden',
|
|
22
|
+
zIndex: 2,
|
|
23
|
+
}
|
|
24
|
+
if (rect) {
|
|
25
|
+
baseStyle.transform = `perspective(1px) translate3d(${rect.x}px,${rect.y}px,0)`
|
|
26
|
+
baseStyle.height = rect.height
|
|
27
|
+
baseStyle.width = rect.width
|
|
28
|
+
baseStyle.visibility = 'visible'
|
|
29
|
+
}
|
|
30
|
+
return baseStyle
|
|
31
|
+
}
|
|
32
|
+
if (!hover.node) return null
|
|
33
|
+
if (hover.node.hidden) return null
|
|
34
|
+
if (selection.selected.includes(hover.node.id)) return null
|
|
35
|
+
return (
|
|
36
|
+
<div className={prefix} style={createTipsStyle()}>
|
|
37
|
+
<span
|
|
38
|
+
className={prefix + '-title'}
|
|
39
|
+
style={{
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
bottom: '100%',
|
|
42
|
+
left: 0,
|
|
43
|
+
fontSize: 12,
|
|
44
|
+
userSelect: 'none',
|
|
45
|
+
fontWeight: 'lighter',
|
|
46
|
+
whiteSpace: 'nowrap',
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
{hover?.node.getMessage('title')}
|
|
50
|
+
</span>
|
|
51
|
+
</div>
|
|
52
|
+
)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
DashedBox.displayName = 'DashedBox'
|