Merge remote-tracking branch 'soybeanjs/main'

# Conflicts:
#	README.en_US.md
#	README.md
This commit is contained in:
xlsea 2025-05-10 11:23:59 +08:00
commit bfd834e78f
4 changed files with 10 additions and 5 deletions

View File

@ -14,6 +14,7 @@
"sdras.vue-vscode-snippets", "sdras.vue-vscode-snippets",
"vue.volar", "vue.volar",
"whtouche.vscode-js-console-utils", "whtouche.vscode-js-console-utils",
"zhuangtongfa.material-theme" "zhuangtongfa.material-theme",
"tu6ge.naive-ui-intelligence"
] ]
} }

View File

@ -210,6 +210,10 @@ export function useEcharts<T extends ECOption>(optionsFactory: () => T, hooks: C
// render chart // render chart
await render(); await render();
if (chart) {
await onUpdated?.(chart);
}
} }
scope.run(() => { scope.run(() => {

View File

@ -14,7 +14,7 @@ declare namespace CommonType {
* @property value: The option value * @property value: The option value
* @property label: The option label * @property label: The option label
*/ */
type Option<K = string> = { value: K; label: string }; type Option<K = string, M = string> = { value: K; label: M };
/** The record type */ /** The record type */
type Record<K extends string | number = string> = { [key in K]: string }; type Record<K extends string | number = string> = { [key in K]: string };

View File

@ -21,7 +21,7 @@ export function transformRecordToOption<T extends Record<string, string>>(record
return Object.entries(record).map(([value, label]) => ({ return Object.entries(record).map(([value, label]) => ({
value, value,
label label
})) as CommonType.Option<keyof T>[]; })) as CommonType.Option<keyof T, T[keyof T]>[];
} }
export function transformRecordToNumberOption<T extends Record<string, string>>(record: T) { export function transformRecordToNumberOption<T extends Record<string, string>>(record: T) {
@ -36,10 +36,10 @@ export function transformRecordToNumberOption<T extends Record<string, string>>(
* *
* @param options * @param options
*/ */
export function translateOptions(options: CommonType.Option<string>[]) { export function translateOptions(options: CommonType.Option<string, App.I18n.I18nKey>[]) {
return options.map(option => ({ return options.map(option => ({
...option, ...option,
label: $t(option.label as App.I18n.I18nKey) label: $t(option.label)
})); }));
} }