diff --git a/zero.Backoffice.UI/app/components/editor/blueprint/property.vue b/zero.Backoffice.UI/app/components/editor/blueprint/property.vue
new file mode 100644
index 00000000..e0bca79d
--- /dev/null
+++ b/zero.Backoffice.UI/app/components/editor/blueprint/property.vue
@@ -0,0 +1,325 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/zero.Backoffice.UI/app/components/editor/blueprint/settings.vue b/zero.Backoffice.UI/app/components/editor/blueprint/settings.vue
new file mode 100644
index 00000000..73424559
--- /dev/null
+++ b/zero.Backoffice.UI/app/components/editor/blueprint/settings.vue
@@ -0,0 +1,225 @@
+
+
+
+
+
+
+
+
+
+
+ By default all properties of your entity are synced with its blueprint.
You can disable synchronisation per property so it won't be overridden on changes.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/zero.Backoffice.UI/app/components/editor/ui-editor-component - Copy.vue b/zero.Backoffice.UI/app/components/editor/ui-editor-component - Copy.vue
deleted file mode 100644
index 9cb09cb7..00000000
--- a/zero.Backoffice.UI/app/components/editor/ui-editor-component - Copy.vue
+++ /dev/null
@@ -1,189 +0,0 @@
--
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/zero.Backoffice.UI/app/components/editor/ui-editor-component.vue b/zero.Backoffice.UI/app/components/editor/ui-editor-component.vue
index 8e11f28e..6ef1e582 100644
--- a/zero.Backoffice.UI/app/components/editor/ui-editor-component.vue
+++ b/zero.Backoffice.UI/app/components/editor/ui-editor-component.vue
@@ -7,6 +7,11 @@
:required="!field.optional(value)"
:disabled="isDisabled"
:vertical="!field.horizontal"
+ :class="{'is-disabled': isDisabled }"
+ :locked="isLocked"
+ :can-unlock="canUnlock || false"
+ @unlock="unlock"
+ @lock="lock"
>
-
-
@@ -90,15 +84,15 @@
isDisabled()
{
return this.manualDisabled || this.disabled || this.field.readonly(this.model);
+ },
+ isLocked()
+ {
+ return false; //this.editor.blueprint && !this.editor.blueprint.unlocked(this.value, this.field);
+ },
+ canUnlock()
+ {
+ return false; // this.editor.blueprint && this.editor.blueprint.canUnlock(this.value, this.field);
}
- //isLocked()
- //{
- // return this.editor.blueprint && !this.editor.blueprint.unlocked(this.value, this.field);
- //},
- //canUnlock()
- //{
- // return this.editor.blueprint && this.editor.blueprint.canUnlock(this.value, this.field);
- //}
},
methods: {
diff --git a/zero.Backoffice.UI/app/components/editor/ui-editor.vue b/zero.Backoffice.UI/app/components/editor/ui-editor.vue
index d498e48d..e375ae93 100644
--- a/zero.Backoffice.UI/app/components/editor/ui-editor.vue
+++ b/zero.Backoffice.UI/app/components/editor/ui-editor.vue
@@ -14,7 +14,7 @@
:disabled="tab.disabled(value)">
-
+
@@ -47,13 +47,10 @@
import './ui-editor.scss';
import EditorComponent from './ui-editor-component.vue';
- //import { createBlueprintConfig } from './editor-blueprint';
- //import BlueprintProperty from './blueprint/property.vue';
+ import BlueprintProperty from './blueprint/property.vue';
import { defineComponent } from 'vue';
import { compileEditor } from '../../editor/compile';
- let createBlueprintConfig = () => null;
-
export default defineComponent({
name: 'uiEditor',
@@ -91,7 +88,7 @@
},
},
- components: { EditorComponent },
+ components: { EditorComponent, BlueprintProperty },
data: () => ({
display: 'tabs',
@@ -122,9 +119,7 @@
this.system = this.$route.query['zero.scope'] == 'system';
const schema = typeof this.config === 'string' ? await this.zero.getSchema(this.config) : this.config;
const editor = compileEditor(this.zero, schema);
-
this.editorConfig = editor;
- //this.editorConfig.blueprint = createBlueprintConfig(this.zero, this.editorConfig, this.value);
this.onConfigure(this);
diff --git a/zero.Backoffice.UI/app/components/ui-add-button.vue b/zero.Backoffice.UI/app/components/ui-add-button.vue
index b046915f..c61c0eae 100644
--- a/zero.Backoffice.UI/app/components/ui-add-button.vue
+++ b/zero.Backoffice.UI/app/components/ui-add-button.vue
@@ -144,7 +144,7 @@
}
if (shared)
{
- routeObj.query['zero.scope'] = 'shared';
+ routeObj.query['zero.scope'] = 'system';
}
this.$router.push(routeObj);
}
diff --git a/zero.Backoffice.UI/app/editor/compile.ts b/zero.Backoffice.UI/app/editor/compile.ts
index c14ddafe..4311ef85 100644
--- a/zero.Backoffice.UI/app/editor/compile.ts
+++ b/zero.Backoffice.UI/app/editor/compile.ts
@@ -2,12 +2,16 @@ import { Component } from "vue";
import { ZeroEditorField } from "zero/schemas";
import { Zero } from "../core";
import { ZeroEditor } from "./editor";
+import { createBlueprintConfig } from "./editor-blueprint";
import { ZeroEditorCanvasBase, ZeroEditorTab } from "./editor-canvas";
import { ZeroEditorFieldConfiguration } from "./editor-field";
+import { localize } from '../services/localization';
export interface ZeroCompiledEditor
{
+ alias: string;
+ blueprint: any;
tabs: ZeroCompiledEditorTab[];
}
@@ -108,8 +112,8 @@ export function compileField(zero: Zero, editor: ZeroEditor, field: ZeroEditorFi
return false;
},
- label: editor.onLabelCreate(field),
- description: editor.onDescriptionCreate(field),
+ label: editor.onLabelCreate(field),
+ description: localize(editor.onDescriptionCreate(field), { hideEmpty: true }),
hideLabel: field.configuration.hideLabel,
helpText: field.configuration.helpText,
classes: field.configuration.classes,
@@ -125,6 +129,8 @@ export function compileField(zero: Zero, editor: ZeroEditor, field: ZeroEditorFi
export function compileEditor(zero: Zero, editor: ZeroEditor): ZeroCompiledEditor
{
let model = {
+ alias: editor.alias,
+ blueprint: null,
tabs: []
} as ZeroCompiledEditor;
@@ -220,5 +226,7 @@ export function compileEditor(zero: Zero, editor: ZeroEditor): ZeroCompiledEdito
}
});
+ model.blueprint = createBlueprintConfig(model.alias, model);
+
return model;
}
\ No newline at end of file
diff --git a/zero.Backoffice.UI/app/editor/legacy/editor-blueprint.ts b/zero.Backoffice.UI/app/editor/editor-blueprint.ts
similarity index 82%
rename from zero.Backoffice.UI/app/editor/legacy/editor-blueprint.ts
rename to zero.Backoffice.UI/app/editor/editor-blueprint.ts
index 591f24e3..11329102 100644
--- a/zero.Backoffice.UI/app/editor/legacy/editor-blueprint.ts
+++ b/zero.Backoffice.UI/app/editor/editor-blueprint.ts
@@ -2,6 +2,7 @@
import { localize } from '../services/localization';
import { arrayRemove } from '../utils/arrays';
import { useUiStore } from '../ui/store';
+import { ZeroCompiledEditor } from './compile';
function unlocked(config, model, field)
{
@@ -77,16 +78,17 @@ function unlock(config, model, field)
* @param {string} alias - Alias for the tab
* @returns {EditorBlueprint}
*/
-export function createBlueprintConfig(zero, editor, model)
+export function createBlueprintConfig(alias: string, editor: ZeroCompiledEditor)
{
const store = useUiStore();
- let blueprintAlias = editor.blueprintAlias;
+ let blueprintAlias = editor.alias;
let canBeBlueprinted = store.blueprints.indexOf(blueprintAlias) > -1;
if (!blueprintAlias || !canBeBlueprinted)
{
return {
alias: blueprintAlias,
+ isEnabled: false,
unlocked: () => true,
canUnlock: () => false,
isBlueprintParent: () => false,
@@ -128,28 +130,35 @@ export function createBlueprintConfig(zero, editor, model)
});
// add blueprint setting for custom fields
- editor.fields.forEach(field =>
+ editor.tabs.forEach(tab =>
{
- let alias = field.path;
-
- if (processed.indexOf(alias) < 0)
+ tab.fieldsets.forEach(set =>
{
- processed.push(alias);
-
- if (config.unlocked.indexOf(alias) > -1 || config.unlocked.find(x => alias.indexOf(x + '.') === 0))
+ set.fields.forEach(field =>
{
- fields.push({
- path: alias,
- label: field.options.label || editor.templateLabel(alias),
- description: localize(field.options.description || editor.templateDescription(alias), { hideEmpty: true }),
- synced: model => !model.blueprint || model.blueprint.desync.indexOf(alias) < 0
- });
- }
- }
+ let alias = field.path;
+
+ if (processed.indexOf(alias) < 0)
+ {
+ processed.push(alias);
+
+ if (config.unlocked.indexOf(alias) > -1 || config.unlocked.find(x => alias.indexOf(x + '.') === 0))
+ {
+ fields.push({
+ path: alias,
+ label: field.label,
+ description: field.description,
+ synced: model => !model.blueprint || model.blueprint.desync.indexOf(alias) < 0
+ });
+ }
+ }
+ });
+ });
});
return {
alias: blueprintAlias,
+ isEnabled: true,
unlocked: (model, field) => unlocked(config, model, field),
canUnlock: (model, field) => canUnlock(config, model, field),
unlock: async (model, field) => await unlock(config, model, field),
diff --git a/zero.Backoffice.UI/app/editor/editor.ts b/zero.Backoffice.UI/app/editor/editor.ts
index 13dbe427..c9801868 100644
--- a/zero.Backoffice.UI/app/editor/editor.ts
+++ b/zero.Backoffice.UI/app/editor/editor.ts
@@ -1,9 +1,10 @@
-import { Component, ComponentPropsOptions } from "vue";
-import { EditorSchema, ZeroEditorField } from "zero/schemas";
+import { ZeroEditorField } from "zero/schemas";
import { ZeroEditorCanvas } from "./editor-canvas";
export class ZeroEditor extends ZeroEditorCanvas
{
+ alias: string;
+
resourcePrefix?: string;
system: boolean = false;
@@ -19,8 +20,9 @@ export class ZeroEditor extends ZeroEditorCanvas
};
- constructor()
+ constructor(alias: string)
{
super();
+ this.alias = alias;
}
}
\ No newline at end of file
diff --git a/zero.Backoffice.UI/app/modules/countries/schemas/editor.ts b/zero.Backoffice.UI/app/modules/countries/schemas/editor.ts
index faafc6e3..e788d604 100644
--- a/zero.Backoffice.UI/app/modules/countries/schemas/editor.ts
+++ b/zero.Backoffice.UI/app/modules/countries/schemas/editor.ts
@@ -2,7 +2,7 @@
import { ZeroEditor } from "../../../editor/editor";
import { formatDate } from '../../../utils/dates';
-const editor = new ZeroEditor();
+const editor = new ZeroEditor('countries');
editor.resourcePrefix = '@country.fields.';
diff --git a/zero.Backoffice.UI/app/modules/integrations/schemas/editor.ts b/zero.Backoffice.UI/app/modules/integrations/schemas/editor.ts
index af6817f6..4f67c21a 100644
--- a/zero.Backoffice.UI/app/modules/integrations/schemas/editor.ts
+++ b/zero.Backoffice.UI/app/modules/integrations/schemas/editor.ts
@@ -1,7 +1,7 @@
import { ZeroEditor } from '../../../editor/editor';
-const editor = new ZeroEditor();
+const editor = new ZeroEditor('integrations');
editor.resourcePrefix = '@translation.fields.';
diff --git a/zero.Backoffice.UI/app/modules/languages/schemas/editor.ts b/zero.Backoffice.UI/app/modules/languages/schemas/editor.ts
index b9fc6f28..380b2a4d 100644
--- a/zero.Backoffice.UI/app/modules/languages/schemas/editor.ts
+++ b/zero.Backoffice.UI/app/modules/languages/schemas/editor.ts
@@ -1,7 +1,7 @@
import { ZeroEditor } from '../../../editor/editor';
-const editor = new ZeroEditor();
+const editor = new ZeroEditor('languages');
editor.resourcePrefix = '@language.fields.';
diff --git a/zero.Backoffice.UI/app/modules/mails/schemas/editor.ts b/zero.Backoffice.UI/app/modules/mails/schemas/editor.ts
index a79f2b44..3c4edf37 100644
--- a/zero.Backoffice.UI/app/modules/mails/schemas/editor.ts
+++ b/zero.Backoffice.UI/app/modules/mails/schemas/editor.ts
@@ -1,7 +1,7 @@
import { ZeroEditor } from "../../../editor/editor";
-const editor = new ZeroEditor();
+const editor = new ZeroEditor('mailtemplates');
editor.resourcePrefix = '@mailTemplate.fields.';
diff --git a/zero.Backoffice.UI/app/modules/translations/schemas/editor.ts b/zero.Backoffice.UI/app/modules/translations/schemas/editor.ts
index af6817f6..94346d71 100644
--- a/zero.Backoffice.UI/app/modules/translations/schemas/editor.ts
+++ b/zero.Backoffice.UI/app/modules/translations/schemas/editor.ts
@@ -1,7 +1,7 @@
import { ZeroEditor } from '../../../editor/editor';
-const editor = new ZeroEditor();
+const editor = new ZeroEditor('translations');
editor.resourcePrefix = '@translation.fields.';
diff --git a/zero.Backoffice.UI/app/services/localization.ts b/zero.Backoffice.UI/app/services/localization.ts
index dda582f1..82e4329a 100644
--- a/zero.Backoffice.UI/app/services/localization.ts
+++ b/zero.Backoffice.UI/app/services/localization.ts
@@ -10,7 +10,7 @@ export interface LocalizeOptions
}
-export const localize = (key: string, options?: LocalizeOptions): string =>
+export const localize = (key: string | null, options?: LocalizeOptions): string =>
{
let params = extendObject({
force: false,