Skip to content

Commit

Permalink
Merge pull request #138 from AnsGoo/dev
Browse files Browse the repository at this point in the history
fix: 重构了接口
  • Loading branch information
AnsGoo authored May 19, 2024
2 parents d3d5666 + 4cf5680 commit 37b7633
Show file tree
Hide file tree
Showing 66 changed files with 72 additions and 72 deletions.
2 changes: 1 addition & 1 deletion examples/src/assets/images/nav-theme-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions examples/src/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const useLoadComponent = () => {
const componentOptions = moduleFilesTs[key]?.default

if (componentOptions) {
const { componentName, config, mainfest, component } = componentOptions
const name = mainfest ? mainfest.name : componentName
canvasState.loadComponent(name, config as BaseComponent, mainfest)
const { componentName, config, manifest, component } = componentOptions
const name = manifest ? manifest.name : componentName
canvasState.loadComponent(name, config as BaseComponent, manifest)
// 注册异步组件
const asyncComp = defineAsyncComponent({
loader: component,
Expand All @@ -42,14 +42,14 @@ const useAsyncLoadComponent = () => {
const keys = Object.keys(components)
keys.forEach((el) => {
const pkg = components[el]
const { mainfest, panel, component } = pkg
const { manifest, panel, component } = pkg
const asyncComp = defineAsyncComponent({
loader: component,
delay: 200,
timeout: 3000
})
canvasState.loadComponents(mainfest.name, mainfest, panel)
app.component(mainfest.name, asyncComp)
canvasState.loadComponents(manifest.name, manifest, panel)
app.component(manifest.name, asyncComp)
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/designer/src/state/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ class CanvasState {
return this.state.components
}

public loadComponent(name: string, component: CustomComponent, mainfest?: any) {
if (mainfest) {
public loadComponent(name: string, component: CustomComponent, manifest?: any) {
if (manifest) {
this.componentMetaMap.set(name, {
...mainfest,
...manifest,
clazz: isClass(component) ? component : undefined,
remoteClazz: isClass(component) ? undefined : component
})
Expand Down
4 changes: 2 additions & 2 deletions resource/Basic/Image/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./Image.vue'),
config: () => import('./config'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Basic/Video/FlvVideo/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./FlvVideo.vue'),
config: () => import('./config'),
mainfest
manifest
}
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Border/BorderBox2/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./BorderBox.vue'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Border/BorderBox3/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./BorderBox.vue'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Border/BorderBox4/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./BorderBox.vue'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Border/BorderBox5/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./BorderBox.vue'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Border/BorderBox6/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./BorderBox.vue'),
config: () => import('./config'),
mainfest
manifest
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./BorderBox.vue'),
mainfest
manifest
}
4 changes: 2 additions & 2 deletions resource/Border/BorderImage/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./BorderImage.vue'),
config: () => import('./config'),
mainfest
manifest
}
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Decoration/Decoration1/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./Decoration.vue'),
mainfest
manifest
}
4 changes: 2 additions & 2 deletions resource/Decoration/Decoration2/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./Decoration.vue'),
mainfest
manifest
}
4 changes: 2 additions & 2 deletions resource/Decoration/Decoration3/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./Decoration.vue'),
mainfest
manifest
}
4 changes: 2 additions & 2 deletions resource/Decoration/Decoration4/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./Decoration.vue'),
mainfest
manifest
}
4 changes: 2 additions & 2 deletions resource/Gauge/Gauge1/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./Gauge.vue'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Progress/Progress/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ProgressComponent from './config'
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./Progress.vue'),
config: ProgressComponent,
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Progress/RankBoard/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./RankBoard.vue'),
config: () => import('./config'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Table/ScrollTable/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./ScrollTable.vue'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Text/DateText/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./DateText.vue'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Text/StaticText/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./StaticText.vue'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/Text/SubText/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./SubText.vue'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/echarts/BarChart/BasicBarChart/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./BasicBarChart.vue'),
config: () => import('./config'),
mainfest
manifest
}
4 changes: 2 additions & 2 deletions resource/echarts/BarChart/StereoscopicLineChart/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
config: () => import('./config'),
component: () => import('./src/StereoscopicBarChart.vue'),
mainfest
manifest
}
4 changes: 2 additions & 2 deletions resource/echarts/ComChart/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
mainfest,
manifest,
component: () => import('./ComChart.vue'),
config: () => import('./config')
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resource/echarts/LineChart/BasicLineChart/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./BasicLineChart.vue'),
config: () => import('./config'),
mainfest
manifest
}
4 changes: 2 additions & 2 deletions resource/echarts/MapChart/MapChart/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./src/MapChart.vue'),
config: () => import('./config'),
mainfest
manifest
}
4 changes: 2 additions & 2 deletions resource/echarts/PieChart/BasicPieChart/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./BasicPieChart.vue'),
config: () => import('./config'),
mainfest
manifest
}
4 changes: 2 additions & 2 deletions resource/echarts/WaterChart/WaveChart/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./WaveChart.vue'),
config: () => import('./config'),
mainfest
manifest
}
4 changes: 2 additions & 2 deletions resources/Basic/BorderBox1/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./BorderBox.vue'),
panel: () => import('./panel'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resources/Basic/Image/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./Image.vue'),
panel: () => import('./panel'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resources/Chart/BasicBarChart/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./BasicBarChart.vue'),
panel: () => import('./panel'),
mainfest
manifest
}
File renamed without changes.
4 changes: 2 additions & 2 deletions resources/Gauge/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mainfest from './mainfest.json'
import manifest from './manifest.json'

export default {
component: () => import('./Gauge.vue'),
panel: () => import('./panel'),
mainfest
manifest
}
File renamed without changes.

0 comments on commit 37b7633

Please sign in to comment.