components have their own icons (?)
This commit is contained in:
parent
60baed5e22
commit
08f1b12143
2 changed files with 35 additions and 35 deletions
|
@ -35,16 +35,10 @@
|
|||
import UpLink from "@/components/UpLink.vue";
|
||||
import Compass from "@/components/widgets/Compass.vue";
|
||||
import Table from "@/components/widgets/Table.vue";
|
||||
import { UpType } from "@/lib/types";
|
||||
import { UpType, Widget } from "@/lib/types";
|
||||
import { AttributeChange, IEntry } from "@/types/base";
|
||||
import { ComponentOptions, defineComponent, PropType } from "vue";
|
||||
|
||||
interface Widget {
|
||||
name: string;
|
||||
icon?: string;
|
||||
components: ComponentOptions[];
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: "AttributeView",
|
||||
components: {
|
||||
|
@ -88,11 +82,7 @@ export default defineComponent({
|
|||
const result = [] as Widget[];
|
||||
|
||||
if (this.type?.widgetInfo) {
|
||||
result.push({
|
||||
name: this.type.name || this.type.address,
|
||||
icon: this.type.icon,
|
||||
components: this.type.widgetInfo,
|
||||
});
|
||||
result.push(this.type.widgetInfo);
|
||||
}
|
||||
|
||||
result.push({
|
||||
|
|
|
@ -13,19 +13,28 @@ export class UpType {
|
|||
return this.name ? TYPE_ICONS[this.name] : undefined;
|
||||
}
|
||||
|
||||
public get widgetInfo(): ComponentOptions[] | undefined {
|
||||
public get widgetInfo(): Widget | undefined {
|
||||
return this.name ? TYPE_WIDGETS[this.name] : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export interface Widget {
|
||||
name: string;
|
||||
icon?: string;
|
||||
components: ComponentOptions[];
|
||||
}
|
||||
|
||||
const TYPE_ICONS: { [key: string]: string } = {
|
||||
"BLOB": "box",
|
||||
"FS_FILE": "file-earmark",
|
||||
"FS_DIR": "folder"
|
||||
}
|
||||
|
||||
const TYPE_WIDGETS: { [key: string]: ComponentOptions[] } = {
|
||||
"KSX_TRACK_MOODS": [
|
||||
const TYPE_WIDGETS: { [key: string]: Widget } = {
|
||||
"KSX_TRACK_MOODS": {
|
||||
name: "ksx-track-compass",
|
||||
icon: "plus-square",
|
||||
components: [
|
||||
{
|
||||
name: "Compass",
|
||||
id: "compass_tint_energy",
|
||||
|
@ -47,4 +56,5 @@ const TYPE_WIDGETS: { [key: string]: ComponentOptions[] } = {
|
|||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue