Skip to content

Commit

Permalink
feat: #343 add progress-absolute prop to c-loader-status
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Jan 12, 2024
1 parent 0b98025 commit 7a50fe3
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ A more advanced usage allows passing different flags for different callers. Prov

Specify if space should be reserved for the progress indicator. If set to false, the content in the default slot may jump up and down slightly as the progress indicator shows and hides.

<Prop def="progressAbsolute: boolean = false" lang="ts" />

Positions the progress bar absolutely. This can be useful in compact interfaces where extra space for the progress bar is undesirable, allowing the progress bar to potentially overlap content while active.

<Prop def="height: number = 10" lang="ts" />

Specifies the height in pixels of the [v-progress-linear](https://vuetifyjs.com/en/components/progress-linear) used to indicate progress.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}"
>
<template #default>
<v-form ref="form">
<v-form ref="form" class="mt-3">
<v-row
v-for="prop in showProps"
:key="prop.name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
...viewModel.$items.map((i) => i.$save),
],
}"
progress-absolute
>
<c-table
admin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
the progress loader and the placeholder independent of the
main outer transition between content/error/loaders -->
<transition-group
class="c-loader-status--transition-group"
class="c-loader-status--transition-group c-loader-status--progress-group"
:class="{ absolute: progressAbsolute }"
key="loading"
v-if="showLoading || usePlaceholder"
name="c-loader-status-fade"
Expand Down Expand Up @@ -118,6 +119,12 @@ export default defineComponent({
* keep the default slot visible.
*/
progressPlaceholder: { required: false, type: Boolean, default: true },
/** Positions the progress bar absolutely. This can be useful in compact interfaces
* where extra space for the progress bar is undesirable, allowing the
* progress bar to potentially overlap content while active. */
progressAbsolute: { required: false, type: Boolean, default: false },
height: { required: false, type: [Number, String], default: 10 },
noProgress: { required: false, type: Boolean, default: null },
Expand Down Expand Up @@ -280,6 +287,15 @@ export default defineComponent({
flex-direction: column;
font-weight: 400;
.c-loader-status--progress-group {
&.absolute {
// Make the progress bar on c-loader-status overlap
// so it doesn't add extra whitespace to the top of the row.
position: absolute !important;
width: 100%;
}
}
.c-loader-status--content {
flex-grow: 1;
flex-shrink: 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</v-btn>
</v-toolbar>

<v-card-text>
<v-card-text class="pt-2">
<c-loader-status
:loaders="{
[!showContent ? 'no-initial-content' : 'no-error-content']: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
</v-col>
<v-col>
<c-loader-status
:progress-placeholder="false"
:loaders="{
'no-initial-content no-error-content no-loading-content': [caller],
}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
v-if="showLoading || usePlaceholder"
key="loading"
class="c-loader-status--transition-group c-loader-status--progress-group"
:class="{ absolute: progressAbsolute }"
name="c-loader-status-fade"
mode="out-in"
tag="div"
style="position: relative"
:style="{
'--c-loader-status-progress-height': height + 'px',
}"
Expand Down Expand Up @@ -127,10 +127,16 @@ const props = withDefaults(
| AnyLoaderMaybe[];
/**
* Whether space is reserved for the progress bar even when the progress visible is not active. Default true.
* Whether space is reserved for the progress bar even when
* the progress visible is not active. Default true.
*/
progressPlaceholder?: boolean;
/** Positions the progress bar absolutely. This can be useful in compact interfaces
* where extra space for the progress bar is undesirable, allowing the
* progress bar to potentially overlap content while active. */
progressAbsolute?: boolean;
/** The height of the progress bar */
height?: 10;
/** The color of the progress bar */
Expand Down Expand Up @@ -337,6 +343,16 @@ defineExpose({ loaderFlags });
flex-direction: column;
font-weight: 400;
.c-loader-status--progress-group {
position: relative;
&.absolute {
// Make the progress bar on c-loader-status overlap
// so it doesn't add extra whitespace to the top of the row.
position: absolute !important;
width: 100%;
}
}
.c-loader-status--content {
flex-grow: 1;
flex-shrink: 1;
Expand Down

0 comments on commit 7a50fe3

Please sign in to comment.