Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into issue/6008-Refactor…
Browse files Browse the repository at this point in the history
…ing-search-component
  • Loading branch information
novikov82 committed Nov 7, 2024
2 parents 639ba39 + 4ebade6 commit 2984a91
Show file tree
Hide file tree
Showing 531 changed files with 1,687 additions and 118 deletions.
2 changes: 2 additions & 0 deletions packages/survey-creator-angular/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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.

### [1.12.9](https://github.com/surveyjs/survey-creator/compare/v1.12.8...v1.12.9) (2024-11-07)

### [1.12.8](https://github.com/surveyjs/survey-creator/compare/v1.12.7...v1.12.8) (2024-10-31)

### [1.12.7](https://github.com/surveyjs/survey-creator/compare/v1.12.6...v1.12.7) (2024-10-23)
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-creator-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "survey-creator-angular",
"version": "1.12.8",
"version": "1.12.9",
"description": "Use SurveyJS Creator to create or edit JSON for SurveyJS Form Library.",
"homepage": "https://surveyjs.io/Overview/Survey-Creator",
"license": "https://surveyjs.io/Licenses#SurveyCreator",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
<span *ngIf="adorner.isDraggable && adorner.canRenderControls"
class="svc-context-button svc-image-item-value-controls__drag-area-indicator"
(pointerdown)="adorner.onPointerDown($event)" [attr.title]="undefined" [attr.aria-label]="undefined">
<svg [iconName]="'icon-drag-area-indicator'" [size]="24" sv-ng-svg-icon></svg>
<svg [iconName]="'icon-drag-24x24'" [size]="24" sv-ng-svg-icon></svg>
</span>
<div *ngIf="adorner.canRenderControls" class="svc-context-container svc-image-item-value-controls">
<ng-container *ngIf="adorner.allowRemove && !adorner.isUploading">
<span class="svc-context-button" (click)="adorner.chooseFile(adorner)" [key2click] [attr.title]="undefined"
[attr.aria-label]="undefined">
<svg role="button" [iconName]="'icon-file'" [size]="24" [title]="adorner.selectFileTitle" sv-ng-svg-icon></svg>
<svg role="button" [iconName]="'icon-choosefile'" [size]="24" [title]="adorner.selectFileTitle" sv-ng-svg-icon></svg>
</span>
<span class="svc-context-button svc-context-button--danger" (click)="adorner.remove(adorner)" [key2click]
[attr.title]="undefined" [attr.aria-label]="undefined">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="svc-item-value__ghost"></div>
<div class="svc-item-value-controls">
<span *ngIf="adorner.isDraggable" class="svc-item-value-controls__button svc-item-value-controls__drag">
<svg class="svc-item-value-controls__drag-icon" [iconName]="'icon-drag-area-indicator'" [size]="24"
<svg class="svc-item-value-controls__drag-icon" [iconName]="'icon-drag-24x24'" [size]="24"
[attr.title]="adorner.dragTooltip" sv-ng-svg-icon></svg>
</span>
<span *ngIf="adorner.allowAdd" class="svc-item-value-controls__button svc-item-value-controls__add" [key2click]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<input type="file" aria-hidden="true" tabindex="-1" [accept]="adorner.acceptedTypes"
class="svc-choose-file-input" />
<span class="svc-context-button" [key2click] [attr.title]="undefined" [attr.aria-label]="undefined">
<svg [iconName]="'icon-file'" [size]="24" (click)="adorner.chooseFile(adorner)" sv-ng-svg-icon></svg>
<svg [iconName]="'icon-choosefile'" [size]="24" (click)="adorner.chooseFile(adorner)" sv-ng-svg-icon></svg>
</span>
</ng-container>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ng-container *ngIf="model.allowEdit && !model.isUploading">
<div class="svc-logo-image-placeholder" (click)="model.chooseFile(model)" [key2click]>
<svg>
<use xlink:href="#icon-logo"></use>
<use xlink:href="#icon-image-48x48"></use>
</svg>
</div>
</ng-container>
Expand All @@ -15,7 +15,7 @@
<div class="svc-context-container svc-logo-image-controls">
<span class="svc-context-button" (click)="model.chooseFile(model)" [key2click] [attr.title]="undefined"
[attr.aria-label]="undefined">
<svg [iconName]="'icon-file'" [size]="24" sv-ng-svg-icon></svg>
<svg [iconName]="'icon-choosefile'" [size]="24" sv-ng-svg-icon></svg>
</span>
<span class="svc-context-button svc-context-button--danger" (click)="model.remove(model)" [key2click]
[attr.title]="undefined" [attr.aria-label]="undefined">
Expand Down
2 changes: 2 additions & 0 deletions packages/survey-creator-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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.

