update js defination,use Partical insted of IView

This commit is contained in:
pengfei.zhou
2020-04-16 19:21:24 +08:00
committed by osborn
parent b2241fe343
commit 2598d0f266
57 changed files with 633 additions and 972 deletions

View File

@@ -1,4 +1,4 @@
import { animate, Group, Panel, gravity, Color, AnimationSet, vlayout, scroller, layoutConfig, IVLayout, modal, IText, network, View, stack, IHLayout, hlayout, IView, text, TranslationAnimation, ScaleAnimation, RotationAnimation, FillMode } from "doric";
import { animate, Group, Panel, gravity, Color, vlayout, layoutConfig, modal, stack, hlayout, text, } from "doric";
import { title, colors, box } from "./utils";
function thisLabel(str: string) {
@@ -175,7 +175,7 @@ class AnimatorDemo extends Panel {
});
}
}),
]).apply({ space: 10 } as IHLayout),
]).apply({ space: 10 }),
],
{ space: 10 }
),

View File

@@ -1,4 +1,4 @@
import { animate, Group, Panel, gravity, Color, AnimationSet, vlayout, scroller, layoutConfig, IVLayout, modal, IText, network, View, stack, IHLayout, hlayout, IView, text, TranslationAnimation, ScaleAnimation, RotationAnimation, FillMode, TimingFunction } from "doric";
import { Group, Panel, gravity, Color, AnimationSet, vlayout, layoutConfig, modal, stack, hlayout, text, TranslationAnimation, ScaleAnimation, RotationAnimation, TimingFunction } from "doric";
import { title, colors, box } from "./utils";
function thisLabel(str: string) {

View File

@@ -1,4 +1,4 @@
import { text, vlayout, ViewHolder, VMPanel, ViewModel, Gravity, NativeCall, Text, Color, log, logw, loge, Group, LayoutSpec, layoutConfig, IVLayout, } from "doric"
import { text, vlayout, ViewHolder, VMPanel, ViewModel, Gravity, NativeCall, Text, Color, log, logw, loge, Group, LayoutSpec, layoutConfig, } from "doric"
interface CountModel {
count: number

View File

@@ -1,4 +1,4 @@
import { Panel, Group, vlayout, layoutConfig, draggable, Color, Text, Draggable, modal, Gravity, stack, text } from "doric";
import { Panel, Group, vlayout, layoutConfig, draggable, Color, Text, modal, Gravity, stack, text } from "doric";
import { title } from "./utils";
@Entry
class DraggableDemo extends Panel {

View File

@@ -1,5 +1,5 @@
import { Group, Panel, Text, text, Color, Stack, vlayout, hlayout, scroller, layoutConfig, Gravity, GradientColor, GradientOrientation } from "doric";
import { Group, Panel, Text, text, Color, Stack, vlayout, hlayout, scroller, layoutConfig, Gravity, GradientOrientation } from "doric";
import { colors } from "./utils";
@@ -28,7 +28,7 @@ function label(str: string) {
@Entry
class EffectsDemo extends Panel {
build(rootView: Group) {
scroller(
vlayout(
@@ -431,7 +431,7 @@ class EffectsDemo extends Panel {
box().apply({
width: 100,
height: 100,
backgroundColor: {
backgroundColor: {
start: colors[0],
end: Color.WHITE,
orientation: GradientOrientation.TOP_BOTTOM
@@ -453,7 +453,7 @@ class EffectsDemo extends Panel {
box().apply({
width: 100,
height: 100,
backgroundColor: {
backgroundColor: {
start: colors[0],
end: Color.WHITE,
orientation: GradientOrientation.TR_BL
@@ -475,7 +475,7 @@ class EffectsDemo extends Panel {
box().apply({
width: 100,
height: 100,
backgroundColor: {
backgroundColor: {
start: colors[0],
end: Color.WHITE,
orientation: GradientOrientation.RIGHT_LEFT
@@ -497,7 +497,7 @@ class EffectsDemo extends Panel {
box().apply({
width: 100,
height: 100,
backgroundColor: {
backgroundColor: {
start: colors[0],
end: Color.WHITE,
orientation: GradientOrientation.BR_TL
@@ -519,7 +519,7 @@ class EffectsDemo extends Panel {
box().apply({
width: 100,
height: 100,
backgroundColor: {
backgroundColor: {
start: colors[0],
end: Color.WHITE,
orientation: GradientOrientation.BOTTOM_TOP
@@ -541,7 +541,7 @@ class EffectsDemo extends Panel {
box().apply({
width: 100,
height: 100,
backgroundColor: {
backgroundColor: {
start: colors[0],
end: Color.WHITE,
orientation: GradientOrientation.BL_TR
@@ -563,7 +563,7 @@ class EffectsDemo extends Panel {
box().apply({
width: 100,
height: 100,
backgroundColor: {
backgroundColor: {
start: colors[0],
end: Color.WHITE,
orientation: GradientOrientation.LEFT_RIGHT
@@ -585,7 +585,7 @@ class EffectsDemo extends Panel {
box().apply({
width: 100,
height: 100,
backgroundColor: {
backgroundColor: {
start: colors[0],
end: Color.WHITE,
orientation: GradientOrientation.TL_BR

View File

@@ -1,6 +1,5 @@
import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, IVLayout, IHLayout, layoutConfig, stack, Gravity, flexlayout, image, ScaleType } from "doric";
import { FlexDirection, Wrap, Justify, Align, FlexTypedValue, OverFlow } from "doric/lib/src/util/flexbox";
import { Group, Panel, Color, LayoutSpec, scroller, layoutConfig, flexlayout, image, ScaleType, Align, FlexDirection, Wrap } from "doric";
import { icon_refresh } from "./utils";
@Entry

View File

@@ -1,4 +1,4 @@
import { Group, Panel, flowlayout, layoutConfig, FlowLayoutItem, text, Color, IFlowLayout, LayoutSpec, Gravity, flowItem } from "doric";
import { Group, Panel, flowlayout, layoutConfig, FlowLayoutItem, text, Color, LayoutSpec, Gravity, flowItem } from "doric";
import { colors, label } from "./utils";
const imageUrls = [

View File

@@ -1,4 +1,4 @@
import { Stack, hlayout, Group, Color, stack, layoutConfig, LayoutSpec, vlayout, IVLayout, Text, ViewHolder, ViewModel, VMPanel, scroller, modal, text, gravity, Gravity, IHLayout, takeNonNull, View, log, popover } from "doric";
import { Stack, hlayout, Group, Color, stack, layoutConfig, LayoutSpec, vlayout, Text, ViewHolder, ViewModel, VMPanel, scroller, modal, text, gravity, Gravity, View, popover } from "doric";
import { colors } from "./utils";
enum State {

View File

@@ -1,4 +1,4 @@
import { Group, Panel, coordinator, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, scroller, layoutConfig, image, IView, IVLayout, ScaleType, Image } from "doric";
import { Group, Panel, coordinator, text, gravity, Color, LayoutSpec, log, vlayout, scroller, layoutConfig, image, ScaleType, Image } from "doric";
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'

View File

@@ -1,4 +1,4 @@
import { Panel, Group, scroller, vlayout, layoutConfig, LayoutSpec, Input, Gravity, log, input } from "doric";
import { Panel, Group, scroller, vlayout, layoutConfig, LayoutSpec, Input, Gravity, log } from "doric";
import { title, colors } from "./utils";
@Entry
class InputDemo extends Panel {

View File

@@ -1,5 +1,5 @@
import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, IVLayout, IHLayout, layoutConfig, stack, Gravity } from "doric";
import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, layoutConfig, stack, Gravity } from "doric";
const colors = [
"#f0932b",

View File

@@ -1,4 +1,4 @@
import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, refreshable, Refreshable, ListItem, layoutConfig } from "doric";
import { Group, Panel, List, text, gravity, Color, LayoutSpec, list, listItem, log, vlayout, Gravity, hlayout, Text, refreshable, Refreshable, ListItem, layoutConfig } from "doric";
import { rotatedArrow, colors } from "./utils";
@Entry
class ListPanel extends Panel {

View File

@@ -1,4 +1,4 @@
import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, scroller, layoutConfig, image, IView, IVLayout, ScaleType, IText, modal } from "doric";
import { Group, Panel, text, Color, LayoutSpec, vlayout, Gravity, scroller, layoutConfig, modal, Text } from "doric";
import { colors, label } from "./utils";
@Entry
@@ -27,7 +27,7 @@ class ModalDemo extends Panel {
onClick: () => {
modal(context).toast('This is a toast.')
}
} as IText),
}),
label('toast on top'),
label('Click me').apply({
width: 200,
@@ -39,7 +39,7 @@ class ModalDemo extends Panel {
onClick: () => {
modal(context).toast('This is a toast.', Gravity.Top)
}
} as IText),
}),
label('toast on center'),
label('Click me').apply({
@@ -52,7 +52,7 @@ class ModalDemo extends Panel {
onClick: () => {
modal(context).toast('This is a toast.', Gravity.Center)
}
} as IText),
} as Partial<Text>),
text({
text: "Alert",
layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST),
@@ -78,7 +78,7 @@ class ModalDemo extends Panel {
modal(context).toast('Clicked OK.')
})
}
} as IText),
}),
text({
text: "Confirm",
layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST),
@@ -109,7 +109,7 @@ class ModalDemo extends Panel {
modal(context).toast('Clicked Cancel.')
})
}
} as IText),
}),
text({
text: "Prompt",
layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST),
@@ -140,7 +140,7 @@ class ModalDemo extends Panel {
modal(context).toast(`Clicked Cancel.Input:${e}`)
})
}
} as IText),
}),
],
{
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
import { Panel, scroller, vlayout, text, layoutConfig, LayoutSpec, Color, gravity, IVLayout, Group, IText, navigator, modal } from "doric";
import { Panel, scroller, vlayout, text, layoutConfig, LayoutSpec, Color, gravity, Group, navigator, modal } from "doric";
import { colors, label } from "./utils";
@Entry
class NaivgatorDemo extends Panel {
@@ -35,7 +35,7 @@ class NaivgatorDemo extends Panel {
},
})
},
} as IText)
})
),
label('POP').apply({
width: 200,
@@ -47,7 +47,7 @@ class NaivgatorDemo extends Panel {
onClick: () => {
navigator(context).pop()
},
} as IText),
}),
label('OpenURL').apply({
width: 200,
height: 50,
@@ -58,12 +58,12 @@ class NaivgatorDemo extends Panel {
onClick: () => {
navigator(context).openUrl("https://doric.pub")
},
} as IText),
}),
]).apply({
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
gravity: gravity().center(),
space: 10,
} as IVLayout)).apply({
})).apply({
layoutConfig: layoutConfig().most(),
}).in(root)
}

View File

@@ -1,4 +1,4 @@
import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, scroller, layoutConfig, image, IView, IVLayout, ScaleType, modal, IText, network } from "doric";
import { Group, Panel, gravity, Color, LayoutSpec, vlayout, scroller, layoutConfig, modal, network } from "doric";
import { title, label, colors } from "./utils";
@Entry
@@ -22,12 +22,12 @@ class NetworkDemo extends Panel {
modal(context).toast('Catched:' + JSON.stringify(e))
})
}
} as IText),
}),
]).apply({
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
gravity: gravity().center(),
space: 10,
} as IVLayout)).apply({
})).apply({
layoutConfig: layoutConfig().most(),
}).in(rootView)
}

View File

@@ -1,4 +1,4 @@
import { Group, Panel, gravity, Color, LayoutSpec, vlayout, scroller, layoutConfig, IVLayout, IText, notch, modal, Gravity, log } from "doric";
import { Group, Panel, gravity, Color, LayoutSpec, vlayout, scroller, layoutConfig, notch, modal, Gravity, log } from "doric";
import { title, label, colors } from "./utils";
@Entry
@@ -15,21 +15,21 @@ class NotchDemo extends Panel {
layoutConfig: layoutConfig().just(),
onClick: () => {
notch(context).inset()
.then((inset) => {
let result = "top: " + inset.top + "\n" + "left: " + inset.left + "\n" + "bottom: " + inset.bottom + "\n" + "right: " + inset.right
modal(context).toast(result, Gravity.Bottom)
log(result)
})
.catch(() => {
.then((inset) => {
let result = "top: " + inset.top + "\n" + "left: " + inset.left + "\n" + "bottom: " + inset.bottom + "\n" + "right: " + inset.right
modal(context).toast(result, Gravity.Bottom)
log(result)
})
.catch(() => {
})
})
}
} as IText),
}),
]).apply({
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
gravity: gravity().center(),
space: 10,
} as IVLayout)).apply({
})).apply({
layoutConfig: layoutConfig().most(),
}).in(rootView)
}

