Skip to content

Commit

Permalink
Merge branch 'master' into features/9195-input-per-page
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Jan 10, 2025
2 parents a88b25a + e917306 commit 67227e0
Show file tree
Hide file tree
Showing 66 changed files with 811 additions and 276 deletions.
26 changes: 13 additions & 13 deletions build-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,19 @@ jobs:
# read about the problem with git output ($env:GIT_REDIRECT_STDERR = '2>&1') :
# https://github.com/microsoft/azure-pipelines-yaml/issues/248
# https://stackoverflow.com/questions/58485585/azure-pipeline-powershell-and-git-on-windows-server-2019-gives-error-in-output
- powershell: |
cd $(Build.SourcesDirectory)/service
$env:GIT_REDIRECT_STDERR = '2>&1'
git config --global user.email "[email protected]"
git config --global user.name "dmitrykurmanov"
git pull origin master
git fetch origin master --tags --force
git checkout master
git add surveyjs.io/App_Data/DocsLibrary
git commit -m "updated survey-library docs [azurepipelines skip]"
git pull origin master
git push origin master
displayName: "git surveyjs/service push updated docs"
# - powershell: |
# cd $(Build.SourcesDirectory)/service
# $env:GIT_REDIRECT_STDERR = '2>&1'
# git config --global user.email "[email protected]"
# git config --global user.name "dmitrykurmanov"
# git pull origin master
# git fetch origin master --tags --force
# git checkout master
# git add surveyjs.io/App_Data/DocsLibrary
# git commit -m "updated survey-library docs [azurepipelines skip]"
# git pull origin master
# git push origin master
# displayName: "git surveyjs/service push updated docs"

- task: CopyFiles@2
inputs:
Expand Down
3 changes: 2 additions & 1 deletion functionalTests/dxService/loadSurvey.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fixture, test } from "testcafe";
import { frameworks, url, initSurvey, getSurveyResult } from "../helper";
import { frameworks, url, initSurvey, getSurveyResult, setRowItemFlowDirection } from "../helper";
const title = "loadSurvey";

