js: remove other module to avoid import error
This commit is contained in:
parent
6696278c5b
commit
74f1c61261
@ -48,7 +48,7 @@ class MyDemo extends Panel {
|
||||
}),
|
||||
|
||||
headerImage = image({
|
||||
imageUrl: "https://img.zcool.cn/community/01e75b5da933daa801209e1ffa4649.jpg@1280w_1l_2o_100sh.jpg",
|
||||
imageUrl: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.jj20.com%2Fup%2Fallimg%2F1112%2F12101P11147%2F1Q210011147-3.jpg&refer=http%3A%2F%2Fpic.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1662787633&t=99942c90360f55bbcfe00fa140d1c1df",
|
||||
layoutConfig: layoutConfig().just(),
|
||||
width: root.width,
|
||||
height: 200,
|
||||
|
@ -31,14 +31,14 @@ class CounterView extends ViewHolder {
|
||||
text({
|
||||
text: `Current language is ${Environment.localeLanguage}`,
|
||||
onClick: function () {
|
||||
const v = this as View
|
||||
const v = this as unknown as View
|
||||
group.removeChild(v)
|
||||
}
|
||||
}),
|
||||
text({
|
||||
text: `Current country is ${Environment.localeCountry}`,
|
||||
onClick: function () {
|
||||
const v = this as View
|
||||
const v = this as unknown as View
|
||||
group.removeChild(v)
|
||||
}
|
||||
}),
|
||||
@ -46,7 +46,7 @@ class CounterView extends ViewHolder {
|
||||
text: "Click to remove",
|
||||
textSize: 30,
|
||||
onClick: function () {
|
||||
const v = this as View
|
||||
const v = this as unknown as View
|
||||
group.removeChild(v)
|
||||
}
|
||||
}),
|
||||
|
@ -2,291 +2,291 @@ import { AssetsResource, AndroidAssetsResource, Base64Resource, DrawableResource
|
||||
import { colors, label } from "./utils";
|
||||
import { img_base64 } from "./image_base64";
|
||||
|
||||
const imageUrl = 'https://img.zcool.cn/community/01e75b5da933daa801209e1ffa4649.jpg@1280w_1l_2o_100sh.jpg'
|
||||
const imageUrl = 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.jj20.com%2Fup%2Fallimg%2F1112%2F12101P11147%2F1Q210011147-3.jpg&refer=http%3A%2F%2Fpic.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1662787633&t=99942c90360f55bbcfe00fa140d1c1df'
|
||||
|
||||
import logo from "./images/logo_w.png"
|
||||
import button from "./images/button.png"
|
||||
|
||||
@Entry
|
||||
class ImageDemo extends Panel {
|
||||
build(rootView: Group): void {
|
||||
let imageView: Image
|
||||
scroller(
|
||||
vlayout(
|
||||
[
|
||||
text({
|
||||
text: "Image Demo",
|
||||
layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST),
|
||||
textSize: 30,
|
||||
textColor: Color.WHITE,
|
||||
backgroundColor: colors[5],
|
||||
textAlignment: gravity().center(),
|
||||
height: 50,
|
||||
}),
|
||||
build(rootView: Group): void {
|
||||
let imageView: Image
|
||||
scroller(
|
||||
vlayout(
|
||||
[
|
||||
text({
|
||||
text: "Image Demo",
|
||||
layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST),
|
||||
textSize: 30,
|
||||
textColor: Color.WHITE,
|
||||
backgroundColor: colors[5],
|
||||
textAlignment: gravity().center(),
|
||||
height: 50,
|
||||
}),
|
||||
|
||||
label("Button"),
|
||||
image({
|
||||
image:
|
||||
Environment.platform === "Android"
|
||||
? new AndroidAssetsResource(
|
||||
"assets/The_Parthenon_in_Athens.jpeg"
|
||||
)
|
||||
: new MainBundleResource(
|
||||
"assets/The_Parthenon_in_Athens.jpeg"
|
||||
),
|
||||
}),
|
||||
image({
|
||||
image: new AssetsResource("The_Parthenon_in_Athens.jpeg"),
|
||||
}),
|
||||
image({
|
||||
image: new RemoteResource(
|
||||
"https://p.upyun.com/demo/webp/webp/jpg-0.webp"
|
||||
label("Button"),
|
||||
image({
|
||||
image:
|
||||
Environment.platform === "Android"
|
||||
? new AndroidAssetsResource(
|
||||
"assets/The_Parthenon_in_Athens.jpeg"
|
||||
)
|
||||
: new MainBundleResource(
|
||||
"assets/The_Parthenon_in_Athens.jpeg"
|
||||
),
|
||||
}),
|
||||
image({
|
||||
image: new Base64Resource(img_base64[0]),
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.FIT,
|
||||
heightSpec: LayoutSpec.FIT,
|
||||
},
|
||||
}),
|
||||
image({
|
||||
imageBase64: button,
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.JUST,
|
||||
heightSpec: LayoutSpec.JUST,
|
||||
},
|
||||
width: 200,
|
||||
height: 150 / 2.75,
|
||||
stretchInset: {
|
||||
left: 100,
|
||||
top: 0,
|
||||
right: 100,
|
||||
bottom: 0,
|
||||
},
|
||||
imageScale: 2.75,
|
||||
}),
|
||||
image({
|
||||
imageBase64: button,
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.JUST,
|
||||
heightSpec: LayoutSpec.JUST,
|
||||
},
|
||||
width: 200,
|
||||
height: 75,
|
||||
stretchInset: {
|
||||
left: 100,
|
||||
top: 0,
|
||||
right: 100,
|
||||
bottom: 0,
|
||||
},
|
||||
imageScale: 2,
|
||||
}),
|
||||
label("Gif "),
|
||||
image({
|
||||
imageUrl:
|
||||
"https://www.w3.org/People/mimasa/test/imgformat/img/w3c_home_animation.gif",
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
imageScale: 3,
|
||||
}),
|
||||
label("APNG"),
|
||||
image({
|
||||
imageUrl:
|
||||
"https://upload.wikimedia.org/wikipedia/commons/1/14/Animated_PNG_example_bouncing_beach_ball.png",
|
||||
}),
|
||||
label("Animated WebP"),
|
||||
image({
|
||||
imageUrl:
|
||||
"https://p.upyun.com/demo/webp/webp/animated-gif-0.webp",
|
||||
}),
|
||||
label("WebP"),
|
||||
(imageView = image({
|
||||
imageUrl: "https://p.upyun.com/demo/webp/webp/jpg-0.webp",
|
||||
layoutConfig: layoutConfig().just(),
|
||||
width: 200,
|
||||
height: 200,
|
||||
loadCallback: (ret) => {
|
||||
if (ret) {
|
||||
imageView.width = ret.width;
|
||||
imageView.height = ret.height;
|
||||
}
|
||||
},
|
||||
})),
|
||||
label("ScaleToFill"),
|
||||
image({
|
||||
imageUrl,
|
||||
width: 300,
|
||||
height: 300,
|
||||
isBlur: true,
|
||||
border: {
|
||||
width: 2,
|
||||
color: Color.GRAY,
|
||||
},
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
loadCallback: (ret) => {},
|
||||
}),
|
||||
label("ScaleAspectFit"),
|
||||
image({
|
||||
imageUrl,
|
||||
width: 300,
|
||||
height: 300,
|
||||
border: {
|
||||
width: 2,
|
||||
color: Color.GRAY,
|
||||
},
|
||||
scaleType: ScaleType.ScaleAspectFit,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
label("ScaleAspectFill"),
|
||||
image({
|
||||
imageUrl,
|
||||
width: 300,
|
||||
height: 300,
|
||||
border: {
|
||||
width: 2,
|
||||
color: Color.GRAY,
|
||||
},
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
label("ImageBase64"),
|
||||
image({
|
||||
imageBase64: img_base64[0],
|
||||
width: 300,
|
||||
height: 300,
|
||||
border: {
|
||||
width: 2,
|
||||
color: Color.GRAY,
|
||||
},
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
label("StretchInset 1"),
|
||||
image({
|
||||
imageBase64: img_base64[1],
|
||||
height: 60,
|
||||
width: 134,
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
image({
|
||||
imageBase64: img_base64[1],
|
||||
height: 60,
|
||||
width: 294,
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
stretchInset: {
|
||||
left: 0.85,
|
||||
top: 0,
|
||||
right: 0.149,
|
||||
bottom: 0,
|
||||
},
|
||||
}),
|
||||
}),
|
||||
image({
|
||||
image: new AssetsResource("The_Parthenon_in_Athens.jpeg"),
|
||||
}),
|
||||
image({
|
||||
image: new RemoteResource(
|
||||
"https://p.upyun.com/demo/webp/webp/jpg-0.webp"
|
||||
),
|
||||
}),
|
||||
image({
|
||||
image: new Base64Resource(img_base64[0]),
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.FIT,
|
||||
heightSpec: LayoutSpec.FIT,
|
||||
},
|
||||
}),
|
||||
image({
|
||||
imageBase64: button,
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.JUST,
|
||||
heightSpec: LayoutSpec.JUST,
|
||||
},
|
||||
width: 200,
|
||||
height: 150 / 2.75,
|
||||
stretchInset: {
|
||||
left: 100,
|
||||
top: 0,
|
||||
right: 100,
|
||||
bottom: 0,
|
||||
},
|
||||
imageScale: 2.75,
|
||||
}),
|
||||
image({
|
||||
imageBase64: button,
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.JUST,
|
||||
heightSpec: LayoutSpec.JUST,
|
||||
},
|
||||
width: 200,
|
||||
height: 75,
|
||||
stretchInset: {
|
||||
left: 100,
|
||||
top: 0,
|
||||
right: 100,
|
||||
bottom: 0,
|
||||
},
|
||||
imageScale: 2,
|
||||
}),
|
||||
label("Gif "),
|
||||
image({
|
||||
imageUrl:
|
||||
"https://www.w3.org/People/mimasa/test/imgformat/img/w3c_home_animation.gif",
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
imageScale: 3,
|
||||
}),
|
||||
label("APNG"),
|
||||
image({
|
||||
imageUrl:
|
||||
"https://upload.wikimedia.org/wikipedia/commons/1/14/Animated_PNG_example_bouncing_beach_ball.png",
|
||||
}),
|
||||
label("Animated WebP"),
|
||||
image({
|
||||
imageUrl:
|
||||
"https://p.upyun.com/demo/webp/webp/animated-gif-0.webp",
|
||||
}),
|
||||
label("WebP"),
|
||||
(imageView = image({
|
||||
imageUrl: "https://p.upyun.com/demo/webp/webp/jpg-0.webp",
|
||||
layoutConfig: layoutConfig().just(),
|
||||
width: 200,
|
||||
height: 200,
|
||||
loadCallback: (ret) => {
|
||||
if (ret) {
|
||||
imageView.width = ret.width;
|
||||
imageView.height = ret.height;
|
||||
}
|
||||
},
|
||||
})),
|
||||
label("ScaleToFill"),
|
||||
image({
|
||||
imageUrl,
|
||||
width: 300,
|
||||
height: 300,
|
||||
isBlur: true,
|
||||
border: {
|
||||
width: 2,
|
||||
color: Color.GRAY,
|
||||
},
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
loadCallback: (ret) => { },
|
||||
}),
|
||||
label("ScaleAspectFit"),
|
||||
image({
|
||||
imageUrl,
|
||||
width: 300,
|
||||
height: 300,
|
||||
border: {
|
||||
width: 2,
|
||||
color: Color.GRAY,
|
||||
},
|
||||
scaleType: ScaleType.ScaleAspectFit,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
label("ScaleAspectFill"),
|
||||
image({
|
||||
imageUrl,
|
||||
width: 300,
|
||||
height: 300,
|
||||
border: {
|
||||
width: 2,
|
||||
color: Color.GRAY,
|
||||
},
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
label("ImageBase64"),
|
||||
image({
|
||||
imageBase64: img_base64[0],
|
||||
width: 300,
|
||||
height: 300,
|
||||
border: {
|
||||
width: 2,
|
||||
color: Color.GRAY,
|
||||
},
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
label("StretchInset 1"),
|
||||
image({
|
||||
imageBase64: img_base64[1],
|
||||
height: 60,
|
||||
width: 134,
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
image({
|
||||
imageBase64: img_base64[1],
|
||||
height: 60,
|
||||
width: 294,
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
stretchInset: {
|
||||
left: 0.85,
|
||||
top: 0,
|
||||
right: 0.149,
|
||||
bottom: 0,
|
||||
},
|
||||
}),
|
||||
|
||||
label("StretchInset 2"),
|
||||
image({
|
||||
image: new AssetsResource("coupon_bg2.png"),
|
||||
height: 48,
|
||||
width: 78,
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
image({
|
||||
image: new AssetsResource("coupon_bg2.png"),
|
||||
height: 48,
|
||||
width: 78 * 3,
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
imageScale: 1,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
stretchInset: {
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: 76,
|
||||
bottom: 0,
|
||||
},
|
||||
}),
|
||||
label("StretchInset 2"),
|
||||
image({
|
||||
image: new AssetsResource("coupon_bg2.png"),
|
||||
height: 48,
|
||||
width: 78,
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
image({
|
||||
image: new AssetsResource("coupon_bg2.png"),
|
||||
height: 48,
|
||||
width: 78 * 3,
|
||||
scaleType: ScaleType.ScaleToFill,
|
||||
imageScale: 1,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
stretchInset: {
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: 76,
|
||||
bottom: 0,
|
||||
},
|
||||
}),
|
||||
|
||||
label("tileInset 1"),
|
||||
image({
|
||||
image: new AssetsResource("dididi.png"),
|
||||
height: 78,
|
||||
width: 84,
|
||||
backgroundColor: Color.BLACK,
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
image({
|
||||
image: new AssetsResource("dididi.png"),
|
||||
height: 78,
|
||||
width: 84 * 3,
|
||||
imageScale: 1,
|
||||
backgroundColor: Color.BLACK,
|
||||
scaleType: ScaleType.Tile,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
label("tileInset 1"),
|
||||
image({
|
||||
image: new AssetsResource("dididi.png"),
|
||||
height: 78,
|
||||
width: 84,
|
||||
backgroundColor: Color.BLACK,
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
image({
|
||||
image: new AssetsResource("dididi.png"),
|
||||
height: 78,
|
||||
width: 84 * 3,
|
||||
imageScale: 1,
|
||||
backgroundColor: Color.BLACK,
|
||||
scaleType: ScaleType.Tile,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
|
||||
label("tileInset 2"),
|
||||
image({
|
||||
image: new AssetsResource("123.png"),
|
||||
height: 288 / 2,
|
||||
width: 154 / 2,
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
image({
|
||||
image: new AssetsResource("123.png"),
|
||||
height: 288,
|
||||
width: 154,
|
||||
imageScale: 2,
|
||||
scaleType: ScaleType.Tile,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
],
|
||||
{
|
||||
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
|
||||
gravity: gravity().center(),
|
||||
space: 10,
|
||||
}
|
||||
),
|
||||
{
|
||||
layoutConfig: layoutConfig().most(),
|
||||
}
|
||||
)
|
||||
.also((it) => {
|
||||
coordinator(context).verticalScrolling({
|
||||
scrollable: it,
|
||||
scrollRange: {
|
||||
start: 0,
|
||||
end: 100,
|
||||
},
|
||||
target: "NavBar",
|
||||
changing: {
|
||||
name: "backgroundColor",
|
||||
start: Color.WHITE,
|
||||
end: Color.RED,
|
||||
},
|
||||
});
|
||||
coordinator(context).verticalScrolling({
|
||||
scrollable: it,
|
||||
scrollRange: {
|
||||
start: 0,
|
||||
end: 100,
|
||||
},
|
||||
target: imageView,
|
||||
changing: {
|
||||
name: "width",
|
||||
start: 10,
|
||||
end: 200,
|
||||
},
|
||||
});
|
||||
})
|
||||
.in(rootView);
|
||||
}
|
||||
onDestroy() {
|
||||
modal(context).toast('onDestroy')
|
||||
}
|
||||
label("tileInset 2"),
|
||||
image({
|
||||
image: new AssetsResource("123.png"),
|
||||
height: 288 / 2,
|
||||
width: 154 / 2,
|
||||
scaleType: ScaleType.ScaleAspectFill,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
image({
|
||||
image: new AssetsResource("123.png"),
|
||||
height: 288,
|
||||
width: 154,
|
||||
imageScale: 2,
|
||||
scaleType: ScaleType.Tile,
|
||||
layoutConfig: layoutConfig().just(),
|
||||
}),
|
||||
],
|
||||
{
|
||||
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
|
||||
gravity: gravity().center(),
|
||||
space: 10,
|
||||
}
|
||||
),
|
||||
{
|
||||
layoutConfig: layoutConfig().most(),
|
||||
}
|
||||
)
|
||||
.also((it) => {
|
||||
coordinator(context).verticalScrolling({
|
||||
scrollable: it,
|
||||
scrollRange: {
|
||||
start: 0,
|
||||
end: 100,
|
||||
},
|
||||
target: "NavBar",
|
||||
changing: {
|
||||
name: "backgroundColor",
|
||||
start: Color.WHITE,
|
||||
end: Color.RED,
|
||||
},
|
||||
});
|
||||
coordinator(context).verticalScrolling({
|
||||
scrollable: it,
|
||||
scrollRange: {
|
||||
start: 0,
|
||||
end: 100,
|
||||
},
|
||||
target: imageView,
|
||||
changing: {
|
||||
name: "width",
|
||||
start: 10,
|
||||
end: 200,
|
||||
},
|
||||
});
|
||||
})
|
||||
.in(rootView);
|
||||
}
|
||||
onDestroy() {
|
||||
modal(context).toast('onDestroy')
|
||||
}
|
||||
}
|
@ -68,7 +68,7 @@ var Mutable = /** @class */ (function () {
|
||||
*/
|
||||
var __uniqueId__ = 0;
|
||||
function uniqueId(prefix) {
|
||||
return "__" + prefix + "_" + __uniqueId__++ + "__";
|
||||
return "__".concat(prefix, "_").concat(__uniqueId__++, "__");
|
||||
}
|
||||
|
||||
function toString(message) {
|
||||
@ -92,11 +92,6 @@ function toString(message) {
|
||||
}
|
||||
function log() {
|
||||
var arguments$1 = arguments;
|
||||
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments$1[_i];
|
||||
}
|
||||
var out = "";
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
if (i > 0) {
|
||||
@ -108,11 +103,6 @@ function log() {
|
||||
}
|
||||
function loge() {
|
||||
var arguments$1 = arguments;
|
||||
|
||||
var message = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
message[_i] = arguments$1[_i];
|
||||
}
|
||||
var out = "";
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
if (i > 0) {
|
||||
@ -124,11 +114,6 @@ function loge() {
|
||||
}
|
||||
function logw() {
|
||||
var arguments$1 = arguments;
|
||||
|
||||
var message = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
message[_i] = arguments$1[_i];
|
||||
}
|
||||
var out = "";
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
if (i > 0) {
|
||||
@ -177,11 +162,11 @@ var __values$5 = (undefined && undefined.__values) || function(o) {
|
||||
function Property(target, propKey) {
|
||||
Object.defineProperty(target, propKey, {
|
||||
get: function () {
|
||||
return Reflect.get(this, "__prop__" + propKey, this);
|
||||
return Reflect.get(this, "__prop__".concat(propKey), this);
|
||||
},
|
||||
set: function (v) {
|
||||
var oldV = Reflect.get(this, "__prop__" + propKey, this);
|
||||
Reflect.set(this, "__prop__" + propKey, v, this);
|
||||
var oldV = Reflect.get(this, "__prop__".concat(propKey), this);
|
||||
Reflect.set(this, "__prop__".concat(propKey), v, this);
|
||||
if (oldV !== v) {
|
||||
Reflect.apply(this.onPropertyChanged, this, [propKey, oldV, v]);
|
||||
}
|
||||
@ -191,11 +176,11 @@ function Property(target, propKey) {
|
||||
function InconsistProperty(target, propKey) {
|
||||
Object.defineProperty(target, propKey, {
|
||||
get: function () {
|
||||
return Reflect.get(this, "__prop__" + propKey, this);
|
||||
return Reflect.get(this, "__prop__".concat(propKey), this);
|
||||
},
|
||||
set: function (v) {
|
||||
var oldV = Reflect.get(this, "__prop__" + propKey, this);
|
||||
Reflect.set(this, "__prop__" + propKey, v, this);
|
||||
var oldV = Reflect.get(this, "__prop__".concat(propKey), this);
|
||||
Reflect.set(this, "__prop__".concat(propKey), v, this);
|
||||
Reflect.apply(this.onPropertyChanged, this, [propKey, oldV, v]);
|
||||
},
|
||||
});
|
||||
@ -359,11 +344,6 @@ var View = /** @class */ (function () {
|
||||
};
|
||||
View.prototype.responseCallback = function (id) {
|
||||
var arguments$1 = arguments;
|
||||
|
||||
var args = [];
|
||||
for (var _i = 1; _i < arguments.length; _i++) {
|
||||
args[_i - 1] = arguments$1[_i];
|
||||
}
|
||||
var f = this.id2Callback(id);
|
||||
if (f instanceof Function) {
|
||||
var argumentsList = [];
|
||||
@ -373,7 +353,7 @@ var View = /** @class */ (function () {
|
||||
return Reflect.apply(f, this, argumentsList);
|
||||
}
|
||||
else {
|
||||
loge("Cannot find callback:" + id + " for " + JSON.stringify(this.toModel()));
|
||||
loge("Cannot find callback:".concat(id, " for ").concat(JSON.stringify(this.toModel())));
|
||||
}
|
||||
};
|
||||
View.prototype.toModel = function () {
|
||||
@ -717,7 +697,7 @@ var Group = /** @class */ (function (_super) {
|
||||
this.addChild(e);
|
||||
}
|
||||
else if (!!e) {
|
||||
loge("Not allowed to add " + typeof e);
|
||||
loge("Not allowed to add ".concat(typeof e));
|
||||
}
|
||||
};
|
||||
Object.defineProperty(Group.prototype, "innerElement", {
|
||||
@ -1232,7 +1212,7 @@ var Panel = /** @class */ (function () {
|
||||
|
||||
var v = this.retrospectView(viewIds);
|
||||
if (v === undefined) {
|
||||
loge("Cannot find view for " + viewIds);
|
||||
loge("Cannot find view for ".concat(viewIds));
|
||||
}
|
||||
else {
|
||||
var argumentsList = [callbackId];
|
||||
@ -1434,7 +1414,7 @@ var Color = /** @class */ (function () {
|
||||
}
|
||||
Color.parse = function (str) {
|
||||
if (!str.startsWith("#")) {
|
||||
throw new Error("Parse color error with " + str);
|
||||
throw new Error("Parse color error with ".concat(str));
|
||||
}
|
||||
var val = parseInt(str.substr(1), 16);
|
||||
if (str.length === 7) {
|
||||
@ -1444,7 +1424,7 @@ var Color = /** @class */ (function () {
|
||||
return new Color(val);
|
||||
}
|
||||
else {
|
||||
throw new Error("Parse color error with " + str);
|
||||
throw new Error("Parse color error with ".concat(str));
|
||||
}
|
||||
};
|
||||
Color.safeParse = function (str, defVal) {
|
||||
@ -2247,7 +2227,7 @@ var MainBundleResource = /** @class */ (function (_super) {
|
||||
var BundleResource = /** @class */ (function (_super) {
|
||||
__extends$f(BundleResource, _super);
|
||||
function BundleResource(bundleName, fileName) {
|
||||
return _super.call(this, "bundle", bundleName + "://" + fileName) || this;
|
||||
return _super.call(this, "bundle", "".concat(bundleName, "://").concat(fileName)) || this;
|
||||
}
|
||||
return BundleResource;
|
||||
}(iOSResource));
|
||||
@ -2530,7 +2510,7 @@ var List = /** @class */ (function (_super) {
|
||||
List.prototype.getItem = function (itemIdx) {
|
||||
var view = this.renderItem(itemIdx);
|
||||
view.superview = this;
|
||||
this.cachedViews.set("" + itemIdx, view);
|
||||
this.cachedViews.set("".concat(itemIdx), view);
|
||||
return view;
|
||||
};
|
||||
List.prototype.renderBunchedItems = function (start, length) {
|
||||
@ -2680,7 +2660,7 @@ var Slider = /** @class */ (function (_super) {
|
||||
Slider.prototype.getItem = function (itemIdx) {
|
||||
var view = this.renderPage(itemIdx);
|
||||
view.superview = this;
|
||||
this.cachedViews.set("" + itemIdx, view);
|
||||
this.cachedViews.set("".concat(itemIdx), view);
|
||||
return view;
|
||||
};
|
||||
Slider.prototype.renderBunchedItems = function (start, length) {
|
||||
@ -3050,7 +3030,7 @@ exports.jsx = void 0;
|
||||
Reflect.set(e, "innerElement", children, e);
|
||||
}
|
||||
else {
|
||||
throw new Error("Do not support " + constructor.name + " for " + children);
|
||||
throw new Error("Do not support ".concat(constructor.name, " for ").concat(children));
|
||||
}
|
||||
}
|
||||
return e;
|
||||
@ -3184,7 +3164,7 @@ var FlowLayout = /** @class */ (function (_super) {
|
||||
FlowLayout.prototype.getItem = function (itemIdx) {
|
||||
var view = this.renderItem(itemIdx);
|
||||
view.superview = this;
|
||||
this.cachedViews.set("" + itemIdx, view);
|
||||
this.cachedViews.set("".concat(itemIdx), view);
|
||||
return view;
|
||||
};
|
||||
FlowLayout.prototype.renderBunchedItems = function (start, length) {
|
||||
@ -3865,7 +3845,7 @@ function navbar(context) {
|
||||
}
|
||||
|
||||
function internalScheme(context, panelClass) {
|
||||
return "_internal_://export?class=" + encodeURIComponent(panelClass.name) + "&context=" + context.id;
|
||||
return "_internal_://export?class=".concat(encodeURIComponent(panelClass.name), "&context=").concat(context.id);
|
||||
}
|
||||
function navigator(context) {
|
||||
var moduleName = "navigator";
|
||||
@ -3905,9 +3885,9 @@ function transformRequest(request) {
|
||||
if (request.params !== undefined) {
|
||||
var queryStrings = [];
|
||||
for (var key in request.params) {
|
||||
queryStrings.push(key + "=" + encodeURIComponent(request.params[key]));
|
||||
queryStrings.push("".concat(key, "=").concat(encodeURIComponent(request.params[key])));
|
||||
}
|
||||
request.url = "" + request.url + (url.indexOf('?') >= 0 ? '&' : '?') + queryStrings.join('&');
|
||||
request.url = "".concat(request.url).concat(url.indexOf('?') >= 0 ? '&' : '?').concat(queryStrings.join('&'));
|
||||
}
|
||||
if (typeof request.data === 'object') {
|
||||
request.data = JSON.stringify(request.data);
|
||||
@ -4183,7 +4163,7 @@ function animate(context) {
|
||||
}
|
||||
else {
|
||||
return function (args) {
|
||||
return Promise.reject("Cannot find panel in Context:" + context.id);
|
||||
return Promise.reject("Cannot find panel in Context:".concat(context.id));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
18
doric-js/generateDts.js
Normal file
18
doric-js/generateDts.js
Normal file
@ -0,0 +1,18 @@
|
||||
const fs = require("fs");
|
||||
|
||||
async function work() {
|
||||
const imageDts = await fs.promises.readFile("src/image.d.ts", "utf-8");
|
||||
const indexDts = await fs.promises.readFile("index.d.ts", "utf-8");
|
||||
const content = `declare module "doric" {
|
||||
${indexDts
|
||||
.replace(/\sdeclare\s/g, " ")
|
||||
.split("\n")
|
||||
.map((e) => ` ${e}`)
|
||||
.join("\n")}
|
||||
}
|
||||
${imageDts}
|
||||
`;
|
||||
await fs.promises.writeFile("index.d.ts", content);
|
||||
}
|
||||
|
||||
work();
|
3684
doric-js/index.d.ts
vendored
3684
doric-js/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -13,6 +13,34 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
declare global {
|
||||
namespace Reflect {
|
||||
function decorate(decorators: ClassDecorator[], target: Function): Function;
|
||||
function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: Object, propertyKey: string | symbol, attributes?: PropertyDescriptor): PropertyDescriptor;
|
||||
function metadata(metadataKey: any, metadataValue: any): {
|
||||
(target: Function): void;
|
||||
(target: Object, propertyKey: string | symbol): void;
|
||||
};
|
||||
function defineMetadata(metadataKey: any, metadataValue: any, target: Object): void;
|
||||
function defineMetadata(metadataKey: any, metadataValue: any, target: Object, propertyKey: string | symbol): void;
|
||||
function hasMetadata(metadataKey: any, target: Object): boolean;
|
||||
function hasMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
|
||||
function hasOwnMetadata(metadataKey: any, target: Object): boolean;
|
||||
function hasOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
|
||||
function getMetadata(metadataKey: any, target: Object): any;
|
||||
function getMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any;
|
||||
function getOwnMetadata(metadataKey: any, target: Object): any;
|
||||
function getOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any;
|
||||
function getMetadataKeys(target: Object): any[];
|
||||
function getMetadataKeys(target: Object, propertyKey: string | symbol): any[];
|
||||
function getOwnMetadataKeys(target: Object): any[];
|
||||
function getOwnMetadataKeys(target: Object, propertyKey: string | symbol): any[];
|
||||
function deleteMetadata(metadataKey: any, target: Object): boolean;
|
||||
function deleteMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export * from './src/runtime/global'
|
||||
export * from './src/ui/index.ui'
|
||||
export * from "./src/widget/index.widget"
|
||||
|
26
doric-js/lib/index.d.ts
vendored
26
doric-js/lib/index.d.ts
vendored
@ -1,3 +1,29 @@
|
||||
declare global {
|
||||
namespace Reflect {
|
||||
function decorate(decorators: ClassDecorator[], target: Function): Function;
|
||||
function decorate(decorators: (PropertyDecorator | MethodDecorator)[], target: Object, propertyKey: string | symbol, attributes?: PropertyDescriptor): PropertyDescriptor;
|
||||
function metadata(metadataKey: any, metadataValue: any): {
|
||||
(target: Function): void;
|
||||
(target: Object, propertyKey: string | symbol): void;
|
||||
};
|
||||
function defineMetadata(metadataKey: any, metadataValue: any, target: Object): void;
|
||||
function defineMetadata(metadataKey: any, metadataValue: any, target: Object, propertyKey: string | symbol): void;
|
||||
function hasMetadata(metadataKey: any, target: Object): boolean;
|
||||
function hasMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
|
||||
function hasOwnMetadata(metadataKey: any, target: Object): boolean;
|
||||
function hasOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
|
||||
function getMetadata(metadataKey: any, target: Object): any;
|
||||
function getMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any;
|
||||
function getOwnMetadata(metadataKey: any, target: Object): any;
|
||||
function getOwnMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): any;
|
||||
function getMetadataKeys(target: Object): any[];
|
||||
function getMetadataKeys(target: Object, propertyKey: string | symbol): any[];
|
||||
function getOwnMetadataKeys(target: Object): any[];
|
||||
function getOwnMetadataKeys(target: Object, propertyKey: string | symbol): any[];
|
||||
function deleteMetadata(metadataKey: any, target: Object): boolean;
|
||||
function deleteMetadata(metadataKey: any, target: Object, propertyKey: string | symbol): boolean;
|
||||
}
|
||||
}
|
||||
export * from './src/runtime/global';
|
||||
export * from './src/ui/index.ui';
|
||||
export * from "./src/widget/index.widget";
|
||||
|
10
doric-js/lib/src/native/navigator.d.ts
vendored
10
doric-js/lib/src/native/navigator.d.ts
vendored
@ -4,11 +4,11 @@ import { ClassType } from "../util/types";
|
||||
export declare function internalScheme(context: BridgeContext, panelClass: ClassType<Panel>): string;
|
||||
export declare function navigator(context: BridgeContext): {
|
||||
push: (source: string | ClassType<Panel>, config?: {
|
||||
alias?: string | undefined;
|
||||
animated?: boolean | undefined;
|
||||
extra?: object | undefined;
|
||||
singlePage?: boolean | undefined;
|
||||
} | undefined) => Promise<any>;
|
||||
alias?: string;
|
||||
animated?: boolean;
|
||||
extra?: object;
|
||||
singlePage?: boolean;
|
||||
}) => Promise<any>;
|
||||
pop: (animated?: boolean) => Promise<any>;
|
||||
popSelf: (animated?: boolean) => Promise<any>;
|
||||
popToRoot: (animated?: boolean) => Promise<any>;
|
||||
|
8
doric-js/lib/src/native/network.d.ts
vendored
8
doric-js/lib/src/native/network.d.ts
vendored
@ -20,8 +20,8 @@ export interface IResponse {
|
||||
}
|
||||
export declare function network(context: BridgeContext): {
|
||||
request: (config: IRequest) => Promise<IResponse>;
|
||||
get: (url: string, config?: IRequest | undefined) => Promise<IResponse>;
|
||||
post: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise<IResponse>;
|
||||
put: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise<IResponse>;
|
||||
delete: (url: string, data?: string | object | undefined, config?: IRequest | undefined) => Promise<IResponse>;
|
||||
get: (url: string, config?: IRequest) => Promise<IResponse>;
|
||||
post: (url: string, data?: object | string, config?: IRequest) => Promise<IResponse>;
|
||||
put: (url: string, data?: object | string, config?: IRequest) => Promise<IResponse>;
|
||||
delete: (url: string, data?: object | string, config?: IRequest) => Promise<IResponse>;
|
||||
};
|
||||
|
6
doric-js/lib/src/native/storage.d.ts
vendored
6
doric-js/lib/src/native/storage.d.ts
vendored
@ -1,7 +1,7 @@
|
||||
import { BridgeContext } from "../runtime/global";
|
||||
export declare function storage(context: BridgeContext): {
|
||||
setItem: (key: string, value: string, zone?: string | undefined) => Promise<any>;
|
||||
getItem: (key: string, zone?: string | undefined) => Promise<string>;
|
||||
remove: (key: string, zone?: string | undefined) => Promise<any>;
|
||||
setItem: (key: string, value: string, zone?: string) => Promise<any>;
|
||||
getItem: (key: string, zone?: string) => Promise<string>;
|
||||
remove: (key: string, zone?: string) => Promise<any>;
|
||||
clear: (zone: string) => Promise<any>;
|
||||
};
|
||||
|
@ -6,8 +6,8 @@
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"build": "cp -rf index.web.html bundle/doric-web.html && tsc -p tsconfig.es5.json && mv -f lib-es5/src/ui/view.es5.js lib-es5/src/ui/view.js && tsc -d -p . && rollup -c && dts-bundle --configJson dts-bundle.json && cat src/image.d.ts >> index.d.ts",
|
||||
"build-win32": "cp -rf index.web.html bundle/doric-web.html && tsc -p tsconfig.es5.json && tsc -d -p . && rollup -c && dts-bundle --configJson dts-bundle.json",
|
||||
"build": "cp -rf index.web.html bundle/doric-web.html && tsc -p tsconfig.es5.json && mv -f lib-es5/src/ui/view.es5.js lib-es5/src/ui/view.js && tsc -d -p . && rollup -c && dts-bundle-generator -o index.d.ts index.ts --project tsconfig.json --inline-declare-global && node generateDts.js",
|
||||
"build-win32": "cp -rf index.web.html bundle/doric-web.html && tsc -p tsconfig.es5.json && tsc -d -p . && rollup -c && dts-bundle-generator -o index.d.ts index.ts --project tsconfig.json --inline-declare-global && node generateDts.js",
|
||||
"dev": "tsc -w -p . & rollup -c -w",
|
||||
"clean": "rm -rf lib && rm -rf lib-es5 && rm -rf bundle",
|
||||
"prepublish": "npm run build"
|
||||
@ -36,7 +36,7 @@
|
||||
"@types/core-js": "^2.5.5",
|
||||
"@types/ws": "^7.2.6",
|
||||
"core-js": "^3.9.1",
|
||||
"dts-bundle": "^0.7.3",
|
||||
"dts-bundle-generator": "^6.12.0",
|
||||
"proxy-polyfill": "^0.3.2",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rollup": "^2.40.0"
|
||||
|
Reference in New Issue
Block a user