View File

@@ -1,4 +1,4 @@
import { Group, Panel, navbar, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, scroller, layoutConfig, image, IView, IVLayout, ScaleType, modal, IText, network, navigator, notification } from "doric";
import { Group, Panel, gravity, Color, LayoutSpec, vlayout, scroller, layoutConfig, modal, notification } from "doric";
import { title, label, colors } from "./utils";
@Entry
@@ -24,7 +24,7 @@ class NotificationDemo extends Panel {
}
})
}
} as IText),
}),
label('Subscribe').apply({
width: 200,
height: 50,
@@ -43,7 +43,7 @@ class NotificationDemo extends Panel {
this.subscribeId = e
})
}
} as IText),
}),
label('Unsubscribe').apply({
width: 200,
height: 50,
@@ -58,12 +58,12 @@ class NotificationDemo extends Panel {
})
}
}
} as IText),
}),
]).apply({
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
gravity: gravity().center(),
space: 10,
} as IVLayout)).apply({
})).apply({
layoutConfig: layoutConfig().most(),
}).in(rootView)
}

View File

@@ -1,4 +1,4 @@
import { Group, Panel, popover, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, scroller, layoutConfig, image, IView, IVLayout, ScaleType, modal, IText, network } from "doric";
import { Group, Panel, popover, text, gravity, Color, LayoutSpec, vlayout, Gravity, scroller, layoutConfig, modal, } from "doric";
import { title, label, colors } from "./utils";
@Entry
@@ -32,12 +32,12 @@ class PopoverDemo extends Panel {
}, 3000)
}))
}
} as IText),
}),
]).apply({
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
gravity: gravity().center(),
space: 10,
} as IVLayout)).apply({
})).apply({
layoutConfig: layoutConfig().most(),
}).in(rootView)
}

