mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 11:10:47 +08:00
Merge branch 'master' into bugfix/4211_long_ws_msg_truncation
This commit is contained in:
commit
83ec246f63
@ -63,18 +63,18 @@ export namespace binding_test {
|
|||||||
DoubleFour: number[][];
|
DoubleFour: number[][];
|
||||||
Triple: number[][][];
|
Triple: number[][][];
|
||||||
SingleMap: Record<string, number>;
|
SingleMap: Record<string, number>;
|
||||||
SliceMap: Record<string, number[]>;
|
SliceMap: Record<string, Array<number>>;
|
||||||
DoubleSliceMap: Record<string, number[][]>;
|
DoubleSliceMap: Record<string, Array<Array<number>>>;
|
||||||
ArrayMap: Record<string, number[]>;
|
ArrayMap: Record<string, Array<number>>;
|
||||||
DoubleArrayMap1: Record<string, number[][]>;
|
DoubleArrayMap1: Record<string, Array<Array<number>>>;
|
||||||
DoubleArrayMap2: Record<string, number[][]>;
|
DoubleArrayMap2: Record<string, Array<Array<number>>>;
|
||||||
DoubleArrayMap3: Record<string, number[][]>;
|
DoubleArrayMap3: Record<string, Array<Array<number>>>;
|
||||||
OneStructs: DeepMessage[];
|
OneStructs: DeepMessage[];
|
||||||
TwoStructs: DeepMessage[][];
|
TwoStructs: DeepMessage[][];
|
||||||
ThreeStructs: DeepMessage[][][];
|
ThreeStructs: DeepMessage[][][];
|
||||||
MapStructs: Record<string, DeepMessage[]>;
|
MapStructs: Record<string, Array<DeepMessage>>;
|
||||||
MapTwoStructs: Record<string, DeepMessage[][]>;
|
MapTwoStructs: Record<string, Array<Array<DeepMessage>>>;
|
||||||
MapThreeStructs: Record<string, DeepMessage[][][]>;
|
MapThreeStructs: Record<string, Array<Array<Array<DeepMessage>>>>;
|
||||||
|
|
||||||
static createFrom(source: any = {}) {
|
static createFrom(source: any = {}) {
|
||||||
return new DeepElements(source);
|
return new DeepElements(source);
|
||||||
@ -97,9 +97,9 @@ export namespace binding_test {
|
|||||||
this.OneStructs = this.convertValues(source["OneStructs"], DeepMessage);
|
this.OneStructs = this.convertValues(source["OneStructs"], DeepMessage);
|
||||||
this.TwoStructs = this.convertValues(source["TwoStructs"], DeepMessage);
|
this.TwoStructs = this.convertValues(source["TwoStructs"], DeepMessage);
|
||||||
this.ThreeStructs = this.convertValues(source["ThreeStructs"], DeepMessage);
|
this.ThreeStructs = this.convertValues(source["ThreeStructs"], DeepMessage);
|
||||||
this.MapStructs = this.convertValues(source["MapStructs"], DeepMessage[], true);
|
this.MapStructs = this.convertValues(source["MapStructs"], Array<DeepMessage>, true);
|
||||||
this.MapTwoStructs = this.convertValues(source["MapTwoStructs"], DeepMessage[][], true);
|
this.MapTwoStructs = this.convertValues(source["MapTwoStructs"], Array<Array<DeepMessage>>, true);
|
||||||
this.MapThreeStructs = this.convertValues(source["MapThreeStructs"], DeepMessage[][][], true);
|
this.MapThreeStructs = this.convertValues(source["MapThreeStructs"], Array<Array<Array<DeepMessage>>>, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||||
|
@ -40,9 +40,7 @@ const (
|
|||||||
jsVariableNameRegex = `^([A-Z]|[a-z]|\$|_)([A-Z]|[a-z]|[0-9]|\$|_)*$`
|
jsVariableNameRegex = `^([A-Z]|[a-z]|\$|_)([A-Z]|[a-z]|[0-9]|\$|_)*$`
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var jsVariableUnsafeChars = regexp.MustCompile(`[^A-Za-z0-9_]`)
|
||||||
jsVariableUnsafeChars = regexp.MustCompile(`[^A-Za-z0-9_]`)
|
|
||||||
)
|
|
||||||
|
|
||||||
func nameTypeOf(typeOf reflect.Type) string {
|
func nameTypeOf(typeOf reflect.Type) string {
|
||||||
tname := typeOf.Name()
|
tname := typeOf.Name()
|
||||||
@ -277,6 +275,7 @@ func (t *typeScriptClassBuilder) AddMapField(fieldName string, field reflect.Str
|
|||||||
valueType := field.Type.Elem()
|
valueType := field.Type.Elem()
|
||||||
valueTypeName := nameTypeOf(valueType)
|
valueTypeName := nameTypeOf(valueType)
|
||||||
valueTypeSuffix := ""
|
valueTypeSuffix := ""
|
||||||
|
valueTypePrefix := ""
|
||||||
if valueType.Kind() == reflect.Ptr {
|
if valueType.Kind() == reflect.Ptr {
|
||||||
valueType = valueType.Elem()
|
valueType = valueType.Elem()
|
||||||
valueTypeName = nameTypeOf(valueType)
|
valueTypeName = nameTypeOf(valueType)
|
||||||
@ -289,7 +288,8 @@ func (t *typeScriptClassBuilder) AddMapField(fieldName string, field reflect.Str
|
|||||||
}
|
}
|
||||||
valueType = valueType.Elem()
|
valueType = valueType.Elem()
|
||||||
valueTypeName = nameTypeOf(valueType)
|
valueTypeName = nameTypeOf(valueType)
|
||||||
valueTypeSuffix = strings.Repeat("[]", arrayDepth)
|
valueTypeSuffix = strings.Repeat(">", arrayDepth)
|
||||||
|
valueTypePrefix = strings.Repeat("Array<", arrayDepth)
|
||||||
}
|
}
|
||||||
if valueType.Kind() == reflect.Ptr {
|
if valueType.Kind() == reflect.Ptr {
|
||||||
valueType = valueType.Elem()
|
valueType = valueType.Elem()
|
||||||
@ -325,10 +325,10 @@ func (t *typeScriptClassBuilder) AddMapField(fieldName string, field reflect.Str
|
|||||||
fieldName = fmt.Sprintf(`"%s"?`, strippedFieldName)
|
fieldName = fmt.Sprintf(`"%s"?`, strippedFieldName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.fields = append(t.fields, fmt.Sprintf("%s%s: Record<%s, %s>;", t.indent, fieldName, keyTypeStr, valueTypeName+valueTypeSuffix))
|
t.fields = append(t.fields, fmt.Sprintf("%s%s: Record<%s, %s>;", t.indent, fieldName, keyTypeStr, valueTypePrefix+valueTypeName+valueTypeSuffix))
|
||||||
if valueType.Kind() == reflect.Struct {
|
if valueType.Kind() == reflect.Struct {
|
||||||
t.constructorBody = append(t.constructorBody, fmt.Sprintf("%s%sthis%s = this.convertValues(source[\"%s\"], %s, true);",
|
t.constructorBody = append(t.constructorBody, fmt.Sprintf("%s%sthis%s = this.convertValues(source[\"%s\"], %s, true);",
|
||||||
t.indent, t.indent, dotField, strippedFieldName, t.prefix+valueTypeName+valueTypeSuffix+t.suffix))
|
t.indent, t.indent, dotField, strippedFieldName, t.prefix+valueTypePrefix+valueTypeName+valueTypeSuffix+t.suffix))
|
||||||
} else {
|
} else {
|
||||||
t.constructorBody = append(t.constructorBody, fmt.Sprintf("%s%sthis%s = source[\"%s\"];",
|
t.constructorBody = append(t.constructorBody, fmt.Sprintf("%s%sthis%s = source[\"%s\"];",
|
||||||
t.indent, t.indent, dotField, strippedFieldName))
|
t.indent, t.indent, dotField, strippedFieldName))
|
||||||
|
@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Added `-skipembedcreate` flag to build and dev command to improve compile and recompile speed [#4143](https://github.com/wailsapp/wails/pull/4143) by @josStorer
|
- Added `-skipembedcreate` flag to build and dev command to improve compile and recompile speed [#4143](https://github.com/wailsapp/wails/pull/4143) by @josStorer
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- Fixed typescript generation of maps with key of array of structs by @joshuapare in [#4209](https://github.com/wailsapp/wails/pull/4209)
|
||||||
- Fixed -m build flag for dev command not working when recompiling in [#4141](https://github.com/wailsapp/wails/pull/4141) by @josStorer
|
- Fixed -m build flag for dev command not working when recompiling in [#4141](https://github.com/wailsapp/wails/pull/4141) by @josStorer
|
||||||
- Fixed window restoration behavior after minimization by @superDingda in [#4109](https://github.com/wailsapp/wails/issues/4109)
|
- Fixed window restoration behavior after minimization by @superDingda in [#4109](https://github.com/wailsapp/wails/issues/4109)
|
||||||
- Fixed excessive console logging after updating to v2.10.1 by @superDingda in [#4111](https://github.com/wailsapp/wails/issues/4111)
|
- Fixed excessive console logging after updating to v2.10.1 by @superDingda in [#4111](https://github.com/wailsapp/wails/issues/4111)
|
||||||
|
Loading…
Reference in New Issue
Block a user