update js

This commit is contained in:
pengfei.zhou
2020-01-03 16:35:04 +08:00
committed by osborn
parent 4b3a370f5f
commit 680b95f05d
18 changed files with 124 additions and 141 deletions

View File

@@ -70,6 +70,13 @@ export interface IView {
/**----------transform----------*/
}
export type NativeViewModel = {
id: string;
type: string;
props: {
[index: string]: Model;
};
}
export abstract class View implements Modeling, IView {
@Property
@@ -206,7 +213,7 @@ export abstract class View implements Modeling, IView {
return this.__dirty_props__
}
nativeViewModel = {
nativeViewModel: NativeViewModel = {
id: this.viewId,
type: this.constructor.name,
props: this.__dirty_props__,

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { Stack } from './layouts'
import { Property, IView, Superview, View } from '../ui/view'
import { Property, IView, Superview, View, NativeViewModel } from '../ui/view'
import { layoutConfig } from '../util/index.util'
export class FlowLayoutItem extends Stack {
@@ -105,7 +105,7 @@ export class FlowLayout extends Superview implements IFlowLayout {
})
}
toModel() {
toModel(): NativeViewModel {
if (this.loadMoreView) {
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { View, Property, Superview, IView } from "../ui/view";
import { View, Property, Superview, IView, NativeViewModel } from "../ui/view";
import { Stack } from "./layouts";
import { layoutConfig, LayoutSpec } from "../util/layoutconfig";
@@ -93,7 +93,7 @@ export class List extends Superview implements IList {
})
}
toModel() {
toModel(): NativeViewModel {
if (this.loadMoreView) {
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId
}

View File

@@ -1,4 +1,4 @@
import { View, Property, Superview, IView } from "../ui/view";
import { View, Property, Superview, IView, NativeViewModel } from "../ui/view";
import { List } from "./list";
import { Scroller } from "./scroller";
import { BridgeContext } from "../runtime/global";
@@ -43,7 +43,7 @@ export class Refreshable extends Superview implements IRefreshable {
return this.nativeChannel(context, 'isRefreshing')() as Promise<boolean>
}
toModel() {
toModel(): NativeViewModel {
this.dirtyProps.content = this.content.viewId
this.dirtyProps.header = ((this.header || {}) as any).viewId
return super.toModel()

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Superview, View, IView } from '../ui/view'
import { Superview, View, IView, NativeViewModel } from '../ui/view'
import { layoutConfig } from '../util/layoutconfig'
export function scroller(content: View) {
@@ -34,7 +34,7 @@ export class Scroller extends Superview implements IScroller {
return [this.content]
}
toModel() {
toModel(): NativeViewModel {
this.dirtyProps.content = this.content.viewId
return super.toModel()
}