View File

@@ -1,4 +1,4 @@
import { refreshable, Group, Panel, pullable, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, scroller, layoutConfig, image, IView, IVLayout, ScaleType, modal, IText, network, navigator, stack, Image } from "doric";
import { refreshable, Group, Panel, pullable, gravity, Color, LayoutSpec, log, vlayout, Image, layoutConfig, stack, image } from "doric";
import { title, label, colors, icon_refresh } from "./utils";
@Entry
@@ -47,7 +47,7 @@ class RefreshableDemo extends Panel {
onClick: () => {
refreshView.setRefreshing(context, true)
}
} as IText),
}),
label('stop Refresh').apply({
width: 300,
height: 50,
@@ -58,7 +58,7 @@ class RefreshableDemo extends Panel {
onClick: () => {
refreshView.setRefreshing(context, false)
}
} as IText),
}),
label('Enable Refresh').apply({
width: 300,
@@ -70,7 +70,7 @@ class RefreshableDemo extends Panel {
onClick: () => {
refreshView.setRefreshable(context, true)
}
} as IText),
}),
label('Disable Refresh').apply({
width: 300,
@@ -82,12 +82,12 @@ class RefreshableDemo extends Panel {
onClick: () => {
refreshView.setRefreshable(context, false)
}
} as IText),
}),
]).apply({
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
gravity: gravity().centerX(),
space: 10,
} as IVLayout))
}))
}).apply({
backgroundColor: Color.YELLOW
}).in(rootView)

