feat: add apply function on Ref
This commit is contained in:
parent
1c1ca76782
commit
5aa20dbd6a
@ -221,6 +221,11 @@ var Ref = /** @class */ (function () {
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Ref.prototype.apply = function (config) {
|
||||
if (this.view) {
|
||||
this.view.apply(config);
|
||||
}
|
||||
};
|
||||
return Ref;
|
||||
}());
|
||||
function createRef() {
|
||||
@ -4044,6 +4049,7 @@ function animate(context) {
|
||||
var v = _f.value;
|
||||
if (v.isDirty()) {
|
||||
var model_1 = v.toModel();
|
||||
model_1.duration = args.duration;
|
||||
var ret_1 = context.callNative('animate', 'animateRender', model_1);
|
||||
v.clean();
|
||||
return ret_1;
|
||||
|
@ -151,6 +151,11 @@ class Ref {
|
||||
}
|
||||
return this.view;
|
||||
}
|
||||
apply(config) {
|
||||
if (this.view) {
|
||||
this.view.apply(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createRef() {
|
||||
return new Ref;
|
||||
@ -3093,6 +3098,7 @@ function animate(context) {
|
||||
for (let v of map.values()) {
|
||||
if (v.isDirty()) {
|
||||
const model_1 = v.toModel();
|
||||
model_1.duration = args.duration;
|
||||
const ret_1 = context.callNative('animate', 'animateRender', model_1);
|
||||
v.clean();
|
||||
return ret_1;
|
||||
|
@ -1679,6 +1679,11 @@ class Ref {
|
||||
}
|
||||
return this.view;
|
||||
}
|
||||
apply(config) {
|
||||
if (this.view) {
|
||||
this.view.apply(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createRef() {
|
||||
return new Ref;
|
||||
@ -4621,6 +4626,7 @@ function animate(context) {
|
||||
for (let v of map.values()) {
|
||||
if (v.isDirty()) {
|
||||
const model_1 = v.toModel();
|
||||
model_1.duration = args.duration;
|
||||
const ret_1 = context.callNative('animate', 'animateRender', model_1);
|
||||
v.clean();
|
||||
return ret_1;
|
||||
|
3
doric-js/index.d.ts
vendored
3
doric-js/index.d.ts
vendored
@ -199,9 +199,11 @@ declare module 'doric/lib/src/ui/view' {
|
||||
[index: string]: Model;
|
||||
};
|
||||
};
|
||||
type RefType<T> = T extends Ref<infer R> ? R : never;
|
||||
export class Ref<T extends View> {
|
||||
set current(v: T);
|
||||
get current(): T;
|
||||
apply(config: Partial<RefType<this>>): void;
|
||||
}
|
||||
export function createRef<T extends View>(): Ref<T>;
|
||||
export abstract class View implements Modeling {
|
||||
@ -341,6 +343,7 @@ declare module 'doric/lib/src/ui/view' {
|
||||
removeAllChildren(): void;
|
||||
set innerElement(e: View | ViewFragment | ViewFragment[] | undefined | null);
|
||||
}
|
||||
export {};
|
||||
}
|
||||
|
||||
declare module 'doric/lib/src/ui/animation' {
|
||||
|
@ -47,6 +47,7 @@ export function animate(context) {
|
||||
for (let v of map.values()) {
|
||||
if (v.isDirty()) {
|
||||
const model_1 = v.toModel();
|
||||
model_1.duration = args.duration;
|
||||
const ret_1 = context.callNative('animate', 'animateRender', model_1);
|
||||
v.clean();
|
||||
return ret_1;
|
||||
|
3
doric-js/lib/src/ui/view.d.ts
vendored
3
doric-js/lib/src/ui/view.d.ts
vendored
@ -14,10 +14,12 @@ export declare type NativeViewModel = {
|
||||
[index: string]: Model;
|
||||
};
|
||||
};
|
||||
declare type RefType<T> = T extends Ref<infer R> ? R : never;
|
||||
export declare class Ref<T extends View> {
|
||||
private view?;
|
||||
set current(v: T);
|
||||
get current(): T;
|
||||
apply(config: Partial<RefType<this>>): void;
|
||||
}
|
||||
export declare function createRef<T extends View>(): Ref<T>;
|
||||
export declare abstract class View implements Modeling {
|
||||
@ -164,3 +166,4 @@ export declare abstract class Group extends Superview implements JSX.ElementChil
|
||||
private addInnerElement;
|
||||
set innerElement(e: View | ViewFragment | ViewFragment[] | undefined | null);
|
||||
}
|
||||
export {};
|
||||
|
@ -33,6 +33,11 @@ export class Ref {
|
||||
}
|
||||
return this.view;
|
||||
}
|
||||
apply(config) {
|
||||
if (this.view) {
|
||||
this.view.apply(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
export function createRef() {
|
||||
return new Ref;
|
||||
|
@ -65,6 +65,8 @@ export type NativeViewModel = {
|
||||
};
|
||||
}
|
||||
|
||||
type RefType<T> = T extends Ref<infer R> ? R : never;
|
||||
|
||||
export class Ref<T extends View> {
|
||||
private view?: T;
|
||||
|
||||
@ -78,6 +80,12 @@ export class Ref<T extends View> {
|
||||
}
|
||||
return this.view
|
||||
}
|
||||
|
||||
apply(config: Partial<RefType<this>>) {
|
||||
if (this.view) {
|
||||
this.view.apply(config)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function createRef() {
|
||||
|
@ -47,6 +47,8 @@ export type NativeViewModel = {
|
||||
};
|
||||
}
|
||||
|
||||
type RefType<T> = T extends Ref<infer R> ? R : never;
|
||||
|
||||
export class Ref<T extends View> {
|
||||
private view?: T;
|
||||
|
||||
@ -60,6 +62,12 @@ export class Ref<T extends View> {
|
||||
}
|
||||
return this.view
|
||||
}
|
||||
|
||||
apply(config: Partial<RefType<this>>) {
|
||||
if (this.view) {
|
||||
this.view.apply(config)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function createRef<T extends View>(): Ref<T> {
|
||||
|
6
doric-web/dist/index.js
vendored
6
doric-web/dist/index.js
vendored
@ -1753,6 +1753,11 @@ class Ref {
|
||||
}
|
||||
return this.view;
|
||||
}
|
||||
apply(config) {
|
||||
if (this.view) {
|
||||
this.view.apply(config);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createRef() {
|
||||
return new Ref;
|
||||
@ -4695,6 +4700,7 @@ function animate(context) {
|
||||
for (let v of map.values()) {
|
||||
if (v.isDirty()) {
|
||||
const model_1 = v.toModel();
|
||||
model_1.duration = args.duration;
|
||||
const ret_1 = context.callNative('animate', 'animateRender', model_1);
|
||||
v.clean();
|
||||
return ret_1;
|
||||
|
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