1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-01-18 21:17:59 +00:00

Tried to fix grid height

This commit is contained in:
Romein van Buren 2023-01-10 20:10:39 +01:00
parent 34ba68b179
commit 11f6343843
Signed by: romein
GPG Key ID: 0EFF8478ADDF6C49
8 changed files with 53 additions and 16 deletions

View File

@ -93,25 +93,25 @@
<style> <style>
main { main {
height: 100vh; height: 100vh;
max-height: 100vh;
display: flex; display: flex;
flex-direction: column; flex-flow: column;
} }
.columns { .columns {
display: flex; display: flex;
gap: 1rem; gap: 1rem;
flex: 1; flex: 1;
height: 100%;
} }
.columns > :global(*) { .columns > :global(*) {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-flow: column;
} }
.hostlist { .hostlist {
flex: 0 0 250px; flex: 0 0 250px;
overflow-y: scroll; overflow: scroll;
} }
.collection { .collection {
flex: 1; flex: 1;

View File

@ -65,7 +65,7 @@
{#each _items as item (item[key])} {#each _items as item (item[key])}
<tr on:click={() => select(item[key])} class:selected={activeKey === item[key] && !activeChildKey}> <tr on:click={() => select(item[key])} class:selected={activeKey === item[key] && !activeChildKey}>
<td class="has-toggle"> <td class="has-toggle">
{#if item.children} {#if item.children?.length}
<button class="toggle" on:click={() => toggleChildren(item[key])}> <button class="toggle" on:click={() => toggleChildren(item[key])}>
<Icon name={childrenOpen[item[key]] ? 'chev-d' : 'chev-r'} /> <Icon name={childrenOpen[item[key]] ? 'chev-d' : 'chev-r'} />
</button> </button>
@ -106,9 +106,9 @@
<style> <style>
.grid { .grid {
background-color: #fff; background-color: #fff;
height: 100%;
width: 100%; width: 100%;
overflow: scroll; overflow: scroll;
max-height: 400px; /* fixme */
} }
.grid.contained { .grid.contained {
border: 1px solid #ccc; border: 1px solid #ccc;
@ -126,7 +126,7 @@
border-bottom: 2px solid #ccc; border-bottom: 2px solid #ccc;
} }
table th { th {
font-weight: 600; font-weight: 600;
text-align: left; text-align: left;
} }
@ -137,7 +137,6 @@
td, th { td, th {
padding: 0.3rem; padding: 0.3rem;
height: 100%;
} }
td.has-toggle { td.has-toggle {
width: calc(20px + 0.3rem); width: calc(20px + 0.3rem);
@ -146,7 +145,7 @@
padding: 0; padding: 0;
} }
table tbody tr.selected td { tbody tr.selected td {
background-color: #00008b; background-color: #00008b;
color: #fff; color: #fff;
} }

View File

@ -4,6 +4,8 @@
{#if name === 'radio'} {#if name === 'radio'}
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-radio"><circle cx="12" cy="12" r="2"></circle><path d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-radio"><circle cx="12" cy="12" r="2"></circle><path d="M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"></path></svg>
{:else if name === 'chev-l'}
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-left"><polyline points="15 18 9 12 15 6"></polyline></svg>
{:else if name === 'chev-r'} {:else if name === 'chev-r'}
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>
{:else if name === 'chev-d'} {:else if name === 'chev-d'}

View File

@ -53,7 +53,7 @@
width: 100%; width: 100%;
border-radius: 10px; border-radius: 10px;
display: flex; display: flex;
flex-direction: column; flex-flow: column;
cursor: auto; cursor: auto;
} }
.inner > :global(*:first-child) { .inner > :global(*:first-child) {

View File

@ -6,8 +6,6 @@
export let showHeaders = false; export let showHeaders = false;
export let contained = true; export let contained = true;
console.log(data);
let items = []; let items = [];
$: if (data) { $: if (data) {
@ -31,6 +29,12 @@
if (Array.isArray(value)) { if (Array.isArray(value)) {
return `array (${value.length} item${value.length === 1 ? '' : 's'})`; return `array (${value.length} item${value.length === 1 ? '' : 's'})`;
} }
else if (typeof value === 'number') {
if (value.toString().includes('.')) {
return 'double';
}
return 'integer';
}
else if (new Date(value).toString() !== 'Invalid Date') { else if (new Date(value).toString() !== 'Invalid Date') {
return 'date'; return 'date';
} }

View File

@ -4,6 +4,7 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { input } from '../../actions'; import { input } from '../../actions';
import ObjectGrid from '../../components/objectgrid.svelte'; import ObjectGrid from '../../components/objectgrid.svelte';
import Icon from '../../components/icon.svelte';
export let collection; export let collection;
@ -33,6 +34,8 @@
async function submitQuery() { async function submitQuery() {
result = await PerformFind(collection.hostKey, collection.dbKey, collection.key, JSON.stringify(form)); result = await PerformFind(collection.hostKey, collection.dbKey, collection.key, JSON.stringify(form));
queryField?.focus();
queryField?.select();
} }
onMount(() => { onMount(() => {
@ -75,7 +78,21 @@
</form> </form>
<CodeExample {code} /> <CodeExample {code} />
<ObjectGrid data={result} />
<div class="result">
<ObjectGrid data={result} />
<div class="controls">
<div>
{#if result}
Results: {result.length}
{/if}
</div>
<div>
<button class="btn"><Icon name="chev-l" /></button>
<button class="btn"><Icon name="chev-r" /></button>
</div>
</div>
</div>
<style> <style>
.row-one { .row-one {
@ -90,4 +107,20 @@
grid-template-columns: 5fr 1fr 1fr 1fr; grid-template-columns: 5fr 1fr 1fr 1fr;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
.result {
flex: 1;
display: flex;
flex-flow: column;
margin-top: 0.5rem;
gap: 0.5rem;
}
.result > :global(.grid) {
flex: 1;
}
.result > .controls {
display: flex;
justify-content: space-between;
align-items: center;
}
</style> </style>

View File

@ -56,13 +56,13 @@
margin: 1rem 1rem 1rem 0; margin: 1rem 1rem 1rem 0;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-flow: column;
} }
.container { .container {
padding: 0.5rem 0.5rem 0; padding: 0.5rem 0.5rem 0;
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-flow: column;
} }
</style> </style>

View File

@ -1,7 +1,6 @@
html, html,
body { body {
height: 100vh; height: 100vh;
max-height: 100vh;
overflow: hidden; overflow: hidden;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
margin: 0; margin: 0;