builder-settings-types 0.0.395 → 0.0.397
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder-settings-types.cjs.js +59 -59
- package/dist/builder-settings-types.es.js +2295 -2128
- package/dist/settings/multi-language-settings/MultiLanguageSetting.d.ts +5 -29
- package/dist/settings/multi-language-settings/services/ExcelTranslationService.d.ts +25 -0
- package/package.json +1 -1
|
@@ -3,12 +3,16 @@ import { MultiLanguageValue, MultiLanguageSettingsProps } from './types';
|
|
|
3
3
|
export declare class MultiLanguageSetting extends Setting<MultiLanguageValue, MultiLanguageSettingsProps> {
|
|
4
4
|
inputType: Record<keyof MultiLanguageValue, "text">;
|
|
5
5
|
private static instances;
|
|
6
|
+
private static messageListeners;
|
|
6
7
|
private container;
|
|
7
8
|
private defaultLanguage;
|
|
8
9
|
private uploadSettings;
|
|
9
10
|
private languageChangeUnsubscribe?;
|
|
10
11
|
private popup;
|
|
11
12
|
private componentPath;
|
|
13
|
+
private instanceId;
|
|
14
|
+
private messageHandler?;
|
|
15
|
+
private resizeHandler?;
|
|
12
16
|
private normalizeLanguageCode;
|
|
13
17
|
private findLanguageMatch;
|
|
14
18
|
private resolveDefaultLanguage;
|
|
@@ -21,40 +25,12 @@ export declare class MultiLanguageSetting extends Setting<MultiLanguageValue, Mu
|
|
|
21
25
|
private closePopup;
|
|
22
26
|
draw(): HTMLElement;
|
|
23
27
|
setValue(value: MultiLanguageValue): void;
|
|
24
|
-
/**
|
|
25
|
-
* Export all multi-language settings to Excel
|
|
26
|
-
* @param filename Optional filename for the exported file
|
|
27
|
-
*/
|
|
28
28
|
static exportAllToExcel(filename?: string): void;
|
|
29
|
-
/**
|
|
30
|
-
* Import translations from Excel and update all instances
|
|
31
|
-
* @param file The Excel file to import
|
|
32
|
-
* @returns Promise that resolves when import is complete
|
|
33
|
-
*/
|
|
34
29
|
static importFromExcel(file: File): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Get all registered instances
|
|
37
|
-
* @returns Map of instance IDs to MultiLanguageSetting instances
|
|
38
|
-
*/
|
|
39
30
|
static getAllInstances(): Map<string, MultiLanguageSetting>;
|
|
40
|
-
/**
|
|
41
|
-
* Clear all registered instances (useful for testing)
|
|
42
|
-
*/
|
|
43
31
|
static clearRegistry(): void;
|
|
44
|
-
/**
|
|
45
|
-
* Find an instance by the leaf component name (e.g., "Button Text")
|
|
46
|
-
* @param leafId The leaf identifier to match
|
|
47
|
-
* @returns Matching instance or undefined (if none or ambiguous)
|
|
48
|
-
*/
|
|
49
32
|
private static findInstanceByLeaf;
|
|
50
|
-
/**
|
|
51
|
-
* Set the component path for this instance (called by parent SettingGroup)
|
|
52
|
-
* @param path The hierarchical path (e.g., "leaderboard > Header Title")
|
|
53
|
-
*/
|
|
54
33
|
setComponentPath(path: string): void;
|
|
55
|
-
/**
|
|
56
|
-
* Get the component path for this instance
|
|
57
|
-
* @returns The hierarchical path
|
|
58
|
-
*/
|
|
59
34
|
getComponentPath(): string;
|
|
35
|
+
cleanup(): void;
|
|
60
36
|
}
|
|
@@ -6,7 +6,32 @@ export interface TranslationRow {
|
|
|
6
6
|
group?: string;
|
|
7
7
|
settingTitle?: string;
|
|
8
8
|
}
|
|
9
|
+
export interface ComponentInstanceData {
|
|
10
|
+
component: string;
|
|
11
|
+
currentSettings: Record<string, unknown>;
|
|
12
|
+
}
|
|
9
13
|
export declare class ExcelTranslationService {
|
|
10
14
|
static exportToExcel(translations: TranslationRow[], languages: string[], filename?: string): void;
|
|
11
15
|
static importFromExcel(file: File, languages: string[]): Promise<TranslationRow[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Check if an object is a MultiLanguageValue (has language codes as keys)
|
|
18
|
+
*/
|
|
19
|
+
private static isMultiLanguageValue;
|
|
20
|
+
/**
|
|
21
|
+
* Recursively extract MultiLanguageValue objects from settings
|
|
22
|
+
* Returns rows with:
|
|
23
|
+
* - id: full path including component name (e.g., "button1 > textSettings > text")
|
|
24
|
+
* - title: nested path WITHOUT component name (e.g., "textSettings > text") - needed for import matching
|
|
25
|
+
*/
|
|
26
|
+
private static extractMultiLanguageValues;
|
|
27
|
+
/**
|
|
28
|
+
* Export translations from component instances data directly
|
|
29
|
+
* This exports only the translations from the provided components, not from global registry
|
|
30
|
+
*/
|
|
31
|
+
static exportFromComponentInstances(componentInstances: ComponentInstanceData[], filename?: string): void;
|
|
32
|
+
static importToComponentInstances(file: File, componentInstances: ComponentInstanceData[]): Promise<ComponentInstanceData[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Recursively update settings with imported translations
|
|
35
|
+
*/
|
|
36
|
+
private static updateSettingsWithTranslations;
|
|
12
37
|
}
|
package/package.json
CHANGED