refactor: improve linkage rule enable (#1700)

This commit is contained in:
katherinehhh 2023-04-17 09:28:22 +08:00 committed by GitHub
parent 76faa9e30c
commit e8bb962389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 0 deletions

View File

@ -74,6 +74,8 @@ export default {
"Value":"Value",
"Disabled":"Disabled",
"Enabled":"Enabled",
'On':'On',
'Off':'Off',
"Empty":"Empty",
"Linkage rule":"Linkage rule",
"Linkage rules":"Linkage rules",

View File

@ -79,6 +79,8 @@ export default {
"Value":"フィールド値",
"Disabled":"無効化",
"Enabled":"有効化",
'On':'有効化',
'Off':'無効化',
"Empty":"くうきち",
"Linkage rule":"連動規則",
"Linkage rules":"連動規則",

View File

@ -41,6 +41,8 @@ export default {
"Setting": "设置",
"Enable": "启用",
"Disable": "禁用",
'On':'启用',
'Off':'禁用',
"Logo": "Logo",
"Add menu item": "添加菜单项",
"Page": "页面",

View File

@ -1,13 +1,18 @@
import React from 'react';
import { Switch } from 'antd';
import { ArrayBase } from '@formily/antd';
import { useTranslation } from 'react-i18next';
export const EnableLinkage = React.forwardRef((props: any, ref) => {
const array = ArrayBase.useArray();
const index = ArrayBase.useIndex(props.index);
const { t } = useTranslation();
return (
<Switch
{...props}
checkedChildren={t('On')}
unCheckedChildren={t('Off')}
checked={!array?.field?.value[index].disabled}
size={'small'}
style={{