From 287fd4ab4587fdaeaefd15abc7708e3bc60135bc Mon Sep 17 00:00:00 2001 From: tengge1 <930372551@qq.com> Date: Sun, 14 Jul 2019 14:38:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=9E=E6=80=A7=E9=9D=A2=E6=9D=BF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/editor2/component/BasicComponent.jsx | 6 +- .../src/editor2/sidebar/PropertyPanel.jsx | 60 ++----------------- ShadowEditor.Web/src/ui/index.js | 3 + .../src/ui/property/DisplayProperty.jsx | 60 +++++++++++++++++++ .../src/ui/property/css/DisplayProperty.css | 0 5 files changed, 72 insertions(+), 57 deletions(-) create mode 100644 ShadowEditor.Web/src/ui/property/DisplayProperty.jsx create mode 100644 ShadowEditor.Web/src/ui/property/css/DisplayProperty.css diff --git a/ShadowEditor.Web/src/editor2/component/BasicComponent.jsx b/ShadowEditor.Web/src/editor2/component/BasicComponent.jsx index 0aab04f5..a33b6e47 100644 --- a/ShadowEditor.Web/src/editor2/component/BasicComponent.jsx +++ b/ShadowEditor.Web/src/editor2/component/BasicComponent.jsx @@ -1,3 +1,5 @@ +import { PropertyGrid, PropertyGroup, TextProperty } from '../../third_party'; + /** * 基本信息组件 * @author tengge / https://github.com/tengge1 @@ -8,7 +10,9 @@ class BasicComponent extends React.Component { } render() { - return
; + return + + ; } } diff --git a/ShadowEditor.Web/src/editor2/sidebar/PropertyPanel.jsx b/ShadowEditor.Web/src/editor2/sidebar/PropertyPanel.jsx index 244e3496..44d89a09 100644 --- a/ShadowEditor.Web/src/editor2/sidebar/PropertyPanel.jsx +++ b/ShadowEditor.Web/src/editor2/sidebar/PropertyPanel.jsx @@ -1,5 +1,6 @@ import './css/PropertyPanel.css'; import { classNames, PropTypes, PropertyGrid } from '../../third_party'; +import BasicComponent from '../component/BasicComponent.jsx'; /** * 属性面板 @@ -8,65 +9,12 @@ import { classNames, PropTypes, PropertyGrid } from '../../third_party'; class PropertyPanel extends React.Component { constructor(props) { super(props); - - this.data = [{ - name: 'General', - expand: true, - children: [{ - type: 'text', - name: 'name', - label: 'Name', - value: 'Box', - }, { - type: 'label', - name: 'type', - label: 'Type', - value: 'Box', - }, { - type: 'checkbox', - name: 'visible', - label: 'Visible', - value: true, - }] - }, { - name: 'Transform', - expand: false, - children: [{ - type: 'number', - name: 'translateX', - label: 'TranslateX', - value: 0, - }, { - type: 'number', - name: 'translateY', - label: 'TranslateY', - value: 0, - }, { - type: 'number', - name: 'translateZ', - label: 'TranslateZ', - value: 0, - }, { - type: 'number', - name: 'rotateX', - label: 'RotateX', - value: 0, - }, { - type: 'number', - name: 'rotateY', - label: 'RotateY', - value: 0, - }, { - type: 'number', - name: 'rotateZ', - label: 'RotateZ', - value: 0, - }] - }]; } render() { - return ; + return + + ; } } diff --git a/ShadowEditor.Web/src/ui/index.js b/ShadowEditor.Web/src/ui/index.js index c015d6b4..0dcdc667 100644 --- a/ShadowEditor.Web/src/ui/index.js +++ b/ShadowEditor.Web/src/ui/index.js @@ -54,6 +54,9 @@ export { default as Panel } from './panel/Panel.jsx'; // property export { default as PropertyGrid } from './property/PropertyGrid.jsx'; +export { default as PropertyGroup } from './property/PropertyGroup.jsx'; +export { default as DisplayProperty } from './property/DisplayProperty.jsx'; +export { default as TextProperty } from './property/TextProperty.jsx'; // svg export { default as SVG } from './svg/SVG.jsx'; diff --git a/ShadowEditor.Web/src/ui/property/DisplayProperty.jsx b/ShadowEditor.Web/src/ui/property/DisplayProperty.jsx new file mode 100644 index 00000000..92195e7e --- /dev/null +++ b/ShadowEditor.Web/src/ui/property/DisplayProperty.jsx @@ -0,0 +1,60 @@ +import './css/DisplayProperty.css'; +import classNames from 'classnames/bind'; +import PropTypes from 'prop-types'; + +/** + * 文本属性 + * @author tengge / https://github.com/tengge1 + */ +class DisplayProperty extends React.Component { + constructor(props) { + super(props); + + this.state = { + + }; + } + + handleCollapse() { + + } + + render() { + const { className, style, data } = this.props; + + return
+ {data.map((group, i) => { + return
+
+
+ +
+
{group.name}
+
+
+ {group.children.map((item, j) => { + return
+
{item.label}
+
{item.value}
+
; + })} +
+
; + })} +
; + } +} + +DisplayProperty.propTypes = { + className: PropTypes.string, + style: PropTypes.object, + data: PropTypes.array, +}; + +DisplayProperty.defaultProps = { + className: null, + style: null, + data: [], +}; + +export default DisplayProperty; \ No newline at end of file diff --git a/ShadowEditor.Web/src/ui/property/css/DisplayProperty.css b/ShadowEditor.Web/src/ui/property/css/DisplayProperty.css new file mode 100644 index 00000000..e69de29b