From 0d8f1b20edaeb72495d134e63923d903fe837692 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:34:40 +0300 Subject: [PATCH] Refactor #3879 - For ProgressBar --- api-generator/components/progressbar.js | 6 ++++ components/lib/progressbar/ProgressBar.d.ts | 40 +++++++++++++++++++++ components/lib/progressbar/ProgressBar.vue | 13 ++++--- 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/api-generator/components/progressbar.js b/api-generator/components/progressbar.js index c89f78165..161870126 100644 --- a/api-generator/components/progressbar.js +++ b/api-generator/components/progressbar.js @@ -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.' } ]; diff --git a/components/lib/progressbar/ProgressBar.d.ts b/components/lib/progressbar/ProgressBar.d.ts index 954483230..2fbee93be 100755 --- a/components/lib/progressbar/ProgressBar.d.ts +++ b/components/lib/progressbar/ProgressBar.d.ts @@ -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; } /** diff --git a/components/lib/progressbar/ProgressBar.vue b/components/lib/progressbar/ProgressBar.vue index fd5beacb4..4d3eb56e9 100755 --- a/components/lib/progressbar/ProgressBar.vue +++ b/components/lib/progressbar/ProgressBar.vue @@ -1,19 +1,22 @@