Add Load Internal Class Support
This commit is contained in:
parent
6a09c583fc
commit
a5ca58c38a
@ -32,6 +32,17 @@ class MultiPanelDemo extends Panel {
|
|||||||
navigator(context).push(CounterPage)
|
navigator(context).push(CounterPage)
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
label('Multi Panel').apply({
|
||||||
|
width: 200,
|
||||||
|
height: 50,
|
||||||
|
backgroundColor: colors[0],
|
||||||
|
textSize: 30,
|
||||||
|
textColor: Color.WHITE,
|
||||||
|
layoutConfig: layoutConfig().just(),
|
||||||
|
onClick: () => {
|
||||||
|
navigator(context).push(MultiPanelDemo)
|
||||||
|
}
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
|
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
|
||||||
|
@ -1205,19 +1205,21 @@ var doric = (function (exports) {
|
|||||||
});
|
});
|
||||||
})(Reflect$1 || (Reflect$1 = {}));
|
})(Reflect$1 || (Reflect$1 = {}));
|
||||||
|
|
||||||
var __extends = (undefined && undefined.__extends) || (function () {
|
/*
|
||||||
var extendStatics = function (d, b) {
|
* Copyright [2019] [Doric.Pub]
|
||||||
extendStatics = Object.setPrototypeOf ||
|
*
|
||||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };
|
* you may not use this file except in compliance with the License.
|
||||||
return extendStatics(d, b);
|
* You may obtain a copy of the License at
|
||||||
};
|
*
|
||||||
return function (d, b) {
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
extendStatics(d, b);
|
*
|
||||||
function __() { this.constructor = d; }
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
};
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
})();
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
function hookBeforeNativeCall(context) {
|
function hookBeforeNativeCall(context) {
|
||||||
if (context) {
|
if (context) {
|
||||||
Reflect.defineMetadata('__doric_context__', context, global$1);
|
Reflect.defineMetadata('__doric_context__', context, global$1);
|
||||||
@ -1396,19 +1398,11 @@ var doric = (function (exports) {
|
|||||||
function jsObtainEntry(contextId) {
|
function jsObtainEntry(contextId) {
|
||||||
var context = jsObtainContext(contextId);
|
var context = jsObtainContext(contextId);
|
||||||
var exportFunc = function (constructor) {
|
var exportFunc = function (constructor) {
|
||||||
var _a;
|
context === null || context === void 0 ? void 0 : context.classes.set(constructor.name, constructor);
|
||||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(constructor.name, constructor);
|
var ret = new constructor;
|
||||||
var ret = /** @class */ (function (_super) {
|
Reflect.set(ret, 'context', context);
|
||||||
__extends(class_1, _super);
|
context === null || context === void 0 ? void 0 : context.register(ret);
|
||||||
function class_1() {
|
return constructor;
|
||||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
||||||
_this.context = context;
|
|
||||||
return _this;
|
|
||||||
}
|
|
||||||
return class_1;
|
|
||||||
}(constructor));
|
|
||||||
context === null || context === void 0 ? void 0 : context.register(new ret);
|
|
||||||
return ret;
|
|
||||||
};
|
};
|
||||||
return function () {
|
return function () {
|
||||||
if (arguments.length === 1) {
|
if (arguments.length === 1) {
|
||||||
|
@ -1397,24 +1397,18 @@ var doric = (function (exports) {
|
|||||||
function jsObtainEntry(contextId) {
|
function jsObtainEntry(contextId) {
|
||||||
const context = jsObtainContext(contextId);
|
const context = jsObtainContext(contextId);
|
||||||
const exportFunc = (constructor) => {
|
const exportFunc = (constructor) => {
|
||||||
var _a;
|
context === null || context === void 0 ? void 0 : context.classes.set(constructor.name, constructor);
|
||||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(constructor.name, constructor);
|
const ret = new constructor;
|
||||||
const ret = class extends constructor {
|
Reflect.set(ret, 'context', context);
|
||||||
constructor() {
|
context === null || context === void 0 ? void 0 : context.register(ret);
|
||||||
super(...arguments);
|
return constructor;
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
context === null || context === void 0 ? void 0 : context.register(new ret);
|
|
||||||
return ret;
|
|
||||||
};
|
};
|
||||||
return function () {
|
return function () {
|
||||||
if (arguments.length === 1) {
|
if (arguments.length === 1) {
|
||||||
const args = arguments[0];
|
const args = arguments[0];
|
||||||
if (args instanceof Array) {
|
if (args instanceof Array) {
|
||||||
args.forEach(clz => {
|
args.forEach(clz => {
|
||||||
var _a;
|
context === null || context === void 0 ? void 0 : context.classes.set(clz.name, clz);
|
||||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(clz.name, clz);
|
|
||||||
});
|
});
|
||||||
return exportFunc;
|
return exportFunc;
|
||||||
}
|
}
|
||||||
|
@ -1420,24 +1420,18 @@ function jsCallEntityMethod(contextId, methodName, args) {
|
|||||||
function jsObtainEntry(contextId) {
|
function jsObtainEntry(contextId) {
|
||||||
const context = jsObtainContext(contextId);
|
const context = jsObtainContext(contextId);
|
||||||
const exportFunc = (constructor) => {
|
const exportFunc = (constructor) => {
|
||||||
var _a;
|
context === null || context === void 0 ? void 0 : context.classes.set(constructor.name, constructor);
|
||||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(constructor.name, constructor);
|
const ret = new constructor;
|
||||||
const ret = class extends constructor {
|
Reflect.set(ret, 'context', context);
|
||||||
constructor() {
|
context === null || context === void 0 ? void 0 : context.register(ret);
|
||||||
super(...arguments);
|
return constructor;
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
context === null || context === void 0 ? void 0 : context.register(new ret);
|
|
||||||
return ret;
|
|
||||||
};
|
};
|
||||||
return function () {
|
return function () {
|
||||||
if (arguments.length === 1) {
|
if (arguments.length === 1) {
|
||||||
const args = arguments[0];
|
const args = arguments[0];
|
||||||
if (args instanceof Array) {
|
if (args instanceof Array) {
|
||||||
args.forEach(clz => {
|
args.forEach(clz => {
|
||||||
var _a;
|
context === null || context === void 0 ? void 0 : context.classes.set(clz.name, clz);
|
||||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(clz.name, clz);
|
|
||||||
});
|
});
|
||||||
return exportFunc;
|
return exportFunc;
|
||||||
}
|
}
|
||||||
|
10
doric-js/lib/src/runtime/sandbox.d.ts
vendored
10
doric-js/lib/src/runtime/sandbox.d.ts
vendored
@ -23,14 +23,6 @@ export declare function __require__(name: string): any;
|
|||||||
export declare function jsRegisterModule(name: string, moduleObject: any): void;
|
export declare function jsRegisterModule(name: string, moduleObject: any): void;
|
||||||
export declare function jsCallEntityMethod(contextId: string, methodName: string, args?: any): any;
|
export declare function jsCallEntityMethod(contextId: string, methodName: string, args?: any): any;
|
||||||
declare type ClassType<T> = new (...args: any) => T;
|
declare type ClassType<T> = new (...args: any) => T;
|
||||||
export declare function jsObtainEntry(contextId: string): () => ((constructor: ClassType<object>) => {
|
export declare function jsObtainEntry(contextId: string): () => ClassType<object> | ((constructor: ClassType<object>) => ClassType<object>);
|
||||||
new (...args: any): {
|
|
||||||
context: Context | undefined;
|
|
||||||
};
|
|
||||||
}) | {
|
|
||||||
new (...args: any): {
|
|
||||||
context: Context | undefined;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
export declare function jsCallbackTimer(timerId: number): void;
|
export declare function jsCallbackTimer(timerId: number): void;
|
||||||
export {};
|
export {};
|
||||||
|
@ -215,24 +215,18 @@ export function jsCallEntityMethod(contextId, methodName, args) {
|
|||||||
export function jsObtainEntry(contextId) {
|
export function jsObtainEntry(contextId) {
|
||||||
const context = jsObtainContext(contextId);
|
const context = jsObtainContext(contextId);
|
||||||
const exportFunc = (constructor) => {
|
const exportFunc = (constructor) => {
|
||||||
var _a;
|
context === null || context === void 0 ? void 0 : context.classes.set(constructor.name, constructor);
|
||||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(constructor.name, constructor);
|
const ret = new constructor;
|
||||||
const ret = class extends constructor {
|
Reflect.set(ret, 'context', context);
|
||||||
constructor() {
|
context === null || context === void 0 ? void 0 : context.register(ret);
|
||||||
super(...arguments);
|
return constructor;
|
||||||
this.context = context;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
context === null || context === void 0 ? void 0 : context.register(new ret);
|
|
||||||
return ret;
|
|
||||||
};
|
};
|
||||||
return function () {
|
return function () {
|
||||||
if (arguments.length === 1) {
|
if (arguments.length === 1) {
|
||||||
const args = arguments[0];
|
const args = arguments[0];
|
||||||
if (args instanceof Array) {
|
if (args instanceof Array) {
|
||||||
args.forEach(clz => {
|
args.forEach(clz => {
|
||||||
var _a;
|
context === null || context === void 0 ? void 0 : context.classes.set(clz.name, clz);
|
||||||
(_a = context === null || context === void 0 ? void 0 : context.classes) === null || _a === void 0 ? void 0 : _a.set(clz.name, clz);
|
|
||||||
});
|
});
|
||||||
return exportFunc;
|
return exportFunc;
|
||||||
}
|
}
|
||||||
|
@ -240,12 +240,11 @@ type ClassType<T> = new (...args: any) => T
|
|||||||
export function jsObtainEntry(contextId: string) {
|
export function jsObtainEntry(contextId: string) {
|
||||||
const context = jsObtainContext(contextId)
|
const context = jsObtainContext(contextId)
|
||||||
const exportFunc = (constructor: ClassType<object>) => {
|
const exportFunc = (constructor: ClassType<object>) => {
|
||||||
context?.classes?.set(constructor.name, constructor)
|
context?.classes.set(constructor.name, constructor)
|
||||||
const ret = class extends constructor {
|
const ret = new constructor
|
||||||
context = context
|
Reflect.set(ret, 'context', context)
|
||||||
}
|
context?.register(ret)
|
||||||
context?.register(new ret)
|
return constructor
|
||||||
return ret
|
|
||||||
}
|
}
|
||||||
return function () {
|
return function () {
|
||||||
if (arguments.length === 1) {
|
if (arguments.length === 1) {
|
||||||
|
@ -278,19 +278,18 @@ type ClassType<T> = new (...args: any) => T
|
|||||||
export function jsObtainEntry(contextId: string) {
|
export function jsObtainEntry(contextId: string) {
|
||||||
const context = jsObtainContext(contextId)
|
const context = jsObtainContext(contextId)
|
||||||
const exportFunc = (constructor: ClassType<object>) => {
|
const exportFunc = (constructor: ClassType<object>) => {
|
||||||
context?.classes?.set(constructor.name, constructor)
|
context?.classes.set(constructor.name, constructor)
|
||||||
const ret = class extends constructor {
|
const ret = new constructor
|
||||||
context = context
|
Reflect.set(ret, 'context', context)
|
||||||
}
|
context?.register(ret)
|
||||||
context?.register(new ret)
|
return constructor
|
||||||
return ret
|
|
||||||
}
|
}
|
||||||
return function () {
|
return function () {
|
||||||
if (arguments.length === 1) {
|
if (arguments.length === 1) {
|
||||||
const args = arguments[0]
|
const args = arguments[0]
|
||||||
if (args instanceof Array) {
|
if (args instanceof Array) {
|
||||||
args.forEach(clz => {
|
args.forEach(clz => {
|
||||||
context?.classes?.set(clz.name, clz)
|
context?.classes.set(clz.name, clz)
|
||||||
})
|
})
|
||||||
return exportFunc
|
return exportFunc
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user