Skip to content

Commit

Permalink
work for the #8209 (readonly fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-kurmanov committed May 27, 2024
1 parent bd2896b commit 24a58e1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/defaultCss/defaultV2Css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export var defaultV2Css = {
disabled: "sd-question--disabled",
readOnly: "sd-question--readonly",
preview: "sd-question--preview",
noPointerEventsMode: "sd-question--no-pointer-events",
errorsContainer: "sd-element__erbox sd-question__erbox",
errorsContainerTop: "sd-element__erbox--above-element sd-question__erbox--above-question",
errorsContainerBottom: "sd-question__erbox--below-question"
Expand Down
10 changes: 10 additions & 0 deletions src/defaultV2-theme/blocks/sd-question.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
position: relative;
}

.sd-question--no-pointer-events {

.sd-selectbase,
.sd-rating {
label {
pointer-events: none;
}
}
}

.sd-element__erbox--above-element {
margin-bottom: calcSize(1);
}
Expand Down
1 change: 1 addition & 0 deletions src/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ export class Question extends SurveyElement<Question>
.append(cssClasses.hasErrorBottom, hasError && this.getErrorLocation() == "bottom")
.append(cssClasses.small, !this.width)
.append(cssClasses.answered, this.isAnswered)
.append(cssClasses.noPointerEventsMode, this.isReadOnlyAttr)
.toString();
}
public get cssHeader(): string {
Expand Down
1 change: 1 addition & 0 deletions src/question_checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export class QuestionCheckboxModel extends QuestionCheckboxBase {
this.renderedValue = val;
}
public clickItemHandler(item: ItemValue, checked?: boolean): void {
if (this.isReadOnlyAttr) return;
if(item === this.selectAllItem) {
if(checked === true || checked === false) {
this.isAllSelected = checked;
Expand Down
1 change: 1 addition & 0 deletions src/question_radiogroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class QuestionRadiogroupModel extends QuestionCheckboxBase {
return !this.isDefaultV2Theme && this.canShowClearButton;
}
public clickItemHandler(item: ItemValue): void {
if (this.isReadOnlyAttr) return;
this.renderedValue = item.value;
}

Expand Down

0 comments on commit 24a58e1

Please sign in to comment.