Browse Source

KERNEL-7826 refactor: jsx环境

es6
Kira 4 years ago
parent
commit
dba226445c
  1. 11
      typescript/base/single/label/abstract.label.ts
  2. 6
      typescript/base/single/label/label.ts
  3. 14
      typescript/base/single/single.ts
  4. 6
      typescript/core/ob.ts
  5. 37
      typescript/shims-tsx.ts

11
typescript/base/single/label/abstract.label.ts

@ -2,7 +2,16 @@ import { Single } from "../single";
export declare class AbstractLabel extends Single {
static xtype: string;
props: {
textAlign: "left" | "center" | "right",
whiteSpace: "nowrap" | "normal",
textWidth: number | null,
textHeight: number | null,
highLight: boolean,
handler: Function | null,
} & Single['props']
doRedMark(...args: any[]): void;
unRedMark(...args: any[]): void;

6
typescript/base/single/label/label.ts

@ -1,5 +1,11 @@
import { AbstractLabel } from "./abstract.label";
export declare class Label extends AbstractLabel {
props: {
py: string;
keyword: string;
text: string;
} & AbstractLabel['props'];
static xtype: string;
}

14
typescript/base/single/single.ts

@ -5,6 +5,20 @@ interface SingleOpt {
}
export declare class Single extends Widget {
props: {
readonly: boolean,
title: string | (() => string) | null,
warningTitle: string | (() => string) | null,
tipType: "success" | "warning",
value: string | null,
/**
* title是否跟随鼠标
* @default false
*/
belowMouse: boolean,
}
_showToolTip(e: Event, opt?: SingleOpt): void;
_hideTooltip(): void;

6
typescript/core/ob.ts

@ -47,6 +47,12 @@ interface Props {
}
export declare class OB {
/**
* jsx props声明
*/
__props: Partial<this['props']>;
props: Props | (<T>(config: T) => Props & T);
options: this["props"];

37
typescript/shims-tsx.ts

@ -0,0 +1,37 @@
declare const React: any;
interface UIProps {
width: number;
height: number;
top: number;
left: number;
bottom: number;
right: number;
rgap: number;
lgap: number;
tgap: number;
bgap: number;
}
interface ElementClassProps<T> extends UIProps {
baseCls: string;
cls: string;
ref: (ref: T) => void;
}
declare namespace JSX {
// for undefined
interface IntrinsicElements {
[elemName: string]: Partial<UIProps>;
}
type ElementAttributesProperty = {
/**
* specify the property name to use
*/
__props: any;
};
interface IntrinsicClassAttributes<T> extends Partial<ElementClassProps<T>> {}
}
Loading…
Cancel
Save