style: format code style (#3857)

* first commit

* style: format code style

* style: format code
This commit is contained in:
zhang 2024-05-22 22:40:56 +08:00 committed by GitHub
parent 821238ea04
commit cfdb09fe5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 29 additions and 20 deletions

View File

@ -16,6 +16,7 @@
import { isString } from '@/utils/is';
import { MODE } from './typing';
import type { EditorConfiguration } from 'codemirror';
const props = defineProps({
value: { type: [Object, String] as PropType<Record<string, any> | string> },
mode: {
@ -29,7 +30,7 @@
readonly: { type: Boolean },
autoFormat: { type: Boolean, default: true },
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']);

View File

@ -51,7 +51,7 @@
value: { type: String, default: '' },
readonly: { 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']);

View File

@ -1,7 +1,5 @@
export enum MODE {
JSON = 'application/json',
HTML = 'htmlmixed',
JS = 'javascript',
APL = 'apl',
ASCIIARMOR = 'asciiarmor',
ASTERISK = 'asterisk',
@ -121,12 +119,12 @@ export enum MODE {
Z80 = 'z80',
}
/**
* @description: DynamicImport codemirror
* @description: DynamicImport codemirror
*/
export function parserDynamicImport(str: MODE): () => Promise<any> {
let dynamicArray = {
const dynamicArray = {
// 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'),
asciiarmor: async () => await import('codemirror/mode/asciiarmor/asciiarmor'),
asterisk: async () => await import('codemirror/mode/asterisk/asterisk'),

View File

@ -339,12 +339,12 @@
// margin-bottom: 20px;
// }
&.suffix-item, &.prefix-item {
&.suffix-item,
&.prefix-item {
.ant-form-item-children {
display: flex;
}
}
&.suffix-item, &.prefix-item{
}
.prefix {
display: inline-flex;
align-items: center;
@ -352,6 +352,7 @@
padding-right: 6px;
line-height: 1;
}
.suffix {
display: inline-flex;
align-items: center;
@ -361,7 +362,7 @@
}
}
}
.ant-form-explain {
font-size: 14px;
}

View File

@ -383,9 +383,9 @@
labelCol={labelCol}
wrapperCol={wrapperCol}
name={field}
class={{
'suffix-item': !!suffix,
'prefix-item': !!prefix
class={{
'suffix-item': !!suffix,
'prefix-item': !!prefix,
}}
>
<BasicTitle {...unref(getComponentsProps)}>{renderLabelHelpMessage()}</BasicTitle>

View File

@ -41,7 +41,7 @@ export interface FormActionType {
validateFields: (nameList?: NamePath[]) => Promise<any>;
validate: <T = Recordable>(nameList?: NamePath[] | false) => Promise<T>;
scrollToField: (name: NamePath, options?: ScrollOptions) => Promise<void>;
resetDefaultField:(name?: NamePath[]) => void;
resetDefaultField: (name?: NamePath[]) => void;
}
export type RegisterFn = (formInstance: FormActionType) => void;
@ -167,8 +167,16 @@ interface BaseFormSchema<T extends ComponentType = any> {
// Required
required?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean);
suffix?: string | number | VNode | ((renderCallbackParams: RenderCallbackParams) => string | VNode | number)
prefix?: string | number | VNode | ((renderCallbackParams: RenderCallbackParams) => string | VNode | number)
suffix?:
| string
| number
| VNode
| ((renderCallbackParams: RenderCallbackParams) => string | VNode | number);
prefix?:
| string
| number
| VNode
| ((renderCallbackParams: RenderCallbackParams) => string | VNode | number);
// Validation rules
rules?: Rule[];
// Check whether the information is added to the label

View File

@ -18,6 +18,7 @@
import { useMessage } from '@/hooks/web/useMessage';
import { PageWrapper } from '@/components/Page';
import { CodeEditor, MODE } from '@/components/CodeEditor';
const schemas: FormSchema[] = [
{
field: 'title',

View File

@ -66,11 +66,11 @@
value.value = jsonData;
return;
}
if (mode === MODE.HTML) {
if (mode === MODE.HTMLMIXED) {
value.value = htmlData;
return;
}
if (mode === MODE.JS) {
if (mode === MODE.JAVASCRIPT) {
value.value = jsData;
return;
}