tsx:add ref and parent support
This commit is contained in:
27
doric-web/dist/index.js
vendored
27
doric-web/dist/index.js
vendored
@@ -1719,6 +1719,20 @@ function ViewComponent(constructor) {
|
||||
const name = Reflect.getMetadata(PROP_KEY_VIEW_TYPE, constructor) || Object.getPrototypeOf(constructor).name;
|
||||
Reflect.defineMetadata(PROP_KEY_VIEW_TYPE, name, constructor);
|
||||
}
|
||||
class Ref {
|
||||
set current(v) {
|
||||
this.view = v;
|
||||
}
|
||||
get current() {
|
||||
if (!!!this.view) {
|
||||
throw new Error("Ref is empty");
|
||||
}
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
function makeRef() {
|
||||
return new Ref;
|
||||
}
|
||||
class View {
|
||||
constructor() {
|
||||
this.width = 0;
|
||||
@@ -1899,6 +1913,12 @@ class View {
|
||||
set props(props) {
|
||||
this.apply(props);
|
||||
}
|
||||
set parent(v) {
|
||||
this.in(v);
|
||||
}
|
||||
set ref(ref) {
|
||||
ref.current = this;
|
||||
}
|
||||
doAnimation(context, animation) {
|
||||
return this.nativeChannel(context, "doAnimation")(animation.toModel()).then((args) => {
|
||||
for (let key in args) {
|
||||
@@ -3621,10 +3641,9 @@ exports.Display = void 0;
|
||||
const jsx = {
|
||||
createElement: function (constructor, config, ...children) {
|
||||
const e = new constructor();
|
||||
e.layoutConfig = layoutConfig().fit();
|
||||
if (config) {
|
||||
for (let key in config) {
|
||||
Reflect.set(e, key, Reflect.get(config, key, config), e);
|
||||
}
|
||||
e.apply(config);
|
||||
}
|
||||
if (children && children.length > 0) {
|
||||
if (e instanceof Group) {
|
||||
@@ -4685,6 +4704,7 @@ exports.Panel = Panel;
|
||||
exports.Property = Property;
|
||||
exports.Provider = Provider;
|
||||
exports.RIGHT = RIGHT;
|
||||
exports.Ref = Ref;
|
||||
exports.Refreshable = Refreshable;
|
||||
exports.Root = Root;
|
||||
exports.RotationAnimation = RotationAnimation;
|
||||
@@ -4726,6 +4746,7 @@ exports.listItem = listItem;
|
||||
exports.log = log;
|
||||
exports.loge = loge;
|
||||
exports.logw = logw;
|
||||
exports.makeRef = makeRef;
|
||||
exports.modal = modal;
|
||||
exports.navbar = navbar;
|
||||
exports.navigator = navigator;
|
||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user