Files
mixtape/zero.Backoffice.UI/app/components/ui-property.vue
T

288 lines
5.6 KiB
Vue
Raw Normal View History

2020-03-27 01:17:22 +01:00
<template>
2021-11-16 15:03:24 +01:00
<div class="ui-property" :class="{'is-vertical': vertical, 'is-text': isText, 'hide-label': hideLabel, 'is-disabled': disabled, 'is-locked': locked, 'can-unlock': canUnlock }">
2021-11-03 16:00:46 +01:00
<label v-if="label && !hideLabel" class="ui-property-label" :for="field" v-localize:title="description" :class="{ 'has-description': !!description }">
2021-11-16 15:03:24 +01:00
<button type="button" v-if="canUnlock" class="ui-property-label-small is-lock" :class="{'is-unlocked': !locked}" :title="locked ? 'Unlock property...' : 'Lock property'" @click="$emit(locked ? 'unlock' : 'lock')">
<ui-icon :size="13" :symbol="locked ? 'fth-lock' : 'fth-unlock'"></ui-icon>
</button>
2020-04-08 15:16:05 +02:00
<span v-localize="label"></span>
2020-03-27 01:17:22 +01:00
<strong class="ui-property-required" v-if="required">*</strong>
<slot name="label-after"></slot>
2021-11-03 16:00:46 +01:00
<small class="ui-property-label-small" v-if="description" :size="14" v-localize:title="description">?</small>
2020-03-27 01:17:22 +01:00
</label>
2020-11-18 23:39:28 +01:00
<div class="ui-property-content">
2020-03-27 01:17:22 +01:00
<slot></slot>
<ui-error v-if="field" :field="field" />
2021-01-12 16:06:56 +01:00
</div>
<slot name="after"></slot>
2020-03-27 01:17:22 +01:00
</div>
</template>
<script>
2021-11-11 14:47:50 +01:00
2020-03-27 01:17:22 +01:00
export default {
name: 'uiProperty',
props: {
field: String,
2020-03-27 01:17:22 +01:00
label: String,
2020-06-12 16:13:47 +02:00
hideLabel: Boolean,
2020-03-27 01:17:22 +01:00
description: String,
required: Boolean,
2021-04-22 00:31:23 +02:00
vertical: {
type: Boolean,
2021-08-23 12:56:40 +02:00
default: true
2021-04-22 00:31:23 +02:00
},
2021-11-16 13:48:18 +01:00
locked: Boolean,
canUnlock: Boolean,
2020-11-20 15:17:41 +01:00
isText: Boolean,
disabled: {
type: Boolean,
default: false
2020-11-18 23:39:28 +01:00
}
2020-03-27 01:17:22 +01:00
}
}
</script>
2020-04-09 13:06:15 +02:00
<style lang="scss">
2020-03-27 01:17:22 +01:00
.ui-property
{
position: relative;
2021-08-24 16:06:13 +02:00
display: grid;
grid-gap: 40px;
grid-template-columns: minmax(auto, 1fr) auto;
2020-06-23 19:40:38 +02:00
margin: 0 -32px 0;
padding: 0 32px 0;
2020-04-28 14:51:17 +02:00
2021-11-16 13:48:18 +01:00
&.is-disabled .ui-property-content,
&.is-locked .ui-property-content
2020-04-28 14:51:17 +02:00
{
pointer-events: none;
}
2021-01-11 15:59:18 +01:00
2021-11-16 15:03:24 +01:00
&.is-disabled, &.is-locked
2021-01-11 15:59:18 +01:00
{
2021-11-16 13:48:18 +01:00
cursor: not-allowed;
2021-01-11 15:59:18 +01:00
}
2021-01-12 16:06:56 +01:00
2021-09-23 10:58:14 +02:00
.ui-error
{
margin-top: 5px;
}
2020-03-27 01:17:22 +01:00
}
2020-10-04 00:52:54 +02:00
.ui-property + .ui-split,
2020-05-04 16:00:39 +02:00
.ui-split + .ui-property,
.ui-property + .ui-property
2021-04-22 16:04:05 +02:00
{
2021-08-11 16:31:39 +02:00
padding-top: 30px;
2021-04-22 16:04:05 +02:00
margin-top: 30px;
2021-08-11 16:31:39 +02:00
border-top: 1px dashed var(--color-line-dashed);
.is-narrow &
{
margin-top: 30px;
padding-top: 0;
border-top: none;
}
2020-05-04 16:00:39 +02:00
}
2020-03-27 01:17:22 +01:00
.ui-property.is-vertical
{
2021-08-24 16:06:13 +02:00
grid-template-columns: minmax(auto, 1fr);
grid-gap: 12px;
2020-03-27 01:17:22 +01:00
flex-direction: column;
2021-08-11 16:31:39 +02:00
//border-top: none;
2020-03-27 01:17:22 +01:00
2021-08-24 16:06:13 +02:00
> .ui-property-label
2020-03-27 01:17:22 +01:00
{
width: 100%;
2020-06-15 10:41:27 +02:00
padding-right: 0;
2020-03-27 01:17:22 +01:00
}
2021-08-24 16:06:13 +02:00
> .ui-property-label + .ui-property-content
2020-03-27 01:17:22 +01:00
{
2021-08-24 16:06:13 +02:00
margin-top: 0;
}
> .ui-property-content
{
display: block;
2020-03-27 01:17:22 +01:00
}
}
2021-08-26 20:42:25 +02:00
.ui-property.is-text
2020-04-21 16:23:43 +02:00
{
2021-08-26 20:42:25 +02:00
grid-gap: 2px;
2020-04-21 16:23:43 +02:00
}
2020-05-20 15:16:02 +02:00
.ui-property.full-width > .ui-property-content,
.ui-property.hide-label > .ui-property-content,
.ui-property.is-static > .ui-property-content
2020-05-01 12:40:08 +02:00
{
max-width: 100%;
}
.ui-property.hide-label > .ui-property-label,
.ui-property.is-static > .ui-property-label
2020-05-20 15:16:02 +02:00
{
display: none;
}
.ui-property.is-static,
.ui-property.is-static + .ui-property
{
margin-top: 0 !important;
}
2020-03-27 01:17:22 +01:00
.ui-property-label
{
display: block;
color: var(--color-text);
2021-08-24 16:06:13 +02:00
//flex-basis: 30%;
font-size: var(--font-size);
2020-03-27 01:17:22 +01:00
line-height: 1.5;
2020-04-03 18:03:36 +02:00
font-weight: 700;
2021-08-24 16:06:13 +02:00
flex-basis: 100%;
2020-09-09 19:06:37 +02:00
2021-11-03 16:00:46 +01:00
&.has-description:hover
{
cursor: help;
}
2020-09-09 19:06:37 +02:00
/*.ui-property:focus-within &
{
color: var(--color-accent-info);
}*/
2020-03-27 01:17:22 +01:00
}
2021-11-03 16:00:46 +01:00
.ui-property-label-small
2020-03-27 01:17:22 +01:00
{
2021-11-03 16:00:46 +01:00
display: inline-block;
font-size: 11px;
font-weight: 600;
position: relative;
top: -1px;
left: 10px;
color: var(--color-text-dim);
2021-11-03 16:00:46 +01:00
cursor: help;
width: 16px;
height: 16px;
text-align: center;
line-height: 16px;
border-radius: 16px;
background: var(--color-bg-shade-4);
2020-04-30 14:21:43 +02:00
2021-11-03 16:00:46 +01:00
&:hover
2021-11-16 13:48:18 +01:00
{
2021-11-03 16:00:46 +01:00
color: var(--color-text);
2020-04-30 14:21:43 +02:00
}
2021-11-16 13:48:18 +01:00
&.is-lock
{
left: 0;
margin-right: 6px;
background: none;
top: 2px;
cursor: pointer;
&[disabled]
{
cursor: not-allowed;
}
2021-11-16 15:03:24 +01:00
&.is-unlocked
{
color: var(--color-text);
}
2021-11-16 13:48:18 +01:00
}
2020-03-27 01:17:22 +01:00
}
.ui-property-required
{
2021-01-06 14:03:56 +01:00
color: var(--color-required-marker);
2020-04-08 15:16:05 +02:00
margin-left: 0.2em;
2020-06-08 16:02:54 +02:00
font-weight: 400;
2021-12-30 17:09:25 +01:00
pointer-events: none;
user-select: none;
2020-03-27 01:17:22 +01:00
}
.ui-property-content
{
flex: 1;
2021-01-06 12:30:24 +01:00
max-width: 932px;
2020-04-30 15:35:09 +02:00
font-size: var(--font-size);
2021-08-24 16:06:13 +02:00
display: flex;
align-items: center;
2020-03-27 01:17:22 +01:00
}
.ui-property-help
{
2021-01-06 12:30:24 +01:00
max-width: 932px;
2020-06-23 19:40:38 +02:00
font-size: var(--font-size-xs);
color: var(--color-text-dim);
margin: 15px 0 0;
2020-06-23 19:40:38 +02:00
letter-spacing: 0.3px;
&:before
{
content: "\e87f";
2021-08-25 10:12:48 +02:00
font-family: var(--font-icon);
2020-08-16 15:51:12 +02:00
color: var(--color-primary);
font-size: var(--font-size-l);
float: left;
position: relative;
top: -1px;
margin-right: 6px;
}
}
2020-06-15 10:41:27 +02:00
.ui-properties-floating
{
.ui-property
{
display: inline-flex;
min-height: 52px;
}
.ui-property + .ui-property
{
padding-top: 0;
margin-top: 0;
border-left: 1px solid var(--color-line);
padding-left: 50px;
margin-left: 50px;
}
}
2021-09-10 14:52:28 +02:00
.ui-property.ui-property-parent
{
display: grid;
grid-template-columns: repeat(12, minmax(0, 1fr));
2021-12-21 13:58:48 +01:00
grid-gap: 0; //var(--padding) var(--padding-m);
2021-09-10 14:52:28 +02:00
> .ui-property
{
grid-column-start: 1;
grid-column-end: 13;
margin-left: 0;
margin-right: 0;
padding-left: 0;
padding-right: 0;
}
2021-09-11 12:01:13 +02:00
&:empty:first-child + .ui-property,
2021-09-10 14:52:28 +02:00
> .ui-property[data-cols] + .ui-property[data-cols]
{
margin-top: 0;
border-top: none;
padding-top: 0;
}
}
2021-09-10 15:40:43 +02:00
.ui-property.ui-property-parent:empty
{
display: none;
}
2020-03-27 01:17:22 +01:00
</style>