Skip to content

Commit 58e0be3

Browse files
author
tsv2013
committed
2 parents 810851b + 0b9ae1f commit 58e0be3

35 files changed

+436
-72
lines changed

functionalTests/designer/side-bar.ts

+51
Original file line numberDiff line numberDiff line change
@@ -284,4 +284,55 @@ test("No Focus on open Property grid Mobile", async (t) => {
284284
await t.expect(Selector(".svc-question__adorner button[title='Open settings']").visible).ok();
285285
await t.click(Selector(".svc-question__adorner button[title='Open settings']"));
286286
await t.expect(Selector(".spg-question[data-name=name] input").focused).notOk();
287+
});
288+
289+
test("Element Selector: Column: Scroll", async (t) => {
290+
await t.resizeWindow(1920, 500);
291+
292+
const json = {
293+
"pages": [
294+
{
295+
"name": "page1",
296+
"elements": [
297+
{
298+
"type": "matrixdropdown",
299+
"name": "question1",
300+
"columns": [
301+
{
302+
"name": "Column 1"
303+
},
304+
{
305+
"name": "Column 2"
306+
},
307+
{
308+
"name": "Column 3"
309+
}
310+
],
311+
"choices": [
312+
1,
313+
2,
314+
3,
315+
4,
316+
5
317+
],
318+
"rows": [
319+
"Row 1",
320+
"Row 2"
321+
]
322+
}
323+
]
324+
}
325+
],
326+
"headerView": "advanced"
327+
};
328+
await setJSON(json);
329+
330+
const getQuestionTopPosition = await ClientFunction(() => {
331+
return Math.round(document.querySelector(".svc-question__content")!.getBoundingClientRect().top);
332+
});
333+
334+
await t
335+
.expect(getQuestionTopPosition()).eql(326)
336+
.click(Selector("#svd-grid-object-selector")).click(Selector(".svc-list__item").withText("Column 2"))
337+
.expect(getQuestionTopPosition()).eql(72);
287338
});

legacy-pipelines/build-packages.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -342,16 +342,16 @@ jobs:
342342
# read about the problem with git output ($env:GIT_REDIRECT_STDERR = '2>&1') :
343343
# https://github.com/microsoft/azure-pipelines-yaml/issues/248
344344
# https://stackoverflow.com/questions/58485585/azure-pipeline-powershell-and-git-on-windows-server-2019-gives-error-in-output
345-
- powershell: |
346-
cd $(Build.SourcesDirectory)/service
347-
git pull origin master
348-
git fetch origin master --tags --force
349-
git checkout master
350-
git add surveyjs.io/App_Data/DocsEditor
351-
git commit -m "updated survey-creator docs [azurepipelines skip]"
352-
git pull origin master
353-
git push origin master
354-
displayName: "Git surveyjs/service push updated docs"
345+
# - powershell: |
346+
# cd $(Build.SourcesDirectory)/service
347+
# git pull origin master
348+
# git fetch origin master --tags --force
349+
# git checkout master
350+
# git add surveyjs.io/App_Data/DocsEditor
351+
# git commit -m "updated survey-creator docs [azurepipelines skip]"
352+
# git pull origin master
353+
# git push origin master
354+
# displayName: "Git surveyjs/service push updated docs"
355355

356356
- job: CreatorV2React
357357
dependsOn: CreatorV2Core

