update 0.15.2

This commit is contained in:
yehuozhili
2022-04-29 23:43:03 +08:00
parent 7ae87f157e
commit 8ccf5289e5
15 changed files with 113 additions and 55 deletions

View File

@@ -180,8 +180,6 @@ function Blocks(props: PropsWithChildren<BlockProps>) {
<div
style={{
pointerEvents: 'none',
width: '100%',
height: '100%',
...animationEdit,
}}
>
@@ -205,21 +203,37 @@ function Blocks(props: PropsWithChildren<BlockProps>) {
</div>
);
} else {
const style = {
position: props.data.fixed ? 'fixed' : props.data.position,
top: previewState.top,
left: previewState.left,
width: previewState.width,
height: previewState.height,
zIndex: props.data.zIndex,
display: props.data.display,
transform: `rotate(${props.data.rotate.value}deg)`,
};
return (
<div
style={{
position: props.data.fixed ? 'fixed' : props.data.position,
top: previewState.top,
left: previewState.left,
width: previewState.width,
height: previewState.height,
zIndex: props.data.zIndex,
display: props.data.display,
transform: `rotate(${props.data.rotate.value}deg)`,
}}
>
<div style={{ ...animateProps }}>{state}</div>
</div>
<>
{/* 绝对定位元素 */}
{props.data.position !== 'static' && (
<div style={style}>
<div style={{ ...animateProps }}>{state}</div>
</div>
)}
{/* 静态定位 非行内 这里暂不考虑布局影响 */}
{props.data.position === 'static' && props.data.display !== 'inline' && (
<div style={style}>
<div style={{ ...animateProps }}>{state}</div>
</div>
)}
{/* 静态定位 行内 这里暂不考虑布局影响 */}
{props.data.position === 'static' && props.data.display === 'inline' && (
<span style={style}>
<span style={{ ...animateProps }}>{state}</span>
</span>
)}
</>
);
}
}, [

View File

@@ -78,6 +78,8 @@ function Container(props: PropsWithChildren<ContainerProps>) {
position: 'relative',
overflow: props.config.containerOverFlow ? 'hidden' : 'visible',
cursor: 'default',
lineHeight: props.state.globalState?.lineHeight ?? 1.575,
fontSize: props.state.globalState?.fontSize ?? 14,
...editContainerStyle,
}}
{...(props.context === 'edit' ? containerDragResolve(props.config) : null)}
@@ -129,6 +131,8 @@ function Container(props: PropsWithChildren<ContainerProps>) {
overflow: 'hidden',
backgroundColor: bgColor(),
transform: transform,
lineHeight: props.state.globalState?.lineHeight ?? 1.575,
fontSize: props.state.globalState?.fontSize ?? 14,
...previewContainerStyle,
}}
>

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-03-14 05:42:13
* @LastEditors: yehuozhili
* @LastEditTime: 2022-04-23 18:12:53
* @LastEditTime: 2022-04-29 23:36:45
* @FilePath: \dooringx\packages\dooringx-lib\src\components\rightConfig.tsx
*/
import { CreateOptionsRes } from '../core/components/formTypes';
@@ -21,6 +21,12 @@ const colStyle: CSSProperties = {
alignItems: 'center',
justifyContent: 'flex-end',
};
const titletStyle: CSSProperties = {
display: 'flex',
alignItems: 'center',
userSelect: 'none',
height: 32,
};
interface RightConfigProps {
state: IStoreData;
config: UserConfig;
@@ -156,7 +162,7 @@ function RightConfig(props: PropsWithChildren<RightConfigProps>) {
{replaceLocale('right.global', '全局设置', props.config)}
</Row>
<Row style={{ padding: '10px 0' }}>
<Col span={6} style={{ userSelect: 'none' }}>
<Col span={6} style={{ ...titletStyle }}>
{replaceLocale('title', '标题', props.config)}
</Col>
<Col span={18} style={colStyle}>
@@ -173,7 +179,7 @@ function RightConfig(props: PropsWithChildren<RightConfigProps>) {
</Col>
</Row>
<Row style={{ padding: '10px 0' }}>
<Col span={6} style={{ userSelect: 'none' }}>
<Col span={6} style={{ ...titletStyle }}>
{replaceLocale('right.containerheight', '容器高度', props.config)}
</Col>
<Col span={18} style={colStyle}>
@@ -190,7 +196,7 @@ function RightConfig(props: PropsWithChildren<RightConfigProps>) {
</Col>
</Row>
<Row style={{ padding: '10px 0' }}>
<Col span={6} style={{ userSelect: 'none' }}>
<Col span={6} style={{ ...titletStyle }}>
{replaceLocale('right.containerColor', '容器底色', props.config)}
</Col>
<Col span={18} style={colStyle}>
@@ -205,7 +211,7 @@ function RightConfig(props: PropsWithChildren<RightConfigProps>) {
</Col>
</Row>
<Row style={{ padding: '10px 0' }}>
<Col span={6} style={{ userSelect: 'none' }}>
<Col span={6} style={{ ...titletStyle }}>
{replaceLocale('right.bodyColor', 'body底色', props.config)}
</Col>
<Col span={18} style={colStyle}>
@@ -219,6 +225,41 @@ function RightConfig(props: PropsWithChildren<RightConfigProps>) {
></ColorPicker>
</Col>
</Row>
<Row style={{ padding: '10px 0' }}>
<Col span={6} style={{ ...titletStyle }}>
{replaceLocale('right.lineHeight', '容器行高', props.config)}
</Col>
<Col span={18} style={colStyle}>
<InputNumber
min={0}
step="0.1"
value={props.config.getStore().getData().globalState?.lineHeight ?? 1.575}
onChange={(e) => {
const val = e;
const originData = deepcopy(props.config.getStore().getData());
originData.globalState.lineHeight = val;
props.config.getStore().setData(originData);
}}
/>
</Col>
</Row>
<Row style={{ padding: '10px 0' }}>
<Col span={6} style={{ ...titletStyle }}>
{replaceLocale('right.fontSize', '容器字号', props.config)}
</Col>
<Col span={18} style={colStyle}>
<InputNumber
min={0}
value={props.config.getStore().getData().globalState?.fontSize ?? 14}
onChange={(e) => {
const val = e;
const originData = deepcopy(props.config.getStore().getData());
originData.globalState.fontSize = val;
props.config.getStore().setData(originData);
}}
/>
</Col>
</Row>
{props.globalExtra && props.globalExtra}
</div>
)}
@@ -229,7 +270,7 @@ function RightConfig(props: PropsWithChildren<RightConfigProps>) {
{replaceLocale('modal.control', '弹窗配置', props.config)}
</Row>
<Row style={{ padding: '10px 0' }}>
<Col span={8}>
<Col span={8} style={{ ...titletStyle }}>
{replaceLocale('modal.control.remove', '取消点击删除弹窗', props.config)}
</Col>
<Col span={16} style={{ ...colStyle }}>

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-02-25 21:16:58
* @LastEditors: yehuozhili
* @LastEditTime: 2022-04-23 23:03:56
* @LastEditTime: 2022-04-29 23:23:42
* @FilePath: \dooringx\packages\dooringx-lib\src\config\index.tsx
*/
import React from 'react';
@@ -174,6 +174,8 @@ export const defaultStore: IMainStoreData = {
bodyColor: 'rgba(255,255,255,1)',
script: [],
customAnimate: [],
lineHeight: 1.575,
fontSize: 14,
},
modalConfig: {},
modalEditName: '',

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-03-14 04:29:09
* @LastEditors: yehuozhili
* @LastEditTime: 2022-04-23 17:07:19
* @LastEditTime: 2022-04-29 23:15:50
* @FilePath: \dooringx\packages\dooringx-lib\src\core\store\storetype.ts
*/
@@ -15,6 +15,8 @@ export interface GlobalState {
title: string;
bodyColor: string;
script: string[];
lineHeight: number;
fontSize: number;
}
export interface IStoreData {

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-08-27 10:20:23
* @LastEditors: yehuozhili
* @LastEditTime: 2022-04-23 18:58:39
* @LastEditTime: 2022-04-29 23:23:13
* @FilePath: \dooringx\packages\dooringx-lib\src\locale\en.ts
*/
@@ -38,6 +38,8 @@ export const en: typeof zhCN = {
'right.containerheight': 'Container height',
'right.containerColor': 'Container background color',
'right.bodyColor': 'Body background color',
'right.fontSize': 'Container font size',
'right.lineHeight': 'Container line height',
title: 'Title',
'system.setting': 'System Settings',
'settings.openabsorb': 'Turn on adsorption',

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-08-27 10:20:15
* @LastEditors: yehuozhili
* @LastEditTime: 2022-04-23 18:58:26
* @LastEditTime: 2022-04-29 23:19:30
* @FilePath: \dooringx\packages\dooringx-lib\src\locale\zh-CN.ts
*/
export const zhCN = {
@@ -35,6 +35,8 @@ export const zhCN = {
'right.containerheight': '容器高度',
'right.containerColor': '容器底色',
'right.bodyColor': 'body底色',
'right.fontSize': '容器字号',
'right.lineHeight': '容器行高',
title: '标题',
'system.setting': '系统设置',
'settings.openabsorb': '开启吸附',