feat(client): add disabled for initializer switch and undeletable for action settings (#2820)
* feat(client): add disabled for initializer switch and undeletable for action settings * refactor(client): adjust api
This commit is contained in:
parent
9044434930
commit
1f1e7e34f5
@ -927,7 +927,7 @@ export const ActionDesigner = (props) => {
|
|||||||
{restProps.children}
|
{restProps.children}
|
||||||
{isChildCollectionAction && <SchemaSettings.EnableChildCollections collectionName={name} />}
|
{isChildCollectionAction && <SchemaSettings.EnableChildCollections collectionName={name} />}
|
||||||
|
|
||||||
{<RemoveButton {...removeButtonProps} />}
|
{fieldSchema?.['x-action-settings']?.removable !== false && <RemoveButton {...removeButtonProps} />}
|
||||||
</MenuGroup>
|
</MenuGroup>
|
||||||
</GeneralSchemaDesigner>
|
</GeneralSchemaDesigner>
|
||||||
);
|
);
|
||||||
|
@ -609,7 +609,8 @@ SchemaInitializer.SwitchItem = (props) => {
|
|||||||
return (
|
return (
|
||||||
<SchemaInitializer.Item onClick={props.onClick}>
|
<SchemaInitializer.Item onClick={props.onClick}>
|
||||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||||
{props.title} <Switch style={{ marginLeft: 20 }} size={'small'} checked={props.checked} />
|
<label>{props.title}</label>
|
||||||
|
<Switch disabled={props.disabled} style={{ marginLeft: 20 }} size={'small'} checked={props.checked} />
|
||||||
</div>
|
</div>
|
||||||
</SchemaInitializer.Item>
|
</SchemaInitializer.Item>
|
||||||
);
|
);
|
||||||
|
@ -5,7 +5,7 @@ import { SchemaInitializer } from '..';
|
|||||||
import { useCurrentSchema } from '../utils';
|
import { useCurrentSchema } from '../utils';
|
||||||
|
|
||||||
export const InitializerWithSwitch = (props) => {
|
export const InitializerWithSwitch = (props) => {
|
||||||
const { type, schema, item, insert, remove: passInRemove } = props;
|
const { type, schema, item, insert, remove: passInRemove, disabled } = props;
|
||||||
const { exists, remove } = useCurrentSchema(
|
const { exists, remove } = useCurrentSchema(
|
||||||
schema?.[type] || item?.schema?.[type],
|
schema?.[type] || item?.schema?.[type],
|
||||||
type,
|
type,
|
||||||
@ -16,8 +16,12 @@ export const InitializerWithSwitch = (props) => {
|
|||||||
return (
|
return (
|
||||||
<SchemaInitializer.SwitchItem
|
<SchemaInitializer.SwitchItem
|
||||||
checked={exists}
|
checked={exists}
|
||||||
|
disabled={disabled}
|
||||||
title={item.title}
|
title={item.title}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
if (disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (exists) {
|
if (exists) {
|
||||||
return remove();
|
return remove();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user