Files
mixtape/zero.Backoffice.UI/old_app/components/modules/module-select.vue
T

178 lines
3.8 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-07-22 11:27:04 +02:00
<div class="ui-modules-select-item-top">
<ui-icon class="ui-modules-select-item-icon" :symbol="item.icon" :size="22" />
</div>
2021-01-06 19:29:11 +01:00
<span class="ui-modules-select-item-text">
2021-07-22 11:27:04 +02:00
<ui-localize :value="item.name" class="-headline" />
<span v-if="item.description" class="-desc" v-localize="item.description"></span>
2021-01-06 19:29:11 +01:00
</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-07-22 11:27:04 +02:00
.app-overlay[data-alias="modules-select"]
{
width: calc(100vw - 40px);
max-width: 1080px;
height: calc(100vh - 40px);
max-height: 750px;
}
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-07-22 11:27:04 +02:00
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
grid-gap: var(--padding-m);
2021-01-06 19:29:11 +01:00
margin: 0 -16px;
2021-07-22 11:27:04 +02:00
padding: 0 16px;
2021-01-06 19:29:11 +01:00
margin-top: var(--padding);
2021-07-22 11:27:04 +02:00
max-height: 550px;
2021-01-06 19:29:11 +01:00
overflow-y: auto;
2020-08-19 12:53:18 +02:00
}
.ui-modules-select-item
{
2021-07-22 11:27:04 +02:00
display: inline-flex;
flex-direction: column;
2021-01-06 19:29:11 +01:00
width: 100%;
grid-template-columns: 40px 1fr auto;
gap: 12px;
2021-07-22 11:27:04 +02:00
align-items: stretch;
2020-08-19 12:53:18 +02:00
position: relative;
2021-01-06 19:29:11 +01:00
color: var(--color-text);
2020-08-19 12:53:18 +02:00
2021-07-22 11:27:04 +02:00
/*&:hover, &:focus
2020-08-19 12:53:18 +02:00
{
2021-01-06 19:29:11 +01:00
background: var(--color-tree-selected);
2021-07-22 11:27:04 +02:00
}*/
2021-01-06 19:29:11 +01:00
2021-07-22 11:27:04 +02:00
&:hover .ui-modules-select-item-top
2021-01-06 19:29:11 +01:00
{
2021-07-22 11:27:04 +02:00
border: 1px solid var(--color-bg-shade-5);
background: var(--color-bg-shade-1);
outline: none;
2021-01-06 19:29:11 +01:00
}
}
2021-07-22 11:27:04 +02:00
.ui-modules-select-item-top
{
background: var(--color-bg-shade-2);
height: 100px;
border-radius: var(--radius);
display: inline-flex;
justify-content: center;
align-items: center;
border: 1px solid var(--color-line);
}
2021-01-06 19:29:11 +01:00
.ui-modules-select-item-text
{
display: flex;
flex-direction: column;
2021-07-22 11:27:04 +02:00
.-desc
2021-01-06 19:29:11 +01:00
{
color: var(--color-text-dim);
margin-top: 3px;
2021-07-22 11:27:04 +02:00
font-size: var(--font-size-s);
line-height: 1.4;
}
.-headline
{
color: var(--color-text);
font-weight: 700;
2020-08-19 12:53:18 +02:00
}
}
.ui-modules-select-item-icon
{
2021-01-06 19:29:11 +01:00
position: relative;
2021-07-22 11:27:04 +02:00
font-size: var(--size-xl);
2021-01-06 19:29:11 +01:00
color: var(--color-text);
2020-08-19 12:53:18 +02:00
}
</style>