View File

@@ -1,4 +1,4 @@
import { Group, Panel, gravity, Color, LayoutSpec, vlayout, scroller, layoutConfig, IVLayout, IText, statusbar, StatusBarMode } from "doric";
import { Group, Panel, gravity, Color, LayoutSpec, vlayout, scroller, layoutConfig, statusbar, StatusBarMode } from "doric";
import { title, label, colors } from "./utils";
@Entry
@@ -16,7 +16,7 @@ class StatusBarDemo extends Panel {
onClick: () => {
statusbar(context).setHidden(false)
}
} as IText),
}),
label('hide').apply({
width: 200,
height: 50,
@@ -27,18 +27,18 @@ class StatusBarDemo extends Panel {
onClick: () => {
statusbar(context).setHidden(true)
}
} as IText),
}),
label('light').apply({
width: 200,
height: 50,
backgroundColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().just().configMargin({top: 30}),
layoutConfig: layoutConfig().just().configMargin({ top: 30 }),
onClick: () => {
statusbar(context).setMode(StatusBarMode.LIGHT)
}
} as IText),
}),
label('dark').apply({
width: 200,
height: 50,
@@ -49,18 +49,18 @@ class StatusBarDemo extends Panel {
onClick: () => {
statusbar(context).setMode(StatusBarMode.DARK)
}
} as IText),
}),
label('white').apply({
width: 200,
height: 50,
backgroundColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().just().configMargin({top: 30}),
layoutConfig: layoutConfig().just().configMargin({ top: 30 }),
onClick: () => {
statusbar(context).setColor(Color.parse("#ffffff"))
}
} as IText),
}),
label('black').apply({
width: 200,
height: 50,
@@ -71,12 +71,12 @@ class StatusBarDemo extends Panel {
onClick: () => {
statusbar(context).setColor(Color.parse("#000000"))
}
} as IText),
}),
]).apply({
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
gravity: gravity().center(),
space: 10,
} as IVLayout)).apply({
})).apply({
layoutConfig: layoutConfig().most(),
}).in(rootView)
}

