update typescript and remove reflect-metadata lib
This commit is contained in:
parent
4d80048d60
commit
0633c1c19d
@ -222,7 +222,7 @@ var View = /** @class */ (function () {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.x = v;
|
this.x = v;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(View.prototype, "right", {
|
Object.defineProperty(View.prototype, "right", {
|
||||||
@ -232,7 +232,7 @@ var View = /** @class */ (function () {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.x = v - this.width;
|
this.x = v - this.width;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(View.prototype, "top", {
|
Object.defineProperty(View.prototype, "top", {
|
||||||
@ -242,7 +242,7 @@ var View = /** @class */ (function () {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.y = v;
|
this.y = v;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(View.prototype, "bottom", {
|
Object.defineProperty(View.prototype, "bottom", {
|
||||||
@ -252,7 +252,7 @@ var View = /** @class */ (function () {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.y = v - this.height;
|
this.y = v - this.height;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(View.prototype, "centerX", {
|
Object.defineProperty(View.prototype, "centerX", {
|
||||||
@ -262,7 +262,7 @@ var View = /** @class */ (function () {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.x = v - this.width / 2;
|
this.x = v - this.width / 2;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(View.prototype, "centerY", {
|
Object.defineProperty(View.prototype, "centerY", {
|
||||||
@ -272,7 +272,7 @@ var View = /** @class */ (function () {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.y = v - this.height / 2;
|
this.y = v - this.height / 2;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(View.prototype, "dirtyProps", {
|
Object.defineProperty(View.prototype, "dirtyProps", {
|
||||||
@ -280,7 +280,7 @@ var View = /** @class */ (function () {
|
|||||||
get: function () {
|
get: function () {
|
||||||
return this.__dirty_props__;
|
return this.__dirty_props__;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
View.prototype.onPropertyChanged = function (propKey, oldV, newV) {
|
View.prototype.onPropertyChanged = function (propKey, oldV, newV) {
|
||||||
@ -1396,7 +1396,7 @@ var ScaleAnimation = /** @class */ (function (_super) {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.scaleXChangeable.fromValue = v;
|
this.scaleXChangeable.fromValue = v;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(ScaleAnimation.prototype, "toScaleX", {
|
Object.defineProperty(ScaleAnimation.prototype, "toScaleX", {
|
||||||
@ -1406,7 +1406,7 @@ var ScaleAnimation = /** @class */ (function (_super) {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.scaleXChangeable.toValue = v;
|
this.scaleXChangeable.toValue = v;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(ScaleAnimation.prototype, "fromScaleY", {
|
Object.defineProperty(ScaleAnimation.prototype, "fromScaleY", {
|
||||||
@ -1416,7 +1416,7 @@ var ScaleAnimation = /** @class */ (function (_super) {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.scaleYChangeable.fromValue = v;
|
this.scaleYChangeable.fromValue = v;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(ScaleAnimation.prototype, "toScaleY", {
|
Object.defineProperty(ScaleAnimation.prototype, "toScaleY", {
|
||||||
@ -1426,7 +1426,7 @@ var ScaleAnimation = /** @class */ (function (_super) {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.scaleYChangeable.toValue = v;
|
this.scaleYChangeable.toValue = v;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
return ScaleAnimation;
|
return ScaleAnimation;
|
||||||
@ -1456,7 +1456,7 @@ var TranslationAnimation = /** @class */ (function (_super) {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.translationXChangeable.fromValue = v;
|
this.translationXChangeable.fromValue = v;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(TranslationAnimation.prototype, "toTranslationX", {
|
Object.defineProperty(TranslationAnimation.prototype, "toTranslationX", {
|
||||||
@ -1466,7 +1466,7 @@ var TranslationAnimation = /** @class */ (function (_super) {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.translationXChangeable.toValue = v;
|
this.translationXChangeable.toValue = v;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(TranslationAnimation.prototype, "fromTranslationY", {
|
Object.defineProperty(TranslationAnimation.prototype, "fromTranslationY", {
|
||||||
@ -1476,7 +1476,7 @@ var TranslationAnimation = /** @class */ (function (_super) {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.translationYChangeable.fromValue = v;
|
this.translationYChangeable.fromValue = v;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(TranslationAnimation.prototype, "toTranslationY", {
|
Object.defineProperty(TranslationAnimation.prototype, "toTranslationY", {
|
||||||
@ -1486,7 +1486,7 @@ var TranslationAnimation = /** @class */ (function (_super) {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.translationYChangeable.toValue = v;
|
this.translationYChangeable.toValue = v;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
return TranslationAnimation;
|
return TranslationAnimation;
|
||||||
@ -1510,7 +1510,7 @@ var RotationAnimation = /** @class */ (function (_super) {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.rotationChaneable.fromValue = v;
|
this.rotationChaneable.fromValue = v;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(RotationAnimation.prototype, "toRotation", {
|
Object.defineProperty(RotationAnimation.prototype, "toRotation", {
|
||||||
@ -1520,7 +1520,7 @@ var RotationAnimation = /** @class */ (function (_super) {
|
|||||||
set: function (v) {
|
set: function (v) {
|
||||||
this.rotationChaneable.toValue = v;
|
this.rotationChaneable.toValue = v;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
return RotationAnimation;
|
return RotationAnimation;
|
||||||
@ -1541,7 +1541,7 @@ var AnimationSet = /** @class */ (function () {
|
|||||||
this._duration = v;
|
this._duration = v;
|
||||||
this.animations.forEach(function (e) { return e.duration = v; });
|
this.animations.forEach(function (e) { return e.duration = v; });
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: false,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
AnimationSet.prototype.toModel = function () {
|
AnimationSet.prototype.toModel = function () {
|
||||||
@ -1927,8 +1927,7 @@ var List = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
List.prototype.scrollToItem = function (context, index, config) {
|
List.prototype.scrollToItem = function (context, index, config) {
|
||||||
var _a;
|
var animated = config === null || config === void 0 ? void 0 : config.animated;
|
||||||
var animated = (_a = config) === null || _a === void 0 ? void 0 : _a.animated;
|
|
||||||
return this.nativeChannel(context, 'scrollToItem')({ index: index, animated: animated, });
|
return this.nativeChannel(context, 'scrollToItem')({ index: index, animated: animated, });
|
||||||
};
|
};
|
||||||
List.prototype.reset = function () {
|
List.prototype.reset = function () {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1705,7 +1705,7 @@ var doric = (function (exports) {
|
|||||||
(module.exports = function (key, value) {
|
(module.exports = function (key, value) {
|
||||||
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
||||||
})('versions', []).push({
|
})('versions', []).push({
|
||||||
version: '3.6.4',
|
version: '3.6.5',
|
||||||
mode: 'global',
|
mode: 'global',
|
||||||
copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
|
copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
|
||||||
});
|
});
|
||||||
@ -6489,7 +6489,13 @@ var doric = (function (exports) {
|
|||||||
defer = functionBindContext(port.postMessage, port, 1);
|
defer = functionBindContext(port.postMessage, port, 1);
|
||||||
// Browsers with postMessage, skip WebWorkers
|
// Browsers with postMessage, skip WebWorkers
|
||||||
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
|
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
|
||||||
} else if (global_1.addEventListener && typeof postMessage == 'function' && !global_1.importScripts && !fails(post)) {
|
} else if (
|
||||||
|
global_1.addEventListener &&
|
||||||
|
typeof postMessage == 'function' &&
|
||||||
|
!global_1.importScripts &&
|
||||||
|
!fails(post) &&
|
||||||
|
location.protocol !== 'file:'
|
||||||
|
) {
|
||||||
defer = post;
|
defer = post;
|
||||||
global_1.addEventListener('message', listener, false);
|
global_1.addEventListener('message', listener, false);
|
||||||
// IE8-
|
// IE8-
|
||||||
@ -9861,7 +9867,7 @@ var doric = (function (exports) {
|
|||||||
var INVALID_PORT = 'Invalid port';
|
var INVALID_PORT = 'Invalid port';
|
||||||
|
|
||||||
var ALPHA = /[A-Za-z]/;
|
var ALPHA = /[A-Za-z]/;
|
||||||
var ALPHANUMERIC = /[\d+\-.A-Za-z]/;
|
var ALPHANUMERIC = /[\d+-.A-Za-z]/;
|
||||||
var DIGIT = /\d/;
|
var DIGIT = /\d/;
|
||||||
var HEX_START = /^(0x|0X)/;
|
var HEX_START = /^(0x|0X)/;
|
||||||
var OCT = /^[0-7]+$/;
|
var OCT = /^[0-7]+$/;
|
||||||
@ -11672,8 +11678,8 @@ var doric = (function (exports) {
|
|||||||
if (cleanup != null) { subscriptionState.cleanup = typeof cleanup.unsubscribe === 'function'
|
if (cleanup != null) { subscriptionState.cleanup = typeof cleanup.unsubscribe === 'function'
|
||||||
? function () { subscription.unsubscribe(); }
|
? function () { subscription.unsubscribe(); }
|
||||||
: aFunction$1(cleanup); }
|
: aFunction$1(cleanup); }
|
||||||
} catch (error) {
|
} catch (error$1) {
|
||||||
subscriptionObserver.error(error);
|
subscriptionObserver.error(error$1);
|
||||||
return;
|
return;
|
||||||
} if (subscriptionClosed(subscriptionState)) { cleanupSubscription(subscriptionState); }
|
} if (subscriptionClosed(subscriptionState)) { cleanupSubscription(subscriptionState); }
|
||||||
};
|
};
|
||||||
@ -13173,7 +13179,7 @@ var doric = (function (exports) {
|
|||||||
// some Chrome versions have non-configurable methods on DOMTokenList
|
// some Chrome versions have non-configurable methods on DOMTokenList
|
||||||
if (CollectionPrototype$1[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) { try {
|
if (CollectionPrototype$1[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) { try {
|
||||||
createNonEnumerableProperty(CollectionPrototype$1, METHOD_NAME, es_array_iterator[METHOD_NAME]);
|
createNonEnumerableProperty(CollectionPrototype$1, METHOD_NAME, es_array_iterator[METHOD_NAME]);
|
||||||
} catch (error) {
|
} catch (error$1) {
|
||||||
CollectionPrototype$1[METHOD_NAME] = es_array_iterator[METHOD_NAME];
|
CollectionPrototype$1[METHOD_NAME] = es_array_iterator[METHOD_NAME];
|
||||||
} }
|
} }
|
||||||
} }
|
} }
|
||||||
|
File diff suppressed because it is too large
Load Diff
31
doric-js/index.d.ts
vendored
31
doric-js/index.d.ts
vendored
@ -1,6 +1,4 @@
|
|||||||
// Generated by dts-bundle v0.7.3
|
// Generated by dts-bundle v0.7.3
|
||||||
// Dependencies for this module:
|
|
||||||
// reflect-metadata
|
|
||||||
|
|
||||||
declare module 'doric' {
|
declare module 'doric' {
|
||||||
export * from 'doric/lib/src/runtime/global';
|
export * from 'doric/lib/src/runtime/global';
|
||||||
@ -12,7 +10,6 @@ declare module 'doric' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module 'doric/lib/src/runtime/global' {
|
declare module 'doric/lib/src/runtime/global' {
|
||||||
export * from 'reflect-metadata';
|
|
||||||
export type BridgeContext = {
|
export type BridgeContext = {
|
||||||
/**
|
/**
|
||||||
* The identify of current context
|
* The identify of current context
|
||||||
@ -739,21 +736,21 @@ declare module 'doric/lib/src/native/modal' {
|
|||||||
alert: (arg: string | {
|
alert: (arg: string | {
|
||||||
title: string;
|
title: string;
|
||||||
msg: string;
|
msg: string;
|
||||||
okLabel?: string | undefined;
|
okLabel?: string;
|
||||||
}) => Promise<any>;
|
}) => Promise<any>;
|
||||||
confirm: (arg: string | {
|
confirm: (arg: string | {
|
||||||
title: string;
|
title: string;
|
||||||
msg: string;
|
msg: string;
|
||||||
okLabel?: string | undefined;
|
okLabel?: string;
|
||||||
cancelLabel?: string | undefined;
|
cancelLabel?: string;
|
||||||
}) => Promise<any>;
|
}) => Promise<any>;
|
||||||
prompt: (arg: {
|
prompt: (arg: {
|
||||||
title?: string | undefined;
|
title?: string;
|
||||||
msg?: string | undefined;
|
msg?: string;
|
||||||
okLabel?: string | undefined;
|
okLabel?: string;
|
||||||
cancelLabel?: string | undefined;
|
cancelLabel?: string;
|
||||||
text?: string | undefined;
|
text?: string;
|
||||||
defaultText?: string | undefined;
|
defaultText?: string;
|
||||||
}) => Promise<string>;
|
}) => Promise<string>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -851,10 +848,10 @@ declare module 'doric/lib/src/native/notification' {
|
|||||||
import { BridgeContext } from "doric/lib/src/runtime/global";
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
||||||
export function notification(context: BridgeContext): {
|
export function notification(context: BridgeContext): {
|
||||||
publish: (args: {
|
publish: (args: {
|
||||||
biz?: string | undefined;
|
biz?: string;
|
||||||
name: string;
|
name: string;
|
||||||
data?: object | undefined;
|
data?: object;
|
||||||
androidSystem?: boolean | undefined;
|
androidSystem?: boolean;
|
||||||
}) => Promise<any>;
|
}) => Promise<any>;
|
||||||
subscribe: (args: {
|
subscribe: (args: {
|
||||||
biz?: string | undefined;
|
biz?: string | undefined;
|
||||||
@ -889,14 +886,14 @@ declare module 'doric/lib/src/native/coordinator' {
|
|||||||
import { Color } from "doric/lib/src/util/color";
|
import { Color } from "doric/lib/src/util/color";
|
||||||
export function coordinator(context: BridgeContext): {
|
export function coordinator(context: BridgeContext): {
|
||||||
verticalScrolling: (argument: {
|
verticalScrolling: (argument: {
|
||||||
scrollable: List | Scroller | FlowLayout;
|
scrollable: Scroller | List | FlowLayout;
|
||||||
scrollRange: {
|
scrollRange: {
|
||||||
start: number;
|
start: number;
|
||||||
end: number;
|
end: number;
|
||||||
};
|
};
|
||||||
target: View | "NavBar";
|
target: View | "NavBar";
|
||||||
changing: {
|
changing: {
|
||||||
name: "width" | "height" | "x" | "y" | "backgroundColor" | "alpha";
|
name: "backgroundColor" | "width" | "height" | "x" | "y" | "alpha";
|
||||||
start: number | Color;
|
start: number | Color;
|
||||||
end: number | Color;
|
end: number | Color;
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
export * from './src/runtime/global';
|
||||||
export * from './src/ui/index.ui';
|
export * from './src/ui/index.ui';
|
||||||
export * from "./src/widget/index.widget";
|
export * from "./src/widget/index.widget";
|
||||||
export * from './src/native/index.native';
|
export * from './src/native/index.native';
|
||||||
|
4
doric-js/lib/src/native/coordinator.d.ts
vendored
4
doric-js/lib/src/native/coordinator.d.ts
vendored
@ -6,14 +6,14 @@ import { View } from "../ui/view";
|
|||||||
import { Color } from "../util/color";
|
import { Color } from "../util/color";
|
||||||
export declare function coordinator(context: BridgeContext): {
|
export declare function coordinator(context: BridgeContext): {
|
||||||
verticalScrolling: (argument: {
|
verticalScrolling: (argument: {
|
||||||
scrollable: List | Scroller | FlowLayout;
|
scrollable: Scroller | List | FlowLayout;
|
||||||
scrollRange: {
|
scrollRange: {
|
||||||
start: number;
|
start: number;
|
||||||
end: number;
|
end: number;
|
||||||
};
|
};
|
||||||
target: View | "NavBar";
|
target: View | "NavBar";
|
||||||
changing: {
|
changing: {
|
||||||
name: "width" | "height" | "x" | "y" | "backgroundColor" | "alpha";
|
name: "backgroundColor" | "width" | "height" | "x" | "y" | "alpha";
|
||||||
start: number | Color;
|
start: number | Color;
|
||||||
end: number | Color;
|
end: number | Color;
|
||||||
};
|
};
|
||||||
|
18
doric-js/lib/src/native/modal.d.ts
vendored
18
doric-js/lib/src/native/modal.d.ts
vendored
@ -5,20 +5,20 @@ export declare function modal(context: BridgeContext): {
|
|||||||
alert: (arg: string | {
|
alert: (arg: string | {
|
||||||
title: string;
|
title: string;
|
||||||
msg: string;
|
msg: string;
|
||||||
okLabel?: string | undefined;
|
okLabel?: string;
|
||||||
}) => Promise<any>;
|
}) => Promise<any>;
|
||||||
confirm: (arg: string | {
|
confirm: (arg: string | {
|
||||||
title: string;
|
title: string;
|
||||||
msg: string;
|
msg: string;
|
||||||
okLabel?: string | undefined;
|
okLabel?: string;
|
||||||
cancelLabel?: string | undefined;
|
cancelLabel?: string;
|
||||||
}) => Promise<any>;
|
}) => Promise<any>;
|
||||||
prompt: (arg: {
|
prompt: (arg: {
|
||||||
title?: string | undefined;
|
title?: string;
|
||||||
msg?: string | undefined;
|
msg?: string;
|
||||||
okLabel?: string | undefined;
|
okLabel?: string;
|
||||||
cancelLabel?: string | undefined;
|
cancelLabel?: string;
|
||||||
text?: string | undefined;
|
text?: string;
|
||||||
defaultText?: string | undefined;
|
defaultText?: string;
|
||||||
}) => Promise<string>;
|
}) => Promise<string>;
|
||||||
};
|
};
|
||||||
|
6
doric-js/lib/src/native/notification.d.ts
vendored
6
doric-js/lib/src/native/notification.d.ts
vendored
@ -1,10 +1,10 @@
|
|||||||
import { BridgeContext } from "../runtime/global";
|
import { BridgeContext } from "../runtime/global";
|
||||||
export declare function notification(context: BridgeContext): {
|
export declare function notification(context: BridgeContext): {
|
||||||
publish: (args: {
|
publish: (args: {
|
||||||
biz?: string | undefined;
|
biz?: string;
|
||||||
name: string;
|
name: string;
|
||||||
data?: object | undefined;
|
data?: object;
|
||||||
androidSystem?: boolean | undefined;
|
androidSystem?: boolean;
|
||||||
}) => Promise<any>;
|
}) => Promise<any>;
|
||||||
subscribe: (args: {
|
subscribe: (args: {
|
||||||
biz?: string | undefined;
|
biz?: string | undefined;
|
||||||
|
1
doric-js/lib/src/runtime/global.d.ts
vendored
1
doric-js/lib/src/runtime/global.d.ts
vendored
@ -1,4 +1,3 @@
|
|||||||
export * from 'reflect-metadata';
|
|
||||||
export declare type BridgeContext = {
|
export declare type BridgeContext = {
|
||||||
/**
|
/**
|
||||||
* The identify of current context
|
* The identify of current context
|
||||||
|
@ -33,228 +33,232 @@ export function NativeCall(target, propertyKey, descriptor) {
|
|||||||
};
|
};
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
export class Panel {
|
let Panel = /** @class */ (() => {
|
||||||
constructor() {
|
class Panel {
|
||||||
this.destroyed = false;
|
constructor() {
|
||||||
this.__root__ = new Root;
|
this.destroyed = false;
|
||||||
this.headviews = new Map;
|
this.__root__ = new Root;
|
||||||
this.onRenderFinishedCallback = [];
|
this.headviews = new Map;
|
||||||
this.__rendering__ = false;
|
this.onRenderFinishedCallback = [];
|
||||||
}
|
this.__rendering__ = false;
|
||||||
onCreate() { }
|
|
||||||
onDestroy() { }
|
|
||||||
onShow() { }
|
|
||||||
onHidden() { }
|
|
||||||
addHeadView(type, v) {
|
|
||||||
let map = this.headviews.get(type);
|
|
||||||
if (map) {
|
|
||||||
map.set(v.viewId, v);
|
|
||||||
}
|
}
|
||||||
else {
|
onCreate() { }
|
||||||
map = new Map;
|
onDestroy() { }
|
||||||
map.set(v.viewId, v);
|
onShow() { }
|
||||||
this.headviews.set(type, map);
|
onHidden() { }
|
||||||
}
|
addHeadView(type, v) {
|
||||||
}
|
|
||||||
allHeadViews() {
|
|
||||||
return this.headviews.values();
|
|
||||||
}
|
|
||||||
removeHeadView(type, v) {
|
|
||||||
if (this.headviews.has(type)) {
|
|
||||||
let map = this.headviews.get(type);
|
let map = this.headviews.get(type);
|
||||||
if (map) {
|
if (map) {
|
||||||
if (v instanceof View) {
|
map.set(v.viewId, v);
|
||||||
map.delete(v.viewId);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
map.delete(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
clearHeadViews(type) {
|
|
||||||
if (this.headviews.has(type)) {
|
|
||||||
this.headviews.delete(type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getRootView() {
|
|
||||||
return this.__root__;
|
|
||||||
}
|
|
||||||
getInitData() {
|
|
||||||
return this.__data__;
|
|
||||||
}
|
|
||||||
__init__(data) {
|
|
||||||
if (data) {
|
|
||||||
this.__data__ = JSON.parse(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
__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__);
|
|
||||||
}
|
|
||||||
__response__(viewIds, callbackId) {
|
|
||||||
const v = this.retrospectView(viewIds);
|
|
||||||
if (v === undefined) {
|
|
||||||
loge(`Cannot find view for ${viewIds}`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const argumentsList = [callbackId];
|
|
||||||
for (let i = 2; i < arguments.length; i++) {
|
|
||||||
argumentsList.push(arguments[i]);
|
|
||||||
}
|
|
||||||
return Reflect.apply(v.responseCallback, v, argumentsList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (Reflect.has(acc, "subviewById")) {
|
map = new Map;
|
||||||
return Reflect.apply(Reflect.get(acc, "subviewById"), acc, [cur]);
|
map.set(v.viewId, v);
|
||||||
}
|
this.headviews.set(type, map);
|
||||||
return acc;
|
|
||||||
}
|
|
||||||
}, undefined);
|
|
||||||
}
|
|
||||||
nativeRender(model) {
|
|
||||||
return this.context.callNative("shader", "render", model);
|
|
||||||
}
|
|
||||||
hookBeforeNativeCall() {
|
|
||||||
if (Environment.platform !== 'web') {
|
|
||||||
this.__root__.clean();
|
|
||||||
for (let map of this.headviews.values()) {
|
|
||||||
for (let v of map.values()) {
|
|
||||||
v.clean();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
allHeadViews() {
|
||||||
hookAfterNativeCall() {
|
return this.headviews.values();
|
||||||
if (this.destroyed) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
const promises = [];
|
removeHeadView(type, v) {
|
||||||
if (Environment.platform !== 'web') {
|
if (this.headviews.has(type)) {
|
||||||
//Here insert a native call to ensure the promise is resolved done.
|
let map = this.headviews.get(type);
|
||||||
nativeEmpty();
|
if (map) {
|
||||||
if (this.__root__.isDirty()) {
|
if (v instanceof View) {
|
||||||
const model = this.__root__.toModel();
|
map.delete(v.viewId);
|
||||||
promises.push(this.nativeRender(model));
|
}
|
||||||
}
|
else {
|
||||||
for (let map of this.headviews.values()) {
|
map.delete(v);
|
||||||
for (let v of map.values()) {
|
|
||||||
if (v.isDirty()) {
|
|
||||||
const model = v.toModel();
|
|
||||||
promises.push(this.nativeRender(model));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
clearHeadViews(type) {
|
||||||
Promise.resolve().then(() => {
|
if (this.headviews.has(type)) {
|
||||||
|
this.headviews.delete(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getRootView() {
|
||||||
|
return this.__root__;
|
||||||
|
}
|
||||||
|
getInitData() {
|
||||||
|
return this.__data__;
|
||||||
|
}
|
||||||
|
__init__(data) {
|
||||||
|
if (data) {
|
||||||
|
this.__data__ = JSON.parse(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
__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__);
|
||||||
|
}
|
||||||
|
__response__(viewIds, callbackId) {
|
||||||
|
const v = this.retrospectView(viewIds);
|
||||||
|
if (v === undefined) {
|
||||||
|
loge(`Cannot find view for ${viewIds}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const argumentsList = [callbackId];
|
||||||
|
for (let i = 2; i < arguments.length; i++) {
|
||||||
|
argumentsList.push(arguments[i]);
|
||||||
|
}
|
||||||
|
return Reflect.apply(v.responseCallback, v, argumentsList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (Reflect.has(acc, "subviewById")) {
|
||||||
|
return Reflect.apply(Reflect.get(acc, "subviewById"), acc, [cur]);
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
|
}, undefined);
|
||||||
|
}
|
||||||
|
nativeRender(model) {
|
||||||
|
return this.context.callNative("shader", "render", model);
|
||||||
|
}
|
||||||
|
hookBeforeNativeCall() {
|
||||||
|
if (Environment.platform !== 'web') {
|
||||||
|
this.__root__.clean();
|
||||||
|
for (let map of this.headviews.values()) {
|
||||||
|
for (let v of map.values()) {
|
||||||
|
v.clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hookAfterNativeCall() {
|
||||||
|
if (this.destroyed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const promises = [];
|
||||||
|
if (Environment.platform !== 'web') {
|
||||||
|
//Here insert a native call to ensure the promise is resolved done.
|
||||||
|
nativeEmpty();
|
||||||
if (this.__root__.isDirty()) {
|
if (this.__root__.isDirty()) {
|
||||||
const model = this.__root__.toModel();
|
const model = this.__root__.toModel();
|
||||||
promises.push(this.nativeRender(model));
|
promises.push(this.nativeRender(model));
|
||||||
this.__root__.clean();
|
|
||||||
}
|
}
|
||||||
for (let map of this.headviews.values()) {
|
for (let map of this.headviews.values()) {
|
||||||
for (let v of map.values()) {
|
for (let v of map.values()) {
|
||||||
if (v.isDirty()) {
|
if (v.isDirty()) {
|
||||||
const model = v.toModel();
|
const model = v.toModel();
|
||||||
promises.push(this.nativeRender(model));
|
promises.push(this.nativeRender(model));
|
||||||
v.clean();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
else {
|
||||||
|
Promise.resolve().then(() => {
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (this.__rendering__) {
|
||||||
|
//skip
|
||||||
|
Promise.all(promises).then(_ => {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.__rendering__ = true;
|
||||||
|
Promise.all(promises).then(_ => {
|
||||||
|
this.__rendering__ = false;
|
||||||
|
this.onRenderFinished();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (this.__rendering__) {
|
onRenderFinished() {
|
||||||
//skip
|
this.onRenderFinishedCallback.forEach(e => {
|
||||||
Promise.all(promises).then(_ => {
|
e();
|
||||||
});
|
});
|
||||||
|
this.onRenderFinishedCallback.length = 0;
|
||||||
}
|
}
|
||||||
else {
|
addOnRenderFinishedCallback(cb) {
|
||||||
this.__rendering__ = true;
|
this.onRenderFinishedCallback.push(cb);
|
||||||
Promise.all(promises).then(_ => {
|
|
||||||
this.__rendering__ = false;
|
|
||||||
this.onRenderFinished();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onRenderFinished() {
|
__decorate([
|
||||||
this.onRenderFinishedCallback.forEach(e => {
|
NativeCall,
|
||||||
e();
|
__metadata("design:type", Function),
|
||||||
});
|
__metadata("design:paramtypes", [String]),
|
||||||
this.onRenderFinishedCallback.length = 0;
|
__metadata("design:returntype", void 0)
|
||||||
}
|
], Panel.prototype, "__init__", null);
|
||||||
addOnRenderFinishedCallback(cb) {
|
__decorate([
|
||||||
this.onRenderFinishedCallback.push(cb);
|
NativeCall,
|
||||||
}
|
__metadata("design:type", Function),
|
||||||
}
|
__metadata("design:paramtypes", []),
|
||||||
__decorate([
|
__metadata("design:returntype", void 0)
|
||||||
NativeCall,
|
], Panel.prototype, "__onCreate__", null);
|
||||||
__metadata("design:type", Function),
|
__decorate([
|
||||||
__metadata("design:paramtypes", [String]),
|
NativeCall,
|
||||||
__metadata("design:returntype", void 0)
|
__metadata("design:type", Function),
|
||||||
], Panel.prototype, "__init__", null);
|
__metadata("design:paramtypes", []),
|
||||||
__decorate([
|
__metadata("design:returntype", void 0)
|
||||||
NativeCall,
|
], Panel.prototype, "__onDestroy__", null);
|
||||||
__metadata("design:type", Function),
|
__decorate([
|
||||||
__metadata("design:paramtypes", []),
|
NativeCall,
|
||||||
__metadata("design:returntype", void 0)
|
__metadata("design:type", Function),
|
||||||
], Panel.prototype, "__onCreate__", null);
|
__metadata("design:paramtypes", []),
|
||||||
__decorate([
|
__metadata("design:returntype", void 0)
|
||||||
NativeCall,
|
], Panel.prototype, "__onShow__", null);
|
||||||
__metadata("design:type", Function),
|
__decorate([
|
||||||
__metadata("design:paramtypes", []),
|
NativeCall,
|
||||||
__metadata("design:returntype", void 0)
|
__metadata("design:type", Function),
|
||||||
], Panel.prototype, "__onDestroy__", null);
|
__metadata("design:paramtypes", []),
|
||||||
__decorate([
|
__metadata("design:returntype", void 0)
|
||||||
NativeCall,
|
], Panel.prototype, "__onHidden__", null);
|
||||||
__metadata("design:type", Function),
|
__decorate([
|
||||||
__metadata("design:paramtypes", []),
|
NativeCall,
|
||||||
__metadata("design:returntype", void 0)
|
__metadata("design:type", Function),
|
||||||
], Panel.prototype, "__onShow__", null);
|
__metadata("design:paramtypes", [Object]),
|
||||||
__decorate([
|
__metadata("design:returntype", void 0)
|
||||||
NativeCall,
|
], Panel.prototype, "__build__", null);
|
||||||
__metadata("design:type", Function),
|
__decorate([
|
||||||
__metadata("design:paramtypes", []),
|
NativeCall,
|
||||||
__metadata("design:returntype", void 0)
|
__metadata("design:type", Function),
|
||||||
], Panel.prototype, "__onHidden__", null);
|
__metadata("design:paramtypes", [Array, String]),
|
||||||
__decorate([
|
__metadata("design:returntype", void 0)
|
||||||
NativeCall,
|
], Panel.prototype, "__response__", null);
|
||||||
__metadata("design:type", Function),
|
return Panel;
|
||||||
__metadata("design:paramtypes", [Object]),
|
})();
|
||||||
__metadata("design:returntype", void 0)
|
export { Panel };
|
||||||
], Panel.prototype, "__build__", null);
|
|
||||||
__decorate([
|
|
||||||
NativeCall,
|
|
||||||
__metadata("design:type", Function),
|
|
||||||
__metadata("design:paramtypes", [Array, String]),
|
|
||||||
__metadata("design:returntype", void 0)
|
|
||||||
], Panel.prototype, "__response__", null);
|
|
||||||
|
@ -13,263 +13,267 @@ import { loge } from "../util/log";
|
|||||||
export function Property(target, propKey) {
|
export function Property(target, propKey) {
|
||||||
Reflect.defineMetadata(propKey, true, target);
|
Reflect.defineMetadata(propKey, true, target);
|
||||||
}
|
}
|
||||||
export class View {
|
let View = /** @class */ (() => {
|
||||||
constructor() {
|
class View {
|
||||||
this.width = 0;
|
constructor() {
|
||||||
this.height = 0;
|
this.width = 0;
|
||||||
this.x = 0;
|
this.height = 0;
|
||||||
this.y = 0;
|
this.x = 0;
|
||||||
this.viewId = uniqueId('ViewId');
|
this.y = 0;
|
||||||
this.callbacks = new Map;
|
this.viewId = uniqueId('ViewId');
|
||||||
/** Anchor end*/
|
this.callbacks = new Map;
|
||||||
this.__dirty_props__ = {};
|
/** Anchor end*/
|
||||||
this.nativeViewModel = {
|
this.__dirty_props__ = {};
|
||||||
id: this.viewId,
|
this.nativeViewModel = {
|
||||||
type: this.constructor.name,
|
id: this.viewId,
|
||||||
props: this.__dirty_props__,
|
type: this.constructor.name,
|
||||||
};
|
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);
|
|
||||||
if (Reflect.getMetadata(p, target) && oldV !== v) {
|
|
||||||
receiver.onPropertyChanged(p.toString(), oldV, v);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
/** 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__;
|
|
||||||
}
|
|
||||||
onPropertyChanged(propKey, oldV, newV) {
|
|
||||||
if (newV instanceof Function) {
|
|
||||||
newV = this.callback2Id(newV);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
newV = obj2Model(newV);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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]);
|
|
||||||
}
|
|
||||||
return Reflect.apply(f, this, argumentsList);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
loge(`Cannot find callback:${id} for ${JSON.stringify(this.toModel())}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
const params = {
|
|
||||||
viewIds: viewIds.reverse(),
|
|
||||||
name,
|
|
||||||
args,
|
|
||||||
};
|
};
|
||||||
return context.callNative('shader', 'command', params);
|
return new Proxy(this, {
|
||||||
};
|
get: (target, p, receiver) => {
|
||||||
}
|
return Reflect.get(target, p, receiver);
|
||||||
getWidth(context) {
|
},
|
||||||
return this.nativeChannel(context, 'getWidth')();
|
set: (target, p, v, receiver) => {
|
||||||
}
|
const oldV = Reflect.get(target, p, receiver);
|
||||||
getHeight(context) {
|
const ret = Reflect.set(target, p, v, receiver);
|
||||||
return this.nativeChannel(context, 'getHeight')();
|
if (Reflect.getMetadata(p, target) && oldV !== v) {
|
||||||
}
|
receiver.onPropertyChanged(p.toString(), oldV, v);
|
||||||
getX(context) {
|
}
|
||||||
return this.nativeChannel(context, 'getX')();
|
return ret;
|
||||||
}
|
}
|
||||||
getY(context) {
|
});
|
||||||
return this.nativeChannel(context, 'getY')();
|
}
|
||||||
}
|
callback2Id(f) {
|
||||||
getLocationOnScreen(context) {
|
const id = uniqueId('Function');
|
||||||
return this.nativeChannel(context, "getLocationOnScreen")();
|
this.callbacks.set(id, f);
|
||||||
}
|
return id;
|
||||||
doAnimation(context, animation) {
|
}
|
||||||
return this.nativeChannel(context, "doAnimation")(animation.toModel()).then((args) => {
|
id2Callback(id) {
|
||||||
for (let key in args) {
|
let f = this.callbacks.get(id);
|
||||||
Reflect.set(this, key, Reflect.get(args, key, args), this);
|
if (f === undefined) {
|
||||||
Reflect.deleteProperty(this.__dirty_props__, key);
|
f = Reflect.get(this, id);
|
||||||
}
|
}
|
||||||
});
|
return f;
|
||||||
|
}
|
||||||
|
/** 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__;
|
||||||
|
}
|
||||||
|
onPropertyChanged(propKey, oldV, newV) {
|
||||||
|
if (newV instanceof Function) {
|
||||||
|
newV = this.callback2Id(newV);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
newV = obj2Model(newV);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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]);
|
||||||
|
}
|
||||||
|
return Reflect.apply(f, this, argumentsList);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
loge(`Cannot find callback:${id} for ${JSON.stringify(this.toModel())}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
const params = {
|
||||||
|
viewIds: viewIds.reverse(),
|
||||||
|
name,
|
||||||
|
args,
|
||||||
|
};
|
||||||
|
return context.callNative('shader', 'command', params);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
getWidth(context) {
|
||||||
|
return this.nativeChannel(context, 'getWidth')();
|
||||||
|
}
|
||||||
|
getHeight(context) {
|
||||||
|
return this.nativeChannel(context, 'getHeight')();
|
||||||
|
}
|
||||||
|
getX(context) {
|
||||||
|
return this.nativeChannel(context, 'getX')();
|
||||||
|
}
|
||||||
|
getY(context) {
|
||||||
|
return this.nativeChannel(context, 'getY')();
|
||||||
|
}
|
||||||
|
getLocationOnScreen(context) {
|
||||||
|
return this.nativeChannel(context, "getLocationOnScreen")();
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], View.prototype, "width", void 0);
|
||||||
], View.prototype, "width", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], View.prototype, "height", void 0);
|
||||||
], View.prototype, "height", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], View.prototype, "x", void 0);
|
||||||
], View.prototype, "x", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], View.prototype, "y", void 0);
|
||||||
], View.prototype, "y", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Object)
|
||||||
__metadata("design:type", Object)
|
], View.prototype, "backgroundColor", void 0);
|
||||||
], View.prototype, "backgroundColor", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Object)
|
||||||
__metadata("design:type", Object)
|
], View.prototype, "corners", void 0);
|
||||||
], View.prototype, "corners", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Object)
|
||||||
__metadata("design:type", Object)
|
], View.prototype, "border", void 0);
|
||||||
], View.prototype, "border", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Object)
|
||||||
__metadata("design:type", Object)
|
], View.prototype, "shadow", void 0);
|
||||||
], View.prototype, "shadow", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], View.prototype, "alpha", void 0);
|
||||||
], View.prototype, "alpha", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Boolean)
|
||||||
__metadata("design:type", Boolean)
|
], View.prototype, "hidden", void 0);
|
||||||
], View.prototype, "hidden", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Object)
|
||||||
__metadata("design:type", Object)
|
], View.prototype, "padding", void 0);
|
||||||
], View.prototype, "padding", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Object)
|
||||||
__metadata("design:type", Object)
|
], View.prototype, "layoutConfig", void 0);
|
||||||
], View.prototype, "layoutConfig", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Function)
|
||||||
__metadata("design:type", Function)
|
], View.prototype, "onClick", void 0);
|
||||||
], View.prototype, "onClick", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], View.prototype, "translationX", void 0);
|
||||||
], View.prototype, "translationX", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], View.prototype, "translationY", void 0);
|
||||||
], View.prototype, "translationY", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], View.prototype, "scaleX", void 0);
|
||||||
], View.prototype, "scaleX", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], View.prototype, "scaleY", void 0);
|
||||||
], View.prototype, "scaleY", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], View.prototype, "pivotX", void 0);
|
||||||
], View.prototype, "pivotX", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], View.prototype, "pivotY", void 0);
|
||||||
], View.prototype, "pivotY", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], View.prototype, "rotation", void 0);
|
||||||
], View.prototype, "rotation", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Object)
|
||||||
__metadata("design:type", Object)
|
], View.prototype, "flexConfig", void 0);
|
||||||
], View.prototype, "flexConfig", void 0);
|
return View;
|
||||||
|
})();
|
||||||
|
export { View };
|
||||||
export class Superview extends View {
|
export class Superview extends View {
|
||||||
subviewById(id) {
|
subviewById(id) {
|
||||||
for (let v of this.allSubviews()) {
|
for (let v of this.allSubviews()) {
|
||||||
|
@ -1,57 +1,61 @@
|
|||||||
/**
|
/**
|
||||||
* Store color as format AARRGGBB or RRGGBB
|
* Store color as format AARRGGBB or RRGGBB
|
||||||
*/
|
*/
|
||||||
export class Color {
|
let Color = /** @class */ (() => {
|
||||||
constructor(v) {
|
class Color {
|
||||||
this._value = 0;
|
constructor(v) {
|
||||||
this._value = v | 0x0;
|
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);
|
static parse(str) {
|
||||||
if (str.length === 7) {
|
if (!str.startsWith("#")) {
|
||||||
return new Color(val | 0xff000000);
|
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}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (str.length === 9) {
|
static safeParse(str, defVal = Color.TRANSPARENT) {
|
||||||
return new Color(val);
|
let color = defVal;
|
||||||
|
try {
|
||||||
|
color = Color.parse(str);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
alpha(v) {
|
||||||
throw new Error(`Parse color error with ${str}`);
|
v = v * 255;
|
||||||
|
return new Color((this._value & 0xffffff) | ((v & 0xff) << 24));
|
||||||
|
}
|
||||||
|
toModel() {
|
||||||
|
return this._value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static safeParse(str, defVal = Color.TRANSPARENT) {
|
Color.BLACK = new Color(0xFF000000);
|
||||||
let color = defVal;
|
Color.DKGRAY = new Color(0xFF444444);
|
||||||
try {
|
Color.GRAY = new Color(0xFF888888);
|
||||||
color = Color.parse(str);
|
Color.LTGRAY = new Color(0xFFCCCCCC);
|
||||||
}
|
Color.WHITE = new Color(0xFFFFFFFF);
|
||||||
catch (e) {
|
Color.RED = new Color(0xFFFF0000);
|
||||||
}
|
Color.GREEN = new Color(0xFF00FF00);
|
||||||
finally {
|
Color.BLUE = new Color(0xFF0000FF);
|
||||||
return color;
|
Color.YELLOW = new Color(0xFFFFFF00);
|
||||||
}
|
Color.CYAN = new Color(0xFF00FFFF);
|
||||||
}
|
Color.MAGENTA = new Color(0xFFFF00FF);
|
||||||
alpha(v) {
|
Color.TRANSPARENT = new Color(0);
|
||||||
v = v * 255;
|
return Color;
|
||||||
return new Color((this._value & 0xffffff) | ((v & 0xff) << 24));
|
})();
|
||||||
}
|
export { Color };
|
||||||
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);
|
|
||||||
export var GradientOrientation;
|
export var GradientOrientation;
|
||||||
(function (GradientOrientation) {
|
(function (GradientOrientation) {
|
||||||
/** draw the gradient from the top to the bottom */
|
/** draw the gradient from the top to the bottom */
|
||||||
|
@ -5,29 +5,33 @@ var ValueType;
|
|||||||
ValueType[ValueType["Percent"] = 2] = "Percent";
|
ValueType[ValueType["Percent"] = 2] = "Percent";
|
||||||
ValueType[ValueType["Auto"] = 3] = "Auto";
|
ValueType[ValueType["Auto"] = 3] = "Auto";
|
||||||
})(ValueType || (ValueType = {}));
|
})(ValueType || (ValueType = {}));
|
||||||
export class FlexTypedValue {
|
let FlexTypedValue = /** @class */ (() => {
|
||||||
constructor(type) {
|
class FlexTypedValue {
|
||||||
this.value = 0;
|
constructor(type) {
|
||||||
this.type = 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;
|
||||||
|
}
|
||||||
|
toModel() {
|
||||||
|
return {
|
||||||
|
type: this.type,
|
||||||
|
value: this.value,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static percent(v) {
|
FlexTypedValue.Auto = new FlexTypedValue(ValueType.Auto);
|
||||||
const ret = new FlexTypedValue(ValueType.Percent);
|
return FlexTypedValue;
|
||||||
ret.value = v;
|
})();
|
||||||
return ret;
|
export { FlexTypedValue };
|
||||||
}
|
|
||||||
static point(v) {
|
|
||||||
const ret = new FlexTypedValue(ValueType.Point);
|
|
||||||
ret.value = v;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
toModel() {
|
|
||||||
return {
|
|
||||||
type: this.type,
|
|
||||||
value: this.value,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FlexTypedValue.Auto = new FlexTypedValue(ValueType.Auto);
|
|
||||||
export var FlexDirection;
|
export var FlexDirection;
|
||||||
(function (FlexDirection) {
|
(function (FlexDirection) {
|
||||||
FlexDirection[FlexDirection["COLUMN"] = 0] = "COLUMN";
|
FlexDirection[FlexDirection["COLUMN"] = 0] = "COLUMN";
|
||||||
|
@ -10,64 +10,68 @@ export const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
|
|||||||
export const CENTER_X = SPECIFIED << SHIFT_X;
|
export const CENTER_X = SPECIFIED << SHIFT_X;
|
||||||
export const CENTER_Y = SPECIFIED << SHIFT_Y;
|
export const CENTER_Y = SPECIFIED << SHIFT_Y;
|
||||||
export const CENTER = CENTER_X | CENTER_Y;
|
export const CENTER = CENTER_X | CENTER_Y;
|
||||||
export class Gravity {
|
let Gravity = /** @class */ (() => {
|
||||||
constructor() {
|
class Gravity {
|
||||||
this.val = 0;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
left() {
|
Gravity.origin = new Gravity;
|
||||||
const val = this.val | LEFT;
|
Gravity.Center = Gravity.origin.center();
|
||||||
const ret = new Gravity;
|
Gravity.CenterX = Gravity.origin.centerX();
|
||||||
ret.val = val;
|
Gravity.CenterY = Gravity.origin.centerY();
|
||||||
return ret;
|
Gravity.Left = Gravity.origin.left();
|
||||||
}
|
Gravity.Right = Gravity.origin.right();
|
||||||
right() {
|
Gravity.Top = Gravity.origin.top();
|
||||||
const val = this.val | RIGHT;
|
Gravity.Bottom = Gravity.origin.bottom();
|
||||||
const ret = new Gravity;
|
return Gravity;
|
||||||
ret.val = val;
|
})();
|
||||||
return ret;
|
export { Gravity };
|
||||||
}
|
|
||||||
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();
|
|
||||||
export function gravity() {
|
export function gravity() {
|
||||||
return new Gravity;
|
return new Gravity;
|
||||||
}
|
}
|
||||||
|
@ -25,12 +25,16 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|||||||
import { Property, View } from "../ui/view";
|
import { Property, View } from "../ui/view";
|
||||||
import { Stack } from "../widget/layouts";
|
import { Stack } from "../widget/layouts";
|
||||||
import { layoutConfig } from "../util/layoutconfig";
|
import { layoutConfig } from "../util/layoutconfig";
|
||||||
export class Draggable extends Stack {
|
let Draggable = /** @class */ (() => {
|
||||||
}
|
class Draggable extends Stack {
|
||||||
__decorate([
|
}
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Function)
|
Property,
|
||||||
], Draggable.prototype, "onDrag", void 0);
|
__metadata("design:type", Function)
|
||||||
|
], Draggable.prototype, "onDrag", void 0);
|
||||||
|
return Draggable;
|
||||||
|
})();
|
||||||
|
export { Draggable };
|
||||||
export function draggable(views, config) {
|
export function draggable(views, config) {
|
||||||
const ret = new Draggable;
|
const ret = new Draggable;
|
||||||
ret.layoutConfig = layoutConfig().fit();
|
ret.layoutConfig = layoutConfig().fit();
|
||||||
|
@ -25,105 +25,113 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|||||||
import { Stack } from './layouts';
|
import { Stack } from './layouts';
|
||||||
import { Property, Superview, View } from '../ui/view';
|
import { Property, Superview, View } from '../ui/view';
|
||||||
import { layoutConfig } from '../util/index.util';
|
import { layoutConfig } from '../util/index.util';
|
||||||
export class FlowLayoutItem extends Stack {
|
let FlowLayoutItem = /** @class */ (() => {
|
||||||
}
|
class FlowLayoutItem extends Stack {
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", String)
|
|
||||||
], FlowLayoutItem.prototype, "identifier", void 0);
|
|
||||||
export class FlowLayout extends Superview {
|
|
||||||
constructor() {
|
|
||||||
super(...arguments);
|
|
||||||
this.cachedViews = new Map;
|
|
||||||
this.ignoreDirtyCallOnce = false;
|
|
||||||
this.columnCount = 2;
|
|
||||||
this.itemCount = 0;
|
|
||||||
this.batchCount = 15;
|
|
||||||
}
|
}
|
||||||
allSubviews() {
|
__decorate([
|
||||||
if (this.loadMoreView) {
|
Property,
|
||||||
return [...this.cachedViews.values(), this.loadMoreView];
|
__metadata("design:type", String)
|
||||||
}
|
], FlowLayoutItem.prototype, "identifier", void 0);
|
||||||
else {
|
return FlowLayoutItem;
|
||||||
return this.cachedViews.values();
|
})();
|
||||||
}
|
export { FlowLayoutItem };
|
||||||
}
|
let FlowLayout = /** @class */ (() => {
|
||||||
reset() {
|
class FlowLayout extends Superview {
|
||||||
this.cachedViews.clear();
|
constructor() {
|
||||||
this.itemCount = 0;
|
super(...arguments);
|
||||||
}
|
this.cachedViews = new Map;
|
||||||
getItem(itemIdx) {
|
|
||||||
let view = this.renderItem(itemIdx);
|
|
||||||
view.superview = this;
|
|
||||||
this.cachedViews.set(`${itemIdx}`, view);
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
isDirty() {
|
|
||||||
if (this.ignoreDirtyCallOnce) {
|
|
||||||
this.ignoreDirtyCallOnce = false;
|
this.ignoreDirtyCallOnce = false;
|
||||||
//Ignore the dirty call once.
|
this.columnCount = 2;
|
||||||
return false;
|
this.itemCount = 0;
|
||||||
|
this.batchCount = 15;
|
||||||
}
|
}
|
||||||
return super.isDirty();
|
allSubviews() {
|
||||||
}
|
if (this.loadMoreView) {
|
||||||
renderBunchedItems(start, length) {
|
return [...this.cachedViews.values(), this.loadMoreView];
|
||||||
this.ignoreDirtyCallOnce = true;
|
}
|
||||||
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
|
else {
|
||||||
const listItem = this.getItem(start + idx);
|
return this.cachedViews.values();
|
||||||
return listItem.toModel();
|
}
|
||||||
});
|
}
|
||||||
}
|
reset() {
|
||||||
toModel() {
|
this.cachedViews.clear();
|
||||||
if (this.loadMoreView) {
|
this.itemCount = 0;
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
}
|
||||||
|
getItem(itemIdx) {
|
||||||
|
let view = this.renderItem(itemIdx);
|
||||||
|
view.superview = this;
|
||||||
|
this.cachedViews.set(`${itemIdx}`, view);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
isDirty() {
|
||||||
|
if (this.ignoreDirtyCallOnce) {
|
||||||
|
this.ignoreDirtyCallOnce = false;
|
||||||
|
//Ignore the dirty call once.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.isDirty();
|
||||||
|
}
|
||||||
|
renderBunchedItems(start, length) {
|
||||||
|
this.ignoreDirtyCallOnce = true;
|
||||||
|
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
|
||||||
|
const listItem = this.getItem(start + idx);
|
||||||
|
return listItem.toModel();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
toModel() {
|
||||||
|
if (this.loadMoreView) {
|
||||||
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
||||||
|
}
|
||||||
|
return super.toModel();
|
||||||
}
|
}
|
||||||
return super.toModel();
|
|
||||||
}
|
}
|
||||||
}
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Object)
|
||||||
__metadata("design:type", Object)
|
], FlowLayout.prototype, "columnCount", void 0);
|
||||||
], FlowLayout.prototype, "columnCount", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], FlowLayout.prototype, "columnSpace", void 0);
|
||||||
], FlowLayout.prototype, "columnSpace", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], FlowLayout.prototype, "rowSpace", void 0);
|
||||||
], FlowLayout.prototype, "rowSpace", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Object)
|
||||||
__metadata("design:type", Object)
|
], FlowLayout.prototype, "itemCount", void 0);
|
||||||
], FlowLayout.prototype, "itemCount", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Function)
|
||||||
__metadata("design:type", Function)
|
], FlowLayout.prototype, "renderItem", void 0);
|
||||||
], FlowLayout.prototype, "renderItem", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Object)
|
||||||
__metadata("design:type", Object)
|
], FlowLayout.prototype, "batchCount", void 0);
|
||||||
], FlowLayout.prototype, "batchCount", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Function)
|
||||||
__metadata("design:type", Function)
|
], FlowLayout.prototype, "onLoadMore", void 0);
|
||||||
], FlowLayout.prototype, "onLoadMore", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Boolean)
|
||||||
__metadata("design:type", Boolean)
|
], FlowLayout.prototype, "loadMore", void 0);
|
||||||
], FlowLayout.prototype, "loadMore", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", FlowLayoutItem)
|
||||||
__metadata("design:type", FlowLayoutItem)
|
], FlowLayout.prototype, "loadMoreView", void 0);
|
||||||
], FlowLayout.prototype, "loadMoreView", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Function)
|
||||||
__metadata("design:type", Function)
|
], FlowLayout.prototype, "onScroll", void 0);
|
||||||
], FlowLayout.prototype, "onScroll", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Function)
|
||||||
__metadata("design:type", Function)
|
], FlowLayout.prototype, "onScrollEnd", void 0);
|
||||||
], FlowLayout.prototype, "onScrollEnd", void 0);
|
return FlowLayout;
|
||||||
|
})();
|
||||||
|
export { FlowLayout };
|
||||||
export function flowlayout(config) {
|
export function flowlayout(config) {
|
||||||
const ret = new FlowLayout;
|
const ret = new FlowLayout;
|
||||||
for (let key in config) {
|
for (let key in config) {
|
||||||
|
@ -31,73 +31,77 @@ export var ScaleType;
|
|||||||
ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit";
|
ScaleType[ScaleType["ScaleAspectFit"] = 1] = "ScaleAspectFit";
|
||||||
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
|
ScaleType[ScaleType["ScaleAspectFill"] = 2] = "ScaleAspectFill";
|
||||||
})(ScaleType || (ScaleType = {}));
|
})(ScaleType || (ScaleType = {}));
|
||||||
export class Image extends View {
|
let Image = /** @class */ (() => {
|
||||||
}
|
class Image extends View {
|
||||||
__decorate([
|
}
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", String)
|
Property,
|
||||||
], Image.prototype, "imageUrl", void 0);
|
__metadata("design:type", String)
|
||||||
__decorate([
|
], Image.prototype, "imageUrl", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", String)
|
Property,
|
||||||
], Image.prototype, "imagePath", void 0);
|
__metadata("design:type", String)
|
||||||
__decorate([
|
], Image.prototype, "imagePath", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", String)
|
Property,
|
||||||
], Image.prototype, "imageRes", void 0);
|
__metadata("design:type", String)
|
||||||
__decorate([
|
], Image.prototype, "imageRes", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", String)
|
Property,
|
||||||
], Image.prototype, "imageBase64", void 0);
|
__metadata("design:type", String)
|
||||||
__decorate([
|
], Image.prototype, "imageBase64", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Number)
|
Property,
|
||||||
], Image.prototype, "scaleType", void 0);
|
__metadata("design:type", Number)
|
||||||
__decorate([
|
], Image.prototype, "scaleType", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Boolean)
|
Property,
|
||||||
], Image.prototype, "isBlur", void 0);
|
__metadata("design:type", Boolean)
|
||||||
__decorate([
|
], Image.prototype, "isBlur", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", String)
|
Property,
|
||||||
], Image.prototype, "placeHolderImage", void 0);
|
__metadata("design:type", String)
|
||||||
__decorate([
|
], Image.prototype, "placeHolderImage", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", String)
|
Property,
|
||||||
], Image.prototype, "placeHolderImageBase64", void 0);
|
__metadata("design:type", String)
|
||||||
__decorate([
|
], Image.prototype, "placeHolderImageBase64", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Color
|
Property,
|
||||||
/**
|
__metadata("design:type", Color
|
||||||
* Display while image is failed to load
|
/**
|
||||||
* It can be file name in local path
|
* Display while image is failed to load
|
||||||
*/
|
* It can be file name in local path
|
||||||
)
|
*/
|
||||||
], Image.prototype, "placeHolderColor", void 0);
|
)
|
||||||
__decorate([
|
], Image.prototype, "placeHolderColor", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", String)
|
Property,
|
||||||
], Image.prototype, "errorImage", void 0);
|
__metadata("design:type", String)
|
||||||
__decorate([
|
], Image.prototype, "errorImage", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", String)
|
Property,
|
||||||
], Image.prototype, "errorImageBase64", void 0);
|
__metadata("design:type", String)
|
||||||
__decorate([
|
], Image.prototype, "errorImageBase64", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Color)
|
Property,
|
||||||
], Image.prototype, "errorColor", void 0);
|
__metadata("design:type", Color)
|
||||||
__decorate([
|
], Image.prototype, "errorColor", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Function)
|
Property,
|
||||||
], Image.prototype, "loadCallback", void 0);
|
__metadata("design:type", Function)
|
||||||
__decorate([
|
], Image.prototype, "loadCallback", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Number)
|
Property,
|
||||||
], Image.prototype, "imageScale", void 0);
|
__metadata("design:type", Number)
|
||||||
__decorate([
|
], Image.prototype, "imageScale", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Object)
|
Property,
|
||||||
], Image.prototype, "stretchInset", void 0);
|
__metadata("design:type", Object)
|
||||||
|
], Image.prototype, "stretchInset", void 0);
|
||||||
|
return Image;
|
||||||
|
})();
|
||||||
|
export { Image };
|
||||||
export function image(config) {
|
export function image(config) {
|
||||||
const ret = new Image;
|
const ret = new Image;
|
||||||
ret.layoutConfig = layoutConfig().fit();
|
ret.layoutConfig = layoutConfig().fit();
|
||||||
|
@ -26,63 +26,67 @@ import { View, Property } from "../ui/view";
|
|||||||
import { Color } from "../util/color";
|
import { Color } from "../util/color";
|
||||||
import { Gravity } from "../util/gravity";
|
import { Gravity } from "../util/gravity";
|
||||||
import { layoutConfig } from "../util/index.util";
|
import { layoutConfig } from "../util/index.util";
|
||||||
export class Input extends View {
|
let Input = /** @class */ (() => {
|
||||||
getText(context) {
|
class Input extends View {
|
||||||
return this.nativeChannel(context, 'getText')();
|
getText(context) {
|
||||||
|
return this.nativeChannel(context, 'getText')();
|
||||||
|
}
|
||||||
|
setSelection(context, start, end = start) {
|
||||||
|
return this.nativeChannel(context, 'setSelection')({
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
requestFocus(context) {
|
||||||
|
return this.nativeChannel(context, 'requestFocus')();
|
||||||
|
}
|
||||||
|
releaseFocus(context) {
|
||||||
|
return this.nativeChannel(context, 'releaseFocus')();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setSelection(context, start, end = start) {
|
__decorate([
|
||||||
return this.nativeChannel(context, 'setSelection')({
|
Property,
|
||||||
start,
|
__metadata("design:type", String)
|
||||||
end,
|
], Input.prototype, "text", void 0);
|
||||||
});
|
__decorate([
|
||||||
}
|
Property,
|
||||||
requestFocus(context) {
|
__metadata("design:type", Color)
|
||||||
return this.nativeChannel(context, 'requestFocus')();
|
], Input.prototype, "textColor", void 0);
|
||||||
}
|
__decorate([
|
||||||
releaseFocus(context) {
|
Property,
|
||||||
return this.nativeChannel(context, 'releaseFocus')();
|
__metadata("design:type", Number)
|
||||||
}
|
], Input.prototype, "textSize", void 0);
|
||||||
}
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", String)
|
||||||
__metadata("design:type", String)
|
], Input.prototype, "hintText", void 0);
|
||||||
], Input.prototype, "text", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Color)
|
||||||
__metadata("design:type", Color)
|
], Input.prototype, "hintTextColor", void 0);
|
||||||
], Input.prototype, "textColor", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Boolean)
|
||||||
__metadata("design:type", Number)
|
], Input.prototype, "multiline", void 0);
|
||||||
], Input.prototype, "textSize", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Gravity)
|
||||||
__metadata("design:type", String)
|
], Input.prototype, "textAlignment", void 0);
|
||||||
], Input.prototype, "hintText", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Function)
|
||||||
__metadata("design:type", Color)
|
], Input.prototype, "onTextChange", void 0);
|
||||||
], Input.prototype, "hintTextColor", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Function)
|
||||||
__metadata("design:type", Boolean)
|
], Input.prototype, "onFocusChange", void 0);
|
||||||
], Input.prototype, "multiline", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Gravity)
|
], Input.prototype, "maxLength", void 0);
|
||||||
], Input.prototype, "textAlignment", void 0);
|
return Input;
|
||||||
__decorate([
|
})();
|
||||||
Property,
|
export { Input };
|
||||||
__metadata("design:type", Function)
|
|
||||||
], Input.prototype, "onTextChange", void 0);
|
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", Function)
|
|
||||||
], Input.prototype, "onFocusChange", void 0);
|
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", Number)
|
|
||||||
], Input.prototype, "maxLength", void 0);
|
|
||||||
export function input(config) {
|
export function input(config) {
|
||||||
const ret = new Input;
|
const ret = new Input;
|
||||||
ret.layoutConfig = layoutConfig().just();
|
ret.layoutConfig = layoutConfig().just();
|
||||||
|
@ -29,16 +29,19 @@ export class Stack extends Group {
|
|||||||
}
|
}
|
||||||
export class Root extends Stack {
|
export class Root extends Stack {
|
||||||
}
|
}
|
||||||
class LinearLayout extends Group {
|
let LinearLayout = /** @class */ (() => {
|
||||||
}
|
class LinearLayout extends Group {
|
||||||
__decorate([
|
}
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Number)
|
Property,
|
||||||
], LinearLayout.prototype, "space", void 0);
|
__metadata("design:type", Number)
|
||||||
__decorate([
|
], LinearLayout.prototype, "space", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Gravity)
|
Property,
|
||||||
], LinearLayout.prototype, "gravity", void 0);
|
__metadata("design:type", Gravity)
|
||||||
|
], LinearLayout.prototype, "gravity", void 0);
|
||||||
|
return LinearLayout;
|
||||||
|
})();
|
||||||
export class VLayout extends LinearLayout {
|
export class VLayout extends LinearLayout {
|
||||||
}
|
}
|
||||||
export class HLayout extends LinearLayout {
|
export class HLayout extends LinearLayout {
|
||||||
|
@ -25,101 +25,108 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|||||||
import { View, Property, Superview } from "../ui/view";
|
import { View, Property, Superview } from "../ui/view";
|
||||||
import { Stack } from "./layouts";
|
import { Stack } from "./layouts";
|
||||||
import { layoutConfig } from "../util/layoutconfig";
|
import { layoutConfig } from "../util/layoutconfig";
|
||||||
export class ListItem extends Stack {
|
let ListItem = /** @class */ (() => {
|
||||||
}
|
class ListItem extends Stack {
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", String)
|
|
||||||
], ListItem.prototype, "identifier", void 0);
|
|
||||||
export class List extends Superview {
|
|
||||||
constructor() {
|
|
||||||
super(...arguments);
|
|
||||||
this.cachedViews = new Map;
|
|
||||||
this.ignoreDirtyCallOnce = false;
|
|
||||||
this.itemCount = 0;
|
|
||||||
this.batchCount = 15;
|
|
||||||
}
|
}
|
||||||
allSubviews() {
|
__decorate([
|
||||||
if (this.loadMoreView) {
|
Property,
|
||||||
return [...this.cachedViews.values(), this.loadMoreView];
|
__metadata("design:type", String)
|
||||||
}
|
], ListItem.prototype, "identifier", void 0);
|
||||||
else {
|
return ListItem;
|
||||||
return this.cachedViews.values();
|
})();
|
||||||
}
|
export { ListItem };
|
||||||
}
|
let List = /** @class */ (() => {
|
||||||
scrollToItem(context, index, config) {
|
class List extends Superview {
|
||||||
var _a;
|
constructor() {
|
||||||
const animated = (_a = config) === null || _a === void 0 ? void 0 : _a.animated;
|
super(...arguments);
|
||||||
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
|
this.cachedViews = new Map;
|
||||||
}
|
|
||||||
reset() {
|
|
||||||
this.cachedViews.clear();
|
|
||||||
this.itemCount = 0;
|
|
||||||
}
|
|
||||||
getItem(itemIdx) {
|
|
||||||
let view = this.renderItem(itemIdx);
|
|
||||||
view.superview = this;
|
|
||||||
this.cachedViews.set(`${itemIdx}`, view);
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
isDirty() {
|
|
||||||
if (this.ignoreDirtyCallOnce) {
|
|
||||||
this.ignoreDirtyCallOnce = false;
|
this.ignoreDirtyCallOnce = false;
|
||||||
//Ignore the dirty call once.
|
this.itemCount = 0;
|
||||||
return false;
|
this.batchCount = 15;
|
||||||
}
|
}
|
||||||
return super.isDirty();
|
allSubviews() {
|
||||||
}
|
if (this.loadMoreView) {
|
||||||
renderBunchedItems(start, length) {
|
return [...this.cachedViews.values(), this.loadMoreView];
|
||||||
this.ignoreDirtyCallOnce = true;
|
}
|
||||||
return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => {
|
else {
|
||||||
const listItem = this.getItem(start + idx);
|
return this.cachedViews.values();
|
||||||
return listItem.toModel();
|
}
|
||||||
});
|
}
|
||||||
}
|
scrollToItem(context, index, config) {
|
||||||
toModel() {
|
const animated = config === null || config === void 0 ? void 0 : config.animated;
|
||||||
if (this.loadMoreView) {
|
return this.nativeChannel(context, 'scrollToItem')({ index, animated, });
|
||||||
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
}
|
||||||
|
reset() {
|
||||||
|
this.cachedViews.clear();
|
||||||
|
this.itemCount = 0;
|
||||||
|
}
|
||||||
|
getItem(itemIdx) {
|
||||||
|
let view = this.renderItem(itemIdx);
|
||||||
|
view.superview = this;
|
||||||
|
this.cachedViews.set(`${itemIdx}`, view);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
isDirty() {
|
||||||
|
if (this.ignoreDirtyCallOnce) {
|
||||||
|
this.ignoreDirtyCallOnce = false;
|
||||||
|
//Ignore the dirty call once.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.isDirty();
|
||||||
|
}
|
||||||
|
renderBunchedItems(start, length) {
|
||||||
|
this.ignoreDirtyCallOnce = true;
|
||||||
|
return new Array(Math.max(0, Math.min(length, this.itemCount - start))).fill(0).map((_, idx) => {
|
||||||
|
const listItem = this.getItem(start + idx);
|
||||||
|
return listItem.toModel();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
toModel() {
|
||||||
|
if (this.loadMoreView) {
|
||||||
|
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId;
|
||||||
|
}
|
||||||
|
return super.toModel();
|
||||||
}
|
}
|
||||||
return super.toModel();
|
|
||||||
}
|
}
|
||||||
}
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Object)
|
||||||
__metadata("design:type", Object)
|
], List.prototype, "itemCount", void 0);
|
||||||
], List.prototype, "itemCount", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Function)
|
||||||
__metadata("design:type", Function)
|
], List.prototype, "renderItem", void 0);
|
||||||
], List.prototype, "renderItem", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Object)
|
||||||
__metadata("design:type", Object)
|
], List.prototype, "batchCount", void 0);
|
||||||
], List.prototype, "batchCount", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Function)
|
||||||
__metadata("design:type", Function)
|
], List.prototype, "onLoadMore", void 0);
|
||||||
], List.prototype, "onLoadMore", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Boolean)
|
||||||
__metadata("design:type", Boolean)
|
], List.prototype, "loadMore", void 0);
|
||||||
], List.prototype, "loadMore", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", ListItem)
|
||||||
__metadata("design:type", ListItem)
|
], List.prototype, "loadMoreView", void 0);
|
||||||
], List.prototype, "loadMoreView", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Function)
|
||||||
__metadata("design:type", Function)
|
], List.prototype, "onScroll", void 0);
|
||||||
], List.prototype, "onScroll", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Function)
|
||||||
__metadata("design:type", Function)
|
], List.prototype, "onScrollEnd", void 0);
|
||||||
], List.prototype, "onScrollEnd", void 0);
|
__decorate([
|
||||||
__decorate([
|
Property,
|
||||||
Property,
|
__metadata("design:type", Number)
|
||||||
__metadata("design:type", Number)
|
], List.prototype, "scrolledPosition", void 0);
|
||||||
], List.prototype, "scrolledPosition", void 0);
|
return List;
|
||||||
|
})();
|
||||||
|
export { List };
|
||||||
export function list(config) {
|
export function list(config) {
|
||||||
const ret = new List;
|
const ret = new List;
|
||||||
for (let key in config) {
|
for (let key in config) {
|
||||||
|
@ -23,18 +23,22 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { Group, Property } from '../ui/view';
|
import { Group, Property } from '../ui/view';
|
||||||
export class NestedSlider extends Group {
|
let NestedSlider = /** @class */ (() => {
|
||||||
addSlideItem(view) {
|
class NestedSlider extends Group {
|
||||||
this.addChild(view);
|
addSlideItem(view) {
|
||||||
|
this.addChild(view);
|
||||||
|
}
|
||||||
|
slidePage(context, page, smooth = false) {
|
||||||
|
return this.nativeChannel(context, "slidePage")({ page, smooth });
|
||||||
|
}
|
||||||
|
getSlidedPage(context) {
|
||||||
|
return this.nativeChannel(context, "getSlidedPage")();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
slidePage(context, page, smooth = false) {
|
__decorate([
|
||||||
return this.nativeChannel(context, "slidePage")({ page, smooth });
|
Property,
|
||||||
}
|
__metadata("design:type", Function)
|
||||||
getSlidedPage(context) {
|
], NestedSlider.prototype, "onPageSlided", void 0);
|
||||||
return this.nativeChannel(context, "getSlidedPage")();
|
return NestedSlider;
|
||||||
}
|
})();
|
||||||
}
|
export { NestedSlider };
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", Function)
|
|
||||||
], NestedSlider.prototype, "onPageSlided", void 0);
|
|
||||||
|
@ -9,36 +9,40 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|||||||
};
|
};
|
||||||
import { Property, Superview } from "../ui/view";
|
import { Property, Superview } from "../ui/view";
|
||||||
import { layoutConfig } from "../util/layoutconfig";
|
import { layoutConfig } from "../util/layoutconfig";
|
||||||
export class Refreshable extends Superview {
|
let Refreshable = /** @class */ (() => {
|
||||||
allSubviews() {
|
class Refreshable extends Superview {
|
||||||
const ret = [this.content];
|
allSubviews() {
|
||||||
if (this.header) {
|
const ret = [this.content];
|
||||||
ret.push(this.header);
|
if (this.header) {
|
||||||
|
ret.push(this.header);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
setRefreshable(context, refreshable) {
|
||||||
|
return this.nativeChannel(context, 'setRefreshable')(refreshable);
|
||||||
|
}
|
||||||
|
setRefreshing(context, refreshing) {
|
||||||
|
return this.nativeChannel(context, 'setRefreshing')(refreshing);
|
||||||
|
}
|
||||||
|
isRefreshable(context) {
|
||||||
|
return this.nativeChannel(context, 'isRefreshable')();
|
||||||
|
}
|
||||||
|
isRefreshing(context) {
|
||||||
|
return this.nativeChannel(context, 'isRefreshing')();
|
||||||
|
}
|
||||||
|
toModel() {
|
||||||
|
this.dirtyProps.content = this.content.viewId;
|
||||||
|
this.dirtyProps.header = (this.header || {}).viewId;
|
||||||
|
return super.toModel();
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
setRefreshable(context, refreshable) {
|
__decorate([
|
||||||
return this.nativeChannel(context, 'setRefreshable')(refreshable);
|
Property,
|
||||||
}
|
__metadata("design:type", Function)
|
||||||
setRefreshing(context, refreshing) {
|
], Refreshable.prototype, "onRefresh", void 0);
|
||||||
return this.nativeChannel(context, 'setRefreshing')(refreshing);
|
return Refreshable;
|
||||||
}
|
})();
|
||||||
isRefreshable(context) {
|
export { Refreshable };
|
||||||
return this.nativeChannel(context, 'isRefreshable')();
|
|
||||||
}
|
|
||||||
isRefreshing(context) {
|
|
||||||
return this.nativeChannel(context, 'isRefreshing')();
|
|
||||||
}
|
|
||||||
toModel() {
|
|
||||||
this.dirtyProps.content = this.content.viewId;
|
|
||||||
this.dirtyProps.header = (this.header || {}).viewId;
|
|
||||||
return super.toModel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", Function)
|
|
||||||
], Refreshable.prototype, "onRefresh", void 0);
|
|
||||||
export function refreshable(config) {
|
export function refreshable(config) {
|
||||||
const ret = new Refreshable;
|
const ret = new Refreshable;
|
||||||
ret.layoutConfig = layoutConfig().fit();
|
ret.layoutConfig = layoutConfig().fit();
|
||||||
|
@ -35,30 +35,34 @@ export function scroller(content, config) {
|
|||||||
v.content = content;
|
v.content = content;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
export class Scroller extends Superview {
|
let Scroller = /** @class */ (() => {
|
||||||
allSubviews() {
|
class Scroller extends Superview {
|
||||||
return [this.content];
|
allSubviews() {
|
||||||
|
return [this.content];
|
||||||
|
}
|
||||||
|
toModel() {
|
||||||
|
this.dirtyProps.content = this.content.viewId;
|
||||||
|
return super.toModel();
|
||||||
|
}
|
||||||
|
scrollTo(context, offset, animated) {
|
||||||
|
return this.nativeChannel(context, "scrollTo")({ offset, animated });
|
||||||
|
}
|
||||||
|
scrollBy(context, offset, animated) {
|
||||||
|
return this.nativeChannel(context, "scrollBy")({ offset, animated });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
toModel() {
|
__decorate([
|
||||||
this.dirtyProps.content = this.content.viewId;
|
Property,
|
||||||
return super.toModel();
|
__metadata("design:type", Object)
|
||||||
}
|
], Scroller.prototype, "contentOffset", void 0);
|
||||||
scrollTo(context, offset, animated) {
|
__decorate([
|
||||||
return this.nativeChannel(context, "scrollTo")({ offset, animated });
|
Property,
|
||||||
}
|
__metadata("design:type", Function)
|
||||||
scrollBy(context, offset, animated) {
|
], Scroller.prototype, "onScroll", void 0);
|
||||||
return this.nativeChannel(context, "scrollBy")({ offset, animated });
|
__decorate([
|
||||||
}
|
Property,
|
||||||
}
|
__metadata("design:type", Function)
|
||||||
__decorate([
|
], Scroller.prototype, "onScrollEnd", void 0);
|
||||||
Property,
|
return Scroller;
|
||||||
__metadata("design:type", Object)
|
})();
|
||||||
], Scroller.prototype, "contentOffset", void 0);
|
export { Scroller };
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", Function)
|
|
||||||
], Scroller.prototype, "onScroll", void 0);
|
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", Function)
|
|
||||||
], Scroller.prototype, "onScrollEnd", void 0);
|
|
||||||
|
@ -25,71 +25,79 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|||||||
import { Superview, View, Property } from "../ui/view";
|
import { Superview, View, Property } from "../ui/view";
|
||||||
import { Stack } from "./layouts";
|
import { Stack } from "./layouts";
|
||||||
import { layoutConfig } from "../util/layoutconfig";
|
import { layoutConfig } from "../util/layoutconfig";
|
||||||
export class SlideItem extends Stack {
|
let SlideItem = /** @class */ (() => {
|
||||||
}
|
class SlideItem extends Stack {
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", String)
|
|
||||||
], SlideItem.prototype, "identifier", void 0);
|
|
||||||
export class Slider extends Superview {
|
|
||||||
constructor() {
|
|
||||||
super(...arguments);
|
|
||||||
this.cachedViews = new Map;
|
|
||||||
this.ignoreDirtyCallOnce = false;
|
|
||||||
this.itemCount = 0;
|
|
||||||
this.batchCount = 3;
|
|
||||||
}
|
}
|
||||||
allSubviews() {
|
__decorate([
|
||||||
return this.cachedViews.values();
|
Property,
|
||||||
}
|
__metadata("design:type", String)
|
||||||
getItem(itemIdx) {
|
], SlideItem.prototype, "identifier", void 0);
|
||||||
let view = this.renderPage(itemIdx);
|
return SlideItem;
|
||||||
view.superview = this;
|
})();
|
||||||
this.cachedViews.set(`${itemIdx}`, view);
|
export { SlideItem };
|
||||||
return view;
|
let Slider = /** @class */ (() => {
|
||||||
}
|
class Slider extends Superview {
|
||||||
isDirty() {
|
constructor() {
|
||||||
if (this.ignoreDirtyCallOnce) {
|
super(...arguments);
|
||||||
|
this.cachedViews = new Map;
|
||||||
this.ignoreDirtyCallOnce = false;
|
this.ignoreDirtyCallOnce = false;
|
||||||
//Ignore the dirty call once.
|
this.itemCount = 0;
|
||||||
return false;
|
this.batchCount = 3;
|
||||||
|
}
|
||||||
|
allSubviews() {
|
||||||
|
return this.cachedViews.values();
|
||||||
|
}
|
||||||
|
getItem(itemIdx) {
|
||||||
|
let view = this.renderPage(itemIdx);
|
||||||
|
view.superview = this;
|
||||||
|
this.cachedViews.set(`${itemIdx}`, view);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
isDirty() {
|
||||||
|
if (this.ignoreDirtyCallOnce) {
|
||||||
|
this.ignoreDirtyCallOnce = false;
|
||||||
|
//Ignore the dirty call once.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.isDirty();
|
||||||
|
}
|
||||||
|
renderBunchedItems(start, length) {
|
||||||
|
this.ignoreDirtyCallOnce = true;
|
||||||
|
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
|
||||||
|
const slideItem = this.getItem(start + idx);
|
||||||
|
return slideItem.toModel();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
slidePage(context, page, smooth = false) {
|
||||||
|
return this.nativeChannel(context, "slidePage")({ page, smooth });
|
||||||
|
}
|
||||||
|
getSlidedPage(context) {
|
||||||
|
return this.nativeChannel(context, "getSlidedPage")();
|
||||||
}
|
}
|
||||||
return super.isDirty();
|
|
||||||
}
|
}
|
||||||
renderBunchedItems(start, length) {
|
__decorate([
|
||||||
this.ignoreDirtyCallOnce = true;
|
Property,
|
||||||
return new Array(Math.min(length, this.itemCount - start)).fill(0).map((_, idx) => {
|
__metadata("design:type", Object)
|
||||||
const slideItem = this.getItem(start + idx);
|
], Slider.prototype, "itemCount", void 0);
|
||||||
return slideItem.toModel();
|
__decorate([
|
||||||
});
|
Property,
|
||||||
}
|
__metadata("design:type", Function)
|
||||||
slidePage(context, page, smooth = false) {
|
], Slider.prototype, "renderPage", void 0);
|
||||||
return this.nativeChannel(context, "slidePage")({ page, smooth });
|
__decorate([
|
||||||
}
|
Property,
|
||||||
getSlidedPage(context) {
|
__metadata("design:type", Object)
|
||||||
return this.nativeChannel(context, "getSlidedPage")();
|
], Slider.prototype, "batchCount", void 0);
|
||||||
}
|
__decorate([
|
||||||
}
|
Property,
|
||||||
__decorate([
|
__metadata("design:type", Function)
|
||||||
Property,
|
], Slider.prototype, "onPageSlided", void 0);
|
||||||
__metadata("design:type", Object)
|
__decorate([
|
||||||
], Slider.prototype, "itemCount", void 0);
|
Property,
|
||||||
__decorate([
|
__metadata("design:type", Boolean)
|
||||||
Property,
|
], Slider.prototype, "loop", void 0);
|
||||||
__metadata("design:type", Function)
|
return Slider;
|
||||||
], Slider.prototype, "renderPage", void 0);
|
})();
|
||||||
__decorate([
|
export { Slider };
|
||||||
Property,
|
|
||||||
__metadata("design:type", Object)
|
|
||||||
], Slider.prototype, "batchCount", void 0);
|
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", Function)
|
|
||||||
], Slider.prototype, "onPageSlided", void 0);
|
|
||||||
__decorate([
|
|
||||||
Property,
|
|
||||||
__metadata("design:type", Boolean)
|
|
||||||
], Slider.prototype, "loop", void 0);
|
|
||||||
export function slider(config) {
|
export function slider(config) {
|
||||||
const ret = new Slider;
|
const ret = new Slider;
|
||||||
for (let key in config) {
|
for (let key in config) {
|
||||||
|
@ -25,28 +25,32 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|||||||
import { View, Property } from "../ui/view";
|
import { View, Property } from "../ui/view";
|
||||||
import { Color } from "../util/color";
|
import { Color } from "../util/color";
|
||||||
import { layoutConfig } from "../util/index.util";
|
import { layoutConfig } from "../util/index.util";
|
||||||
export class Switch extends View {
|
let Switch = /** @class */ (() => {
|
||||||
}
|
class Switch extends View {
|
||||||
__decorate([
|
}
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Boolean)
|
Property,
|
||||||
], Switch.prototype, "state", void 0);
|
__metadata("design:type", Boolean)
|
||||||
__decorate([
|
], Switch.prototype, "state", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Function)
|
Property,
|
||||||
], Switch.prototype, "onSwitch", void 0);
|
__metadata("design:type", Function)
|
||||||
__decorate([
|
], Switch.prototype, "onSwitch", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Color)
|
Property,
|
||||||
], Switch.prototype, "offTintColor", void 0);
|
__metadata("design:type", Color)
|
||||||
__decorate([
|
], Switch.prototype, "offTintColor", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Color)
|
Property,
|
||||||
], Switch.prototype, "onTintColor", void 0);
|
__metadata("design:type", Color)
|
||||||
__decorate([
|
], Switch.prototype, "onTintColor", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Color)
|
Property,
|
||||||
], Switch.prototype, "thumbTintColor", void 0);
|
__metadata("design:type", Color)
|
||||||
|
], Switch.prototype, "thumbTintColor", void 0);
|
||||||
|
return Switch;
|
||||||
|
})();
|
||||||
|
export { Switch };
|
||||||
export function switchView(config) {
|
export function switchView(config) {
|
||||||
const ret = new Switch;
|
const ret = new Switch;
|
||||||
ret.layoutConfig = layoutConfig().just();
|
ret.layoutConfig = layoutConfig().just();
|
||||||
|
@ -33,64 +33,68 @@ export var TruncateAt;
|
|||||||
TruncateAt[TruncateAt["Start"] = 2] = "Start";
|
TruncateAt[TruncateAt["Start"] = 2] = "Start";
|
||||||
TruncateAt[TruncateAt["Clip"] = 3] = "Clip";
|
TruncateAt[TruncateAt["Clip"] = 3] = "Clip";
|
||||||
})(TruncateAt || (TruncateAt = {}));
|
})(TruncateAt || (TruncateAt = {}));
|
||||||
export class Text extends View {
|
let Text = /** @class */ (() => {
|
||||||
}
|
class Text extends View {
|
||||||
__decorate([
|
}
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", String)
|
Property,
|
||||||
], Text.prototype, "text", void 0);
|
__metadata("design:type", String)
|
||||||
__decorate([
|
], Text.prototype, "text", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Color)
|
Property,
|
||||||
], Text.prototype, "textColor", void 0);
|
__metadata("design:type", Color)
|
||||||
__decorate([
|
], Text.prototype, "textColor", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Number)
|
Property,
|
||||||
], Text.prototype, "textSize", void 0);
|
__metadata("design:type", Number)
|
||||||
__decorate([
|
], Text.prototype, "textSize", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Number)
|
Property,
|
||||||
], Text.prototype, "maxLines", void 0);
|
__metadata("design:type", Number)
|
||||||
__decorate([
|
], Text.prototype, "maxLines", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Gravity)
|
Property,
|
||||||
], Text.prototype, "textAlignment", void 0);
|
__metadata("design:type", Gravity)
|
||||||
__decorate([
|
], Text.prototype, "textAlignment", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", String)
|
Property,
|
||||||
], Text.prototype, "fontStyle", void 0);
|
__metadata("design:type", String)
|
||||||
__decorate([
|
], Text.prototype, "fontStyle", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", String)
|
Property,
|
||||||
], Text.prototype, "font", void 0);
|
__metadata("design:type", String)
|
||||||
__decorate([
|
], Text.prototype, "font", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Number)
|
Property,
|
||||||
], Text.prototype, "maxWidth", void 0);
|
__metadata("design:type", Number)
|
||||||
__decorate([
|
], Text.prototype, "maxWidth", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Number)
|
Property,
|
||||||
], Text.prototype, "maxHeight", void 0);
|
__metadata("design:type", Number)
|
||||||
__decorate([
|
], Text.prototype, "maxHeight", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Number)
|
Property,
|
||||||
], Text.prototype, "lineSpacing", void 0);
|
__metadata("design:type", Number)
|
||||||
__decorate([
|
], Text.prototype, "lineSpacing", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Boolean)
|
Property,
|
||||||
], Text.prototype, "strikethrough", void 0);
|
__metadata("design:type", Boolean)
|
||||||
__decorate([
|
], Text.prototype, "strikethrough", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Boolean)
|
Property,
|
||||||
], Text.prototype, "underline", void 0);
|
__metadata("design:type", Boolean)
|
||||||
__decorate([
|
], Text.prototype, "underline", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", String)
|
Property,
|
||||||
], Text.prototype, "htmlText", void 0);
|
__metadata("design:type", String)
|
||||||
__decorate([
|
], Text.prototype, "htmlText", void 0);
|
||||||
Property,
|
__decorate([
|
||||||
__metadata("design:type", Number)
|
Property,
|
||||||
], Text.prototype, "truncateAt", void 0);
|
__metadata("design:type", Number)
|
||||||
|
], Text.prototype, "truncateAt", void 0);
|
||||||
|
return Text;
|
||||||
|
})();
|
||||||
|
export { Text };
|
||||||
export function text(config) {
|
export function text(config) {
|
||||||
const ret = new Text;
|
const ret = new Text;
|
||||||
ret.layoutConfig = layoutConfig().fit();
|
ret.layoutConfig = layoutConfig().fit();
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rollup": "^1.29.0",
|
"rollup": "^1.29.0",
|
||||||
"tslib": "^1.10.0",
|
"tslib": "^1.10.0",
|
||||||
"typescript": "^3.7.4",
|
"typescript": "^3.9.2",
|
||||||
"ws": "^7.2.1"
|
"ws": "^7.2.1"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@ -27,7 +27,6 @@ export default [
|
|||||||
plugins: [
|
plugins: [
|
||||||
resolve({ mainFields: ["jsnext"] }),
|
resolve({ mainFields: ["jsnext"] }),
|
||||||
],
|
],
|
||||||
external: ['reflect-metadata'],
|
|
||||||
onwarn: function (warning) {
|
onwarn: function (warning) {
|
||||||
if (warning.code === 'THIS_IS_UNDEFINED') { return; }
|
if (warning.code === 'THIS_IS_UNDEFINED') { return; }
|
||||||
console.warn(warning.message);
|
console.warn(warning.message);
|
||||||
@ -80,7 +79,6 @@ export default [
|
|||||||
transforms: { dangerousForOf: true }
|
transforms: { dangerousForOf: true }
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
external: ['reflect-metadata'],
|
|
||||||
onwarn: function (warning) {
|
onwarn: function (warning) {
|
||||||
if (warning.code === 'THIS_IS_UNDEFINED') { return; }
|
if (warning.code === 'THIS_IS_UNDEFINED') { return; }
|
||||||
console.warn(warning.message);
|
console.warn(warning.message);
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
export * from 'reflect-metadata'
|
|
||||||
|
|
||||||
export type BridgeContext = {
|
export type BridgeContext = {
|
||||||
/**
|
/**
|
||||||
* The identify of current context
|
* The identify of current context
|
||||||
|
Reference in New Issue
Block a user