feat:add lib and bundle

This commit is contained in:
pengfei.zhou 2021-04-23 17:57:34 +08:00 committed by osborn
parent 5982b15b0d
commit cc7df5d2ca
17 changed files with 427 additions and 322 deletions

View File

@ -2130,6 +2130,10 @@ var List = /** @class */ (function (_super) {
Property, Property,
__metadata$8("design:type", Number) __metadata$8("design:type", Number)
], List.prototype, "scrolledPosition", void 0); ], List.prototype, "scrolledPosition", void 0);
__decorate$8([
Property,
__metadata$8("design:type", Boolean)
], List.prototype, "scrollable", void 0);
return List; return List;
}(Superview)); }(Superview));
function list(config) { function list(config) {
@ -2245,6 +2249,10 @@ var Slider = /** @class */ (function (_super) {
Property, Property,
__metadata$7("design:type", Boolean) __metadata$7("design:type", Boolean)
], Slider.prototype, "loop", void 0); ], Slider.prototype, "loop", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
return Slider; return Slider;
}(Superview)); }(Superview));
function slider(config) { function slider(config) {
@ -2338,6 +2346,10 @@ var Scroller = /** @class */ (function (_super) {
Property, Property,
__metadata$6("design:type", Function) __metadata$6("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0); ], Scroller.prototype, "onScrollEnd", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Boolean)
], Scroller.prototype, "scrollable", void 0);
return Scroller; return Scroller;
}(Superview)); }(Superview));
@ -2643,6 +2655,10 @@ var FlowLayout = /** @class */ (function (_super) {
Property, Property,
__metadata$4("design:type", Function) __metadata$4("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0); ], FlowLayout.prototype, "onScrollEnd", void 0);
__decorate$4([
Property,
__metadata$4("design:type", Boolean)
], FlowLayout.prototype, "scrollable", void 0);
return FlowLayout; return FlowLayout;
}(Superview)); }(Superview));
function flowlayout(config) { function flowlayout(config) {
@ -2826,6 +2842,10 @@ var NestedSlider = /** @class */ (function (_super) {
Property, Property,
__metadata$2("design:type", Function) __metadata$2("design:type", Function)
], NestedSlider.prototype, "onPageSlided", void 0); ], NestedSlider.prototype, "onPageSlided", void 0);
__decorate$2([
Property,
__metadata$2("design:type", Boolean)
], NestedSlider.prototype, "scrollable", void 0);
return NestedSlider; return NestedSlider;
}(Group)); }(Group));

View File

