Skip to content

Commit

Permalink
feat: schema-builder 新增 methods 方法
Browse files Browse the repository at this point in the history
  • Loading branch information
lhbxs committed Nov 13, 2023
1 parent 671d780 commit f5530a6
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
8 changes: 2 additions & 6 deletions tools/schema-builder/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import React, { useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
import createIframe from './createIframe';
interface IProps {
widgets: any
settings: any
[key: string]: any
}
import { TSchemaBuilder } from './type';

let iframe: any;

const Design = (props: IProps, ref: any) => {
const Design = (props: TSchemaBuilder, ref: any) => {
const { widgets, settings, ...restProps } = props;
const containerRef: any = useRef();

Expand Down
35 changes: 35 additions & 0 deletions tools/schema-builder/src/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
interface TProperties {
[key: string]: any;
}

interface TLogo {
title?: string;
image?: string;
href?: string;
}

interface TSchema {
"type": "object",
"properties": TProperties
}

interface TToolBtn {
text: string;
order: number;
onClick: (schema: TSchema) => void;
}

export interface TSchemaBuilder {
logo?: TLogo;
importBtn?: boolean;
exportBtn?: boolean;
clearBtn?: boolean | TToolBtn;
saveBtn?: boolean | TToolBtn;
pubBtn?: boolean | TToolBtn;
extraBtns?: TToolBtn[];
defaultValue?: TSchema;
widgets?: any;
settings?: any;
onMount?: () => void;
[key: string]: any
}

0 comments on commit f5530a6

Please sign in to comment.