kopia lustrzana https://github.com/shoelace-style/shoelace
Use localization for default tooltip formatter
rodzic
450e3296d0
commit
3b83126851
|
@ -110,7 +110,7 @@ export default class SlMultiRange extends ShoelaceElement implements ShoelaceFor
|
|||
* A function used to format the tooltip's value. The range's value is passed as the first and only argument. The
|
||||
* function should return a string to display in the tooltip.
|
||||
*/
|
||||
@property({ attribute: false }) tooltipFormatter: (value: number) => string = (value: number) => value.toString();
|
||||
@property({ attribute: false }) tooltipFormatter: (value: number) => string;
|
||||
|
||||
@query('.base') baseDiv: HTMLDivElement;
|
||||
@query('.active-track') activeTrack: HTMLDivElement;
|
||||
|
@ -131,6 +131,11 @@ export default class SlMultiRange extends ShoelaceElement implements ShoelaceFor
|
|||
return this.#localize.dir() === 'rtl';
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.tooltipFormatter = this.#localize.number.bind(this.#localize);
|
||||
}
|
||||
|
||||
override render(): unknown {
|
||||
const hasLabel = !!(this.label || this.#hasSlotController.test('label'));
|
||||
const hasHelpText = !!(this.helpText || this.#hasSlotController.test('help-text'));
|
||||
|
|
Ładowanie…
Reference in New Issue