From 095cdf94fa7247278de2a74bdf5cbc84e5fab9b6 Mon Sep 17 00:00:00 2001 From: OlgaLarina Date: Wed, 31 Jan 2024 17:30:04 +0300 Subject: [PATCH 1/9] Fix list item styles (#7761) * work for https://github.com/surveyjs/survey-creator/issues/5115 * work for https://github.com/surveyjs/survey-creator/issues/5115 fix text aligment * work for https://github.com/surveyjs/survey-creator/issues/5115 revert code --------- Co-authored-by: OlgaLarina --- src/common-styles/sv-list.scss | 5 +++-- src/defaultV2-theme/blocks/sd-dropdown.scss | 21 ++++++++++++++++++++- src/defaultV2-theme/mixins.scss | 1 - 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/common-styles/sv-list.scss b/src/common-styles/sv-list.scss index c23c0ee126..c66d36c48d 100644 --- a/src/common-styles/sv-list.scss +++ b/src/common-styles/sv-list.scss @@ -59,8 +59,11 @@ } .sv-list__item.sv-list__item--focused:not(.sv-list__item--selected) { + outline: none; + .sv-list__item-body { @include borderLight; + border-radius: calcCornerRadius(1); padding-block: calcSize(0.75); padding-inline-end: calcSize(7.75); padding-inline-start: calcSize(1.75); @@ -69,8 +72,6 @@ .sv-string-viewer { margin-inline-start: calcSize(-0.25); } - - outline: none; } .sv-list__item:hover, diff --git a/src/defaultV2-theme/blocks/sd-dropdown.scss b/src/defaultV2-theme/blocks/sd-dropdown.scss index 59993e1158..e20785f433 100644 --- a/src/defaultV2-theme/blocks/sd-dropdown.scss +++ b/src/defaultV2-theme/blocks/sd-dropdown.scss @@ -164,7 +164,26 @@ font-size: $font-editorfont-size; font-weight: $font-editorfont-weight; font-family: $font-editorfont-family; - padding-inline-end: calcSize(2); + padding-inline-end: calcSize(1.75); + padding-block: calcSize(1.25); + padding-inline-start: calcSize(1.75); + border: calcSize(0.25) solid transparent; + border-radius: calcCornerRadius(1); + + // transition: border-color 1550ms; + } + + .sv-list__item.sv-list__item--focused:not(.sv-list__item--selected) { + .sv-list__item-body { + @include borderLight; + padding-inline-end: calcSize(1.75); + padding-block: calcSize(1.25); + padding-inline-start: calcSize(1.75); + } + } + + .sv-list__item span { + margin-inline-start: calcSize(-0.25); } } diff --git a/src/defaultV2-theme/mixins.scss b/src/defaultV2-theme/mixins.scss index a61853e7b2..9fd433e793 100644 --- a/src/defaultV2-theme/mixins.scss +++ b/src/defaultV2-theme/mixins.scss @@ -25,7 +25,6 @@ @mixin borderLight { border: calcSize(0.25) solid $border-light; - border-radius: calcCornerRadius(1); } @mixin articleXXLargeFont { From 611415ed28224fb0343362ac54ee0f0b33194cc9 Mon Sep 17 00:00:00 2001 From: OlgaLarina Date: Wed, 31 Jan 2024 18:04:15 +0300 Subject: [PATCH 2/9] fix scroll view after chrome update version 121 fix for FF --- src/defaultV2-theme/defaultV2.fontless.scss | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/defaultV2-theme/defaultV2.fontless.scss b/src/defaultV2-theme/defaultV2.fontless.scss index f1237c9ded..347dbaeccd 100644 --- a/src/defaultV2-theme/defaultV2.fontless.scss +++ b/src/defaultV2-theme/defaultV2.fontless.scss @@ -72,7 +72,7 @@ body { position: relative; } - * { + @-moz-document url-prefix() { scrollbar-width: thin; scrollbar-color: $border transparent; } @@ -113,7 +113,7 @@ body { overflow: auto; position: static; - * { + @-moz-document url-prefix() { scrollbar-width: thin; scrollbar-color: $border transparent; } @@ -162,11 +162,15 @@ body { } } -.sv-popup { - .sv-popup__scrolling-content { +@-moz-document url-prefix() { + .sv-popup .sv-popup__scrolling-content { scrollbar-width: thin; scrollbar-color: $border transparent; + } +} +.sv-popup { + .sv-popup__scrolling-content { *, & { &::-webkit-scrollbar { From e9a084868a51ccd5d6642279521ecd815c8c78b3 Mon Sep 17 00:00:00 2001 From: tsv2013 Date: Wed, 31 Jan 2024 18:16:03 +0300 Subject: [PATCH 3/9] Fixed https://github.com/surveyjs/survey-creator/issues/5141 - Creator KO - New Progress bar UI is not working for Knockout --- src/knockout/components/progress/buttons.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/knockout/components/progress/buttons.ts b/src/knockout/components/progress/buttons.ts index 91d67f5060..c43d80fc8b 100644 --- a/src/knockout/components/progress/buttons.ts +++ b/src/knockout/components/progress/buttons.ts @@ -1,5 +1,5 @@ import * as ko from "knockout"; -import { ProgressButtons, ProgressButtonsResponsivityManager, IProgressButtonsViewModel } from "survey-core"; +import { ProgressButtons, ProgressButtonsResponsivityManager, IProgressButtonsViewModel, SurveyModel } from "survey-core"; const template: any = require("html-loader?interpolate!val-loader!./buttons.html"); export class ProgressButtonsViewModel implements IProgressButtonsViewModel { @@ -8,7 +8,7 @@ export class ProgressButtonsViewModel implements IProgressButtonsViewModel { public canShowHeader = ko.observable(false); public canShowFooter = ko.observable(false); public canShowItemTitles = ko.observable(true); - constructor(private model: ProgressButtons, private element: HTMLElement, public container: string = "center") { + constructor(private model: ProgressButtons, private element: HTMLElement, public container: string = "center", public survey: SurveyModel) { this.respManager = new ProgressButtonsResponsivityManager(model, element, this); } onResize(canShowItemTitles: boolean): void { @@ -42,7 +42,8 @@ ko.components.register("sv-progress-buttons", { return new ProgressButtonsViewModel( params.model, componentInfo.element.nextElementSibling, - params.container + params.container, + params.survey ); }, }, From ff5c380f0581b5fb3f296be4c2686a06c67a1390 Mon Sep 17 00:00:00 2001 From: tsv2013 Date: Wed, 31 Jan 2024 18:18:14 +0300 Subject: [PATCH 4/9] Work for https://github.com/surveyjs/survey-creator/issues/5141 - fixed u-test --- tests/ko/survey_kotests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ko/survey_kotests.ts b/tests/ko/survey_kotests.ts index fad8c71242..6334ed6915 100644 --- a/tests/ko/survey_kotests.ts +++ b/tests/ko/survey_kotests.ts @@ -1908,7 +1908,7 @@ QUnit.test("ProgressButtonsViewModel component scroll button", function ( querySelectorAll: function () { return [] as any; }, - } as any + } as any, "center", survey ); progress.dispose(); assert.equal( From 664e26729c6f79bc82481e40726c80bcf68615c8 Mon Sep 17 00:00:00 2001 From: OlgaLarina Date: Wed, 31 Jan 2024 18:36:26 +0300 Subject: [PATCH 5/9] update test --- testCafe/survey/surveyWidth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testCafe/survey/surveyWidth.ts b/testCafe/survey/surveyWidth.ts index 22c8f1bc2d..9324489aff 100644 --- a/testCafe/survey/surveyWidth.ts +++ b/testCafe/survey/surveyWidth.ts @@ -26,10 +26,10 @@ frameworks.forEach((framework) => { test("Check question width", async (t) => { await t - .expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("min(100% + 0px, 0% + 300px)"); + .expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("min(100%, 300px)"); await ClientFunction(() => { window["survey"].getAllQuestions()[0].minWidth = "200px"; })(); await t - .expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("min(100% + 0px, 0% + 200px)"); + .expect(Selector(".sv_row > div").getStyleProperty("min-width")).eql("min(100%, 200px)"); }); }); \ No newline at end of file From bd4db734408de98ee9e45aad8774f9138e1ab37a Mon Sep 17 00:00:00 2001 From: OlgaLarina Date: Thu, 1 Feb 2024 10:06:25 +0300 Subject: [PATCH 6/9] resolve #7769 focusOnFirstError bricks dropdown popup if any errors are on the same page --- src/dropdownListModel.ts | 2 +- testCafe/questions/dropdown.js | 63 ++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/src/dropdownListModel.ts b/src/dropdownListModel.ts index 3be103af52..37be36a0d5 100644 --- a/src/dropdownListModel.ts +++ b/src/dropdownListModel.ts @@ -157,7 +157,7 @@ export class DropdownListModel extends Base { _onSelectionChanged = (item: IAction) => { this.question.value = item.id; if (this.question.searchEnabled) this.applyInputString(item as ItemValue); - this._popupModel.toggleVisibility(); + this.popupModel.isVisible = false; }; } const res = new ListModel(visibleItems, _onSelectionChanged, false, undefined, this.question.choicesLazyLoadEnabled ? this.listModelFilterStringChanged : undefined, this.listElementId); diff --git a/testCafe/questions/dropdown.js b/testCafe/questions/dropdown.js index fa9b3f2534..21832c9bcf 100644 --- a/testCafe/questions/dropdown.js +++ b/testCafe/questions/dropdown.js @@ -2068,4 +2068,67 @@ frameworks.forEach((framework) => { .expect(Selector(".sd-boolean__thumb-text").withText("Yes").visible).ok() .expect(popupContainer.visible).notOk(); }); + + test.page(`${url_test}${theme}/${framework}`)("focusOnFirstError bricks dropdown popup if any errors are on the same page", async (t) => { + await t.resizeWindow(800, 600); + const json = { + pages: [ + { + name: "Seite1", + elements: [ + { + type: "dropdown", + name: "Anrede", + title: "Anrede", + choices: [ + { + value: "Item 1", + text: "Frau", + }, + { + value: "Item 2", + text: "Herr", + }, + { + value: "Item 3", + text: "keine Angabe", + }, + { + value: "Item 4", + text: "Divers", + }, + { + value: "Item 5", + text: "Firma", + }, + ], + }, + { + type: "text", + name: "Nachname", + title: "Nachname", + isRequired: true, + }, + ], + }, + ], + focusOnFirstError: true, + }; + await initSurvey(framework, json, { + "onValueChanged": (surveyModel) => { surveyModel.hasErrors(false, true); } + }); + + const questionDropdownV2Select = Selector(".sd-dropdown"); + const popupContainer = Selector(".sv-popup__container").filterVisible(); + const textQuestion = Selector(".sd-input.sd-text"); + await t + .expect(textQuestion.focused).notOk() + + .click(questionDropdownV2Select) + .expect(popupContainer.visible).ok() + + .click(getListItemByText("Herr")) + .expect(textQuestion.focused).ok() + .expect(popupContainer.visible).notOk(); + }); }); \ No newline at end of file From 6410ea84962f8ba2a94bcc969281649a4b74b02d Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 1 Feb 2024 09:47:33 +0200 Subject: [PATCH 7/9] toJSON may serialize a "pos" object for a custom complex property fix #7775 (#7776) --- src/jsonobject.ts | 8 ++++--- tests/jsonobjecttests.ts | 52 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/jsonobject.ts b/src/jsonobject.ts index 0fe281ea2d..33afe3b406 100644 --- a/src/jsonobject.ts +++ b/src/jsonobject.ts @@ -1763,9 +1763,7 @@ export class JsonObject { } private removePosOnValueToJson(property: JsonObjectProperty, value: any): any { if(!property.isCustom || !value) return value; - if (!!value[JsonObject.positionPropertyName]) { - delete value[JsonObject.positionPropertyName]; - } + this.removePosFromObj(value); return value; } private removePos(property: JsonObjectProperty, value: any): void { @@ -1780,9 +1778,13 @@ export class JsonObject { this.removePosFromObj(obj[i]); } } + if(typeof obj !== "object") return; if (!!obj[JsonObject.positionPropertyName]) { delete obj[JsonObject.positionPropertyName]; } + for(let key in obj) { + this.removePosFromObj(obj[key]); + } } private isValueArray(value: any): boolean { return value && Array.isArray(value); diff --git a/tests/jsonobjecttests.ts b/tests/jsonobjecttests.ts index b3e1576f70..d1215f4bf9 100644 --- a/tests/jsonobjecttests.ts +++ b/tests/jsonobjecttests.ts @@ -849,6 +849,58 @@ QUnit.test( ); } ); +QUnit.test("Custom object deserialization, remove pos", function (assert) { + Serializer.addClass("optionstype", + [ + { name: "itemValue" }, + { name: "colorId" }, + { name: "label:text", isLocalizable: true }, + ], undefined); + Serializer.addProperty("car", { name: "options:optionstype" }); + Serializer.addProperty("car", { name: "optionsarray:optionstype[]" }); + const json: any = { + options: { + pos: { start: 1, end: 5 }, + itemValue: "abcdef", + label: { + pos: { start: 10, end: 15 }, + default: "default text", + en: "en text", + de: "de text", + }, + colorId: "black" + }, + optionsarray: [{ + pos: { start: 20, end: 25 }, + itemValue: "abcdef", + label: { + pos: { start: 30, end: 35 }, + default: "default text", + en: "en text", + de: "de text", + }, + colorId: "black" + }] + }; + const car: any = new Car(); + car.fromJSON(json); + + assert.equal(car.options.itemValue, "abcdef", "check itemValue"); + assert.equal(car.options.pos.start, 1, "pos1"); + assert.equal(car.options.label.pos.start, 10, "pos2"); + assert.equal(car.optionsarray[0].pos.start, 20, "pos3"); + assert.equal(car.optionsarray[0].label.pos.start, 30, "pos4"); + + const car_json = car.toJSON(); + assert.notOk(car_json.options["pos"], "no pos1"); + assert.notOk(car_json.options.label["pos"], "no pos2"); + assert.notOk(car_json.optionsarray[0]["pos"], "no pos3"); + assert.notOk(car_json.optionsarray[0].label["pos"], "no pos4"); + + Serializer.removeProperty("car", "options"); + Serializer.removeProperty("car", "optionsarray"); + Serializer.removeClass("optionstype"); +}); QUnit.test( "ItemValue and settings.itemValueAlwaysSerializeAsObject = true", function (assert) { From 6c6f88901d8d47f1d3691e94e26cfc403f7c5f9e Mon Sep 17 00:00:00 2001 From: dmitrykurmanov Date: Thu, 1 Feb 2024 14:14:40 +0400 Subject: [PATCH 8/9] work for the https://github.com/surveyjs/private-tasks/issues/364 --- src/defaultV2-theme/blocks/sd-dropdown.scss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/defaultV2-theme/blocks/sd-dropdown.scss b/src/defaultV2-theme/blocks/sd-dropdown.scss index e20785f433..4caee1cd70 100644 --- a/src/defaultV2-theme/blocks/sd-dropdown.scss +++ b/src/defaultV2-theme/blocks/sd-dropdown.scss @@ -169,8 +169,7 @@ padding-inline-start: calcSize(1.75); border: calcSize(0.25) solid transparent; border-radius: calcCornerRadius(1); - - // transition: border-color 1550ms; + transition: border-color $transition-duration; } .sv-list__item.sv-list__item--focused:not(.sv-list__item--selected) { From a016d56259dcdb5ff50381964ef625b3d80e8c9b Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 1 Feb 2024 15:16:53 +0400 Subject: [PATCH 9/9] Use matrix's responsive titles in other themes: default and modern (#7784) --- src/defaultCss/cssmodern.ts | 2 +- src/defaultCss/cssstandard.ts | 2 +- src/main.m600.scss | 12 +++++++++--- src/modern.m600.scss | 12 +++++++++--- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/defaultCss/cssmodern.ts b/src/defaultCss/cssmodern.ts index ff7ae72e67..86cd636347 100644 --- a/src/defaultCss/cssmodern.ts +++ b/src/defaultCss/cssmodern.ts @@ -319,7 +319,7 @@ export var modernCss = { cellText: "sv-matrix__text", cellTextSelected: "sv-matrix__text--checked", cellTextDisabled: "sv-matrix__text--disabled", - cellResponsiveTitle: "sv-hidden", + cellResponsiveTitle: "sv-matrix__cell-responsive-title", itemSvgIconId: "#icon-modernradio", }, matrixdropdown: { diff --git a/src/defaultCss/cssstandard.ts b/src/defaultCss/cssstandard.ts index bb12a6635c..e4d2878543 100644 --- a/src/defaultCss/cssstandard.ts +++ b/src/defaultCss/cssstandard.ts @@ -200,7 +200,7 @@ export var defaultStandardCss = { cellText: "sv_q_m_cell_text", cellTextSelected: "sv_q_m_cell_selected", cellLabel: "sv_q_m_cell_label", - cellResponsiveTitle: "sv-hidden" + cellResponsiveTitle: "sv_q_m_cell_responsive_title" }, matrixdropdown: { root: "sv_q_matrix_dropdown", diff --git a/src/main.m600.scss b/src/main.m600.scss index c9d1a2da4c..8fd09a141c 100644 --- a/src/main.m600.scss +++ b/src/main.m600.scss @@ -8,30 +8,37 @@ .sv_qstn { display: block; width: 100% !important; + .title-left { float: none; } + .sv_q_radiogroup_inline, .sv_q_checkbox_inline, .sv_q_imagepicker_inline { display: block; } + table.sv_q_matrix, table.sv_q_matrix_dropdown, table.sv_q_matrix_dynamic { display: block; + thead { display: none; } + td.sv-table__cell--choice { text-align: initial; } + tbody, tr, td { display: block; } } + table.sv_q_matrix_dropdown, table.sv_q_matrix_dynamic { td { @@ -40,15 +47,14 @@ } } } + table.sv_q_matrix { td { label.sv_q_m_label { display: inline; } - &:after { - content: attr(data-responsive-title); - } } + .sv_q_m_cell { text-align: initial; } diff --git a/src/modern.m600.scss b/src/modern.m600.scss index 968de9cd04..5817a9b478 100644 --- a/src/modern.m600.scss +++ b/src/modern.m600.scss @@ -8,27 +8,34 @@ .sv-row__question { display: block; width: 100% !important; + .sv-question__header--location--left { float: none; } + .sv-selectbase__item--inline, .sv-imagepicker__item--inline { display: block; } + table.sv-table { display: block; + thead { display: none; } + td.sv-table__cell--choice { text-align: initial; } + tbody, tr, td { display: block; } } + table.sv-matrixdropdown, table.sv-matrixdynamic { td { @@ -37,15 +44,14 @@ } } } + table.sv-matrix-root { td { label.sv-matrix__label { display: inline; } - &:after { - content: attr(data-responsive-title); - } } + .sv-matrix__cell { text-align: initial; }