Merge remote-tracking branch 'soybeanjs/main'
# Conflicts: # README.en_US.md # README.md
This commit is contained in:
commit
bfd834e78f
3
.vscode/extensions.json
vendored
3
.vscode/extensions.json
vendored
@ -14,6 +14,7 @@
|
||||
"sdras.vue-vscode-snippets",
|
||||
"vue.volar",
|
||||
"whtouche.vscode-js-console-utils",
|
||||
"zhuangtongfa.material-theme"
|
||||
"zhuangtongfa.material-theme",
|
||||
"tu6ge.naive-ui-intelligence"
|
||||
]
|
||||
}
|
||||
|
@ -210,6 +210,10 @@ export function useEcharts<T extends ECOption>(optionsFactory: () => T, hooks: C
|
||||
|
||||
// render chart
|
||||
await render();
|
||||
|
||||
if (chart) {
|
||||
await onUpdated?.(chart);
|
||||
}
|
||||
}
|
||||
|
||||
scope.run(() => {
|
||||
|
2
src/typings/common.d.ts
vendored
2
src/typings/common.d.ts
vendored
@ -14,7 +14,7 @@ declare namespace CommonType {
|
||||
* @property value: The option value
|
||||
* @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 */
|
||||
type Record<K extends string | number = string> = { [key in K]: string };
|
||||
|
@ -21,7 +21,7 @@ export function transformRecordToOption<T extends Record<string, string>>(record
|
||||
return Object.entries(record).map(([value, label]) => ({
|
||||
value,
|
||||
label
|
||||
})) as CommonType.Option<keyof T>[];
|
||||
})) as CommonType.Option<keyof T, T[keyof 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
|
||||
*/
|
||||
export function translateOptions(options: CommonType.Option<string>[]) {
|
||||
export function translateOptions(options: CommonType.Option<string, App.I18n.I18nKey>[]) {
|
||||
return options.map(option => ({
|
||||
...option,
|
||||
label: $t(option.label as App.I18n.I18nKey)
|
||||
label: $t(option.label)
|
||||
}));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user