Merge branch 'dev' into dev.loading

This commit is contained in:
Eric NGUYEN 2022-11-04 12:05:37 +01:00
commit 0ac42b3500
41 changed files with 1609 additions and 1241 deletions

View file

@ -5,6 +5,7 @@
type IHistoryState = SVGLD.IHistoryState;
type IEditorState = SVGLD.IEditorState;
type IConfiguration = SVGLD.IConfiguration;
type ILanguage = SVGLD.ILanguage;
export class SVGLayoutDesigner extends Components.ComponentBase {
@ -210,6 +211,43 @@
const component = this.GetAppComponent();
component.dispatchEvent(new CustomEvent(eventType, { detail: configuration }));
}
/**
* Add a language to the app
* @param option Displayed string of the language
* @param language Language containing an id and a dictionary
* @param callback Callback
*/
public AddLanguage(option: string, language: ILanguage, callback?: () => void) {
const eventType = 'addLanguage';
this.app.AddEventListener(eventType, callback);
const component = this.GetAppComponent();
component.dispatchEvent(new CustomEvent(eventType, { detail: { language, option } }));
}
/**
* Set the language of the app (defaults: ['fr', 'en'])
* @param languageId Language identifier for the language to select
* @param callback Callback
*/
public SetLanguage(languageId: string, callback?: (success: boolean) => void) {
const eventType = 'setLanguage';
this.app.AddEventListener(eventType, callback);
const component = this.GetAppComponent();
component.dispatchEvent(new CustomEvent(eventType, { detail: languageId }));
}
/**
* Set the language of the app (defaults: ['fr', 'en'])
* @param languageId Language identifier for the language to select
* @param callback Callback
*/
public GetLanguages(callback: (languages: Record<string, Record<string, string>>) => void) {
const eventType = 'getLanguages';
this.app.AddEventListener(eventType, callback);
const component = this.GetAppComponent();
component.dispatchEvent(new CustomEvent(eventType));
}
}

1058
public/svgld.d.ts vendored

File diff suppressed because it is too large Load diff