UNPKG

@riil-frontend/component-page-config

Version:

page config components,include components list,component attribute panel and page canvas

71 lines (69 loc) 2.16 kB
import _extends from "@babel/runtime/helpers/extends"; import React from 'react'; import DragLayoutCanvas from '../drag-panel'; import { getGridBackgroundStyle } from '../util'; function SingleEditor(props) { var appPageConfig = props.appPageConfig, selected = props.selected, droppingItem = props.droppingItem, isDroppable = props.isDroppable, isEdit = props.isEdit, _onChange = props.onChange, onWidgetSelect = props.onWidgetSelect, pageProps = props.pageProps, jumpto = props.jumpto, request = props.request, onClickBlank = props.onClickBlank, layoutProps = props.layoutProps, customGetComRequire = props.customGetComRequire, comDict = props.comDict; var item = appPageConfig.configs[0]; var _item$layoutConfig = item.layoutConfig, cols = _item$layoutConfig.cols, rowHeight = _item$layoutConfig.rowHeight; var sizeX = 100 / cols; var sizeY = rowHeight; var style = getGridBackgroundStyle({ line1Color: '#DCDEE3', line1Size: '1px', line2Color: '#eeeeee', line2Size: '1px', line1W: sizeX + "%", line1H: sizeY + "px", line2W: sizeX / 4 + "%", line2H: sizeY / 4 + "px" }, false); return /*#__PURE__*/React.createElement("div", { className: "creater-canvas", onClick: function onClick() { onClickBlank(); } }, /*#__PURE__*/React.createElement(DragLayoutCanvas, { style: item.layoutConfig.isShowGrid ? style : null, layoutProps: _extends({ droppingItem: droppingItem, isDroppable: isDroppable && isEdit }, layoutProps), pageConfig: item, selectedId: selected, onSelect: function onSelect(id) { onWidgetSelect(id); }, isEdit: isEdit, onChange: function onChange(widgets) { _onChange(_extends({}, item, { widgets: widgets })); }, allPageOnChange: function allPageOnChange(pageConfig) { _onChange(pageConfig); }, pageProps: pageProps, request: request, jumpto: jumpto, customGetComRequire: customGetComRequire, comDict: comDict, appConfig: appPageConfig })); } export default SingleEditor;