From cc7d0ccce2888b2d23c6ecb77783c920eb37be2d 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: Mon, 24 Apr 2023 12:43:33 +0300 Subject: [PATCH] Refactor #3879 - For Skeleton --- api-generator/components/skeleton.js | 6 +++++ components/lib/skeleton/Skeleton.d.ts | 32 +++++++++++++++++++++++++++ components/lib/skeleton/Skeleton.vue | 5 ++++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/api-generator/components/skeleton.js b/api-generator/components/skeleton.js index 59ef801d1..e500ce80d 100644 --- a/api-generator/components/skeleton.js +++ b/api-generator/components/skeleton.js @@ -34,6 +34,12 @@ const SkeletonProps = [ type: 'string', default: 'wave', description: 'Type of the animation, valid options are "wave" and "none".' + }, + { + name: 'pt', + type: 'any', + default: 'null', + description: 'Uses to pass attributes to DOM elements inside the component.' } ]; diff --git a/components/lib/skeleton/Skeleton.d.ts b/components/lib/skeleton/Skeleton.d.ts index 26b507822..5035dc031 100644 --- a/components/lib/skeleton/Skeleton.d.ts +++ b/components/lib/skeleton/Skeleton.d.ts @@ -9,6 +9,33 @@ */ import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type SkeletonPassThroughOptionType = SkeletonPassThroughAttributes | ((options: SkeletonPassThroughMethodOptions) => SkeletonPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface SkeletonPassThroughMethodOptions { + props: SkeletonProps; +} + +/** + * Custom passthrough(pt) options. + * @see {@link SkeletonProps.pt} + */ +export interface SkeletonPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: SkeletonPassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface SkeletonPassThroughAttributes { + [key: string]: any; +} + /** * Defines valid properties in Skeleton component. */ @@ -41,6 +68,11 @@ export interface SkeletonProps { * @defaultValue wave */ animation?: 'wave' | 'none' | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {SkeletonPassThroughOptions} + */ + pt?: SkeletonPassThroughOptions; } /** diff --git a/components/lib/skeleton/Skeleton.vue b/components/lib/skeleton/Skeleton.vue index a3c72fc7c..f8bfa5f03 100644 --- a/components/lib/skeleton/Skeleton.vue +++ b/components/lib/skeleton/Skeleton.vue @@ -1,10 +1,13 @@