Refactor #3879 - For ProgressBar
parent
58c4684a38
commit
0d8f1b20ed
|
@ -16,6 +16,12 @@ const ProgressbarProps = [
|
|||
type: 'boolean',
|
||||
default: 'true',
|
||||
description: 'Whether to display the progress bar value.'
|
||||
},
|
||||
{
|
||||
name: 'pt',
|
||||
type: 'any',
|
||||
default: 'null',
|
||||
description: 'Uses to pass attributes to DOM elements inside the component.'
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -10,6 +10,41 @@
|
|||
import { VNode } from 'vue';
|
||||
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
||||
|
||||
export declare type ProgressBarPassThroughOptionType = ProgressBarPassThroughAttributes | ((options: ProgressBarPassThroughMethodOptions) => ProgressBarPassThroughAttributes) | null | undefined;
|
||||
|
||||
/**
|
||||
* Custom passthrough(pt) option method.
|
||||
*/
|
||||
export interface ProgressBarPassThroughMethodOptions {
|
||||
props: ProgressBarProps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom passthrough(pt) options.
|
||||
* @see {@link ProgressBarProps.pt}
|
||||
*/
|
||||
export interface ProgressBarPassThroughOptions {
|
||||
/**
|
||||
* Uses to pass attributes to the root's DOM element.
|
||||
*/
|
||||
root?: ProgressBarPassThroughOptionType;
|
||||
/**
|
||||
* Uses to pass attributes to the value's DOM element.
|
||||
*/
|
||||
value?: ProgressBarPassThroughOptionType;
|
||||
/**
|
||||
* Uses to pass attributes to the label's DOM element.
|
||||
*/
|
||||
label?: ProgressBarPassThroughOptionType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom passthrough attributes for each DOM elements
|
||||
*/
|
||||
export interface ProgressBarPassThroughAttributes {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines valid properties in ProgressBar component.
|
||||
*/
|
||||
|
@ -28,6 +63,11 @@ export interface ProgressBarProps {
|
|||
* @defaultValue true
|
||||
*/
|
||||
showValue?: boolean | undefined;
|
||||
/**
|
||||
* Uses to pass attributes to DOM elements inside the component.
|
||||
* @type {ProgressBarPassThroughOptions}
|
||||
*/
|
||||
pt?: ProgressBarPassThroughOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
<template>
|
||||
<div role="progressbar" :class="containerClass" aria-valuemin="0" :aria-valuenow="value" aria-valuemax="100">
|
||||
<div v-if="determinate" class="p-progressbar-value p-progressbar-value-animate" :style="progressStyle">
|
||||
<div v-if="value != null && value !== 0 && showValue" class="p-progressbar-label">
|
||||
<div role="progressbar" :class="containerClass" aria-valuemin="0" :aria-valuenow="value" aria-valuemax="100" v-bind="ptm('root')">
|
||||
<div v-if="determinate" class="p-progressbar-value p-progressbar-value-animate" :style="progressStyle" v-bind="ptm('value')">
|
||||
<div v-if="value != null && value !== 0 && showValue" class="p-progressbar-label" v-bind="ptm('label')">
|
||||
<slot>{{ value + '%' }}</slot>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="indeterminate" class="p-progressbar-indeterminate-container">
|
||||
<div class="p-progressbar-value p-progressbar-value-animate"></div>
|
||||
<div v-if="indeterminate" class="p-progressbar-indeterminate-container" v-bind="ptm('root')">
|
||||
<div class="p-progressbar-value p-progressbar-value-animate" v-bind="ptm('value')"></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseComponent from 'primevue/basecomponent';
|
||||
|
||||
export default {
|
||||
name: 'ProgressBar',
|
||||
extends: BaseComponent,
|
||||
props: {
|
||||
value: {
|
||||
type: Number,
|
||||
|
|
Loading…
Reference in New Issue