@ -116,110 +116,6 @@ function logw(...message) {
nativeLog('w', out); nativeLog('w', out);
} }
const SPECIFIED = 1;
const START = 1 << 1;
const END = 1 << 2;
const SHIFT_X = 0;
const SHIFT_Y = 4;
const LEFT = (START | SPECIFIED) << SHIFT_X;
const RIGHT = (END | SPECIFIED) << SHIFT_X;
const TOP = (START | SPECIFIED) << SHIFT_Y;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
class Gravity {
constructor() {
this.val = 0;
}
left() {
const val = this.val | LEFT;
const ret = new Gravity;
ret.val = val;
return ret;
}
right() {
const val = this.val | RIGHT;
const ret = new Gravity;
ret.val = val;
return ret;
}
top() {
const val = this.val | TOP;
const ret = new Gravity;
ret.val = val;
return ret;
}
bottom() {
const val = this.val | BOTTOM;
const ret = new Gravity;
ret.val = val;
return ret;
}
center() {
const val = this.val | CENTER;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerX() {
const val = this.val | CENTER_X;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerY() {
const val = this.val | CENTER_Y;
const ret = new Gravity;
ret.val = val;
return ret;
}
toModel() {
return this.val;
}
}
Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top();
Gravity.Bottom = Gravity.origin.bottom();
function gravity() {
return new Gravity;
}
function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
}
else {
return context.callNative('modal', 'alert', arg);
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
}
else {
return context.callNative('modal', 'confirm', arg);
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
},
};
}
var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@ -431,9 +327,8 @@ class View {
return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => { return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => {
for (let key in args) { for (let key in args) {
Reflect.set(this, key, Reflect.get(args, key, args), this); Reflect.set(this, key, Reflect.get(args, key, args), this);
//Reflect.deleteProperty(this.__dirty_props__, key) Reflect.deleteProperty(this.__dirty_props__, key);
} }
modal(context).alert(JSON.stringify(this.__dirty_props__));
}); });
} }
} }
@ -617,6 +512,80 @@ class Group extends Superview {
} }
} }
const SPECIFIED = 1;
const START = 1 << 1;
const END = 1 << 2;
const SHIFT_X = 0;
const SHIFT_Y = 4;
const LEFT = (START | SPECIFIED) << SHIFT_X;
const RIGHT = (END | SPECIFIED) << SHIFT_X;
const TOP = (START | SPECIFIED) << SHIFT_Y;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
class Gravity {
constructor() {
this.val = 0;
}
left() {
const val = this.val | LEFT;
const ret = new Gravity;
ret.val = val;
return ret;
}
right() {
const val = this.val | RIGHT;
const ret = new Gravity;
ret.val = val;
return ret;
}
top() {
const val = this.val | TOP;
const ret = new Gravity;
ret.val = val;
return ret;
}
bottom() {
const val = this.val | BOTTOM;
const ret = new Gravity;
ret.val = val;
return ret;
}
center() {
const val = this.val | CENTER;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerX() {
const val = this.val | CENTER_X;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerY() {
const val = this.val | CENTER_Y;
const ret = new Gravity;
ret.val = val;
return ret;
}
toModel() {
return this.val;
}
}
Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top();
Gravity.Bottom = Gravity.origin.bottom();
function gravity() {
return new Gravity;
}
exports.LayoutSpec = void 0; exports.LayoutSpec = void 0;
(function (LayoutSpec) { (function (LayoutSpec) {
/** /**
@ -1657,6 +1626,10 @@ __decorate$8([
Property, Property,
__metadata$8("design:type", Number) __metadata$8("design:type", Number)
], List.prototype, "scrolledPosition", void 0); ], List.prototype, "scrolledPosition", void 0);
__decorate$8([
Property,
__metadata$8("design:type", Boolean)
], List.prototype, "scrollable", void 0);
function list(config) { function list(config) {
const ret = new List; const ret = new List;
for (let key in config) { for (let key in config) {
@ -1747,6 +1720,10 @@ __decorate$7([
Property, Property,
__metadata$7("design:type", Boolean) __metadata$7("design:type", Boolean)
], Slider.prototype, "loop", void 0); ], Slider.prototype, "loop", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
function slider(config) { function slider(config) {
const ret = new Slider; const ret = new Slider;
for (let key in config) { for (let key in config) {
@ -1820,6 +1797,10 @@ __decorate$6([
Property, Property,
__metadata$6("design:type", Function) __metadata$6("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0); ], Scroller.prototype, "onScrollEnd", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Boolean)
], Scroller.prototype, "scrollable", void 0);
var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -2059,6 +2040,10 @@ __decorate$4([
Property, Property,
__metadata$4("design:type", Function) __metadata$4("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0); ], FlowLayout.prototype, "onScrollEnd", void 0);
__decorate$4([
Property,
__metadata$4("design:type", Boolean)
], FlowLayout.prototype, "scrollable", void 0);
function flowlayout(config) { function flowlayout(config) {
const ret = new FlowLayout; const ret = new FlowLayout;
for (let key in config) { for (let key in config) {
@ -2200,6 +2185,10 @@ __decorate$2([
Property, Property,
__metadata$2("design:type", Function) __metadata$2("design:type", Function)
], NestedSlider.prototype, "onPageSlided", void 0); ], NestedSlider.prototype, "onPageSlided", void 0);
__decorate$2([
Property,
__metadata$2("design:type", Boolean)
], NestedSlider.prototype, "scrollable", void 0);
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -2277,6 +2266,36 @@ function switchView(config) {
return ret; return ret;
} }
function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
}
else {
return context.callNative('modal', 'alert', arg);
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
}
else {
return context.callNative('modal', 'confirm', arg);
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
},
};
}
function navbar(context) { function navbar(context) {
const entity = context.entity; const entity = context.entity;
let panel = undefined; let panel = undefined;

View File

@ -1637,110 +1637,6 @@ class Mutable {
} }
} }
const SPECIFIED = 1;
const START = 1 << 1;
const END = 1 << 2;
const SHIFT_X = 0;
const SHIFT_Y = 4;
const LEFT = (START | SPECIFIED) << SHIFT_X;
const RIGHT = (END | SPECIFIED) << SHIFT_X;
const TOP = (START | SPECIFIED) << SHIFT_Y;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
class Gravity {
constructor() {
this.val = 0;
}
left() {
const val = this.val | LEFT;
const ret = new Gravity;
ret.val = val;
return ret;
}
right() {
const val = this.val | RIGHT;
const ret = new Gravity;
ret.val = val;
return ret;
}
top() {
const val = this.val | TOP;
const ret = new Gravity;
ret.val = val;
return ret;
}
bottom() {
const val = this.val | BOTTOM;
const ret = new Gravity;
ret.val = val;
return ret;
}
center() {
const val = this.val | CENTER;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerX() {
const val = this.val | CENTER_X;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerY() {
const val = this.val | CENTER_Y;
const ret = new Gravity;
ret.val = val;
return ret;
}
toModel() {
return this.val;
}
}
Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top();
Gravity.Bottom = Gravity.origin.bottom();
function gravity() {
return new Gravity;
}
function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
}
else {
return context.callNative('modal', 'alert', arg);
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
}
else {
return context.callNative('modal', 'confirm', arg);
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
},
};
}
var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@ -1952,9 +1848,8 @@ class View {
return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => { return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => {
for (let key in args) { for (let key in args) {
Reflect.set(this, key, Reflect.get(args, key, args), this); Reflect.set(this, key, Reflect.get(args, key, args), this);
//Reflect.deleteProperty(this.__dirty_props__, key) Reflect.deleteProperty(this.__dirty_props__, key);
} }
modal(context).alert(JSON.stringify(this.__dirty_props__));
}); });
} }
} }
@ -2138,6 +2033,80 @@ class Group extends Superview {
} }
} }
const SPECIFIED = 1;
const START = 1 << 1;
const END = 1 << 2;
const SHIFT_X = 0;
const SHIFT_Y = 4;
const LEFT = (START | SPECIFIED) << SHIFT_X;
const RIGHT = (END | SPECIFIED) << SHIFT_X;
const TOP = (START | SPECIFIED) << SHIFT_Y;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
class Gravity {
constructor() {
this.val = 0;
}
left() {
const val = this.val | LEFT;
const ret = new Gravity;
ret.val = val;
return ret;
}
right() {
const val = this.val | RIGHT;
const ret = new Gravity;
ret.val = val;
return ret;
}
top() {
const val = this.val | TOP;
const ret = new Gravity;
ret.val = val;
return ret;
}
bottom() {
const val = this.val | BOTTOM;
const ret = new Gravity;
ret.val = val;
return ret;
}
center() {
const val = this.val | CENTER;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerX() {
const val = this.val | CENTER_X;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerY() {
const val = this.val | CENTER_Y;
const ret = new Gravity;
ret.val = val;
return ret;
}
toModel() {
return this.val;
}
}
Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top();
Gravity.Bottom = Gravity.origin.bottom();
function gravity() {
return new Gravity;
}
exports.LayoutSpec = void 0; exports.LayoutSpec = void 0;
(function (LayoutSpec) { (function (LayoutSpec) {
/** /**
@ -3178,6 +3147,10 @@ __decorate$8([
Property, Property,
__metadata$8("design:type", Number) __metadata$8("design:type", Number)
], List.prototype, "scrolledPosition", void 0); ], List.prototype, "scrolledPosition", void 0);
__decorate$8([
Property,
__metadata$8("design:type", Boolean)
], List.prototype, "scrollable", void 0);
function list(config) { function list(config) {
const ret = new List; const ret = new List;
for (let key in config) { for (let key in config) {
@ -3268,6 +3241,10 @@ __decorate$7([
Property, Property,
__metadata$7("design:type", Boolean) __metadata$7("design:type", Boolean)
], Slider.prototype, "loop", void 0); ], Slider.prototype, "loop", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
function slider(config) { function slider(config) {
const ret = new Slider; const ret = new Slider;
for (let key in config) { for (let key in config) {
@ -3341,6 +3318,10 @@ __decorate$6([
Property, Property,
__metadata$6("design:type", Function) __metadata$6("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0); ], Scroller.prototype, "onScrollEnd", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Boolean)
], Scroller.prototype, "scrollable", void 0);
var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -3580,6 +3561,10 @@ __decorate$4([
Property, Property,
__metadata$4("design:type", Function) __metadata$4("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0); ], FlowLayout.prototype, "onScrollEnd", void 0);
__decorate$4([
Property,
__metadata$4("design:type", Boolean)
], FlowLayout.prototype, "scrollable", void 0);
function flowlayout(config) { function flowlayout(config) {
const ret = new FlowLayout; const ret = new FlowLayout;
for (let key in config) { for (let key in config) {
@ -3721,6 +3706,10 @@ __decorate$2([
Property, Property,
__metadata$2("design:type", Function) __metadata$2("design:type", Function)
], NestedSlider.prototype, "onPageSlided", void 0); ], NestedSlider.prototype, "onPageSlided", void 0);
__decorate$2([
Property,
__metadata$2("design:type", Boolean)
], NestedSlider.prototype, "scrollable", void 0);
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -3798,6 +3787,36 @@ function switchView(config) {
return ret; return ret;
} }
function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
}
else {
return context.callNative('modal', 'alert', arg);
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
}
else {
return context.callNative('modal', 'confirm', arg);
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
},
};
}
function navbar(context) { function navbar(context) {
const entity = context.entity; const entity = context.entity;
let panel = undefined; let panel = undefined;

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

@ -610,6 +610,7 @@ declare module 'doric/lib/src/widget/list' {
y: number; y: number;
}) => void; }) => void;
scrolledPosition?: number; scrolledPosition?: number;
scrollable?: boolean;
scrollToItem(context: BridgeContext, index: number, config?: { scrollToItem(context: BridgeContext, index: number, config?: {
animated?: boolean; animated?: boolean;
}): Promise<any>; }): Promise<any>;
@ -637,6 +638,7 @@ declare module 'doric/lib/src/widget/slider' {
batchCount: number; batchCount: number;
onPageSlided?: (index: number) => void; onPageSlided?: (index: number) => void;
loop?: boolean; loop?: boolean;
scrollable?: boolean;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>; slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
getSlidedPage(context: BridgeContext): Promise<number>; getSlidedPage(context: BridgeContext): Promise<number>;
} }
@ -662,6 +664,7 @@ declare module 'doric/lib/src/widget/scroller' {
x: number; x: number;
y: number; y: number;
}) => void; }) => void;
scrollable?: boolean;
allSubviews(): View[]; allSubviews(): View[];
toModel(): NativeViewModel; toModel(): NativeViewModel;
scrollTo(context: BridgeContext, offset: { scrollTo(context: BridgeContext, offset: {
@ -726,6 +729,7 @@ declare module 'doric/lib/src/widget/flowlayout' {
x: number; x: number;
y: number; y: number;
}) => void; }) => void;
scrollable?: boolean;
reset(): void; reset(): void;
toModel(): NativeViewModel; toModel(): NativeViewModel;
} }
@ -771,6 +775,7 @@ declare module 'doric/lib/src/widget/nestedSlider' {
import { BridgeContext } from 'doric/lib/src/runtime/global'; import { BridgeContext } from 'doric/lib/src/runtime/global';
export class NestedSlider extends Group { export class NestedSlider extends Group {
onPageSlided?: (index: number) => void; onPageSlided?: (index: number) => void;
scrollable?: boolean;
addSlideItem(view: View): void; addSlideItem(view: View): void;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>; slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
getSlidedPage(context: BridgeContext): Promise<number>; getSlidedPage(context: BridgeContext): Promise<number>;

View File

@ -10,7 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
import { obj2Model } from "../util/types"; import { obj2Model } from "../util/types";
import { uniqueId } from "../util/uniqueId"; import { uniqueId } from "../util/uniqueId";
import { loge } from "../util/log"; import { loge } from "../util/log";
import { modal } from "../native/modal";
const PROP_CONSIST = 1; const PROP_CONSIST = 1;
const PROP_INCONSIST = 2; const PROP_INCONSIST = 2;
export function Property(target, propKey) { export function Property(target, propKey) {
@ -213,9 +212,8 @@ export class View {
return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => { return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => {
for (let key in args) { for (let key in args) {
Reflect.set(this, key, Reflect.get(args, key, args), this); Reflect.set(this, key, Reflect.get(args, key, args), this);
//Reflect.deleteProperty(this.__dirty_props__, key) Reflect.deleteProperty(this.__dirty_props__, key);
} }
modal(context).alert(JSON.stringify(this.__dirty_props__));
}); });
} }
} }

View File

@ -26,6 +26,7 @@ export declare class FlowLayout extends Superview {
x: number; x: number;
y: number; y: number;
}) => void; }) => void;
scrollable?: boolean;
reset(): void; reset(): void;
private getItem; private getItem;
private renderBunchedItems; private renderBunchedItems;

View File

@ -114,6 +114,10 @@ __decorate([
Property, Property,
__metadata("design:type", Function) __metadata("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0); ], FlowLayout.prototype, "onScrollEnd", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], FlowLayout.prototype, "scrollable", void 0);
export function flowlayout(config) { export function flowlayout(config) {
const ret = new FlowLayout; const ret = new FlowLayout;
for (let key in config) { for (let key in config) {

View File

@ -25,6 +25,7 @@ export declare class List extends Superview {
y: number; y: number;
}) => void; }) => void;
scrolledPosition?: number; scrolledPosition?: number;
scrollable?: boolean;
scrollToItem(context: BridgeContext, index: number, config?: { scrollToItem(context: BridgeContext, index: number, config?: {
animated?: boolean; animated?: boolean;
}): Promise<any>; }): Promise<any>;

View File

@ -109,6 +109,10 @@ __decorate([
Property, Property,
__metadata("design:type", Number) __metadata("design:type", Number)
], List.prototype, "scrolledPosition", void 0); ], List.prototype, "scrolledPosition", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], List.prototype, "scrollable", void 0);
export function list(config) { export function list(config) {
const ret = new List; const ret = new List;
for (let key in config) { for (let key in config) {

View File

@ -2,6 +2,7 @@ import { Group, View } from '../ui/view';
import { BridgeContext } from '../runtime/global'; import { BridgeContext } from '../runtime/global';
export declare class NestedSlider extends Group { export declare class NestedSlider extends Group {
onPageSlided?: (index: number) => void; onPageSlided?: (index: number) => void;
scrollable?: boolean;
addSlideItem(view: View): void; addSlideItem(view: View): void;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>; slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;
getSlidedPage(context: BridgeContext): Promise<number>; getSlidedPage(context: BridgeContext): Promise<number>;

View File

@ -38,3 +38,7 @@ __decorate([
Property, Property,
__metadata("design:type", Function) __metadata("design:type", Function)
], NestedSlider.prototype, "onPageSlided", void 0); ], NestedSlider.prototype, "onPageSlided", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], NestedSlider.prototype, "scrollable", void 0);

View File

@ -15,6 +15,7 @@ export declare class Scroller extends Superview {
x: number; x: number;
y: number; y: number;
}) => void; }) => void;
scrollable?: boolean;
allSubviews(): View[]; allSubviews(): View[];
toModel(): NativeViewModel; toModel(): NativeViewModel;
scrollTo(context: BridgeContext, offset: { scrollTo(context: BridgeContext, offset: {

View File

@ -62,3 +62,7 @@ __decorate([
Property, Property,
__metadata("design:type", Function) __metadata("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0); ], Scroller.prototype, "onScrollEnd", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Scroller.prototype, "scrollable", void 0);

View File

@ -15,6 +15,7 @@ export declare class Slider extends Superview {
batchCount: number; batchCount: number;
onPageSlided?: (index: number) => void; onPageSlided?: (index: number) => void;
loop?: boolean; loop?: boolean;
scrollable?: boolean;
private getItem; private getItem;
private renderBunchedItems; private renderBunchedItems;
slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>; slidePage(context: BridgeContext, page: number, smooth?: boolean): Promise<any>;

View File

@ -80,6 +80,10 @@ __decorate([
Property, Property,
__metadata("design:type", Boolean) __metadata("design:type", Boolean)
], Slider.prototype, "loop", void 0); ], Slider.prototype, "loop", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
export function slider(config) { export function slider(config) {
const ret = new Slider; const ret = new Slider;
for (let key in config) { for (let key in config) {

View File

@ -1691,110 +1691,6 @@ function logw(...message) {
nativeLog('w', out); nativeLog('w', out);
} }
const SPECIFIED = 1;
const START = 1 << 1;
const END = 1 << 2;
const SHIFT_X = 0;
const SHIFT_Y = 4;
const LEFT = (START | SPECIFIED) << SHIFT_X;
const RIGHT = (END | SPECIFIED) << SHIFT_X;
const TOP = (START | SPECIFIED) << SHIFT_Y;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
class Gravity {
constructor() {
this.val = 0;
}
left() {
const val = this.val | LEFT;
const ret = new Gravity;
ret.val = val;
return ret;
}
right() {
const val = this.val | RIGHT;
const ret = new Gravity;
ret.val = val;
return ret;
}
top() {
const val = this.val | TOP;
const ret = new Gravity;
ret.val = val;
return ret;
}
bottom() {
const val = this.val | BOTTOM;
const ret = new Gravity;
ret.val = val;
return ret;
}
center() {
const val = this.val | CENTER;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerX() {
const val = this.val | CENTER_X;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerY() {
const val = this.val | CENTER_Y;
const ret = new Gravity;
ret.val = val;
return ret;
}
toModel() {
return this.val;
}
}
Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top();
Gravity.Bottom = Gravity.origin.bottom();
function gravity() {
return new Gravity;
}
function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
}
else {
return context.callNative('modal', 'alert', arg);
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
}
else {
return context.callNative('modal', 'confirm', arg);
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
},
};
}
var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@ -2006,9 +1902,8 @@ class View {
return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => { return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => {
for (let key in args) { for (let key in args) {
Reflect.set(this, key, Reflect.get(args, key, args), this); Reflect.set(this, key, Reflect.get(args, key, args), this);
//Reflect.deleteProperty(this.__dirty_props__, key) Reflect.deleteProperty(this.__dirty_props__, key);
} }
modal(context).alert(JSON.stringify(this.__dirty_props__));
}); });
} }
} }
@ -2192,6 +2087,80 @@ class Group extends Superview {
} }
} }
const SPECIFIED = 1;
const START = 1 << 1;
const END = 1 << 2;
const SHIFT_X = 0;
const SHIFT_Y = 4;
const LEFT = (START | SPECIFIED) << SHIFT_X;
const RIGHT = (END | SPECIFIED) << SHIFT_X;
const TOP = (START | SPECIFIED) << SHIFT_Y;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
class Gravity {
constructor() {
this.val = 0;
}
left() {
const val = this.val | LEFT;
const ret = new Gravity;
ret.val = val;
return ret;
}
right() {
const val = this.val | RIGHT;
const ret = new Gravity;
ret.val = val;
return ret;
}
top() {
const val = this.val | TOP;
const ret = new Gravity;
ret.val = val;
return ret;
}
bottom() {
const val = this.val | BOTTOM;
const ret = new Gravity;
ret.val = val;
return ret;
}
center() {
const val = this.val | CENTER;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerX() {
const val = this.val | CENTER_X;
const ret = new Gravity;
ret.val = val;
return ret;
}
centerY() {
const val = this.val | CENTER_Y;
const ret = new Gravity;
ret.val = val;
return ret;
}
toModel() {
return this.val;
}
}
Gravity.origin = new Gravity;
Gravity.Center = Gravity.origin.center();
Gravity.CenterX = Gravity.origin.centerX();
Gravity.CenterY = Gravity.origin.centerY();
Gravity.Left = Gravity.origin.left();
Gravity.Right = Gravity.origin.right();
Gravity.Top = Gravity.origin.top();
Gravity.Bottom = Gravity.origin.bottom();
function gravity() {
return new Gravity;
}
exports.LayoutSpec = void 0; exports.LayoutSpec = void 0;
(function (LayoutSpec) { (function (LayoutSpec) {
/** /**
@ -3232,6 +3201,10 @@ __decorate$8([
Property, Property,
__metadata$8("design:type", Number) __metadata$8("design:type", Number)
], List.prototype, "scrolledPosition", void 0); ], List.prototype, "scrolledPosition", void 0);
__decorate$8([
Property,
__metadata$8("design:type", Boolean)
], List.prototype, "scrollable", void 0);
function list(config) { function list(config) {
const ret = new List; const ret = new List;
for (let key in config) { for (let key in config) {
@ -3322,6 +3295,10 @@ __decorate$7([
Property, Property,
__metadata$7("design:type", Boolean) __metadata$7("design:type", Boolean)
], Slider.prototype, "loop", void 0); ], Slider.prototype, "loop", void 0);
__decorate$7([
Property,
__metadata$7("design:type", Boolean)
], Slider.prototype, "scrollable", void 0);
function slider(config) { function slider(config) {
const ret = new Slider; const ret = new Slider;
for (let key in config) { for (let key in config) {
@ -3395,6 +3372,10 @@ __decorate$6([
Property, Property,
__metadata$6("design:type", Function) __metadata$6("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0); ], Scroller.prototype, "onScrollEnd", void 0);
__decorate$6([
Property,
__metadata$6("design:type", Boolean)
], Scroller.prototype, "scrollable", void 0);
var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -3634,6 +3615,10 @@ __decorate$4([
Property, Property,
__metadata$4("design:type", Function) __metadata$4("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0); ], FlowLayout.prototype, "onScrollEnd", void 0);
__decorate$4([
Property,
__metadata$4("design:type", Boolean)
], FlowLayout.prototype, "scrollable", void 0);
function flowlayout(config) { function flowlayout(config) {
const ret = new FlowLayout; const ret = new FlowLayout;
for (let key in config) { for (let key in config) {
@ -3775,6 +3760,10 @@ __decorate$2([
Property, Property,
__metadata$2("design:type", Function) __metadata$2("design:type", Function)
], NestedSlider.prototype, "onPageSlided", void 0); ], NestedSlider.prototype, "onPageSlided", void 0);
__decorate$2([
Property,
__metadata$2("design:type", Boolean)
], NestedSlider.prototype, "scrollable", void 0);
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@ -3852,6 +3841,36 @@ function switchView(config) {
return ret; return ret;
} }
function modal(context) {
return {
toast: (msg, gravity = Gravity.Bottom) => {
context.callNative('modal', 'toast', {
msg,
gravity: gravity.toModel(),
});
},
alert: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'alert', { msg: arg });
}
else {
return context.callNative('modal', 'alert', arg);
}
},
confirm: (arg) => {
if (typeof arg === 'string') {
return context.callNative('modal', 'confirm', { msg: arg });
}
else {
return context.callNative('modal', 'confirm', arg);
}
},
prompt: (arg) => {
return context.callNative('modal', 'prompt', arg);
},
};
}
function navbar(context) { function navbar(context) {
const entity = context.entity; const entity = context.entity;
let panel = undefined; let panel = undefined;

File diff suppressed because one or more lines are too long