const json = {
Expand All @@ -16,6 +16,7 @@ frameworks.forEach(framework => {
test("correct loading", async t => {
let surveyResult;

await setRowItemFlowDirection();
await t
.click("fieldset div:nth-of-type(1) label input")
.click("fieldset div:nth-of-type(4) label input")
Expand Down
7 changes: 7 additions & 0 deletions functionalTests/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ export const urlV2 = "http://127.0.0.1:8080/examples_test/defaultV2/";
export const url_test = "http://127.0.0.1:8080/examples_test/";
export const FLOAT_PRECISION = 0.01;

export const applyTheme = ClientFunction((theme) => {
window["Survey"].StylesManager.applyTheme(theme);
});
export const setRowItemFlowDirection = ClientFunction(() => {
window["Survey"].settings.itemFlowDirection = "row";
});

export const initSurvey = ClientFunction(
(framework, json, events, isDesignMode, props) => {
// eslint-disable-next-line no-console
Expand Down
8 changes: 7 additions & 1 deletion functionalTests/questions/checkboxes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { frameworks, url, setOptions, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, checkSurveyWithEmptyQuestion, getData } from "../helper";
import { frameworks, url, setOptions, initSurvey, getSurveyResult, getQuestionValue, getQuestionJson, checkSurveyWithEmptyQuestion, getData, setRowItemFlowDirection } from "../helper";
import { Selector, ClientFunction, fixture, test } from "testcafe";
// eslint-disable-next-line no-undef
const assert = require("assert");
Expand Down Expand Up @@ -103,6 +103,9 @@ frameworks.forEach((framework) => {
});

test("change choices order", async (t) => {

await setRowItemFlowDirection();

const getChoicesCount = ClientFunction(
() => {
const checkboxControlClassName = ".sd-checkbox__control";
Expand Down Expand Up @@ -217,6 +220,9 @@ frameworks.forEach((framework) => {
});

test("check \"other\" choice doesn't change order", async (t) => {

await setRowItemFlowDirection();

const getOtherChoice = Selector(
() => {
const columnClassName = ".sd-selectbase__column";
Expand Down
38 changes: 38 additions & 0 deletions functionalTests/questions/matrixdynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,4 +558,42 @@ frameworks.forEach((framework) => {

await t.expect(await getSurveyResult()).eql({ matrix: [{ name: "abc123" }] });
});
test("Editing cell loses focus when a dependent column appears, Bug#9233", async (t) => {
await initSurvey(framework, {
textUpdateMode: "onTyping",
elements: [
{
type: "matrixdynamic",
name: "matrix",
rowCount: 1,
columns: [
{
name: "col1",
visibleIf: "{row.col2} notempty",
cellType: "text"
},
{
name: "col2",
cellType: "text"
},
{
name: "col3",
visibleIf: "{row.col2} notempty",
cellType: "text"
}
]
}
]
});

const inputs = Selector("input[type=text");
await t.expect(inputs.count).eql(1)
.click(inputs.nth(0))
.pressKey("a")
.expect(inputs.count).eql(3)
.pressKey("b c")
.click(completeButton);

await t.expect(await getSurveyResult()).eql({ matrix: [{ col2: "abc" }] });
});
});
5 changes: 4 additions & 1 deletion functionalTests/survey/focusFirstQuestionAutomatic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { url, initSurvey, frameworks, getSurveyResult, filterIsInViewport } from "../helper";
import { url, initSurvey, frameworks, getSurveyResult, filterIsInViewport, setRowItemFlowDirection } from "../helper";
import { Selector, ClientFunction } from "testcafe";

const title = "focusFirstQuestionAutomatic";
Expand Down Expand Up @@ -70,6 +70,9 @@ frameworks.forEach(async framework => {
await t.expect(surveyResult).eql({ });
});
test("Focus and scroll into view question", async t => {

await setRowItemFlowDirection();

const focusQuestion = ClientFunction((name, doScroll) => {
const q = window["survey"].getQuestionByName(name);
q.focus(false, doScroll);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ng-container *ngIf="model.needSeparator">
<div [class]="listModel.cssClasses.itemSeparator"></div>
</ng-container>
<div [class]="listModel.cssClasses.itemBody" [style]="itemStyle" [attr.title]="model.locTitle.calculatedText"
<div [class]="listModel.cssClasses.itemBody" [style]="itemStyle" [attr.title]="model.getTooltip()"
(mouseover)="listModel.onItemHover(model)"
(mouseleave)="listModel.onItemLeave(model)">
<ng-template [component]="{ name: itemComponent, data: { model: model, listModel: listModel } }"></ng-template>
Expand Down
10 changes: 5 additions & 5 deletions packages/survey-core/docs/surveyjs_definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@
"type": "boolean"
},
"showNavigationButtons": {
"type": "boolean"
},
"navigationButtonsLocation": {
"type": [
"string",
"numeric",
"boolean"
"string"
],
"enum": [
"none",
"top",
"bottom",
"both"
"topBottom"
]
},
"showPrevButton": {
Expand Down
1 change: 1 addition & 0 deletions packages/survey-core/entries/chunks/localization.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "../../src/localization/arabic";
import "../../src/localization/basque";
import "../../src/localization/bulgarian";
import "../../src/localization/burmese";
import "../../src/localization/catalan";
import "../../src/localization/croatian";
import "../../src/localization/czech";
Expand Down
2 changes: 2 additions & 0 deletions packages/survey-core/entries/chunks/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
//import "../../src/modern.scss";

import { DomWindowHelper } from "../../src/global_variables_utils";
import { settings } from "../../src/settings";

export var Version: string;
export var ReleaseDate: string;
Version = `${process.env.VERSION}`;
settings.version = Version;
ReleaseDate = `${process.env.RELEASE_DATE}`;

export function checkLibraryVersion(ver: string, libraryName: string): void {
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"devDependencies": {
"@types/lodash": "4.14.186",
"@types/node": "7.0.4",
"@types/node": "18.11.12",
"@types/papaparse": "^5.0.4",
"@types/qunit": "2.0.31",
"@types/signature_pad": "^2.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-core/src/base-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export interface ISurvey extends ITextProcessor, ISurveyErrorOwner {

state: string;
isLazyRendering: boolean;
lazyRenderingFirstBatchSize: number;
lazyRenderFirstBatchSize: number;
cancelPreviewByPage(panel: IPanel): any;
locEditText: LocalizableString;
cssNavigationEdit: string;
Expand Down
85 changes: 85 additions & 0 deletions packages/survey-core/src/localization/burmese.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { setupLocale } from "survey-core";

export var burmeseStrings = {
pagePrevText: "နောက်သို့",
pageNextText: "ရှေ့သို့",
completeText: "ပြီးဆုံးပါပြီ",
previewText: "ကြိုတင်ကြည့်ရှုရန်",
editText: "တည်းဖြတ်ရန်",
startSurveyText: "စတင်ရန်",
otherItemText: "အခြား (ဖော်ပြပါ)",
noneItemText: "ဘာမျှမရှိပါ",
refuseItemText: "ဖြေဆိုရန်ငြင်းဆန်သည်",
dontKnowItemText: "မသိပါ",
selectAllItemText: "အားလုံးရွေးချယ်ပါ",
deselectAllItemText: "အားလုံးမရွေးချယ်ပါ",
progressText: "စာမျက်နှာ {0}/{1}",
indexText: "{0}/{1}",
panelDynamicProgressText: "{0}/{1}",
panelDynamicTabTextFormat: "ပန်းနယ် {panelIndex}",
questionsProgressText: "မေးခွန်းများ {0}/{1} ဖြေဆိုပြီးပြီ",
emptySurvey: "ဒီစစ်တမ်းတွင် မြင်သာမေးခွန်းများမရှိပါ။",
completingSurvey: "စစ်တမ်းကိုပြီးမြောက်စွာဖြေဆိုပေးခဲ့သည့်အတွက်ကျေးဇူးတင်ပါသည်။",
completingSurveyBefore: "ဒီစစ်တမ်းကို မျှဝေပြီးသားဖြေဆိုထားပါသည်။",
loadingSurvey: "စစ်တမ်းကိုလုပ်ဆောင်နေသည်...",
placeholder: "ရွေးချယ်ပါ...",
ratingOptionsCaption: "ရွေးချယ်ပါ...",
value: "တန်ဖိုး",
requiredError: "ဖြေဆိုရန်လိုအပ်ပါသည်။",
requiredErrorInPanel: "ဖြေဆိုရန်လိုအပ်ပါသည် - အနည်းဆုံးတစ်ခုကိုဖြေဆိုပါ။",
requiredInAllRowsError: "အတန်းအားလုံးတွင်ဖြေဆိုရန်လိုအပ်ပါသည်။",
eachRowUniqueError: "အတန်းတိုင်းတွင်ထပ်တူဖြေဆိုမှုမရှိရပါ။",
numericError: "တန်ဖိုးသည်ကိန်းဂဏန်းဖြစ်ရပါမည်။",
minError: "တန်ဖိုးသည် {0} ထက်မနည်းရပါ။",
maxError: "တန်ဖိုးသည် {0} ထက်မကျော်ရပါ။",
textNoDigitsAllow: "ကိန်းဂဏန်းများကိုခွင့်မပြုပါ။",
textMinLength: "အနည်းဆုံး {0} လုံးဖြည့်စွက်ပါ။",
textMaxLength: "အများဆုံး {0} လုံးထိသာဖြည့်စွက်ပါ။",
textMinMaxLength: "အနည်းဆုံး {0} နှင့်အများဆုံး {1} လုံးဖြည့်စွက်ပါ။",
minRowCountError: "အနည်းဆုံး {0} အတန်းဖြည့်စွက်ပါ။",
minSelectError: "အနည်းဆုံး {0} ရွေးချယ်ချက်များရွေးပါ။",
maxSelectError: "အများဆုံး {0} ရွေးချယ်ချက်များသာရွေးပါ။",
numericMinMax: "‘{0}’ သည် {1} နှင့် {2} အကြားဖြစ်ရမည်။",
numericMin: "‘{0}’ သည် {1} ထက်မနည်းရပါ။",
numericMax: "‘{0}’ သည် {1} ထက်မကျော်ရပါ။",
invalidEmail: "တရားဝင်သော အီးမေးလ်လိပ်စာကိုရိုက်ထည့်ပါ။",
invalidExpression: "အထောက်အထား {0} သည် 'true' ပြန်သင့်သည်။",
urlRequestError: "တောင်းဆိုမှုတွင် အမှား '{0}' ဖြစ်ခဲ့သည်။ {1}",
urlGetChoicesError: "တောင်းဆိုမှုတွင်ဒေတာမရှိပါ။ သို့မဟုတ် 'path' ပိုင်ဆိုင်မှုမှာမှားနေပါသည်။",
exceedMaxSize: "ဖိုင်အရွယ်အစားသည် {0} ထက်မကျော်ရပါ။",
noUploadFilesHandler: "ဖိုင်များကိုအပ်လုဒ်လုပ်၍မရနိုင်ပါ။",
otherRequiredError: "ဖြေဆိုရန်လိုအပ်ပါသည်။ တန်ဖိုးတစ်ခုရိုက်ထည့်ပါ။",
uploadingFile: "ဖိုင်တင်နေသည်။ မိနစ်ပိုင်းစောင့်ပြီးပြန်ကြိုးစားပါ။",
loadingFile: "တင်နေသည်...",
chooseFile: "ဖိုင်(များ) ရွေးချယ်ပါ...",
noFileChosen: "ဖိုင်မရွေးရသေးပါ",
filePlaceholder: "ဖိုင်တစ်ခုအားဤနေရာတွင်ဆွဲချပြီးအောက်တွင်ရှိသောခလုတ်ကိုနှိပ်ပါ။",
confirmDelete: "ဤမှတ်တမ်းကိုဖျက်မည်မှာ သေချာပါသလား?",
keyDuplicationError: "ဤတန်ဖိုးသည်ထူးခြားဖြစ်ရပါမည်။",
addColumn: "ကော်လံထည့်ရန်",
addRow: "တန်းထည့်ရန်",
removeRow: "ဖယ်ရှားရန်",
emptyRowsText: "တန်းများမရှိပါ။",
addPanel: "အသစ်ထည့်ပါ",
removePanel: "ဖယ်ရှားပါ",
showDetails: "အသေးစိတ်ပြရန်",
hideDetails: "အသေးစိတ်ဖျောက်ရန်",
choices_Item: "အရာ",
matrix_column: "ကော်လံ",
matrix_row: "တန်း",
multipletext_itemname: "စာသား",
savingData: "ရလဒ်များကိုဆာဗာတွင်သိမ်းဆည်းနေသည်...",
savingDataError: "အမှားတစ်ခုဖြစ်ပြီး ရလဒ်များကိုသိမ်းဆည်း၍မရနိုင်ပါ။",
savingDataSuccess: "ရလဒ်များကိုအောင်မြင်စွာသိမ်းဆည်းပြီးပါပြီ။",
savingExceedSize: "သင့်ဖြေဆိုမှုသည် 64KB ကျော်နေပါသည်။",
saveAgainButton: "ထပ်ကြိုးစားရန်",
timerMin: "မိနစ်",
timerSec: "စက္ကန့်",
clearCaption: "ရှင်းလင်းရန်",
signaturePlaceHolder: "ဤနေရာတွင်လက်မှတ်ရေးပါ",
confirmRemoveFile: "ဤဖိုင်အားဖယ်ရှားမည်မှာ သေချာပါသလား: {0}?",
ok: "အိုကေ",
cancel: "ပယ်ဖျက်ပါ"
};

setupLocale({ localeCode: "mm", strings: burmeseStrings, nativeName: "မြန်မာ", englishName: "Burmese" });
6 changes: 1 addition & 5 deletions packages/survey-core/src/localization/translation_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ module.exports = {
},
getLocale: function(name) {
const text = this.readFile(name);
let loc = this.getLocaleByText(text, "surveyLocalization.locales[\"");
if(!!loc) return loc;
return this.getLocaleByText(text, "surveyLocalization.setupLocale(\"");
},
getLocaleByText: function(text, subStr) {
let subStr = "localeCode: \"";
let index = text.indexOf(subStr);
if(index < 0) return undefined;
index += subStr.length;
Expand Down
46 changes: 39 additions & 7 deletions packages/survey-core/src/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,43 @@ export class PageModel extends PanelModel implements IPage {
}
@property({ defaultValue: -1, onSet: (val: number, target: PageModel) => target.onNumChanged(val) }) num: number;
/**
* Set this property to "hide" to make "Prev", "Next" and "Complete" buttons are invisible for this page. Set this property to "show" to make these buttons visible, even if survey showNavigationButtons property is false.
* @see SurveyMode.showNavigationButtons
* Obsolete. Use the [`showNavigationButtons`](https://surveyjs.io/form-library/documentation/api-reference/page-model#showNavigationButtons) property instead.
* @deprecated
*/
public get navigationButtonsVisibility(): string {
return this.getPropertyValue("navigationButtonsVisibility");
const result = this.showNavigationButtons;
if (result === undefined || result === null) {
return "inherit";
}
return result ? "show" : "hide";
}
public set navigationButtonsVisibility(val: string) {
this.setPropertyValue("navigationButtonsVisibility", val.toLowerCase());
if (typeof val == "string") {
val = val.toLowerCase();
}
this.showNavigationButtons = val;
}
/**
* Gets or sets the visibility of the Start, Next, Previous, and Complete navigation buttons on this page. Overrides the [`showNavigationButtons`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#showNavigationButtons) property specified on the survey-level.
*
* Default value: `undefined` (the visibility depends on the survey-level setting)
*/
public get showNavigationButtons(): boolean | string {
return this.getPropertyValue("showNavigationButtons", undefined);
}
public set showNavigationButtons(val: boolean | string) {
this.setShowNavigationButtonsProperty(val);
}
public setShowNavigationButtonsProperty(val: boolean | string) {
if (val === true || val === false) {
this.setPropertyValue("showNavigationButtons", val);
} else if (val === "show") {
this.setPropertyValue("showNavigationButtons", true);
} else if (val === "hide") {
this.setPropertyValue("showNavigationButtons", false);
} else {
this.setPropertyValue("showNavigationButtons", undefined);
}
}
/**
* Returns `true` if this is the current page.
Expand Down Expand Up @@ -382,9 +411,12 @@ Serializer.addClass(
"page",
[
{
name: "navigationButtonsVisibility",
default: "inherit",
choices: ["inherit", "show", "hide"],
name: "showNavigationButtons:boolean",
defaultFunc: () => undefined,
onSetValue: function (obj: any, value: any) {
obj && obj.setShowNavigationButtonsProperty(value);
},
alternativeName: "navigationButtonsVisibility"
},
{ name: "timeLimit:number", alternativeName: "maxTimeToFinish", default: 0, minValue: 0 },
{
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-core/src/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ export class PanelModelBase extends SurveyElement<Question>
private isLazyRenderInRow(rowIndex: number): boolean {
if (!this.survey || !this.survey.isLazyRendering) return false;
return (
rowIndex >= this.survey.lazyRenderingFirstBatchSize ||
rowIndex >= this.survey.lazyRenderFirstBatchSize ||
!this.canRenderFirstRows()
);
}
Expand Down
Loading

0 comments on commit 67227e0

Please sign in to comment.