New row style (#203)

Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
Alexander Platov 2021-09-21 11:24:57 +03:00 committed by GitHub
parent 2550a7f9ce
commit 598071d50d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 103 additions and 21 deletions

View File

@ -15,13 +15,18 @@
<script lang="ts">
export let checked: boolean = false
export let symbol: 'check' | 'minus' = 'check'
</script>
<label class="checkbox">
<input class="chBox" type="checkbox" bind:checked={checked}>
<svg class="checkSVG" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path class="back" d="M4,0h8c2.2,0,4,1.8,4,4v8c0,2.2-1.8,4-4,4H4c-2.2,0-4-1.8-4-4V4C0,1.8,1.8,0,4,0z"/>
<polygon class="check" points="7.3,11.5 4,8.3 5,7.4 7.3,9.7 11.8,5.1 12.7,6.1 "/>
{#if symbol === 'minus'}
<rect class="check" x="4" y="7.4" width="8" height="1.2"/>
{:else}
<polygon class="check" points="7.3,11.5 4,8.3 5,7.4 7.3,9.7 11.8,5.1 12.7,6.1 "/>
{/if}
<path class="border" d="M12,16H4c-2.2,0-4-1.8-4-4V4c0-2.2,1.8-4,4-4h8c2.2,0,4,1.8,4,4v8C16,14.2,14.2,16,12,16z M4,1 C2.3,1,1,2.3,1,4v8c0,1.7,1.3,3,3,3h8c1.7,0,3-1.3,3-3V4c0-1.7-1.3-3-3-3H4z"/>
</svg>
</label>

View File

@ -19,7 +19,8 @@
import type { Ref, Class, Doc, Space, FindOptions } from '@anticrm/core'
import { buildModel } from '../utils'
import { getClient } from '@anticrm/presentation'
import { Label, showPopup, Loading, ScrollBox } from '@anticrm/ui'
import { Label, showPopup, Loading, ScrollBox, CheckBox } from '@anticrm/ui'
import MoreV from './icons/MoreV.svelte'
import { createQuery } from '@anticrm/presentation'
@ -47,7 +48,7 @@
}
const client = getClient()
let checking: boolean = false
</script>
{#await buildModel(client, _class, config, options)}
@ -58,18 +59,39 @@
<table class="table-body">
<thead>
<tr class="tr-head">
{#each model as attribute}
<th><Label label = {attribute.label}/></th>
{#each model as attribute, cellHead}
<th class:checkall={checking}>
{#if !cellHead}
<div class="firstCell">
<div class="control"><CheckBox symbol={'minus'} /></div>
<span><Label label = {attribute.label}/></span>
</div>
{:else}
<Label label = {attribute.label}/>
{/if}
</th>
{/each}
</tr>
</thead>
{#if objects}
<tbody>
{#each objects as object (object._id)}
<tr class="tr-body">
{#each model as attribute}
<td><svelte:component this={attribute.presenter} value={getValue(object, attribute.key)}/></td>
{/each}
<tr class="tr-body" class:checking>
{#each model as attribute, cell}
<td>
{#if !cell}
<div class="firstCell">
<div class="control">
<CheckBox bind:checked={checking} />
<div class="moveRow"><MoreV /></div>
</div>
<svelte:component this={attribute.presenter} value={getValue(object, attribute.key)}/>
</div>
{:else}
<svelte:component this={attribute.presenter} value={getValue(object, attribute.key)}/>
{/if}
</td>
{/each}
</tr>
{/each}
</tbody>
@ -85,22 +107,32 @@
position: relative;
padding-bottom: 2.5rem;
height: 100%;
&::before {
position: absolute;
content: '';
top: 2.5rem;
bottom: 0;
width: 100%;
background-color: var(--theme-table-bg-color);
border-radius: 0 0 1.25rem 1.25rem;
}
.firstCell {
display: flex;
align-items: center;
flex-grow: 1;
.control {
visibility: hidden;
display: flex;
align-items: center;
width: 0;
.moveRow {
visibility: hidden;
width: 1rem;
margin: 0 .5rem;
cursor: pointer;
}
}
}
th, td {
padding: .5rem 1.5rem;
text-align: left;
&:first-child { padding-left: 2.5rem; }
&:first-child {
padding-left: 2.5rem;
padding-right: 3rem;
}
}
th {
@ -113,13 +145,32 @@
background-color: var(--theme-bg-color);
box-shadow: inset 0 -1px 0 0 var(--theme-bg-focused-color);
z-index: 5;
&:first-child.checkall {
padding-left: 1rem;
& .control {
visibility: visible;
width: auto;
}
span { margin-left: 2rem; }
}
}
.tr-body {
height: 3.25rem;
color: var(--theme-caption-color);
border-bottom: 1px solid var(--theme-button-border-hovered);
&:last-child { border-bottom: none; }
&:hover { background-color: var(--theme-table-bg-hover); }
&:hover, &.checking {
background-color: var(--theme-table-bg-hover);
& td:first-child {
padding-left: 1rem;
padding-right: 1.5rem;
& .control {
visibility: visible;
width: auto;
}
}
}
&:hover td:first-child .control .moveRow { visibility: visible; }
}
</style>

View File

@ -0,0 +1,26 @@
<!--
// Copyright © 2020, 2021 Anticrm Platform Contributors.
// Copyright © 2021 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
export let size: 'small' | 'medium' | 'large'
const fill: string = 'var(--theme-caption-color)'
</script>
<svg class="svg-{size}" {fill} viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="M8,6.6C7.2,6.6,6.6,7.2,6.6,8S7.2,9.4,8,9.4c0.8,0,1.4-0.6,1.4-1.4S8.8,6.6,8,6.6z"/>
<path d="M8,11.4c-0.8,0-1.4,0.6-1.4,1.4s0.6,1.4,1.4,1.4c0.8,0,1.4-0.6,1.4-1.4S8.8,11.4,8,11.4z"/>
<path d="M8,4.6c0.8,0,1.4-0.6,1.4-1.4S8.7,1.8,8,1.8c-0.8,0-1.4,0.6-1.4,1.4S7.2,4.6,8,4.6z"/>
</svg>