update 0.9.2

This commit is contained in:
yehuozhili
2021-09-28 22:36:03 +08:00
parent 464fef69c9
commit 02337bae3c
14 changed files with 199 additions and 39 deletions

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-07-07 14:51:17
* @LastEditors: yehuozhili
* @LastEditTime: 2021-09-27 21:44:56
* @LastEditTime: 2021-09-28 16:33:32
* @FilePath: \dooringx\packages\dooringx-example\src\layouts\index.tsx
*/
import { Button } from 'antd';
@@ -19,7 +19,7 @@ import { locale } from 'dooringx-lib';
import { localeKey } from '../../../dooringx-lib/dist/locale';
export const config = new UserConfig(plugin);
export const configContext = createContext<UserConfig>(config);
config.i18n = false;
//config.i18n = false;
// 自定义右键
const contextMenuState = config.getContextMenuState();
const unmountContextMenu = contextMenuState.unmountContextMenu;
@@ -84,12 +84,12 @@ export const LocaleContext = createContext<LocaleContextType>({
export default function Layout({ children }: IRouteComponentProps) {
const [l, setLocale] = useState<localeKey>('zh-CN');
// return (
// <LocaleContext.Provider value={{ change: setLocale, current: l }}>
// <IntlProvider messages={locale.localeMap[l]} locale={l} defaultLocale={l}>
// <configContext.Provider value={config}>{children}</configContext.Provider>
// </IntlProvider>
// </LocaleContext.Provider>
// );
return (
<LocaleContext.Provider value={{ change: setLocale, current: l }}>
<IntlProvider messages={locale.localeMap[l]} locale={l} defaultLocale={l}>
<configContext.Provider value={config}>{children}</configContext.Provider>
</IntlProvider>
</LocaleContext.Provider>
);
return <configContext.Provider value={config}>{children}</configContext.Provider>;
}

View File

@@ -0,0 +1,19 @@
<!--
* @Author: yehuozhili
* @Date: 2021-09-28 21:10:15
* @LastEditors: yehuozhili
* @LastEditTime: 2021-09-28 21:11:22
* @FilePath: \dooringx\packages\dooringx-example\src\pages\document.ejs
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dooringx-example</title>
</head>
<script src="https://unpkg.com/react@17.0.1/umd/react.production.min.js"></script>
<body>
</body>
</html>

View File

@@ -2,7 +2,7 @@
* @Author: yehuozhili
* @Date: 2021-05-15 12:49:28
* @LastEditors: yehuozhili
* @LastEditTime: 2021-08-27 16:24:39
* @LastEditTime: 2021-09-28 21:58:21
* @FilePath: \dooringx\packages\dooringx-example\src\pages\index.tsx
*/
import {
@@ -15,12 +15,13 @@ import {
Control,
} from 'dooringx-lib';
import { InsertRowBelowOutlined } from '@ant-design/icons';
import { useContext } from 'react';
import { useContext, useState } from 'react';
import { configContext, LocaleContext } from '@/layouts';
import { useCallback } from 'react';
import { PREVIEWSTATE } from '@/constant';
import { Button, Popover } from 'antd';
import { Button, Input, Popover } from 'antd';
import { localeKey } from '../../../dooringx-lib/dist/locale';
import { LeftRegistComponentMapItem } from 'dooringx-lib/dist/core/crossDrag';
export const HeaderHeight = '40px';
const footerConfig = function () {
@@ -45,6 +46,9 @@ export default function IndexPage() {
}, [config]);
const [state] = useStoreState(config, subscribeFn, everyFn);
const [value, setValue] = useState('');
return (
<div {...innerContainerDragUp(config)}>
<div style={{ height: HeaderHeight }}>
@@ -71,6 +75,22 @@ export default function IndexPage() {
>
</Button>
<Input
style={{ width: 200 }}
value={value}
onChange={(e) => setValue(e.target.value)}
></Input>
<Button
onClick={() => {
const leftprops: Partial<LeftRegistComponentMapItem> = {
type: 'basic',
img: 'https://img.guguzhu.com/d/file/android/ico/2021/09/08/rytzi2w34tm.png',
};
config.scriptSingleLoad(value, leftprops);
}}
>
</Button>
</div>
<div
style={{