diff --git a/doric-demo/index.ts b/doric-demo/index.ts index 5f778ea2..222866bd 100644 --- a/doric-demo/index.ts +++ b/doric-demo/index.ts @@ -1,7 +1,3 @@ export default [ - 'src/Counter', - 'src/Snake', - 'src/ComplicatedAnimations', - 'src/.*Demo', - 'src/Gobang', + 'src/SliderInListDemo', ] \ No newline at end of file diff --git a/doric-demo/src/SliderInListDemo.tsx b/doric-demo/src/SliderInListDemo.tsx new file mode 100644 index 00000000..0ff8fad3 --- /dev/null +++ b/doric-demo/src/SliderInListDemo.tsx @@ -0,0 +1,67 @@ +import { + Group, + List, + Panel, + layoutConfig, + jsx, + ListItem, + Slider, + SlideItem, + Image, + Color, +} from "doric"; +const imageUrls = [ + "http://b.hiphotos.baidu.com/image/pic/item/908fa0ec08fa513db777cf78376d55fbb3fbd9b3.jpg", + "http://f.hiphotos.baidu.com/image/pic/item/0e2442a7d933c8956c0e8eeadb1373f08202002a.jpg", + "http://f.hiphotos.baidu.com/image/pic/item/b151f8198618367aa7f3cc7424738bd4b31ce525.jpg", + "http://b.hiphotos.baidu.com/image/pic/item/0eb30f2442a7d9337119f7dba74bd11372f001e0.jpg", + "http://a.hiphotos.baidu.com/image/h%3D300/sign=b38f3fc35b0fd9f9bf175369152cd42b/9a504fc2d5628535bdaac29e9aef76c6a6ef63c2.jpg", + "http://h.hiphotos.baidu.com/image/pic/item/810a19d8bc3eb1354c94a704ac1ea8d3fd1f4439.jpg", + "http://hbimg.b0.upaiyun.com/ca29ea125b7f2d580f573e48eb594b1ef509757f34a08-m0hK45_fw658", + "http://b.hiphotos.baidu.com/image/pic/item/908fa0ec08fa513db777cf78376d55fbb3fbd9b3.jpg", + "http://f.hiphotos.baidu.com/image/pic/item/0e2442a7d933c8956c0e8eeadb1373f08202002a.jpg", + "http://f.hiphotos.baidu.com/image/pic/item/b151f8198618367aa7f3cc7424738bd4b31ce525.jpg", + "http://b.hiphotos.baidu.com/image/pic/item/0eb30f2442a7d9337119f7dba74bd11372f001e0.jpg", + "http://a.hiphotos.baidu.com/image/h%3D300/sign=b38f3fc35b0fd9f9bf175369152cd42b/9a504fc2d5628535bdaac29e9aef76c6a6ef63c2.jpg", + "http://h.hiphotos.baidu.com/image/pic/item/810a19d8bc3eb1354c94a704ac1ea8d3fd1f4439.jpg", +]; + +@Entry +export class SliderInListDemo extends Panel { + build(root: Group) { + + ( + + + ( + + + + ) as SlideItem + } + /> + + ) as ListItem + } + />; + } +} diff --git a/doric-js/bundle/doric-lib.es5.js b/doric-js/bundle/doric-lib.es5.js index 9f0b913e..1320ecac 100644 --- a/doric-js/bundle/doric-lib.es5.js +++ b/doric-js/bundle/doric-lib.es5.js @@ -2641,7 +2641,7 @@ var List = /** @class */ (function (_super) { __metadata$b("design:type", Function) ], List.prototype, "onScrollEnd", void 0); __decorate$b([ - Property, + InconsistProperty, __metadata$b("design:type", Number) ], List.prototype, "scrolledPosition", void 0); __decorate$b([ @@ -2820,6 +2820,10 @@ var Slider = /** @class */ (function (_super) { Property, __metadata$a("design:type", Object) ], Slider.prototype, "slideStyle", void 0); + __decorate$a([ + InconsistProperty, + __metadata$a("design:type", Number) + ], Slider.prototype, "slidePosition", void 0); return Slider; }(Superview)); function slider(config) { diff --git a/doric-js/bundle/doric-lib.js b/doric-js/bundle/doric-lib.js index deb7738a..f05bcabf 100644 --- a/doric-js/bundle/doric-lib.js +++ b/doric-js/bundle/doric-lib.js @@ -1993,7 +1993,7 @@ __decorate$b([ __metadata$b("design:type", Function) ], List.prototype, "onScrollEnd", void 0); __decorate$b([ - Property, + InconsistProperty, __metadata$b("design:type", Number) ], List.prototype, "scrolledPosition", void 0); __decorate$b([ @@ -2147,6 +2147,10 @@ __decorate$a([ Property, __metadata$a("design:type", Object) ], Slider.prototype, "slideStyle", void 0); +__decorate$a([ + InconsistProperty, + __metadata$a("design:type", Number) +], Slider.prototype, "slidePosition", void 0); function slider(config) { const ret = new Slider; ret.apply(config); diff --git a/doric-js/bundle/doric-vm.js b/doric-js/bundle/doric-vm.js index 94866ed4..8a452d86 100644 --- a/doric-js/bundle/doric-vm.js +++ b/doric-js/bundle/doric-vm.js @@ -3533,7 +3533,7 @@ __decorate$b([ __metadata$b("design:type", Function) ], List.prototype, "onScrollEnd", void 0); __decorate$b([ - Property, + InconsistProperty, __metadata$b("design:type", Number) ], List.prototype, "scrolledPosition", void 0); __decorate$b([ @@ -3687,6 +3687,10 @@ __decorate$a([ Property, __metadata$a("design:type", Object) ], Slider.prototype, "slideStyle", void 0); +__decorate$a([ + InconsistProperty, + __metadata$a("design:type", Number) +], Slider.prototype, "slidePosition", void 0); function slider(config) { const ret = new Slider; ret.apply(config); diff --git a/doric-js/index.d.ts b/doric-js/index.d.ts index 46a0207b..2c3ec243 100644 --- a/doric-js/index.d.ts +++ b/doric-js/index.d.ts @@ -1106,6 +1106,7 @@ declare module "doric" { minScale: number; maxScale: number; }; + slidePosition?: number; /** * Reload all list items. * @param context diff --git a/doric-js/lib/src/widget/list.js b/doric-js/lib/src/widget/list.js index 110a33af..a4e1dd9f 100644 --- a/doric-js/lib/src/widget/list.js +++ b/doric-js/lib/src/widget/list.js @@ -22,7 +22,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; -import { View, Property, Superview } from "../ui/view"; +import { View, Property, Superview, InconsistProperty } from "../ui/view"; import { Stack } from "./layouts"; import { layoutConfig } from "../util/layoutconfig"; import { deepClone } from "./utils"; @@ -133,7 +133,7 @@ __decorate([ __metadata("design:type", Function) ], List.prototype, "onScrollEnd", void 0); __decorate([ - Property, + InconsistProperty, __metadata("design:type", Number) ], List.prototype, "scrolledPosition", void 0); __decorate([ diff --git a/doric-js/lib/src/widget/slider.d.ts b/doric-js/lib/src/widget/slider.d.ts index 395dafe4..f43c8d2f 100644 --- a/doric-js/lib/src/widget/slider.d.ts +++ b/doric-js/lib/src/widget/slider.d.ts @@ -33,6 +33,7 @@ export declare class Slider extends Superview { minScale: number; maxScale: number; }; + slidePosition?: number; /** * Reload all list items. * @param context diff --git a/doric-js/lib/src/widget/slider.js b/doric-js/lib/src/widget/slider.js index 7582ec53..00be717d 100644 --- a/doric-js/lib/src/widget/slider.js +++ b/doric-js/lib/src/widget/slider.js @@ -22,7 +22,7 @@ var __metadata = (this && this.__metadata) || function (k, v) { * See the License for the specific language governing permissions and * limitations under the License. */ -import { Superview, View, Property } from "../ui/view"; +import { Superview, View, Property, InconsistProperty } from "../ui/view"; import { Stack } from "./layouts"; import { layoutConfig } from "../util/layoutconfig"; import { deepClone } from "./utils"; @@ -110,6 +110,10 @@ __decorate([ Property, __metadata("design:type", Object) ], Slider.prototype, "slideStyle", void 0); +__decorate([ + InconsistProperty, + __metadata("design:type", Number) +], Slider.prototype, "slidePosition", void 0); export function slider(config) { const ret = new Slider; ret.apply(config); diff --git a/doric-js/src/widget/list.ts b/doric-js/src/widget/list.ts index 3de794fb..7029fd15 100644 --- a/doric-js/src/widget/list.ts +++ b/doric-js/src/widget/list.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { View, Property, Superview, NativeViewModel } from "../ui/view"; +import { View, Property, Superview, NativeViewModel, InconsistProperty } from "../ui/view"; import { Stack } from "./layouts"; import { layoutConfig } from "../util/layoutconfig"; import { BridgeContext } from "../runtime/global"; @@ -71,7 +71,7 @@ export class List extends Superview { @Property onScrollEnd?: (offset: { x: number, y: number }) => void - @Property + @InconsistProperty scrolledPosition?: number @Property diff --git a/doric-js/src/widget/slider.ts b/doric-js/src/widget/slider.ts index c4e7d1c9..16e7f122 100644 --- a/doric-js/src/widget/slider.ts +++ b/doric-js/src/widget/slider.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Superview, View, Property } from "../ui/view"; +import { Superview, View, Property, InconsistProperty } from "../ui/view"; import { Stack } from "./layouts"; import { layoutConfig } from "../util/layoutconfig"; import { BridgeContext } from "../runtime/global"; @@ -71,6 +71,9 @@ export class Slider extends Superview { @Property slideStyle?: "zoomOut" | { type: "zoomOut", minScale: number, maxScale: number } + @InconsistProperty + slidePosition?: number + /** * Reload all list items. * @param context