diff --git a/core/core-frontend/src/custom-component/circle-shape/Attr.vue b/core/core-frontend/src/custom-component/circle-shape/Attr.vue new file mode 100644 index 0000000000..50031ca63e --- /dev/null +++ b/core/core-frontend/src/custom-component/circle-shape/Attr.vue @@ -0,0 +1,13 @@ + + + diff --git a/core/core-frontend/src/custom-component/circle-shape/Component.vue b/core/core-frontend/src/custom-component/circle-shape/Component.vue new file mode 100644 index 0000000000..edceded7f6 --- /dev/null +++ b/core/core-frontend/src/custom-component/circle-shape/Component.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/core/core-frontend/src/custom-component/common/CommonAttr.vue b/core/core-frontend/src/custom-component/common/CommonAttr.vue index 7a805481d9..0f19fdbae4 100644 --- a/core/core-frontend/src/custom-component/common/CommonAttr.vue +++ b/core/core-frontend/src/custom-component/common/CommonAttr.vue @@ -90,7 +90,9 @@ const backgroundCustomShow = computed(() => { return ( dashboardActive.value || (!dashboardActive.value && - !['CanvasBoard', 'CanvasIcon', 'Picture'].includes(element.value.component)) + !['CanvasBoard', 'CanvasIcon', 'Picture', 'CircleShape', 'RectShape'].includes( + element.value.component + )) ) }) onMounted(() => { diff --git a/core/core-frontend/src/custom-component/common/ComponentConfig.ts b/core/core-frontend/src/custom-component/common/ComponentConfig.ts index ab15c2c185..d01e99c0d0 100644 --- a/core/core-frontend/src/custom-component/common/ComponentConfig.ts +++ b/core/core-frontend/src/custom-component/common/ComponentConfig.ts @@ -66,10 +66,16 @@ export const CANVAS_MATERIAL = [ span: 8, details: [ { - value: 'rect', + value: 'RectShape', type: 'graphical', title: '矩形', icon: 'graphical-rect' + }, + { + value: 'CircleShape', + type: 'graphical', + title: '圆形', + icon: 'graphical-circular' } ] }, diff --git a/core/core-frontend/src/custom-component/component-list.ts b/core/core-frontend/src/custom-component/component-list.ts index 234f4c2305..4c807295aa 100644 --- a/core/core-frontend/src/custom-component/component-list.ts +++ b/core/core-frontend/src/custom-component/component-list.ts @@ -164,7 +164,7 @@ const list = [ }, { component: 'CanvasBoard', - name: '边框', + name: '图形', label: '边框', propValue: '', icon: 'other_material_board', @@ -182,23 +182,48 @@ const list = [ } }, { - component: 'DeGraphical', - name: '图形', - label: '图形', - propValue: '', + component: 'RectShape', + name: '矩形', + label: '矩形', + propValue: ' ', icon: 'icon_graphical', - innerType: '', - editing: false, - canvasActive: false, - x: 1, - y: 1, - sizeX: 15, - sizeY: 15, style: { + width: 200, + height: 200, borderColor: '#000', borderWidth: 1, backgroundColor: '', - borderStyle: 'solid' + borderStyle: 'solid', + borderRadius: 5 + } + }, + { + component: 'CircleShape', + name: '图形', + label: '圆形', + propValue: ' ', + icon: 'icon_graphical', + style: { + width: 200, + height: 200, + borderColor: '#000', + borderWidth: 1, + borderStyle: 'solid', + backgroundColor: '' + } + }, + { + component: 'SvgTriangle', + name: '图形', + label: '三角形', + icon: 'icon_graphical', + propValue: '', + style: { + width: 200, + height: 200, + borderColor: '#000', + borderWidth: 1, + backgroundColor: '' } }, { diff --git a/core/core-frontend/src/custom-component/rect-shape/Attr.vue b/core/core-frontend/src/custom-component/rect-shape/Attr.vue new file mode 100644 index 0000000000..50031ca63e --- /dev/null +++ b/core/core-frontend/src/custom-component/rect-shape/Attr.vue @@ -0,0 +1,13 @@ + + + diff --git a/core/core-frontend/src/custom-component/rect-shape/Component.vue b/core/core-frontend/src/custom-component/rect-shape/Component.vue new file mode 100644 index 0000000000..040be98757 --- /dev/null +++ b/core/core-frontend/src/custom-component/rect-shape/Component.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/core/core-frontend/src/custom-component/svgs/svg-star/Attr.vue b/core/core-frontend/src/custom-component/svgs/svg-star/Attr.vue new file mode 100644 index 0000000000..50031ca63e --- /dev/null +++ b/core/core-frontend/src/custom-component/svgs/svg-star/Attr.vue @@ -0,0 +1,13 @@ + + + diff --git a/core/core-frontend/src/custom-component/svgs/svg-star/Component.vue b/core/core-frontend/src/custom-component/svgs/svg-star/Component.vue new file mode 100644 index 0000000000..7294694f31 --- /dev/null +++ b/core/core-frontend/src/custom-component/svgs/svg-star/Component.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/core/core-frontend/src/custom-component/svgs/svg-triangle/Attr.vue b/core/core-frontend/src/custom-component/svgs/svg-triangle/Attr.vue new file mode 100644 index 0000000000..50031ca63e --- /dev/null +++ b/core/core-frontend/src/custom-component/svgs/svg-triangle/Attr.vue @@ -0,0 +1,13 @@ + + + diff --git a/core/core-frontend/src/custom-component/svgs/svg-triangle/Component.vue b/core/core-frontend/src/custom-component/svgs/svg-triangle/Component.vue new file mode 100644 index 0000000000..af4263b29b --- /dev/null +++ b/core/core-frontend/src/custom-component/svgs/svg-triangle/Component.vue @@ -0,0 +1,91 @@ + + + + diff --git a/core/core-frontend/src/utils/canvasUtils.ts b/core/core-frontend/src/utils/canvasUtils.ts index 91ef77b2be..7e63ac9a51 100644 --- a/core/core-frontend/src/utils/canvasUtils.ts +++ b/core/core-frontend/src/utils/canvasUtils.ts @@ -41,7 +41,7 @@ export function findDragComponent(componentInfo) { export function findNewComponent(componentName, innerType) { let newComponent componentList.forEach(comp => { - if (comp.component === componentName) { + if (comp.component === componentName || comp.component === innerType) { newComponent = cloneDeep(comp) newComponent.innerType = innerType if (newComponent.innerType === 'richText') { diff --git a/core/core-frontend/src/utils/components.ts b/core/core-frontend/src/utils/components.ts index 45610af6ec..f290ec5b73 100644 --- a/core/core-frontend/src/utils/components.ts +++ b/core/core-frontend/src/utils/components.ts @@ -15,6 +15,12 @@ import DeTabs from '@/custom-component/de-tabs/Component.vue' import DeTabsAttr from '@/custom-component/de-tabs/Attr.vue' import DeGraphical from '@/custom-component/de-graphical/Component.vue' import DeGraphicalAttr from '@/custom-component/de-graphical/Attr.vue' +import CircleShape from '@/custom-component/circle-shape/Component.vue' +import CircleShapeAttr from '@/custom-component/circle-shape/Attr.vue' +import RectShape from '@/custom-component/rect-shape/Component.vue' +import RectShapeAttr from '@/custom-component/rect-shape/Attr.vue' +import SvgTriangle from '@/custom-component/svgs/svg-triangle/Component.vue' +import SvgTriangleAttr from '@/custom-component/svgs/svg-triangle/Attr.vue' export const componentsMap = { VText: VText, @@ -33,7 +39,13 @@ export const componentsMap = { DeTabs: DeTabs, DeTabsAttr: DeTabsAttr, DeGraphical: DeGraphical, - DeGraphicalAttr: DeGraphicalAttr + DeGraphicalAttr: DeGraphicalAttr, + CircleShape: CircleShape, + CircleShapeAttr: CircleShapeAttr, + RectShape: RectShape, + RectShapeAttr: RectShapeAttr, + SvgTriangle: SvgTriangle, + SvgTriangleAttr: SvgTriangleAttr } export default function findComponent(key) {