Have got text transformations working
This commit is contained in:
parent
9f2fa96b92
commit
41daf7cfc9
14 changed files with 178 additions and 17 deletions
3
frontend/wailsjs/go/main/App.d.ts
vendored
3
frontend/wailsjs/go/main/App.d.ts
vendored
|
|
@ -1,4 +1,5 @@
|
|||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
import {main} from '../models';
|
||||
|
||||
export function Greet(arg1:string):Promise<string>;
|
||||
export function ProcessText(arg1:main.ProcessTextRequest):Promise<void>;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export function Greet(arg1) {
|
||||
return window['go']['main']['App']['Greet'](arg1);
|
||||
export function ProcessText(arg1) {
|
||||
return window['go']['main']['App']['ProcessText'](arg1);
|
||||
}
|
||||
|
|
|
|||
53
frontend/wailsjs/go/models.ts
Executable file
53
frontend/wailsjs/go/models.ts
Executable file
|
|
@ -0,0 +1,53 @@
|
|||
export namespace main {
|
||||
|
||||
export class TextSpan {
|
||||
text: string;
|
||||
pos: number;
|
||||
len: number;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new TextSpan(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.text = source["text"];
|
||||
this.pos = source["pos"];
|
||||
this.len = source["len"];
|
||||
}
|
||||
}
|
||||
export class ProcessTextRequest {
|
||||
action: string;
|
||||
input: TextSpan[];
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new ProcessTextRequest(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.action = source["action"];
|
||||
this.input = this.convertValues(source["input"], TextSpan);
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
if (!a) {
|
||||
return a;
|
||||
}
|
||||
if (a.slice && a.map) {
|
||||
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
||||
} else if ("object" === typeof a) {
|
||||
if (asMap) {
|
||||
for (const key of Object.keys(a)) {
|
||||
a[key] = new classs(a[key]);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return new classs(a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue