vendor: amis 6.13.0 base (fork root)

This commit is contained in:
2026-06-16 22:14:57 +08:00
commit 8c8e4247a9
3840 changed files with 2467374 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
import React from 'react';
import Markdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import {Prism as SyntaxHighlighter} from 'react-syntax-highlighter';
import {darcula} from 'react-syntax-highlighter/dist/esm/styles/prism';
import {getSchemaTpl, tipedLabel} from 'amis-editor-core';
import 'amis';
import '../../src/index';
import PanelPreview from './PanelPreview';
export interface DocProps {
children?: string | null | undefined;
}
export function mdComment(fun: Function) {
const txt = fun.toString();
return txt;
}
function str2schema(code: string) {
const fn = new Function('getSchemaTpl', 'tipedLabel', `return [${code}]`);
return fn.call(null, getSchemaTpl, tipedLabel);
}
export default function Doc({children}: DocProps) {
return (
<div className="markdown">
<div className="markdown-body">
<Markdown
children={children}
remarkPlugins={[remarkGfm]}
components={{
pre(props) {
if ((props.children as any)?.props?.className) {
return <>{props.children}</>;
}
return <code>{props.children}</code>;
},
code(props) {
const {children, className, node, ref, ...rest} = props;
const match = /language-(\w+)/.exec(className || '');
if (match?.[1] === 'schema') {
const schema = str2schema(children as string);
return (
<div className="schema-tpl-preview">
<code>
<SyntaxHighlighter
{...rest}
PreTag="div"
children={String(children).replace(/\n$/, '')}
language={'jsx'}
style={darcula}
/>
</code>
<PanelPreview schema={schema} />
</div>
);
}
return match ? (
<SyntaxHighlighter
{...rest}
PreTag="div"
children={String(children).replace(/\n$/, '')}
language={match[1]}
style={darcula}
/>
) : (
<code {...rest} className={className}>
{children}
</code>
);
}
}}
/>
</div>
</div>
);
}

View File

@@ -0,0 +1,60 @@
import {JsonView, render} from 'amis';
import cx from 'classnames';
import React from 'react';
export interface PanelPreviewProps {
schema: any;
}
export default function (props: PanelPreviewProps) {
const schema = React.useMemo(() => {
return {
type: 'form',
mode: 'normal',
wrapWithPanel: false,
className: cx('config-form-content', 'ae-Settings-content'),
wrapperComponent: 'div',
body: Array.isArray(props.schema) ? props.schema : [props.schema],
submitOnChange: true,
submitOnInit: true
};
}, [JSON.stringify(props.schema)]);
const [data, setData] = React.useState({});
const onFinished = React.useCallback((data: any) => {
setData(data);
return false;
}, []);
const onJsonEdit = React.useCallback((e: any) => {
setData(e.updated_src);
}, []);
const dom = React.useRef<HTMLDivElement | null>(null);
// const popOverContainer = React.useCallback(() => {
// return dom.current;
// }, []);
return (
<div className="PanelPreview" ref={dom}>
<div className="AMISCSSWrapper editor-right-panel">
{render(
schema,
{
data: data,
onFinished: onFinished
// popOverContainer
},
{
// theme: 'cxd' // 右侧属性配置面板固定使用cxd主题展示
}
)}
</div>
<JsonView
name={false}
src={data}
theme={'rjv-default'}
enableClipboard={false}
onEdit={onJsonEdit}
onDelete={onJsonEdit}
onAdd={onJsonEdit}
/>
</div>
);
}