mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 新增组件拖拽
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
import { getUUID } from '@/utils'
|
||||
import { BarCommonConfig } from './index'
|
||||
|
||||
export default class Config {
|
||||
name: string = 'BarCommon'
|
||||
id: string = getUUID()
|
||||
attr = { w: 500, h: 300 }
|
||||
// 图表的
|
||||
key: string = BarCommonConfig.key
|
||||
attr = { x: 0, y: 0, w: 500, h: 300 }
|
||||
|
||||
// 图表配置项
|
||||
public config = {
|
||||
global: {}
|
||||
}
|
||||
|
||||
// 设置坐标
|
||||
setPosition(x: number, y: number) {
|
||||
this.attr.x = x
|
||||
this.attr.y = y
|
||||
}
|
||||
}
|
||||
|
||||
+14
-4
@@ -8,9 +8,8 @@ import { ChartList } from '@/packages/components/Charts/index'
|
||||
import { DecorateList } from '@/packages/components/Decorates/index'
|
||||
import { InformationList } from '@/packages/components/Informations/index'
|
||||
import { TableList } from '@/packages/components/Tables/index'
|
||||
import {} from './useCreate'
|
||||
|
||||
// 所有图表
|
||||
// * 所有图表
|
||||
let packagesList: PackagesType = {
|
||||
[PackagesCategoryEnum.CHARTS]: ChartList,
|
||||
[PackagesCategoryEnum.INFORMATION]: InformationList,
|
||||
@@ -18,7 +17,7 @@ let packagesList: PackagesType = {
|
||||
[PackagesCategoryEnum.DECORATES]: DecorateList
|
||||
}
|
||||
|
||||
// 注册
|
||||
// * 注册
|
||||
const packagesInstall = (app: App): void => {
|
||||
for (const item in packagesList) {
|
||||
const chartList: ConfigType[] = (packagesList as any)[item]
|
||||
@@ -28,4 +27,15 @@ const packagesInstall = (app: App): void => {
|
||||
}
|
||||
}
|
||||
|
||||
export { packagesList, packagesInstall }
|
||||
/**
|
||||
* * 获取目标拖拽组件信息
|
||||
* @param dropData
|
||||
*/
|
||||
const createComponent = async (dropData: ConfigType) => {
|
||||
const { category } = dropData
|
||||
const key = dropData.key.substring(1)
|
||||
const chart = await import(`./components/${dropData.package}/${category}/${key}/config.ts`)
|
||||
return new chart.default()
|
||||
}
|
||||
|
||||
export { packagesList, packagesInstall, createComponent }
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import { ConfigType, PackagesCategoryEnum } from '@/packages/index.d'
|
||||
|
||||
/**
|
||||
* * 获取目标拖拽组件信息
|
||||
* @param drayData
|
||||
*/
|
||||
export const createComponent = async (drayData: Exclude<ConfigType, 'node'>) => {
|
||||
const chart = await import(`./${drayData.categoryName}`)
|
||||
return new chart()
|
||||
}
|
||||
Reference in New Issue
Block a user