mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2025-04-06 21:40:23 +08:00
commit
2ebdf5772e
@ -243,7 +243,7 @@ TraitResult is the most important part of Trait. It is the return result of the
|
||||
TraitResult is an object with the following properties:
|
||||
|
||||
| Parameter name | Type | Required | Description |
|
||||
| ------------------- | ------------------------ | ---- ---- | --------------------------------------------- ------------------- |
|
||||
| ------------------- | ------------------------ | ------- | ---------- |
|
||||
| customStyle | Record<string, string> | No | Style map passed to the Component. The value of the object should be a CSS string. |
|
||||
| callbackMap | Record<string, Function> | No | Map of callback functions for Component. Mainly used for Event Trait. |
|
||||
| componentDidUnmount | Function[] | No | Lifecycle hook. Will be executed after the Component is unloaded. |
|
||||
|
@ -242,8 +242,8 @@ TraitResult 是 Trait 最重要的部分,它是 Trait 函数的返回结果,
|
||||
|
||||
TraitResult 是一个 object,属性如下:
|
||||
|
||||
| 参数名 | 类型 | 是否必须 | 说明 |
|
||||
| ------------------- | ------------------------ | -------- | ---------------------------------------------------------------- |
|
||||
| 参数名 | 类型 | 是否必须 | 说明 |
|
||||
| ------------------- | ------------------------ | -------- | ----- |
|
||||
| customStyle | Record<string, string> | 否 | 传递给 Component 的样式 Map。object 的 value 应该是 CSS 字符串。 |
|
||||
| callbackMap | Record<string, Function> | 否 | Component 的回调函数 Map。主要用于 Event Trait。 |
|
||||
| componentDidUnmount | Function[] | 否 | 生命周期钩子。将会在 Component 卸载后执行。 |
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sunmao-ui/arco-lib",
|
||||
"version": "0.3.2",
|
||||
"version": "0.3.4",
|
||||
"homepage": "https://github.com/smartxworks/sunmao-ui-arco-lib",
|
||||
"license": "Apache-2.0",
|
||||
"publishConfig": {
|
||||
@ -29,8 +29,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@arco-design/web-react": "^2.34.0",
|
||||
"@sunmao-ui/editor-sdk": "^0.3.2",
|
||||
"@sunmao-ui/shared": "^0.2.2",
|
||||
"@sunmao-ui/editor-sdk": "^0.3.4",
|
||||
"@sunmao-ui/shared": "^0.2.3",
|
||||
"react-resizable": "^3.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sunmao-ui/chakra-ui-lib",
|
||||
"version": "0.5.2",
|
||||
"version": "0.5.4",
|
||||
"description": "sunmao-ui chakra-ui library",
|
||||
"author": "sunmao-ui developers",
|
||||
"homepage": "https://github.com/smartxworks/sunmao-ui#readme",
|
||||
@ -32,7 +32,7 @@
|
||||
"@chakra-ui/icons": "^1.0.15",
|
||||
"@chakra-ui/react": "^1.7.1",
|
||||
"@emotion/styled": "^11.6.0",
|
||||
"@sunmao-ui/editor-sdk": "^0.3.2",
|
||||
"@sunmao-ui/editor-sdk": "^0.3.4",
|
||||
"chakra-react-select": "^1.3.2",
|
||||
"framer-motion": "^4"
|
||||
},
|
||||
@ -41,7 +41,7 @@
|
||||
"@babel/preset-env": "^7.15.6",
|
||||
"@babel/preset-react": "^7.14.5",
|
||||
"@babel/preset-typescript": "^7.15.0",
|
||||
"@sunmao-ui/vite-plugins": "^1.0.4",
|
||||
"@sunmao-ui/vite-plugins": "^1.0.5",
|
||||
"@testing-library/react": "^12.1.0",
|
||||
"@types/lodash": "^4.14.182",
|
||||
"@types/react": "^17.0.2",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sunmao-ui/core",
|
||||
"version": "0.7.2",
|
||||
"version": "0.7.3",
|
||||
"description": "sunmao-ui core",
|
||||
"author": "sunmao-ui developers",
|
||||
"homepage": "https://github.com/smartxworks/sunmao-ui#readme",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sunmao-ui/editor-sdk",
|
||||
"version": "0.3.2",
|
||||
"version": "0.3.4",
|
||||
"description": "The SDK for SunMao Editor",
|
||||
"author": "sunmao-ui developers",
|
||||
"homepage": "https://github.com/smartxworks/sunmao-ui#readme",
|
||||
@ -29,9 +29,9 @@
|
||||
"@emotion/css": "^11.7.1",
|
||||
"@emotion/react": "^11.1.1",
|
||||
"@sinclair/typebox": "^0.21.2",
|
||||
"@sunmao-ui/core": "^0.7.2",
|
||||
"@sunmao-ui/runtime": "^0.7.2",
|
||||
"@sunmao-ui/shared": "^0.2.2",
|
||||
"@sunmao-ui/core": "^0.7.3",
|
||||
"@sunmao-ui/runtime": "^0.7.3",
|
||||
"@sunmao-ui/shared": "^0.2.3",
|
||||
"codemirror": "^5.63.3",
|
||||
"formik": "^2.2.9",
|
||||
"framer-motion": "^4",
|
||||
|
@ -103,7 +103,7 @@ export const ModuleWidget: React.FC<WidgetProps<ModuleWidgetType>> = props => {
|
||||
title: 'Module Properties',
|
||||
}}
|
||||
path={[]}
|
||||
value={{ ...module.metadata.exampleProperties, ...value?.properties }}
|
||||
value={value?.properties}
|
||||
level={1}
|
||||
services={services}
|
||||
onChange={v => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sunmao-ui/editor",
|
||||
"version": "0.7.2",
|
||||
"version": "0.7.4",
|
||||
"description": "sunmao-ui editor",
|
||||
"author": "sunmao-ui developers",
|
||||
"homepage": "https://github.com/smartxworks/sunmao-ui#readme",
|
||||
@ -37,12 +37,12 @@
|
||||
"@emotion/css": "^11.7.1",
|
||||
"@optum/json-schema-editor": "^2.1.0",
|
||||
"@sinclair/typebox": "^0.21.2",
|
||||
"@sunmao-ui/arco-lib": "^0.3.2",
|
||||
"@sunmao-ui/chakra-ui-lib": "^0.5.2",
|
||||
"@sunmao-ui/core": "^0.7.2",
|
||||
"@sunmao-ui/editor-sdk": "^0.3.2",
|
||||
"@sunmao-ui/runtime": "^0.7.2",
|
||||
"@sunmao-ui/shared": "^0.2.2",
|
||||
"@sunmao-ui/arco-lib": "^0.3.4",
|
||||
"@sunmao-ui/chakra-ui-lib": "^0.5.4",
|
||||
"@sunmao-ui/core": "^0.7.3",
|
||||
"@sunmao-ui/editor-sdk": "^0.3.4",
|
||||
"@sunmao-ui/runtime": "^0.7.3",
|
||||
"@sunmao-ui/shared": "^0.2.3",
|
||||
"acorn": "^8.7.0",
|
||||
"acorn-loose": "^8.3.0",
|
||||
"acorn-walk": "^8.2.0",
|
||||
@ -63,7 +63,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-react": "^7.14.5",
|
||||
"@sunmao-ui/vite-plugins": "^1.0.4",
|
||||
"@sunmao-ui/vite-plugins": "^1.0.5",
|
||||
"@swc/core": "^1.2.121",
|
||||
"@types/codemirror": "^5.60.5",
|
||||
"@types/escodegen": "^0.0.7",
|
||||
|
@ -4,6 +4,7 @@ import { Accordion, Input, Text, VStack } from '@chakra-ui/react';
|
||||
import { SpecWidget } from '@sunmao-ui/editor-sdk';
|
||||
import { parseType } from '@sunmao-ui/core';
|
||||
import { generateDefaultValueFromSpec } from '@sunmao-ui/shared';
|
||||
import { css } from '@emotion/css';
|
||||
|
||||
import { EventTraitForm } from './EventTraitForm';
|
||||
import { GeneralTraitFormList } from './GeneralTraitFormList';
|
||||
@ -13,6 +14,13 @@ import { StyleTraitForm } from './StyleTraitForm';
|
||||
import { EditorServices } from '../../types';
|
||||
import { FormSection } from './FormSection';
|
||||
|
||||
// avoid the expression tip would be covered
|
||||
const ComponentFormStyle = css`
|
||||
.chakra-collapse {
|
||||
overflow: initial !important;
|
||||
}
|
||||
`;
|
||||
|
||||
type Props = {
|
||||
services: EditorServices;
|
||||
};
|
||||
@ -125,6 +133,7 @@ export const ComponentForm: React.FC<Props> = observer(props => {
|
||||
return (
|
||||
<ErrorBoundary>
|
||||
<Accordion
|
||||
className={ComponentFormStyle}
|
||||
defaultIndex={sections.map((_, i) => i)}
|
||||
background="gray.50"
|
||||
paddingBottom="200px"
|
||||
|
@ -32,6 +32,7 @@ type Props = {
|
||||
stateStore: ReturnOfInit['stateManager']['store'];
|
||||
services: EditorServices;
|
||||
libs: SunmaoLib[];
|
||||
dependencies: Record<string, any>;
|
||||
onRefresh: () => void;
|
||||
};
|
||||
|
||||
@ -45,7 +46,7 @@ const ApiFormStyle = css`
|
||||
`;
|
||||
|
||||
export const Editor: React.FC<Props> = observer(
|
||||
({ App, stateStore, services, libs, onRefresh: onRefreshApp }) => {
|
||||
({ App, stateStore, services, libs, dependencies, onRefresh: onRefreshApp }) => {
|
||||
const { editorStore } = services;
|
||||
const {
|
||||
components,
|
||||
@ -282,6 +283,7 @@ export const Editor: React.FC<Props> = observer(
|
||||
app={app}
|
||||
modules={modules}
|
||||
libs={libs}
|
||||
dependencies={dependencies}
|
||||
/>
|
||||
)}
|
||||
{codeMode && (
|
||||
|
@ -9,11 +9,18 @@ type Props = {
|
||||
app: Application;
|
||||
modules: Module[];
|
||||
libs: SunmaoLib[];
|
||||
dependencies: Record<string, any>;
|
||||
onClose: () => void;
|
||||
};
|
||||
|
||||
export const PreviewModal: React.FC<Props> = ({ app, modules, libs, onClose }) => {
|
||||
const { App, registry } = initSunmaoUI({libs});
|
||||
export const PreviewModal: React.FC<Props> = ({
|
||||
app,
|
||||
modules,
|
||||
libs,
|
||||
dependencies,
|
||||
onClose,
|
||||
}) => {
|
||||
const { App, registry } = initSunmaoUI({ libs, dependencies });
|
||||
modules.forEach(m => registry.registerModule(createModule(m)));
|
||||
|
||||
return (
|
||||
|
@ -132,6 +132,7 @@ export function initSunmaoUIEditor(props: SunmaoUIEditorProps = {}) {
|
||||
services={services}
|
||||
libs={props.runtimeProps?.libs || []}
|
||||
onRefresh={onRefresh}
|
||||
dependencies={props.runtimeProps?.dependencies || {}}
|
||||
/>
|
||||
</ChakraProvider>
|
||||
);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sunmao-ui/runtime",
|
||||
"version": "0.7.2",
|
||||
"version": "0.7.3",
|
||||
"description": "sunmao-ui runtime",
|
||||
"author": "sunmao-ui developers",
|
||||
"homepage": "https://github.com/smartxworks/sunmao-ui#readme",
|
||||
@ -31,8 +31,8 @@
|
||||
"dependencies": {
|
||||
"@emotion/css": "^11.7.1",
|
||||
"@sinclair/typebox": "^0.21.2",
|
||||
"@sunmao-ui/core": "^0.7.2",
|
||||
"@sunmao-ui/shared": "^0.2.2",
|
||||
"@sunmao-ui/core": "^0.7.3",
|
||||
"@sunmao-ui/shared": "^0.2.3",
|
||||
"@vue/reactivity": "^3.1.5",
|
||||
"@vue/shared": "^3.2.20",
|
||||
"copy-to-clipboard": "^3.3.1",
|
||||
@ -53,7 +53,7 @@
|
||||
"@babel/preset-react": "^7.14.5",
|
||||
"@babel/preset-typescript": "^7.15.0",
|
||||
"@babel/runtime": "^7.18.3",
|
||||
"@sunmao-ui/vite-plugins": "^1.0.4",
|
||||
"@sunmao-ui/vite-plugins": "^1.0.5",
|
||||
"@swc/core": "^1.2.121",
|
||||
"@testing-library/jest-dom": "^5.16.4",
|
||||
"@testing-library/react": "^12.1.0",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sunmao-ui/shared",
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"description": "The Sunmao shared lib",
|
||||
"author": "sunmao-ui developers",
|
||||
"homepage": "https://github.com/smartxworks/sunmao-ui#readme",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sunmao-ui/vite-plugin-fs",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.3",
|
||||
"description": "The vite plugin for reading and writing the sunmao schema files through the server",
|
||||
"main": "dist/index.js",
|
||||
"types": "lib/index.d.ts",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sunmao-ui/vite-plugins",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"description": "vite plugins for sunmao-ui",
|
||||
"author": "sunmao-ui developers",
|
||||
"homepage": "https://github.com/smartxworks/sunmao-ui#readme",
|
||||
|
Loading…
x
Reference in New Issue
Block a user