packages/survey-creator-angular/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [1.12.27](https://github.com/surveyjs/survey-creator/compare/v1.12.26...v1.12.27) (2025-03-12)
6+
7+
### [1.12.26](https://github.com/surveyjs/survey-creator/compare/v1.12.25...v1.12.26) (2025-03-04)
8+
9+
### [1.12.25](https://github.com/surveyjs/survey-creator/compare/v1.12.24...v1.12.25) (2025-02-25)
10+
511
### [1.12.24](https://github.com/surveyjs/survey-creator/compare/v1.12.23...v1.12.24) (2025-02-20)
612

713
### [1.12.23](https://github.com/surveyjs/survey-creator/compare/v1.12.22...v1.12.23) (2025-02-11)

packages/survey-creator-angular/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "survey-creator-angular",
3-
"version": "1.12.24",
3+
"version": "1.12.27",
44
"description": "Use SurveyJS Creator to create or edit JSON for SurveyJS Form Library.",
55
"homepage": "https://surveyjs.io/Overview/Survey-Creator",
66
"license": "https://surveyjs.io/Licenses#SurveyCreator",

packages/survey-creator-core/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [1.12.27](https://github.com/surveyjs/survey-creator/compare/v1.12.26...v1.12.27) (2025-03-12)
6+
7+
### [1.12.26](https://github.com/surveyjs/survey-creator/compare/v1.12.25...v1.12.26) (2025-03-04)
8+
9+
### [1.12.25](https://github.com/surveyjs/survey-creator/compare/v1.12.24...v1.12.25) (2025-02-25)
10+
511
### [1.12.24](https://github.com/surveyjs/survey-creator/compare/v1.12.23...v1.12.24) (2025-02-20)
612

713
### [1.12.23](https://github.com/surveyjs/survey-creator/compare/v1.12.22...v1.12.23) (2025-02-11)

packages/survey-creator-core/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.12.24",
2+
"version": "1.12.27",
33
"name": "survey-creator-core",
44
"homepage": "https://surveyjs.io/Overview/Survey-Creator",
55
"license": "SEE LICENSE IN LICENSE",
@@ -14,7 +14,7 @@
1414
"test": "jest",
1515
"test:cov": "jest --coverage",
1616
"test:dev": "jest --watch",
17-
"test:postcss": "postcss build/survey-creator-core.css --silent -u postcss-calc -u autoprefixer -u postcss-fail-on-warn -o survey-creator-core.postcss.css && rimraf survey-creator-core.postcss.css",
17+
"test:postcss": "postcss build/survey-creator-core.css --silent -u postcss-calc -u autoprefixer -u postcss-fail-on-warn -u postcss-import -o survey-creator-core.postcss.css && rimraf survey-creator-core.postcss.css",
1818
"doc_gen": "node doc_generator/editor_docgenerator.js src/entries/index.ts",
1919
"watch": "webpack --env buildType=dev --watch",
2020
"watch:dev": "webpack --env buildType=dev --watch",
@@ -58,6 +58,7 @@
5858
"postcss-calc": "9.0.1",
5959
"postcss-cli": "10.1.0",
6060
"postcss-fail-on-warn": "0.2.1",
61+
"postcss-import": "^16.1.0",
6162
"puppeteer": "^1.19.0",
6263
"qunitjs": "2.2.0",
6364
"replace-in-file": "^3.4.3",

packages/survey-creator-core/src/components/question.ts

+18-11
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ export class QuestionAdornerViewModel extends SurveyElementAdornerBase {
557557
element.closest(".svc-question__drag-area") && !element.closest(".svc-question__top-actions") ||
558558
element.closest(".sd-element__header") && !element.closest(".svc-string-editor");
559559
}
560+
560561
protected updateQuestionTypeOrSubtypeListModel(listModel: ListModel, subtypeOnly: boolean) {
561562
const availableItems = this.getConvertToTypes();
562563
const defaultJsons = this.buildDefaultJsonMap(availableItems);
@@ -565,25 +566,32 @@ export class QuestionAdornerViewModel extends SurveyElementAdornerBase {
565566
let selectedAction: IAction;
566567
let selectedSubaction: IAction = undefined;
567568
let selectedSubactions = undefined;
569+
570+
const toolboxItemToAction = (item, needSeparator = false) => {
571+
return this.creator.createIActionBarItemByClass(item, needSeparator, (questionType, json) => { this.convertQuestion(questionType, json, defaultJsons); });
572+
};
573+
568574
availableItems.forEach((item: QuestionToolboxItem) => {
569575
const needSeparator = lastItem && item.category != lastItem.category;
570-
const action = this.creator.createIActionBarItemByClass(item, needSeparator, (questionType, json) => { this.convertQuestion(questionType, json, defaultJsons); });
576+
const action = toolboxItemToAction(item, needSeparator);
571577
if (this.toolboxItemIsCorresponded(item, !!selectedAction)) {
572578
selectedAction = action;
573-
selectedSubactions = item.items;
579+
if (item.items) {
580+
selectedSubactions = item.items.map(subitem => toolboxItemToAction(subitem));
581+
}
574582
}
575583
if (item.items?.length > 0 && this.creator.toolbox.showSubitems) {
576584
const subactions = [];
577585
let selectedSubactionLocal: IAction = undefined;
578586
let allChildsAreCompatibleToParent = false;
579587
item.items.forEach(subitem => {
580-
const subaction = this.creator.createIActionBarItemByClass(subitem, false, (questionType, json) => { this.convertQuestion(questionType, json, defaultJsons); });
588+
const subaction = toolboxItemToAction(subitem,);
581589
if (this.toolboxItemIsCorresponded(subitem, !!selectedAction)) selectedSubactionLocal = subitem;
582590
if (this.jsonsAreCompatible(item.json, subitem.json)) allChildsAreCompatibleToParent = true;
583591
subactions.push(subaction);
584592
});
585593
if (!allChildsAreCompatibleToParent && subactions.length > 0) {
586-
const defaultSubaction = this.creator.createIActionBarItemByClass(item, false, (questionType, json) => { this.convertQuestion(questionType, json, defaultJsons); });
594+
const defaultSubaction = toolboxItemToAction(item);
587595
defaultSubaction.id = action.id + "-default";
588596
defaultSubaction.iconName = undefined;
589597
defaultSubaction.markerIconName = undefined;
@@ -626,12 +634,12 @@ export class QuestionAdornerViewModel extends SurveyElementAdornerBase {
626634
cssClasses: listComponentCss,
627635
});
628636
this.updateQuestionTypeOrSubtypeListModel(listModel, true);
629-
if (listModel.actions.length == 0) return null;
630-
637+
const propName = QuestionToolbox.getSubTypePropertyName(this.surveyElement.getType());
638+
if (!listModel.selectedItem && !propName) return null;
631639
const actionData: IAction = {
632640
id: "convertInputType",
633641
visibleIndex: 1,
634-
title: listModel.selectedItem?.title || "SUBTYPE",
642+
title: listModel.selectedItem?.title || editorLocalization.getPropertyValueInEditor(propName, this.surveyElement.getPropertyValue(propName)) || "SUBTYPE",
635643
disableShrink: true,
636644
iconName: "icon-chevron_16x16"
637645
};
@@ -642,14 +650,13 @@ export class QuestionAdornerViewModel extends SurveyElementAdornerBase {
642650
this.updateQuestionTypeOrSubtypeListModel(listModel, true);
643651
}
644652
});
645-
646653
this.surveyElement.registerFunctionOnPropertiesValueChanged(
647-
["inputType", "rateType"],
648-
() => {
654+
[propName],
655+
(newValue) => {
649656
const popup = newAction.popupModel;
650657
const list = popup.contentComponentData.model;
651658
this.updateQuestionTypeOrSubtypeListModel(list, true);
652-
newAction.title = list.selectedItem.title;
659+
newAction.title = list.selectedItem?.title || editorLocalization.getPropertyValueInEditor(propName, newValue) || "SUBTYPE";
653660
},
654661
"inputTypeAdorner"
655662
);

packages/survey-creator-core/src/components/string-editor.ts

+20-7
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,19 @@ export class StringEditorViewModelBase extends Base {
256256
super();
257257
this.locString = locString;
258258
this.checkMarkdownToTextConversion(this.locString.owner, this.locString.name);
259+
this.addCreatorEvents();
259260
}
260-
261+
private onLocaleChanged = () => {
262+
this.resetPropertyValue("placeholderValue");
263+
};
261264
public afterRender() {
262265
if (this.connector.focusOnEditor) {
263266
if (this.activate()) this.connector.focusOnEditor = false;
264267
}
265268
}
266269

267270
public detachFromUI() {
271+
this.removeCreatorEvents();
268272
this.connector?.onDoActivate.remove(this.activate);
269273
this.getEditorElement = undefined;
270274
this.blurEditor = undefined;
@@ -284,12 +288,20 @@ export class StringEditorViewModelBase extends Base {
284288
}
285289
return false;
286290
}
291+
private addCreatorEvents() {
292+
this.creator?.onLocaleChanded.add(this.onLocaleChanged);
293+
}
294+
private removeCreatorEvents() {
295+
this.creator?.onLocaleChanded.remove(this.onLocaleChanged);
296+
}
287297

288298
public setLocString(locString: LocalizableString) {
299+
this.removeCreatorEvents();
289300
this.connector?.onDoActivate.remove(this.activate);
290301
this.locString = locString;
291302
this.connector = StringEditorConnector.get(locString);
292303
this.connector.onDoActivate.add(this.activate);
304+
this.addCreatorEvents();
293305
}
294306
public checkConstraints(event: any) {
295307
if (!this.compostionInProgress && this.maxLength > 0 && event.keyCode >= 32) {
@@ -422,9 +434,8 @@ export class StringEditorViewModelBase extends Base {
422434
private getClearedText(target: HTMLElement): string {
423435
const html = target.innerHTML;
424436
const text = target.innerText;
425-
if(!this.creator) return this.locString.hasHtml ? html : text;
426437
let mdText = null;
427-
if (!this.editAsText) {
438+
if (!this.editAsText && this.creator) {
428439
const options = {
429440
element: <Base><any>this.locString.owner,
430441
text: <any>null,
@@ -438,9 +449,11 @@ export class StringEditorViewModelBase extends Base {
438449
if (mdText) {
439450
clearedText = mdText;
440451
} else {
441-
let txt = this.locString.hasHtml && !this.editAsText ? html : text;
442-
if (!this.locString.allowLineBreaks) txt = clearNewLines(txt);
443-
clearedText = txt;
452+
clearedText = this.locString.hasHtml && !this.editAsText ? html : text;
453+
const txt = clearNewLines(clearedText);
454+
if (!this.locString.allowLineBreaks || !txt) {
455+
clearedText = txt;
456+
}
444457
}
445458
const owner = this.locString.owner as any;
446459

@@ -451,7 +464,7 @@ export class StringEditorViewModelBase extends Base {
451464
newValue: clearedText,
452465
doValidation: false
453466
};
454-
this.creator.onValueChangingCallback(changingOptions);
467+
if (this.creator) this.creator.onValueChangingCallback(changingOptions);
455468
return changingOptions.newValue;
456469
}
457470
private getErrorTextOnChanged(clearedText: string): string {

packages/survey-creator-core/src/components/tabs/logic-items.ts

+12-7
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,22 @@ export class SurveyLogicAction {
4444
public apply(expression: string, isRenaming: boolean = false): void {
4545
if (!!this.element && !!this.logicType) {
4646
this.element[this.logicType.propertyName] = expression;
47-
if (
48-
!expression &&
49-
Serializer.isDescendantOf(this.element.getType(), "surveytrigger")
50-
) {
51-
var index = this.survey.triggers.indexOf(<SurveyTrigger>this.element);
52-
if (index > -1) {
53-
this.survey.triggers.splice(index, 1);
47+
if (!expression) {
48+
if(Serializer.isDescendantOf(this.element.getType(), "surveytrigger")) {
49+
this.removeElement(this.survey.triggers, this.element);
50+
}
51+
if(Serializer.isDescendantOf(this.element.getType(), "htmlconditionitem")) {
52+
this.removeElement(this.survey.completedHtmlOnCondition, this.element);
5453
}
5554
}
5655
}
5756
}
57+
private removeElement(items: Array<any>, element: any): void {
58+
var index = items.indexOf(this.element);
59+
if (index > -1) {
60+
items.splice(index, 1);
61+
}
62+
}
5863
public renameQuestion(oldName: string, newName: string): void {
5964
if (!this.element) return;
6065
var names = this.questionNames;

packages/survey-creator-core/src/components/toolbox/toolbox-tool.scss

-5
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,6 @@
392392
padding-inline-end: var(--ctr-toolbox-item-padding-right-no-text, calcSize(1));
393393
box-sizing: border-box;
394394
align-self: flex-start;
395-
&:after {
396-
content:"\a0";
397-
@include ctrSmallBoldFont;
398-
width: 0;
399-
}
400395
}
401396
.svc-toolbox__tool--dots {
402397
padding-inline-end: 0;

packages/survey-creator-core/src/creator-base.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -2830,7 +2830,7 @@ export class SurveyCreatorModel extends Base
28302830
clearTimeout(this.currentFocusTimeout);
28312831
this.currentFocusTimeout = setTimeout(() => {
28322832
this.currentFocusInterval = setInterval(() => {
2833-
const el = document.getElementById(selEl.id);
2833+
let el = this.getHtmlElementForScroll(selEl);
28342834
if (!!selEl && (focus || startEdit && (!selEl.hasTitle || selEl.isPanel))) {
28352835
if (!el || this.rootElement.getAnimations({ subtree: true }).filter((animation => animation.effect.getComputedTiming().activeDuration !== Infinity && (animation.pending || animation.playState !== "finished")))[0]) return;
28362836
clearInterval(this.currentFocusInterval);
@@ -2845,7 +2845,7 @@ export class SurveyCreatorModel extends Base
28452845
SurveyHelper.scrollIntoViewIfNeeded(el.parentElement ?? el, () => { return scrollIntoViewOptions; }, true);
28462846
}
28472847
}
2848-
if (!propertyName && el.parentElement) {
2848+
if (!propertyName && el.parentElement && selEl.getType() !== "matrixdropdowncolumn") {
28492849
let elToFocus: HTMLElement = (typeof (focus) === "string") ? el.parentElement.querySelector(focus) : el.parentElement;
28502850
elToFocus && elToFocus.focus({ preventScroll: true });
28512851
}
@@ -2860,9 +2860,19 @@ export class SurveyCreatorModel extends Base
28602860
}, 100);
28612861
}
28622862

2863+
private getHtmlElementForScroll(element: any): HTMLElement {
2864+
const id = element.getType() === "matrixdropdowncolumn" ? element.colOwner.id : element.id;
2865+
return document.getElementById(id);
2866+
}
2867+
28632868
private getSelectedSurveyElement(): IElement {
28642869
var sel: any = this.selectedElement;
28652870
if (!sel || sel.getType() == "survey") return null;
2871+
2872+
if (this.selectedElement.getType() === "matrixdropdowncolumn") {
2873+
return (<any>this.selectedElement);
2874+
}
2875+
28662876
return sel.isInteractiveDesignElement && sel.id ? sel : null;
28672877
}
28682878
private onSelectingElement(val: Base): Base {

0 commit comments

Comments
 (0)