From c7d3a2fd14a8ab045da5a5d1d0c53d5598cb10c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Fri, 21 Apr 2023 16:39:16 +0300 Subject: [PATCH] Refactor #3879 - For ProgressSpinner --- api-generator/components/progressspinner.js | 6 +++ .../lib/progressspinner/ProgressSpinner.d.ts | 40 +++++++++++++++++++ .../lib/progressspinner/ProgressSpinner.vue | 9 +++-- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/api-generator/components/progressspinner.js b/api-generator/components/progressspinner.js index f2a190cea..493b9e054 100644 --- a/api-generator/components/progressspinner.js +++ b/api-generator/components/progressspinner.js @@ -16,6 +16,12 @@ const ProgressSpinnerProps = [ type: 'string', default: '2s', description: 'Duration of the rotate animation.' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/progressspinner/ProgressSpinner.d.ts b/components/lib/progressspinner/ProgressSpinner.d.ts index 533875822..23fb36c1d 100755 --- a/components/lib/progressspinner/ProgressSpinner.d.ts +++ b/components/lib/progressspinner/ProgressSpinner.d.ts @@ -9,6 +9,41 @@ */ 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. */ @@ -27,6 +62,11 @@ export interface ProgressSpinnerProps { * @defaultValue 2s */ animationDuration?: string | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {ProgressSpinnerPassThroughOptions} + */ + pt?: ProgressSpinnerPassThroughOptions; } /** diff --git a/components/lib/progressspinner/ProgressSpinner.vue b/components/lib/progressspinner/ProgressSpinner.vue index 37a304eb8..c10da4e18 100755 --- a/components/lib/progressspinner/ProgressSpinner.vue +++ b/components/lib/progressspinner/ProgressSpinner.vue @@ -1,14 +1,17 @@