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

View File

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

View File

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

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

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

View File

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

View File

@ -297,10 +297,6 @@ __decorate([
Property,
__metadata("design:type", Boolean)
], View.prototype, "hidden", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], View.prototype, "padding", void 0);
__decorate([
Property,
__metadata("design:type", Object)
@ -466,3 +462,7 @@ export class Group extends Superview {
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;
replacement: string;
}) => boolean;
padding?: {
left?: number;
right?: number;
top?: number;
bottom?: number;
};
getText(context: BridgeContext): Promise<string>;
setSelection(context: BridgeContext, start: number, end?: number): Promise<any>;
getSelection(context: BridgeContext): Promise<{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long