Skip to content

Commit

Permalink
Remove v1, knockout (#6360)
Browse files Browse the repository at this point in the history
* Remove styles manager references + fix paths to library packages

* Remove creator v1 and creator knockout packages

* Fix package.json version

* Format ymls

* Delete V1 creator from pipelines

* Delete creator v2 knockout from pipelines

* Rename library core build artifact in pipelines

* Fix pipelines

* Fix vrt pipelines

* Fix react build: make react build be independent of node modules from library project

* Fix versions for package.json

* Fix presets build
  • Loading branch information
dk981234 authored Jan 3, 2025
1 parent 246e2d4 commit 491aeae
Show file tree
Hide file tree
Showing 694 changed files with 4,607 additions and 96,901 deletions.
2,207 changes: 900 additions & 1,307 deletions build-packages.yml

Large diffs are not rendered by default.

1,941 changes: 967 additions & 974 deletions devops-pull-requests-v2.yml

Large diffs are not rendered by default.

1,596 changes: 622 additions & 974 deletions devops-pull-requests.yml

Large diffs are not rendered by default.

601 changes: 284 additions & 317 deletions devops-visual-regression-tests-v2.yml

Large diffs are not rendered by default.

1,733 changes: 738 additions & 995 deletions devops-visual-regression-tests.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/creator-presets-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"lint": "eslint ./src"
},
"dependencies": {
"survey-core": "../../../survey-library/build/survey-core",
"survey-core": "../../../survey-library/packages/survey-core/build",
"survey-creator-core": "../survey-creator-core/build"
},
"devDependencies": {
Expand Down Expand Up @@ -80,4 +80,4 @@
"tag": true
}
}
}
}
6 changes: 3 additions & 3 deletions packages/creator-presets-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
"dependencies": {
"react": "^17.0.1",
"react-dom": "^17.0.1",
"survey-core": "../../../survey-library/build/survey-core",
"survey-core": "../../../survey-library/packages/survey-core/build",
"survey-react-ui": "../../../survey-library/packages/survey-react-ui/build",
"survey-creator-core": "../survey-creator-core/build",
"survey-react-ui": "../../../survey-library/build/survey-react-ui",
"creator-presets-core": "../creator-presets-core/build",
"survey-creator-react": "../survey-creator-react/build"
},
Expand All @@ -87,4 +87,4 @@
"tag": true
}
}
}
}
6 changes: 6 additions & 0 deletions packages/creator-presets-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
],
"creator-presets-react": [
"./src/entries/index.ts"
],
"react": [
"./node_modules/@types/react"
],
"react-dom": [
"./node_modules/@types/react-dom"
]
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, ViewEncapsulation } from "@angular/core";
import { TestDefaultComponent } from "./default.component";
import { StylesManager } from "survey-core";
import * as SurveyCore from "survey-core";
import * as widgets from "surveyjs-widgets";
import "icheck";
Expand All @@ -12,7 +11,6 @@ import "icheck";
export class TestCustomWidgetComponent extends TestDefaultComponent {
constructor() {
super();
StylesManager.applyTheme("default");
widgets.sortablejs(SurveyCore);
}
}
8 changes: 4 additions & 4 deletions 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.17",
"version": "2.0.0",
"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 Expand Up @@ -63,8 +63,8 @@
"testcafe": "3.3.0",
"get-func-name": "2.0.0",
"@types/lodash": "4.14.186",
"survey-angular-ui": "../../../survey-library/build/survey-angular-ui",
"survey-core": "../../../survey-library/build/survey-core",
"survey-angular-ui": "../../../survey-library/packages/survey-angular-ui/build",
"survey-core": "../../../survey-library/packages/survey-core/build",
"survey-creator-core": "../survey-creator-core/build",
"standard-version": "^8.0.2",
"puppeteer": "22.13.1"
Expand All @@ -82,4 +82,4 @@
"test:single": "ng test --watch=false --browsers=ChromeHeadless survey-creator-angular",
"release": "standard-version --message \"Release: %s [azurepipelines skip]\" "
}
}
}
6 changes: 3 additions & 3 deletions packages/survey-creator-core/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.12.17",
"version": "2.0.0",
"name": "survey-creator-core",
"homepage": "https://surveyjs.io/Overview/Survey-Creator",
"license": "SEE LICENSE IN LICENSE",
Expand All @@ -25,7 +25,7 @@
},
"dependencies": {
"papaparse": "^5.2.0",
"survey-core": "../../../survey-library/build/survey-core"
"survey-core": "../../../survey-library/packages/survey-core/build"
},
"devDependencies": {
"@types/ace": "0.0.32",
Expand Down Expand Up @@ -93,4 +93,4 @@
"tag": true
}
}
}
}
73 changes: 1 addition & 72 deletions packages/survey-creator-core/src/components/tabs/test-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { notShortCircuitAnd } from "../../utils/utils";
import { Action, ComputedUpdater, createDropdownActionModel, surveyCss, defaultV2ThemeName, IAction, ListModel, PopupModel, surveyLocalization, SurveyModel, StylesManager } from "survey-core";
import { Action, ComputedUpdater, createDropdownActionModel, surveyCss, defaultV2ThemeName, IAction, ListModel, PopupModel, surveyLocalization } from "survey-core";
import { SurveyCreatorModel } from "../../creator-base";
import { ICreatorPlugin } from "../../creator-settings";
import { editorLocalization, getLocString } from "../../editorLocalization";
Expand All @@ -9,8 +9,6 @@ import { listComponentCss } from "../list-theme";

