Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<background-provider color="#FFFFFF">
<tbuilder-component-mode text="Default">
<dxc-slider
label="Test Mode"
helperText="Helper text example"
label="Test Mode"
helperText="Helper text example"
minValue="0"
maxValue="100"
showLimitsValues="true"
Expand Down Expand Up @@ -37,7 +37,6 @@
step="10"
marks="true"
margin="medium"

></dxc-slider>
</tbuilder-component-mode>

Expand Down
20 changes: 17 additions & 3 deletions projects/dxc-ngx-cdk/src/lib/dxc-slider/dxc-slider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ export class DxcSliderComponent implements OnInit, OnChanges {
this._disabled = coerceBooleanProperty(value);
}
private _disabled;
/**
* Whether the marks between each step should be shown or not.
*/
@Input()
get marks(): boolean {
return this._marks;
}
set marks(value: boolean) {
this._marks = coerceBooleanProperty(value);
}
private _marks = false;
/**
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
Expand Down Expand Up @@ -134,7 +145,7 @@ export class DxcSliderComponent implements OnInit, OnChanges {
/**
* This event will emit in case the slider changes its value, as it's being dragged.
* The new value will be passed as a parameter.
*/
*/
@Output() onChange: EventEmitter<number> = new EventEmitter<number>();
/**
* This event will emit in case the slider changes its value, but only when the thumb is released.
Expand Down Expand Up @@ -201,7 +212,9 @@ export class DxcSliderComponent implements OnInit, OnChanges {
}

public ngOnChanges(changes: SimpleChanges): void {
this.tickInterval = this.step > 1 ? 1 : 0;
if (this.marks) {
this.tickInterval = this.step > 1 ? 1 : 0;
}
this.isDisabled = this.disabled;
this.renderedValue = this.value;
const inputs = Object.keys(changes).reduce((result, item) => {
Expand Down Expand Up @@ -263,7 +276,8 @@ export class DxcSliderComponent implements OnInit, OnChanges {
if (inputs.size === "fillParent") {
return css`
width: calc(
${sizes[inputs.size]} - ${this.getMargin(inputs.margin, "left")} - ${this.getMargin(inputs.margin, "right")}
${sizes[inputs.size]} - ${this.getMargin(inputs.margin, "left")} -
${this.getMargin(inputs.margin, "right")}
);
`;
}
Expand Down