diff --git a/packages/toolpad-studio/src/runtime/toolpadComponents/layoutBox.ts b/packages/toolpad-studio/src/runtime/toolpadComponents/layoutBox.ts index d7b272db61b..9a2cc841ebf 100644 --- a/packages/toolpad-studio/src/runtime/toolpadComponents/layoutBox.ts +++ b/packages/toolpad-studio/src/runtime/toolpadComponents/layoutBox.ts @@ -15,7 +15,7 @@ export const layoutBoxArgTypes: { enum: ['start', 'center', 'end', 'space-between', 'space-around', 'space-evenly'], default: 'start', label: 'Horizontal alignment', - control: { type: 'HorizontalAlign', hideLabel: true }, + control: { type: 'HorizontalAlign', hideLabel: true, bindable: false }, }, verticalAlign: { helperText: 'Vertical alignment of the component.', @@ -23,6 +23,6 @@ export const layoutBoxArgTypes: { enum: ['start', 'center', 'end', 'space-between', 'space-around', 'space-evenly'], default: 'start', label: 'Vertical alignment', - control: { type: 'VerticalAlign', hideLabel: true }, + control: { type: 'VerticalAlign', hideLabel: true, bindable: false }, }, }; diff --git a/packages/toolpad-studio/src/toolpad/AppEditor/PageEditor/BindableEditor.tsx b/packages/toolpad-studio/src/toolpad/AppEditor/PageEditor/BindableEditor.tsx index 007ebc820fb..16354442329 100644 --- a/packages/toolpad-studio/src/toolpad/AppEditor/PageEditor/BindableEditor.tsx +++ b/packages/toolpad-studio/src/toolpad/AppEditor/PageEditor/BindableEditor.tsx @@ -14,6 +14,7 @@ import { JsRuntime, ScopeMeta, EnvAttrValue, + ArgTypeDefinition, } from '@toolpad/studio-runtime'; import { WithControlledProp } from '@toolpad/utils/types'; import { getBindingType } from '../../../runtime/bindings'; @@ -43,7 +44,7 @@ export interface BindableEditorProps extends WithControlledProp; renderControl?: (params: RenderControlParams) => React.ReactNode; liveBinding?: LiveBinding; globalScope?: Record; @@ -103,14 +104,14 @@ export default function BindableEditor({ return ( - - {renderControl({ - label, - propType, - disabled: disabled || !!hasBinding, - value: constValue, - onChange: handlePropConstChange, - })} + {renderControl({ + label, + propType, + disabled: disabled || !!hasBinding, + value: constValue, + onChange: handlePropConstChange, + })} + {propType.control?.bindable === false ? null : ( globalScope={globalScope} globalScopeMeta={globalScopeMeta} @@ -125,7 +126,7 @@ export default function BindableEditor({ env={env} declaredEnvKeys={declaredEnvKeys} /> - + )} ); } diff --git a/packages/toolpad-studio/src/toolpad/AppEditor/PageEditor/ComponentEditor.tsx b/packages/toolpad-studio/src/toolpad/AppEditor/PageEditor/ComponentEditor.tsx index 5ecd8374695..0a37692ac97 100644 --- a/packages/toolpad-studio/src/toolpad/AppEditor/PageEditor/ComponentEditor.tsx +++ b/packages/toolpad-studio/src/toolpad/AppEditor/PageEditor/ComponentEditor.tsx @@ -11,6 +11,7 @@ import { } from '@toolpad/studio-runtime'; import { ExactEntriesOf } from '@toolpad/utils/types'; import * as appDom from '@toolpad/studio-runtime/appDom'; +import Box from '@mui/system/Box'; import NodeAttributeEditor from './NodeAttributeEditor'; import { usePageEditorState } from './PageEditorProvider'; import { useToolpadComponent } from '../toolpadComponents'; @@ -106,7 +107,15 @@ function ComponentPropsEditor

({

Alignment: - + {hasLayoutHorizontalControls ? ( ({ argType={layoutBoxArgTypes.verticalAlign} /> ) : null} - +
diff --git a/packages/toolpad-studio/src/toolpad/AppEditor/PageEditor/NodeAttributeEditor.tsx b/packages/toolpad-studio/src/toolpad/AppEditor/PageEditor/NodeAttributeEditor.tsx index 4c774039c77..fb3840d5120 100644 --- a/packages/toolpad-studio/src/toolpad/AppEditor/PageEditor/NodeAttributeEditor.tsx +++ b/packages/toolpad-studio/src/toolpad/AppEditor/PageEditor/NodeAttributeEditor.tsx @@ -96,7 +96,7 @@ export default function NodeAttributeEditor

({ propType={argType} jsRuntime={jsBrowserRuntime} renderControl={(params) => ( - + )} diff --git a/packages/toolpad-studio/src/toolpadDataSources/TranformInput.tsx b/packages/toolpad-studio/src/toolpadDataSources/TranformInput.tsx index 4e52c9857fa..1224ccc93a5 100644 --- a/packages/toolpad-studio/src/toolpadDataSources/TranformInput.tsx +++ b/packages/toolpad-studio/src/toolpadDataSources/TranformInput.tsx @@ -1,4 +1,4 @@ -import { Stack, Grid, Checkbox, FormControlLabel, IconButton } from '@mui/material'; +import { Stack, Checkbox, FormControlLabel, IconButton } from '@mui/material'; import * as React from 'react'; import AutorenewIcon from '@mui/icons-material/Autorenew'; import JsonView from '../components/JsonView'; @@ -31,72 +31,70 @@ export default function TransformInput({ ); return ( - - - + + } + /> + + + - } /> - - - - {onUpdatePreview ? ( - - + - - ) : null} - - + '100%': { + transform: 'rotate(360deg)', + }, + }, + }} + fontSize="inherit" + /> + + ) : null} + - + ); } diff --git a/packages/toolpad-studio/src/toolpadDataSources/local/client.tsx b/packages/toolpad-studio/src/toolpadDataSources/local/client.tsx index b9b2bc5a225..5974135d741 100644 --- a/packages/toolpad-studio/src/toolpadDataSources/local/client.tsx +++ b/packages/toolpad-studio/src/toolpadDataSources/local/client.tsx @@ -340,35 +340,43 @@ function QueryEditor({ - + {Object.entries(parameterDefs).map(([name, definiton]) => { const Control = getDefaultControl(propTypeControls, definiton, liveBindings); - return Control ? ( - ( - - )} - value={paramsObject[name]} - onChange={(newValue) => { - const paramKeys = Object.keys(parameterDefs); - const newParams: BindableAttrEntries = paramKeys.flatMap((key) => { - const paramValue = key === name ? newValue : paramsObject[key]; - return paramValue ? [[key, paramValue]] : []; - }); - appStateApi.updateQueryDraft((draft) => ({ - ...draft, - params: newParams, - })); - }} - /> - ) : null; + if (!Control) { + return ( + + Can't configure {name} + + ); + } + return ( + + ( + + )} + value={paramsObject[name]} + onChange={(newValue) => { + const paramKeys = Object.keys(parameterDefs); + const newParams: BindableAttrEntries = paramKeys.flatMap((key) => { + const paramValue = key === name ? newValue : paramsObject[key]; + return paramValue ? [[key, paramValue]] : []; + }); + appStateApi.updateQueryDraft((draft) => ({ + ...draft, + params: newParams, + })); + }} + /> + + ); })}