Skip to content

Commit

Permalink
Fixed #5616
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Apr 19, 2024
1 parent e747e01 commit e7ec2ad
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions api-generator/components/knob.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ const KnobProps = [
{
name: 'valueTemplate',
type: 'function | string',
default: 'val => val',
description: 'Controls how the knob is labeled.'
default: '{value}',
description: 'Template of the value.'
},
{
name: 'tabindex',
Expand Down
2 changes: 1 addition & 1 deletion components/lib/knob/BaseKnob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default {
},
valueTemplate: {
type: [String, Function],
default: () => (val) => val
default: '{value}'
},
tabindex: {
type: Number,
Expand Down
2 changes: 1 addition & 1 deletion components/lib/knob/Knob.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export interface KnobProps {
showValue?: boolean | undefined;
/**
* Template string of the value.
* @defaultValue 'val => val'
* @defaultValue '{value}'
*/
valueTemplate?: (val: number) => string | string | undefined;
/**
Expand Down
10 changes: 3 additions & 7 deletions doc/knob/TemplateDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<DocSectionText v-bind="$attrs">
<p>The label can be customized with the <i>valueTemplate</i> property using either a template string or a function.</p>
</DocSectionText>
<div class="card flex justify-content-center gap-4">
<div class="card flex justify-content-center">
<Knob v-model="value" valueTemplate="{value}%" />
<Knob v-model="value" :valueTemplate="(val) => val / 100" />
</div>
<DocSectionCode :code="code" />
</template>
Expand All @@ -17,13 +16,11 @@ export default {
code: {
basic: `
<Knob v-model="value" valueTemplate="{value}%" />
<Knob v-model="value" :valueTemplate="val => val / 100" />
`,
options: `
<template>
<div class="card flex justify-content-center gap-4">
<div class="card flex justify-content-center">
<Knob v-model="value" valueTemplate="{value}%" />
<Knob v-model="value" :valueTemplate="val => val / 100" />
</div>
</template>
Expand All @@ -39,9 +36,8 @@ export default {
`,
composition: `
<template>
<div class="card flex justify-content-center gap-4">
<div class="card flex justify-content-center">
<Knob v-model="value" valueTemplate="{value}%" />
<Knob v-model="value" :valueTemplate="val => val / 100" />
</div>
</template>
Expand Down

0 comments on commit e7ec2ad

Please sign in to comment.