store renderers

This commit is contained in:
2020-10-16 14:15:45 +02:00
parent 1fe10d8952
commit cb7fda8a19
4 changed files with 31 additions and 11 deletions
+3 -2
View File
@@ -5,7 +5,7 @@ class Plugin
#onInstall;
routes = [];
renderers = {};
renderers = [];
constructor(name)
@@ -35,7 +35,8 @@ class Plugin
*/
addRenderer(alias, config)
{
this.renderers[alias] = config;
config.alias = alias;
this.renderers.push(config);
}
/*
+21 -6
View File
@@ -19,6 +19,7 @@ class Zero
#vue = null;
#plugins = [];
#renderers = [];
#routes = [];
#router = null;
@@ -69,8 +70,6 @@ class Zero
routes: this.#routes
});
console.info(this.#routes);
//const result = await Axios.get('zerovue/config');
//this.config = { ...this.config, ...result.data };
@@ -94,13 +93,29 @@ class Zero
this.#plugins.push(plugin);
// append routes
plugin.routes.forEach(route =>
{
this.#routes.push(route);
});
plugin.routes.forEach(x => this.#routes.push(x));
// append renderers
plugin.renderers.forEach(x => this.#renderers.push(x));
console.log(`[zero] Installed %c${plugin.name}%cplugin`, 'font-style:italic;');
}
/*
* Returns a renderer
*/
getRenderer(alias)
{
const renderer = this.#renderers.find(x => x.alias === alias);
if (!renderer)
{
console.warn(`[zero] Could not find renderer ${alias}`);
}
return renderer;
}
};
+2 -2
View File
@@ -18,12 +18,12 @@
data: () => ({
count: 0,
createRoute: zero.alias.settings.languages + '-create',
tableConfig: zero.renderers.language.list
tableConfig: null
}),
created()
{
this.tableConfig.items = LanguagesApi.getAll;
this.tableConfig = this.zero.getRenderer('language').list;
}
}
</script>
+5 -1
View File
@@ -1,4 +1,7 @@
export default {
import LanguagesApi from 'zero/resources/languages';
export default {
alias: 'language',
labelTemplate(field)
@@ -40,6 +43,7 @@
],
list: {
items: LanguagesApi.getAll,
labelPrefix: '@language.fields.',
search: null,
columns: {