fix: shared form scopes
This commit is contained in:
parent
b878b214d4
commit
07b982960d
@ -19,6 +19,7 @@ import { useRequest } from 'umi';
|
||||
import api from '@/api-client';
|
||||
import { Spin } from '@nocobase/client';
|
||||
import cleanDeep from 'clean-deep';
|
||||
import scopes from '@/components/views/Form/scopes';
|
||||
|
||||
const actions = createFormActions();
|
||||
|
||||
@ -107,20 +108,7 @@ export default forwardRef((props: any, ref) => {
|
||||
type: 'object',
|
||||
properties: fields,
|
||||
}}
|
||||
expressionScope={{
|
||||
text(...args: any[]) {
|
||||
return React.createElement('span', {}, ...args)
|
||||
},
|
||||
tooltip(title: string, offset = 3) {
|
||||
return (
|
||||
<Tooltip title={title}>
|
||||
<QuestionCircleOutlined
|
||||
style={{ margin: '0 3px', cursor: 'default', marginLeft: offset }}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
}}
|
||||
expressionScope={scopes}
|
||||
>
|
||||
</SchemaForm>
|
||||
</Drawer>
|
||||
|
@ -23,6 +23,7 @@ import isEqual from 'lodash/isEqual';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import get from 'lodash/get';
|
||||
import cleanDeep from 'clean-deep';
|
||||
import scopes from './scopes';
|
||||
|
||||
const actions = createFormActions();
|
||||
|
||||
@ -137,23 +138,8 @@ export const DrawerForm = forwardRef((props: any, ref) => {
|
||||
type: 'object',
|
||||
properties,
|
||||
}}
|
||||
expressionScope={{
|
||||
text(...args: any[]) {
|
||||
return React.createElement('span', {}, ...args)
|
||||
},
|
||||
html(html: string) {
|
||||
return <div dangerouslySetInnerHTML={{__html: html}}></div>
|
||||
},
|
||||
tooltip(title: string, offset = 3) {
|
||||
return (
|
||||
<Tooltip title={<div dangerouslySetInnerHTML={{__html: title}}></div>}>
|
||||
<QuestionCircleOutlined
|
||||
style={{ margin: '0 3px', cursor: 'default', marginLeft: offset }}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
}}
|
||||
autoComplete={'off'}
|
||||
expressionScope={scopes}
|
||||
>
|
||||
</SchemaForm>
|
||||
)}
|
||||
|
@ -13,6 +13,7 @@ import {
|
||||
setValidationLanguage,
|
||||
} from '@formily/antd';
|
||||
import { QuestionCircleOutlined } from '@ant-design/icons';
|
||||
import scopes from './scopes';
|
||||
|
||||
export function FilterForm(props: any) {
|
||||
const actions = createAsyncFormActions();
|
||||
@ -37,20 +38,7 @@ export function FilterForm(props: any) {
|
||||
type: 'object',
|
||||
properties,
|
||||
}}
|
||||
expressionScope={{
|
||||
text(...args: any[]) {
|
||||
return React.createElement('span', {}, ...args)
|
||||
},
|
||||
tooltip(title: string, offset = 3) {
|
||||
return (
|
||||
<Tooltip title={title}>
|
||||
<QuestionCircleOutlined
|
||||
style={{ margin: '0 3px', cursor: 'default', marginLeft: offset }}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
}}
|
||||
expressionScope={scopes}
|
||||
>
|
||||
<FormButtonGroup align={'end'}>
|
||||
<Reset>取消</Reset>
|
||||
|
21
packages/app/src/components/views/Form/scopes.tsx
Normal file
21
packages/app/src/components/views/Form/scopes.tsx
Normal file
@ -0,0 +1,21 @@
|
||||
import React from 'react';
|
||||
import { Tooltip } from 'antd';
|
||||
import { QuestionCircleOutlined } from '@ant-design/icons';
|
||||
|
||||
export default {
|
||||
text(...args: any[]) {
|
||||
return React.createElement('span', {}, ...args)
|
||||
},
|
||||
html(html: string) {
|
||||
return <div dangerouslySetInnerHTML={{__html: html}}></div>
|
||||
},
|
||||
tooltip(title: string, offset = 3) {
|
||||
return (
|
||||
<Tooltip title={<div dangerouslySetInnerHTML={{__html: title}}></div>}>
|
||||
<QuestionCircleOutlined
|
||||
style={{ margin: '0 3px', cursor: 'default', marginLeft: offset }}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue
Block a user