Refactor #3879 - For ProgressSpinner
parent
498b40f80f
commit
c7d3a2fd14
|
@ -16,6 +16,12 @@ const ProgressSpinnerProps = [
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: '2s',
|
default: '2s',
|
||||||
description: 'Duration of the rotate animation.'
|
description: 'Duration of the rotate animation.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'pt',
|
||||||
|
type: 'any',
|
||||||
|
default: 'null',
|
||||||
|
description: 'Uses to pass attributes to DOM elements inside the component.'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,41 @@
|
||||||
*/
|
*/
|
||||||
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
||||||
|
|
||||||
|
export declare type ProgressSpinnerPassThroughOptionType = ProgressSpinnerPassThroughAttributes | ((options: ProgressSpinnerPassThroughMethodOptions) => ProgressSpinnerPassThroughAttributes) | null | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom passthrough(pt) option method.
|
||||||
|
*/
|
||||||
|
export interface ProgressSpinnerPassThroughMethodOptions {
|
||||||
|
props: ProgressSpinnerProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom passthrough(pt) options.
|
||||||
|
* @see {@link ProgressSpinnerProps.pt}
|
||||||
|
*/
|
||||||
|
export interface ProgressSpinnerPassThroughOptions {
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to the root's DOM element.
|
||||||
|
*/
|
||||||
|
root?: ProgressSpinnerPassThroughOptionType;
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to the spinner's DOM element.
|
||||||
|
*/
|
||||||
|
spinner?: ProgressSpinnerPassThroughOptionType;
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to the circle's DOM element.
|
||||||
|
*/
|
||||||
|
circle?: ProgressSpinnerPassThroughOptionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom passthrough attributes for each DOM elements
|
||||||
|
*/
|
||||||
|
export interface ProgressSpinnerPassThroughAttributes {
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines valid properties in ProgressSpinner component.
|
* Defines valid properties in ProgressSpinner component.
|
||||||
*/
|
*/
|
||||||
|
@ -27,6 +62,11 @@ export interface ProgressSpinnerProps {
|
||||||
* @defaultValue 2s
|
* @defaultValue 2s
|
||||||
*/
|
*/
|
||||||
animationDuration?: string | undefined;
|
animationDuration?: string | undefined;
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to DOM elements inside the component.
|
||||||
|
* @type {ProgressSpinnerPassThroughOptions}
|
||||||
|
*/
|
||||||
|
pt?: ProgressSpinnerPassThroughOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="p-progress-spinner" role="progressbar">
|
<div class="p-progress-spinner" role="progressbar" v-bind="ptm('root')">
|
||||||
<svg class="p-progress-spinner-svg" viewBox="25 25 50 50" :style="svgStyle">
|
<svg class="p-progress-spinner-svg" viewBox="25 25 50 50" :style="svgStyle" v-bind="ptm('spinner')">
|
||||||
<circle class="p-progress-spinner-circle" cx="50" cy="50" r="20" :fill="fill" :stroke-width="strokeWidth" strokeMiterlimit="10" />
|
<circle class="p-progress-spinner-circle" cx="50" cy="50" r="20" :fill="fill" :stroke-width="strokeWidth" strokeMiterlimit="10" v-bind="ptm('circle')" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import BaseComponent from 'primevue/basecomponent';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ProgressSpinner',
|
name: 'ProgressSpinner',
|
||||||
|
extends: BaseComponent,
|
||||||
props: {
|
props: {
|
||||||
strokeWidth: {
|
strokeWidth: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
Loading…
Reference in New Issue