2022-01-13 14:41:44 +01:00
|
|
|
import { Component } from "vue";
|
|
|
|
|
import { ZeroEditorField, ZeroSchema, ZeroEditorDisplay } from "zero/schemas";
|
2021-12-21 13:58:48 +01:00
|
|
|
import { ZeroEditorCanvas } from "./editor-canvas";
|
|
|
|
|
|
2021-12-23 13:47:34 +01:00
|
|
|
export class ZeroEditor extends ZeroEditorCanvas implements ZeroSchema
|
2021-12-21 13:58:48 +01:00
|
|
|
{
|
2021-12-22 10:55:40 +01:00
|
|
|
alias: string;
|
|
|
|
|
|
2021-12-21 13:58:48 +01:00
|
|
|
resourcePrefix?: string;
|
|
|
|
|
|
2021-12-21 14:41:50 +01:00
|
|
|
system: boolean = false;
|
|
|
|
|
|
2021-12-30 13:39:31 +01:00
|
|
|
display: ZeroEditorDisplay = 'tabs';
|
|
|
|
|
|
2021-12-21 13:58:48 +01:00
|
|
|
onLabelCreate = (field: ZeroEditorField): string =>
|
|
|
|
|
{
|
|
|
|
|
return field.configuration.label || (this.resourcePrefix ? this.resourcePrefix + field.path : '@nolabel[' + field.path + ']');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onDescriptionCreate = (field: ZeroEditorField): string | null =>
|
|
|
|
|
{
|
|
|
|
|
return field.configuration.description || (this.resourcePrefix ? this.resourcePrefix + field.path + '_text' : '@nodesc[' + field.path + ']');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2021-12-22 10:55:40 +01:00
|
|
|
constructor(alias: string)
|
2021-12-21 13:58:48 +01:00
|
|
|
{
|
|
|
|
|
super();
|
2021-12-22 10:55:40 +01:00
|
|
|
this.alias = alias;
|
2021-12-21 13:58:48 +01:00
|
|
|
}
|
2022-01-13 14:41:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class ZeroModuleEditor extends ZeroEditor
|
|
|
|
|
{
|
|
|
|
|
preview: ZeroModuleEditorPreview;
|
|
|
|
|
|
|
|
|
|
constructor(alias: string)
|
|
|
|
|
{
|
|
|
|
|
super(alias);
|
|
|
|
|
|
|
|
|
|
this.preview = {
|
|
|
|
|
hideLabel: false
|
|
|
|
|
} as ZeroModuleEditorPreview;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface ZeroModuleEditorPreview
|
|
|
|
|
{
|
|
|
|
|
hideLabel?: boolean;
|
2021-12-21 13:58:48 +01:00
|
|
|
}
|