Files
mixtape/zero.Web.UI/app/components/modules/module-select.vue
T

145 lines
2.9 KiB
Vue
Raw Normal View History

2020-08-19 12:53:18 +02:00
<template>
2021-01-06 19:29:11 +01:00
<div class="ui-modules-select">
<h2 class="ui-headline">Add module</h2>
<div v-if="!loading">
<div class="ui-modules-select-items">
<button type="button" v-for="item in types" class="ui-modules-select-item" @click="onSelect(item)">
2021-01-21 15:14:33 +01:00
<ui-icon class="ui-modules-select-item-icon" :symbol="item.icon" :size="22" />
2021-01-06 19:29:11 +01:00
<span class="ui-modules-select-item-text">
2021-03-22 16:00:00 +01:00
<ui-localize :value="item.name" />
2021-01-06 19:29:11 +01:00
<span v-if="item.description" v-localize="item.description"></span>
</span>
</button>
</div>
<ui-message type="error" v-if="!types.length" text="@page.create.nonavailable" />
<div class="app-confirm-buttons">
<ui-button type="light" :label="config.closeLabel" @click="config.close"></ui-button>
2020-08-19 12:53:18 +02:00
</div>
</div>
2021-01-06 19:29:11 +01:00
</div>
2020-08-19 12:53:18 +02:00
</template>
<script>
2021-01-06 19:29:11 +01:00
import ModulesApi from 'zero/api/modules.js';
import Overlay from 'zero/helpers/overlay.js';
2020-08-19 12:53:18 +02:00
export default {
props: {
2021-01-06 19:29:11 +01:00
config: Object
2020-08-19 12:53:18 +02:00
},
data: () => ({
2021-01-06 19:29:11 +01:00
model: {
name: null,
parentId: null,
pageTypeAlias: null
},
loading: false,
item: {},
disabled: false,
types: []
2020-08-19 12:53:18 +02:00
}),
created()
{
2021-01-06 19:29:11 +01:00
this.types = this.config.types;
this.model.parentId = this.config.parent ? this.config.parent.id : null;
2020-08-20 01:35:08 +02:00
},
methods: {
2021-01-06 19:29:11 +01:00
onSelect(item)
2020-08-19 12:53:18 +02:00
{
2021-01-06 19:29:11 +01:00
//this.config.close();
this.config.confirm(item);
//this.$router.push({
// name: 'ui-modules-select',
// params: { type: item.alias, parent: this.model.parentId }
//});
2020-08-20 01:35:08 +02:00
},
2020-08-19 12:53:18 +02:00
}
}
</script>
<style lang="scss">
2021-01-06 19:29:11 +01:00
.ui-modules-select
2020-08-19 12:53:18 +02:00
{
2021-01-06 19:29:11 +01:00
text-align: left;
2021-01-06 19:29:11 +01:00
.ui-message
{
2021-01-06 19:29:11 +01:00
margin: 0;
}
2020-08-19 12:53:18 +02:00
}
2021-01-06 19:29:11 +01:00
.ui-modules-select-parent
2020-08-19 12:53:18 +02:00
{
2021-01-06 19:29:11 +01:00
margin: 30px 0 -10px 0;
2020-08-19 12:53:18 +02:00
border-radius: var(--radius);
2021-01-06 19:29:11 +01:00
/*border: 1px solid var(--color-line-light);*/
background: var(--color-box-nested);
line-height: 1.4;
color: var(--color-text-dim);
2021-01-06 19:29:11 +01:00
padding: 14px 16px;
font-size: var(--font-size);
2020-08-19 12:53:18 +02:00
strong
{
color: var(--color-text);
2020-08-19 12:53:18 +02:00
}
}
.ui-modules-select-items
{
2021-01-06 19:29:11 +01:00
margin: 0 -16px;
margin-top: var(--padding);
max-height: 600px;
overflow-y: auto;
2020-08-19 12:53:18 +02:00
}
.ui-modules-select-item
{
display: grid;
2021-01-06 19:29:11 +01:00
width: 100%;
grid-template-columns: 40px 1fr auto;
gap: 12px;
2020-08-19 12:53:18 +02:00
align-items: center;
position: relative;
2021-01-06 19:29:11 +01:00
color: var(--color-text);
padding: 16px;
border-radius: var(--radius);
2020-08-19 12:53:18 +02:00
2021-01-06 19:29:11 +01:00
&:hover, &:focus
2020-08-19 12:53:18 +02:00
{
2021-01-06 19:29:11 +01:00
background: var(--color-tree-selected);
}
& + .ui-modules-select-item
{
margin-top: 5px;
}
}
.ui-modules-select-item-text
{
display: flex;
flex-direction: column;
span
{
color: var(--color-text-dim);
margin-top: 3px;
2020-08-19 12:53:18 +02:00
}
}
.ui-modules-select-item-icon
{
2021-01-06 19:29:11 +01:00
position: relative;
top: -2px;
left: 4px;
color: var(--color-text);
2020-08-19 12:53:18 +02:00
}
</style>