@brushes/component-core 0.0.31 → 0.0.32
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/dist/basic-component/container/index.d.ts +23 -0
- package/dist/basic-component/default/index.d.ts +8 -0
- package/dist/basic-component/empty/index.d.ts +4 -0
- package/dist/basic-component/index.d.ts +3 -0
- package/dist/basic-component/resizer/index.d.ts +0 -0
- package/dist/basic-component/resizer/numToMeasurement.d.ts +7 -0
- package/dist/components/code.d.ts +5 -0
- package/dist/components/image.d.ts +5 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/context/index.d.ts +6 -0
- package/dist/index.d.ts +7 -0
- package/dist/setting/basic.d.ts +7 -0
- package/dist/setting/index.d.ts +1 -0
- package/dist/setting/title.d.ts +4 -0
- package/dist/store/commonModule.d.ts +5 -0
- package/dist/store/commonStore.d.ts +56 -0
- package/dist/store/index.d.ts +2 -0
- package/dist/store/rootModule.d.ts +5 -0
- package/dist/store/rootStore.d.ts +35 -0
- package/dist/store/storeDataConfig.d.ts +0 -0
- package/dist/tool/combine.d.ts +1 -0
- package/dist/tool/fullpath.d.ts +1 -0
- package/dist/tool/index.d.ts +2 -0
- package/package.json +2 -2
- package/src/basic-component/container/index.tsx +228 -0
- package/src/basic-component/default/index.tsx +55 -0
- package/src/basic-component/empty/index.tsx +24 -0
- package/src/basic-component/index.tsx +4 -0
- package/src/basic-component/resizer/index.tsx +270 -0
- package/src/basic-component/resizer/numToMeasurement.ts +26 -0
- package/src/components/code.tsx +60 -0
- package/src/components/image.tsx +78 -0
- package/src/components/index.ts +2 -0
- package/src/context/index.tsx +10 -0
- package/src/index.ts +7 -0
- package/src/setting/basic.tsx +91 -0
- package/src/setting/index.ts +1 -0
- package/src/setting/title.tsx +14 -0
- package/src/store/commonModule.tsx +37 -0
- package/src/store/commonStore.tsx +103 -0
- package/src/store/index.tsx +2 -0
- package/src/store/rootModule.tsx +24 -0
- package/src/store/rootStore.tsx +56 -0
- package/src/store/storeDataConfig.tsx +50 -0
- package/src/tool/combine.ts +11 -0
- package/src/tool/fullpath.ts +13 -0
- package/src/tool/index.tsx +2 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare const Inner: ({ children, enabled, root, text }: {
|
|
3
|
+
text?: string;
|
|
4
|
+
root?: boolean;
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const IsShowContainer: ({ moduleShowValue, rootKey, isRevert, children, routerIsShowValue, routerIsShow, moduleIsShow, padding, storeKey, margin }: {
|
|
9
|
+
isRevert?: boolean;
|
|
10
|
+
routerIsShowValue?: string;
|
|
11
|
+
rootKey?: string;
|
|
12
|
+
moduleShowValue?: string;
|
|
13
|
+
moduleIsShow?: string;
|
|
14
|
+
routerIsShow?: string;
|
|
15
|
+
storeKey: string;
|
|
16
|
+
padding: object;
|
|
17
|
+
margin: object;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
20
|
+
export declare const Container: ({ width, text, children, background, margin, positionValue, padding, backgroundImage, position, $$_actions, $_actions, borderColor, ...props }: any) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const OutContainerComponent: ({ width, api, params, children, background, padding, backgroundImage, ...props }: any) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const OutContainer: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const ContainerWrap: ({ width, background, children, backgroundImage, height, $$_style, $_style, ...props }: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const DefaultJsx: ({ text, root }: {
|
|
2
|
+
text?: string;
|
|
3
|
+
root?: boolean;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const DefaultEditorBg: ({ content, color }: {
|
|
6
|
+
content?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const isPercentage: (val: string) => boolean;
|
|
2
|
+
export declare const percentToPx: (value: any, comparativeValue: number) => any;
|
|
3
|
+
export declare const pxToPercent: (value: any, comparativeValue: number) => number;
|
|
4
|
+
export declare const getElementDimensions: (element: HTMLElement) => {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FieldType } from '@brushes/form';
|
|
2
|
+
export type formConfigType = {
|
|
3
|
+
title?: string;
|
|
4
|
+
formFields: FieldType[];
|
|
5
|
+
};
|
|
6
|
+
export type LayoutType = 'horizontal' | 'vertical' | 'inline';
|
|
7
|
+
export declare const basicSettings: (formFields: formConfigType[], layout?: LayoutType) => () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './basic';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ModuleState, moduleStore } from './commonStore';
|
|
2
|
+
type ModuleProviderProps = React.PropsWithChildren<Partial<moduleStore>>;
|
|
3
|
+
export { initialValueOrder } from './commonStore';
|
|
4
|
+
export declare function ModuleProvider({ children, ...props }: ModuleProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function useModuleContext<T>(selector: (state: ModuleState) => T): T;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const goodListIntialValue: {
|
|
2
|
+
dataPic: string;
|
|
3
|
+
goodsName: string;
|
|
4
|
+
goodsCamount: number;
|
|
5
|
+
skuName: string;
|
|
6
|
+
pricesetNprice: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const initialValueOrder: {
|
|
9
|
+
contractSettlOpno: number;
|
|
10
|
+
upmMap: {};
|
|
11
|
+
rebMoney: number;
|
|
12
|
+
goodsCamount: number;
|
|
13
|
+
shoppingCountPrice: number;
|
|
14
|
+
totalDiscountPrice: number;
|
|
15
|
+
accountsSumPrice: number;
|
|
16
|
+
discount: number;
|
|
17
|
+
freight: number;
|
|
18
|
+
comDisMoney: number;
|
|
19
|
+
copyComDisMoney: number;
|
|
20
|
+
shoppingType: string;
|
|
21
|
+
promotionCode: string;
|
|
22
|
+
promotionCodes: string;
|
|
23
|
+
};
|
|
24
|
+
export type addressInfo = {
|
|
25
|
+
freight: number;
|
|
26
|
+
goodsReceiptMem: string;
|
|
27
|
+
goodsReceiptPhone: string;
|
|
28
|
+
goodsReceiptArrdess: string;
|
|
29
|
+
areaCode: string;
|
|
30
|
+
};
|
|
31
|
+
export type moduleType = {
|
|
32
|
+
[v: string]: any;
|
|
33
|
+
_ocPoints: Array<any>;
|
|
34
|
+
_ocDiscount: Array<any>;
|
|
35
|
+
_orderAddressInfo: addressInfo;
|
|
36
|
+
_couponList: [];
|
|
37
|
+
_selectCoupon: [];
|
|
38
|
+
_shoppingList: Array<any>;
|
|
39
|
+
_contractGoodsList: Array<typeof goodListIntialValue>;
|
|
40
|
+
_orderDomainStr: Array<typeof initialValueOrder>;
|
|
41
|
+
_ocContractSettlList: Array<any>;
|
|
42
|
+
open?: boolean;
|
|
43
|
+
defaultValue?: object;
|
|
44
|
+
goodNum?: number;
|
|
45
|
+
_skuInfo?: object;
|
|
46
|
+
params?: object;
|
|
47
|
+
breadList?: [];
|
|
48
|
+
};
|
|
49
|
+
export interface moduleStore {
|
|
50
|
+
moduleStore: moduleType;
|
|
51
|
+
}
|
|
52
|
+
export interface ModuleState extends moduleStore {
|
|
53
|
+
setModuleStore: (e: Partial<moduleType>) => void;
|
|
54
|
+
}
|
|
55
|
+
export type ModuleStore = ReturnType<typeof createModuleStore>;
|
|
56
|
+
export declare const createModuleStore: (initProps?: Partial<moduleStore>) => import("zustand").StoreApi<ModuleState>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ModuleRootState, moduleRootStore } from './rootStore';
|
|
2
|
+
type ModuleProviderProps = React.PropsWithChildren<Partial<moduleRootStore>>;
|
|
3
|
+
export declare function ModuleRootProvider({ children, ...props }: ModuleProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function useModuleRootContext<T>(selector: (state: ModuleRootState) => T): T;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type moduleType = {
|
|
2
|
+
[v: string]: any;
|
|
3
|
+
_historyList: Array<any>;
|
|
4
|
+
_themeColor: {
|
|
5
|
+
colorPrimary: string;
|
|
6
|
+
colorBgTextHover: string;
|
|
7
|
+
};
|
|
8
|
+
_orderCount: {
|
|
9
|
+
[v: string]: string | number;
|
|
10
|
+
};
|
|
11
|
+
_userInfo: {
|
|
12
|
+
[v: string]: any;
|
|
13
|
+
};
|
|
14
|
+
_cart: number;
|
|
15
|
+
};
|
|
16
|
+
export interface moduleRootStore {
|
|
17
|
+
rootStore: moduleType;
|
|
18
|
+
}
|
|
19
|
+
export interface ModuleRootState extends moduleRootStore {
|
|
20
|
+
setModuleRootStore: (e: Partial<moduleType>) => void;
|
|
21
|
+
}
|
|
22
|
+
export type ModuleRootStore = ReturnType<typeof createRootModuleStore>;
|
|
23
|
+
export declare const createRootModuleStore: (initProps?: Partial<moduleRootStore>) => Omit<import("zustand").StoreApi<ModuleRootState>, "setState" | "persist"> & {
|
|
24
|
+
setState(partial: ModuleRootState | Partial<ModuleRootState> | ((state: ModuleRootState) => ModuleRootState | Partial<ModuleRootState>), replace?: false | undefined): unknown;
|
|
25
|
+
setState(state: ModuleRootState | ((state: ModuleRootState) => ModuleRootState), replace: true): unknown;
|
|
26
|
+
persist: {
|
|
27
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<ModuleRootState, unknown, unknown>>) => void;
|
|
28
|
+
clearStorage: () => void;
|
|
29
|
+
rehydrate: () => Promise<void> | void;
|
|
30
|
+
hasHydrated: () => boolean;
|
|
31
|
+
onHydrate: (fn: (state: ModuleRootState) => void) => () => void;
|
|
32
|
+
onFinishHydration: (fn: (state: ModuleRootState) => void) => () => void;
|
|
33
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<ModuleRootState, unknown, unknown>>;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function combine(array: Array<any>): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fullpath: (str?: string) => string;
|
package/package.json
CHANGED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { ReactNode, useMemo } from 'react';
|
|
2
|
+
import { DefaultJsx } from '../default';
|
|
3
|
+
import { fullpath } from '../../tool';
|
|
4
|
+
import { createStyles } from 'antd-style';
|
|
5
|
+
import { useEditor, useNode } from '@craftjs/core';
|
|
6
|
+
import { ModuleProvider, useModuleContext, useModuleRootContext } from '../../store';
|
|
7
|
+
import { useSearchParams } from 'react-router-dom';
|
|
8
|
+
import { isEmpty, isUndefined, get } from 'lodash';
|
|
9
|
+
|
|
10
|
+
const useStyles = createStyles(({ token, css }) => {
|
|
11
|
+
return {
|
|
12
|
+
category: css`
|
|
13
|
+
&:hover {
|
|
14
|
+
box-shadow: 0 1px 5px 1px rgba(0, 0, 0, 0.1);
|
|
15
|
+
}
|
|
16
|
+
`,
|
|
17
|
+
width_100: css`
|
|
18
|
+
width: 100%;
|
|
19
|
+
`
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
export const Inner = ({ children, enabled, root, text }: { text?: string; root?: boolean; enabled: boolean; children: ReactNode }) => {
|
|
23
|
+
return <>{children ? children : enabled ? <DefaultJsx text={text} root={root} /> : ''}</>;
|
|
24
|
+
};
|
|
25
|
+
export const IsShowContainer = ({
|
|
26
|
+
moduleShowValue,
|
|
27
|
+
rootKey = '',
|
|
28
|
+
isRevert = false,
|
|
29
|
+
children,
|
|
30
|
+
routerIsShowValue,
|
|
31
|
+
routerIsShow,
|
|
32
|
+
moduleIsShow = '',
|
|
33
|
+
padding,
|
|
34
|
+
storeKey = '',
|
|
35
|
+
margin
|
|
36
|
+
}: {
|
|
37
|
+
isRevert?: boolean;
|
|
38
|
+
routerIsShowValue?: string;
|
|
39
|
+
rootKey?: string;
|
|
40
|
+
moduleShowValue?: string;
|
|
41
|
+
moduleIsShow?: string;
|
|
42
|
+
routerIsShow?: string;
|
|
43
|
+
storeKey: string;
|
|
44
|
+
padding: object;
|
|
45
|
+
margin: object;
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
}) => {
|
|
48
|
+
const store = useModuleContext((s) => s.moduleStore[storeKey]);
|
|
49
|
+
const rootStore = useModuleRootContext((s) => s.rootStore[rootKey]);
|
|
50
|
+
|
|
51
|
+
const { enabled } = useEditor((state) => ({
|
|
52
|
+
enabled: state.options.enabled
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
const {
|
|
56
|
+
connectors: { connect, drag }
|
|
57
|
+
} = useNode();
|
|
58
|
+
|
|
59
|
+
let [searchParams] = useSearchParams();
|
|
60
|
+
|
|
61
|
+
const nValue = useMemo(() => {
|
|
62
|
+
if (storeKey && store) {
|
|
63
|
+
if (typeof store[moduleIsShow] === 'number') {
|
|
64
|
+
return get(store, moduleIsShow) + '';
|
|
65
|
+
}
|
|
66
|
+
return get(store, moduleIsShow);
|
|
67
|
+
}
|
|
68
|
+
}, [store, storeKey, moduleIsShow]);
|
|
69
|
+
|
|
70
|
+
const rnValue = useMemo(() => {
|
|
71
|
+
if (rootKey && rootStore) {
|
|
72
|
+
if (typeof rootStore[moduleIsShow] === 'number') {
|
|
73
|
+
return get(rootStore, moduleIsShow) + '';
|
|
74
|
+
}
|
|
75
|
+
return get(rootStore, moduleIsShow);
|
|
76
|
+
}
|
|
77
|
+
}, [rootStore, rootKey, moduleIsShow]);
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 1: 路由是否包含
|
|
81
|
+
* 2: 路由是否包含 值是否匹配
|
|
82
|
+
* 3: store显示条件Key和value都为空, store是否为空
|
|
83
|
+
* 4: store显示条件Key不为空 store显示条件value为空, store里面的key的值是否空
|
|
84
|
+
* 5: store显示条件Key和store显示条件value都不为空, store里面的key的值和 显示条件value是否匹配
|
|
85
|
+
* 6: 全局Store显示条件Key和value都为空, 全局Store是否为空
|
|
86
|
+
* 7: 全局Store显示条件Key和显示条件value都不为空, 全局Store里面的key的值和 显示条件value是否匹配
|
|
87
|
+
* 8: 全局store显示条件Key不为空 store显示条件value为空, 全局store里面的key的值是否空
|
|
88
|
+
*/
|
|
89
|
+
const conditionType = useMemo(() => {
|
|
90
|
+
const condition =
|
|
91
|
+
(routerIsShow && searchParams.has(routerIsShow) && !routerIsShowValue) || // 1
|
|
92
|
+
(routerIsShow && searchParams.has(routerIsShow) && routerIsShowValue && routerIsShowValue.split(',').includes(searchParams.get(routerIsShow) || '')) || // 2
|
|
93
|
+
(storeKey && !moduleShowValue && !moduleIsShow && !isUndefined(store) && !isEmpty(store)) || // 3
|
|
94
|
+
(moduleIsShow && storeKey && !moduleShowValue && !isUndefined(nValue) && !isEmpty(nValue)) || // 4
|
|
95
|
+
(moduleShowValue && storeKey && moduleIsShow && moduleShowValue.split(',').includes(nValue + '')) || // 5
|
|
96
|
+
(rootKey && !moduleShowValue && !moduleIsShow && !isUndefined(rootStore) && !isEmpty(rootStore)) || // 6
|
|
97
|
+
(moduleIsShow && rootKey && !moduleShowValue && !isUndefined(rnValue) && !isEmpty(rnValue)) || // 7
|
|
98
|
+
(moduleShowValue && rootKey && moduleIsShow && moduleShowValue.split(',').includes(rnValue + '')); // 8
|
|
99
|
+
|
|
100
|
+
return isRevert ? !condition : condition;
|
|
101
|
+
}, [routerIsShow, routerIsShowValue, isRevert, store, storeKey, moduleShowValue, moduleIsShow, nValue, rootKey, rootStore, rnValue]);
|
|
102
|
+
|
|
103
|
+
if (conditionType || enabled) {
|
|
104
|
+
return (
|
|
105
|
+
<div
|
|
106
|
+
style={{
|
|
107
|
+
...margin,
|
|
108
|
+
...padding
|
|
109
|
+
}}
|
|
110
|
+
ref={(ref: HTMLDivElement) => connect(drag(ref))}
|
|
111
|
+
>
|
|
112
|
+
<Inner enabled={enabled}>{children}</Inner>
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const Container = ({ width, text, children, background, margin = {}, positionValue = {}, padding = {}, backgroundImage, position, $$_actions, $_actions, borderColor, ...props }: any) => {
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
const { styles } = useStyles();
|
|
121
|
+
const { enabled } = useEditor((state) => ({
|
|
122
|
+
enabled: state.options.enabled
|
|
123
|
+
}));
|
|
124
|
+
//为了右边贴边位置特殊处理
|
|
125
|
+
const positionNewValue = useMemo(() => {
|
|
126
|
+
if (position === 'fixed' && positionValue.right === 0 && enabled) {
|
|
127
|
+
return {
|
|
128
|
+
...positionValue,
|
|
129
|
+
right: 412
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (position === 'fixed' && positionValue.left === 0 && enabled) {
|
|
133
|
+
return {
|
|
134
|
+
...positionValue,
|
|
135
|
+
left: 172
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
return positionValue;
|
|
139
|
+
}, [positionValue, position]);
|
|
140
|
+
const {
|
|
141
|
+
connectors: { connect, drag }
|
|
142
|
+
} = useNode();
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<div
|
|
146
|
+
className={enabled ? styles.category : ''}
|
|
147
|
+
ref={(ref: HTMLDivElement) => connect(drag(ref))}
|
|
148
|
+
style={{
|
|
149
|
+
...margin,
|
|
150
|
+
display: 'flex',
|
|
151
|
+
boxSizing: 'border-box',
|
|
152
|
+
position,
|
|
153
|
+
border: `solid 1px ${borderColor}`,
|
|
154
|
+
...padding,
|
|
155
|
+
...props,
|
|
156
|
+
...positionNewValue,
|
|
157
|
+
background: backgroundImage ? `url(${fullpath(backgroundImage)}) repeat-x center 0` : background,
|
|
158
|
+
width: (width + '').includes('%') ? width : `${width}px`
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
<Inner text={text} enabled={enabled}>
|
|
162
|
+
{children}
|
|
163
|
+
</Inner>
|
|
164
|
+
</div>
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const OutContainerComponent = ({ width, api, params, children, background, padding = {}, backgroundImage, ...props }: any) => {
|
|
169
|
+
const { enabled } = useEditor((state) => ({
|
|
170
|
+
enabled: state.options.enabled
|
|
171
|
+
}));
|
|
172
|
+
|
|
173
|
+
const {
|
|
174
|
+
connectors: { connect, drag }
|
|
175
|
+
} = useNode();
|
|
176
|
+
|
|
177
|
+
const { styles } = useStyles();
|
|
178
|
+
return (
|
|
179
|
+
<div
|
|
180
|
+
ref={(ref: HTMLDivElement) => connect(drag(ref))}
|
|
181
|
+
className={enabled ? styles.category : ''}
|
|
182
|
+
style={{
|
|
183
|
+
margin: '0 auto',
|
|
184
|
+
display: 'flex',
|
|
185
|
+
boxSizing: 'border-box',
|
|
186
|
+
...padding,
|
|
187
|
+
...props,
|
|
188
|
+
background: backgroundImage ? `url(${fullpath(backgroundImage)}) repeat-x center 0` : background,
|
|
189
|
+
width: (width + '').includes('%') ? width : `${width}px`
|
|
190
|
+
}}
|
|
191
|
+
>
|
|
192
|
+
<Inner enabled={enabled}>{children}</Inner>
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export const OutContainer = (props: any) => {
|
|
198
|
+
return (
|
|
199
|
+
<ModuleProvider>
|
|
200
|
+
<OutContainerComponent {...props} />
|
|
201
|
+
</ModuleProvider>
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
export const ContainerWrap = ({ width, background, children, backgroundImage, height, $$_style = '', $_style = '', ...props }: any) => {
|
|
205
|
+
const {
|
|
206
|
+
connectors: { connect, drag }
|
|
207
|
+
} = useNode();
|
|
208
|
+
|
|
209
|
+
const { enabled } = useEditor((state) => ({
|
|
210
|
+
enabled: state.options.enabled
|
|
211
|
+
}));
|
|
212
|
+
return (
|
|
213
|
+
<div
|
|
214
|
+
{...props}
|
|
215
|
+
ref={(ref: HTMLDivElement) => connect(drag(ref))}
|
|
216
|
+
style={{
|
|
217
|
+
width,
|
|
218
|
+
paddingBottom: 5,
|
|
219
|
+
background: backgroundImage ? `url(${fullpath(backgroundImage)}) repeat-x center 0` : background,
|
|
220
|
+
minHeight: `calc(${height}vh - 110px)`
|
|
221
|
+
}}
|
|
222
|
+
>
|
|
223
|
+
<Inner root={true} enabled={enabled}>
|
|
224
|
+
{children}
|
|
225
|
+
</Inner>
|
|
226
|
+
</div>
|
|
227
|
+
);
|
|
228
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { QjIcon } from '@brushes/share-resource';
|
|
2
|
+
import { Watermark } from 'antd';
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
|
|
5
|
+
const useStyle = createStyles(({ token, css }) => {
|
|
6
|
+
return {
|
|
7
|
+
defaultWrap: css`
|
|
8
|
+
border: dashed 1px rgba(0, 0, 0, 0.15);
|
|
9
|
+
width: 100%;
|
|
10
|
+
text-align: center;
|
|
11
|
+
border-radius: ${token.borderRadius}px;
|
|
12
|
+
height: 100%;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
align-items: center;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
color: ${token.colorTextLabel};
|
|
18
|
+
p {
|
|
19
|
+
margin-top: 10px;
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
}
|
|
22
|
+
}`
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const DefaultJsx = ({ text = '内容放置区域', root }: { text?: string; root?: boolean }) => {
|
|
27
|
+
const { styles } = useStyle();
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
className={styles.defaultWrap}
|
|
31
|
+
style={{
|
|
32
|
+
minHeight: root ? `calc(100vh - 110px)` : 'auto'
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<QjIcon
|
|
36
|
+
style={{
|
|
37
|
+
fontSize: 50,
|
|
38
|
+
fontWeight: 500,
|
|
39
|
+
display: 'block',
|
|
40
|
+
color: '#bbb'
|
|
41
|
+
}}
|
|
42
|
+
name={'icon-computer'}
|
|
43
|
+
></QjIcon>
|
|
44
|
+
<p>{text}</p>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const DefaultEditorBg = ({ content = '/', color = 'blue' }: { content?: string; color?: string }) => {
|
|
50
|
+
return (
|
|
51
|
+
<Watermark gap={[1, 1]} font={{ color }} rotate={0} height={10} width={10} content={content}>
|
|
52
|
+
<div style={{ height: 10 }} />
|
|
53
|
+
</Watermark>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Typography } from 'antd';
|
|
2
|
+
|
|
3
|
+
export const SlotEmpty: React.FC<{
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
borderColor?: string;
|
|
6
|
+
}> = ({ children = '当前为插槽容器,可以自定义组件代码。', borderColor = 'rgba(0, 0, 0, 0.1)' }) => {
|
|
7
|
+
return (
|
|
8
|
+
<div
|
|
9
|
+
style={{
|
|
10
|
+
height: '100%',
|
|
11
|
+
width: '100%',
|
|
12
|
+
borderColor,
|
|
13
|
+
borderWidth: 1,
|
|
14
|
+
borderStyle: 'dashed',
|
|
15
|
+
fontSize: 12,
|
|
16
|
+
textAlign: 'center',
|
|
17
|
+
fontWeight: 'normal',
|
|
18
|
+
background: 'rgba(255,255,255, 0.2)'
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<Typography.Text type="secondary">{children}</Typography.Text>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|