EZQMS-529: Added support for grow and new align display options in Table (#4389)

Signed-off-by: Petr Vyazovetskiy <develop.pit@gmail.com>
This commit is contained in:
Pete Anøther 2024-01-19 12:32:53 -03:00 committed by GitHub
parent c0c17993cf
commit 85a68bebb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 4 deletions

View File

@ -877,7 +877,7 @@
font-size: 0.75rem;
}
.label {
margin-bottom: 0rem;
margin-bottom: 0;
}
}
}
@ -915,6 +915,16 @@
}
&:hover .antiTable-cells__checkCell { visibility: visible; }
.checkall { visibility: visible; }
&.align-left .antiTable-cells { justify-content: start; }
&.align-center .antiTable-cells { justify-content: center; }
&.align-right .antiTable-cells { justify-content: end; }
}
td {
&.align-left { text-align: left; }
&.align-center { text-align: center; }
&.align-right { text-align: right; }
}
&.editable {

View File

@ -80,6 +80,7 @@
$: lookup = buildConfigLookup(hierarchy, _class, config, options?.lookup)
let _sortKey = prefferedSorting
let userSorting = false
$: if (!userSorting) {
_sortKey = prefferedSorting
}
@ -87,8 +88,6 @@
let sortOrder = SortingOrder.Descending
let loading = 0
let userSorting = false
let objects: Doc[] = []
let gtotal: number = 0
let total: number = 0
@ -339,8 +338,12 @@
{/if}
{#each model as attribute}
<th
class:w-full={attribute.displayProps?.grow === true}
class:sortable={attribute.sortingKey}
class:sorted={attribute.sortingKey === _sortKey}
class:align-left={attribute.displayProps?.align === 'left'}
class:align-center={attribute.displayProps?.align === 'center'}
class:align-right={attribute.displayProps?.align === 'right'}
on:click={() => {
changeSorting(attribute.sortingKey)
}}
@ -416,7 +419,11 @@
{/if}
{#if row < rowLimit}
{#each model as attribute, cell}
<td>
<td
class:align-left={attribute.displayProps?.align === 'left'}
class:align-center={attribute.displayProps?.align === 'center'}
class:align-right={attribute.displayProps?.align === 'right'}
>
<div class:antiTable-cells__firstCell={!cell}>
<!-- {getOnChange(object, attribute) !== undefined} -->
<svelte:component

View File

@ -583,6 +583,7 @@ export interface DisplayProps {
key?: string
excludeByKey?: string
fixed?: 'left' | 'right' // using for align items in row
align?: 'left' | 'right' | 'center'
suffix?: boolean
optional?: boolean
compression?: boolean