Browse Source

Introduce isLoading attribute

pull/7540/head
Thomas Kaul 4 weeks ago
parent
commit
ca20ceb72a
  1. 22
      libs/ui/src/lib/value/value.component.html
  2. 5
      libs/ui/src/lib/value/value.component.stories.ts
  3. 4
      libs/ui/src/lib/value/value.component.ts

22
libs/ui/src/lib/value/value.component.html

@ -27,7 +27,16 @@
} }
</ng-template> </ng-template>
@if (value || value === 0 || value === null) { @if (isLoading() || value === undefined) {
<ngx-skeleton-loader
animation="pulse"
[theme]="{
height:
size === 'large' ? '2rem' : size === 'medium' ? '1.8rem' : '1.5rem',
width: '5rem'
}"
/>
} @else if (value || value === 0 || value === null) {
<div <div
class="align-items-center d-flex" class="align-items-center d-flex"
[class.justify-content-end]="position === 'end'" [class.justify-content-end]="position === 'end'"
@ -75,17 +84,6 @@
</div> </div>
} }
@if (value === undefined) {
<ngx-skeleton-loader
animation="pulse"
[theme]="{
height:
size === 'large' ? '2rem' : size === 'medium' ? '1.8rem' : '1.5rem',
width: '5rem'
}"
/>
}
@if (size === 'large') { @if (size === 'large') {
<div class="text-truncate"> <div class="text-truncate">
<span class="h6"><ng-container *ngTemplateOutlet="label" /></span> <span class="h6"><ng-container *ngTemplateOutlet="label" /></span>

5
libs/ui/src/lib/value/value.component.stories.ts

@ -30,6 +30,9 @@ export default {
enableCopyToClipboardButton: { enableCopyToClipboardButton: {
control: 'boolean' control: 'boolean'
}, },
isLoading: {
control: 'boolean'
},
size: { size: {
control: 'select', control: 'select',
options: ['small', 'medium', 'large'] options: ['small', 'medium', 'large']
@ -41,7 +44,7 @@ type Story = StoryObj<GfValueComponent>;
export const Loading: Story = { export const Loading: Story = {
args: { args: {
value: undefined isLoading: true
} }
}; };

4
libs/ui/src/lib/value/value.component.ts

@ -62,6 +62,8 @@ export class GfValueComponent implements AfterViewInit, OnChanges, OnDestroy {
public readonly copiedTitle = $localize`The value has been copied to the clipboard`; public readonly copiedTitle = $localize`The value has been copied to the clipboard`;
public readonly copyToClipboardTitle = $localize`Copy to clipboard`; public readonly copyToClipboardTitle = $localize`Copy to clipboard`;
public readonly isLoading = input<boolean>(false);
public readonly precision = input<number>();
public constructor( public constructor(
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
@ -74,8 +76,6 @@ export class GfValueComponent implements AfterViewInit, OnChanges, OnDestroy {
}); });
} }
public readonly precision = input<number>();
private copyToClipboardTimeout: ReturnType<typeof setTimeout>; private copyToClipboardTimeout: ReturnType<typeof setTimeout>;
private readonly formatOptions = computed<Intl.NumberFormatOptions>(() => { private readonly formatOptions = computed<Intl.NumberFormatOptions>(() => {

Loading…
Cancel
Save