Skip to content

Commit

Permalink
暂存
Browse files Browse the repository at this point in the history
  • Loading branch information
sumneko committed Jun 25, 2024
1 parent d0b66a0 commit b473da9
Show file tree
Hide file tree
Showing 9 changed files with 189 additions and 13 deletions.
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ vsc-extension-quickstart.md
**/*.map
**/*.ts
.github
typings
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/console/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function init() {
server = new ConsoleServer(port);

env.onDidChange(() => {
setPort(port);
setPort(port!);
});
setPort(port);
}
Expand Down
3 changes: 1 addition & 2 deletions src/editorTable/EXCEL/fieldTypes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as vscode from 'vscode';

export const enum FieldType {
Default,
Int,
Expand Down Expand Up @@ -427,5 +428,3 @@ export function RatiosInt(retios: any = 1, value: any = 0){
export function RatiosFloat(retios: any = 1, value: any = 0){
return new RatiosFloatKlass(retios, value);
}


3 changes: 3 additions & 0 deletions src/editorTable/EXCEL/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './fieldTypes';
export * from './attrType';
export * from './importRule';
6 changes: 3 additions & 3 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ class EnvPath {
this.scriptUri = vscode.Uri.joinPath(this.mapUri, 'script');
this.y3Uri = vscode.Uri.joinPath(this.scriptUri, 'y3');
this.editorTableUri = vscode.Uri.joinPath(this.mapUri, "editor_table");
this.csvTableUri = vscode.Uri.joinPath(this.scriptUri, "./y3helper/editor_table/csv/");
this.excelUri = vscode.Uri.joinPath(this.mapUri, "./excel/");
this.ruleUri = vscode.Uri.joinPath(this.scriptUri, "./y3helper/editor_table/excel/rule/");
this.csvTableUri = vscode.Uri.joinPath(this.scriptUri, "./y3-helper/editor_table/csv/");
this.excelUri = vscode.Uri.joinPath(this.scriptUri, "./y3-helper/excel/");
this.ruleUri = vscode.Uri.joinPath(this.scriptUri, "./y3-helper/excel_rule/");
this.initTableTypeToCSVfolderPath();
}
tools.log.info(`mapUri: ${this.mapUri}`);
Expand Down
6 changes: 6 additions & 0 deletions template/excel/rule/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"compilerOptions": {
"checkJs": true,
"alwaysStrict": true,
}
}
163 changes: 163 additions & 0 deletions template/excel/rules/y3helper.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
// Generated by dts-bundle v0.7.3

declare module 'y3helper' {
export * from 'y3helper/fieldTypes';
export * from 'y3helper/attrType';
export * from 'y3helper/importRule';
}

declare module 'y3helper/fieldTypes' {
export const enum FieldType {
Default = 0,
Int = 1,
Str = 2,
Bool = 3,
Float = 4,
RatiosInt = 5,
RatiosFloat = 6,
List = 7,
Templete = 8,
Tuple = 9,
EnumInt = 10,
EnumStr = 11,
Enum = 12
}
export class converter {
type: FieldType;
defaultValue: any;
constructor();
getDefault(): any;
getTypeDesc(): string;
getErrorStr(data: any): string;
inputConvert(data: any): any;
outputConvert(d: any): any;
static getInstance(): any;
}
export class IntKlass extends converter {
type: FieldType;
defaultValue: number;
constructor(defaultValue?: number | string);
getDefault(): number;
inputConvert(data: any): any;
}
export class StrKlass extends converter {
type: FieldType;
defaultValue: string;
constructor(defaultValue?: any);
getDefault(): string;
inputConvert(data: any): any;
}
export class BoolenKlass extends converter {
type: FieldType;
defaultValue: boolean;
constructor(defaultValue?: any);
getDefault(): boolean;
inputConvert(data: any): boolean;
}
export class FloatKlass extends converter {
type: FieldType;
defaultValue: number;
constructor(defaultValue?: any);
getDefault(): number;
inputConvert(data: any): any;
}
export class RatiosIntKlass extends converter {
type: FieldType;
defaultValue: number;
ratios: number;
constructor(ratios?: number, defaultValue?: any);
getDefault(): number;
inputConvert(data: any): any;
}
export class RatiosFloatKlass extends converter {
type: FieldType;
defaultValue: number;
ratios: number;
constructor(ratios?: number, defaultValue?: any);
getDefault(): number;
inputConvert(data: any): any;
}
export class ListKlass extends converter {
type: FieldType;
seperator: string;
ft: converter;
constructor(seperator?: string, filedType?: Function | converter);
getDefault(): [];
inputConvert(data: any): any[];
}
export class TupleKlass extends converter {
type: FieldType;
seperator: string;
ftList: Function[] | converter[];
constructor(seperator: string, args: Function[] | converter[]);
inputConvert(data: any): any[];
}
export class EnumKlass extends converter {
type: FieldType;
enumMap: {
[key: string]: any;
};
constructor(map: {
[key: string]: any;
});
inputConvert(data: any): any;
}
export class TempleteKlass extends converter {
type: FieldType;
getDefault(): any;
inputConvert(data: any): any;
}
export function Int(value: any): IntKlass;
export function Float(value: any): FloatKlass;
export function Str(value: any): StrKlass;
export function Bool(value: any): BoolenKlass;
export function Templete(): TempleteKlass;
export function List(seperator: any, type: Function): ListKlass;
export function Tuple(seperator?: string, ...args: Function[] | converter[]): TupleKlass;
export function Enum(map: {}): EnumKlass;
export function RatiosInt(retios?: any, value?: any): RatiosIntKlass;
export function RatiosFloat(retios?: any, value?: any): RatiosFloatKlass;
}

declare module 'y3helper/attrType' {
export class AttrKlass {
constructor(name: any, desc?: string);
getString(): string;
}
export const NONE: AttrKlass;
export const INDEX: AttrKlass;
export const DEFAULT: AttrKlass;
export const IGNORE: AttrKlass;
export const REQUIRED: AttrKlass;
export const CONST: AttrKlass;
export const SKIPNULL: AttrKlass;
export function AS(outKey: string | number, asType: as): as;
export class as {
outKey: string | number;
asType: any;
constructor(outKey: string | number, asType: as);
}
}

declare module 'y3helper/importRule' {
export class ImportRule {
editorTableType: string;
excelRelativePath: string;
sheet: string;
fieldDefs: {
[key: string]: [string | string[] | number[], any, any];
};
filter: Function | undefined;
jumpHeader: number;
dataRehandle: Function | undefined;
constructor(editorTableType: string, excelRelativePath: string, sheetName: string);
resetRule(editorTableType: string, excelRelativePath: string, sheetName: string): void;
def(fieldName: string, filedKey: string | string[] | number[], fieldType: any, attrType: any): void;
templateBy(fieldName: string): void;
indexBy(fieldName: string): void;
startBy(jumpHeader: number): void;
copyRule(): ImportRule;
deepCopy(obj: any): any;
}
}

4 changes: 4 additions & 0 deletions 生成定义.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tsc -d src\editorTable\EXCEL\index.ts --emitDeclarationOnly --outDir ./tmp/typings
dts-bundle --name y3helper --main tmp\typings\index.d.ts --out y3helper.d.ts
xcopy /y .tmp\typings\y3helper.d.ts .\template\excel\rules\y3helper.d.ts
pause

0 comments on commit b473da9

Please sign in to comment.