Skip to content

Commit ac92753

Browse files
committed
Add layout import and new component aliases
Imported '@object-ui/layout' in Storybook preview for layout support. Registered 'chart:bar' as an alias for CRM App compatibility in plugin-charts, using ChartRenderer with defaultProps. Added and registered a 'view:simple' container component in plugin-view for flexible grid layouts.
1 parent e0a0b2a commit ac92753

3 files changed

Lines changed: 35 additions & 0 deletions

File tree

.storybook/preview.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import '@object-ui/plugin-map';
2929
import '@object-ui/plugin-markdown';
3030
import '@object-ui/plugin-timeline';
3131
import '@object-ui/plugin-view';
32+
import '@object-ui/layout';
3233

3334
const preview: Preview = {
3435
loaders: [mswLoader],

packages/plugin-charts/src/index.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,14 @@ export const chartComponents = {
209209
'bar-chart': ChartBarRenderer,
210210
'chart': ChartRenderer,
211211
};
212+
213+
// Alias for CRM App compatibility
214+
ComponentRegistry.register(
215+
'chart:bar',
216+
ChartRenderer, // Use the smart renderer to handle Tremor-like props
217+
{
218+
label: 'Bar Chart (Alias)',
219+
category: 'plugin',
220+
defaultProps: { chartType: 'bar' }
221+
}
222+
);

packages/plugin-view/src/index.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,26 @@ const ObjectViewRenderer: React.FC<{ schema: any }> = ({ schema }) => {
1919
};
2020

2121
ComponentRegistry.register('object-view', ObjectViewRenderer);
22+
23+
// Simple View Renderer (Container)
24+
const SimpleViewRenderer: React.FC<any> = ({ schema, className, children, ...props }) => {
25+
// If columns prop is present, use grid layout
26+
const style = schema.props?.columns
27+
? { display: 'grid', gridTemplateColumns: `repeat(${schema.props.columns}, 1fr)`, gap: '1rem' }
28+
: undefined;
29+
30+
return (
31+
<div
32+
className={className}
33+
style={style}
34+
{...props}
35+
>
36+
{children}
37+
</div>
38+
);
39+
};
40+
41+
ComponentRegistry.register('view:simple', SimpleViewRenderer, {
42+
label: 'Simple View',
43+
category: 'view'
44+
});

0 commit comments

Comments
 (0)