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}
|
||||
{isChildCollectionAction && <SchemaSettings.EnableChildCollections collectionName={name} />}
|
||||
|
||||
{<RemoveButton {...removeButtonProps} />}
|
||||
{fieldSchema?.['x-action-settings']?.removable !== false && <RemoveButton {...removeButtonProps} />}
|
||||
</MenuGroup>
|
||||
</GeneralSchemaDesigner>
|
||||
);
|
||||
|
@ -609,7 +609,8 @@ SchemaInitializer.SwitchItem = (props) => {
|
||||
return (
|
||||
<SchemaInitializer.Item onClick={props.onClick}>
|
||||
<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>
|
||||
</SchemaInitializer.Item>
|
||||
);
|
||||
|
@ -5,7 +5,7 @@ import { SchemaInitializer } from '..';
|
||||
import { useCurrentSchema } from '../utils';
|
||||
|
||||
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(
|
||||
schema?.[type] || item?.schema?.[type],
|
||||
type,
|
||||
@ -16,8 +16,12 @@ export const InitializerWithSwitch = (props) => {
|
||||
return (
|
||||
<SchemaInitializer.SwitchItem
|
||||
checked={exists}
|
||||
disabled={disabled}
|
||||
title={item.title}
|
||||
onClick={() => {
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
if (exists) {
|
||||
return remove();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user