remove flexSlider
This commit is contained in:
parent
1e112055db
commit
71154ad640
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, IVLayout, IHLayout, layoutConfig, stack, Gravity, flexlayout, flexScroller } from "doric";
|
import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, IVLayout, IHLayout, layoutConfig, stack, Gravity, flexlayout } from "doric";
|
||||||
import { FlexDirection, Wrap, Justify, Align, FlexTypedValue, OverFlow } from "doric/lib/src/util/flexbox";
|
import { FlexDirection, Wrap, Justify, Align, FlexTypedValue, OverFlow } from "doric/lib/src/util/flexbox";
|
||||||
import { colors } from "./utils";
|
import { colors } from "./utils";
|
||||||
|
|
||||||
@ -40,6 +40,7 @@ class LayoutDemo extends Panel {
|
|||||||
heightSpec: LayoutSpec.FIT,
|
heightSpec: LayoutSpec.FIT,
|
||||||
minHeight: 200,
|
minHeight: 200,
|
||||||
maxHeight: 400,
|
maxHeight: 400,
|
||||||
|
maxWidth: 300,
|
||||||
},
|
},
|
||||||
backgroundColor: colors[0].alpha(0.3),
|
backgroundColor: colors[0].alpha(0.3),
|
||||||
})
|
})
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
#import "DoricSwitchNode.h"
|
#import "DoricSwitchNode.h"
|
||||||
#import "DoricNotchPlugin.h"
|
#import "DoricNotchPlugin.h"
|
||||||
#import "DoricFlexNode.h"
|
#import "DoricFlexNode.h"
|
||||||
#import "DoricFlexScrollerNode.h"
|
|
||||||
|
|
||||||
@interface DoricLibraries : NSObject
|
@interface DoricLibraries : NSObject
|
||||||
@property(nonatomic, strong) NSMutableSet <DoricLibrary *> *libraries;
|
@property(nonatomic, strong) NSMutableSet <DoricLibrary *> *libraries;
|
||||||
@ -142,7 +141,6 @@ - (void)innerRegister {
|
|||||||
[self registerViewNode:DoricDraggableNode.class withName:@"Draggable"];
|
[self registerViewNode:DoricDraggableNode.class withName:@"Draggable"];
|
||||||
[self registerViewNode:DoricSwitchNode.class withName:@"Switch"];
|
[self registerViewNode:DoricSwitchNode.class withName:@"Switch"];
|
||||||
[self registerViewNode:DoricFlexNode.class withName:@"FlexLayout"];
|
[self registerViewNode:DoricFlexNode.class withName:@"FlexLayout"];
|
||||||
[self registerViewNode:DoricFlexScrollerNode.class withName:@"FlexScroller"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)registerJSBundle:(NSString *)bundle withName:(NSString *)name {
|
- (void)registerJSBundle:(NSString *)bundle withName:(NSString *)name {
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright [2019] [Doric.Pub]
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
//
|
|
||||||
// Created by pengfei.zhou on 2020/4/11.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
#import "DoricGroupNode.h"
|
|
||||||
|
|
||||||
@interface DoricFlexScrollerNode : DoricGroupNode <UIScrollView *>
|
|
||||||
- (void)blendSubNode:(DoricViewNode *)subNode flexConfig:(NSDictionary *)flexConfig;
|
|
||||||
@end
|
|
@ -1,194 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright [2019] [Doric.Pub]
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
//
|
|
||||||
// Created by pengfei.zhou on 2020/4/11.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "DoricExtensions.h"
|
|
||||||
#import "DoricFlexScrollerNode.h"
|
|
||||||
|
|
||||||
#import "DoricJSDispatcher.h"
|
|
||||||
#import "DoricScrollableProtocol.h"
|
|
||||||
#import "DoricRefreshableNode.h"
|
|
||||||
|
|
||||||
@interface DoricFlexScrollView : UIScrollView
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation DoricFlexScrollView
|
|
||||||
- (CGSize)sizeThatFits:(CGSize)size {
|
|
||||||
return [self.yoga intrinsicSize];
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
@interface DoricFlexScrollerNode () <UIScrollViewDelegate>
|
|
||||||
@property(nonatomic, copy) NSString *onScrollFuncId;
|
|
||||||
@property(nonatomic, copy) NSString *onScrollEndFuncId;
|
|
||||||
@property(nonatomic, strong) NSMutableSet <DoricDidScrollBlock> *didScrollBlocks;
|
|
||||||
@property(nonatomic, strong) DoricJSDispatcher *jsDispatcher;
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
@implementation DoricFlexScrollerNode
|
|
||||||
- (UIScrollView *)build {
|
|
||||||
return [[DoricFlexScrollView new] also:^(UIScrollView *it) {
|
|
||||||
[it configureLayoutWithBlock:^(YGLayout *layout) {
|
|
||||||
layout.isEnabled = YES;
|
|
||||||
layout.overflow = YGOverflowScroll;
|
|
||||||
}];
|
|
||||||
it.delegate = self;
|
|
||||||
it.showsHorizontalScrollIndicator = NO;
|
|
||||||
it.showsVerticalScrollIndicator = NO;
|
|
||||||
if (@available(iOS 11, *)) {
|
|
||||||
it.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)initWithSuperNode:(DoricSuperNode *)superNode {
|
|
||||||
[super initWithSuperNode:superNode];
|
|
||||||
if ([superNode isKindOfClass:[DoricRefreshableNode class]]) {
|
|
||||||
self.view.bounces = NO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)afterBlended:(NSDictionary *)props {
|
|
||||||
[super afterBlended:props];
|
|
||||||
if (props[@"contentOffset"]) {
|
|
||||||
NSDictionary *prop = props[@"contentOffset"];
|
|
||||||
self.view.contentOffset = CGPointMake([prop[@"x"] floatValue], [prop[@"y"] floatValue]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)requestLayout {
|
|
||||||
[super requestLayout];
|
|
||||||
[self.view.yoga applyLayoutPreservingOrigin:YES];
|
|
||||||
self.view.contentSize = self.view.yoga.intrinsicSize;
|
|
||||||
/// Need layout again.
|
|
||||||
for (UIView *view in self.view.subviews) {
|
|
||||||
if (view.yoga.isEnabled) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (view.doricLayout.measuredWidth == view.width && view.doricLayout.measuredHeight == view.height) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
view.doricLayout.widthSpec = DoricLayoutJust;
|
|
||||||
view.doricLayout.heightSpec = DoricLayoutJust;
|
|
||||||
view.doricLayout.width = view.width;
|
|
||||||
view.doricLayout.height = view.height;
|
|
||||||
view.doricLayout.measuredX = view.left;
|
|
||||||
view.doricLayout.measuredY = view.top;
|
|
||||||
[view.doricLayout apply];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)blendView:(UIScrollView *)view forPropName:(NSString *)name propValue:(id)prop {
|
|
||||||
if ([@"flexConfig" isEqualToString:name]) {
|
|
||||||
[self blendYoga:view.yoga from:prop];
|
|
||||||
} else if ([@"onScroll" isEqualToString:name]) {
|
|
||||||
self.onScrollFuncId = prop;
|
|
||||||
} else if ([@"onScrollEnd" isEqualToString:name]) {
|
|
||||||
self.onScrollEndFuncId = prop;
|
|
||||||
} else {
|
|
||||||
[super blendView:view forPropName:name propValue:prop];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)blendSubNode:(DoricViewNode *)subNode flexConfig:(NSDictionary *)flexConfig {
|
|
||||||
[subNode.view configureLayoutWithBlock:^(YGLayout *_Nonnull layout) {
|
|
||||||
layout.isEnabled = YES;
|
|
||||||
}];
|
|
||||||
[self blendYoga:subNode.view.yoga from:flexConfig];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
|
||||||
for (DoricDidScrollBlock block in self.didScrollBlocks) {
|
|
||||||
block(scrollView);
|
|
||||||
}
|
|
||||||
if (self.onScrollFuncId) {
|
|
||||||
if (!self.jsDispatcher) {
|
|
||||||
self.jsDispatcher = [DoricJSDispatcher new];
|
|
||||||
}
|
|
||||||
__weak typeof(self) __self = self;
|
|
||||||
[self.jsDispatcher dispatch:^DoricAsyncResult * {
|
|
||||||
__strong typeof(__self) self = __self;
|
|
||||||
return [self callJSResponse:self.onScrollFuncId,
|
|
||||||
@{
|
|
||||||
@"x": @(self.view.contentOffset.x),
|
|
||||||
@"y": @(self.view.contentOffset.y),
|
|
||||||
},
|
|
||||||
nil];
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
|
|
||||||
if (self.onScrollEndFuncId) {
|
|
||||||
[self callJSResponse:self.onScrollEndFuncId,
|
|
||||||
@{
|
|
||||||
@"x": @(self.view.contentOffset.x),
|
|
||||||
@"y": @(self.view.contentOffset.y),
|
|
||||||
},
|
|
||||||
nil];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
|
|
||||||
if (!decelerate) {
|
|
||||||
if (self.onScrollEndFuncId) {
|
|
||||||
[self callJSResponse:self.onScrollEndFuncId,
|
|
||||||
@{
|
|
||||||
@"x": @(self.view.contentOffset.x),
|
|
||||||
@"y": @(self.view.contentOffset.y),
|
|
||||||
},
|
|
||||||
nil];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)scrollTo:(NSDictionary *)params {
|
|
||||||
BOOL animated = [params[@"animated"] boolValue];
|
|
||||||
NSDictionary *offsetDic = params[@"offset"];
|
|
||||||
CGPoint offset = CGPointMake([offsetDic[@"x"] floatValue], [offsetDic[@"y"] floatValue]);
|
|
||||||
[self.view setContentOffset:offset animated:animated];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)scrollBy:(NSDictionary *)params {
|
|
||||||
BOOL animated = [params[@"animated"] boolValue];
|
|
||||||
NSDictionary *offsetDic = params[@"offset"];
|
|
||||||
CGPoint offset = CGPointMake([offsetDic[@"x"] floatValue], [offsetDic[@"y"] floatValue]);
|
|
||||||
[self.view setContentOffset:CGPointMake(
|
|
||||||
MIN(self.view.contentSize.width - self.view.width, MAX(0, offset.x + self.view.contentOffset.x)),
|
|
||||||
MIN(self.view.contentSize.height - self.view.height, MAX(0, offset.y + self.view.contentOffset.y)))
|
|
||||||
animated:animated];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSMutableSet<DoricDidScrollBlock> *)didScrollBlocks {
|
|
||||||
if (!_didScrollBlocks) {
|
|
||||||
_didScrollBlocks = [NSMutableSet new];
|
|
||||||
}
|
|
||||||
return _didScrollBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)addDidScrollBlock:(__nonnull DoricDidScrollBlock)didScrollListener {
|
|
||||||
[self.didScrollBlocks addObject:didScrollListener];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)removeDidScrollBlock:(__nonnull DoricDidScrollBlock)didScrollListener {
|
|
||||||
[self.didScrollBlocks removeObject:didScrollListener];
|
|
||||||
}
|
|
||||||
@end
|
|
@ -30,7 +30,6 @@
|
|||||||
#import "DoricExtensions.h"
|
#import "DoricExtensions.h"
|
||||||
#import "DoricPromise.h"
|
#import "DoricPromise.h"
|
||||||
#import "DoricFlexNode.h"
|
#import "DoricFlexNode.h"
|
||||||
#import "DoricFlexScrollerNode.h"
|
|
||||||
|
|
||||||
void DoricAddEllipticArcPath(CGMutablePathRef path,
|
void DoricAddEllipticArcPath(CGMutablePathRef path,
|
||||||
CGPoint origin,
|
CGPoint origin,
|
||||||
@ -270,8 +269,6 @@ - (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop
|
|||||||
if ([prop isKindOfClass:[NSDictionary class]]) {
|
if ([prop isKindOfClass:[NSDictionary class]]) {
|
||||||
if ([self.superNode isKindOfClass:[DoricFlexNode class]]) {
|
if ([self.superNode isKindOfClass:[DoricFlexNode class]]) {
|
||||||
[((DoricFlexNode *) self.superNode) blendSubNode:self flexConfig:prop];
|
[((DoricFlexNode *) self.superNode) blendSubNode:self flexConfig:prop];
|
||||||
} else if ([self.superNode isKindOfClass:[DoricFlexScrollerNode class]]) {
|
|
||||||
[((DoricFlexScrollerNode *) self.superNode) blendSubNode:self flexConfig:prop];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2645,89 +2645,6 @@ function switchView(config) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
var __extends$e = (undefined && undefined.__extends) || (function () {
|
|
||||||
var extendStatics = function (d, b) {
|
|
||||||
extendStatics = Object.setPrototypeOf ||
|
|
||||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
||||||
function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };
|
|
||||||
return extendStatics(d, b);
|
|
||||||
};
|
|
||||||
return function (d, b) {
|
|
||||||
extendStatics(d, b);
|
|
||||||
function __() { this.constructor = d; }
|
|
||||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") { r = Reflect.decorate(decorators, target, key, desc); }
|
|
||||||
else { for (var i = decorators.length - 1; i >= 0; i--) { if (d = decorators[i]) { r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; } } }
|
|
||||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
||||||
};
|
|
||||||
var __metadata$e = (undefined && undefined.__metadata) || function (k, v) {
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") { return Reflect.metadata(k, v); }
|
|
||||||
};
|
|
||||||
var __values$4 = (undefined && undefined.__values) || function(o) {
|
|
||||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
||||||
if (m) { return m.call(o); }
|
|
||||||
if (o && typeof o.length === "number") { return {
|
|
||||||
next: function () {
|
|
||||||
if (o && i >= o.length) { o = void 0; }
|
|
||||||
return { value: o && o[i++], done: !o };
|
|
||||||
}
|
|
||||||
}; }
|
|
||||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
||||||
};
|
|
||||||
function flexScroller(views, config) {
|
|
||||||
var e_1, _a;
|
|
||||||
var ret = new FlexScroller;
|
|
||||||
ret.layoutConfig = layoutConfig().fit();
|
|
||||||
try {
|
|
||||||
for (var views_1 = __values$4(views), views_1_1 = views_1.next(); !views_1_1.done; views_1_1 = views_1.next()) {
|
|
||||||
var v = views_1_1.value;
|
|
||||||
ret.addChild(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
||||||
finally {
|
|
||||||
try {
|
|
||||||
if (views_1_1 && !views_1_1.done && (_a = views_1.return)) { _a.call(views_1); }
|
|
||||||
}
|
|
||||||
finally { if (e_1) { throw e_1.error; } }
|
|
||||||
}
|
|
||||||
if (config) {
|
|
||||||
for (var key in config) {
|
|
||||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
var FlexScroller = /** @class */ (function (_super) {
|
|
||||||
__extends$e(FlexScroller, _super);
|
|
||||||
function FlexScroller() {
|
|
||||||
return _super !== null && _super.apply(this, arguments) || this;
|
|
||||||
}
|
|
||||||
FlexScroller.prototype.scrollTo = function (context, offset, animated) {
|
|
||||||
return this.nativeChannel(context, "scrollTo")({ offset: offset, animated: animated });
|
|
||||||
};
|
|
||||||
FlexScroller.prototype.scrollBy = function (context, offset, animated) {
|
|
||||||
return this.nativeChannel(context, "scrollBy")({ offset: offset, animated: animated });
|
|
||||||
};
|
|
||||||
__decorate$e([
|
|
||||||
Property,
|
|
||||||
__metadata$e("design:type", Object)
|
|
||||||
], FlexScroller.prototype, "contentOffset", void 0);
|
|
||||||
__decorate$e([
|
|
||||||
Property,
|
|
||||||
__metadata$e("design:type", Function)
|
|
||||||
], FlexScroller.prototype, "onScroll", void 0);
|
|
||||||
__decorate$e([
|
|
||||||
Property,
|
|
||||||
__metadata$e("design:type", Function)
|
|
||||||
], FlexScroller.prototype, "onScrollEnd", void 0);
|
|
||||||
return FlexScroller;
|
|
||||||
}(Group));
|
|
||||||
|
|
||||||
function modal(context) {
|
function modal(context) {
|
||||||
return {
|
return {
|
||||||
toast: function (msg, gravity) {
|
toast: function (msg, gravity) {
|
||||||
@ -3024,7 +2941,7 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
|
|||||||
if (op[0] & 5) { throw op[1]; } return { value: op[0] ? op[1] : void 0, done: true };
|
if (op[0] & 5) { throw op[1]; } return { value: op[0] ? op[1] : void 0, done: true };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var __values$5 = (undefined && undefined.__values) || function(o) {
|
var __values$4 = (undefined && undefined.__values) || function(o) {
|
||||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||||
if (m) { return m.call(o); }
|
if (m) { return m.call(o); }
|
||||||
if (o && typeof o.length === "number") { return {
|
if (o && typeof o.length === "number") { return {
|
||||||
@ -3061,10 +2978,10 @@ function animate(context) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
for (var _c = __values$5(panel_1.allHeadViews()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
for (var _c = __values$4(panel_1.allHeadViews()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
||||||
var map = _d.value;
|
var map = _d.value;
|
||||||
try {
|
try {
|
||||||
for (var _e = (e_2 = void 0, __values$5(map.values())), _f = _e.next(); !_f.done; _f = _e.next()) {
|
for (var _e = (e_2 = void 0, __values$4(map.values())), _f = _e.next(); !_f.done; _f = _e.next()) {
|
||||||
var v = _f.value;
|
var v = _f.value;
|
||||||
if (v.isDirty()) {
|
if (v.isDirty()) {
|
||||||
var model_1 = v.toModel();
|
var model_1 = v.toModel();
|
||||||
@ -3180,7 +3097,7 @@ function notch(context) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var __values$6 = (undefined && undefined.__values) || function(o) {
|
var __values$5 = (undefined && undefined.__values) || function(o) {
|
||||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||||
if (m) { return m.call(o); }
|
if (m) { return m.call(o); }
|
||||||
if (o && typeof o.length === "number") { return {
|
if (o && typeof o.length === "number") { return {
|
||||||
@ -3211,7 +3128,7 @@ var Observable = /** @class */ (function () {
|
|||||||
this.provider.provide(newV);
|
this.provider.provide(newV);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
for (var _b = __values$6(this.observers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
for (var _b = __values$5(this.observers), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||||
var observer = _c.value;
|
var observer = _c.value;
|
||||||
observer(newV);
|
observer(newV);
|
||||||
}
|
}
|
||||||
@ -3255,7 +3172,7 @@ var Provider = /** @class */ (function () {
|
|||||||
return Provider;
|
return Provider;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
var __extends$f = (undefined && undefined.__extends) || (function () {
|
var __extends$e = (undefined && undefined.__extends) || (function () {
|
||||||
var extendStatics = function (d, b) {
|
var extendStatics = function (d, b) {
|
||||||
extendStatics = Object.setPrototypeOf ||
|
extendStatics = Object.setPrototypeOf ||
|
||||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||||
@ -3296,7 +3213,7 @@ var ViewModel = /** @class */ (function () {
|
|||||||
return ViewModel;
|
return ViewModel;
|
||||||
}());
|
}());
|
||||||
var VMPanel = /** @class */ (function (_super) {
|
var VMPanel = /** @class */ (function (_super) {
|
||||||
__extends$f(VMPanel, _super);
|
__extends$e(VMPanel, _super);
|
||||||
function VMPanel() {
|
function VMPanel() {
|
||||||
return _super !== null && _super.apply(this, arguments) || this;
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
}
|
}
|
||||||
@ -3319,7 +3236,6 @@ exports.CENTER_Y = CENTER_Y;
|
|||||||
exports.Color = Color;
|
exports.Color = Color;
|
||||||
exports.Draggable = Draggable;
|
exports.Draggable = Draggable;
|
||||||
exports.FlexLayout = FlexLayout;
|
exports.FlexLayout = FlexLayout;
|
||||||
exports.FlexScroller = FlexScroller;
|
|
||||||
exports.FlowLayout = FlowLayout;
|
exports.FlowLayout = FlowLayout;
|
||||||
exports.FlowLayoutItem = FlowLayoutItem;
|
exports.FlowLayoutItem = FlowLayoutItem;
|
||||||
exports.Gravity = Gravity;
|
exports.Gravity = Gravity;
|
||||||
@ -3360,7 +3276,6 @@ exports.ViewModel = ViewModel;
|
|||||||
exports.animate = animate;
|
exports.animate = animate;
|
||||||
exports.coordinator = coordinator;
|
exports.coordinator = coordinator;
|
||||||
exports.draggable = draggable;
|
exports.draggable = draggable;
|
||||||
exports.flexScroller = flexScroller;
|
|
||||||
exports.flexlayout = flexlayout;
|
exports.flexlayout = flexlayout;
|
||||||
exports.flowItem = flowItem;
|
exports.flowItem = flowItem;
|
||||||
exports.flowlayout = flowlayout;
|
exports.flowlayout = flowlayout;
|
||||||
|
@ -1972,49 +1972,6 @@ function switchView(config) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
||||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
||||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
||||||
};
|
|
||||||
var __metadata$e = (undefined && undefined.__metadata) || function (k, v) {
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
||||||
};
|
|
||||||
function flexScroller(views, config) {
|
|
||||||
const ret = new FlexScroller;
|
|
||||||
ret.layoutConfig = layoutConfig().fit();
|
|
||||||
for (let v of views) {
|
|
||||||
ret.addChild(v);
|
|
||||||
}
|
|
||||||
if (config) {
|
|
||||||
for (let key in config) {
|
|
||||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
class FlexScroller extends Group {
|
|
||||||
scrollTo(context, offset, animated) {
|
|
||||||
return this.nativeChannel(context, "scrollTo")({ offset, animated });
|
|
||||||
}
|
|
||||||
scrollBy(context, offset, animated) {
|
|
||||||
return this.nativeChannel(context, "scrollBy")({ offset, animated });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
__decorate$e([
|
|
||||||
Property,
|
|
||||||
__metadata$e("design:type", Object)
|
|
||||||
], FlexScroller.prototype, "contentOffset", void 0);
|
|
||||||
__decorate$e([
|
|
||||||
Property,
|
|
||||||
__metadata$e("design:type", Function)
|
|
||||||
], FlexScroller.prototype, "onScroll", void 0);
|
|
||||||
__decorate$e([
|
|
||||||
Property,
|
|
||||||
__metadata$e("design:type", Function)
|
|
||||||
], FlexScroller.prototype, "onScrollEnd", void 0);
|
|
||||||
|
|
||||||
function modal(context) {
|
function modal(context) {
|
||||||
return {
|
return {
|
||||||
toast: (msg, gravity = Gravity.Bottom) => {
|
toast: (msg, gravity = Gravity.Bottom) => {
|
||||||
@ -2491,7 +2448,6 @@ exports.CENTER_Y = CENTER_Y;
|
|||||||
exports.Color = Color;
|
exports.Color = Color;
|
||||||
exports.Draggable = Draggable;
|
exports.Draggable = Draggable;
|
||||||
exports.FlexLayout = FlexLayout;
|
exports.FlexLayout = FlexLayout;
|
||||||
exports.FlexScroller = FlexScroller;
|
|
||||||
exports.FlowLayout = FlowLayout;
|
exports.FlowLayout = FlowLayout;
|
||||||
exports.FlowLayoutItem = FlowLayoutItem;
|
exports.FlowLayoutItem = FlowLayoutItem;
|
||||||
exports.Gravity = Gravity;
|
exports.Gravity = Gravity;
|
||||||
@ -2532,7 +2488,6 @@ exports.ViewModel = ViewModel;
|
|||||||
exports.animate = animate;
|
exports.animate = animate;
|
||||||
exports.coordinator = coordinator;
|
exports.coordinator = coordinator;
|
||||||
exports.draggable = draggable;
|
exports.draggable = draggable;
|
||||||
exports.flexScroller = flexScroller;
|
|
||||||
exports.flexlayout = flexlayout;
|
exports.flexlayout = flexlayout;
|
||||||
exports.flowItem = flowItem;
|
exports.flowItem = flowItem;
|
||||||
exports.flowlayout = flowlayout;
|
exports.flowlayout = flowlayout;
|
||||||
|
@ -3431,49 +3431,6 @@ function switchView(config) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
||||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
||||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
||||||
};
|
|
||||||
var __metadata$e = (undefined && undefined.__metadata) || function (k, v) {
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
||||||
};
|
|
||||||
function flexScroller(views, config) {
|
|
||||||
const ret = new FlexScroller;
|
|
||||||
ret.layoutConfig = layoutConfig().fit();
|
|
||||||
for (let v of views) {
|
|
||||||
ret.addChild(v);
|
|
||||||
}
|
|
||||||
if (config) {
|
|
||||||
for (let key in config) {
|
|
||||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
class FlexScroller extends Group {
|
|
||||||
scrollTo(context, offset, animated) {
|
|
||||||
return this.nativeChannel(context, "scrollTo")({ offset, animated });
|
|
||||||
}
|
|
||||||
scrollBy(context, offset, animated) {
|
|
||||||
return this.nativeChannel(context, "scrollBy")({ offset, animated });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
__decorate$e([
|
|
||||||
Property,
|
|
||||||
__metadata$e("design:type", Object)
|
|
||||||
], FlexScroller.prototype, "contentOffset", void 0);
|
|
||||||
__decorate$e([
|
|
||||||
Property,
|
|
||||||
__metadata$e("design:type", Function)
|
|
||||||
], FlexScroller.prototype, "onScroll", void 0);
|
|
||||||
__decorate$e([
|
|
||||||
Property,
|
|
||||||
__metadata$e("design:type", Function)
|
|
||||||
], FlexScroller.prototype, "onScrollEnd", void 0);
|
|
||||||
|
|
||||||
function modal(context) {
|
function modal(context) {
|
||||||
return {
|
return {
|
||||||
toast: (msg, gravity = Gravity.Bottom) => {
|
toast: (msg, gravity = Gravity.Bottom) => {
|
||||||
@ -4085,7 +4042,6 @@ exports.CENTER_Y = CENTER_Y;
|
|||||||
exports.Color = Color;
|
exports.Color = Color;
|
||||||
exports.Draggable = Draggable;
|
exports.Draggable = Draggable;
|
||||||
exports.FlexLayout = FlexLayout;
|
exports.FlexLayout = FlexLayout;
|
||||||
exports.FlexScroller = FlexScroller;
|
|
||||||
exports.FlowLayout = FlowLayout;
|
exports.FlowLayout = FlowLayout;
|
||||||
exports.FlowLayoutItem = FlowLayoutItem;
|
exports.FlowLayoutItem = FlowLayoutItem;
|
||||||
exports.Gravity = Gravity;
|
exports.Gravity = Gravity;
|
||||||
@ -4126,7 +4082,6 @@ exports.ViewModel = ViewModel;
|
|||||||
exports.animate = animate;
|
exports.animate = animate;
|
||||||
exports.coordinator = coordinator;
|
exports.coordinator = coordinator;
|
||||||
exports.draggable = draggable;
|
exports.draggable = draggable;
|
||||||
exports.flexScroller = flexScroller;
|
|
||||||
exports.flexlayout = flexlayout;
|
exports.flexlayout = flexlayout;
|
||||||
exports.flowItem = flowItem;
|
exports.flowItem = flowItem;
|
||||||
exports.flowlayout = flowlayout;
|
exports.flowlayout = flowlayout;
|
||||||
|
35
doric-js/index.d.ts
vendored
35
doric-js/index.d.ts
vendored
@ -88,7 +88,6 @@ declare module 'doric/lib/src/widget/index.widget' {
|
|||||||
export * from 'doric/lib/src/widget/nestedSlider';
|
export * from 'doric/lib/src/widget/nestedSlider';
|
||||||
export * from 'doric/lib/src/widget/draggable';
|
export * from 'doric/lib/src/widget/draggable';
|
||||||
export * from 'doric/lib/src/widget/switch';
|
export * from 'doric/lib/src/widget/switch';
|
||||||
export * from 'doric/lib/src/widget/flexScroller';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'doric/lib/src/native/index.native' {
|
declare module 'doric/lib/src/native/index.native' {
|
||||||
@ -871,40 +870,6 @@ declare module 'doric/lib/src/widget/switch' {
|
|||||||
export function switchView(config: ISwitch): Switch;
|
export function switchView(config: ISwitch): Switch;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'doric/lib/src/widget/flexScroller' {
|
|
||||||
import { View, IView, Group } from 'doric/lib/src/ui/view';
|
|
||||||
import { BridgeContext } from 'doric/lib/src/runtime/global';
|
|
||||||
export function flexScroller(views: View[], config?: IFlexScroller): FlexScroller;
|
|
||||||
export interface IFlexScroller extends IView {
|
|
||||||
contentOffset?: {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
export class FlexScroller extends Group implements IFlexScroller {
|
|
||||||
contentOffset?: {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
};
|
|
||||||
onScroll?: (offset: {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
}) => void;
|
|
||||||
onScrollEnd?: (offset: {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
}) => void;
|
|
||||||
scrollTo(context: BridgeContext, offset: {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
}, animated?: boolean): Promise<any>;
|
|
||||||
scrollBy(context: BridgeContext, offset: {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
}, animated?: boolean): Promise<any>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'doric/lib/src/native/modal' {
|
declare module 'doric/lib/src/native/modal' {
|
||||||
import { BridgeContext } from "doric/lib/src/runtime/global";
|
import { BridgeContext } from "doric/lib/src/runtime/global";
|
||||||
import { Gravity } from "doric/lib/src/util/gravity";
|
import { Gravity } from "doric/lib/src/util/gravity";
|
||||||
|
1
doric-js/lib/src/widget/index.widget.d.ts
vendored
1
doric-js/lib/src/widget/index.widget.d.ts
vendored
@ -10,4 +10,3 @@ export * from './input';
|
|||||||
export * from './nestedSlider';
|
export * from './nestedSlider';
|
||||||
export * from './draggable';
|
export * from './draggable';
|
||||||
export * from './switch';
|
export * from './switch';
|
||||||
export * from './flexScroller';
|
|
||||||
|
@ -25,4 +25,3 @@ export * from './input';
|
|||||||
export * from './nestedSlider';
|
export * from './nestedSlider';
|
||||||
export * from './draggable';
|
export * from './draggable';
|
||||||
export * from './switch';
|
export * from './switch';
|
||||||
export * from './flexScroller';
|
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright [2019] [Doric.Pub]
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
import { View, IView, Property, Group } from '../ui/view'
|
|
||||||
import { layoutConfig } from '../util/layoutconfig'
|
|
||||||
import { BridgeContext } from '../runtime/global'
|
|
||||||
|
|
||||||
export function flexScroller(views: View[], config?: IFlexScroller) {
|
|
||||||
const ret = new FlexScroller
|
|
||||||
ret.layoutConfig = layoutConfig().fit()
|
|
||||||
for (let v of views) {
|
|
||||||
ret.addChild(v)
|
|
||||||
}
|
|
||||||
if (config) {
|
|
||||||
for (let key in config) {
|
|
||||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IFlexScroller extends IView {
|
|
||||||
contentOffset?: { x: number, y: number }
|
|
||||||
}
|
|
||||||
|
|
||||||
export class FlexScroller extends Group implements IFlexScroller {
|
|
||||||
|
|
||||||
@Property
|
|
||||||
contentOffset?: { x: number, y: number }
|
|
||||||
|
|
||||||
@Property
|
|
||||||
onScroll?: (offset: { x: number, y: number }) => void
|
|
||||||
|
|
||||||
@Property
|
|
||||||
onScrollEnd?: (offset: { x: number, y: number }) => void
|
|
||||||
|
|
||||||
scrollTo(context: BridgeContext, offset: { x: number, y: number }, animated?: boolean) {
|
|
||||||
return this.nativeChannel(context, "scrollTo")({ offset, animated })
|
|
||||||
}
|
|
||||||
|
|
||||||
scrollBy(context: BridgeContext, offset: { x: number, y: number }, animated?: boolean) {
|
|
||||||
return this.nativeChannel(context, "scrollBy")({ offset, animated })
|
|
||||||
}
|
|
||||||
}
|
|
@ -24,5 +24,4 @@ export * from './flowlayout'
|
|||||||
export * from './input'
|
export * from './input'
|
||||||
export * from './nestedSlider'
|
export * from './nestedSlider'
|
||||||
export * from './draggable'
|
export * from './draggable'
|
||||||
export * from './switch'
|
export * from './switch'
|
||||||
export * from './flexScroller'
|
|
45
doric-web/dist/index.js
vendored
45
doric-web/dist/index.js
vendored
@ -3489,49 +3489,6 @@ function switchView(config) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
||||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
||||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
||||||
};
|
|
||||||
var __metadata$e = (undefined && undefined.__metadata) || function (k, v) {
|
|
||||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
||||||
};
|
|
||||||
function flexScroller(views, config) {
|
|
||||||
const ret = new FlexScroller;
|
|
||||||
ret.layoutConfig = layoutConfig().fit();
|
|
||||||
for (let v of views) {
|
|
||||||
ret.addChild(v);
|
|
||||||
}
|
|
||||||
if (config) {
|
|
||||||
for (let key in config) {
|
|
||||||
Reflect.set(ret, key, Reflect.get(config, key, config), ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
class FlexScroller extends Group {
|
|
||||||
scrollTo(context, offset, animated) {
|
|
||||||
return this.nativeChannel(context, "scrollTo")({ offset, animated });
|
|
||||||
}
|
|
||||||
scrollBy(context, offset, animated) {
|
|
||||||
return this.nativeChannel(context, "scrollBy")({ offset, animated });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
__decorate$e([
|
|
||||||
Property,
|
|
||||||
__metadata$e("design:type", Object)
|
|
||||||
], FlexScroller.prototype, "contentOffset", void 0);
|
|
||||||
__decorate$e([
|
|
||||||
Property,
|
|
||||||
__metadata$e("design:type", Function)
|
|
||||||
], FlexScroller.prototype, "onScroll", void 0);
|
|
||||||
__decorate$e([
|
|
||||||
Property,
|
|
||||||
__metadata$e("design:type", Function)
|
|
||||||
], FlexScroller.prototype, "onScrollEnd", void 0);
|
|
||||||
|
|
||||||
function modal(context) {
|
function modal(context) {
|
||||||
return {
|
return {
|
||||||
toast: (msg, gravity = Gravity.Bottom) => {
|
toast: (msg, gravity = Gravity.Bottom) => {
|
||||||
@ -4008,7 +3965,6 @@ exports.CENTER_Y = CENTER_Y;
|
|||||||
exports.Color = Color;
|
exports.Color = Color;
|
||||||
exports.Draggable = Draggable;
|
exports.Draggable = Draggable;
|
||||||
exports.FlexLayout = FlexLayout;
|
exports.FlexLayout = FlexLayout;
|
||||||
exports.FlexScroller = FlexScroller;
|
|
||||||
exports.FlowLayout = FlowLayout;
|
exports.FlowLayout = FlowLayout;
|
||||||
exports.FlowLayoutItem = FlowLayoutItem;
|
exports.FlowLayoutItem = FlowLayoutItem;
|
||||||
exports.Gravity = Gravity;
|
exports.Gravity = Gravity;
|
||||||
@ -4049,7 +4005,6 @@ exports.ViewModel = ViewModel;
|
|||||||
exports.animate = animate;
|
exports.animate = animate;
|
||||||
exports.coordinator = coordinator;
|
exports.coordinator = coordinator;
|
||||||
exports.draggable = draggable;
|
exports.draggable = draggable;
|
||||||
exports.flexScroller = flexScroller;
|
|
||||||
exports.flexlayout = flexlayout;
|
exports.flexlayout = flexlayout;
|
||||||
exports.flowItem = flowItem;
|
exports.flowItem = flowItem;
|
||||||
exports.flowlayout = flowlayout;
|
exports.flowlayout = flowlayout;
|
||||||
|
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