js: padding currently only support group or text,input

This commit is contained in:
pengfei.zhou 2022-08-25 10:42:56 +08:00 committed by osborn
parent 02259823da
commit 3937a3f4d3
16 changed files with 129 additions and 48 deletions

View File

@ -500,10 +500,6 @@ var View = /** @class */ (function () {
Property, Property,
__metadata$g("design:type", Boolean) __metadata$g("design:type", Boolean)
], View.prototype, "hidden", void 0); ], View.prototype, "hidden", void 0);
__decorate$g([
Property,
__metadata$g("design:type", Object)
], View.prototype, "padding", void 0);
__decorate$g([ __decorate$g([
Property, Property,
__metadata$g("design:type", Object) __metadata$g("design:type", Object)
@ -707,6 +703,10 @@ var Group = /** @class */ (function (_super) {
enumerable: false, enumerable: false,
configurable: true configurable: true
}); });
__decorate$g([
Property,
__metadata$g("design:type", Object)
], Group.prototype, "padding", void 0);
return Group; return Group;
}(Superview)); }(Superview));
@ -2106,6 +2106,10 @@ var Text = /** @class */ (function (_super) {
Property, Property,
__metadata$d("design:type", Number) __metadata$d("design:type", Number)
], Text.prototype, "truncateAt", void 0); ], Text.prototype, "truncateAt", void 0);
__decorate$d([
Property,
__metadata$d("design:type", Object)
], Text.prototype, "padding", void 0);
return Text; return Text;
}(View)); }(View));
function text(config) { function text(config) {
@ -3423,6 +3427,10 @@ var Input = /** @class */ (function (_super) {
Property, Property,
__metadata$6("design:type", Function) __metadata$6("design:type", Function)
], Input.prototype, "beforeTextChange", void 0); ], Input.prototype, "beforeTextChange", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Object)
], Input.prototype, "padding", void 0);
return Input; return Input;
}(View)); }(View));
exports.InputType = void 0; exports.InputType = void 0;

View File