View File

@@ -1,4 +1,4 @@
import { Panel, Group, scroller, vlayout, image, layoutConfig, LayoutSpec, Input, Gravity, log, stack, hlayout, text, IHLayout, CENTER, slider, slideItem, modal, Slider, Text, Color, View, Stack, animate, flowlayout, FlowLayoutItem, NestedSlider, ScaleType } from "doric";
import { Panel, Group, scroller, vlayout, image, layoutConfig, LayoutSpec, Input, Gravity, log, stack, hlayout, text, CENTER, slider, slideItem, modal, Slider, Text, Color, View, Stack, animate, flowlayout, FlowLayoutItem, NestedSlider, ScaleType } from "doric";
import { title, colors } from "./utils";
function tab(idx: number, title: string, sliderView: Slider) {
@@ -52,7 +52,7 @@ class StickDemo extends Panel {
]).apply({
layoutConfig: layoutConfig().most(),
gravity: Gravity.Center,
} as IHLayout),
}),
this.indicator,
]).apply({
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.JUST),

View File

@@ -1,4 +1,4 @@
import { storage, Panel, scroller, vlayout, text, layoutConfig, LayoutSpec, Color, gravity, IVLayout, Group, IText, modal, Text, log, loge } from "doric";
import { storage, Panel, scroller, vlayout, text, layoutConfig, LayoutSpec, Color, gravity, Group, modal, Text, log, loge } from "doric";
import { colors, label } from "./utils";
const storedKey = 'StoredKey'
const zone = 'StorageDemo'
@@ -53,7 +53,7 @@ class StorageDemo extends Panel {
})
})
},
} as IText),
}),
label('remove value').apply({
width: 200,
height: 50,
@@ -66,7 +66,7 @@ class StorageDemo extends Panel {
this.update()
})
},
} as IText),
}),
label('clear values').apply({
width: 200,
height: 50,
@@ -79,12 +79,12 @@ class StorageDemo extends Panel {
this.update()
})
},
} as IText),
}),
]).apply({
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
gravity: gravity().center(),
space: 10,
} as IVLayout)).apply({
})).apply({
layoutConfig: layoutConfig().most(),
}).in(root)
this.update()