2019-12-23 15:29:38 +08:00
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
|
|
2021-04-23 19:05:33 +08:00
|
|
|
|
function obj2Model(obj, convertor) {
|
|
|
|
|
if (obj instanceof Function) {
|
|
|
|
|
return convertor(obj);
|
|
|
|
|
}
|
|
|
|
|
else if (obj instanceof Array) {
|
|
|
|
|
return obj.map(e => obj2Model(e, convertor));
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
|
|
|
|
else if (obj instanceof Object) {
|
|
|
|
|
if (Reflect.has(obj, 'toModel') && Reflect.get(obj, 'toModel') instanceof Function) {
|
|
|
|
|
obj = Reflect.apply(Reflect.get(obj, 'toModel'), obj, []);
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
for (let key in obj) {
|
|
|
|
|
const val = Reflect.get(obj, key);
|
2021-04-23 19:05:33 +08:00
|
|
|
|
Reflect.set(obj, key, obj2Model(val, convertor));
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class Mutable {
|
|
|
|
|
constructor(v) {
|
|
|
|
|
this.binders = new Set;
|
|
|
|
|
this.get = () => {
|
|
|
|
|
return this.val;
|
|
|
|
|
};
|
|
|
|
|
this.set = (v) => {
|
|
|
|
|
this.val = v;
|
|
|
|
|
this.binders.forEach(e => {
|
|
|
|
|
Reflect.apply(e, undefined, [this.val]);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
this.val = v;
|
|
|
|
|
}
|
|
|
|
|
bind(binder) {
|
|
|
|
|
this.binders.add(binder);
|
|
|
|
|
Reflect.apply(binder, undefined, [this.val]);
|
|
|
|
|
}
|
|
|
|
|
static of(v) {
|
|
|
|
|
return new Mutable(v);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copyright [2019] [Doric.Pub]
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
let __uniqueId__ = 0;
|
|
|
|
|
function uniqueId(prefix) {
|
|
|
|
|
return `__${prefix}_${__uniqueId__++}__`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function toString(message) {
|
|
|
|
|
if (message instanceof Function) {
|
|
|
|
|
return message.toString();
|
|
|
|
|
}
|
|
|
|
|
else if (message instanceof Object) {
|
|
|
|
|
try {
|
|
|
|
|
return JSON.stringify(message);
|
|
|
|
|
}
|
|
|
|
|
catch (e) {
|
|
|
|
|
return message.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (message === undefined) {
|
|
|
|
|
return "undefined";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return message.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function log(...args) {
|
|
|
|
|
let out = "";
|
|
|
|
|
for (let i = 0; i < arguments.length; i++) {
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
out += ',';
|
|
|
|
|
}
|
|
|
|
|
out += toString(arguments[i]);
|
|
|
|
|
}
|
|
|
|
|
nativeLog('d', out);
|
|
|
|
|
}
|
|
|
|
|
function loge(...message) {
|
|
|
|
|
let out = "";
|
|
|
|
|
for (let i = 0; i < arguments.length; i++) {
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
out += ',';
|
|
|
|
|
}
|
|
|
|
|
out += toString(arguments[i]);
|
|
|
|
|
}
|
|
|
|
|
nativeLog('e', out);
|
|
|
|
|
}
|
|
|
|
|
function logw(...message) {
|
|
|
|
|
let out = "";
|
|
|
|
|
for (let i = 0; i < arguments.length; i++) {
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
out += ',';
|
|
|
|
|
}
|
|
|
|
|
out += toString(arguments[i]);
|
|
|
|
|
}
|
|
|
|
|
nativeLog('w', out);
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$g = (undefined && undefined.__metadata) || function (k, v) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
2021-03-03 10:08:48 +08:00
|
|
|
|
const PROP_CONSIST = 1;
|
|
|
|
|
const PROP_INCONSIST = 2;
|
2021-05-14 19:24:07 +08:00
|
|
|
|
const PROP_KEY_VIEW_TYPE = "ViewType";
|
2019-12-23 15:29:38 +08:00
|
|
|
|
function Property(target, propKey) {
|
2021-03-03 10:08:48 +08:00
|
|
|
|
Reflect.defineMetadata(propKey, PROP_CONSIST, target);
|
|
|
|
|
}
|
|
|
|
|
function InconsistProperty(target, propKey) {
|
|
|
|
|
Reflect.defineMetadata(propKey, PROP_INCONSIST, target);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2021-05-14 19:24:07 +08:00
|
|
|
|
function ViewComponent(constructor) {
|
|
|
|
|
const name = Reflect.getMetadata(PROP_KEY_VIEW_TYPE, constructor) || Object.getPrototypeOf(constructor).name;
|
|
|
|
|
Reflect.defineMetadata(PROP_KEY_VIEW_TYPE, name, constructor);
|
|
|
|
|
}
|
2021-09-02 11:39:51 +08:00
|
|
|
|
class Ref {
|
|
|
|
|
set current(v) {
|
|
|
|
|
this.view = v;
|
|
|
|
|
}
|
|
|
|
|
get current() {
|
|
|
|
|
if (!!!this.view) {
|
|
|
|
|
throw new Error("Ref is empty");
|
|
|
|
|
}
|
|
|
|
|
return this.view;
|
|
|
|
|
}
|
2021-12-03 15:37:42 +08:00
|
|
|
|
apply(config) {
|
|
|
|
|
if (this.view) {
|
|
|
|
|
this.view.apply(config);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-02 11:39:51 +08:00
|
|
|
|
}
|
2021-09-03 16:48:24 +08:00
|
|
|
|
function createRef() {
|
2021-09-02 11:39:51 +08:00
|
|
|
|
return new Ref;
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class View {
|
2023-03-09 10:55:32 +08:00
|
|
|
|
callback2Id(f) {
|
|
|
|
|
const id = uniqueId('Function');
|
|
|
|
|
this.callbacks.set(id, f);
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
id2Callback(id) {
|
|
|
|
|
let f = this.callbacks.get(id);
|
|
|
|
|
if (f === undefined) {
|
|
|
|
|
f = Reflect.get(this, id);
|
|
|
|
|
}
|
|
|
|
|
return f;
|
|
|
|
|
}
|
|
|
|
|
findViewByTag(tag) {
|
|
|
|
|
if (tag === this.tag) {
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
constructor() {
|
|
|
|
|
this.width = 0;
|
|
|
|
|
this.height = 0;
|
|
|
|
|
this.x = 0;
|
|
|
|
|
this.y = 0;
|
|
|
|
|
this.viewId = uniqueId('ViewId');
|
|
|
|
|
this.callbacks = new Map;
|
|
|
|
|
/** Anchor end*/
|
|
|
|
|
this.__dirty_props__ = {};
|
|
|
|
|
this.nativeViewModel = {
|
|
|
|
|
id: this.viewId,
|
2021-05-14 13:14:54 +08:00
|
|
|
|
type: this.viewType(),
|
2020-07-03 16:53:31 +08:00
|
|
|
|
props: this.__dirty_props__,
|
|
|
|
|
};
|
|
|
|
|
return new Proxy(this, {
|
|
|
|
|
get: (target, p, receiver) => {
|
|
|
|
|
return Reflect.get(target, p, receiver);
|
|
|
|
|
},
|
|
|
|
|
set: (target, p, v, receiver) => {
|
|
|
|
|
const oldV = Reflect.get(target, p, receiver);
|
|
|
|
|
const ret = Reflect.set(target, p, v, receiver);
|
2021-03-03 10:08:48 +08:00
|
|
|
|
if (Reflect.getMetadata(p, target) === PROP_CONSIST && oldV !== v) {
|
|
|
|
|
receiver.onPropertyChanged(p.toString(), oldV, v);
|
|
|
|
|
}
|
|
|
|
|
else if (Reflect.getMetadata(p, target) === PROP_INCONSIST) {
|
2020-07-03 16:53:31 +08:00
|
|
|
|
receiver.onPropertyChanged(p.toString(), oldV, v);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
return ret;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
/** Anchor start*/
|
|
|
|
|
get left() {
|
|
|
|
|
return this.x;
|
|
|
|
|
}
|
|
|
|
|
set left(v) {
|
|
|
|
|
this.x = v;
|
|
|
|
|
}
|
|
|
|
|
get right() {
|
|
|
|
|
return this.x + this.width;
|
|
|
|
|
}
|
|
|
|
|
set right(v) {
|
|
|
|
|
this.x = v - this.width;
|
|
|
|
|
}
|
|
|
|
|
get top() {
|
|
|
|
|
return this.y;
|
|
|
|
|
}
|
|
|
|
|
set top(v) {
|
|
|
|
|
this.y = v;
|
|
|
|
|
}
|
|
|
|
|
get bottom() {
|
|
|
|
|
return this.y + this.height;
|
|
|
|
|
}
|
|
|
|
|
set bottom(v) {
|
|
|
|
|
this.y = v - this.height;
|
|
|
|
|
}
|
|
|
|
|
get centerX() {
|
|
|
|
|
return this.x + this.width / 2;
|
|
|
|
|
}
|
|
|
|
|
get centerY() {
|
|
|
|
|
return this.y + this.height / 2;
|
|
|
|
|
}
|
|
|
|
|
set centerX(v) {
|
|
|
|
|
this.x = v - this.width / 2;
|
|
|
|
|
}
|
|
|
|
|
set centerY(v) {
|
|
|
|
|
this.y = v - this.height / 2;
|
|
|
|
|
}
|
|
|
|
|
get dirtyProps() {
|
|
|
|
|
return this.__dirty_props__;
|
|
|
|
|
}
|
2021-05-14 13:14:54 +08:00
|
|
|
|
viewType() {
|
2021-05-14 19:24:07 +08:00
|
|
|
|
const viewType = Reflect.getMetadata(PROP_KEY_VIEW_TYPE, this.constructor);
|
|
|
|
|
return viewType || this.constructor.name;
|
2021-05-14 13:14:54 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
onPropertyChanged(propKey, oldV, newV) {
|
|
|
|
|
if (newV instanceof Function) {
|
|
|
|
|
newV = this.callback2Id(newV);
|
2020-05-16 18:58:32 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
else {
|
2021-04-23 19:05:33 +08:00
|
|
|
|
newV = obj2Model(newV, (v) => this.callback2Id(v));
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
this.__dirty_props__[propKey] = newV;
|
|
|
|
|
}
|
|
|
|
|
clean() {
|
|
|
|
|
for (const key in this.__dirty_props__) {
|
|
|
|
|
if (Reflect.has(this.__dirty_props__, key)) {
|
|
|
|
|
Reflect.deleteProperty(this.__dirty_props__, key);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
isDirty() {
|
|
|
|
|
return Reflect.ownKeys(this.__dirty_props__).length !== 0;
|
|
|
|
|
}
|
|
|
|
|
responseCallback(id, ...args) {
|
|
|
|
|
const f = this.id2Callback(id);
|
|
|
|
|
if (f instanceof Function) {
|
|
|
|
|
const argumentsList = [];
|
|
|
|
|
for (let i = 1; i < arguments.length; i++) {
|
|
|
|
|
argumentsList.push(arguments[i]);
|
2020-05-16 18:58:32 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
return Reflect.apply(f, this, argumentsList);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
else {
|
|
|
|
|
loge(`Cannot find callback:${id} for ${JSON.stringify(this.toModel())}`);
|
2020-05-16 18:58:32 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
toModel() {
|
|
|
|
|
return this.nativeViewModel;
|
|
|
|
|
}
|
|
|
|
|
let(block) {
|
|
|
|
|
block(this);
|
|
|
|
|
}
|
|
|
|
|
also(block) {
|
|
|
|
|
block(this);
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
apply(config) {
|
|
|
|
|
for (let key in config) {
|
|
|
|
|
Reflect.set(this, key, Reflect.get(config, key, config), this);
|
2020-05-16 18:58:32 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
in(group) {
|
|
|
|
|
group.addChild(this);
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
nativeChannel(context, name) {
|
|
|
|
|
let thisView = this;
|
|
|
|
|
return function (args = undefined) {
|
|
|
|
|
const viewIds = [];
|
|
|
|
|
while (thisView != undefined) {
|
|
|
|
|
viewIds.push(thisView.viewId);
|
|
|
|
|
thisView = thisView.superview;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
const params = {
|
|
|
|
|
viewIds: viewIds.reverse(),
|
|
|
|
|
name,
|
|
|
|
|
args,
|
2019-12-23 15:29:38 +08:00
|
|
|
|
};
|
2020-07-03 16:53:31 +08:00
|
|
|
|
return context.callNative('shader', 'command', params);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
getWidth(context) {
|
|
|
|
|
return this.nativeChannel(context, 'getWidth')();
|
|
|
|
|
}
|
|
|
|
|
getHeight(context) {
|
|
|
|
|
return this.nativeChannel(context, 'getHeight')();
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
getX(context) {
|
|
|
|
|
return this.nativeChannel(context, 'getX')();
|
|
|
|
|
}
|
|
|
|
|
getY(context) {
|
|
|
|
|
return this.nativeChannel(context, 'getY')();
|
|
|
|
|
}
|
|
|
|
|
getLocationOnScreen(context) {
|
|
|
|
|
return this.nativeChannel(context, "getLocationOnScreen")();
|
|
|
|
|
}
|
2021-08-31 12:49:47 +08:00
|
|
|
|
set props(props) {
|
|
|
|
|
this.apply(props);
|
|
|
|
|
}
|
2021-09-02 11:39:51 +08:00
|
|
|
|
set parent(v) {
|
|
|
|
|
this.in(v);
|
|
|
|
|
}
|
|
|
|
|
set ref(ref) {
|
|
|
|
|
ref.current = this;
|
2022-09-17 03:51:08 +08:00
|
|
|
|
this._ref = ref;
|
2021-09-02 11:39:51 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
doAnimation(context, animation) {
|
|
|
|
|
return this.nativeChannel(context, "doAnimation")(animation.toModel()).then((args) => {
|
|
|
|
|
for (let key in args) {
|
|
|
|
|
Reflect.set(this, key, Reflect.get(args, key, args), this);
|
|
|
|
|
Reflect.deleteProperty(this.__dirty_props__, key);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-04-22 11:46:24 +08:00
|
|
|
|
clearAnimation(context, animation) {
|
|
|
|
|
return this.nativeChannel(context, "clearAnimation")(animation.id).then(() => {
|
2021-04-21 18:59:29 +08:00
|
|
|
|
this.__dirty_props__.translationX = this.translationX || 0;
|
|
|
|
|
this.__dirty_props__.translationY = this.translationY || 0;
|
|
|
|
|
this.__dirty_props__.scaleX = this.scaleX || 1;
|
|
|
|
|
this.__dirty_props__.scaleY = this.scaleY || 1;
|
|
|
|
|
this.__dirty_props__.rotation = this.rotation || 0;
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-04-22 11:46:24 +08:00
|
|
|
|
cancelAnimation(context, animation) {
|
2021-04-22 14:54:25 +08:00
|
|
|
|
return this.nativeChannel(context, "cancelAnimation")(animation.id).then((args) => {
|
|
|
|
|
for (let key in args) {
|
|
|
|
|
Reflect.set(this, key, Reflect.get(args, key, args), this);
|
2021-04-23 17:57:34 +08:00
|
|
|
|
Reflect.deleteProperty(this.__dirty_props__, key);
|
2021-04-22 14:54:25 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2021-04-22 11:46:24 +08:00
|
|
|
|
}
|
2022-07-04 14:13:41 +08:00
|
|
|
|
static isViewClass() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "width", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "height", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "x", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "y", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "backgroundColor", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "corners", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "border", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "shadow", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "alpha", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Boolean)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "hidden", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "layoutConfig", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "onClick", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "translationX", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "translationY", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "scaleX", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "scaleY", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "pivotX", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "pivotY", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "rotation", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "rotationX", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "rotationY", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "perspective", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$g([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$g("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], View.prototype, "flexConfig", void 0);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
class Superview extends View {
|
|
|
|
|
subviewById(id) {
|
|
|
|
|
for (let v of this.allSubviews()) {
|
|
|
|
|
if (v.viewId === id) {
|
|
|
|
|
return v;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-04 10:04:40 +08:00
|
|
|
|
findViewByTag(tag) {
|
|
|
|
|
if (tag === this.tag) {
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
return this.findViewTraversal(this, tag);
|
|
|
|
|
}
|
|
|
|
|
findViewTraversal(view, tag) {
|
|
|
|
|
for (let v of view.allSubviews()) {
|
|
|
|
|
let find = v.findViewByTag(tag);
|
|
|
|
|
if (find) {
|
|
|
|
|
return find;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
isDirty() {
|
|
|
|
|
if (super.isDirty()) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
for (const v of this.allSubviews()) {
|
|
|
|
|
if (v.isDirty()) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
clean() {
|
|
|
|
|
for (let v of this.allSubviews()) {
|
|
|
|
|
v.clean();
|
|
|
|
|
}
|
|
|
|
|
super.clean();
|
|
|
|
|
}
|
|
|
|
|
toModel() {
|
|
|
|
|
const subviews = [];
|
|
|
|
|
for (let v of this.allSubviews()) {
|
|
|
|
|
if (v != undefined) {
|
2021-06-24 15:10:00 +08:00
|
|
|
|
if (v.superview && v.superview !== this) {
|
|
|
|
|
//It had been added to another view, need to be marked totally
|
|
|
|
|
for (let key in v) {
|
|
|
|
|
if (Reflect.getMetadata(key, v) === PROP_CONSIST || Reflect.getMetadata(key, v) === PROP_INCONSIST) {
|
|
|
|
|
v.onPropertyChanged(key, undefined, Reflect.get(v, key));
|
|
|
|
|
}
|
2021-06-25 16:36:31 +08:00
|
|
|
|
if (v instanceof Superview) {
|
|
|
|
|
for (const subview of v.allSubviews()) {
|
|
|
|
|
subview.superview = {};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (v instanceof Group) {
|
|
|
|
|
v.dirtyProps.children = v.children.map(e => e.viewId);
|
|
|
|
|
}
|
2021-06-24 15:10:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
v.superview = this;
|
|
|
|
|
if (v.isDirty()) {
|
|
|
|
|
subviews.push(v.toModel());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.dirtyProps.subviews = subviews;
|
|
|
|
|
return super.toModel();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class Group extends Superview {
|
|
|
|
|
constructor() {
|
|
|
|
|
super(...arguments);
|
|
|
|
|
this.children = new Proxy([], {
|
|
|
|
|
set: (target, index, value) => {
|
|
|
|
|
const ret = Reflect.set(target, index, value);
|
|
|
|
|
// Let getDirty return true
|
2021-06-03 18:24:02 +08:00
|
|
|
|
this.dirtyProps.children = target.map(e => e.viewId);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
allSubviews() {
|
|
|
|
|
return this.children;
|
|
|
|
|
}
|
|
|
|
|
addChild(view) {
|
|
|
|
|
this.children.push(view);
|
|
|
|
|
}
|
2020-05-15 17:58:25 +08:00
|
|
|
|
removeChild(view) {
|
|
|
|
|
const ret = this.children.filter(e => e !== view);
|
|
|
|
|
this.children.length = 0;
|
|
|
|
|
ret.forEach(e => this.addChild(e));
|
|
|
|
|
}
|
|
|
|
|
removeAllChildren() {
|
|
|
|
|
this.children.length = 0;
|
|
|
|
|
}
|
2021-09-03 13:42:25 +08:00
|
|
|
|
addInnerElement(e) {
|
|
|
|
|
if (e instanceof Array) {
|
|
|
|
|
e.forEach(e => this.addInnerElement(e));
|
|
|
|
|
}
|
|
|
|
|
else if (e instanceof View) {
|
|
|
|
|
this.addChild(e);
|
|
|
|
|
}
|
2022-07-20 20:58:43 +08:00
|
|
|
|
else if (!!e) {
|
2021-09-03 13:42:25 +08:00
|
|
|
|
loge(`Not allowed to add ${typeof e}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
set innerElement(e) {
|
|
|
|
|
this.addInnerElement(e);
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2022-08-25 10:42:56 +08:00
|
|
|
|
__decorate$g([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$g("design:type", Object)
|
|
|
|
|
], Group.prototype, "padding", void 0);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
|
2021-04-23 17:57:34 +08:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.LayoutSpec = void 0;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
(function (LayoutSpec) {
|
|
|
|
|
/**
|
|
|
|
|
* Depends on what's been set on width or height.
|
|
|
|
|
*/
|
|
|
|
|
LayoutSpec[LayoutSpec["JUST"] = 0] = "JUST";
|
|
|
|
|
/**
|
|
|
|
|
* Depends on it's content.
|
|
|
|
|
*/
|
|
|
|
|
LayoutSpec[LayoutSpec["FIT"] = 1] = "FIT";
|
|
|
|
|
/**
|
|
|
|
|
* Extend as much as parent let it take.
|
|
|
|
|
*/
|
|
|
|
|
LayoutSpec[LayoutSpec["MOST"] = 2] = "MOST";
|
|
|
|
|
})(exports.LayoutSpec || (exports.LayoutSpec = {}));
|
|
|
|
|
class LayoutConfigImpl {
|
|
|
|
|
fit() {
|
|
|
|
|
this.widthSpec = exports.LayoutSpec.FIT;
|
|
|
|
|
this.heightSpec = exports.LayoutSpec.FIT;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2021-05-14 19:32:19 +08:00
|
|
|
|
fitWidth() {
|
|
|
|
|
this.widthSpec = exports.LayoutSpec.FIT;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
fitHeight() {
|
|
|
|
|
this.heightSpec = exports.LayoutSpec.FIT;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
most() {
|
|
|
|
|
this.widthSpec = exports.LayoutSpec.MOST;
|
|
|
|
|
this.heightSpec = exports.LayoutSpec.MOST;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2021-05-14 19:32:19 +08:00
|
|
|
|
mostWidth() {
|
|
|
|
|
this.widthSpec = exports.LayoutSpec.MOST;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
mostHeight() {
|
2021-06-22 10:52:09 +08:00
|
|
|
|
this.heightSpec = exports.LayoutSpec.MOST;
|
2021-05-14 19:32:19 +08:00
|
|
|
|
return this;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
just() {
|
|
|
|
|
this.widthSpec = exports.LayoutSpec.JUST;
|
|
|
|
|
this.heightSpec = exports.LayoutSpec.JUST;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2021-05-14 19:32:19 +08:00
|
|
|
|
justWidth() {
|
|
|
|
|
this.widthSpec = exports.LayoutSpec.JUST;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
justHeight() {
|
|
|
|
|
this.heightSpec = exports.LayoutSpec.JUST;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
configWidth(w) {
|
|
|
|
|
this.widthSpec = w;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
configHeight(h) {
|
|
|
|
|
this.heightSpec = h;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
configMargin(m) {
|
|
|
|
|
this.margin = m;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2020-01-03 13:35:40 +08:00
|
|
|
|
configAlignment(a) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
this.alignment = a;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
configWeight(w) {
|
|
|
|
|
this.weight = w;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2020-04-11 12:20:43 +08:00
|
|
|
|
configMaxWidth(v) {
|
|
|
|
|
this.maxWidth = v;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
configMaxHeight(v) {
|
|
|
|
|
this.maxHeight = v;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
configMinWidth(v) {
|
|
|
|
|
this.minWidth = v;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
configMinHeight(v) {
|
|
|
|
|
this.minHeight = v;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
toModel() {
|
|
|
|
|
return {
|
|
|
|
|
widthSpec: this.widthSpec,
|
|
|
|
|
heightSpec: this.heightSpec,
|
|
|
|
|
margin: this.margin,
|
|
|
|
|
alignment: this.alignment ? this.alignment.toModel() : undefined,
|
|
|
|
|
weight: this.weight,
|
2022-03-22 17:04:59 +08:00
|
|
|
|
minWidth: this.minWidth,
|
|
|
|
|
maxWidth: this.maxWidth,
|
|
|
|
|
minHeight: this.minHeight,
|
|
|
|
|
maxHeight: this.maxHeight
|
2019-12-23 15:29:38 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function layoutConfig() {
|
|
|
|
|
return new LayoutConfigImpl;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$f = (undefined && undefined.__metadata) || function (k, v) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
|
|
|
|
class Stack extends Group {
|
|
|
|
|
}
|
|
|
|
|
class Root extends Stack {
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class LinearLayout extends Group {
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$f([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$f("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], LinearLayout.prototype, "space", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$f([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$f("design:type", Gravity)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], LinearLayout.prototype, "gravity", void 0);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
class VLayout extends LinearLayout {
|
|
|
|
|
}
|
|
|
|
|
class HLayout extends LinearLayout {
|
|
|
|
|
}
|
2020-01-04 19:13:15 +08:00
|
|
|
|
function stack(views, config) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
const ret = new Stack;
|
|
|
|
|
ret.layoutConfig = layoutConfig().fit();
|
|
|
|
|
for (let v of views) {
|
|
|
|
|
ret.addChild(v);
|
|
|
|
|
}
|
2020-01-04 19:13:15 +08:00
|
|
|
|
if (config) {
|
2021-08-31 12:49:47 +08:00
|
|
|
|
ret.apply(config);
|
2020-01-04 19:13:15 +08:00
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
2020-01-04 19:13:15 +08:00
|
|
|
|
function hlayout(views, config) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
const ret = new HLayout;
|
|
|
|
|
ret.layoutConfig = layoutConfig().fit();
|
|
|
|
|
for (let v of views) {
|
|
|
|
|
ret.addChild(v);
|
|
|
|
|
}
|
2020-01-04 19:13:15 +08:00
|
|
|
|
if (config) {
|
2021-08-31 12:49:47 +08:00
|
|
|
|
ret.apply(config);
|
2020-01-04 19:13:15 +08:00
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
2020-01-04 19:13:15 +08:00
|
|
|
|
function vlayout(views, config) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
const ret = new VLayout;
|
|
|
|
|
ret.layoutConfig = layoutConfig().fit();
|
|
|
|
|
for (let v of views) {
|
|
|
|
|
ret.addChild(v);
|
|
|
|
|
}
|
2020-01-04 19:13:15 +08:00
|
|
|
|
if (config) {
|
2021-08-31 12:49:47 +08:00
|
|
|
|
ret.apply(config);
|
2020-01-04 19:13:15 +08:00
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
2020-04-09 20:01:22 +08:00
|
|
|
|
class FlexLayout extends Group {
|
|
|
|
|
}
|
|
|
|
|
function flexlayout(views, config) {
|
|
|
|
|
const ret = new FlexLayout;
|
2020-04-10 20:41:43 +08:00
|
|
|
|
ret.layoutConfig = layoutConfig().fit();
|
2020-04-09 20:01:22 +08:00
|
|
|
|
for (let v of views) {
|
|
|
|
|
ret.addChild(v);
|
|
|
|
|
}
|
|
|
|
|
if (config) {
|
2021-08-31 12:49:47 +08:00
|
|
|
|
ret.apply(config);
|
2020-04-09 20:01:22 +08:00
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$e = (undefined && undefined.__metadata) || function (k, v) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
|
|
|
|
function NativeCall(target, propertyKey, descriptor) {
|
|
|
|
|
const originVal = descriptor.value;
|
|
|
|
|
descriptor.value = function () {
|
|
|
|
|
const ret = Reflect.apply(originVal, this, arguments);
|
|
|
|
|
return ret;
|
|
|
|
|
};
|
|
|
|
|
return descriptor;
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class Panel {
|
|
|
|
|
constructor() {
|
|
|
|
|
this.destroyed = false;
|
|
|
|
|
this.__root__ = new Root;
|
|
|
|
|
this.headviews = new Map;
|
|
|
|
|
this.onRenderFinishedCallback = [];
|
|
|
|
|
this.__rendering__ = false;
|
2023-08-03 18:58:28 +08:00
|
|
|
|
this.callingRenderFinishedCallback = false;
|
2021-07-09 17:16:30 +08:00
|
|
|
|
this.snapshotEnabled = false;
|
|
|
|
|
this.renderSnapshots = [];
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
onCreate() { }
|
|
|
|
|
onDestroy() { }
|
|
|
|
|
onShow() { }
|
|
|
|
|
onHidden() { }
|
2021-07-07 17:30:08 +08:00
|
|
|
|
onEnvChanged() {
|
|
|
|
|
this.__root__.children.length = 0;
|
|
|
|
|
this.build(this.__root__);
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
addHeadView(type, v) {
|
|
|
|
|
let map = this.headviews.get(type);
|
|
|
|
|
if (map) {
|
|
|
|
|
map.set(v.viewId, v);
|
2020-05-16 18:58:32 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
else {
|
|
|
|
|
map = new Map;
|
|
|
|
|
map.set(v.viewId, v);
|
|
|
|
|
this.headviews.set(type, map);
|
2020-05-16 18:58:32 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
allHeadViews() {
|
|
|
|
|
return this.headviews.values();
|
|
|
|
|
}
|
|
|
|
|
removeHeadView(type, v) {
|
|
|
|
|
if (this.headviews.has(type)) {
|
|
|
|
|
let map = this.headviews.get(type);
|
|
|
|
|
if (map) {
|
|
|
|
|
if (v instanceof View) {
|
|
|
|
|
map.delete(v.viewId);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
map.delete(v);
|
2020-01-09 11:17:44 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
clearHeadViews(type) {
|
|
|
|
|
if (this.headviews.has(type)) {
|
|
|
|
|
this.headviews.delete(type);
|
2020-01-09 11:17:44 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
getRootView() {
|
|
|
|
|
return this.__root__;
|
|
|
|
|
}
|
|
|
|
|
getInitData() {
|
|
|
|
|
return this.__data__;
|
|
|
|
|
}
|
|
|
|
|
__init__(data) {
|
|
|
|
|
if (data) {
|
|
|
|
|
this.__data__ = JSON.parse(data);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
__onCreate__() {
|
|
|
|
|
this.onCreate();
|
|
|
|
|
}
|
|
|
|
|
__onDestroy__() {
|
|
|
|
|
this.destroyed = true;
|
|
|
|
|
this.onDestroy();
|
|
|
|
|
}
|
|
|
|
|
__onShow__() {
|
|
|
|
|
this.onShow();
|
|
|
|
|
}
|
|
|
|
|
__onHidden__() {
|
|
|
|
|
this.onHidden();
|
|
|
|
|
}
|
|
|
|
|
__build__(frame) {
|
|
|
|
|
this.__root__.width = frame.width;
|
|
|
|
|
this.__root__.height = frame.height;
|
|
|
|
|
this.__root__.children.length = 0;
|
|
|
|
|
this.build(this.__root__);
|
|
|
|
|
}
|
2021-07-07 17:30:08 +08:00
|
|
|
|
__onEnvChanged__() {
|
|
|
|
|
this.onEnvChanged();
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
__response__(viewIds, callbackId) {
|
|
|
|
|
const v = this.retrospectView(viewIds);
|
|
|
|
|
if (v === undefined) {
|
|
|
|
|
loge(`Cannot find view for ${viewIds}`);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
else {
|
|
|
|
|
const argumentsList = [callbackId];
|
|
|
|
|
for (let i = 2; i < arguments.length; i++) {
|
|
|
|
|
argumentsList.push(arguments[i]);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
return Reflect.apply(v.responseCallback, v, argumentsList);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
retrospectView(ids) {
|
|
|
|
|
return ids.reduce((acc, cur) => {
|
|
|
|
|
if (acc === undefined) {
|
|
|
|
|
if (cur === this.__root__.viewId) {
|
|
|
|
|
return this.__root__;
|
|
|
|
|
}
|
|
|
|
|
for (let map of this.headviews.values()) {
|
|
|
|
|
if (map.has(cur)) {
|
|
|
|
|
return map.get(cur);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return undefined;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
|
|
|
|
else {
|
2020-07-03 16:53:31 +08:00
|
|
|
|
if (Reflect.has(acc, "subviewById")) {
|
|
|
|
|
return Reflect.apply(Reflect.get(acc, "subviewById"), acc, [cur]);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
return acc;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}, undefined);
|
|
|
|
|
}
|
2021-07-09 17:16:30 +08:00
|
|
|
|
__renderSnapshotDepth__() {
|
|
|
|
|
return this.renderSnapshots.length;
|
|
|
|
|
}
|
|
|
|
|
__restoreRenderSnapshot__(idx) {
|
|
|
|
|
return [...this.renderSnapshots].slice(0, idx);
|
|
|
|
|
}
|
|
|
|
|
__enableSnapshot__() {
|
|
|
|
|
this.snapshotEnabled = true;
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
nativeRender(model) {
|
2021-07-09 17:16:30 +08:00
|
|
|
|
if (this.snapshotEnabled) {
|
|
|
|
|
this.renderSnapshots.push(JSON.parse(JSON.stringify(model)));
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
return this.context.callNative("shader", "render", model);
|
|
|
|
|
}
|
|
|
|
|
hookBeforeNativeCall() {
|
|
|
|
|
}
|
|
|
|
|
hookAfterNativeCall() {
|
|
|
|
|
if (this.destroyed) {
|
|
|
|
|
return;
|
2020-05-06 17:34:48 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
const promises = [];
|
2021-09-16 12:52:02 +08:00
|
|
|
|
if (this.__root__.isDirty()) {
|
|
|
|
|
const model = this.__root__.toModel();
|
|
|
|
|
promises.push(this.nativeRender(model));
|
|
|
|
|
this.__root__.clean();
|
|
|
|
|
}
|
|
|
|
|
for (let map of this.headviews.values()) {
|
|
|
|
|
for (let v of map.values()) {
|
|
|
|
|
if (v.isDirty()) {
|
|
|
|
|
const model = v.toModel();
|
|
|
|
|
promises.push(this.nativeRender(model));
|
|
|
|
|
v.clean();
|
2019-12-25 14:37:14 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-16 12:52:02 +08:00
|
|
|
|
}
|
|
|
|
|
if (this.__rendering__) {
|
|
|
|
|
//skip
|
|
|
|
|
Promise.all(promises).then(_ => {
|
|
|
|
|
});
|
2019-12-26 11:23:56 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
else {
|
2021-04-13 18:28:45 +08:00
|
|
|
|
this.__rendering__ = true;
|
2021-09-16 12:52:02 +08:00
|
|
|
|
Promise.all(promises).then(_ => {
|
2020-07-03 16:53:31 +08:00
|
|
|
|
this.__rendering__ = false;
|
2021-09-16 12:52:02 +08:00
|
|
|
|
this.onRenderFinished();
|
|
|
|
|
});
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-02-15 16:31:28 +08:00
|
|
|
|
__fetchEffectiveData__() {
|
|
|
|
|
const diryData = [];
|
|
|
|
|
if (this.destroyed) {
|
|
|
|
|
return diryData;
|
|
|
|
|
}
|
|
|
|
|
if (this.__root__.isDirty()) {
|
|
|
|
|
const model = this.__root__.toModel();
|
|
|
|
|
diryData.push(JSON.parse(JSON.stringify(model)));
|
|
|
|
|
this.__root__.clean();
|
|
|
|
|
}
|
|
|
|
|
for (let map of this.headviews.values()) {
|
|
|
|
|
for (let v of map.values()) {
|
|
|
|
|
if (v.isDirty()) {
|
|
|
|
|
const model = v.toModel();
|
|
|
|
|
diryData.push(JSON.parse(JSON.stringify(model)));
|
|
|
|
|
v.clean();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return diryData;
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
onRenderFinished() {
|
2023-08-04 16:42:59 +08:00
|
|
|
|
this.callingRenderFinishedCallback = true;
|
2020-07-03 16:53:31 +08:00
|
|
|
|
this.onRenderFinishedCallback.forEach(e => {
|
|
|
|
|
e();
|
|
|
|
|
});
|
|
|
|
|
this.onRenderFinishedCallback.length = 0;
|
2023-08-04 16:42:59 +08:00
|
|
|
|
this.callingRenderFinishedCallback = false;
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
addOnRenderFinishedCallback(cb) {
|
2023-08-03 18:58:28 +08:00
|
|
|
|
if (this.callingRenderFinishedCallback) {
|
|
|
|
|
loge("Do not call addOnRenderFinishedCallback recursively");
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
this.onRenderFinishedCallback.push(cb);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$e([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
NativeCall,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$e("design:type", Function),
|
|
|
|
|
__metadata$e("design:paramtypes", [String]),
|
|
|
|
|
__metadata$e("design:returntype", void 0)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Panel.prototype, "__init__", null);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$e([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
NativeCall,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$e("design:type", Function),
|
|
|
|
|
__metadata$e("design:paramtypes", []),
|
|
|
|
|
__metadata$e("design:returntype", void 0)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Panel.prototype, "__onCreate__", null);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$e([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
NativeCall,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$e("design:type", Function),
|
|
|
|
|
__metadata$e("design:paramtypes", []),
|
|
|
|
|
__metadata$e("design:returntype", void 0)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Panel.prototype, "__onDestroy__", null);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$e([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
NativeCall,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$e("design:type", Function),
|
|
|
|
|
__metadata$e("design:paramtypes", []),
|
|
|
|
|
__metadata$e("design:returntype", void 0)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Panel.prototype, "__onShow__", null);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$e([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
NativeCall,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$e("design:type", Function),
|
|
|
|
|
__metadata$e("design:paramtypes", []),
|
|
|
|
|
__metadata$e("design:returntype", void 0)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Panel.prototype, "__onHidden__", null);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$e([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
NativeCall,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$e("design:type", Function),
|
|
|
|
|
__metadata$e("design:paramtypes", [Object]),
|
|
|
|
|
__metadata$e("design:returntype", void 0)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Panel.prototype, "__build__", null);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$e([
|
2021-07-07 17:30:08 +08:00
|
|
|
|
NativeCall,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$e("design:type", Function),
|
|
|
|
|
__metadata$e("design:paramtypes", []),
|
|
|
|
|
__metadata$e("design:returntype", void 0)
|
2021-07-07 17:30:08 +08:00
|
|
|
|
], Panel.prototype, "__onEnvChanged__", null);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$e([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
NativeCall,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$e("design:type", Function),
|
|
|
|
|
__metadata$e("design:paramtypes", [Array, String]),
|
|
|
|
|
__metadata$e("design:returntype", void 0)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Panel.prototype, "__response__", null);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$e([
|
2021-07-09 17:16:30 +08:00
|
|
|
|
NativeCall,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$e("design:type", Function),
|
|
|
|
|
__metadata$e("design:paramtypes", []),
|
|
|
|
|
__metadata$e("design:returntype", void 0)
|
2021-07-09 17:16:30 +08:00
|
|
|
|
], Panel.prototype, "__renderSnapshotDepth__", null);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$e([
|
2021-07-09 17:16:30 +08:00
|
|
|
|
NativeCall,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$e("design:type", Function),
|
|
|
|
|
__metadata$e("design:paramtypes", [Number]),
|
|
|
|
|
__metadata$e("design:returntype", void 0)
|
2021-07-09 17:16:30 +08:00
|
|
|
|
], Panel.prototype, "__restoreRenderSnapshot__", null);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$e([
|
2021-07-09 17:16:30 +08:00
|
|
|
|
NativeCall,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$e("design:type", Function),
|
|
|
|
|
__metadata$e("design:paramtypes", []),
|
|
|
|
|
__metadata$e("design:returntype", void 0)
|
2021-07-09 17:16:30 +08:00
|
|
|
|
], Panel.prototype, "__enableSnapshot__", null);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
|
2021-09-07 18:33:25 +08:00
|
|
|
|
/**
|
|
|
|
|
* Store color as format AARRGGBB or RRGGBB
|
|
|
|
|
*/
|
|
|
|
|
class Color {
|
|
|
|
|
constructor(v) {
|
|
|
|
|
this._value = 0;
|
|
|
|
|
this._value = v | 0x0;
|
|
|
|
|
}
|
|
|
|
|
static parse(str) {
|
|
|
|
|
if (!str.startsWith("#")) {
|
|
|
|
|
throw new Error(`Parse color error with ${str}`);
|
|
|
|
|
}
|
|
|
|
|
const val = parseInt(str.substr(1), 16);
|
|
|
|
|
if (str.length === 7) {
|
|
|
|
|
return new Color(val | 0xff000000);
|
|
|
|
|
}
|
|
|
|
|
else if (str.length === 9) {
|
|
|
|
|
return new Color(val);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
throw new Error(`Parse color error with ${str}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
static safeParse(str, defVal = Color.TRANSPARENT) {
|
|
|
|
|
let color = defVal;
|
|
|
|
|
try {
|
|
|
|
|
color = Color.parse(str);
|
|
|
|
|
}
|
|
|
|
|
catch (e) {
|
|
|
|
|
}
|
|
|
|
|
finally {
|
|
|
|
|
return color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
alpha(v) {
|
|
|
|
|
v = v * 255;
|
|
|
|
|
return new Color((this._value & 0xffffff) | ((v & 0xff) << 24));
|
|
|
|
|
}
|
|
|
|
|
toModel() {
|
|
|
|
|
return this._value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Color.BLACK = new Color(0xFF000000);
|
|
|
|
|
Color.DKGRAY = new Color(0xFF444444);
|
|
|
|
|
Color.GRAY = new Color(0xFF888888);
|
|
|
|
|
Color.LTGRAY = new Color(0xFFCCCCCC);
|
|
|
|
|
Color.WHITE = new Color(0xFFFFFFFF);
|
|
|
|
|
Color.RED = new Color(0xFFFF0000);
|
|
|
|
|
Color.GREEN = new Color(0xFF00FF00);
|
|
|
|
|
Color.BLUE = new Color(0xFF0000FF);
|
|
|
|
|
Color.YELLOW = new Color(0xFFFFFF00);
|
|
|
|
|
Color.CYAN = new Color(0xFF00FFFF);
|
|
|
|
|
Color.MAGENTA = new Color(0xFFFF00FF);
|
|
|
|
|
Color.TRANSPARENT = new Color(0);
|
|
|
|
|
exports.GradientOrientation = void 0;
|
|
|
|
|
(function (GradientOrientation) {
|
|
|
|
|
/** draw the gradient from the top to the bottom */
|
|
|
|
|
GradientOrientation[GradientOrientation["TOP_BOTTOM"] = 0] = "TOP_BOTTOM";
|
|
|
|
|
/** draw the gradient from the top-right to the bottom-left */
|
|
|
|
|
GradientOrientation[GradientOrientation["TR_BL"] = 1] = "TR_BL";
|
|
|
|
|
/** draw the gradient from the right to the left */
|
|
|
|
|
GradientOrientation[GradientOrientation["RIGHT_LEFT"] = 2] = "RIGHT_LEFT";
|
|
|
|
|
/** draw the gradient from the bottom-right to the top-left */
|
|
|
|
|
GradientOrientation[GradientOrientation["BR_TL"] = 3] = "BR_TL";
|
|
|
|
|
/** draw the gradient from the bottom to the top */
|
|
|
|
|
GradientOrientation[GradientOrientation["BOTTOM_TOP"] = 4] = "BOTTOM_TOP";
|
|
|
|
|
/** draw the gradient from the bottom-left to the top-right */
|
|
|
|
|
GradientOrientation[GradientOrientation["BL_TR"] = 5] = "BL_TR";
|
|
|
|
|
/** draw the gradient from the left to the right */
|
|
|
|
|
GradientOrientation[GradientOrientation["LEFT_RIGHT"] = 6] = "LEFT_RIGHT";
|
|
|
|
|
/** draw the gradient from the top-left to the bottom-right */
|
|
|
|
|
GradientOrientation[GradientOrientation["TL_BR"] = 7] = "TL_BR";
|
|
|
|
|
})(exports.GradientOrientation || (exports.GradientOrientation = {}));
|
|
|
|
|
|
2019-12-23 15:29:38 +08:00
|
|
|
|
/*
|
|
|
|
|
* Copyright [2019] [Doric.Pub]
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.RepeatMode = void 0;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
(function (RepeatMode) {
|
|
|
|
|
RepeatMode[RepeatMode["RESTART"] = 1] = "RESTART";
|
|
|
|
|
RepeatMode[RepeatMode["REVERSE"] = 2] = "REVERSE";
|
|
|
|
|
})(exports.RepeatMode || (exports.RepeatMode = {}));
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.FillMode = void 0;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
(function (FillMode) {
|
|
|
|
|
/**
|
|
|
|
|
* The receiver is removed from the presentation when the animation is completed.
|
|
|
|
|
*/
|
|
|
|
|
FillMode[FillMode["Removed"] = 0] = "Removed";
|
|
|
|
|
/**
|
|
|
|
|
* The receiver remains visible in its final state when the animation is completed.
|
|
|
|
|
*/
|
|
|
|
|
FillMode[FillMode["Forward"] = 1] = "Forward";
|
|
|
|
|
/**
|
|
|
|
|
* The receiver clamps values before zero to zero when the animation is completed.
|
|
|
|
|
*/
|
|
|
|
|
FillMode[FillMode["Backward"] = 2] = "Backward";
|
|
|
|
|
/**
|
|
|
|
|
* The receiver clamps values at both ends of the object’s time space
|
|
|
|
|
*/
|
|
|
|
|
FillMode[FillMode["Both"] = 3] = "Both";
|
|
|
|
|
})(exports.FillMode || (exports.FillMode = {}));
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.TimingFunction = void 0;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
(function (TimingFunction) {
|
|
|
|
|
/**
|
|
|
|
|
* The system default timing function. Use this function to ensure that the timing of your animations matches that of most system animations.
|
|
|
|
|
*/
|
|
|
|
|
TimingFunction[TimingFunction["Default"] = 0] = "Default";
|
|
|
|
|
/**
|
|
|
|
|
* Linear pacing, which causes an animation to occur evenly over its duration.
|
|
|
|
|
*/
|
|
|
|
|
TimingFunction[TimingFunction["Linear"] = 1] = "Linear";
|
|
|
|
|
/**
|
|
|
|
|
* Ease-in pacing, which causes an animation to begin slowly and then speed up as it progresses.
|
|
|
|
|
*/
|
|
|
|
|
TimingFunction[TimingFunction["EaseIn"] = 2] = "EaseIn";
|
|
|
|
|
/**
|
|
|
|
|
* Ease-out pacing, which causes an animation to begin quickly and then slow as it progresses.
|
|
|
|
|
*/
|
|
|
|
|
TimingFunction[TimingFunction["EaseOut"] = 3] = "EaseOut";
|
|
|
|
|
/**
|
|
|
|
|
* Ease-in-ease-out pacing, which causes an animation to begin slowly, accelerate through the middle of its duration, and then slow again before completing.
|
|
|
|
|
*/
|
|
|
|
|
TimingFunction[TimingFunction["EaseInEaseOut"] = 4] = "EaseInEaseOut";
|
|
|
|
|
})(exports.TimingFunction || (exports.TimingFunction = {}));
|
|
|
|
|
class Animation {
|
|
|
|
|
constructor() {
|
|
|
|
|
this.changeables = new Map;
|
|
|
|
|
this.duration = 0;
|
|
|
|
|
this.fillMode = exports.FillMode.Forward;
|
2021-04-21 18:59:29 +08:00
|
|
|
|
this.id = uniqueId("Animation");
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
|
|
|
|
toModel() {
|
|
|
|
|
const changeables = [];
|
|
|
|
|
for (let e of this.changeables.values()) {
|
|
|
|
|
changeables.push({
|
|
|
|
|
key: e.key,
|
|
|
|
|
fromValue: e.fromValue,
|
|
|
|
|
toValue: e.toValue,
|
2021-09-07 20:10:44 +08:00
|
|
|
|
keyFrames: e.keyFrames,
|
2019-12-23 15:29:38 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
type: this.constructor.name,
|
|
|
|
|
delay: this.delay,
|
|
|
|
|
duration: this.duration,
|
|
|
|
|
changeables,
|
|
|
|
|
repeatCount: this.repeatCount,
|
|
|
|
|
repeatMode: this.repeatMode,
|
|
|
|
|
fillMode: this.fillMode,
|
2021-04-21 18:59:29 +08:00
|
|
|
|
timingFunction: this.timingFunction,
|
|
|
|
|
id: this.id,
|
2019-12-23 15:29:38 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class ScaleAnimation extends Animation {
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
this.scaleXChangeable = {
|
|
|
|
|
key: "scaleX",
|
|
|
|
|
fromValue: 1,
|
|
|
|
|
toValue: 1,
|
|
|
|
|
};
|
|
|
|
|
this.scaleYChangeable = {
|
|
|
|
|
key: "scaleY",
|
|
|
|
|
fromValue: 1,
|
|
|
|
|
toValue: 1,
|
|
|
|
|
};
|
|
|
|
|
this.changeables.set("scaleX", this.scaleXChangeable);
|
|
|
|
|
this.changeables.set("scaleY", this.scaleYChangeable);
|
|
|
|
|
}
|
2021-09-07 20:10:44 +08:00
|
|
|
|
set xKeyFrames(keyFrames) {
|
|
|
|
|
this.scaleXChangeable.keyFrames = keyFrames;
|
|
|
|
|
}
|
|
|
|
|
set yKeyFrames(keyFrames) {
|
|
|
|
|
this.scaleYChangeable.keyFrames = keyFrames;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
set fromScaleX(v) {
|
|
|
|
|
this.scaleXChangeable.fromValue = v;
|
|
|
|
|
}
|
|
|
|
|
get fromScaleX() {
|
|
|
|
|
return this.scaleXChangeable.fromValue;
|
|
|
|
|
}
|
|
|
|
|
set toScaleX(v) {
|
|
|
|
|
this.scaleXChangeable.toValue = v;
|
|
|
|
|
}
|
|
|
|
|
get toScaleX() {
|
|
|
|
|
return this.scaleXChangeable.toValue;
|
|
|
|
|
}
|
|
|
|
|
set fromScaleY(v) {
|
|
|
|
|
this.scaleYChangeable.fromValue = v;
|
|
|
|
|
}
|
|
|
|
|
get fromScaleY() {
|
|
|
|
|
return this.scaleYChangeable.fromValue;
|
|
|
|
|
}
|
|
|
|
|
set toScaleY(v) {
|
|
|
|
|
this.scaleYChangeable.toValue = v;
|
|
|
|
|
}
|
|
|
|
|
get toScaleY() {
|
|
|
|
|
return this.scaleYChangeable.toValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class TranslationAnimation extends Animation {
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
this.translationXChangeable = {
|
|
|
|
|
key: "translationX",
|
2021-04-21 18:59:29 +08:00
|
|
|
|
fromValue: 0,
|
|
|
|
|
toValue: 0,
|
2019-12-23 15:29:38 +08:00
|
|
|
|
};
|
|
|
|
|
this.translationYChangeable = {
|
|
|
|
|
key: "translationY",
|
2021-04-21 18:59:29 +08:00
|
|
|
|
fromValue: 0,
|
|
|
|
|
toValue: 0,
|
2019-12-23 15:29:38 +08:00
|
|
|
|
};
|
|
|
|
|
this.changeables.set("translationX", this.translationXChangeable);
|
|
|
|
|
this.changeables.set("translationY", this.translationYChangeable);
|
|
|
|
|
}
|
2021-09-07 20:10:44 +08:00
|
|
|
|
set xKeyFrames(keyFrames) {
|
|
|
|
|
this.translationXChangeable.keyFrames = keyFrames;
|
|
|
|
|
}
|
|
|
|
|
set yKeyFrames(keyFrames) {
|
|
|
|
|
this.translationYChangeable.keyFrames = keyFrames;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
set fromTranslationX(v) {
|
|
|
|
|
this.translationXChangeable.fromValue = v;
|
|
|
|
|
}
|
|
|
|
|
get fromTranslationX() {
|
|
|
|
|
return this.translationXChangeable.fromValue;
|
|
|
|
|
}
|
|
|
|
|
set toTranslationX(v) {
|
|
|
|
|
this.translationXChangeable.toValue = v;
|
|
|
|
|
}
|
|
|
|
|
get toTranslationX() {
|
|
|
|
|
return this.translationXChangeable.toValue;
|
|
|
|
|
}
|
|
|
|
|
set fromTranslationY(v) {
|
|
|
|
|
this.translationYChangeable.fromValue = v;
|
|
|
|
|
}
|
|
|
|
|
get fromTranslationY() {
|
|
|
|
|
return this.translationYChangeable.fromValue;
|
|
|
|
|
}
|
|
|
|
|
set toTranslationY(v) {
|
|
|
|
|
this.translationYChangeable.toValue = v;
|
|
|
|
|
}
|
|
|
|
|
get toTranslationY() {
|
|
|
|
|
return this.translationYChangeable.toValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-07 18:33:25 +08:00
|
|
|
|
/**
|
|
|
|
|
* Rotation range is [0..2]
|
|
|
|
|
*/
|
2019-12-23 15:29:38 +08:00
|
|
|
|
class RotationAnimation extends Animation {
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
this.rotationChaneable = {
|
|
|
|
|
key: "rotation",
|
|
|
|
|
fromValue: 1,
|
|
|
|
|
toValue: 1,
|
|
|
|
|
};
|
|
|
|
|
this.changeables.set("rotation", this.rotationChaneable);
|
|
|
|
|
}
|
|
|
|
|
set fromRotation(v) {
|
|
|
|
|
this.rotationChaneable.fromValue = v;
|
|
|
|
|
}
|
|
|
|
|
get fromRotation() {
|
|
|
|
|
return this.rotationChaneable.fromValue;
|
|
|
|
|
}
|
|
|
|
|
set toRotation(v) {
|
|
|
|
|
this.rotationChaneable.toValue = v;
|
|
|
|
|
}
|
|
|
|
|
get toRotation() {
|
|
|
|
|
return this.rotationChaneable.toValue;
|
|
|
|
|
}
|
2021-09-07 20:10:44 +08:00
|
|
|
|
set keyFrames(keyFrames) {
|
|
|
|
|
this.rotationChaneable.keyFrames = keyFrames;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2021-09-07 18:33:25 +08:00
|
|
|
|
/**
|
|
|
|
|
* Rotation range is [0..2]
|
|
|
|
|
*/
|
2020-06-03 14:53:32 +08:00
|
|
|
|
class RotationXAnimation extends Animation {
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
this.rotationChaneable = {
|
|
|
|
|
key: "rotationX",
|
|
|
|
|
fromValue: 1,
|
|
|
|
|
toValue: 1,
|
|
|
|
|
};
|
|
|
|
|
this.changeables.set("rotationX", this.rotationChaneable);
|
|
|
|
|
}
|
|
|
|
|
set fromRotation(v) {
|
|
|
|
|
this.rotationChaneable.fromValue = v;
|
|
|
|
|
}
|
|
|
|
|
get fromRotation() {
|
|
|
|
|
return this.rotationChaneable.fromValue;
|
|
|
|
|
}
|
|
|
|
|
set toRotation(v) {
|
|
|
|
|
this.rotationChaneable.toValue = v;
|
|
|
|
|
}
|
|
|
|
|
get toRotation() {
|
|
|
|
|
return this.rotationChaneable.toValue;
|
|
|
|
|
}
|
2021-09-07 20:10:44 +08:00
|
|
|
|
set keyFrames(keyFrames) {
|
|
|
|
|
this.rotationChaneable.keyFrames = keyFrames;
|
|
|
|
|
}
|
2020-06-03 14:53:32 +08:00
|
|
|
|
}
|
2021-09-07 18:33:25 +08:00
|
|
|
|
/**
|
|
|
|
|
* Rotation range is [0..2]
|
|
|
|
|
*/
|
2020-06-03 14:53:32 +08:00
|
|
|
|
class RotationYAnimation extends Animation {
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
this.rotationChaneable = {
|
|
|
|
|
key: "rotationY",
|
|
|
|
|
fromValue: 1,
|
|
|
|
|
toValue: 1,
|
|
|
|
|
};
|
|
|
|
|
this.changeables.set("rotationY", this.rotationChaneable);
|
|
|
|
|
}
|
|
|
|
|
set fromRotation(v) {
|
|
|
|
|
this.rotationChaneable.fromValue = v;
|
|
|
|
|
}
|
|
|
|
|
get fromRotation() {
|
|
|
|
|
return this.rotationChaneable.fromValue;
|
|
|
|
|
}
|
|
|
|
|
set toRotation(v) {
|
|
|
|
|
this.rotationChaneable.toValue = v;
|
|
|
|
|
}
|
|
|
|
|
get toRotation() {
|
|
|
|
|
return this.rotationChaneable.toValue;
|
|
|
|
|
}
|
2021-09-07 20:10:44 +08:00
|
|
|
|
set keyFrames(keyFrames) {
|
|
|
|
|
this.rotationChaneable.keyFrames = keyFrames;
|
|
|
|
|
}
|
2020-06-03 14:53:32 +08:00
|
|
|
|
}
|
2021-09-07 18:33:25 +08:00
|
|
|
|
class BackgroundColorAnimation extends Animation {
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
this.backgroundColorChangeable = {
|
|
|
|
|
key: "backgroundColor",
|
|
|
|
|
fromValue: Color.TRANSPARENT._value,
|
|
|
|
|
toValue: Color.TRANSPARENT._value,
|
|
|
|
|
};
|
|
|
|
|
this.changeables.set("backgroundColor", this.backgroundColorChangeable);
|
|
|
|
|
}
|
|
|
|
|
set fromColor(color) {
|
|
|
|
|
this.backgroundColorChangeable.fromValue = color._value;
|
|
|
|
|
}
|
|
|
|
|
get fromColor() {
|
|
|
|
|
return new Color(this.backgroundColorChangeable.fromValue);
|
|
|
|
|
}
|
|
|
|
|
set toColor(v) {
|
|
|
|
|
this.backgroundColorChangeable.toValue = v._value;
|
|
|
|
|
}
|
|
|
|
|
get toColor() {
|
|
|
|
|
return new Color(this.backgroundColorChangeable.toValue);
|
|
|
|
|
}
|
2021-09-07 20:10:44 +08:00
|
|
|
|
set keyFrames(keyFrames) {
|
|
|
|
|
this.backgroundColorChangeable.keyFrames = keyFrames.map(e => { return { percent: e.percent, value: e.value.toModel() }; });
|
|
|
|
|
}
|
2021-09-07 18:33:25 +08:00
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Alpha range is [0..1]
|
|
|
|
|
*/
|
|
|
|
|
class AlphaAnimation extends Animation {
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
this.opacityChangeable = {
|
|
|
|
|
key: "alpha",
|
|
|
|
|
fromValue: 1,
|
|
|
|
|
toValue: 1,
|
|
|
|
|
};
|
|
|
|
|
this.changeables.set("alpha", this.opacityChangeable);
|
|
|
|
|
}
|
|
|
|
|
set from(v) {
|
|
|
|
|
this.opacityChangeable.fromValue = v;
|
|
|
|
|
}
|
|
|
|
|
get from() {
|
|
|
|
|
return this.opacityChangeable.fromValue;
|
|
|
|
|
}
|
|
|
|
|
set to(v) {
|
|
|
|
|
this.opacityChangeable.toValue = v;
|
|
|
|
|
}
|
|
|
|
|
get to() {
|
|
|
|
|
return this.opacityChangeable.toValue;
|
|
|
|
|
}
|
2021-09-07 20:10:44 +08:00
|
|
|
|
set keyFrames(keyFrames) {
|
|
|
|
|
this.opacityChangeable.keyFrames = keyFrames;
|
|
|
|
|
}
|
2021-09-07 18:33:25 +08:00
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
class AnimationSet {
|
|
|
|
|
constructor() {
|
|
|
|
|
this.animations = [];
|
|
|
|
|
this._duration = 0;
|
2021-04-21 18:59:29 +08:00
|
|
|
|
this.id = uniqueId("AnimationSet");
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
|
|
|
|
addAnimation(anim) {
|
|
|
|
|
this.animations.push(anim);
|
|
|
|
|
}
|
|
|
|
|
get duration() {
|
|
|
|
|
return this._duration;
|
|
|
|
|
}
|
|
|
|
|
set duration(v) {
|
|
|
|
|
this._duration = v;
|
|
|
|
|
this.animations.forEach(e => e.duration = v);
|
|
|
|
|
}
|
|
|
|
|
toModel() {
|
|
|
|
|
return {
|
|
|
|
|
animations: this.animations.map(e => {
|
|
|
|
|
return e.toModel();
|
|
|
|
|
}),
|
|
|
|
|
delay: this.delay,
|
2021-04-21 18:59:29 +08:00
|
|
|
|
id: this.id,
|
2019-12-23 15:29:38 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$d = (undefined && undefined.__metadata) || function (k, v) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.TruncateAt = void 0;
|
2020-04-27 18:46:39 +08:00
|
|
|
|
(function (TruncateAt) {
|
|
|
|
|
TruncateAt[TruncateAt["End"] = 0] = "End";
|
|
|
|
|
TruncateAt[TruncateAt["Middle"] = 1] = "Middle";
|
|
|
|
|
TruncateAt[TruncateAt["Start"] = 2] = "Start";
|
|
|
|
|
TruncateAt[TruncateAt["Clip"] = 3] = "Clip";
|
|
|
|
|
})(exports.TruncateAt || (exports.TruncateAt = {}));
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class Text extends View {
|
2021-09-03 13:42:25 +08:00
|
|
|
|
set innerElement(e) {
|
|
|
|
|
this.text = e;
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "text", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "textColor", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "textSize", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "maxLines", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", Gravity)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "textAlignment", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "fontStyle", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "font", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "maxWidth", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "maxHeight", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "lineSpacing", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", Boolean)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "strikethrough", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", Boolean)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "underline", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "htmlText", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$d([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$d("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Text.prototype, "truncateAt", void 0);
|
2022-08-25 10:42:56 +08:00
|
|
|
|
__decorate$d([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$d("design:type", Object)
|
|
|
|
|
], Text.prototype, "padding", void 0);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
function text(config) {
|
|
|
|
|
const ret = new Text;
|
|
|
|
|
ret.layoutConfig = layoutConfig().fit();
|
2021-08-31 12:49:47 +08:00
|
|
|
|
ret.apply(config);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-20 18:57:17 +08:00
|
|
|
|
class Resource {
|
|
|
|
|
constructor(type, identifier) {
|
2021-11-18 17:39:01 +08:00
|
|
|
|
this.resId = uniqueId("resource");
|
2021-10-20 18:57:17 +08:00
|
|
|
|
this.type = type;
|
|
|
|
|
this.identifier = identifier;
|
|
|
|
|
}
|
|
|
|
|
toModel() {
|
|
|
|
|
return {
|
2021-11-18 17:39:01 +08:00
|
|
|
|
resId: this.resId,
|
2021-10-20 18:57:17 +08:00
|
|
|
|
type: this.type,
|
|
|
|
|
identifier: this.identifier,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-25 16:01:44 +08:00
|
|
|
|
class LocalResource extends Resource {
|
2021-10-22 17:00:00 +08:00
|
|
|
|
constructor(path) {
|
2021-10-25 16:01:44 +08:00
|
|
|
|
super("local", path);
|
2021-10-22 17:00:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class RemoteResource extends Resource {
|
|
|
|
|
constructor(url) {
|
|
|
|
|
super("remote", url);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class Base64Resource extends Resource {
|
2021-10-25 16:01:44 +08:00
|
|
|
|
constructor(content) {
|
|
|
|
|
super("base64", content);
|
2021-10-22 17:00:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-07 18:38:05 +08:00
|
|
|
|
/**
|
|
|
|
|
* Resources belong to assets dir.
|
|
|
|
|
*/
|
2021-12-07 19:13:42 +08:00
|
|
|
|
class AssetsResource extends Resource {
|
2021-12-07 18:38:05 +08:00
|
|
|
|
constructor(content) {
|
|
|
|
|
super("doric_assets", content);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class AndroidResource extends Resource {
|
|
|
|
|
}
|
|
|
|
|
class iOSResource extends Resource {
|
|
|
|
|
}
|
2021-10-22 17:00:00 +08:00
|
|
|
|
/**
|
|
|
|
|
* This is for android platform
|
|
|
|
|
*/
|
2021-12-07 18:38:05 +08:00
|
|
|
|
class DrawableResource extends AndroidResource {
|
2021-10-25 16:01:44 +08:00
|
|
|
|
constructor(name) {
|
|
|
|
|
super("drawable", name);
|
2021-10-22 17:00:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-07 18:38:05 +08:00
|
|
|
|
class RawResource extends AndroidResource {
|
2021-10-25 16:01:44 +08:00
|
|
|
|
constructor(name) {
|
|
|
|
|
super("raw", name);
|
2021-10-22 17:00:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-07 18:38:05 +08:00
|
|
|
|
class AndroidAssetsResource extends AndroidResource {
|
2021-10-22 17:00:00 +08:00
|
|
|
|
constructor(path) {
|
2021-12-07 18:38:05 +08:00
|
|
|
|
super("android_assets", path);
|
2021-10-22 17:00:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* This is for iOS platform
|
|
|
|
|
*/
|
2021-12-07 18:38:05 +08:00
|
|
|
|
class MainBundleResource extends iOSResource {
|
2021-10-25 16:51:45 +08:00
|
|
|
|
constructor(fileName) {
|
|
|
|
|
super("mainBundle", fileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-07 18:38:05 +08:00
|
|
|
|
class BundleResource extends iOSResource {
|
2021-10-25 16:51:45 +08:00
|
|
|
|
constructor(bundleName, fileName) {
|
|
|
|
|
super("bundle", `${bundleName}://${fileName}`);
|
2021-10-22 17:00:00 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-09 17:35:13 +08:00
|
|
|
|
class ArrayBufferResource extends Resource {
|
|
|
|
|
constructor(data) {
|
|
|
|
|
super("arrayBuffer", uniqueId("buffer"));
|
|
|
|
|
this.data = data;
|
|
|
|
|
}
|
|
|
|
|
toModel() {
|
|
|
|
|
const ret = super.toModel();
|
|
|
|
|
ret.data = this.data;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-20 18:57:17 +08:00
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$c = (undefined && undefined.__metadata) || function (k, v) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.ScaleType = void 0;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
(function (ScaleType) {
|
|
|
|
|
ScaleType[ScaleType["ScaleToFill"] = 0] = "ScaleToFill";
|
|
|
|
|
ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit";
|
|
|
|
|
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
|
2022-03-18 19:37:41 +08:00
|
|
|
|
ScaleType[ScaleType["Tile"] = 3] = "Tile";
|
2023-09-13 14:32:55 +08:00
|
|
|
|
ScaleType[ScaleType["ScaleAspectFitStart"] = 4] = "ScaleAspectFitStart";
|
|
|
|
|
ScaleType[ScaleType["ScaleAspectFitEnd"] = 5] = "ScaleAspectFitEnd";
|
2019-12-23 15:29:38 +08:00
|
|
|
|
})(exports.ScaleType || (exports.ScaleType = {}));
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class Image extends View {
|
2021-09-26 16:27:13 +08:00
|
|
|
|
isAnimating(context) {
|
|
|
|
|
return this.nativeChannel(context, "isAnimating")();
|
|
|
|
|
}
|
|
|
|
|
startAnimating(context) {
|
|
|
|
|
return this.nativeChannel(context, "startAnimating")();
|
|
|
|
|
}
|
|
|
|
|
stopAnimating(context) {
|
|
|
|
|
return this.nativeChannel(context, "stopAnimating")();
|
|
|
|
|
}
|
2021-11-19 14:30:24 +08:00
|
|
|
|
getImageInfo(context) {
|
|
|
|
|
return this.nativeChannel(context, "getImageInfo")();
|
|
|
|
|
}
|
|
|
|
|
getImagePixels(context) {
|
|
|
|
|
return this.nativeChannel(context, "getImagePixels")();
|
|
|
|
|
}
|
2022-03-03 18:55:52 +08:00
|
|
|
|
setImagePixels(context, image) {
|
|
|
|
|
return this.nativeChannel(context, "setImagePixels")(image);
|
2021-11-22 11:54:47 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2021-11-19 14:30:24 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", Object)
|
2021-11-19 14:30:24 +08:00
|
|
|
|
], Image.prototype, "imagePixels", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2021-10-20 18:57:17 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", Resource)
|
2021-10-20 18:57:17 +08:00
|
|
|
|
], Image.prototype, "image", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "imageUrl", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2021-08-05 17:42:45 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", String)
|
2021-08-05 17:42:45 +08:00
|
|
|
|
], Image.prototype, "imageFilePath", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "imagePath", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "imageRes", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "imageBase64", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "scaleType", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", Boolean)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "isBlur", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "placeHolderImage", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "placeHolderImageBase64", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", Color
|
2020-07-03 16:53:31 +08:00
|
|
|
|
/**
|
|
|
|
|
* Display while image is failed to load
|
|
|
|
|
* It can be file name in local path
|
|
|
|
|
*/
|
|
|
|
|
)
|
|
|
|
|
], Image.prototype, "placeHolderColor", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "errorImage", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "errorImageBase64", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", Color)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "errorColor", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "loadCallback", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "imageScale", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Image.prototype, "stretchInset", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$c([
|
2021-12-17 16:52:20 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$c("design:type", Function)
|
2021-12-17 16:52:20 +08:00
|
|
|
|
], Image.prototype, "onAnimationEnd", void 0);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
function image(config) {
|
|
|
|
|
const ret = new Image;
|
|
|
|
|
ret.layoutConfig = layoutConfig().fit();
|
2021-08-31 12:49:47 +08:00
|
|
|
|
ret.apply(config);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-22 15:18:08 +08:00
|
|
|
|
function deepClone(nativeViewModel) {
|
|
|
|
|
const ret = {
|
|
|
|
|
id: nativeViewModel.id,
|
|
|
|
|
type: nativeViewModel.type,
|
|
|
|
|
props: Object.assign({}, nativeViewModel.props),
|
|
|
|
|
};
|
|
|
|
|
if (nativeViewModel.props.subviews) {
|
|
|
|
|
ret.props.subviews = nativeViewModel.props.subviews
|
|
|
|
|
.map(e => deepClone(e));
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-23 15:29:38 +08:00
|
|
|
|
/*
|
|
|
|
|
* Copyright [2019] [Doric.Pub]
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$b = (undefined && undefined.__metadata) || function (k, v) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class ListItem extends Stack {
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], ListItem.prototype, "identifier", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2021-04-23 19:05:33 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Array)
|
2021-04-23 19:05:33 +08:00
|
|
|
|
], ListItem.prototype, "actions", void 0);
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class List extends Superview {
|
|
|
|
|
constructor() {
|
|
|
|
|
super(...arguments);
|
|
|
|
|
this.cachedViews = new Map;
|
|
|
|
|
this.itemCount = 0;
|
|
|
|
|
this.batchCount = 15;
|
|
|
|
|
}
|
|
|
|
|
allSubviews() {
|
2021-10-09 16:50:34 +08:00
|
|
|
|
const ret = [...this.cachedViews.values()];
|
2020-07-03 16:53:31 +08:00
|
|
|
|
if (this.loadMoreView) {
|
2021-10-09 16:50:34 +08:00
|
|
|
|
ret.push(this.loadMoreView);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2021-10-09 16:50:34 +08:00
|
|
|
|
return ret;
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
2023-08-03 18:58:28 +08:00
|
|
|
|
/**
|
|
|
|
|
* @param {number} config.topOffset - 目标位置cell的顶部偏移量
|
|
|
|
|
*/
|
2020-07-03 16:53:31 +08:00
|
|
|
|
scrollToItem(context, index, config) {
|
|
|
|
|
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
2023-08-03 18:58:28 +08:00
|
|
|
|
const topOffset = config === null || config === void 0 ? void 0 : config.topOffset;
|
|
|
|
|
return this.nativeChannel(context, 'scrollToItem')({ index, animated, topOffset });
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
2021-10-11 18:10:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @param context
|
2021-10-12 16:33:04 +08:00
|
|
|
|
* @returns Returns array of visible view's index.
|
2021-10-11 18:10:59 +08:00
|
|
|
|
*/
|
|
|
|
|
findVisibleItems(context) {
|
|
|
|
|
return this.nativeChannel(context, 'findVisibleItems')();
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* @param context
|
2021-10-12 16:33:04 +08:00
|
|
|
|
* @returns Returns array of completely visible view's index.
|
2021-10-11 18:10:59 +08:00
|
|
|
|
*/
|
|
|
|
|
findCompletelyVisibleItems(context) {
|
|
|
|
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
|
|
|
|
}
|
2022-08-16 17:57:51 +08:00
|
|
|
|
/**
|
|
|
|
|
* Reload all list items.
|
|
|
|
|
* @param context
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
|
|
|
|
reload(context) {
|
|
|
|
|
return this.nativeChannel(context, 'reload')();
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
reset() {
|
|
|
|
|
this.cachedViews.clear();
|
|
|
|
|
this.itemCount = 0;
|
|
|
|
|
}
|
|
|
|
|
getItem(itemIdx) {
|
|
|
|
|
let view = this.renderItem(itemIdx);
|
|
|
|
|
view.superview = this;
|
|
|
|
|
this.cachedViews.set(`${itemIdx}`, view);
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
|
renderBunchedItems(start, length) {
|
2023-03-22 15:18:08 +08:00
|
|
|
|
const items = new Array(Math.max(0, Math.min(length, this.itemCount - start)))
|
|
|
|
|
.fill(0).map((_, idx) => this.getItem(start + idx));
|
|
|
|
|
const ret = items.map(e => deepClone(e.toModel()));
|
|
|
|
|
items.forEach(e => e.clean());
|
|
|
|
|
return ret;
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
toModel() {
|
|
|
|
|
if (this.loadMoreView) {
|
|
|
|
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
return super.toModel();
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], List.prototype, "itemCount", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], List.prototype, "renderItem", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], List.prototype, "batchCount", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], List.prototype, "onLoadMore", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Boolean)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], List.prototype, "loadMore", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", ListItem)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], List.prototype, "loadMoreView", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], List.prototype, "onScroll", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], List.prototype, "onScrollEnd", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2023-04-04 19:49:10 +08:00
|
|
|
|
InconsistProperty,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], List.prototype, "scrolledPosition", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2021-04-23 17:57:34 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Boolean)
|
2021-04-23 17:57:34 +08:00
|
|
|
|
], List.prototype, "scrollable", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2021-04-30 14:32:53 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Boolean)
|
2021-04-30 14:32:53 +08:00
|
|
|
|
], List.prototype, "bounces", void 0);
|
2023-03-13 19:17:56 +08:00
|
|
|
|
__decorate$b([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$b("design:type", Boolean)
|
|
|
|
|
], List.prototype, "scrollsToTop", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2022-06-17 15:43:51 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Boolean)
|
2022-06-17 15:43:51 +08:00
|
|
|
|
], List.prototype, "canDrag", void 0);
|
2022-08-26 14:16:12 +08:00
|
|
|
|
__decorate$b([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$b("design:type", Function)
|
|
|
|
|
], List.prototype, "itemCanDrag", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2022-06-30 16:39:03 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Function)
|
2022-06-30 16:39:03 +08:00
|
|
|
|
], List.prototype, "beforeDragging", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2022-06-17 15:43:51 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Function)
|
2022-06-17 15:43:51 +08:00
|
|
|
|
], List.prototype, "onDragging", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$b([
|
2022-06-17 15:43:51 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$b("design:type", Function)
|
2022-06-17 15:43:51 +08:00
|
|
|
|
], List.prototype, "onDragged", void 0);
|
2023-03-09 10:55:32 +08:00
|
|
|
|
__decorate$b([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$b("design:type", Number)
|
|
|
|
|
], List.prototype, "preloadItemCount", void 0);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
function list(config) {
|
|
|
|
|
const ret = new List;
|
2021-08-31 12:49:47 +08:00
|
|
|
|
ret.apply(config);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
2020-01-04 19:13:15 +08:00
|
|
|
|
function listItem(item, config) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return (new ListItem).also((it) => {
|
2020-01-04 19:13:15 +08:00
|
|
|
|
it.layoutConfig = layoutConfig().fit();
|
|
|
|
|
if (item instanceof View) {
|
|
|
|
|
it.addChild(item);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
item.forEach(e => {
|
|
|
|
|
it.addChild(e);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (config) {
|
2021-08-31 12:49:47 +08:00
|
|
|
|
it.apply(config);
|
2020-01-04 19:13:15 +08:00
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$a = (undefined && undefined.__metadata) || function (k, v) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class SlideItem extends Stack {
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$a([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$a("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], SlideItem.prototype, "identifier", void 0);
|
|
|
|
|
class Slider extends Superview {
|
|
|
|
|
constructor() {
|
|
|
|
|
super(...arguments);
|
|
|
|
|
this.cachedViews = new Map;
|
|
|
|
|
this.itemCount = 0;
|
|
|
|
|
this.batchCount = 3;
|
|
|
|
|
}
|
|
|
|
|
allSubviews() {
|
|
|
|
|
return this.cachedViews.values();
|
|
|
|
|
}
|
2022-08-16 17:57:51 +08:00
|
|
|
|
/**
|
|
|
|
|
* Reload all list items.
|
|
|
|
|
* @param context
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
|
|
|
|
reload(context) {
|
|
|
|
|
return this.nativeChannel(context, 'reload')();
|
|
|
|
|
}
|
|
|
|
|
reset() {
|
|
|
|
|
this.cachedViews.clear();
|
|
|
|
|
this.itemCount = 0;
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
getItem(itemIdx) {
|
|
|
|
|
let view = this.renderPage(itemIdx);
|
|
|
|
|
view.superview = this;
|
|
|
|
|
this.cachedViews.set(`${itemIdx}`, view);
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
|
renderBunchedItems(start, length) {
|
2023-03-22 15:18:08 +08:00
|
|
|
|
const items = new Array(Math.max(0, Math.min(length, this.itemCount - start)))
|
|
|
|
|
.fill(0).map((_, idx) => this.getItem(start + idx));
|
|
|
|
|
const ret = items.map(e => deepClone(e.toModel()));
|
|
|
|
|
items.forEach(e => e.clean());
|
|
|
|
|
return ret;
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
slidePage(context, page, smooth = false) {
|
|
|
|
|
return this.nativeChannel(context, "slidePage")({ page, smooth });
|
|
|
|
|
}
|
|
|
|
|
getSlidedPage(context) {
|
|
|
|
|
return this.nativeChannel(context, "getSlidedPage")();
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$a([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$a("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Slider.prototype, "itemCount", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$a([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$a("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Slider.prototype, "renderPage", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$a([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$a("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Slider.prototype, "batchCount", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$a([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$a("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Slider.prototype, "onPageSlided", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$a([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$a("design:type", Boolean)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Slider.prototype, "loop", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$a([
|
2021-04-23 17:57:34 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$a("design:type", Boolean)
|
2021-04-23 17:57:34 +08:00
|
|
|
|
], Slider.prototype, "scrollable", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$a([
|
2021-04-30 14:28:38 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$a("design:type", Boolean)
|
2021-04-30 14:28:38 +08:00
|
|
|
|
], Slider.prototype, "bounces", void 0);
|
2023-03-13 19:17:56 +08:00
|
|
|
|
__decorate$a([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$a("design:type", Boolean)
|
|
|
|
|
], Slider.prototype, "scrollsToTop", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$a([
|
2022-07-15 15:59:06 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$a("design:type", Object)
|
2022-07-15 17:18:52 +08:00
|
|
|
|
], Slider.prototype, "slideStyle", void 0);
|
2023-04-04 19:49:10 +08:00
|
|
|
|
__decorate$a([
|
|
|
|
|
InconsistProperty,
|
|
|
|
|
__metadata$a("design:type", Number)
|
|
|
|
|
], Slider.prototype, "slidePosition", void 0);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
function slider(config) {
|
|
|
|
|
const ret = new Slider;
|
2021-08-31 12:49:47 +08:00
|
|
|
|
ret.apply(config);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
2020-01-04 19:13:15 +08:00
|
|
|
|
function slideItem(item, config) {
|
|
|
|
|
return (new SlideItem).also((it) => {
|
2020-04-07 10:58:44 +08:00
|
|
|
|
it.layoutConfig = layoutConfig().most();
|
2020-01-04 19:13:15 +08:00
|
|
|
|
if (item instanceof View) {
|
|
|
|
|
it.addChild(item);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
item.forEach(e => {
|
|
|
|
|
it.addChild(e);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (config) {
|
|
|
|
|
for (let key in config) {
|
|
|
|
|
Reflect.set(it, key, Reflect.get(config, key, config), it);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2020-03-03 13:23:06 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$9 = (undefined && undefined.__metadata) || function (k, v) {
|
2020-03-03 13:23:06 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
2020-01-06 10:43:18 +08:00
|
|
|
|
function scroller(content, config) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return (new Scroller).also(v => {
|
|
|
|
|
v.layoutConfig = layoutConfig().fit();
|
2020-01-06 10:43:18 +08:00
|
|
|
|
if (config) {
|
2021-08-31 12:49:47 +08:00
|
|
|
|
v.apply(config);
|
2020-01-06 10:43:18 +08:00
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
v.content = content;
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
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 });
|
|
|
|
|
}
|
2021-09-03 13:42:25 +08:00
|
|
|
|
set innerElement(e) {
|
|
|
|
|
this.content = e;
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$9([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$9("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Scroller.prototype, "contentOffset", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$9([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$9("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Scroller.prototype, "onScroll", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$9([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$9("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Scroller.prototype, "onScrollEnd", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$9([
|
2021-04-23 17:57:34 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$9("design:type", Boolean)
|
2021-04-23 17:57:34 +08:00
|
|
|
|
], Scroller.prototype, "scrollable", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$9([
|
2021-04-30 14:32:53 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$9("design:type", Boolean)
|
2021-04-30 14:32:53 +08:00
|
|
|
|
], Scroller.prototype, "bounces", void 0);
|
2023-03-13 19:17:56 +08:00
|
|
|
|
__decorate$9([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$9("design:type", Boolean)
|
|
|
|
|
], Scroller.prototype, "scrollsToTop", void 0);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$8 = (undefined && undefined.__metadata) || function (k, v) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class Refreshable extends Superview {
|
|
|
|
|
allSubviews() {
|
|
|
|
|
const ret = [this.content];
|
|
|
|
|
if (this.header) {
|
|
|
|
|
ret.push(this.header);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
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')();
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
isRefreshing(context) {
|
|
|
|
|
return this.nativeChannel(context, 'isRefreshing')();
|
|
|
|
|
}
|
|
|
|
|
toModel() {
|
|
|
|
|
this.dirtyProps.content = this.content.viewId;
|
|
|
|
|
this.dirtyProps.header = (this.header || {}).viewId;
|
|
|
|
|
return super.toModel();
|
|
|
|
|
}
|
2021-09-03 13:42:25 +08:00
|
|
|
|
set innerElement(e) {
|
|
|
|
|
if (e instanceof View) {
|
|
|
|
|
this.content = e;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this.header = e[0];
|
|
|
|
|
this.content = e[1];
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$8([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$8("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Refreshable.prototype, "onRefresh", void 0);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
function refreshable(config) {
|
|
|
|
|
const ret = new Refreshable;
|
|
|
|
|
ret.layoutConfig = layoutConfig().fit();
|
2021-08-31 12:49:47 +08:00
|
|
|
|
ret.apply(config);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
function pullable(v, config) {
|
|
|
|
|
Reflect.set(v, 'startAnimation', config.startAnimation);
|
|
|
|
|
Reflect.set(v, 'stopAnimation', config.stopAnimation);
|
|
|
|
|
Reflect.set(v, 'setPullingDistance', config.setPullingDistance);
|
|
|
|
|
return v;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-16 19:21:24 +08:00
|
|
|
|
var ValueType;
|
|
|
|
|
(function (ValueType) {
|
|
|
|
|
ValueType[ValueType["Undefined"] = 0] = "Undefined";
|
|
|
|
|
ValueType[ValueType["Point"] = 1] = "Point";
|
|
|
|
|
ValueType[ValueType["Percent"] = 2] = "Percent";
|
|
|
|
|
ValueType[ValueType["Auto"] = 3] = "Auto";
|
|
|
|
|
})(ValueType || (ValueType = {}));
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class FlexTypedValue {
|
|
|
|
|
constructor(type) {
|
|
|
|
|
this.value = 0;
|
|
|
|
|
this.type = type;
|
|
|
|
|
}
|
|
|
|
|
static percent(v) {
|
|
|
|
|
const ret = new FlexTypedValue(ValueType.Percent);
|
|
|
|
|
ret.value = v;
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
static point(v) {
|
|
|
|
|
const ret = new FlexTypedValue(ValueType.Point);
|
|
|
|
|
ret.value = v;
|
|
|
|
|
return ret;
|
2020-04-16 19:21:24 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
toModel() {
|
|
|
|
|
return {
|
|
|
|
|
type: this.type,
|
|
|
|
|
value: this.value,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
FlexTypedValue.Auto = new FlexTypedValue(ValueType.Auto);
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.FlexDirection = void 0;
|
2020-04-16 19:21:24 +08:00
|
|
|
|
(function (FlexDirection) {
|
|
|
|
|
FlexDirection[FlexDirection["COLUMN"] = 0] = "COLUMN";
|
|
|
|
|
FlexDirection[FlexDirection["COLUMN_REVERSE"] = 1] = "COLUMN_REVERSE";
|
|
|
|
|
FlexDirection[FlexDirection["ROW"] = 2] = "ROW";
|
|
|
|
|
FlexDirection[FlexDirection["ROW_REVERSE"] = 3] = "ROW_REVERSE";
|
|
|
|
|
})(exports.FlexDirection || (exports.FlexDirection = {}));
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.Align = void 0;
|
2020-04-16 19:21:24 +08:00
|
|
|
|
(function (Align) {
|
|
|
|
|
Align[Align["AUTO"] = 0] = "AUTO";
|
|
|
|
|
Align[Align["FLEX_START"] = 1] = "FLEX_START";
|
|
|
|
|
Align[Align["CENTER"] = 2] = "CENTER";
|
|
|
|
|
Align[Align["FLEX_END"] = 3] = "FLEX_END";
|
|
|
|
|
Align[Align["STRETCH"] = 4] = "STRETCH";
|
|
|
|
|
Align[Align["BASELINE"] = 5] = "BASELINE";
|
|
|
|
|
Align[Align["SPACE_BETWEEN"] = 6] = "SPACE_BETWEEN";
|
|
|
|
|
Align[Align["SPACE_AROUND"] = 7] = "SPACE_AROUND";
|
|
|
|
|
})(exports.Align || (exports.Align = {}));
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.Justify = void 0;
|
2020-04-16 19:21:24 +08:00
|
|
|
|
(function (Justify) {
|
|
|
|
|
Justify[Justify["FLEX_START"] = 0] = "FLEX_START";
|
|
|
|
|
Justify[Justify["CENTER"] = 1] = "CENTER";
|
|
|
|
|
Justify[Justify["FLEX_END"] = 2] = "FLEX_END";
|
|
|
|
|
Justify[Justify["SPACE_BETWEEN"] = 3] = "SPACE_BETWEEN";
|
|
|
|
|
Justify[Justify["SPACE_AROUND"] = 4] = "SPACE_AROUND";
|
|
|
|
|
Justify[Justify["SPACE_EVENLY"] = 5] = "SPACE_EVENLY";
|
|
|
|
|
})(exports.Justify || (exports.Justify = {}));
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.Direction = void 0;
|
2020-04-16 19:21:24 +08:00
|
|
|
|
(function (Direction) {
|
|
|
|
|
Direction[Direction["INHERIT"] = 0] = "INHERIT";
|
|
|
|
|
Direction[Direction["LTR"] = 1] = "LTR";
|
|
|
|
|
Direction[Direction["RTL"] = 2] = "RTL";
|
|
|
|
|
})(exports.Direction || (exports.Direction = {}));
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.PositionType = void 0;
|
2020-04-16 19:21:24 +08:00
|
|
|
|
(function (PositionType) {
|
|
|
|
|
PositionType[PositionType["RELATIVE"] = 0] = "RELATIVE";
|
|
|
|
|
PositionType[PositionType["ABSOLUTE"] = 1] = "ABSOLUTE";
|
|
|
|
|
})(exports.PositionType || (exports.PositionType = {}));
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.Wrap = void 0;
|
2020-04-16 19:21:24 +08:00
|
|
|
|
(function (Wrap) {
|
|
|
|
|
Wrap[Wrap["NO_WRAP"] = 0] = "NO_WRAP";
|
|
|
|
|
Wrap[Wrap["WRAP"] = 1] = "WRAP";
|
|
|
|
|
Wrap[Wrap["WRAP_REVERSE"] = 2] = "WRAP_REVERSE";
|
|
|
|
|
})(exports.Wrap || (exports.Wrap = {}));
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.OverFlow = void 0;
|
2020-04-16 19:21:24 +08:00
|
|
|
|
(function (OverFlow) {
|
|
|
|
|
OverFlow[OverFlow["VISIBLE"] = 0] = "VISIBLE";
|
|
|
|
|
OverFlow[OverFlow["HIDDEN"] = 1] = "HIDDEN";
|
|
|
|
|
OverFlow[OverFlow["SCROLL"] = 2] = "SCROLL";
|
|
|
|
|
})(exports.OverFlow || (exports.OverFlow = {}));
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.Display = void 0;
|
2020-04-16 19:21:24 +08:00
|
|
|
|
(function (Display) {
|
|
|
|
|
Display[Display["FLEX"] = 0] = "FLEX";
|
|
|
|
|
Display[Display["NONE"] = 1] = "NONE";
|
|
|
|
|
})(exports.Display || (exports.Display = {}));
|
|
|
|
|
|
2021-09-02 12:03:19 +08:00
|
|
|
|
exports.jsx = void 0;
|
|
|
|
|
(function (jsx) {
|
|
|
|
|
function createElement(constructor, config, ...children) {
|
2022-08-04 14:12:59 +08:00
|
|
|
|
var _a;
|
2022-07-04 14:13:41 +08:00
|
|
|
|
if (!!constructor.isViewClass) {
|
|
|
|
|
const e = new constructor();
|
|
|
|
|
if (e instanceof Fragment) {
|
|
|
|
|
return children;
|
2021-09-03 13:42:25 +08:00
|
|
|
|
}
|
2022-08-04 14:12:59 +08:00
|
|
|
|
e.layoutConfig = (_a = e.layoutConfig) !== null && _a !== void 0 ? _a : layoutConfig().fit();
|
2022-07-04 14:13:41 +08:00
|
|
|
|
if (config) {
|
|
|
|
|
e.apply(config);
|
2021-09-01 10:47:40 +08:00
|
|
|
|
}
|
2022-07-04 14:13:41 +08:00
|
|
|
|
if (children && children.length > 0) {
|
|
|
|
|
if (children.length === 1) {
|
|
|
|
|
children = children[0];
|
|
|
|
|
}
|
|
|
|
|
if (Reflect.has(e, "innerElement")) {
|
|
|
|
|
Reflect.set(e, "innerElement", children, e);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
throw new Error(`Do not support ${constructor.name} for ${children}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return e;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
const f = constructor;
|
2022-07-20 20:51:26 +08:00
|
|
|
|
const args = config !== null && config !== void 0 ? config : {};
|
2022-07-04 14:13:41 +08:00
|
|
|
|
if (children && children.length > 0) {
|
|
|
|
|
if (children.length === 1) {
|
|
|
|
|
children = children[0];
|
|
|
|
|
}
|
2022-07-20 20:51:26 +08:00
|
|
|
|
args.innerElement = children;
|
|
|
|
|
}
|
|
|
|
|
const e = Reflect.apply(f, undefined, [args]);
|
|
|
|
|
if (e instanceof Fragment) {
|
|
|
|
|
return children;
|
2021-09-01 10:47:40 +08:00
|
|
|
|
}
|
2022-07-04 14:13:41 +08:00
|
|
|
|
return e;
|
2021-09-01 10:47:40 +08:00
|
|
|
|
}
|
2021-09-02 12:03:19 +08:00
|
|
|
|
}
|
|
|
|
|
jsx.createElement = createElement;
|
|
|
|
|
class Fragment extends Group {
|
|
|
|
|
}
|
|
|
|
|
jsx.Fragment = Fragment;
|
|
|
|
|
})(exports.jsx || (exports.jsx = {}));
|
2021-09-01 10:47:40 +08:00
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$7 = (undefined && undefined.__metadata) || function (k, v) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class FlowLayoutItem extends Stack {
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], FlowLayoutItem.prototype, "identifier", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2021-10-11 16:26:56 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Boolean)
|
2021-10-11 16:26:56 +08:00
|
|
|
|
], FlowLayoutItem.prototype, "fullSpan", void 0);
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class FlowLayout extends Superview {
|
|
|
|
|
constructor() {
|
|
|
|
|
super(...arguments);
|
|
|
|
|
this.cachedViews = new Map;
|
|
|
|
|
this.columnCount = 2;
|
|
|
|
|
this.itemCount = 0;
|
|
|
|
|
this.batchCount = 15;
|
|
|
|
|
}
|
|
|
|
|
allSubviews() {
|
2021-10-11 11:14:55 +08:00
|
|
|
|
const ret = [...this.cachedViews.values()];
|
2020-07-03 16:53:31 +08:00
|
|
|
|
if (this.loadMoreView) {
|
2021-10-11 11:14:55 +08:00
|
|
|
|
ret.push(this.loadMoreView);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2021-10-11 11:14:55 +08:00
|
|
|
|
return ret;
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
2021-10-11 18:10:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* @param context
|
2021-10-12 16:33:04 +08:00
|
|
|
|
* @returns Returns array of visible view's index.
|
2021-10-11 18:10:59 +08:00
|
|
|
|
*/
|
|
|
|
|
findVisibleItems(context) {
|
|
|
|
|
return this.nativeChannel(context, 'findVisibleItems')();
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* @param context
|
2021-10-12 16:33:04 +08:00
|
|
|
|
* @returns Returns array of completely visible view's index.
|
2021-10-11 18:10:59 +08:00
|
|
|
|
*/
|
|
|
|
|
findCompletelyVisibleItems(context) {
|
|
|
|
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
|
|
|
|
}
|
2022-08-16 17:57:51 +08:00
|
|
|
|
/**
|
|
|
|
|
* Reload all list items.
|
|
|
|
|
* @param context
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
|
|
|
|
reload(context) {
|
|
|
|
|
return this.nativeChannel(context, 'reload')();
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
reset() {
|
|
|
|
|
this.cachedViews.clear();
|
|
|
|
|
this.itemCount = 0;
|
|
|
|
|
}
|
|
|
|
|
getItem(itemIdx) {
|
|
|
|
|
let view = this.renderItem(itemIdx);
|
|
|
|
|
view.superview = this;
|
|
|
|
|
this.cachedViews.set(`${itemIdx}`, view);
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
|
renderBunchedItems(start, length) {
|
2023-03-22 15:18:08 +08:00
|
|
|
|
const items = new Array(Math.max(0, Math.min(length, this.itemCount - start)))
|
|
|
|
|
.fill(0).map((_, idx) => this.getItem(start + idx));
|
|
|
|
|
const ret = items.map(e => deepClone(e.toModel()));
|
|
|
|
|
items.forEach(e => e.clean());
|
|
|
|
|
return ret;
|
2020-07-03 16:53:31 +08:00
|
|
|
|
}
|
|
|
|
|
toModel() {
|
|
|
|
|
if (this.loadMoreView) {
|
|
|
|
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
return super.toModel();
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], FlowLayout.prototype, "columnCount", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], FlowLayout.prototype, "columnSpace", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], FlowLayout.prototype, "rowSpace", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], FlowLayout.prototype, "itemCount", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], FlowLayout.prototype, "renderItem", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Object)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], FlowLayout.prototype, "batchCount", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], FlowLayout.prototype, "onLoadMore", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Boolean)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], FlowLayout.prototype, "loadMore", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", FlowLayoutItem)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], FlowLayout.prototype, "loadMoreView", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], FlowLayout.prototype, "onScroll", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], FlowLayout.prototype, "onScrollEnd", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2021-04-23 17:57:34 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Boolean)
|
2021-04-23 17:57:34 +08:00
|
|
|
|
], FlowLayout.prototype, "scrollable", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$7([
|
2021-04-30 14:32:53 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$7("design:type", Boolean)
|
2021-04-30 14:32:53 +08:00
|
|
|
|
], FlowLayout.prototype, "bounces", void 0);
|
2023-03-13 19:17:56 +08:00
|
|
|
|
__decorate$7([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$7("design:type", Boolean)
|
|
|
|
|
], FlowLayout.prototype, "scrollsToTop", void 0);
|
2022-08-25 10:52:01 +08:00
|
|
|
|
__decorate$7([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$7("design:type", Boolean)
|
|
|
|
|
], FlowLayout.prototype, "canDrag", void 0);
|
2022-08-26 14:16:12 +08:00
|
|
|
|
__decorate$7([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$7("design:type", Function)
|
|
|
|
|
], FlowLayout.prototype, "itemCanDrag", void 0);
|
2022-08-25 10:52:01 +08:00
|
|
|
|
__decorate$7([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$7("design:type", Function)
|
|
|
|
|
], FlowLayout.prototype, "beforeDragging", void 0);
|
|
|
|
|
__decorate$7([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$7("design:type", Function)
|
|
|
|
|
], FlowLayout.prototype, "onDragging", void 0);
|
|
|
|
|
__decorate$7([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$7("design:type", Function)
|
|
|
|
|
], FlowLayout.prototype, "onDragged", void 0);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
function flowlayout(config) {
|
|
|
|
|
const ret = new FlowLayout;
|
|
|
|
|
for (let key in config) {
|
|
|
|
|
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2020-01-04 19:13:15 +08:00
|
|
|
|
function flowItem(item, config) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return (new FlowLayoutItem).also((it) => {
|
|
|
|
|
it.layoutConfig = layoutConfig().fit();
|
2020-01-04 19:13:15 +08:00
|
|
|
|
if (item instanceof View) {
|
|
|
|
|
it.addChild(item);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
item.forEach(e => {
|
|
|
|
|
it.addChild(e);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (config) {
|
2021-08-31 12:49:47 +08:00
|
|
|
|
it.apply(config);
|
2020-01-04 19:13:15 +08:00
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$6 = (undefined && undefined.__metadata) || function (k, v) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
2021-06-11 15:17:20 +08:00
|
|
|
|
exports.ReturnKeyType = void 0;
|
|
|
|
|
(function (ReturnKeyType) {
|
|
|
|
|
ReturnKeyType[ReturnKeyType["Default"] = 0] = "Default";
|
|
|
|
|
ReturnKeyType[ReturnKeyType["Done"] = 1] = "Done";
|
|
|
|
|
ReturnKeyType[ReturnKeyType["Search"] = 2] = "Search";
|
|
|
|
|
ReturnKeyType[ReturnKeyType["Next"] = 3] = "Next";
|
|
|
|
|
ReturnKeyType[ReturnKeyType["Go"] = 4] = "Go";
|
|
|
|
|
ReturnKeyType[ReturnKeyType["Send"] = 5] = "Send";
|
|
|
|
|
})(exports.ReturnKeyType || (exports.ReturnKeyType = {}));
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class Input extends View {
|
|
|
|
|
getText(context) {
|
|
|
|
|
return this.nativeChannel(context, 'getText')();
|
|
|
|
|
}
|
|
|
|
|
setSelection(context, start, end = start) {
|
|
|
|
|
return this.nativeChannel(context, 'setSelection')({
|
|
|
|
|
start,
|
|
|
|
|
end,
|
|
|
|
|
});
|
|
|
|
|
}
|
2021-06-11 17:40:02 +08:00
|
|
|
|
getSelection(context) {
|
|
|
|
|
return this.nativeChannel(context, 'getSelection')();
|
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
requestFocus(context) {
|
|
|
|
|
return this.nativeChannel(context, 'requestFocus')();
|
|
|
|
|
}
|
|
|
|
|
releaseFocus(context) {
|
|
|
|
|
return this.nativeChannel(context, 'releaseFocus')();
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2021-03-03 16:13:58 +08:00
|
|
|
|
InconsistProperty,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Input.prototype, "text", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Color)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Input.prototype, "textColor", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Input.prototype, "textSize", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2021-07-20 15:38:25 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", String)
|
2021-07-20 15:38:25 +08:00
|
|
|
|
], Input.prototype, "font", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", String)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Input.prototype, "hintText", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2021-07-20 15:38:25 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", String)
|
2021-07-20 15:38:25 +08:00
|
|
|
|
], Input.prototype, "hintFont", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Input.prototype, "inputType", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Color)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Input.prototype, "hintTextColor", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Boolean)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Input.prototype, "multiline", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Gravity)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Input.prototype, "textAlignment", void 0);
|
2023-01-12 11:09:22 +08:00
|
|
|
|
__decorate$6([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$6("design:type", String)
|
|
|
|
|
], Input.prototype, "fontStyle", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Input.prototype, "onTextChange", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Input.prototype, "onFocusChange", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Number)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Input.prototype, "maxLength", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2021-02-08 18:18:37 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Boolean)
|
2021-02-08 18:18:37 +08:00
|
|
|
|
], Input.prototype, "password", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2021-06-11 15:17:20 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Boolean)
|
2021-06-11 15:17:20 +08:00
|
|
|
|
], Input.prototype, "editable", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2021-06-11 15:17:20 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Number)
|
2021-06-11 15:17:20 +08:00
|
|
|
|
], Input.prototype, "returnKeyType", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2021-06-11 15:17:20 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Function)
|
2021-06-11 15:17:20 +08:00
|
|
|
|
], Input.prototype, "onSubmitEditing", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2021-07-29 16:29:01 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Boolean)
|
2021-07-29 16:29:01 +08:00
|
|
|
|
], Input.prototype, "enableHorizontalScrollBar", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2021-07-29 16:29:01 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Boolean)
|
2021-07-29 16:29:01 +08:00
|
|
|
|
], Input.prototype, "enableVerticalScrollBar", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$6([
|
2021-06-11 17:47:06 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$6("design:type", Function)
|
2021-06-11 17:47:06 +08:00
|
|
|
|
], Input.prototype, "beforeTextChange", void 0);
|
2022-08-25 10:42:56 +08:00
|
|
|
|
__decorate$6([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$6("design:type", Object)
|
|
|
|
|
], Input.prototype, "padding", void 0);
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.InputType = void 0;
|
2020-06-13 11:58:24 +08:00
|
|
|
|
(function (InputType) {
|
|
|
|
|
InputType[InputType["Default"] = 0] = "Default";
|
|
|
|
|
InputType[InputType["Number"] = 1] = "Number";
|
|
|
|
|
InputType[InputType["Decimal"] = 2] = "Decimal";
|
|
|
|
|
InputType[InputType["Alphabet"] = 3] = "Alphabet";
|
|
|
|
|
InputType[InputType["Phone"] = 4] = "Phone";
|
|
|
|
|
})(exports.InputType || (exports.InputType = {}));
|
2020-01-03 13:35:40 +08:00
|
|
|
|
function input(config) {
|
|
|
|
|
const ret = new Input;
|
|
|
|
|
ret.layoutConfig = layoutConfig().just();
|
2021-08-31 12:49:47 +08:00
|
|
|
|
ret.apply(config);
|
2020-01-03 13:35:40 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$5 = (undefined && undefined.__metadata) || function (k, v) {
|
2019-12-23 15:29:38 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class NestedSlider extends Group {
|
|
|
|
|
addSlideItem(view) {
|
|
|
|
|
this.addChild(view);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-07-03 16:53:31 +08:00
|
|
|
|
slidePage(context, page, smooth = false) {
|
|
|
|
|
return this.nativeChannel(context, "slidePage")({ page, smooth });
|
|
|
|
|
}
|
|
|
|
|
getSlidedPage(context) {
|
|
|
|
|
return this.nativeChannel(context, "getSlidedPage")();
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$5([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$5("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], NestedSlider.prototype, "onPageSlided", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$5([
|
2021-04-23 17:57:34 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$5("design:type", Boolean)
|
2021-04-23 17:57:34 +08:00
|
|
|
|
], NestedSlider.prototype, "scrollable", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$5([
|
2021-04-30 14:32:53 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$5("design:type", Boolean)
|
2021-04-30 14:32:53 +08:00
|
|
|
|
], NestedSlider.prototype, "bounces", void 0);
|
2023-03-13 19:17:56 +08:00
|
|
|
|
__decorate$5([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata$5("design:type", Boolean)
|
|
|
|
|
], NestedSlider.prototype, "scrollsToTop", void 0);
|
2023-04-04 20:28:31 +08:00
|
|
|
|
__decorate$5([
|
|
|
|
|
InconsistProperty,
|
|
|
|
|
__metadata$5("design:type", Number)
|
|
|
|
|
], NestedSlider.prototype, "slidePosition", void 0);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2020-01-02 20:02:21 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$4 = (undefined && undefined.__metadata) || function (k, v) {
|
2020-01-02 20:02:21 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
2021-09-22 15:30:08 +08:00
|
|
|
|
/**
|
|
|
|
|
* @deprecated The class should not be used, please use GestureContainer class instead
|
|
|
|
|
*/
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class Draggable extends Stack {
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$4([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$4("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Draggable.prototype, "onDrag", void 0);
|
2021-09-22 15:30:08 +08:00
|
|
|
|
/**
|
|
|
|
|
* @deprecated The function should not be used, please use gestureContainer function instead
|
|
|
|
|
*/
|
2020-01-04 19:13:15 +08:00
|
|
|
|
function draggable(views, config) {
|
2020-01-02 20:02:21 +08:00
|
|
|
|
const ret = new Draggable;
|
|
|
|
|
ret.layoutConfig = layoutConfig().fit();
|
2020-01-04 19:13:15 +08:00
|
|
|
|
if (views instanceof View) {
|
|
|
|
|
ret.addChild(views);
|
2020-01-02 20:02:21 +08:00
|
|
|
|
}
|
2020-01-04 19:13:15 +08:00
|
|
|
|
else {
|
|
|
|
|
views.forEach(e => {
|
|
|
|
|
ret.addChild(e);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (config) {
|
2021-08-31 12:49:47 +08:00
|
|
|
|
ret.apply(config);
|
2020-01-02 20:02:21 +08:00
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2020-03-13 13:01:21 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$3 = (undefined && undefined.__metadata) || function (k, v) {
|
2020-03-13 13:01:21 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
2020-07-03 16:53:31 +08:00
|
|
|
|
class Switch extends View {
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$3([
|
2021-03-03 16:13:58 +08:00
|
|
|
|
InconsistProperty,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$3("design:type", Boolean)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Switch.prototype, "state", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$3([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$3("design:type", Function)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Switch.prototype, "onSwitch", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$3([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$3("design:type", Color)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Switch.prototype, "offTintColor", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$3([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$3("design:type", Color)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Switch.prototype, "onTintColor", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$3([
|
2020-07-03 16:53:31 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$3("design:type", Color)
|
2020-07-03 16:53:31 +08:00
|
|
|
|
], Switch.prototype, "thumbTintColor", void 0);
|
2020-03-13 13:01:21 +08:00
|
|
|
|
function switchView(config) {
|
|
|
|
|
const ret = new Switch;
|
|
|
|
|
ret.layoutConfig = layoutConfig().just();
|
|
|
|
|
ret.width = 50;
|
|
|
|
|
ret.height = 30;
|
2021-08-31 12:49:47 +08:00
|
|
|
|
ret.apply(config);
|
2020-03-13 13:01:21 +08:00
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2021-09-22 10:28:02 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$2 = (undefined && undefined.__metadata) || function (k, v) {
|
2021-09-22 10:28:02 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
|
|
|
|
exports.SwipeOrientation = void 0;
|
|
|
|
|
(function (SwipeOrientation) {
|
|
|
|
|
SwipeOrientation[SwipeOrientation["LEFT"] = 0] = "LEFT";
|
|
|
|
|
SwipeOrientation[SwipeOrientation["RIGHT"] = 1] = "RIGHT";
|
|
|
|
|
SwipeOrientation[SwipeOrientation["TOP"] = 2] = "TOP";
|
|
|
|
|
SwipeOrientation[SwipeOrientation["BOTTOM"] = 3] = "BOTTOM";
|
|
|
|
|
})(exports.SwipeOrientation || (exports.SwipeOrientation = {}));
|
|
|
|
|
class GestureContainer extends Stack {
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$2([
|
2021-09-22 10:28:02 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$2("design:type", Function)
|
2021-09-22 10:28:02 +08:00
|
|
|
|
], GestureContainer.prototype, "onSingleTap", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$2([
|
2021-09-22 10:28:02 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$2("design:type", Function)
|
2021-09-22 10:28:02 +08:00
|
|
|
|
], GestureContainer.prototype, "onDoubleTap", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$2([
|
2021-09-22 10:28:02 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$2("design:type", Function)
|
2021-09-22 10:28:02 +08:00
|
|
|
|
], GestureContainer.prototype, "onLongPress", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$2([
|
2021-09-22 10:28:02 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$2("design:type", Function)
|
2021-09-22 10:28:02 +08:00
|
|
|
|
], GestureContainer.prototype, "onPinch", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$2([
|
2021-09-22 10:28:02 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$2("design:type", Function)
|
2021-09-22 10:28:02 +08:00
|
|
|
|
], GestureContainer.prototype, "onPan", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$2([
|
2021-09-22 10:28:02 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$2("design:type", Function)
|
2021-09-22 10:28:02 +08:00
|
|
|
|
], GestureContainer.prototype, "onRotate", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$2([
|
2021-09-22 10:28:02 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$2("design:type", Function)
|
2021-09-22 10:28:02 +08:00
|
|
|
|
], GestureContainer.prototype, "onSwipe", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$2([
|
2021-09-22 15:30:08 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$2("design:type", Function)
|
2021-09-22 15:30:08 +08:00
|
|
|
|
], GestureContainer.prototype, "onTouchDown", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$2([
|
2021-09-22 15:30:08 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$2("design:type", Function)
|
2021-09-22 15:30:08 +08:00
|
|
|
|
], GestureContainer.prototype, "onTouchMove", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$2([
|
2021-09-22 15:30:08 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$2("design:type", Function)
|
2021-09-22 15:30:08 +08:00
|
|
|
|
], GestureContainer.prototype, "onTouchUp", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$2([
|
2021-09-22 15:30:08 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$2("design:type", Function)
|
2021-09-22 15:30:08 +08:00
|
|
|
|
], GestureContainer.prototype, "onTouchCancel", void 0);
|
2021-09-22 10:28:02 +08:00
|
|
|
|
function gestureContainer(views, config) {
|
|
|
|
|
const ret = new GestureContainer;
|
|
|
|
|
ret.layoutConfig = layoutConfig().fit();
|
|
|
|
|
if (views instanceof View) {
|
|
|
|
|
ret.addChild(views);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
views.forEach(e => {
|
|
|
|
|
ret.addChild(e);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (config) {
|
|
|
|
|
ret.apply(config);
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
2021-11-24 14:37:48 +08:00
|
|
|
|
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);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
2022-08-23 11:20:36 +08:00
|
|
|
|
var __metadata$1 = (undefined && undefined.__metadata) || function (k, v) {
|
2021-11-24 14:37:48 +08:00
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
|
|
|
|
class BlurEffect extends Stack {
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$1([
|
2021-11-24 14:37:48 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$1("design:type", Object)
|
2021-11-24 14:37:48 +08:00
|
|
|
|
], BlurEffect.prototype, "effectiveRect", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$1([
|
2021-11-24 14:37:48 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$1("design:type", Number)
|
2021-11-24 14:37:48 +08:00
|
|
|
|
], BlurEffect.prototype, "radius", void 0);
|
2021-11-25 12:00:58 +08:00
|
|
|
|
class AeroEffect extends Stack {
|
|
|
|
|
}
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$1([
|
2021-11-25 12:00:58 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$1("design:type", Object)
|
2021-11-25 12:00:58 +08:00
|
|
|
|
], AeroEffect.prototype, "effectiveRect", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate$1([
|
2021-11-25 16:30:29 +08:00
|
|
|
|
Property,
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__metadata$1("design:type", String)
|
2021-11-25 16:30:29 +08:00
|
|
|
|
], AeroEffect.prototype, "style", void 0);
|
2021-11-24 14:37:48 +08:00
|
|
|
|
function blurEffect(views, config) {
|
|
|
|
|
const ret = new BlurEffect;
|
|
|
|
|
ret.layoutConfig = layoutConfig().fit();
|
|
|
|
|
if (views instanceof View) {
|
|
|
|
|
ret.addChild(views);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
views.forEach(e => {
|
|
|
|
|
ret.addChild(e);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (config) {
|
|
|
|
|
ret.apply(config);
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2021-11-25 12:00:58 +08:00
|
|
|
|
function aeroEffect(views, config) {
|
|
|
|
|
const ret = new AeroEffect;
|
|
|
|
|
ret.layoutConfig = layoutConfig().fit();
|
|
|
|
|
if (views instanceof View) {
|
|
|
|
|
ret.addChild(views);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
views.forEach(e => {
|
|
|
|
|
ret.addChild(e);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (config) {
|
|
|
|
|
ret.apply(config);
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
2021-11-24 14:37:48 +08:00
|
|
|
|
|
2022-08-23 11:20:36 +08:00
|
|
|
|
/*
|
|
|
|
|
* Copyright [2022] [Doric.Pub]
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
var __decorate = (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;
|
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
|
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
|
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
|
|
|
};
|
|
|
|
|
var __metadata = (undefined && undefined.__metadata) || function (k, v) {
|
|
|
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
|
|
|
};
|
|
|
|
|
class HorizontalListItem extends Stack {
|
|
|
|
|
}
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", String)
|
|
|
|
|
], HorizontalListItem.prototype, "identifier", void 0);
|
|
|
|
|
class HorizontalList extends Superview {
|
|
|
|
|
constructor() {
|
|
|
|
|
super(...arguments);
|
|
|
|
|
this.cachedViews = new Map;
|
|
|
|
|
this.itemCount = 0;
|
|
|
|
|
this.batchCount = 15;
|
|
|
|
|
}
|
|
|
|
|
allSubviews() {
|
|
|
|
|
const ret = [...this.cachedViews.values()];
|
|
|
|
|
if (this.loadMoreView) {
|
|
|
|
|
ret.push(this.loadMoreView);
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
scrollToItem(context, index, config) {
|
|
|
|
|
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
|
|
|
|
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* @param context
|
|
|
|
|
* @returns Returns array of visible view's index.
|
|
|
|
|
*/
|
|
|
|
|
findVisibleItems(context) {
|
|
|
|
|
return this.nativeChannel(context, 'findVisibleItems')();
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* @param context
|
|
|
|
|
* @returns Returns array of completely visible view's index.
|
|
|
|
|
*/
|
|
|
|
|
findCompletelyVisibleItems(context) {
|
|
|
|
|
return this.nativeChannel(context, 'findCompletelyVisibleItems')();
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Reload all list items.
|
|
|
|
|
* @param context
|
|
|
|
|
* @returns
|
|
|
|
|
*/
|
|
|
|
|
reload(context) {
|
|
|
|
|
return this.nativeChannel(context, 'reload')();
|
|
|
|
|
}
|
|
|
|
|
reset() {
|
|
|
|
|
this.cachedViews.clear();
|
|
|
|
|
this.itemCount = 0;
|
|
|
|
|
}
|
|
|
|
|
getItem(itemIdx) {
|
|
|
|
|
let view = this.renderItem(itemIdx);
|
|
|
|
|
view.superview = this;
|
|
|
|
|
this.cachedViews.set(`${itemIdx}`, view);
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
|
renderBunchedItems(start, length) {
|
2023-03-22 15:18:08 +08:00
|
|
|
|
const items = new Array(Math.max(0, Math.min(length, this.itemCount - start)))
|
|
|
|
|
.fill(0).map((_, idx) => this.getItem(start + idx));
|
|
|
|
|
const ret = items.map(e => deepClone(e.toModel()));
|
|
|
|
|
items.forEach(e => e.clean());
|
|
|
|
|
return ret;
|
2022-08-23 11:20:36 +08:00
|
|
|
|
}
|
|
|
|
|
toModel() {
|
|
|
|
|
if (this.loadMoreView) {
|
|
|
|
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
|
|
|
|
}
|
|
|
|
|
return super.toModel();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Object)
|
|
|
|
|
], HorizontalList.prototype, "itemCount", void 0);
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Function)
|
|
|
|
|
], HorizontalList.prototype, "renderItem", void 0);
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Object)
|
|
|
|
|
], HorizontalList.prototype, "batchCount", void 0);
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Function)
|
|
|
|
|
], HorizontalList.prototype, "onLoadMore", void 0);
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Boolean)
|
|
|
|
|
], HorizontalList.prototype, "loadMore", void 0);
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", HorizontalListItem)
|
|
|
|
|
], HorizontalList.prototype, "loadMoreView", void 0);
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Function)
|
|
|
|
|
], HorizontalList.prototype, "onScroll", void 0);
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Function)
|
|
|
|
|
], HorizontalList.prototype, "onScrollEnd", void 0);
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Number)
|
|
|
|
|
], HorizontalList.prototype, "scrolledPosition", void 0);
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Boolean)
|
|
|
|
|
], HorizontalList.prototype, "scrollable", void 0);
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Boolean)
|
|
|
|
|
], HorizontalList.prototype, "bounces", void 0);
|
2023-03-13 19:17:56 +08:00
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Boolean)
|
|
|
|
|
], HorizontalList.prototype, "scrollsToTop", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Boolean)
|
|
|
|
|
], HorizontalList.prototype, "canDrag", void 0);
|
2022-08-26 14:16:12 +08:00
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Function)
|
|
|
|
|
], HorizontalList.prototype, "itemCanDrag", void 0);
|
2022-08-23 11:20:36 +08:00
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Function)
|
|
|
|
|
], HorizontalList.prototype, "beforeDragging", void 0);
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Function)
|
|
|
|
|
], HorizontalList.prototype, "onDragging", void 0);
|
|
|
|
|
__decorate([
|
|
|
|
|
Property,
|
|
|
|
|
__metadata("design:type", Function)
|
|
|
|
|
], HorizontalList.prototype, "onDragged", void 0);
|
|
|
|
|
function horizontalList(config) {
|
|
|
|
|
const ret = new HorizontalList;
|
|
|
|
|
ret.apply(config);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
function horizontalListItem(item, config) {
|
|
|
|
|
return (new HorizontalListItem).also((it) => {
|
|
|
|
|
it.layoutConfig = layoutConfig().fit();
|
|
|
|
|
if (item instanceof View) {
|
|
|
|
|
it.addChild(item);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
item.forEach(e => {
|
|
|
|
|
it.addChild(e);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (config) {
|
|
|
|
|
it.apply(config);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-23 17:57:34 +08:00
|
|
|
|
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);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-23 15:29:38 +08:00
|
|
|
|
function navbar(context) {
|
|
|
|
|
const entity = context.entity;
|
2020-01-10 15:55:47 +08:00
|
|
|
|
let panel = undefined;
|
|
|
|
|
if (entity instanceof Panel) {
|
|
|
|
|
panel = entity;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return {
|
|
|
|
|
isHidden: () => {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('navbar', 'isHidden');
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
setHidden: (hidden) => {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('navbar', 'setHidden', { hidden, });
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
setTitle: (title) => {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('navbar', 'setTitle', { title, });
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
setBgColor: (color) => {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('navbar', 'setBgColor', { color: color.toModel(), });
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
2020-01-10 15:55:47 +08:00
|
|
|
|
setLeft: (view) => {
|
|
|
|
|
if (panel) {
|
|
|
|
|
panel.clearHeadViews("navbar_left");
|
|
|
|
|
panel.addHeadView("navbar_left", view);
|
|
|
|
|
}
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('navbar', 'setLeft', view.toModel());
|
2020-01-10 15:55:47 +08:00
|
|
|
|
},
|
|
|
|
|
setRight: (view) => {
|
|
|
|
|
if (panel) {
|
|
|
|
|
panel.clearHeadViews("navbar_right");
|
|
|
|
|
panel.addHeadView("navbar_right", view);
|
|
|
|
|
}
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('navbar', 'setRight', view.toModel());
|
2020-04-30 14:53:09 +08:00
|
|
|
|
},
|
|
|
|
|
setCenter: (view) => {
|
|
|
|
|
if (panel) {
|
|
|
|
|
panel.clearHeadViews("navbar_center");
|
|
|
|
|
panel.addHeadView("navbar_center", view);
|
|
|
|
|
}
|
|
|
|
|
return context.callNative('navbar', 'setCenter', view.toModel());
|
|
|
|
|
},
|
2019-12-23 15:29:38 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-04 18:51:08 +08:00
|
|
|
|
function internalScheme(context, panelClass) {
|
|
|
|
|
return `_internal_://export?class=${encodeURIComponent(panelClass.name)}&context=${context.id}`;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
function navigator(context) {
|
2020-04-01 15:19:37 +08:00
|
|
|
|
const moduleName = "navigator";
|
2019-12-23 15:29:38 +08:00
|
|
|
|
return {
|
2020-02-17 21:23:02 +08:00
|
|
|
|
push: (source, config) => {
|
2020-09-04 18:22:45 +08:00
|
|
|
|
if (typeof source === 'function') {
|
2020-09-04 18:51:08 +08:00
|
|
|
|
source = internalScheme(context, source);
|
2020-09-04 18:22:45 +08:00
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
if (config && config.extra) {
|
|
|
|
|
config.extra = JSON.stringify(config.extra);
|
|
|
|
|
}
|
2020-04-01 15:19:37 +08:00
|
|
|
|
return context.callNative(moduleName, 'push', {
|
2020-02-17 21:23:02 +08:00
|
|
|
|
source, config
|
2019-12-23 15:29:38 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
pop: (animated = true) => {
|
2020-04-01 15:19:37 +08:00
|
|
|
|
return context.callNative(moduleName, 'pop', { animated });
|
|
|
|
|
},
|
2021-06-08 11:55:21 +08:00
|
|
|
|
popSelf: (animated = true) => {
|
|
|
|
|
return context.callNative(moduleName, 'popSelf', { animated });
|
|
|
|
|
},
|
|
|
|
|
popToRoot: (animated = true) => {
|
|
|
|
|
return context.callNative(moduleName, 'popToRoot', { animated });
|
|
|
|
|
},
|
2020-04-01 15:19:37 +08:00
|
|
|
|
openUrl: (url) => {
|
|
|
|
|
return context.callNative(moduleName, "openUrl", url);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function transformRequest(request) {
|
|
|
|
|
let url = request.url || "";
|
|
|
|
|
if (request.params !== undefined) {
|
|
|
|
|
const queryStrings = [];
|
|
|
|
|
for (let key in request.params) {
|
|
|
|
|
queryStrings.push(`${key}=${encodeURIComponent(request.params[key])}`);
|
|
|
|
|
}
|
|
|
|
|
request.url = `${request.url}${url.indexOf('?') >= 0 ? '&' : '?'}${queryStrings.join('&')}`;
|
|
|
|
|
}
|
|
|
|
|
if (typeof request.data === 'object') {
|
|
|
|
|
request.data = JSON.stringify(request.data);
|
|
|
|
|
}
|
|
|
|
|
return request;
|
|
|
|
|
}
|
|
|
|
|
function network(context) {
|
|
|
|
|
return {
|
|
|
|
|
request: (config) => {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('network', 'request', transformRequest(config));
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
get: (url, config) => {
|
|
|
|
|
let finalConfig = config;
|
|
|
|
|
if (finalConfig === undefined) {
|
|
|
|
|
finalConfig = {};
|
|
|
|
|
}
|
|
|
|
|
finalConfig.url = url;
|
|
|
|
|
finalConfig.method = "get";
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('network', 'request', transformRequest(finalConfig));
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
post: (url, data, config) => {
|
|
|
|
|
let finalConfig = config;
|
|
|
|
|
if (finalConfig === undefined) {
|
|
|
|
|
finalConfig = {};
|
|
|
|
|
}
|
|
|
|
|
finalConfig.url = url;
|
|
|
|
|
finalConfig.method = "post";
|
|
|
|
|
if (data !== undefined) {
|
|
|
|
|
finalConfig.data = data;
|
|
|
|
|
}
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('network', 'request', transformRequest(finalConfig));
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
put: (url, data, config) => {
|
|
|
|
|
let finalConfig = config;
|
|
|
|
|
if (finalConfig === undefined) {
|
|
|
|
|
finalConfig = {};
|
|
|
|
|
}
|
|
|
|
|
finalConfig.url = url;
|
|
|
|
|
finalConfig.method = "put";
|
|
|
|
|
if (data !== undefined) {
|
|
|
|
|
finalConfig.data = data;
|
|
|
|
|
}
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('network', 'request', transformRequest(finalConfig));
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
delete: (url, data, config) => {
|
|
|
|
|
let finalConfig = config;
|
|
|
|
|
if (finalConfig === undefined) {
|
|
|
|
|
finalConfig = {};
|
|
|
|
|
}
|
|
|
|
|
finalConfig.url = url;
|
|
|
|
|
finalConfig.method = "delete";
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('network', 'request', transformRequest(finalConfig));
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function storage(context) {
|
|
|
|
|
return {
|
|
|
|
|
setItem: (key, value, zone) => {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('storage', 'setItem', { key, value, zone });
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
getItem: (key, zone) => {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('storage', 'getItem', { key, zone });
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
remove: (key, zone) => {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('storage', 'remove', { key, zone });
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
clear: (zone) => {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('storage', 'clear', { zone });
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function popover(context) {
|
|
|
|
|
const entity = context.entity;
|
|
|
|
|
let panel = undefined;
|
|
|
|
|
if (entity instanceof Panel) {
|
|
|
|
|
panel = entity;
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
show: (view) => {
|
|
|
|
|
if (panel) {
|
2020-01-09 11:17:44 +08:00
|
|
|
|
panel.addHeadView("popover", view);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('popover', 'show', view.toModel());
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
dismiss: (view = undefined) => {
|
|
|
|
|
if (panel) {
|
|
|
|
|
if (view) {
|
2020-01-09 11:17:44 +08:00
|
|
|
|
panel.removeHeadView("popover", view);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
|
|
|
|
else {
|
2020-01-09 11:17:44 +08:00
|
|
|
|
panel.clearHeadViews("popover");
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('popover', 'dismiss', view ? { id: view.viewId } : undefined);
|
2019-12-23 15:29:38 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Copyright [2019] [Doric.Pub]
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
function take(target) {
|
|
|
|
|
return (block) => {
|
|
|
|
|
block(target);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
function takeNonNull(target) {
|
|
|
|
|
return (block) => {
|
|
|
|
|
if (target !== undefined) {
|
|
|
|
|
return block(target);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
function takeNull(target) {
|
|
|
|
|
return (block) => {
|
|
|
|
|
if (target === undefined) {
|
|
|
|
|
return block();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
function takeLet(target) {
|
|
|
|
|
return (block) => {
|
|
|
|
|
return block(target);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
function takeAlso(target) {
|
|
|
|
|
return (block) => {
|
|
|
|
|
block(target);
|
|
|
|
|
return target;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
function takeIf(target) {
|
|
|
|
|
return (predicate) => {
|
|
|
|
|
return predicate(target) ? target : undefined;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
function takeUnless(target) {
|
|
|
|
|
return (predicate) => {
|
|
|
|
|
return predicate(target) ? undefined : target;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
function repeat(action) {
|
|
|
|
|
return (times) => {
|
|
|
|
|
for (let i = 0; i < times; i++) {
|
|
|
|
|
action(i);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-18 19:06:10 +08:00
|
|
|
|
var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
2019-12-23 15:29:38 +08:00
|
|
|
|
/**
|
|
|
|
|
* Only supports x,y,width,height,corner(just for four corners),rotation,bgColor,
|
|
|
|
|
* @param panel @see Panel
|
|
|
|
|
*/
|
|
|
|
|
function animate(context) {
|
|
|
|
|
const entity = context.entity;
|
|
|
|
|
if (entity instanceof Panel) {
|
|
|
|
|
let panel = entity;
|
2021-11-18 19:06:10 +08:00
|
|
|
|
return (args) => __awaiter$1(this, void 0, void 0, function* () {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
yield context.callNative('animate', 'submit');
|
|
|
|
|
args.animations();
|
|
|
|
|
return takeLet(panel.getRootView())(root => {
|
|
|
|
|
if (root.isDirty()) {
|
|
|
|
|
const model = root.toModel();
|
|
|
|
|
model.duration = args.duration;
|
|
|
|
|
const ret = context.callNative('animate', 'animateRender', model);
|
|
|
|
|
root.clean();
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
for (let map of panel.allHeadViews()) {
|
|
|
|
|
for (let v of map.values()) {
|
|
|
|
|
if (v.isDirty()) {
|
|
|
|
|
const model_1 = v.toModel();
|
2021-12-03 15:37:42 +08:00
|
|
|
|
model_1.duration = args.duration;
|
2020-01-17 16:51:17 +08:00
|
|
|
|
const ret_1 = context.callNative('animate', 'animateRender', model_1);
|
|
|
|
|
v.clean();
|
|
|
|
|
return ret_1;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
2020-01-17 16:51:17 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
throw new Error('Cannot find any animated elements');
|
2019-12-23 15:29:38 +08:00
|
|
|
|
});
|
2020-01-17 16:51:17 +08:00
|
|
|
|
});
|
2019-12-23 15:29:38 +08:00
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return (args) => {
|
|
|
|
|
return Promise.reject(`Cannot find panel in Context:${context.id}`);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-08 20:18:19 +08:00
|
|
|
|
function notification(context) {
|
|
|
|
|
return {
|
2023-03-22 17:17:12 +08:00
|
|
|
|
/**
|
|
|
|
|
* @param androidSystem: when set true, using global broadcast instead of local broadcast by default
|
|
|
|
|
* @param iosUsingObject: when set true, using object instead of userInfo by default
|
|
|
|
|
*/
|
2020-01-08 20:18:19 +08:00
|
|
|
|
publish: (args) => {
|
|
|
|
|
if (args.data !== undefined) {
|
|
|
|
|
args.data = JSON.stringify(args.data);
|
|
|
|
|
}
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('notification', 'publish', args);
|
2020-01-08 20:18:19 +08:00
|
|
|
|
},
|
2023-03-22 17:17:12 +08:00
|
|
|
|
/**
|
|
|
|
|
* @param androidSystem: when set true, using global broadcast instead of local broadcast by default
|
|
|
|
|
* @param iosUsingObject: when set true, using object instead of userInfo by default
|
|
|
|
|
*/
|
2020-01-08 20:18:19 +08:00
|
|
|
|
subscribe: (args) => {
|
|
|
|
|
args.callback = context.function2Id(args.callback);
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('notification', 'subscribe', args);
|
2020-01-08 20:18:19 +08:00
|
|
|
|
},
|
|
|
|
|
unsubscribe: (subscribeId) => {
|
|
|
|
|
context.removeFuncById(subscribeId);
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('notification', 'unsubscribe', subscribeId);
|
2020-01-08 20:18:19 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-19 17:33:10 +08:00
|
|
|
|
exports.StatusBarMode = void 0;
|
2020-01-14 10:59:42 +08:00
|
|
|
|
(function (StatusBarMode) {
|
|
|
|
|
StatusBarMode[StatusBarMode["LIGHT"] = 0] = "LIGHT";
|
|
|
|
|
StatusBarMode[StatusBarMode["DARK"] = 1] = "DARK";
|
|
|
|
|
})(exports.StatusBarMode || (exports.StatusBarMode = {}));
|
|
|
|
|
function statusbar(context) {
|
|
|
|
|
return {
|
|
|
|
|
setHidden: (hidden) => {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('statusbar', 'setHidden', { hidden });
|
2020-01-14 10:59:42 +08:00
|
|
|
|
},
|
|
|
|
|
setMode: (mode) => {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('statusbar', 'setMode', { mode });
|
2020-01-14 10:59:42 +08:00
|
|
|
|
},
|
|
|
|
|
setColor: (color) => {
|
2020-01-17 16:51:17 +08:00
|
|
|
|
return context.callNative('statusbar', 'setColor', { color: color.toModel() });
|
2020-01-14 10:59:42 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-13 20:26:58 +08:00
|
|
|
|
function viewIdChains(view) {
|
|
|
|
|
const viewIds = [];
|
|
|
|
|
let thisView = view;
|
|
|
|
|
while (thisView != undefined) {
|
|
|
|
|
viewIds.push(thisView.viewId);
|
|
|
|
|
thisView = thisView.superview;
|
|
|
|
|
}
|
|
|
|
|
return viewIds.reverse();
|
|
|
|
|
}
|
|
|
|
|
function coordinator(context) {
|
|
|
|
|
return {
|
2020-03-10 18:51:53 +08:00
|
|
|
|
verticalScrolling: (argument) => {
|
|
|
|
|
if (context.entity instanceof Panel) {
|
|
|
|
|
const panel = context.entity;
|
2020-03-10 19:18:33 +08:00
|
|
|
|
panel.addOnRenderFinishedCallback(() => {
|
2020-03-10 18:51:53 +08:00
|
|
|
|
argument.scrollable = viewIdChains(argument.scrollable);
|
|
|
|
|
if (argument.target instanceof View) {
|
|
|
|
|
argument.target = viewIdChains(argument.target);
|
|
|
|
|
}
|
|
|
|
|
if (argument.changing.start instanceof Color) {
|
|
|
|
|
argument.changing.start = argument.changing.start.toModel();
|
|
|
|
|
}
|
|
|
|
|
if (argument.changing.end instanceof Color) {
|
|
|
|
|
argument.changing.end = argument.changing.end.toModel();
|
|
|
|
|
}
|
2020-03-10 19:18:33 +08:00
|
|
|
|
context.callNative("coordinator", "verticalScrolling", argument);
|
|
|
|
|
});
|
2020-02-13 20:26:58 +08:00
|
|
|
|
}
|
2023-03-13 22:09:57 +08:00
|
|
|
|
},
|
|
|
|
|
observeScrollingInterval: (argument) => {
|
|
|
|
|
if (context.entity instanceof Panel) {
|
|
|
|
|
const panel = context.entity;
|
|
|
|
|
panel.addOnRenderFinishedCallback(() => {
|
|
|
|
|
argument.scrollable = viewIdChains(argument.scrollable);
|
|
|
|
|
argument.onScrolledInterval = context.function2Id(argument.onScrolledInterval);
|
|
|
|
|
context.callNative("coordinator", "observeScrollingInterval", argument);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
2020-02-13 20:26:58 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-19 14:32:42 +08:00
|
|
|
|
function notch(context) {
|
|
|
|
|
return {
|
|
|
|
|
inset: () => {
|
|
|
|
|
return context.callNative('notch', 'inset', {});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-18 18:47:49 +08:00
|
|
|
|
function keyboard(context) {
|
|
|
|
|
return {
|
|
|
|
|
subscribe: (callback) => {
|
|
|
|
|
return context.callNative('keyboard', 'subscribe', context.function2Id(callback));
|
|
|
|
|
},
|
|
|
|
|
unsubscribe: (subscribeId) => {
|
|
|
|
|
context.removeFuncById(subscribeId);
|
|
|
|
|
return context.callNative('keyboard', 'unsubscribe', subscribeId);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-18 16:38:35 +08:00
|
|
|
|
function resourceLoader(context) {
|
|
|
|
|
return {
|
|
|
|
|
load: (resource) => {
|
|
|
|
|
return context.callNative('resourceLoader', 'load', resource.toModel());
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-18 19:06:10 +08:00
|
|
|
|
/*
|
|
|
|
|
* Copyright [2021] [Doric.Pub]
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
|
|
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
|
|
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
function imageDecoder(context) {
|
|
|
|
|
return {
|
|
|
|
|
getImageInfo: (resource) => {
|
|
|
|
|
return context.callNative('imageDecoder', 'getImageInfo', resource);
|
|
|
|
|
},
|
|
|
|
|
decodeToPixels: (resource) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
return context.callNative('imageDecoder', 'decodeToPixels', resource);
|
|
|
|
|
}),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-23 15:29:38 +08:00
|
|
|
|
class Observable {
|
|
|
|
|
constructor(provider, clz) {
|
|
|
|
|
this.observers = new Set;
|
|
|
|
|
this.provider = provider;
|
|
|
|
|
this.clz = clz;
|
|
|
|
|
}
|
|
|
|
|
addObserver(observer) {
|
|
|
|
|
this.observers.add(observer);
|
|
|
|
|
}
|
|
|
|
|
removeObserver(observer) {
|
|
|
|
|
this.observers.delete(observer);
|
|
|
|
|
}
|
|
|
|
|
update(updater) {
|
|
|
|
|
const oldV = this.provider.acquire(this.clz);
|
|
|
|
|
const newV = updater(oldV);
|
|
|
|
|
if (newV !== undefined) {
|
|
|
|
|
this.provider.provide(newV);
|
|
|
|
|
}
|
|
|
|
|
for (let observer of this.observers) {
|
|
|
|
|
observer(newV);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class Provider {
|
|
|
|
|
constructor() {
|
|
|
|
|
this.provision = new Map;
|
|
|
|
|
this.observableMap = new Map;
|
|
|
|
|
}
|
|
|
|
|
provide(obj) {
|
|
|
|
|
this.provision.set(obj.constructor, obj);
|
|
|
|
|
}
|
|
|
|
|
acquire(clz) {
|
|
|
|
|
const ret = this.provision.get(clz);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
remove(clz) {
|
|
|
|
|
this.provision.delete(clz);
|
|
|
|
|
}
|
|
|
|
|
clear() {
|
|
|
|
|
this.provision.clear();
|
|
|
|
|
}
|
|
|
|
|
observe(clz) {
|
|
|
|
|
let observable = this.observableMap.get(clz);
|
|
|
|
|
if (observable === undefined) {
|
|
|
|
|
observable = new Observable(this, clz);
|
|
|
|
|
this.observableMap.set(clz, observable);
|
|
|
|
|
}
|
|
|
|
|
return observable;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class ViewHolder {
|
|
|
|
|
}
|
|
|
|
|
class ViewModel {
|
|
|
|
|
constructor(obj, v) {
|
|
|
|
|
this.state = obj;
|
|
|
|
|
this.viewHolder = v;
|
|
|
|
|
}
|
|
|
|
|
getState() {
|
|
|
|
|
return this.state;
|
|
|
|
|
}
|
2020-03-03 15:51:20 +08:00
|
|
|
|
getViewHolder() {
|
|
|
|
|
return this.viewHolder;
|
|
|
|
|
}
|
2019-12-23 15:29:38 +08:00
|
|
|
|
updateState(setter) {
|
|
|
|
|
setter(this.state);
|
|
|
|
|
this.onBind(this.state, this.viewHolder);
|
|
|
|
|
}
|
|
|
|
|
attach(view) {
|
|
|
|
|
this.viewHolder.build(view);
|
|
|
|
|
this.onAttached(this.state, this.viewHolder);
|
|
|
|
|
this.onBind(this.state, this.viewHolder);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class VMPanel extends Panel {
|
|
|
|
|
getViewModel() {
|
|
|
|
|
return this.vm;
|
|
|
|
|
}
|
|
|
|
|
build(root) {
|
|
|
|
|
this.vh = new (this.getViewHolderClass());
|
|
|
|
|
this.vm = new (this.getViewModelClass())(this.getState(), this.vh);
|
2020-09-21 15:58:45 +08:00
|
|
|
|
this.vm.context = this.context;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
this.vm.attach(root);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-13 16:57:21 +08:00
|
|
|
|
class Module extends Panel {
|
2021-05-18 11:41:18 +08:00
|
|
|
|
constructor() {
|
|
|
|
|
super(...arguments);
|
|
|
|
|
this.unmounted = false;
|
|
|
|
|
}
|
2021-05-14 13:14:54 +08:00
|
|
|
|
get provider() {
|
|
|
|
|
var _a;
|
|
|
|
|
return this.__provider || ((_a = this.superPanel) === null || _a === void 0 ? void 0 : _a.provider);
|
|
|
|
|
}
|
|
|
|
|
set provider(provider) {
|
|
|
|
|
this.__provider = provider;
|
|
|
|
|
}
|
2021-05-18 11:41:18 +08:00
|
|
|
|
mount() {
|
|
|
|
|
var _a;
|
|
|
|
|
if (this.unmounted) {
|
|
|
|
|
this.unmounted = false;
|
|
|
|
|
(_a = this.superPanel) === null || _a === void 0 ? void 0 : _a.onStructureChanged(this, true);
|
|
|
|
|
this.onMounted();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
unmount() {
|
|
|
|
|
var _a;
|
|
|
|
|
if (!this.unmounted) {
|
|
|
|
|
this.unmounted = true;
|
|
|
|
|
(_a = this.superPanel) === null || _a === void 0 ? void 0 : _a.onStructureChanged(this, false);
|
|
|
|
|
this.onUnmounted();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
get mounted() {
|
|
|
|
|
return !this.unmounted;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Dispatch message to other modules.
|
|
|
|
|
* @param message which is sent out
|
|
|
|
|
*/
|
2021-05-13 16:57:21 +08:00
|
|
|
|
dispatchMessage(message) {
|
|
|
|
|
var _a;
|
|
|
|
|
(_a = this.superPanel) === null || _a === void 0 ? void 0 : _a.dispatchMessage(message);
|
|
|
|
|
}
|
2021-05-18 11:41:18 +08:00
|
|
|
|
/**
|
|
|
|
|
* Dispatched messages can be received by override this method.
|
|
|
|
|
* @param message recevied message
|
|
|
|
|
*/
|
2021-05-13 16:57:21 +08:00
|
|
|
|
onMessage(message) { }
|
2021-05-18 11:41:18 +08:00
|
|
|
|
/**
|
|
|
|
|
* Called when this module is mounted
|
|
|
|
|
*/
|
|
|
|
|
onMounted() { }
|
|
|
|
|
/**
|
|
|
|
|
* Called when this module is unmounted
|
|
|
|
|
*/
|
|
|
|
|
onUnmounted() { }
|
|
|
|
|
}
|
|
|
|
|
class VMModule extends Module {
|
|
|
|
|
getViewModel() {
|
|
|
|
|
return this.vm;
|
|
|
|
|
}
|
|
|
|
|
build(root) {
|
|
|
|
|
this.vh = new (this.getViewHolderClass());
|
|
|
|
|
this.vm = new (this.getViewModelClass())(this.getState(), this.vh);
|
|
|
|
|
this.vm.context = this.context;
|
|
|
|
|
this.vm.attach(root);
|
|
|
|
|
}
|
2021-05-13 16:57:21 +08:00
|
|
|
|
}
|
|
|
|
|
class ModularPanel extends Module {
|
2021-05-13 16:26:48 +08:00
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
2021-05-13 16:57:21 +08:00
|
|
|
|
this.modules = this.setupModules().map(e => {
|
|
|
|
|
const instance = new e;
|
|
|
|
|
if (instance instanceof Module) {
|
|
|
|
|
instance.superPanel = this;
|
|
|
|
|
}
|
|
|
|
|
return instance;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
dispatchMessage(message) {
|
|
|
|
|
if (this.superPanel) {
|
|
|
|
|
this.superPanel.dispatchMessage(message);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
this.onMessage(message);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-18 11:41:18 +08:00
|
|
|
|
get mountedModules() {
|
|
|
|
|
return this.modules.filter(e => !(e instanceof Module) || e.mounted);
|
|
|
|
|
}
|
2021-05-13 16:57:21 +08:00
|
|
|
|
onMessage(message) {
|
2021-05-18 11:41:18 +08:00
|
|
|
|
this.mountedModules.forEach(e => {
|
2021-05-13 16:57:21 +08:00
|
|
|
|
if (e instanceof Module) {
|
|
|
|
|
e.onMessage(message);
|
|
|
|
|
}
|
|
|
|
|
});
|
2021-05-13 16:26:48 +08:00
|
|
|
|
}
|
2021-05-18 11:41:18 +08:00
|
|
|
|
onStructureChanged(module, mounted) {
|
|
|
|
|
if (this.superPanel) {
|
|
|
|
|
this.superPanel.onStructureChanged(module, mounted);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (!!!this.scheduledRebuild) {
|
|
|
|
|
this.scheduledRebuild = setTimeout(() => {
|
|
|
|
|
this.scheduledRebuild = undefined;
|
|
|
|
|
this.getRootView().children.length = 0;
|
|
|
|
|
this.build(this.getRootView());
|
|
|
|
|
}, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-05-13 16:26:48 +08:00
|
|
|
|
build(root) {
|
|
|
|
|
const groupView = this.setupShelf(root);
|
2021-05-18 11:41:18 +08:00
|
|
|
|
this.mountedModules.forEach(e => {
|
2021-05-13 16:26:48 +08:00
|
|
|
|
Reflect.set(e, "__root__", groupView);
|
|
|
|
|
e.build(groupView);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onCreate() {
|
|
|
|
|
super.onCreate();
|
2021-05-18 11:41:18 +08:00
|
|
|
|
this.mountedModules.forEach(e => {
|
2021-05-13 16:26:48 +08:00
|
|
|
|
e.context = this.context;
|
|
|
|
|
e.onCreate();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onDestroy() {
|
|
|
|
|
super.onDestroy();
|
2021-05-18 11:41:18 +08:00
|
|
|
|
this.mountedModules.forEach(e => {
|
2021-05-13 16:26:48 +08:00
|
|
|
|
e.onDestroy();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onShow() {
|
|
|
|
|
super.onShow();
|
2021-05-18 11:41:18 +08:00
|
|
|
|
this.mountedModules.forEach(e => {
|
2021-05-13 16:26:48 +08:00
|
|
|
|
e.onShow();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onHidden() {
|
|
|
|
|
super.onHidden();
|
2021-05-18 11:41:18 +08:00
|
|
|
|
this.mountedModules.forEach(e => {
|
2021-05-13 16:26:48 +08:00
|
|
|
|
e.onHidden();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
onRenderFinished() {
|
|
|
|
|
super.onRenderFinished();
|
2021-05-18 11:41:18 +08:00
|
|
|
|
this.mountedModules.forEach(e => {
|
2021-05-13 16:26:48 +08:00
|
|
|
|
e.onRenderFinished();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-25 12:00:58 +08:00
|
|
|
|
exports.AeroEffect = AeroEffect;
|
2021-09-07 18:33:25 +08:00
|
|
|
|
exports.AlphaAnimation = AlphaAnimation;
|
2021-12-07 18:38:05 +08:00
|
|
|
|
exports.AndroidAssetsResource = AndroidAssetsResource;
|
|
|
|
|
exports.AndroidResource = AndroidResource;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.AnimationSet = AnimationSet;
|
2022-03-09 17:35:13 +08:00
|
|
|
|
exports.ArrayBufferResource = ArrayBufferResource;
|
2021-12-30 10:50:08 +08:00
|
|
|
|
exports.AssetsResource = AssetsResource;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.BOTTOM = BOTTOM;
|
2021-09-07 18:33:25 +08:00
|
|
|
|
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
2021-10-22 17:00:00 +08:00
|
|
|
|
exports.Base64Resource = Base64Resource;
|
2021-11-24 14:37:48 +08:00
|
|
|
|
exports.BlurEffect = BlurEffect;
|
2021-10-25 16:51:45 +08:00
|
|
|
|
exports.BundleResource = BundleResource;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.CENTER = CENTER;
|
|
|
|
|
exports.CENTER_X = CENTER_X;
|
|
|
|
|
exports.CENTER_Y = CENTER_Y;
|
|
|
|
|
exports.Color = Color;
|
2020-01-02 20:02:21 +08:00
|
|
|
|
exports.Draggable = Draggable;
|
2021-10-22 17:00:00 +08:00
|
|
|
|
exports.DrawableResource = DrawableResource;
|
2020-04-09 20:01:22 +08:00
|
|
|
|
exports.FlexLayout = FlexLayout;
|
2020-04-16 19:21:24 +08:00
|
|
|
|
exports.FlexTypedValue = FlexTypedValue;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.FlowLayout = FlowLayout;
|
|
|
|
|
exports.FlowLayoutItem = FlowLayoutItem;
|
2021-09-22 10:28:02 +08:00
|
|
|
|
exports.GestureContainer = GestureContainer;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.Gravity = Gravity;
|
|
|
|
|
exports.Group = Group;
|
|
|
|
|
exports.HLayout = HLayout;
|
2022-08-23 11:20:36 +08:00
|
|
|
|
exports.HorizontalList = HorizontalList;
|
|
|
|
|
exports.HorizontalListItem = HorizontalListItem;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.Image = Image;
|
2021-03-03 10:08:48 +08:00
|
|
|
|
exports.InconsistProperty = InconsistProperty;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.Input = Input;
|
|
|
|
|
exports.LEFT = LEFT;
|
|
|
|
|
exports.LayoutConfigImpl = LayoutConfigImpl;
|
|
|
|
|
exports.List = List;
|
|
|
|
|
exports.ListItem = ListItem;
|
2021-10-25 16:01:44 +08:00
|
|
|
|
exports.LocalResource = LocalResource;
|
2021-10-22 17:00:00 +08:00
|
|
|
|
exports.MainBundleResource = MainBundleResource;
|
2021-05-13 16:26:48 +08:00
|
|
|
|
exports.ModularPanel = ModularPanel;
|
2021-05-13 16:57:21 +08:00
|
|
|
|
exports.Module = Module;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.Mutable = Mutable;
|
|
|
|
|
exports.NativeCall = NativeCall;
|
|
|
|
|
exports.NestedSlider = NestedSlider;
|
|
|
|
|
exports.Observable = Observable;
|
|
|
|
|
exports.Panel = Panel;
|
|
|
|
|
exports.Property = Property;
|
|
|
|
|
exports.Provider = Provider;
|
|
|
|
|
exports.RIGHT = RIGHT;
|
2021-10-22 17:00:00 +08:00
|
|
|
|
exports.RawResource = RawResource;
|
2021-09-02 11:39:51 +08:00
|
|
|
|
exports.Ref = Ref;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.Refreshable = Refreshable;
|
2021-10-22 17:00:00 +08:00
|
|
|
|
exports.RemoteResource = RemoteResource;
|
|
|
|
|
exports.Resource = Resource;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.Root = Root;
|
|
|
|
|
exports.RotationAnimation = RotationAnimation;
|
2020-06-03 14:53:32 +08:00
|
|
|
|
exports.RotationXAnimation = RotationXAnimation;
|
|
|
|
|
exports.RotationYAnimation = RotationYAnimation;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.ScaleAnimation = ScaleAnimation;
|
|
|
|
|
exports.Scroller = Scroller;
|
|
|
|
|
exports.SlideItem = SlideItem;
|
|
|
|
|
exports.Slider = Slider;
|
|
|
|
|
exports.Stack = Stack;
|
|
|
|
|
exports.Superview = Superview;
|
2020-03-13 13:01:21 +08:00
|
|
|
|
exports.Switch = Switch;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.TOP = TOP;
|
|
|
|
|
exports.Text = Text;
|
|
|
|
|
exports.TranslationAnimation = TranslationAnimation;
|
|
|
|
|
exports.VLayout = VLayout;
|
2021-05-18 11:41:18 +08:00
|
|
|
|
exports.VMModule = VMModule;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.VMPanel = VMPanel;
|
|
|
|
|
exports.View = View;
|
2021-05-14 19:24:07 +08:00
|
|
|
|
exports.ViewComponent = ViewComponent;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.ViewHolder = ViewHolder;
|
|
|
|
|
exports.ViewModel = ViewModel;
|
2021-11-25 12:00:58 +08:00
|
|
|
|
exports.aeroEffect = aeroEffect;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.animate = animate;
|
2021-11-24 14:37:48 +08:00
|
|
|
|
exports.blurEffect = blurEffect;
|
2020-02-13 20:26:58 +08:00
|
|
|
|
exports.coordinator = coordinator;
|
2021-09-03 16:48:24 +08:00
|
|
|
|
exports.createRef = createRef;
|
2020-01-02 20:02:21 +08:00
|
|
|
|
exports.draggable = draggable;
|
2020-04-09 20:01:22 +08:00
|
|
|
|
exports.flexlayout = flexlayout;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.flowItem = flowItem;
|
|
|
|
|
exports.flowlayout = flowlayout;
|
2021-09-22 10:28:02 +08:00
|
|
|
|
exports.gestureContainer = gestureContainer;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.gravity = gravity;
|
|
|
|
|
exports.hlayout = hlayout;
|
2022-08-23 11:20:36 +08:00
|
|
|
|
exports.horizontalList = horizontalList;
|
|
|
|
|
exports.horizontalListItem = horizontalListItem;
|
2021-12-07 18:38:05 +08:00
|
|
|
|
exports.iOSResource = iOSResource;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.image = image;
|
2021-11-18 19:06:10 +08:00
|
|
|
|
exports.imageDecoder = imageDecoder;
|
2020-01-03 13:35:40 +08:00
|
|
|
|
exports.input = input;
|
2020-09-04 18:51:08 +08:00
|
|
|
|
exports.internalScheme = internalScheme;
|
2021-03-18 18:47:49 +08:00
|
|
|
|
exports.keyboard = keyboard;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.layoutConfig = layoutConfig;
|
|
|
|
|
exports.list = list;
|
|
|
|
|
exports.listItem = listItem;
|
|
|
|
|
exports.log = log;
|
|
|
|
|
exports.loge = loge;
|
|
|
|
|
exports.logw = logw;
|
|
|
|
|
exports.modal = modal;
|
|
|
|
|
exports.navbar = navbar;
|
|
|
|
|
exports.navigator = navigator;
|
|
|
|
|
exports.network = network;
|
2020-03-19 14:32:42 +08:00
|
|
|
|
exports.notch = notch;
|
2020-01-08 20:18:19 +08:00
|
|
|
|
exports.notification = notification;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.obj2Model = obj2Model;
|
|
|
|
|
exports.popover = popover;
|
|
|
|
|
exports.pullable = pullable;
|
|
|
|
|
exports.refreshable = refreshable;
|
|
|
|
|
exports.repeat = repeat;
|
2021-11-18 16:38:35 +08:00
|
|
|
|
exports.resourceLoader = resourceLoader;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.scroller = scroller;
|
|
|
|
|
exports.slideItem = slideItem;
|
|
|
|
|
exports.slider = slider;
|
|
|
|
|
exports.stack = stack;
|
2020-01-14 10:59:42 +08:00
|
|
|
|
exports.statusbar = statusbar;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.storage = storage;
|
2020-03-13 13:01:21 +08:00
|
|
|
|
exports.switchView = switchView;
|
2019-12-23 15:29:38 +08:00
|
|
|
|
exports.take = take;
|
|
|
|
|
exports.takeAlso = takeAlso;
|
|
|
|
|
exports.takeIf = takeIf;
|
|
|
|
|
exports.takeLet = takeLet;
|
|
|
|
|
exports.takeNonNull = takeNonNull;
|
|
|
|
|
exports.takeNull = takeNull;
|
|
|
|
|
exports.takeUnless = takeUnless;
|
|
|
|
|
exports.text = text;
|
|
|
|
|
exports.uniqueId = uniqueId;
|
|
|
|
|
exports.vlayout = vlayout;
|