mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-21 21:47:17 +00:00
36 lines
1,017 B
JavaScript
36 lines
1,017 B
JavaScript
|
|
import { widgets } from './widgetConfig';
|
||
|
|
|
||
|
|
const universalProps = {
|
||
|
|
properties: {},
|
||
|
|
general: {
|
||
|
|
tooltip: { type: 'code', displayName: 'Tooltip' },
|
||
|
|
},
|
||
|
|
others: {},
|
||
|
|
events: {},
|
||
|
|
styles: {},
|
||
|
|
definition: {
|
||
|
|
others: {},
|
||
|
|
events: [],
|
||
|
|
styles: {},
|
||
|
|
},
|
||
|
|
};
|
||
|
|
|
||
|
|
const combineProperties = (widget, universal, isArray = false) => {
|
||
|
|
return {
|
||
|
|
...widget,
|
||
|
|
properties: { ...universal.properties, ...widget.properties },
|
||
|
|
general: { ...universal.general, ...widget.general },
|
||
|
|
others: { ...universal.others, ...widget.others },
|
||
|
|
events: isArray ? [...universal.events, ...widget.events] : { ...universal.events, ...widget.events },
|
||
|
|
styles: { ...universal.styles, ...widget.styles },
|
||
|
|
exposedVariables: { ...universal.exposedVariables, ...widget.exposedVariables },
|
||
|
|
};
|
||
|
|
};
|
||
|
|
|
||
|
|
export const componentTypes = widgets.map((widget) => {
|
||
|
|
return {
|
||
|
|
...combineProperties(widget, universalProps),
|
||
|
|
definition: combineProperties(widget.definition, universalProps.definition, true),
|
||
|
|
};
|
||
|
|
});
|