From a760c56aefbd39d3fa4b60fadf4acceb97bcda45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bahad=C4=B1r=20Sofuo=C4=9Flu?= Date: Sun, 7 May 2023 13:54:26 +0300 Subject: [PATCH] Refactor #3922 - For Slider --- components/lib/slider/Slider.d.ts | 48 ++++++++++++++++++++++++++++++ components/lib/slider/Slider.vue | 9 ++++-- doc/slider/pt/PTDoc.vue | 49 +++++++++++++++++++++++++++++++ doc/slider/pt/PTImage.vue | 8 +++++ doc/slider/pt/index.vue | 41 ++++++++++++++++++++++++++ pages/slider/index.vue | 7 +++-- 6 files changed, 157 insertions(+), 5 deletions(-) create mode 100644 doc/slider/pt/PTDoc.vue create mode 100644 doc/slider/pt/PTImage.vue create mode 100644 doc/slider/pt/index.vue diff --git a/components/lib/slider/Slider.d.ts b/components/lib/slider/Slider.d.ts index c31c7b4d9..cd395f4d9 100755 --- a/components/lib/slider/Slider.d.ts +++ b/components/lib/slider/Slider.d.ts @@ -9,6 +9,49 @@ */ import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; +export declare type SliderPassThroughOptionType = SliderPassThroughAttributes | ((options: SliderPassThroughMethodOptions) => SliderPassThroughAttributes) | null | undefined; + +/** + * Custom passthrough(pt) option method. + */ +export interface SliderPassThroughMethodOptions { + props: SliderProps; +} + +/** + * Custom passthrough(pt) options. + * @see {@link SliderProps.pt} + */ +export interface SliderPassThroughOptions { + /** + * Uses to pass attributes to the root's DOM element. + */ + root?: SliderPassThroughOptionType; + /** + * Uses to pass attributes to the range's DOM element. + */ + range?: SliderPassThroughOptionType; + /** + * Uses to pass attributes to the handle's DOM element. + */ + handle?: SliderPassThroughOptionType; + /** + * Uses to pass attributes to the start handler's DOM element. + */ + startHandler?: SliderPassThroughOptionType; + /** + * Uses to pass attributes to the end handler's DOM element. + */ + endHandler?: SliderPassThroughOptionType; +} + +/** + * Custom passthrough attributes for each DOM elements + */ +export interface SliderPassThroughAttributes { + [key: string]: any; +} + /** * Custom slide end event. * @see {@link SliderEmits.slideend} @@ -74,6 +117,11 @@ export interface SliderProps { * Used to define a string that labels the element. */ 'aria-label'?: string | undefined; + /** + * Uses to pass attributes to DOM elements inside the component. + * @type {SliderPassThroughOptions} + */ + pt?: SliderPassThroughOptions; } /** diff --git a/components/lib/slider/Slider.vue b/components/lib/slider/Slider.vue index c94637b92..a9a133577 100755 --- a/components/lib/slider/Slider.vue +++ b/components/lib/slider/Slider.vue @@ -1,6 +1,6 @@ diff --git a/doc/slider/pt/PTImage.vue b/doc/slider/pt/PTImage.vue new file mode 100644 index 000000000..9ac50d6b4 --- /dev/null +++ b/doc/slider/pt/PTImage.vue @@ -0,0 +1,8 @@ + diff --git a/doc/slider/pt/index.vue b/doc/slider/pt/index.vue new file mode 100644 index 000000000..b70472fae --- /dev/null +++ b/doc/slider/pt/index.vue @@ -0,0 +1,41 @@ + + + diff --git a/pages/slider/index.vue b/pages/slider/index.vue index 79b7a1708..803e0fa68 100755 --- a/pages/slider/index.vue +++ b/pages/slider/index.vue @@ -1,5 +1,5 @@