feat: 补充json展示插件参数 (#4014)

This commit is contained in:
ZYA 2022-04-12 16:28:28 +08:00 committed by GitHub
parent 18030b5415
commit 8b79789c3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,26 @@ export interface JsonSchema extends BaseSchema {
*
*/
displayDataTypes?: boolean;
/**
*
*/
enableClipboard?: boolean;
/**
*
*/
iconStyle?: "square" | "circle" | "triangle"
/**
*
*/
quotesOnKeys?: boolean
/**
*
*/
sortKeys?: boolean
}
export interface JSONProps extends RendererProps, JsonSchema {
@ -50,7 +70,11 @@ export class JSONField extends React.Component<JSONProps, object> {
placeholder: '-',
levelExpand: 1,
source: '',
displayDataTypes: false
displayDataTypes: false,
enableClipboard: false,
iconStyle:"square",
quotesOnKeys: true,
sortKeys:false,
};
@autobind
@ -86,6 +110,10 @@ export class JSONField extends React.Component<JSONProps, object> {
levelExpand,
mutable,
displayDataTypes,
enableClipboard,
iconStyle,
quotesOnKeys,
sortKeys,
name
} = this.props;
@ -127,9 +155,11 @@ export class JSONField extends React.Component<JSONProps, object> {
src={data}
theme={(jsonThemeValue as any) ?? 'rjv-default'}
shouldCollapse={this.shouldExpandNode}
enableClipboard={false}
enableClipboard={enableClipboard}
displayDataTypes={displayDataTypes}
iconStyle="square"
iconStyle={iconStyle}
quotesOnKeys={quotesOnKeys}
sortKeys={sortKeys}
onEdit={name && mutable ? this.emitChange : false}
onDelete={name && mutable ? this.emitChange : false}
onAdd={name && mutable ? this.emitChange : false}