style: format code style (#3857)
* first commit * style: format code style * style: format code
This commit is contained in:
parent
821238ea04
commit
cfdb09fe5b
|
|
@ -16,6 +16,7 @@
|
||||||
import { isString } from '@/utils/is';
|
import { isString } from '@/utils/is';
|
||||||
import { MODE } from './typing';
|
import { MODE } from './typing';
|
||||||
import type { EditorConfiguration } from 'codemirror';
|
import type { EditorConfiguration } from 'codemirror';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
value: { type: [Object, String] as PropType<Record<string, any> | string> },
|
value: { type: [Object, String] as PropType<Record<string, any> | string> },
|
||||||
mode: {
|
mode: {
|
||||||
|
|
@ -29,7 +30,7 @@
|
||||||
readonly: { type: Boolean },
|
readonly: { type: Boolean },
|
||||||
autoFormat: { type: Boolean, default: true },
|
autoFormat: { type: Boolean, default: true },
|
||||||
bordered: { type: Boolean, default: false },
|
bordered: { type: Boolean, default: false },
|
||||||
config: { type: Object as PropType<EditorConfiguration>, default: {} },
|
config: { type: Object as PropType<EditorConfiguration>, default: () => {} },
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['change', 'update:value', 'format-error']);
|
const emit = defineEmits(['change', 'update:value', 'format-error']);
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
value: { type: String, default: '' },
|
value: { type: String, default: '' },
|
||||||
readonly: { type: Boolean, default: false },
|
readonly: { type: Boolean, default: false },
|
||||||
bordered: { type: Boolean, default: false },
|
bordered: { type: Boolean, default: false },
|
||||||
config: { type: Object as PropType<EditorConfiguration>, default: {} },
|
config: { type: Object as PropType<EditorConfiguration>, default: () => {} },
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(['change']);
|
const emit = defineEmits(['change']);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
export enum MODE {
|
export enum MODE {
|
||||||
JSON = 'application/json',
|
JSON = 'application/json',
|
||||||
HTML = 'htmlmixed',
|
|
||||||
JS = 'javascript',
|
|
||||||
APL = 'apl',
|
APL = 'apl',
|
||||||
ASCIIARMOR = 'asciiarmor',
|
ASCIIARMOR = 'asciiarmor',
|
||||||
ASTERISK = 'asterisk',
|
ASTERISK = 'asterisk',
|
||||||
|
|
@ -124,9 +122,9 @@ export enum MODE {
|
||||||
* @description: DynamicImport codemirror
|
* @description: DynamicImport codemirror
|
||||||
*/
|
*/
|
||||||
export function parserDynamicImport(str: MODE): () => Promise<any> {
|
export function parserDynamicImport(str: MODE): () => Promise<any> {
|
||||||
let dynamicArray = {
|
const dynamicArray = {
|
||||||
// adapt before demo
|
// adapt before demo
|
||||||
"application/json": async () => await import('codemirror/mode/javascript/javascript'),
|
'application/json': async () => await import('codemirror/mode/javascript/javascript'),
|
||||||
apl: async () => await import('codemirror/mode/apl/apl'),
|
apl: async () => await import('codemirror/mode/apl/apl'),
|
||||||
asciiarmor: async () => await import('codemirror/mode/asciiarmor/asciiarmor'),
|
asciiarmor: async () => await import('codemirror/mode/asciiarmor/asciiarmor'),
|
||||||
asterisk: async () => await import('codemirror/mode/asterisk/asterisk'),
|
asterisk: async () => await import('codemirror/mode/asterisk/asterisk'),
|
||||||
|
|
|
||||||
|
|
@ -339,12 +339,12 @@
|
||||||
// margin-bottom: 20px;
|
// margin-bottom: 20px;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
&.suffix-item, &.prefix-item {
|
&.suffix-item,
|
||||||
|
&.prefix-item {
|
||||||
.ant-form-item-children {
|
.ant-form-item-children {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
&.suffix-item, &.prefix-item{
|
|
||||||
.prefix {
|
.prefix {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -352,6 +352,7 @@
|
||||||
padding-right: 6px;
|
padding-right: 6px;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.suffix {
|
.suffix {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
||||||
|
|
@ -385,7 +385,7 @@
|
||||||
name={field}
|
name={field}
|
||||||
class={{
|
class={{
|
||||||
'suffix-item': !!suffix,
|
'suffix-item': !!suffix,
|
||||||
'prefix-item': !!prefix
|
'prefix-item': !!prefix,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<BasicTitle {...unref(getComponentsProps)}>{renderLabelHelpMessage()}</BasicTitle>
|
<BasicTitle {...unref(getComponentsProps)}>{renderLabelHelpMessage()}</BasicTitle>
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ export interface FormActionType {
|
||||||
validateFields: (nameList?: NamePath[]) => Promise<any>;
|
validateFields: (nameList?: NamePath[]) => Promise<any>;
|
||||||
validate: <T = Recordable>(nameList?: NamePath[] | false) => Promise<T>;
|
validate: <T = Recordable>(nameList?: NamePath[] | false) => Promise<T>;
|
||||||
scrollToField: (name: NamePath, options?: ScrollOptions) => Promise<void>;
|
scrollToField: (name: NamePath, options?: ScrollOptions) => Promise<void>;
|
||||||
resetDefaultField:(name?: NamePath[]) => void;
|
resetDefaultField: (name?: NamePath[]) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type RegisterFn = (formInstance: FormActionType) => void;
|
export type RegisterFn = (formInstance: FormActionType) => void;
|
||||||
|
|
@ -167,8 +167,16 @@ interface BaseFormSchema<T extends ComponentType = any> {
|
||||||
// Required
|
// Required
|
||||||
required?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean);
|
required?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean);
|
||||||
|
|
||||||
suffix?: string | number | VNode | ((renderCallbackParams: RenderCallbackParams) => string | VNode | number)
|
suffix?:
|
||||||
prefix?: string | number | VNode | ((renderCallbackParams: RenderCallbackParams) => string | VNode | number)
|
| string
|
||||||
|
| number
|
||||||
|
| VNode
|
||||||
|
| ((renderCallbackParams: RenderCallbackParams) => string | VNode | number);
|
||||||
|
prefix?:
|
||||||
|
| string
|
||||||
|
| number
|
||||||
|
| VNode
|
||||||
|
| ((renderCallbackParams: RenderCallbackParams) => string | VNode | number);
|
||||||
// Validation rules
|
// Validation rules
|
||||||
rules?: Rule[];
|
rules?: Rule[];
|
||||||
// Check whether the information is added to the label
|
// Check whether the information is added to the label
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
import { useMessage } from '@/hooks/web/useMessage';
|
import { useMessage } from '@/hooks/web/useMessage';
|
||||||
import { PageWrapper } from '@/components/Page';
|
import { PageWrapper } from '@/components/Page';
|
||||||
import { CodeEditor, MODE } from '@/components/CodeEditor';
|
import { CodeEditor, MODE } from '@/components/CodeEditor';
|
||||||
|
|
||||||
const schemas: FormSchema[] = [
|
const schemas: FormSchema[] = [
|
||||||
{
|
{
|
||||||
field: 'title',
|
field: 'title',
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,11 @@
|
||||||
value.value = jsonData;
|
value.value = jsonData;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mode === MODE.HTML) {
|
if (mode === MODE.HTMLMIXED) {
|
||||||
value.value = htmlData;
|
value.value = htmlData;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mode === MODE.JS) {
|
if (mode === MODE.JAVASCRIPT) {
|
||||||
value.value = jsData;
|
value.value = jsData;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue