update typescript and remove reflect-metadata lib

This commit is contained in:
pengfei.zhou
2020-05-16 18:58:32 +08:00
committed by osborn
parent 4d80048d60
commit 0633c1c19d
30 changed files with 3593 additions and 3384 deletions

View File

@@ -25,12 +25,16 @@ var __metadata = (this && this.__metadata) || function (k, v) {
import { Property, View } from "../ui/view";
import { Stack } from "../widget/layouts";
import { layoutConfig } from "../util/layoutconfig";
export class Draggable extends Stack {
}
__decorate([
Property,
__metadata("design:type", Function)
], Draggable.prototype, "onDrag", void 0);
let Draggable = /** @class */ (() => {
class Draggable extends Stack {
}
__decorate([
Property,
__metadata("design:type", Function)
], Draggable.prototype, "onDrag", void 0);
return Draggable;
})();
export { Draggable };
export function draggable(views, config) {
const ret = new Draggable;
ret.layoutConfig = layoutConfig().fit();

View File

@@ -25,105 +25,113 @@ var __metadata = (this && this.__metadata) || function (k, v) {
import { Stack } from './layouts';
import { Property, Superview, View } from '../ui/view';
import { layoutConfig } from '../util/index.util';
export class FlowLayoutItem extends Stack {
}
__decorate([
Property,
__metadata("design:type", String)
], FlowLayoutItem.prototype, "identifier", void 0);
export class FlowLayout extends Superview {
constructor() {
super(...arguments);
this.cachedViews = new Map;
this.ignoreDirtyCallOnce = false;
this.columnCount = 2;
this.itemCount = 0;
this.batchCount = 15;
let FlowLayoutItem = /** @class */ (() => {
class FlowLayoutItem extends Stack {
}
allSubviews() {
if (this.loadMoreView) {
return [...this.cachedViews.values(), this.loadMoreView];
}
else {
return this.cachedViews.values();
}
}
reset() {
this.cachedViews.clear();
this.itemCount = 0;
}
getItem(itemIdx) {
let view = this.renderItem(itemIdx);
view.superview = this;
this.cachedViews.set(`${itemIdx}`, view);
return view;
}
isDirty() {
if (this.ignoreDirtyCallOnce) {
__decorate([
Property,
__metadata("design:type", String)
], FlowLayoutItem.prototype, "identifier", void 0);
return FlowLayoutItem;
})();
export { FlowLayoutItem };
let FlowLayout = /** @class */ (() => {
class FlowLayout extends Superview {
constructor() {
super(...arguments);
this.cachedViews = new Map;
this.ignoreDirtyCallOnce = false;
//Ignore the dirty call once.
return false;
this.columnCount = 2;
this.itemCount = 0;
this.batchCount = 15;
}
return super.isDirty();
}
renderBunchedItems(start, length) {
this.ignoreDirtyCallOnce = true;
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
const listItem = this.getItem(start + idx);
return listItem.toModel();
});
}
toModel() {
if (this.loadMoreView) {
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
allSubviews() {
if (this.loadMoreView) {
return [...this.cachedViews.values(), this.loadMoreView];
}
else {
return this.cachedViews.values();
}
}
reset() {
this.cachedViews.clear();
this.itemCount = 0;
}
getItem(itemIdx) {
let view = this.renderItem(itemIdx);
view.superview = this;
this.cachedViews.set(`${itemIdx}`, view);
return view;
}
isDirty() {
if (this.ignoreDirtyCallOnce) {
this.ignoreDirtyCallOnce = false;
//Ignore the dirty call once.
return false;
}
return super.isDirty();
}
renderBunchedItems(start, length) {
this.ignoreDirtyCallOnce = true;
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
const listItem = this.getItem(start + idx);
return listItem.toModel();
});
}
toModel() {
if (this.loadMoreView) {
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
}
return super.toModel();
}
return super.toModel();
}
}
__decorate([
Property,
__metadata("design:type", Object)
], FlowLayout.prototype, "columnCount", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], FlowLayout.prototype, "columnSpace", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], FlowLayout.prototype, "rowSpace", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], FlowLayout.prototype, "itemCount", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], FlowLayout.prototype, "renderItem", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], FlowLayout.prototype, "batchCount", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], FlowLayout.prototype, "onLoadMore", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], FlowLayout.prototype, "loadMore", void 0);
__decorate([
Property,
__metadata("design:type", FlowLayoutItem)
], FlowLayout.prototype, "loadMoreView", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], FlowLayout.prototype, "onScroll", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], FlowLayout.prototype, "columnCount", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], FlowLayout.prototype, "columnSpace", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], FlowLayout.prototype, "rowSpace", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], FlowLayout.prototype, "itemCount", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], FlowLayout.prototype, "renderItem", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], FlowLayout.prototype, "batchCount", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], FlowLayout.prototype, "onLoadMore", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], FlowLayout.prototype, "loadMore", void 0);
__decorate([
Property,
__metadata("design:type", FlowLayoutItem)
], FlowLayout.prototype, "loadMoreView", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], FlowLayout.prototype, "onScroll", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], FlowLayout.prototype, "onScrollEnd", void 0);
return FlowLayout;
})();
export { FlowLayout };
export function flowlayout(config) {
const ret = new FlowLayout;
for (let key in config) {

View File

@@ -31,73 +31,77 @@ export var ScaleType;
ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit";
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
})(ScaleType || (ScaleType = {}));
export class Image extends View {
}
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "imageUrl", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "imagePath", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "imageRes", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "imageBase64", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Image.prototype, "scaleType", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Image.prototype, "isBlur", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "placeHolderImage", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "placeHolderImageBase64", void 0);
__decorate([
Property,
__metadata("design:type", Color
/**
* Display while image is failed to load
* It can be file name in local path
*/
)
], Image.prototype, "placeHolderColor", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "errorImage", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "errorImageBase64", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Image.prototype, "errorColor", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Image.prototype, "loadCallback", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Image.prototype, "imageScale", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], Image.prototype, "stretchInset", void 0);
let Image = /** @class */ (() => {
class Image extends View {
}
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "imageUrl", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "imagePath", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "imageRes", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "imageBase64", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Image.prototype, "scaleType", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Image.prototype, "isBlur", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "placeHolderImage", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "placeHolderImageBase64", void 0);
__decorate([
Property,
__metadata("design:type", Color
/**
* Display while image is failed to load
* It can be file name in local path
*/
)
], Image.prototype, "placeHolderColor", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "errorImage", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Image.prototype, "errorImageBase64", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Image.prototype, "errorColor", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Image.prototype, "loadCallback", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Image.prototype, "imageScale", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], Image.prototype, "stretchInset", void 0);
return Image;
})();
export { Image };
export function image(config) {
const ret = new Image;
ret.layoutConfig = layoutConfig().fit();

View File

@@ -26,63 +26,67 @@ import { View, Property } from "../ui/view";
import { Color } from "../util/color";
import { Gravity } from "../util/gravity";
import { layoutConfig } from "../util/index.util";
export class Input extends View {
getText(context) {
return this.nativeChannel(context, 'getText')();
let Input = /** @class */ (() => {
class Input extends View {
getText(context) {
return this.nativeChannel(context, 'getText')();
}
setSelection(context, start, end = start) {
return this.nativeChannel(context, 'setSelection')({
start,
end,
});
}
requestFocus(context) {
return this.nativeChannel(context, 'requestFocus')();
}
releaseFocus(context) {
return this.nativeChannel(context, 'releaseFocus')();
}
}
setSelection(context, start, end = start) {
return this.nativeChannel(context, 'setSelection')({
start,
end,
});
}
requestFocus(context) {
return this.nativeChannel(context, 'requestFocus')();
}
releaseFocus(context) {
return this.nativeChannel(context, 'releaseFocus')();
}
}
__decorate([
Property,
__metadata("design:type", String)
], Input.prototype, "text", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Input.prototype, "textColor", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Input.prototype, "textSize", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Input.prototype, "hintText", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Input.prototype, "hintTextColor", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Input.prototype, "multiline", void 0);
__decorate([
Property,
__metadata("design:type", Gravity)
], Input.prototype, "textAlignment", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Input.prototype, "onTextChange", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Input.prototype, "onFocusChange", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Input.prototype, "maxLength", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Input.prototype, "text", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Input.prototype, "textColor", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Input.prototype, "textSize", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Input.prototype, "hintText", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Input.prototype, "hintTextColor", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Input.prototype, "multiline", void 0);
__decorate([
Property,
__metadata("design:type", Gravity)
], Input.prototype, "textAlignment", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Input.prototype, "onTextChange", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Input.prototype, "onFocusChange", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Input.prototype, "maxLength", void 0);
return Input;
})();
export { Input };
export function input(config) {
const ret = new Input;
ret.layoutConfig = layoutConfig().just();

View File

@@ -29,16 +29,19 @@ export class Stack extends Group {
}
export class Root extends Stack {
}
class LinearLayout extends Group {
}
__decorate([
Property,
__metadata("design:type", Number)
], LinearLayout.prototype, "space", void 0);
__decorate([
Property,
__metadata("design:type", Gravity)
], LinearLayout.prototype, "gravity", void 0);
let LinearLayout = /** @class */ (() => {
class LinearLayout extends Group {
}
__decorate([
Property,
__metadata("design:type", Number)
], LinearLayout.prototype, "space", void 0);
__decorate([
Property,
__metadata("design:type", Gravity)
], LinearLayout.prototype, "gravity", void 0);
return LinearLayout;
})();
export class VLayout extends LinearLayout {
}
export class HLayout extends LinearLayout {

View File

@@ -25,101 +25,108 @@ var __metadata = (this && this.__metadata) || function (k, v) {
import { View, Property, Superview } from "../ui/view";
import { Stack } from "./layouts";
import { layoutConfig } from "../util/layoutconfig";
export class ListItem extends Stack {
}
__decorate([
Property,
__metadata("design:type", String)
], ListItem.prototype, "identifier", void 0);
export class List extends Superview {
constructor() {
super(...arguments);
this.cachedViews = new Map;
this.ignoreDirtyCallOnce = false;
this.itemCount = 0;
this.batchCount = 15;
let ListItem = /** @class */ (() => {
class ListItem extends Stack {
}
allSubviews() {
if (this.loadMoreView) {
return [...this.cachedViews.values(), this.loadMoreView];
}
else {
return this.cachedViews.values();
}
}
scrollToItem(context, index, config) {
var _a;
const animated = (_a = config) === null || _a === void 0 ? void 0 : _a.animated;
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
}
reset() {
this.cachedViews.clear();
this.itemCount = 0;
}
getItem(itemIdx) {
let view = this.renderItem(itemIdx);
view.superview = this;
this.cachedViews.set(`${itemIdx}`, view);
return view;
}
isDirty() {
if (this.ignoreDirtyCallOnce) {
__decorate([
Property,
__metadata("design:type", String)
], ListItem.prototype, "identifier", void 0);
return ListItem;
})();
export { ListItem };
let List = /** @class */ (() => {
class List extends Superview {
constructor() {
super(...arguments);
this.cachedViews = new Map;
this.ignoreDirtyCallOnce = false;
//Ignore the dirty call once.
return false;
this.itemCount = 0;
this.batchCount = 15;
}
return super.isDirty();
}
renderBunchedItems(start, length) {
this.ignoreDirtyCallOnce = true;
return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => {
const listItem = this.getItem(start + idx);
return listItem.toModel();
});
}
toModel() {
if (this.loadMoreView) {
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
allSubviews() {
if (this.loadMoreView) {
return [...this.cachedViews.values(), this.loadMoreView];
}
else {
return this.cachedViews.values();
}
}
scrollToItem(context, index, config) {
const animated = config === null || config === void 0 ? void 0 : config.animated;
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
}
reset() {
this.cachedViews.clear();
this.itemCount = 0;
}
getItem(itemIdx) {
let view = this.renderItem(itemIdx);
view.superview = this;
this.cachedViews.set(`${itemIdx}`, view);
return view;
}
isDirty() {
if (this.ignoreDirtyCallOnce) {
this.ignoreDirtyCallOnce = false;
//Ignore the dirty call once.
return false;
}
return super.isDirty();
}
renderBunchedItems(start, length) {
this.ignoreDirtyCallOnce = true;
return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => {
const listItem = this.getItem(start + idx);
return listItem.toModel();
});
}
toModel() {
if (this.loadMoreView) {
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
}
return super.toModel();
}
return super.toModel();
}
}
__decorate([
Property,
__metadata("design:type", Object)
], List.prototype, "itemCount", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], List.prototype, "renderItem", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], List.prototype, "batchCount", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], List.prototype, "onLoadMore", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], List.prototype, "loadMore", void 0);
__decorate([
Property,
__metadata("design:type", ListItem)
], List.prototype, "loadMoreView", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], List.prototype, "onScroll", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], List.prototype, "onScrollEnd", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], List.prototype, "scrolledPosition", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], List.prototype, "itemCount", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], List.prototype, "renderItem", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], List.prototype, "batchCount", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], List.prototype, "onLoadMore", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], List.prototype, "loadMore", void 0);
__decorate([
Property,
__metadata("design:type", ListItem)
], List.prototype, "loadMoreView", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], List.prototype, "onScroll", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], List.prototype, "onScrollEnd", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], List.prototype, "scrolledPosition", void 0);
return List;
})();
export { List };
export function list(config) {
const ret = new List;
for (let key in config) {

View File

@@ -23,18 +23,22 @@ var __metadata = (this && this.__metadata) || function (k, v) {
* limitations under the License.
*/
import { Group, Property } from '../ui/view';
export class NestedSlider extends Group {
addSlideItem(view) {
this.addChild(view);
let NestedSlider = /** @class */ (() => {
class NestedSlider extends Group {
addSlideItem(view) {
this.addChild(view);
}
slidePage(context, page, smooth = false) {
return this.nativeChannel(context, "slidePage")({ page, smooth });
}
getSlidedPage(context) {
return this.nativeChannel(context, "getSlidedPage")();
}
}
slidePage(context, page, smooth = false) {
return this.nativeChannel(context, "slidePage")({ page, smooth });
}
getSlidedPage(context) {
return this.nativeChannel(context, "getSlidedPage")();
}
}
__decorate([
Property,
__metadata("design:type", Function)
], NestedSlider.prototype, "onPageSlided", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], NestedSlider.prototype, "onPageSlided", void 0);
return NestedSlider;
})();
export { NestedSlider };

View File

@@ -9,36 +9,40 @@ var __metadata = (this && this.__metadata) || function (k, v) {
};
import { Property, Superview } from "../ui/view";
import { layoutConfig } from "../util/layoutconfig";
export class Refreshable extends Superview {
allSubviews() {
const ret = [this.content];
if (this.header) {
ret.push(this.header);
let Refreshable = /** @class */ (() => {
class Refreshable extends Superview {
allSubviews() {
const ret = [this.content];
if (this.header) {
ret.push(this.header);
}
return ret;
}
setRefreshable(context, refreshable) {
return this.nativeChannel(context, 'setRefreshable')(refreshable);
}
setRefreshing(context, refreshing) {
return this.nativeChannel(context, 'setRefreshing')(refreshing);
}
isRefreshable(context) {
return this.nativeChannel(context, 'isRefreshable')();
}
isRefreshing(context) {
return this.nativeChannel(context, 'isRefreshing')();
}
toModel() {
this.dirtyProps.content = this.content.viewId;
this.dirtyProps.header = (this.header || {}).viewId;
return super.toModel();
}
return ret;
}
setRefreshable(context, refreshable) {
return this.nativeChannel(context, 'setRefreshable')(refreshable);
}
setRefreshing(context, refreshing) {
return this.nativeChannel(context, 'setRefreshing')(refreshing);
}
isRefreshable(context) {
return this.nativeChannel(context, 'isRefreshable')();
}
isRefreshing(context) {
return this.nativeChannel(context, 'isRefreshing')();
}
toModel() {
this.dirtyProps.content = this.content.viewId;
this.dirtyProps.header = (this.header || {}).viewId;
return super.toModel();
}
}
__decorate([
Property,
__metadata("design:type", Function)
], Refreshable.prototype, "onRefresh", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Refreshable.prototype, "onRefresh", void 0);
return Refreshable;
})();
export { Refreshable };
export function refreshable(config) {
const ret = new Refreshable;
ret.layoutConfig = layoutConfig().fit();

View File

@@ -35,30 +35,34 @@ export function scroller(content, config) {
v.content = content;
});
}
export class Scroller extends Superview {
allSubviews() {
return [this.content];
let Scroller = /** @class */ (() => {
class Scroller extends Superview {
allSubviews() {
return [this.content];
}
toModel() {
this.dirtyProps.content = this.content.viewId;
return super.toModel();
}
scrollTo(context, offset, animated) {
return this.nativeChannel(context, "scrollTo")({ offset, animated });
}
scrollBy(context, offset, animated) {
return this.nativeChannel(context, "scrollBy")({ offset, animated });
}
}
toModel() {
this.dirtyProps.content = this.content.viewId;
return super.toModel();
}
scrollTo(context, offset, animated) {
return this.nativeChannel(context, "scrollTo")({ offset, animated });
}
scrollBy(context, offset, animated) {
return this.nativeChannel(context, "scrollBy")({ offset, animated });
}
}
__decorate([
Property,
__metadata("design:type", Object)
], Scroller.prototype, "contentOffset", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Scroller.prototype, "onScroll", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], Scroller.prototype, "contentOffset", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Scroller.prototype, "onScroll", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Scroller.prototype, "onScrollEnd", void 0);
return Scroller;
})();
export { Scroller };

View File

@@ -25,71 +25,79 @@ var __metadata = (this && this.__metadata) || function (k, v) {
import { Superview, View, Property } from "../ui/view";
import { Stack } from "./layouts";
import { layoutConfig } from "../util/layoutconfig";
export class SlideItem extends Stack {
}
__decorate([
Property,
__metadata("design:type", String)
], SlideItem.prototype, "identifier", void 0);
export class Slider extends Superview {
constructor() {
super(...arguments);
this.cachedViews = new Map;
this.ignoreDirtyCallOnce = false;
this.itemCount = 0;
this.batchCount = 3;
let SlideItem = /** @class */ (() => {
class SlideItem extends Stack {
}
allSubviews() {
return this.cachedViews.values();
}
getItem(itemIdx) {
let view = this.renderPage(itemIdx);
view.superview = this;
this.cachedViews.set(`${itemIdx}`, view);
return view;
}
isDirty() {
if (this.ignoreDirtyCallOnce) {
__decorate([
Property,
__metadata("design:type", String)
], SlideItem.prototype, "identifier", void 0);
return SlideItem;
})();
export { SlideItem };
let Slider = /** @class */ (() => {
class Slider extends Superview {
constructor() {
super(...arguments);
this.cachedViews = new Map;
this.ignoreDirtyCallOnce = false;
//Ignore the dirty call once.
return false;
this.itemCount = 0;
this.batchCount = 3;
}
allSubviews() {
return this.cachedViews.values();
}
getItem(itemIdx) {
let view = this.renderPage(itemIdx);
view.superview = this;
this.cachedViews.set(`${itemIdx}`, view);
return view;
}
isDirty() {
if (this.ignoreDirtyCallOnce) {
this.ignoreDirtyCallOnce = false;
//Ignore the dirty call once.
return false;
}
return super.isDirty();
}
renderBunchedItems(start, length) {
this.ignoreDirtyCallOnce = true;
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
const slideItem = this.getItem(start + idx);
return slideItem.toModel();
});
}
slidePage(context, page, smooth = false) {
return this.nativeChannel(context, "slidePage")({ page, smooth });
}
getSlidedPage(context) {
return this.nativeChannel(context, "getSlidedPage")();
}
return super.isDirty();
}
renderBunchedItems(start, length) {
this.ignoreDirtyCallOnce = true;
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
const slideItem = this.getItem(start + idx);
return slideItem.toModel();
});
}
slidePage(context, page, smooth = false) {
return this.nativeChannel(context, "slidePage")({ page, smooth });
}
getSlidedPage(context) {
return this.nativeChannel(context, "getSlidedPage")();
}
}
__decorate([
Property,
__metadata("design:type", Object)
], Slider.prototype, "itemCount", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Slider.prototype, "renderPage", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], Slider.prototype, "batchCount", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Slider.prototype, "onPageSlided", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Slider.prototype, "loop", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], Slider.prototype, "itemCount", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Slider.prototype, "renderPage", void 0);
__decorate([
Property,
__metadata("design:type", Object)
], Slider.prototype, "batchCount", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Slider.prototype, "onPageSlided", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Slider.prototype, "loop", void 0);
return Slider;
})();
export { Slider };
export function slider(config) {
const ret = new Slider;
for (let key in config) {

View File

@@ -25,28 +25,32 @@ var __metadata = (this && this.__metadata) || function (k, v) {
import { View, Property } from "../ui/view";
import { Color } from "../util/color";
import { layoutConfig } from "../util/index.util";
export class Switch extends View {
}
__decorate([
Property,
__metadata("design:type", Boolean)
], Switch.prototype, "state", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Switch.prototype, "onSwitch", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Switch.prototype, "offTintColor", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Switch.prototype, "onTintColor", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Switch.prototype, "thumbTintColor", void 0);
let Switch = /** @class */ (() => {
class Switch extends View {
}
__decorate([
Property,
__metadata("design:type", Boolean)
], Switch.prototype, "state", void 0);
__decorate([
Property,
__metadata("design:type", Function)
], Switch.prototype, "onSwitch", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Switch.prototype, "offTintColor", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Switch.prototype, "onTintColor", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Switch.prototype, "thumbTintColor", void 0);
return Switch;
})();
export { Switch };
export function switchView(config) {
const ret = new Switch;
ret.layoutConfig = layoutConfig().just();

View File

@@ -33,64 +33,68 @@ export var TruncateAt;
TruncateAt[TruncateAt["Start"] = 2] = "Start";
TruncateAt[TruncateAt["Clip"] = 3] = "Clip";
})(TruncateAt || (TruncateAt = {}));
export class Text extends View {
}
__decorate([
Property,
__metadata("design:type", String)
], Text.prototype, "text", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Text.prototype, "textColor", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "textSize", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "maxLines", void 0);
__decorate([
Property,
__metadata("design:type", Gravity)
], Text.prototype, "textAlignment", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Text.prototype, "fontStyle", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Text.prototype, "font", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "maxWidth", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "maxHeight", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "lineSpacing", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Text.prototype, "strikethrough", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Text.prototype, "underline", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Text.prototype, "htmlText", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "truncateAt", void 0);
let Text = /** @class */ (() => {
class Text extends View {
}
__decorate([
Property,
__metadata("design:type", String)
], Text.prototype, "text", void 0);
__decorate([
Property,
__metadata("design:type", Color)
], Text.prototype, "textColor", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "textSize", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "maxLines", void 0);
__decorate([
Property,
__metadata("design:type", Gravity)
], Text.prototype, "textAlignment", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Text.prototype, "fontStyle", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Text.prototype, "font", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "maxWidth", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "maxHeight", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "lineSpacing", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Text.prototype, "strikethrough", void 0);
__decorate([
Property,
__metadata("design:type", Boolean)
], Text.prototype, "underline", void 0);
__decorate([
Property,
__metadata("design:type", String)
], Text.prototype, "htmlText", void 0);
__decorate([
Property,
__metadata("design:type", Number)
], Text.prototype, "truncateAt", void 0);
return Text;
})();
export { Text };
export function text(config) {
const ret = new Text;
ret.layoutConfig = layoutConfig().fit();