export class TabTestPlugin implements ICreatorPlugin {
private languageSelectorAction: Action;
private changeThemePopupModel: PopupModel;
private changeThemeModel: ListModel;
protected changeThemeAction: Action;
private deviceSelectorAction: Action;
private orientationSelectorAction: Action;
Expand Down Expand Up @@ -136,19 +134,6 @@ export class TabTestPlugin implements ICreatorPlugin {
this.invisibleToggleAction && (this.invisibleToggleAction.visible = false);
return true;
}
private getAvailableThemes(themeMapper: Array<any>): Array<Action> {
const availableThemesToItems = [];
for (var i = 0; i < themeMapper.length; i++) {
const item = themeMapper[i];
const action = new Action({ id: item.name + "_themeSwitcher", locTitleName: this.getThemeLocName(item.name) });
(<any>action).value = item.name;
availableThemesToItems.push(action);
}
return availableThemesToItems;
}
private getThemeLocName(name: string): string {
return "ed." + name + "Theme";
}
public createActions(): Array<Action> {
const items: Array<Action> = [];

Expand Down Expand Up @@ -220,62 +205,6 @@ export class TabTestPlugin implements ICreatorPlugin {
items.push(this.invisibleToggleAction);
}

let themeMapper = StylesManager.getIncludedThemeCss() as Array<any>;
const sequence = ["defaultV2", "modern", "default"];
themeMapper = themeMapper.sort((theme1, theme2) => {
return sequence.indexOf(theme1.name) > sequence.indexOf(theme2.name) ? 1 : -1;
});
let availableThemesToItems = this.getAvailableThemes(themeMapper);

if (this.creator.allowChangeThemeInPreview && availableThemesToItems.length > 1 && !this.creator.showThemeTab) {
this.changeThemeModel = new ListModel(
availableThemesToItems,
(item: any) => {
if (!!this.model) {
this.model.setTheme(item.value, themeMapper);
}
this.changeThemeAction.locTitleName = this.getThemeLocName(item.value);
this.changeThemeAction.locStrsChanged();
this.changeThemePopupModel.toggleVisibility();
},
true
);
this.changeThemeModel.locOwner = this.creator;
this.changeThemeModel.cssClasses = listComponentCss;

this.changeThemePopupModel = new PopupModel(
"sv-list",
{ model: this.changeThemeModel },
{
verticalPosition: "bottom",
horizontalPosition: "center",
cssClass: "svc-creator-popup",
}
);
const getStartThemeName = (): string => {
const availableThemes = themeMapper.filter(item => item.theme.root === this.simulatorTheme.root);
return availableThemes.length > 0 ? availableThemes[0].name : "defaultV2";
};
this.changeThemeAction = new Action({
id: "themeSwitcher",
iconName: "icon-theme",
iconSize: "auto",
component: "sv-action-bar-item-dropdown",
mode: "large",
locTitleName: this.getThemeLocName(getStartThemeName()),
needSeparator: true,
visible: <any>new ComputedUpdater<boolean>(() => {
return notShortCircuitAnd(this.creator.showSimulatorInTestSurveyTab, this.creator.activeTab === "test");
}),
action: () => {
this.changeThemePopupModel.toggleVisibility();
},
popupModel: this.changeThemePopupModel
});

items.push(this.changeThemeAction);
}

this.languageSelectorAction = createDropdownActionModel({
id: "languageSelector",
iconName: "icon-language",
Expand Down
7 changes: 2 additions & 5 deletions packages/survey-creator-core/src/creator-settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
StylesManager, Base, IAction, ItemValue,
import { Base, IAction, ItemValue,
JsonObjectProperty, MatrixDropdownColumn, Question,
SurveyModel, ILocalizableString, PopupBaseViewModel, SurveyElement
} from "survey-core";
Expand Down Expand Up @@ -487,6 +486,4 @@ export class EmptySurveyCreatorOptions implements ISurveyCreatorOptions {
doMachineTranslation(fromLocale: string, toLocale: string, strings: Array<string>, callback: (translated: Array<string>) => void): void { }
chooseFiles(input: HTMLInputElement, callback: (files: File[]) => void, context?: { element: Base, item?: any, elementType?: string, propertyName?: string }): void { }
translationLocalesOrder: Array<string> = [];
}

StylesManager.applyTheme("defaultV2");
}
3 changes: 0 additions & 3 deletions packages/survey-creator-core/src/stylesmanager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as Survey from "survey-core";

export class StylesManager {
public static ThemeVariablesMap = {
"$primary-color": "--primary-color",
Expand Down Expand Up @@ -129,7 +127,6 @@ export class StylesManager {

public static applyTheme(themeName: string = "default") {
StylesManager.currentTheme = themeName;
Survey.StylesManager.applyTheme(themeName);

if (!document || !document.body || !document.body.style) {
return;
Expand Down
71 changes: 0 additions & 71 deletions packages/survey-creator-core/tests/tabs/test.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,78 +693,7 @@ test("Prev/Next actions enabled/disabled", (): any => {
expect(model.prevPageAction.enabled).toBeTruthy();
expect(model.nextPageAction.enabled).toBeFalsy();
});
test("Change theme action hidden", (): any => {
TabTestPlugin.prototype["filterThemeMapper"] = (themeMapper: Array<any>): Array<any> => { return themeMapper; };
var oldF = StylesManager.getIncludedThemeCss;
StylesManager.getIncludedThemeCss = (): Array<any> => { return StylesManager.getAvailableThemes(); };
let creator: CreatorTester = new CreatorTester();
let testPlugin: TabTestPlugin = <TabTestPlugin>creator.getPlugin("test");
testPlugin.activate();
expect(testPlugin["changeThemeAction"]).toBeDefined();
creator = new CreatorTester({ allowChangeThemeInPreview: false });
testPlugin = <TabTestPlugin>creator.getPlugin("test");
testPlugin.activate();
expect(testPlugin["changeThemeAction"]).toBeUndefined();

StylesManager.getIncludedThemeCss = oldF;
});

test("Themes switcher list actions", (): any => {
TabTestPlugin.prototype["filterThemeMapper"] = (themeMapper: Array<any>): Array<any> => { return themeMapper; };
var oldF = StylesManager.getIncludedThemeCss;
StylesManager.getIncludedThemeCss = (): Array<any> => { return StylesManager.getAvailableThemes(); };

const creator = new CreatorTester();
const themeAction = creator.toolbar.getActionById("themeSwitcher");
expect(themeAction).toBeTruthy();
expect(themeAction.title).toEqual("Default");
const listModel = <ListModel>themeAction.popupModel.contentComponentData.model;
const actions = listModel.actions;
expect(actions).toHaveLength(3);
expect(actions[0].title).toEqual("Default");
expect(actions[1].title).toEqual("Modern");
expect(actions[2].title).toEqual("Default (legacy)");

StylesManager.getIncludedThemeCss = oldF;
});

test("Change test themes list actions titles on changing locale", (): any => {
TabTestPlugin.prototype["filterThemeMapper"] = (themeMapper: Array<any>): Array<any> => { return themeMapper; };
var oldF = StylesManager.getIncludedThemeCss;
StylesManager.getIncludedThemeCss = (): Array<any> => { return StylesManager.getAvailableThemes(); };
const deutschStrings: any = {
ed: {
defaultV2Theme: "Default de",
modernTheme: "Modern de"
}
};
editorLocalization.locales["de"] = deutschStrings;
const creator = new CreatorTester();
const themeAction = creator.toolbar.getActionById("themeSwitcher");
expect(themeAction).toBeTruthy();
expect(themeAction.title).toEqual("Default");
const listModel = <ListModel>themeAction.popupModel.contentComponentData.model;
const actions = listModel.actions;
expect(actions).toHaveLength(3);
const modernAction = actions.filter(act => act.id === "modern_themeSwitcher")[0];
expect(modernAction.title).toEqual("Modern");
creator.locale = "de";
expect(themeAction.title).toEqual("Default de");
expect(modernAction.getLocale()).toEqual("de");
expect(modernAction.title).toEqual("Modern de");
creator.locale = "";
expect(themeAction.title).toEqual("Default");
expect(modernAction.title).toEqual("Modern");

listModel.onItemClick(modernAction);
expect(themeAction.title).toEqual("Modern");
creator.locale = "de";
expect(themeAction.title).toEqual("Modern de");
creator.locale = "";
expect(themeAction.title).toEqual("Modern");

StylesManager.getIncludedThemeCss = oldF;
});
test("Default mobile orientation", (): any => {
const creator: CreatorTester = new CreatorTester();
const testPlugin: TabTestPlugin = <TabTestPlugin>creator.getPlugin("test");
Expand Down
10 changes: 5 additions & 5 deletions packages/survey-creator-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "survey-creator-js",
"version": "1.12.17",
"version": "2.0.0",
"description": "",
"homepage": "https://surveyjs.io/Overview/Survey-Creator",
"author": "Devsoft Baltic OU",
Expand Down Expand Up @@ -85,8 +85,8 @@
"puppeteer": "22.13.1"
},
"dependencies": {
"survey-core": "../../../survey-library/build/survey-core",
"survey-creator-core": "../survey-creator-core/build",
"survey-js-ui": "../../../survey-library/build/survey-js-ui"
"survey-core": "../../../survey-library/packages/survey-core/build",
"survey-js-ui": "../../../survey-library/packages/survey-js-ui/build",
"survey-creator-core": "../survey-creator-core/build"
}
}
}
Loading

0 comments on commit 491aeae

Please sign in to comment.