UNPKG

jamis

Version:

一种支持通过JSON配置方式生成页面的组件库

422 lines (421 loc) 22 kB
import React from 'react'; import type { ListenerAction } from 'jamis-core'; import type { SizeUnit } from '../types'; import type { EditorProps } from './types'; export default class EditorControl extends React.Component<EditorProps, any> { static defaultProps: Partial<EditorProps>; state: { focused: boolean; }; editor: any; toDispose: Array<Function>; divRef: React.RefObject<HTMLDivElement>; constructor(props: EditorProps); componentWillUnmount(): void; doAction(action: ListenerAction, args: any): void; focus(): void; handleFocus(): void; handleBlur(): void; handleEditorMounted(editor: any, monaco: any): void; prevHeight: number; updateContainerSize(editor: any, monaco: any): void; handleChange: (val: string, event: any) => void; render(): JSX.Element; } export declare const EditorControls: Array<typeof EditorControl>; export declare class JavascriptEditorControlRenderer extends EditorControl { static defaultProps: { language: "javascript"; options?: Record<string, any>; render?: import("jamis-core").SchemaRenderFn | undefined; env?: import("jamis-core").RendererEnv | undefined; $path?: string | undefined; scopeRef?: (scoped: import("jamis-core").IScopedContext) => void; $schema?: (import("jamis-core").BaseSchemaWithoutType & { [key: string]: any; type: string; }) | undefined; store?: import("jamis-core").IIRendererStore; syncSuperStore?: boolean; data?: import("jamis-core").RendererPropsData | undefined; defaultData?: Record<string, any>; className?: import("jamis-core").SchemaClassName; rootStore?: import("jamis-core").IRendererStoreCopy | undefined; topStore?: import("jamis-core").IRootStoreCopy | undefined; appStore?: import("jamis-core").IAppStoreCopy; dispatchEvent?: import("jamis-core").DispatchEventFn<import("jamis-core").RendererPropsData, string | React.SyntheticEvent<HTMLElement, Event>> | undefined; onAction?: import("jamis-core").OnActionFn; $$editor?: any; style?: React.CSSProperties; onEvent?: import("jamis-core").EventListeners; onOpenDialog?: ((schema: import("jamis-core").Schema, data: any) => Promise<any>) | undefined; name?: string; formStore?: import("../types").IFormStore; formItem?: import("../types").IFormItemStore; formInited?: boolean | undefined; formMode?: "normal" | "horizontal" | "inline" | "default" | "row" | undefined; formHorizontal?: import("../types").FormHorizontal | undefined; horizontal?: import("../types").FormHorizontal; formLabelAlign?: import("../types").LabelAlign | undefined; formLabelWidth?: number | string; defaultSize?: SizeUnit; size?: SizeUnit; labelAlign?: import("../types").LabelAlign; labelWidth?: number | string; labelClassName?: string; disabled?: boolean; btnDisabled?: boolean | undefined; defaultValue?: any; value?: any; prinstine?: any; formItemValue?: any; inputClassName?: string; inputStyle?: React.CSSProperties; inputOnly?: boolean; renderLabel?: boolean; renderDescription?: boolean; sizeMutable?: boolean; wrap?: boolean; hint?: string; description?: string; descriptionClassName?: string; errors?: { [propName: string]: string; }; error?: string; showErrorMsg?: boolean; requiredClassName?: import("jamis-core").SchemaClassName; valueClassName?: import("jamis-core").SchemaClassName; setPrinstineValue?: ((value: any) => void) | undefined; onChange?: ((value: any, submitOnChange?: boolean, changeImmediately?: boolean) => void) | undefined; onBulkChange?: (values: { [propName: string]: any; }, submitOnChange?: boolean) => void; addHook?: ((fn: Function, mode: "validate" | "init" | "flush") => () => void) | undefined; removeHook?: ((fn: Function, mode?: "validate" | "init" | "flush") => void) | undefined; renderFormItems?: ((schema: Partial<import("../types").FormSchemaBase>, region: string, props: any) => JSX.Element) | undefined; onFocus?: ((e: any) => void) | undefined; onBlur?: ((e: any) => void) | undefined; getValue?: (() => any) | undefined; setValue?: ((value: any, key: string) => void) | undefined; renderControl?: (props: import("../types").FormControlProps) => JSX.Element; type?: "editor" | "bat-editor" | "c-editor" | "coffeescript-editor" | "cpp-editor" | "csharp-editor" | "css-editor" | "dockerfile-editor" | "fsharp-editor" | "go-editor" | "handlebars-editor" | "html-editor" | "ini-editor" | "java-editor" | "javascript-editor" | "json-editor" | "less-editor" | "lua-editor" | "markdown-editor" | "msdax-editor" | "objective-c-editor" | "php-editor" | "plaintext-editor" | "postiats-editor" | "powershell-editor" | "pug-editor" | "python-editor" | "r-editor" | "razor-editor" | "ruby-editor" | "sb-editor" | "scss-editor" | "sol-editor" | "sql-editor" | "swift-editor" | "typescript-editor" | "vb-editor" | "xml-editor" | "yaml-editor" | undefined; sizeExpr?: import("jamis-core").SchemaExpression; placeholder?: string; placeholderExpr?: import("jamis-core").SchemaExpression; id?: string; key?: any; $ref?: string; definitions?: Record<string, any>; disabledOn?: import("jamis-core").SchemaBoolean; hidden?: boolean; hiddenOn?: import("jamis-core").SchemaBoolean; visible?: boolean; visibleOn?: import("jamis-core").SchemaBoolean; editorSetting?: { behavior?: string; displayName?: string; mock?: any; [propName: string]: any; }; remark?: unknown; labelRemark?: unknown; clearable?: boolean; label?: string | false | import("jamis-core").Schema; submitOnChange?: boolean; readOnly?: boolean; readOnlyOn?: string; validateOnChange?: boolean; validatable?: boolean; validatableOn?: import("jamis-core").SchemaExpression; desc?: string; mode?: "normal" | "inline" | "horizontal"; modeExpr?: import("jamis-core").SchemaExpression; inline?: boolean; controlBodyClassName?: import("jamis-core").SchemaClassName; required?: boolean; requiredOn?: import("jamis-core").SchemaExpression; changeImmediately?: boolean; validationErrors?: { [k in keyof import("../types").FormValidation]: string; }; validations?: string | import("../types").FormValidation; clearValueOnHidden?: boolean; validateApi?: import("jamis-core").Api; columnRatio?: import("jamis-core").GridSizeUnit; columnRatioExpr?: import("jamis-core").GridSizeUnit | import("jamis-core").SchemaExpression | Record<import("jamis-core").GridSizeUnitStr, boolean | import("jamis-core").SchemaBoolean>; static?: boolean; staticOn?: import("jamis-core").SchemaExpression; staticPlaceholder?: string; staticClassName?: import("jamis-core").SchemaClassName; staticLabelClassName?: import("jamis-core").SchemaClassName; staticInputClassName?: import("jamis-core").SchemaClassName; staticSchema?: any; validate?: (values: any, value: any) => string | boolean; pipeIn?: ((value: any, data: Record<string, any>) => any) | import("jamis-core").SchemaExpression; pipeOut?: ((value: any, originValue: any, data: Record<string, any>) => any) | import("jamis-core").SchemaExpression; allowFullscreen?: boolean; }; } export declare class TypescriptEditorControlRenderer extends EditorControl { static defaultProps: { language: "typescript"; options?: Record<string, any>; render?: import("jamis-core").SchemaRenderFn | undefined; env?: import("jamis-core").RendererEnv | undefined; $path?: string | undefined; scopeRef?: (scoped: import("jamis-core").IScopedContext) => void; $schema?: (import("jamis-core").BaseSchemaWithoutType & { [key: string]: any; type: string; }) | undefined; store?: import("jamis-core").IIRendererStore; syncSuperStore?: boolean; data?: import("jamis-core").RendererPropsData | undefined; defaultData?: Record<string, any>; className?: import("jamis-core").SchemaClassName; rootStore?: import("jamis-core").IRendererStoreCopy | undefined; topStore?: import("jamis-core").IRootStoreCopy | undefined; appStore?: import("jamis-core").IAppStoreCopy; dispatchEvent?: import("jamis-core").DispatchEventFn<import("jamis-core").RendererPropsData, string | React.SyntheticEvent<HTMLElement, Event>> | undefined; onAction?: import("jamis-core").OnActionFn; $$editor?: any; style?: React.CSSProperties; onEvent?: import("jamis-core").EventListeners; onOpenDialog?: ((schema: import("jamis-core").Schema, data: any) => Promise<any>) | undefined; name?: string; formStore?: import("../types").IFormStore; formItem?: import("../types").IFormItemStore; formInited?: boolean | undefined; formMode?: "normal" | "horizontal" | "inline" | "default" | "row" | undefined; formHorizontal?: import("../types").FormHorizontal | undefined; horizontal?: import("../types").FormHorizontal; formLabelAlign?: import("../types").LabelAlign | undefined; formLabelWidth?: number | string; defaultSize?: SizeUnit; size?: SizeUnit; labelAlign?: import("../types").LabelAlign; labelWidth?: number | string; labelClassName?: string; disabled?: boolean; btnDisabled?: boolean | undefined; defaultValue?: any; value?: any; prinstine?: any; formItemValue?: any; inputClassName?: string; inputStyle?: React.CSSProperties; inputOnly?: boolean; renderLabel?: boolean; renderDescription?: boolean; sizeMutable?: boolean; wrap?: boolean; hint?: string; description?: string; descriptionClassName?: string; errors?: { [propName: string]: string; }; error?: string; showErrorMsg?: boolean; requiredClassName?: import("jamis-core").SchemaClassName; valueClassName?: import("jamis-core").SchemaClassName; setPrinstineValue?: ((value: any) => void) | undefined; onChange?: ((value: any, submitOnChange?: boolean, changeImmediately?: boolean) => void) | undefined; onBulkChange?: (values: { [propName: string]: any; }, submitOnChange?: boolean) => void; addHook?: ((fn: Function, mode: "validate" | "init" | "flush") => () => void) | undefined; removeHook?: ((fn: Function, mode?: "validate" | "init" | "flush") => void) | undefined; renderFormItems?: ((schema: Partial<import("../types").FormSchemaBase>, region: string, props: any) => JSX.Element) | undefined; onFocus?: ((e: any) => void) | undefined; onBlur?: ((e: any) => void) | undefined; getValue?: (() => any) | undefined; setValue?: ((value: any, key: string) => void) | undefined; renderControl?: (props: import("../types").FormControlProps) => JSX.Element; type?: "editor" | "bat-editor" | "c-editor" | "coffeescript-editor" | "cpp-editor" | "csharp-editor" | "css-editor" | "dockerfile-editor" | "fsharp-editor" | "go-editor" | "handlebars-editor" | "html-editor" | "ini-editor" | "java-editor" | "javascript-editor" | "json-editor" | "less-editor" | "lua-editor" | "markdown-editor" | "msdax-editor" | "objective-c-editor" | "php-editor" | "plaintext-editor" | "postiats-editor" | "powershell-editor" | "pug-editor" | "python-editor" | "r-editor" | "razor-editor" | "ruby-editor" | "sb-editor" | "scss-editor" | "sol-editor" | "sql-editor" | "swift-editor" | "typescript-editor" | "vb-editor" | "xml-editor" | "yaml-editor" | undefined; sizeExpr?: import("jamis-core").SchemaExpression; placeholder?: string; placeholderExpr?: import("jamis-core").SchemaExpression; id?: string; key?: any; $ref?: string; definitions?: Record<string, any>; disabledOn?: import("jamis-core").SchemaBoolean; hidden?: boolean; hiddenOn?: import("jamis-core").SchemaBoolean; visible?: boolean; visibleOn?: import("jamis-core").SchemaBoolean; editorSetting?: { behavior?: string; displayName?: string; mock?: any; [propName: string]: any; }; remark?: unknown; labelRemark?: unknown; clearable?: boolean; label?: string | false | import("jamis-core").Schema; submitOnChange?: boolean; readOnly?: boolean; readOnlyOn?: string; validateOnChange?: boolean; validatable?: boolean; validatableOn?: import("jamis-core").SchemaExpression; desc?: string; mode?: "normal" | "inline" | "horizontal"; modeExpr?: import("jamis-core").SchemaExpression; inline?: boolean; controlBodyClassName?: import("jamis-core").SchemaClassName; required?: boolean; requiredOn?: import("jamis-core").SchemaExpression; changeImmediately?: boolean; validationErrors?: { [k in keyof import("../types").FormValidation]: string; }; validations?: string | import("../types").FormValidation; clearValueOnHidden?: boolean; validateApi?: import("jamis-core").Api; columnRatio?: import("jamis-core").GridSizeUnit; columnRatioExpr?: import("jamis-core").GridSizeUnit | import("jamis-core").SchemaExpression | Record<import("jamis-core").GridSizeUnitStr, boolean | import("jamis-core").SchemaBoolean>; static?: boolean; staticOn?: import("jamis-core").SchemaExpression; staticPlaceholder?: string; staticClassName?: import("jamis-core").SchemaClassName; staticLabelClassName?: import("jamis-core").SchemaClassName; staticInputClassName?: import("jamis-core").SchemaClassName; staticSchema?: any; validate?: (values: any, value: any) => string | boolean; pipeIn?: ((value: any, data: Record<string, any>) => any) | import("jamis-core").SchemaExpression; pipeOut?: ((value: any, originValue: any, data: Record<string, any>) => any) | import("jamis-core").SchemaExpression; allowFullscreen?: boolean; }; } export declare class EditorControlRenderer extends EditorControl { static defaultProps: { language: "javascript"; options?: Record<string, any>; render?: import("jamis-core").SchemaRenderFn | undefined; env?: import("jamis-core").RendererEnv | undefined; $path?: string | undefined; scopeRef?: (scoped: import("jamis-core").IScopedContext) => void; $schema?: (import("jamis-core").BaseSchemaWithoutType & { [key: string]: any; type: string; }) | undefined; store?: import("jamis-core").IIRendererStore; syncSuperStore?: boolean; data?: import("jamis-core").RendererPropsData | undefined; defaultData?: Record<string, any>; className?: import("jamis-core").SchemaClassName; rootStore?: import("jamis-core").IRendererStoreCopy | undefined; topStore?: import("jamis-core").IRootStoreCopy | undefined; appStore?: import("jamis-core").IAppStoreCopy; dispatchEvent?: import("jamis-core").DispatchEventFn<import("jamis-core").RendererPropsData, string | React.SyntheticEvent<HTMLElement, Event>> | undefined; onAction?: import("jamis-core").OnActionFn; $$editor?: any; style?: React.CSSProperties; onEvent?: import("jamis-core").EventListeners; onOpenDialog?: ((schema: import("jamis-core").Schema, data: any) => Promise<any>) | undefined; name?: string; formStore?: import("../types").IFormStore; formItem?: import("../types").IFormItemStore; formInited?: boolean | undefined; formMode?: "normal" | "horizontal" | "inline" | "default" | "row" | undefined; formHorizontal?: import("../types").FormHorizontal | undefined; horizontal?: import("../types").FormHorizontal; formLabelAlign?: import("../types").LabelAlign | undefined; formLabelWidth?: number | string; defaultSize?: SizeUnit; size?: SizeUnit; labelAlign?: import("../types").LabelAlign; labelWidth?: number | string; labelClassName?: string; disabled?: boolean; btnDisabled?: boolean | undefined; defaultValue?: any; value?: any; prinstine?: any; formItemValue?: any; inputClassName?: string; inputStyle?: React.CSSProperties; inputOnly?: boolean; renderLabel?: boolean; renderDescription?: boolean; sizeMutable?: boolean; wrap?: boolean; hint?: string; description?: string; descriptionClassName?: string; errors?: { [propName: string]: string; }; error?: string; showErrorMsg?: boolean; requiredClassName?: import("jamis-core").SchemaClassName; valueClassName?: import("jamis-core").SchemaClassName; setPrinstineValue?: ((value: any) => void) | undefined; onChange?: ((value: any, submitOnChange?: boolean, changeImmediately?: boolean) => void) | undefined; onBulkChange?: (values: { [propName: string]: any; }, submitOnChange?: boolean) => void; addHook?: ((fn: Function, mode: "validate" | "init" | "flush") => () => void) | undefined; removeHook?: ((fn: Function, mode?: "validate" | "init" | "flush") => void) | undefined; renderFormItems?: ((schema: Partial<import("../types").FormSchemaBase>, region: string, props: any) => JSX.Element) | undefined; onFocus?: ((e: any) => void) | undefined; onBlur?: ((e: any) => void) | undefined; getValue?: (() => any) | undefined; setValue?: ((value: any, key: string) => void) | undefined; renderControl?: (props: import("../types").FormControlProps) => JSX.Element; type?: "editor" | "bat-editor" | "c-editor" | "coffeescript-editor" | "cpp-editor" | "csharp-editor" | "css-editor" | "dockerfile-editor" | "fsharp-editor" | "go-editor" | "handlebars-editor" | "html-editor" | "ini-editor" | "java-editor" | "javascript-editor" | "json-editor" | "less-editor" | "lua-editor" | "markdown-editor" | "msdax-editor" | "objective-c-editor" | "php-editor" | "plaintext-editor" | "postiats-editor" | "powershell-editor" | "pug-editor" | "python-editor" | "r-editor" | "razor-editor" | "ruby-editor" | "sb-editor" | "scss-editor" | "sol-editor" | "sql-editor" | "swift-editor" | "typescript-editor" | "vb-editor" | "xml-editor" | "yaml-editor" | undefined; sizeExpr?: import("jamis-core").SchemaExpression; placeholder?: string; placeholderExpr?: import("jamis-core").SchemaExpression; id?: string; key?: any; $ref?: string; definitions?: Record<string, any>; disabledOn?: import("jamis-core").SchemaBoolean; hidden?: boolean; hiddenOn?: import("jamis-core").SchemaBoolean; visible?: boolean; visibleOn?: import("jamis-core").SchemaBoolean; editorSetting?: { behavior?: string; displayName?: string; mock?: any; [propName: string]: any; }; remark?: unknown; labelRemark?: unknown; clearable?: boolean; label?: string | false | import("jamis-core").Schema; submitOnChange?: boolean; readOnly?: boolean; readOnlyOn?: string; validateOnChange?: boolean; validatable?: boolean; validatableOn?: import("jamis-core").SchemaExpression; desc?: string; mode?: "normal" | "inline" | "horizontal"; modeExpr?: import("jamis-core").SchemaExpression; inline?: boolean; controlBodyClassName?: import("jamis-core").SchemaClassName; required?: boolean; requiredOn?: import("jamis-core").SchemaExpression; changeImmediately?: boolean; validationErrors?: { [k in keyof import("../types").FormValidation]: string; }; validations?: string | import("../types").FormValidation; clearValueOnHidden?: boolean; validateApi?: import("jamis-core").Api; columnRatio?: import("jamis-core").GridSizeUnit; columnRatioExpr?: import("jamis-core").GridSizeUnit | import("jamis-core").SchemaExpression | Record<import("jamis-core").GridSizeUnitStr, boolean | import("jamis-core").SchemaBoolean>; static?: boolean; staticOn?: import("jamis-core").SchemaExpression; staticPlaceholder?: string; staticClassName?: import("jamis-core").SchemaClassName; staticLabelClassName?: import("jamis-core").SchemaClassName; staticInputClassName?: import("jamis-core").SchemaClassName; staticSchema?: any; validate?: (values: any, value: any) => string | boolean; pipeIn?: ((value: any, data: Record<string, any>) => any) | import("jamis-core").SchemaExpression; pipeOut?: ((value: any, originValue: any, data: Record<string, any>) => any) | import("jamis-core").SchemaExpression; allowFullscreen?: boolean; }; }