### [1.12.9](https://github.com/surveyjs/survey-creator/compare/v1.12.8...v1.12.9) (2024-11-07)

### [1.12.8](https://github.com/surveyjs/survey-creator/compare/v1.12.7...v1.12.8) (2024-10-31)

### [1.12.7](https://github.com/surveyjs/survey-creator/compare/v1.12.6...v1.12.7) (2024-10-23)
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-creator-core/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.12.8",
"version": "1.12.9",
"name": "survey-creator-core",
"homepage": "https://surveyjs.io/Overview/Survey-Creator",
"license": "SEE LICENSE IN LICENSE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ export class SurveyElementAdornerBase<T extends SurveyElement = SurveyElement> e
this.updateActionsProperties();
}
protected getExpandCollapseAction(): IAction {
const collapseIcon = "icon-collapse-detail-light_16x16";
const expandIcon = "icon-restore_16x16";
const collapseIcon = "icon-collapsepanel-16x16";
const expandIcon = "icon-expandpanel-16x16";
return {
id: "collapse",
css: "sv-action-bar-item--secondary sv-action-bar-item--collapse",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
}

svg {
width: calcSize(4);
height: calcSize(4);
width: calcSize(6);
height: calcSize(6);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,9 @@ export abstract class TabJsonEditorBasePlugin implements ICreatorPlugin {
}
public deactivate(): boolean {
if (this.model) {
const textWorker: SurveyTextWorker = new SurveyTextWorker(this.model.text);
if (!textWorker.isJsonCorrect) {
return false;
}
if (!this.model.readOnly && this.model.isJSONChanged) {
this.creator.selectedElement = undefined;
this.creator.text = this.model.text;
this.creator.changeText(this.model.text, false, true);
this.creator.selectedElement = this.creator.survey;
this.creator.setModified({ type: "JSON_EDITOR" });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ svc-tab-json-editor-textarea {
fill: $foreground-dim-light;
width: calcSize(3);
height: calcSize(3);
opacity: 0.75;
}
}

Expand Down
4 changes: 1 addition & 3 deletions packages/survey-creator-core/src/components/tabs/logic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
.sl-table .sl-table__detail-button.sl-table__detail-button {
width: calcSize(6);
height: calcSize(6);

box-sizing: border-box;
border-radius: var(--ctr-collapse-button-corner-radius, calcSize(12.5));

padding: 0;
padding: calcSize(1.5);
transition: background-color $creator-transition-duration;

&:hover:enabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ export class TabTranslationPlugin implements ICreatorPlugin {
this.mergeLocaleWithDefaultAction.visible = false;
this.importCsvAction.visible = false;
this.exportCsvAction.visible = false;

return true;
}
private createMergeLocaleWithDefaultActionTitleUpdater(): any {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
display: flex;
position: relative;
align-items: center;
z-index: 20;
outline: none;
padding-top: var(--ctr-toolbox-item-padding-top, calcSize(1));
padding-bottom: var(--ctr-toolbox-item-padding-bottom, calcSize(1));
Expand Down Expand Up @@ -221,7 +220,6 @@
box-sizing: border-box;
align-items: center;
border-radius: var(--ctr-toolbox-item-submenu-button-corner-radius, 1024px);
z-index: 40;
background-color: var(--ctr-toolbox-item-submenu-button-background-color, $background-dim);
transition: background-color $creator-transition-duration;
&:hover {
Expand Down
46 changes: 35 additions & 11 deletions packages/survey-creator-core/src/creator-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
EventBase, hasLicense, slk, settings as SurveySettings, Event, Helpers as SurveyHelpers, MatrixDropdownColumn, JsonObject,
dxSurveyService, ISurveyElement, PanelModelBase, surveyLocalization, QuestionMatrixDropdownModelBase, ITheme, Helpers,
chooseFiles, createDropdownActionModel,
CssClassBuilder
CssClassBuilder,
SvgRegistry
} from "survey-core";
import { ICreatorPlugin, ISurveyCreatorOptions, settings, ICollectionItemAllowOperations } from "./creator-settings";
import { editorLocalization } from "./editorLocalization";
Expand Down Expand Up @@ -57,6 +58,7 @@ import designTabSurveyThemeJSON from "./designTabSurveyThemeJSON";
import { ICreatorTheme } from "./creator-theme/creator-themes";
import { SurveyElementAdornerBase } from "./components/action-container-view-model";
import { TabbedMenuContainer, TabbedMenuItem } from "./tabbed-menu";
import { svgBundle } from "./svgbundle";

require("./components/creator.scss");
require("./components/string-editor.scss");
Expand Down Expand Up @@ -1197,16 +1199,12 @@ export class SurveyCreatorModel extends Base
const chaningOptions = { tabName: viewName, allow: allow, model: this.currentPlugin?.model };
this.onActiveTabChanging.fire(this, chaningOptions);
if (!chaningOptions.allow) return;
if (!this.canSwitchViewType()) return false;
if(!!this.currentPlugin?.deactivate && !this.currentPlugin.deactivate()) return;
const plugin = this.activatePlugin(viewName);
this.viewType = viewName;
this.onActiveTabChanged.fire(this, { tabName: viewName, plugin: plugin, model: !!plugin ? plugin.model : undefined });
return true;
}
private canSwitchViewType(): boolean {
const plugin: ICreatorPlugin = this.currentPlugin;
return !plugin || !plugin.deactivate || plugin.deactivate();
}
private activatePlugin(newType: string): ICreatorPlugin {
const plugin: ICreatorPlugin = this.getPlugin(newType);
if (!!plugin) {
Expand Down Expand Up @@ -1248,6 +1246,7 @@ export class SurveyCreatorModel extends Base
this.tabbedMenu.locOwner = this;
this.selectionHistoryControllerValue = new SelectionHistory(this);
this.sidebar = new SidebarModel(this);
this.registerIcons();
this.setOptions(this.options);
this.patchMetadata();
this.initSurveyWithJSON(undefined, false);
Expand Down Expand Up @@ -1565,6 +1564,20 @@ export class SurveyCreatorModel extends Base
public getOptions(): ICreatorOptions {
return this.options || {};
}
protected registerIcons() {
let path;
if (settings.useLegacyIcons) {
SurveySettings.useLegacyIcons = true;
path = svgBundle.V1;
} else {
SurveySettings.useLegacyIcons = false;
path = svgBundle.V2;
}

if (!path) return;

SvgRegistry.registerIconsFromFolder(path);
}
protected setOptions(options: ICreatorOptions): void {
if (!options) options = {};
const obsoleteOptions = {};
Expand Down Expand Up @@ -2137,20 +2150,31 @@ export class SurveyCreatorModel extends Base
}
}

public changeText(value: string, clearState = false): void {
public changeText(value: string, clearState = false, trustJSON?: boolean): void {
this.setTextValue(value);
if (!value) {
this.initSurveyWithJSON(undefined, clearState);
} else {
const textWorker = new SurveyTextWorker(value);
if (textWorker.isJsonCorrect || !!textWorker.survey) {
this.initSurveyWithJSON(textWorker.survey.toJSON(), clearState);
let jsonValue = trustJSON ? this.parseJSON(value) : undefined;
if(!trustJSON) {
const textWorker = new SurveyTextWorker(value);
if(textWorker.isJsonCorrect) {
jsonValue = this.parseJSON(value);
}
else if(!!textWorker.survey) {
jsonValue = textWorker.survey.toJSON();
}
}
if (!!jsonValue) {
this.initSurveyWithJSON(jsonValue, clearState);
} else {
this.viewType = "editor";
}
}
}

private parseJSON(val: string): any {
return new SurveyJSON5().parse(val);
}
/**
* A survey JSON schema as a string.
*
Expand Down
3 changes: 2 additions & 1 deletion packages/survey-creator-core/src/creator-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ export var settings = {
jsonEditor: {
indentation: 2,
exportFileName: "survey.json"
}
},
useLegacyIcons: true
};
export interface ICollectionItemAllowOperations {
allowDelete: boolean;
Expand Down
10 changes: 10 additions & 0 deletions packages/survey-creator-core/src/images-v1/add-16x16.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/images-v1/add-24x24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/images-v1/apply-24x24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/images-v1/arrowup-24x24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/images-v1/camera-24x24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/images-v1/camera-32x32.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/images-v1/cancel-24x24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/images-v1/check-16x16.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/images-v1/check-24x24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/images-v1/clear-16x16.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/images-v1/clear-24x24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/images-v1/close-16x16.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/survey-creator-core/src/images-v1/close-24x24.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2984a91

Please sign in to comment.