From dbfbc31e8aa56ff4f98f219b33f7311e90a188d1 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: Tue, 4 Apr 2023 15:39:42 +0300 Subject: [PATCH] Refactor #3832 Refactor #3833 - For Checkbox --- api-generator/components/checkbox.js | 10 +++++++++- components/lib/checkbox/Checkbox.d.ts | 15 +++++++++++++-- components/lib/checkbox/Checkbox.vue | 8 +++++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/api-generator/components/checkbox.js b/api-generator/components/checkbox.js index 06a343db2..2e122f275 100644 --- a/api-generator/components/checkbox.js +++ b/api-generator/components/checkbox.js @@ -106,11 +106,19 @@ const CheckboxEvents = [ } ]; +const CheckboxSlots = [ + { + name: 'icon', + description: 'Custom icon template.' + } +]; + module.exports = { checkbox: { name: 'Checkbox', description: 'Checkbox is an extension to standard checkbox element with theming.', props: CheckboxProps, - events: CheckboxEvents + events: CheckboxEvents, + slots: CheckboxSlots } }; diff --git a/components/lib/checkbox/Checkbox.d.ts b/components/lib/checkbox/Checkbox.d.ts index b4716b997..86ad112e4 100755 --- a/components/lib/checkbox/Checkbox.d.ts +++ b/components/lib/checkbox/Checkbox.d.ts @@ -7,7 +7,7 @@ * @module checkbox * */ -import { InputHTMLAttributes } from 'vue'; +import { InputHTMLAttributes, VNode } from 'vue'; import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; /** @@ -86,7 +86,18 @@ export interface CheckboxProps { 'aria-label'?: string | undefined; } -export interface CheckboxSlots {} +export interface CheckboxSlots { + /** + * Custom icon template. + * @param {Object} scope - icon slot's params. + */ + icon(scope: { + /** + * State of the checkbox. + */ + checked: boolean; + }): VNode[]; +} /** * Defines valid emits in Checkbox component. diff --git a/components/lib/checkbox/Checkbox.vue b/components/lib/checkbox/Checkbox.vue index 36cd2645b..52cfa66d8 100755 --- a/components/lib/checkbox/Checkbox.vue +++ b/components/lib/checkbox/Checkbox.vue @@ -20,12 +20,15 @@ />
- + + +