@ -415,10 +415,6 @@ __decorate$g([
Property, Property,
__metadata$g("design:type", Boolean) __metadata$g("design:type", Boolean)
], View.prototype, "hidden", void 0); ], View.prototype, "hidden", void 0);
__decorate$g([
Property,
__metadata$g("design:type", Object)
], View.prototype, "padding", void 0);
__decorate$g([ __decorate$g([
Property, Property,
__metadata$g("design:type", Object) __metadata$g("design:type", Object)
@ -584,6 +580,10 @@ class Group extends Superview {
this.addInnerElement(e); this.addInnerElement(e);
} }
} }
__decorate$g([
Property,
__metadata$g("design:type", Object)
], Group.prototype, "padding", void 0);
const SPECIFIED = 1; const SPECIFIED = 1;
const START = 1 << 1; const START = 1 << 1;
@ -1608,6 +1608,10 @@ __decorate$d([
Property, Property,
__metadata$d("design:type", Number) __metadata$d("design:type", Number)
], Text.prototype, "truncateAt", void 0); ], Text.prototype, "truncateAt", void 0);
__decorate$d([
Property,
__metadata$d("design:type", Object)
], Text.prototype, "padding", void 0);
function text(config) { function text(config) {
const ret = new Text; const ret = new Text;
ret.layoutConfig = layoutConfig().fit(); ret.layoutConfig = layoutConfig().fit();
@ -2639,6 +2643,10 @@ __decorate$6([
Property, Property,
__metadata$6("design:type", Function) __metadata$6("design:type", Function)
], Input.prototype, "beforeTextChange", void 0); ], Input.prototype, "beforeTextChange", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Object)
], Input.prototype, "padding", void 0);
exports.InputType = void 0; exports.InputType = void 0;
(function (InputType) { (function (InputType) {
InputType[InputType["Default"] = 0] = "Default"; InputType[InputType["Default"] = 0] = "Default";

View File

@ -1945,10 +1945,6 @@ __decorate$g([
Property, Property,
__metadata$g("design:type", Boolean) __metadata$g("design:type", Boolean)
], View.prototype, "hidden", void 0); ], View.prototype, "hidden", void 0);
__decorate$g([
Property,
__metadata$g("design:type", Object)
], View.prototype, "padding", void 0);
__decorate$g([ __decorate$g([
Property, Property,
__metadata$g("design:type", Object) __metadata$g("design:type", Object)
@ -2114,6 +2110,10 @@ class Group extends Superview {
this.addInnerElement(e); this.addInnerElement(e);
} }
} }
__decorate$g([
Property,
__metadata$g("design:type", Object)
], Group.prototype, "padding", void 0);
const SPECIFIED = 1; const SPECIFIED = 1;
const START = 1 << 1; const START = 1 << 1;
@ -3138,6 +3138,10 @@ __decorate$d([
Property, Property,
__metadata$d("design:type", Number) __metadata$d("design:type", Number)
], Text.prototype, "truncateAt", void 0); ], Text.prototype, "truncateAt", void 0);
__decorate$d([
Property,
__metadata$d("design:type", Object)
], Text.prototype, "padding", void 0);
function text(config) { function text(config) {
const ret = new Text; const ret = new Text;
ret.layoutConfig = layoutConfig().fit(); ret.layoutConfig = layoutConfig().fit();
@ -4169,6 +4173,10 @@ __decorate$6([
Property, Property,
__metadata$6("design:type", Function) __metadata$6("design:type", Function)
], Input.prototype, "beforeTextChange", void 0); ], Input.prototype, "beforeTextChange", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Object)
], Input.prototype, "padding", void 0);
exports.InputType = void 0; exports.InputType = void 0;
(function (InputType) { (function (InputType) {
InputType[InputType["Default"] = 0] = "Default"; InputType[InputType["Default"] = 0] = "Default";

24
doric-js/index.d.ts vendored
View File

@ -565,12 +565,6 @@ declare module "doric" {
hidden?: boolean; hidden?: boolean;
viewId: string; viewId: string;
tag?: string; tag?: string;
padding?: {
left?: number;
right?: number;
top?: number;
bottom?: number;
};
layoutConfig?: LayoutConfig; layoutConfig?: LayoutConfig;
onClick?: Function; onClick?: Function;
superview?: Superview; superview?: Superview;
@ -672,6 +666,12 @@ declare module "doric" {
export type ViewArray = View[]; export type ViewArray = View[];
export type ViewFragment = View | ViewArray | undefined | null; export type ViewFragment = View | ViewArray | undefined | null;
export abstract class Group extends Superview implements JSX.ElementChildrenAttribute { export abstract class Group extends Superview implements JSX.ElementChildrenAttribute {
padding?: {
left?: number;
right?: number;
top?: number;
bottom?: number;
};
readonly children: View[]; readonly children: View[];
allSubviews(): View[]; allSubviews(): View[];
addChild(view: View): void; addChild(view: View): void;
@ -884,6 +884,12 @@ declare module "doric" {
underline?: boolean; underline?: boolean;
htmlText?: string; htmlText?: string;
truncateAt?: TruncateAt; truncateAt?: TruncateAt;
padding?: {
left?: number;
right?: number;
top?: number;
bottom?: number;
};
set innerElement(e: string); set innerElement(e: string);
} }
export function text(config: Partial<Text>): Text; export function text(config: Partial<Text>): Text;
@ -1250,6 +1256,12 @@ declare module "doric" {
length: number; length: number;
replacement: string; replacement: string;
}) => boolean; }) => boolean;
padding?: {
left?: number;
right?: number;
top?: number;
bottom?: number;
};
getText(context: BridgeContext): Promise<string>; getText(context: BridgeContext): Promise<string>;
setSelection(context: BridgeContext, start: number, end?: number): Promise<any>; setSelection(context: BridgeContext, start: number, end?: number): Promise<any>;
getSelection(context: BridgeContext): Promise<{ getSelection(context: BridgeContext): Promise<{

View File

@ -52,12 +52,6 @@ export declare abstract class View implements Modeling {
hidden?: boolean; hidden?: boolean;
viewId: string; viewId: string;
tag?: string; tag?: string;
padding?: {
left?: number;
right?: number;
top?: number;
bottom?: number;
};
layoutConfig?: LayoutConfig; layoutConfig?: LayoutConfig;
onClick?: Function; onClick?: Function;
superview?: Superview; superview?: Superview;
@ -159,6 +153,12 @@ export declare abstract class Superview extends View {
export declare type ViewArray = View[]; export declare type ViewArray = View[];
export declare type ViewFragment = View | ViewArray | undefined | null; export declare type ViewFragment = View | ViewArray | undefined | null;
export declare abstract class Group extends Superview implements JSX.ElementChildrenAttribute { export declare abstract class Group extends Superview implements JSX.ElementChildrenAttribute {
padding?: {
left?: number;
right?: number;
top?: number;
bottom?: number;
};
readonly children: View[]; readonly children: View[];
allSubviews(): View[]; allSubviews(): View[];
addChild(view: View): void; addChild(view: View): void;

View File

@ -297,10 +297,6 @@ __decorate([
Property, Property,
__metadata("design:type", Boolean) __metadata("design:type", Boolean)
], View.prototype, "hidden", void 0); ], View.prototype, "hidden", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], View.prototype, "padding", void 0);
__decorate([ __decorate([
Property, Property,
__metadata("design:type", Object) __metadata("design:type", Object)
@ -466,3 +462,7 @@ export class Group extends Superview {
this.addInnerElement(e); this.addInnerElement(e);
} }
} }
__decorate([
Property,
__metadata("design:type", Object)
], Group.prototype, "padding", void 0);

View File

@ -45,6 +45,12 @@ export declare class Input extends View {
length: number; length: number;
replacement: string; replacement: string;
}) => boolean; }) => boolean;
padding?: {
left?: number;
right?: number;
top?: number;
bottom?: number;
};
getText(context: BridgeContext): Promise<string>; getText(context: BridgeContext): Promise<string>;
setSelection(context: BridgeContext, start: number, end?: number): Promise<any>; setSelection(context: BridgeContext, start: number, end?: number): Promise<any>;
getSelection(context: BridgeContext): Promise<{ getSelection(context: BridgeContext): Promise<{

View File

@ -135,6 +135,10 @@ __decorate([
Property, Property,
__metadata("design:type", Function) __metadata("design:type", Function)
], Input.prototype, "beforeTextChange", void 0); ], Input.prototype, "beforeTextChange", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], Input.prototype, "padding", void 0);
export var InputType; export var InputType;
(function (InputType) { (function (InputType) {
InputType[InputType["Default"] = 0] = "Default"; InputType[InputType["Default"] = 0] = "Default";

View File

@ -23,6 +23,12 @@ export declare class Text extends View implements JSX.ElementChildrenAttribute {
underline?: boolean; underline?: boolean;
htmlText?: string; htmlText?: string;
truncateAt?: TruncateAt; truncateAt?: TruncateAt;
padding?: {
left?: number;
right?: number;
top?: number;
bottom?: number;
};
set innerElement(e: string); set innerElement(e: string);
} }
export declare function text(config: Partial<Text>): Text; export declare function text(config: Partial<Text>): Text;

View File

@ -93,6 +93,10 @@ __decorate([
Property, Property,
__metadata("design:type", Number) __metadata("design:type", Number)
], Text.prototype, "truncateAt", void 0); ], Text.prototype, "truncateAt", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], Text.prototype, "padding", void 0);
export function text(config) { export function text(config) {
const ret = new Text; const ret = new Text;
ret.layoutConfig = layoutConfig().fit(); ret.layoutConfig = layoutConfig().fit();

View File

@ -127,14 +127,6 @@ export abstract class View implements Modeling {
viewId = uniqueId('ViewId') viewId = uniqueId('ViewId')
@Property
padding?: {
left?: number,
right?: number,
top?: number,
bottom?: number,
}
@Property @Property
layoutConfig?: LayoutConfig layoutConfig?: LayoutConfig
@ -483,6 +475,14 @@ export type ViewFragment = View | ViewArray | undefined | null
export abstract class Group extends Superview { export abstract class Group extends Superview {
@Property
padding?: {
left?: number,
right?: number,
top?: number,
bottom?: number,
}
readonly children: View[] = [] readonly children: View[] = []
allSubviews() { allSubviews() {

View File

@ -111,13 +111,6 @@ export abstract class View implements Modeling {
tag?: string tag?: string
@Property
padding?: {
left?: number,
right?: number,
top?: number,
bottom?: number,
}
@Property @Property
layoutConfig?: LayoutConfig layoutConfig?: LayoutConfig
@ -508,6 +501,14 @@ export type ViewFragment = View | ViewArray | undefined | null
export abstract class Group extends Superview implements JSX.ElementChildrenAttribute { export abstract class Group extends Superview implements JSX.ElementChildrenAttribute {
@Property
padding?: {
left?: number,
right?: number,
top?: number,
bottom?: number,
}
readonly children: View[] = new Proxy([], { readonly children: View[] = new Proxy([], {
set: (target, index, value) => { set: (target, index, value) => {
const ret = Reflect.set(target, index, value) const ret = Reflect.set(target, index, value)

View File

@ -104,6 +104,14 @@ export class Input extends View {
replacement: string, replacement: string,
}) => boolean }) => boolean
@Property
padding?: {
left?: number,
right?: number,
top?: number,
bottom?: number,
}
getText(context: BridgeContext) { getText(context: BridgeContext) {
return this.nativeChannel(context, 'getText')() as Promise<string> return this.nativeChannel(context, 'getText')() as Promise<string>
} }

View File

@ -69,6 +69,14 @@ export class Text extends View implements JSX.ElementChildrenAttribute {
@Property @Property
truncateAt?: TruncateAt truncateAt?: TruncateAt
@Property
padding?: {
left?: number,
right?: number,
top?: number,
bottom?: number,
}
set innerElement(e: string) { set innerElement(e: string) {
this.text = e this.text = e
} }

View File

@ -2022,10 +2022,6 @@ __decorate$g([
Property, Property,
__metadata$g("design:type", Boolean) __metadata$g("design:type", Boolean)
], View.prototype, "hidden", void 0); ], View.prototype, "hidden", void 0);
__decorate$g([
Property,
__metadata$g("design:type", Object)
], View.prototype, "padding", void 0);
__decorate$g([ __decorate$g([
Property, Property,
__metadata$g("design:type", Object) __metadata$g("design:type", Object)
@ -2191,6 +2187,10 @@ class Group extends Superview {
this.addInnerElement(e); this.addInnerElement(e);
} }
} }
__decorate$g([
Property,
__metadata$g("design:type", Object)
], Group.prototype, "padding", void 0);
const SPECIFIED = 1; const SPECIFIED = 1;
const START = 1 << 1; const START = 1 << 1;
@ -3215,6 +3215,10 @@ __decorate$d([
Property, Property,
__metadata$d("design:type", Number) __metadata$d("design:type", Number)
], Text.prototype, "truncateAt", void 0); ], Text.prototype, "truncateAt", void 0);
__decorate$d([
Property,
__metadata$d("design:type", Object)
], Text.prototype, "padding", void 0);
function text(config) { function text(config) {
const ret = new Text; const ret = new Text;
ret.layoutConfig = layoutConfig().fit(); ret.layoutConfig = layoutConfig().fit();
@ -4246,6 +4250,10 @@ __decorate$6([
Property, Property,
__metadata$6("design:type", Function) __metadata$6("design:type", Function)
], Input.prototype, "beforeTextChange", void 0); ], Input.prototype, "beforeTextChange", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Object)
], Input.prototype, "padding", void 0);
exports.InputType = void 0; exports.InputType = void 0;
(function (InputType) { (function (InputType) {
InputType[InputType["Default"] = 0] = "Default"; InputType[InputType["Default"] = 0] = "Default";

File diff suppressed because one or more lines are too long