feat:Android LinearNode setBaselineAligned false

This commit is contained in:
刘涛
2020-07-03 16:53:31 +08:00
committed by osborn
parent ae5ac30fb6
commit 787ea71862
24 changed files with 4510 additions and 4769 deletions

View File

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

View File

@@ -25,113 +25,105 @@ 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';
let FlowLayoutItem = /** @class */ (() => {
class FlowLayoutItem extends Stack {
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;
}
__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;
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;
this.columnCount = 2;
this.itemCount = 0;
this.batchCount = 15;
}
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();
//Ignore the dirty call once.
return false;
}
return super.isDirty();
}
__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 };
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();
}
}
__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);
export function flowlayout(config) {
const ret = new FlowLayout;
for (let key in config) {

View File

@@ -31,77 +31,73 @@ export var ScaleType;
ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit";
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
})(ScaleType || (ScaleType = {}));
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 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);
export function image(config) {
const ret = new Image;
ret.layoutConfig = layoutConfig().fit();

View File

@@ -26,71 +26,67 @@ import { View, Property } from "../ui/view";
import { Color } from "../util/color";
import { Gravity } from "../util/gravity";
import { layoutConfig } from "../util/index.util";
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')();
}
export class Input extends View {
getText(context) {
return this.nativeChannel(context, 'getText')();
}
__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", Number)
], Input.prototype, "inputType", 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 };
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", Number)
], Input.prototype, "inputType", 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);
export var InputType;
(function (InputType) {
InputType[InputType["Default"] = 0] = "Default";

View File

@@ -29,19 +29,16 @@ export class Stack extends Group {
}
export class Root extends Stack {
}
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;
})();
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);
export class VLayout extends LinearLayout {
}
export class HLayout extends LinearLayout {

View File

@@ -25,108 +25,100 @@ var __metadata = (this && this.__metadata) || function (k, v) {
import { View, Property, Superview } from "../ui/view";
import { Stack } from "./layouts";
import { layoutConfig } from "../util/layoutconfig";
let ListItem = /** @class */ (() => {
class ListItem extends Stack {
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;
}
__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;
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;
this.itemCount = 0;
this.batchCount = 15;
}
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();
//Ignore the dirty call once.
return false;
}
return super.isDirty();
}
__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 };
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();
}
}
__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);
export function list(config) {
const ret = new List;
for (let key in config) {

View File

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

View File

@@ -9,40 +9,36 @@ var __metadata = (this && this.__metadata) || function (k, v) {
};
import { Property, Superview } from "../ui/view";
import { layoutConfig } from "../util/layoutconfig";
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();
export class Refreshable extends Superview {
allSubviews() {
const ret = [this.content];
if (this.header) {
ret.push(this.header);
}
return ret;
}
__decorate([
Property,
__metadata("design:type", Function)
], Refreshable.prototype, "onRefresh", void 0);
return Refreshable;
})();
export { Refreshable };
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);
export function refreshable(config) {
const ret = new Refreshable;
ret.layoutConfig = layoutConfig().fit();

View File

@@ -35,34 +35,30 @@ export function scroller(content, config) {
v.content = 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 });
}
export class Scroller extends Superview {
allSubviews() {
return [this.content];
}
__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 };
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);

View File

@@ -25,79 +25,71 @@ var __metadata = (this && this.__metadata) || function (k, v) {
import { Superview, View, Property } from "../ui/view";
import { Stack } from "./layouts";
import { layoutConfig } from "../util/layoutconfig";
let SlideItem = /** @class */ (() => {
class SlideItem extends Stack {
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;
}
__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;
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;
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")();
//Ignore the dirty call once.
return false;
}
return super.isDirty();
}
__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 };
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);
export function slider(config) {
const ret = new Slider;
for (let key in config) {

View File

@@ -25,32 +25,28 @@ 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";
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 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);
export function switchView(config) {
const ret = new Switch;
ret.layoutConfig = layoutConfig().just();

View File

@@ -33,68 +33,64 @@ export var TruncateAt;
TruncateAt[TruncateAt["Start"] = 2] = "Start";
TruncateAt[TruncateAt["Clip"] = 3] = "Clip";
})(TruncateAt || (TruncateAt = {}));
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 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);
export function text(config) {
const ret = new Text;
ret.layoutConfig = layoutConfig().fit();