MCPcopy
hub / github.com/buqiyuan/vite-vue3-lowcode / createNewBlock

Function createNewBlock

src/visual-editor/visual-editor.utils.ts:231–263  ·  view source on GitHub ↗
(component: VisualEditorComponent)

Source from the content-addressed store, hash-verified

229};
230
231export function createNewBlock(component: VisualEditorComponent): VisualEditorBlockData {
232 return {
233 _vid: `vid_${generateNanoid()}`,
234 moduleName: component.moduleName,
235 componentKey: component!.key,
236 label: component!.label,
237 adjustPosition: true,
238 focus: false,
239 styles: {
240 display: 'flex',
241 justifyContent: 'flex-start',
242 paddingTop: '0',
243 paddingRight: '0',
244 paddingLeft: '0',
245 paddingBottom: '0',
246 tempPadding: '0',
247 },
248 hasResize: false,
249 props: Object.entries(component.props || {}).reduce((prev, [propName, propSchema]) => {
250 const { propObj, prop } = useDotProp(prev, propName);
251 if (propSchema?.defaultValue) {
252 propObj[prop] = prev[propName] = propSchema?.defaultValue;
253 }
254 return prev;
255 }, {}),
256 draggable: component.draggable ?? true, // 是否可以拖拽
257 showStyleConfig: component.showStyleConfig ?? true, // 是否显示组件样式配置
258 animations: [], // 动画集
259 actions: [], // 动作集合
260 events: component.events || [], // 事件集合
261 model: {},
262 };
263}
264
265export type VisualDragEvent = {
266 dragstart: {

Callers 3

index.tsxFile · 0.90
cloneDogFunction · 0.90
cloneDogFunction · 0.90

Calls 1

useDotPropFunction · 0.90

Tested by

no test coverage detected