jsbox-cview 1.6.6 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/components/alert/input-alert.d.ts +22 -0
- package/dist/components/alert/login-alert.d.ts +21 -0
- package/dist/components/alert/plain-alert.d.ts +15 -0
- package/dist/components/alert/uialert.d.ts +29 -0
- package/{components/base.ts → dist/components/base.d.ts} +9 -28
- package/dist/components/custom-navigation-bar.d.ts +117 -0
- package/dist/components/dialogs/dialog-sheet.d.ts +46 -0
- package/dist/components/dialogs/dialog-sheet.js +3 -1
- package/dist/components/dialogs/form-dialog.d.ts +15 -0
- package/dist/components/dialogs/list-dialog.d.ts +23 -0
- package/dist/components/dialogs/list-dialog.js +1 -1
- package/dist/components/dialogs/text-dialog.d.ts +13 -0
- package/dist/components/dynamic-contextmenu-view.d.ts +40 -0
- package/dist/components/dynamic-itemsize-matrix.d.ts +79 -0
- package/dist/components/dynamic-itemsize-matrix.js +1 -0
- package/dist/components/dynamic-itemsize-section-matrix.d.ts +115 -0
- package/dist/components/dynamic-preference-listview.d.ts +63 -0
- package/dist/components/dynamic-rowheight-list.d.ts +38 -0
- package/dist/components/enhanced-imageview.d.ts +41 -0
- package/dist/components/flowlayout.d.ts +63 -0
- package/dist/components/image-pager.d.ts +49 -0
- package/dist/components/oc-webview.d.ts +64 -0
- package/dist/components/page-control.d.ts +45 -0
- package/dist/components/pageviewer-titlebar.d.ts +48 -0
- package/dist/components/pageviewer.d.ts +41 -0
- package/dist/components/refresh-button.d.ts +25 -0
- package/dist/components/rotating-view.d.ts +45 -0
- package/dist/components/searchbar.d.ts +118 -0
- package/dist/components/sheet.d.ts +42 -0
- package/dist/components/single-views.d.ts +289 -0
- package/dist/components/spinners/loading-dual-ring.d.ts +18 -0
- package/dist/components/spinners/loading-wedges.d.ts +15 -0
- package/dist/components/spinners/spinner-androidstyle.d.ts +30 -0
- package/dist/components/static-preference-listview.d.ts +389 -0
- package/dist/components/symbol-button.d.ts +39 -0
- package/dist/components/tabbar.d.ts +140 -0
- package/dist/controller/base-controller.d.ts +125 -0
- package/dist/controller/base-controller.js +11 -11
- package/dist/controller/controller-router.d.ts +48 -0
- package/dist/controller/pageviewer-controller.d.ts +38 -0
- package/dist/controller/presented-page-controller.d.ts +41 -0
- package/dist/controller/splitview-controller.d.ts +90 -0
- package/dist/controller/splitview-controller.js +4 -0
- package/dist/controller/tabbar-controller.d.ts +49 -0
- package/dist/controller/tabbar-controller.js +0 -2
- package/{index.ts → dist/index.d.ts} +1 -0
- package/dist/index.js +1 -0
- package/dist/utils/colors.d.ts +7 -0
- package/dist/utils/cvid.d.ts +11 -0
- package/dist/utils/l10n.d.ts +1 -0
- package/dist/utils/path.d.ts +8 -0
- package/dist/utils/rect.d.ts +38 -0
- package/dist/utils/uitools.d.ts +75 -0
- package/package.json +20 -6
- package/.prettierignore +0 -6
- package/.prettierrc +0 -3
- package/components/alert/input-alert.ts +0 -64
- package/components/alert/login-alert.ts +0 -66
- package/components/alert/plain-alert.ts +0 -39
- package/components/alert/uialert.ts +0 -107
- package/components/custom-navigation-bar.ts +0 -579
- package/components/dialogs/dialog-sheet.ts +0 -111
- package/components/dialogs/form-dialog.ts +0 -63
- package/components/dialogs/list-dialog.ts +0 -119
- package/components/dialogs/text-dialog.ts +0 -44
- package/components/dynamic-contextmenu-view.ts +0 -115
- package/components/dynamic-itemsize-matrix.ts +0 -206
- package/components/dynamic-itemsize-section-matrix.ts +0 -363
- package/components/dynamic-preference-listview.ts +0 -684
- package/components/dynamic-rowheight-list.ts +0 -77
- package/components/enhanced-imageview.ts +0 -132
- package/components/flowlayout.ts +0 -248
- package/components/image-pager.ts +0 -180
- package/components/oc-webview.ts +0 -177
- package/components/page-control.ts +0 -93
- package/components/pageviewer-titlebar.ts +0 -166
- package/components/pageviewer.ts +0 -125
- package/components/refresh-button.ts +0 -83
- package/components/rotating-view.ts +0 -133
- package/components/searchbar.ts +0 -398
- package/components/sheet.ts +0 -104
- package/components/single-views.ts +0 -956
- package/components/spinners/loading-dual-ring.ts +0 -97
- package/components/spinners/loading-wedges.ts +0 -106
- package/components/spinners/spinner-androidstyle.ts +0 -269
- package/components/static-preference-listview.ts +0 -1282
- package/components/symbol-button.ts +0 -108
- package/components/tabbar.ts +0 -453
- package/controller/base-controller.ts +0 -214
- package/controller/controller-router.ts +0 -73
- package/controller/pageviewer-controller.ts +0 -93
- package/controller/presented-page-controller.ts +0 -76
- package/controller/splitview-controller.ts +0 -359
- package/controller/tabbar-controller.ts +0 -131
- package/dist/test/custom-navigation-bar.js +0 -40
- package/dist/test/dialog-sheet.js +0 -40
- package/dist/test/dynamic-contextmenu-view.js +0 -66
- package/dist/test/dynamic-itemsize-matrix.js +0 -74
- package/dist/test/dynamic-itemsize-section-matrix.js +0 -138
- package/dist/test/dynamic-preference-listview.js +0 -150
- package/dist/test/flowlayout.js +0 -76
- package/dist/test/form-dialog.js +0 -51
- package/dist/test/oc-webview.js +0 -195
- package/dist/test/pageviewer-controller.js +0 -20
- package/dist/test/pageviewer-titlebar.js +0 -18
- package/dist/test/pageviewer.js +0 -32
- package/dist/test/refresh-button.js +0 -26
- package/dist/test/searchbar.js +0 -36
- package/dist/test/splitview-controller.js +0 -41
- package/dist/test/static-preference-listview.js +0 -143
- package/dist/test/tabbar-controller.js +0 -48
- package/test/custom-navigation-bar.ts +0 -40
- package/test/dialog-sheet.ts +0 -40
- package/test/dynamic-contextmenu-view.ts +0 -67
- package/test/dynamic-itemsize-matrix.ts +0 -74
- package/test/dynamic-itemsize-section-matrix.ts +0 -142
- package/test/dynamic-preference-listview.ts +0 -151
- package/test/flowlayout.ts +0 -79
- package/test/form-dialog.ts +0 -48
- package/test/oc-webview.ts +0 -197
- package/test/pageviewer-controller.ts +0 -21
- package/test/pageviewer-titlebar.ts +0 -18
- package/test/pageviewer.ts +0 -31
- package/test/refresh-button.ts +0 -26
- package/test/searchbar.ts +0 -38
- package/test/splitview-controller.ts +0 -42
- package/test/static-preference-listview.ts +0 -142
- package/test/tabbar-controller.ts +0 -49
- package/tsconfig.json +0 -122
- package/utils/colors.ts +0 -17
- package/utils/cvid.ts +0 -32
- package/utils/l10n.ts +0 -42
- package/utils/path.ts +0 -97
- package/utils/rect.ts +0 -90
- package/utils/uitools.ts +0 -122
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
import { PreferenceSection } from "./static-preference-listview";
|
|
3
|
+
interface CunstomProps extends UiTypes.ListProps {
|
|
4
|
+
stringLeftInset?: number;
|
|
5
|
+
infoAndLinkLeftInset?: number;
|
|
6
|
+
sliderWidth?: number;
|
|
7
|
+
tabWidth?: number;
|
|
8
|
+
symbolSizeForSymbolAction?: JBSize;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* # cview PreferenceListView_dynamic
|
|
12
|
+
*
|
|
13
|
+
* 便捷的设置列表实现. 样式以及功能均以 PreferenceListView_static 为准.
|
|
14
|
+
*
|
|
15
|
+
* 优势在于:
|
|
16
|
+
*
|
|
17
|
+
* - 可以实现 sections 重新写入.
|
|
18
|
+
*
|
|
19
|
+
* 劣势在于:
|
|
20
|
+
*
|
|
21
|
+
* - 由于每个 cell 不能单独布局, 因此标题和内容的长度无法动态调整, 在两者都比较短的情况下没有问题, 长了布局可能会重叠.
|
|
22
|
+
* - 不能真正实现 selectable 为 false, 分割线仍然会闪动
|
|
23
|
+
*
|
|
24
|
+
* 为了缓解上面的问题, 让修改布局无需调整源代码, 增加下列 props:
|
|
25
|
+
*
|
|
26
|
+
* - stringLeftInset?: number = 120 将同时作用于 string, number, integer, list, date
|
|
27
|
+
* 但是由于后四者内容可控, 可视为只作用于 string
|
|
28
|
+
* - infoAndLinkLeftInset?: number = 120 作用于 info, link
|
|
29
|
+
* - sliderWidth?: number = 200 作用于 slider
|
|
30
|
+
* - tabWidth?: number = 200 作用于 tab
|
|
31
|
+
* - symbolSizeForSymbolAction?: size = $size(24, 24) 作用于symbol-action
|
|
32
|
+
* 注意以上的修改是应用于 template, 而不是应用于单个 cell 的
|
|
33
|
+
*
|
|
34
|
+
* 独特方法:
|
|
35
|
+
*
|
|
36
|
+
* - cview.sections = sections 可以写入新的 sections
|
|
37
|
+
*/
|
|
38
|
+
export declare class DynamicPreferenceListView extends Base<UIListView, UiTypes.ListOptions> {
|
|
39
|
+
_defineView: () => UiTypes.ListOptions;
|
|
40
|
+
private _sections;
|
|
41
|
+
private _props;
|
|
42
|
+
constructor({ sections, props, layout, events, }: {
|
|
43
|
+
sections: PreferenceSection[];
|
|
44
|
+
props: CunstomProps;
|
|
45
|
+
layout?: (make: MASConstraintMaker, view: UIListView) => void;
|
|
46
|
+
events?: {
|
|
47
|
+
changed?: (values: any) => void;
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
_handleText(text: string, type: string): number | undefined;
|
|
51
|
+
_handleSliderValue(num?: number, decimal?: number, min?: number, max?: number): number;
|
|
52
|
+
_map(sections: PreferenceSection[]): {
|
|
53
|
+
title: string;
|
|
54
|
+
rows: any[];
|
|
55
|
+
}[];
|
|
56
|
+
get sections(): PreferenceSection[];
|
|
57
|
+
set sections(sections: PreferenceSection[]);
|
|
58
|
+
get values(): {
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
};
|
|
61
|
+
set(key: string, value: any): void;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
interface DynamicRowHeightListProps extends Omit<UiTypes.ListProps, "data" | "template"> {
|
|
3
|
+
}
|
|
4
|
+
interface DynamicRowHeightListEvents extends Omit<UiTypes.ListEvents, "rowHeight"> {
|
|
5
|
+
}
|
|
6
|
+
interface DynamicRowHeightListCView extends Base<any, any> {
|
|
7
|
+
heightToWidth: (width: number) => number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* # cview Dynamic RowHeight List
|
|
11
|
+
*
|
|
12
|
+
* 可以自动更新 rowHeight 的 list
|
|
13
|
+
*
|
|
14
|
+
* 核心策略为 list 的所有行均为 cview,且每一个 cview 需要实现一个方法:
|
|
15
|
+
* heightToWidth(width: number) => number
|
|
16
|
+
* 通过这个方法汇报自己在某个宽度的时候所需要的高度,这必须任何时候均立即可用;
|
|
17
|
+
*
|
|
18
|
+
* 特别参数
|
|
19
|
+
* sections: {title: string, rows: cview[]}[]
|
|
20
|
+
* rows: cview[]
|
|
21
|
+
* 两者不能同时存在,否则rows不起作用
|
|
22
|
+
*
|
|
23
|
+
* 除了 props.data, props.template 和 events.rowHeight 不可用,其他均和 list 一致
|
|
24
|
+
*/
|
|
25
|
+
export declare class DynamicRowHeightList extends Base<UIListView, UiTypes.ListOptions> {
|
|
26
|
+
_defineView: () => UiTypes.ListOptions;
|
|
27
|
+
constructor({ sections, rows, props, layout, events, }: {
|
|
28
|
+
sections?: {
|
|
29
|
+
title: string;
|
|
30
|
+
rows: DynamicRowHeightListCView[];
|
|
31
|
+
}[];
|
|
32
|
+
rows?: DynamicRowHeightListCView[];
|
|
33
|
+
props: DynamicRowHeightListProps;
|
|
34
|
+
layout: (make: MASConstraintMaker, view: UIListView) => void;
|
|
35
|
+
events: DynamicRowHeightListEvents;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
/**
|
|
3
|
+
* 此组件是为了加强 imageView,实现以下目的:
|
|
4
|
+
* 1. 点击实现上下翻页
|
|
5
|
+
* 2. 双指放大缩小(但不可以双击放大缩小)
|
|
6
|
+
*
|
|
7
|
+
* 请注意:此组件使用了Runtime代码重新设置了Tapped事件。
|
|
8
|
+
* 与以前使用touchesEnded事件来实现相比,可以避免在滑动手指时误触发。
|
|
9
|
+
* 但因此带来了副作用:必须在关闭前通过releaseGestureObject释放掉此视图中自定义的NSObject,
|
|
10
|
+
* 否则再次启动可能会有问题。
|
|
11
|
+
*
|
|
12
|
+
* Props:
|
|
13
|
+
* src: string, 图片地址
|
|
14
|
+
* maxZoomScale: number, 最大缩放倍数,默认为2
|
|
15
|
+
*
|
|
16
|
+
* Events:
|
|
17
|
+
* upperLocationTouched: (sender: EnhancedImageView) => void, 上半部分被点击
|
|
18
|
+
* lowerLocationTouched: (sender: EnhancedImageView) => void, 下半部分被点击
|
|
19
|
+
*/
|
|
20
|
+
export declare class EnhancedImageView extends Base<UIView, UiTypes.ViewOptions> {
|
|
21
|
+
private _props;
|
|
22
|
+
private _scroll;
|
|
23
|
+
private _gestureObject;
|
|
24
|
+
_defineView: () => UiTypes.ViewOptions;
|
|
25
|
+
constructor({ props, layout, events, }: {
|
|
26
|
+
props: {
|
|
27
|
+
src: string;
|
|
28
|
+
maxZoomScale?: number;
|
|
29
|
+
};
|
|
30
|
+
layout: (make: MASConstraintMaker, view: UIView) => void;
|
|
31
|
+
events?: {
|
|
32
|
+
upperLocationTouched?: (sender: EnhancedImageView) => void;
|
|
33
|
+
lowerLocationTouched?: (sender: EnhancedImageView) => void;
|
|
34
|
+
};
|
|
35
|
+
});
|
|
36
|
+
private _addGesture;
|
|
37
|
+
releaseGestureObject(): void;
|
|
38
|
+
get src(): string;
|
|
39
|
+
set src(src: string);
|
|
40
|
+
get image(): UIImage;
|
|
41
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
/**
|
|
3
|
+
* 流式布局:间距固定,项目高度固定但宽度不定,左对齐,自动换行,不能滚动。
|
|
4
|
+
*
|
|
5
|
+
* 注意事项:
|
|
6
|
+
* 1. 此控件默认是可变高度的,但前提是布局中必须有关于高度的约束。
|
|
7
|
+
* 如果不需要可变高度,可以设置fixedHeight为true
|
|
8
|
+
* 1. 此控件的边缘是不留白的,这和Matrix不同
|
|
9
|
+
* 2. itemWidth 如果超过总宽度,会被设定为总宽度
|
|
10
|
+
* 3. maxRows 可以控制最大行数,如果超过则会被截断
|
|
11
|
+
*
|
|
12
|
+
* ## 属性
|
|
13
|
+
* 属性的写法尽可能和Matrix的风格保持一致
|
|
14
|
+
* - items: FlowlayoutItem[] 关键参数,必须实现一个方法itemWidth(): number, 用于告知自身理想的宽度
|
|
15
|
+
* - spacing: number
|
|
16
|
+
* - itemHeight: number
|
|
17
|
+
* - maxRows?: number
|
|
18
|
+
* - fixedHeight?: boolean
|
|
19
|
+
* - menu?: UiTypes.ContextMenuOptions
|
|
20
|
+
* - bgcolor?: UIColor
|
|
21
|
+
*
|
|
22
|
+
* ## 事件
|
|
23
|
+
* - didSelect: (sender: Flowlayout, index: number, item: FlowlayoutItem) => void
|
|
24
|
+
* - didLongPress: (sender: Flowlayout, index: number, item: FlowlayoutItem) => void
|
|
25
|
+
*
|
|
26
|
+
* ## 方法
|
|
27
|
+
* - heightToWidth(width: number): height: number 根据宽度计算其应有的高度
|
|
28
|
+
* - cell(index: number): FlowlayoutItem 获取对应位置的 cview
|
|
29
|
+
* - set items(items: FlowlayoutItem[]) 设置子视图
|
|
30
|
+
* - get items(): FlowlayoutItem[] 获取子视图
|
|
31
|
+
*/
|
|
32
|
+
export declare class Flowlayout<T extends FlowlayoutItem> extends Base<UIView, UiTypes.ViewOptions> {
|
|
33
|
+
private _width;
|
|
34
|
+
private _props;
|
|
35
|
+
private _wrappers;
|
|
36
|
+
private _events?;
|
|
37
|
+
_defineView: () => UiTypes.ViewOptions;
|
|
38
|
+
constructor({ props, layout, events, }: {
|
|
39
|
+
props: {
|
|
40
|
+
items: T[];
|
|
41
|
+
spacing: number;
|
|
42
|
+
itemHeight: number;
|
|
43
|
+
fixedRows?: number;
|
|
44
|
+
fixedHeight?: boolean;
|
|
45
|
+
menu?: UiTypes.ContextMenuOptions<UIView>;
|
|
46
|
+
bgcolor?: UIColor;
|
|
47
|
+
};
|
|
48
|
+
layout: (make: MASConstraintMaker, view: UIView) => void;
|
|
49
|
+
events?: {
|
|
50
|
+
didSelect?: (sender: Flowlayout<T>, index: number, item: T) => void;
|
|
51
|
+
didLongPress?: (sender: Flowlayout<T>, index: number, item: T) => void;
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
cell(index: number): T;
|
|
55
|
+
get items(): T[];
|
|
56
|
+
set items(items: T[]);
|
|
57
|
+
_layoutWrappers(): number;
|
|
58
|
+
heightToWidth(width: number): number;
|
|
59
|
+
}
|
|
60
|
+
interface FlowlayoutItem extends Base<any, any> {
|
|
61
|
+
itemWidth: () => number;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
import { Matrix } from "./single-views";
|
|
3
|
+
/**
|
|
4
|
+
* 图片浏览组件
|
|
5
|
+
*
|
|
6
|
+
* 与内置的Gallery组件相比,ImagePager组件可以动态刷新,
|
|
7
|
+
* 适用于图片数量较多的场景,以及需要动态加载图片列表的场景
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare class ImagePager extends Base<UIView, UiTypes.ViewOptions> {
|
|
11
|
+
_props: {
|
|
12
|
+
srcs: string[];
|
|
13
|
+
page: number;
|
|
14
|
+
doubleTapToZoom: boolean;
|
|
15
|
+
};
|
|
16
|
+
_matrix: Matrix;
|
|
17
|
+
_pageLoadRecorder: {
|
|
18
|
+
[key: number]: boolean;
|
|
19
|
+
};
|
|
20
|
+
_defineView: () => UiTypes.ViewOptions;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param props
|
|
24
|
+
* - srcs: string[] - 图片地址列表
|
|
25
|
+
* - page: number - 当前页码
|
|
26
|
+
* - doubleTapToZoom: boolean - 是否双击放大,默认为true
|
|
27
|
+
* @param layout
|
|
28
|
+
* @param events
|
|
29
|
+
* - changed: (page: number) => void - 页码变化时触发
|
|
30
|
+
* - tapped: (sender: ImagePager) => void - 点击图片时触发
|
|
31
|
+
*/
|
|
32
|
+
constructor({ props, layout, events, }: {
|
|
33
|
+
props: {
|
|
34
|
+
srcs?: string[];
|
|
35
|
+
page?: number;
|
|
36
|
+
doubleTapToZoom?: boolean;
|
|
37
|
+
};
|
|
38
|
+
layout: (make: MASConstraintMaker, view: UIView) => void;
|
|
39
|
+
events: {
|
|
40
|
+
changed?: (page: number) => void;
|
|
41
|
+
tapped?: (sender: ImagePager) => void;
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
loadsrc(page: number, forced?: boolean): void;
|
|
45
|
+
get page(): number;
|
|
46
|
+
get currentImage(): UIImage | undefined;
|
|
47
|
+
set page(page: number);
|
|
48
|
+
scrollToPage(page: number): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
/**
|
|
3
|
+
* # OCWebView
|
|
4
|
+
*
|
|
5
|
+
* 通过OC Runtime构建的Web视图,该控件是为了解决UIWebView无法通过CloudFlare人机检测的问题
|
|
6
|
+
* (TIPS:推测JSBox的网页视图实际上运行在一个iframe中,所以会出现该问题)
|
|
7
|
+
*
|
|
8
|
+
* ## Argumnets
|
|
9
|
+
*
|
|
10
|
+
* props:
|
|
11
|
+
* - url: string
|
|
12
|
+
*
|
|
13
|
+
* layout
|
|
14
|
+
*
|
|
15
|
+
* events:
|
|
16
|
+
* - didStart?: (sender: any) => void;
|
|
17
|
+
* - didFinish?: (sender: any) => void;
|
|
18
|
+
* - didFail?: (sender: any, error: NSError | null) => void;
|
|
19
|
+
*
|
|
20
|
+
* events中sender的any类型实际为WKWebView OC类型
|
|
21
|
+
*
|
|
22
|
+
* ## Methods
|
|
23
|
+
*
|
|
24
|
+
* - url
|
|
25
|
+
* - canGoBack
|
|
26
|
+
* - canGoForward
|
|
27
|
+
* - goBack()
|
|
28
|
+
* - goForward()
|
|
29
|
+
* - stopLoading()
|
|
30
|
+
* - reload()
|
|
31
|
+
* - evaluateJavaScript(script)
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export declare class OCWebView extends Base<UIView, UiTypes.RuntimeOptions> {
|
|
35
|
+
_defineView: () => UiTypes.RuntimeOptions;
|
|
36
|
+
webView: any;
|
|
37
|
+
private _originUrl;
|
|
38
|
+
constructor({ props, layout, events, }: {
|
|
39
|
+
props: {
|
|
40
|
+
url: string;
|
|
41
|
+
};
|
|
42
|
+
events: {
|
|
43
|
+
didStart?: (sender: any) => void;
|
|
44
|
+
didFinish?: (sender: any) => void;
|
|
45
|
+
didFail?: (sender: any, error: NSError | null) => void;
|
|
46
|
+
};
|
|
47
|
+
layout: (make: MASConstraintMaker, view: UIView) => void;
|
|
48
|
+
});
|
|
49
|
+
get url(): string;
|
|
50
|
+
set url(urlStr: string);
|
|
51
|
+
get title(): string;
|
|
52
|
+
get canGoBack(): boolean;
|
|
53
|
+
get canGoForward(): boolean;
|
|
54
|
+
goBack(): void;
|
|
55
|
+
goForward(): void;
|
|
56
|
+
stopLoading(): void;
|
|
57
|
+
reload(): void;
|
|
58
|
+
reloadFromOrigin(): void;
|
|
59
|
+
exec<T = any>(script: string): Promise<T>;
|
|
60
|
+
eval({ script, handler }: {
|
|
61
|
+
script: string;
|
|
62
|
+
handler: (result: any, error?: NSError) => void;
|
|
63
|
+
}): void;
|
|
64
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Runtime } from "./single-views";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* 基于 Runtime 构建 PageControl
|
|
5
|
+
*
|
|
6
|
+
* 请注意本视图如果没有足够的横向宽度,会显示不全
|
|
7
|
+
*
|
|
8
|
+
* @property currentPage: number
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare class PageControl extends Runtime {
|
|
12
|
+
private _numberOfPages;
|
|
13
|
+
private _currentPage;
|
|
14
|
+
private _pageIndicatorTintColor?;
|
|
15
|
+
private _currentPageIndicatorTintColor?;
|
|
16
|
+
private _changed?;
|
|
17
|
+
private _pageControl;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param props 属性
|
|
21
|
+
* - numberOfPages: 页面数量
|
|
22
|
+
* - currentPage: 当前页面
|
|
23
|
+
* - pageIndicatorTintColor?: 页面指示器颜色
|
|
24
|
+
* - currentPageIndicatorTintColor?: 当前页面指示器颜色
|
|
25
|
+
* @param layout 布局
|
|
26
|
+
* @param events 事件
|
|
27
|
+
* - changed: (sender: PageControl, currentPage: number) => void
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
constructor({ props, layout, events, }: {
|
|
31
|
+
props: {
|
|
32
|
+
numberOfPages?: number;
|
|
33
|
+
currentPage?: number;
|
|
34
|
+
pageIndicatorTintColor?: UIColor;
|
|
35
|
+
currentPageIndicatorTintColor?: UIColor;
|
|
36
|
+
};
|
|
37
|
+
layout: (make: MASConstraintMaker, view: UIView) => void;
|
|
38
|
+
events?: {
|
|
39
|
+
changed?: (sender: PageControl, currentPage: number) => void;
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
_createPageControl(): any;
|
|
43
|
+
get currentPage(): number;
|
|
44
|
+
set currentPage(num: number);
|
|
45
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
import { ContentView, Label, Stack } from "./single-views";
|
|
3
|
+
interface PageViewerTitleBarProps {
|
|
4
|
+
items: string[];
|
|
5
|
+
index?: number;
|
|
6
|
+
selectedItemColor?: UIColor;
|
|
7
|
+
defaultItemColor?: UIColor;
|
|
8
|
+
}
|
|
9
|
+
interface PageViewerTitleBarEvents extends UiTypes.BaseViewEvents {
|
|
10
|
+
changed?: (cview: PageViewerTitleBar, index: number) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* [PageViewer](./pageviewer.ts)配套的标题栏
|
|
14
|
+
* @property index: number
|
|
15
|
+
*/
|
|
16
|
+
export declare class PageViewerTitleBar extends Base<UIView, UiTypes.ViewOptions> {
|
|
17
|
+
private _props;
|
|
18
|
+
private _floatedIndex;
|
|
19
|
+
private _lineStartLocationPercentage;
|
|
20
|
+
labels: Label[];
|
|
21
|
+
stack: Stack;
|
|
22
|
+
placeholderView: ContentView;
|
|
23
|
+
line: ContentView;
|
|
24
|
+
_defineView: () => UiTypes.ViewOptions;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param props 属性
|
|
28
|
+
* - items: string[]
|
|
29
|
+
* - index: number
|
|
30
|
+
* - selectedItemColor
|
|
31
|
+
* - defaultItemColor
|
|
32
|
+
* @param layout 布局
|
|
33
|
+
* @param events 事件
|
|
34
|
+
* - changed: (cview, index) => void 在点击变更 index 的时候回调
|
|
35
|
+
*/
|
|
36
|
+
constructor({ props, layout, events, }: {
|
|
37
|
+
props: PageViewerTitleBarProps;
|
|
38
|
+
layout: (make: MASConstraintMaker, view: UIView) => void;
|
|
39
|
+
events: PageViewerTitleBarEvents;
|
|
40
|
+
});
|
|
41
|
+
get lineStartLocationPercentage(): number;
|
|
42
|
+
set lineStartLocationPercentage(percent: number);
|
|
43
|
+
get floatedIndex(): number;
|
|
44
|
+
set floatedIndex(floatedIndex: number);
|
|
45
|
+
get index(): number;
|
|
46
|
+
set index(index: number);
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
import { Scroll } from "./single-views";
|
|
3
|
+
/**
|
|
4
|
+
* 与JSBox内置的Gallery功能类似,但是效果更好,可以伴随翻页实现联动效果
|
|
5
|
+
* 参见[pageviewer-titlebar.ts](./pageviewer-titlebar.ts)
|
|
6
|
+
*
|
|
7
|
+
* @property page: number 当前页码(无动画效果)
|
|
8
|
+
* @method scrollToPage(page: number) 滚动到某一页(带有动画效果)
|
|
9
|
+
*/
|
|
10
|
+
export declare class PageViewer extends Base<UIView, UiTypes.ViewOptions> {
|
|
11
|
+
private _props;
|
|
12
|
+
private _events;
|
|
13
|
+
private _pageWidth;
|
|
14
|
+
private _floatPage;
|
|
15
|
+
scroll: Scroll;
|
|
16
|
+
_defineView: () => UiTypes.ViewOptions;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param props 属性
|
|
20
|
+
* - page: number
|
|
21
|
+
* - cviews: Base<any, any>[]
|
|
22
|
+
* @param layout 布局
|
|
23
|
+
* @param events 事件
|
|
24
|
+
* - changed: (cview, page) => void 页面改变时回调
|
|
25
|
+
* - floatPageChanged: (cview, floatPage) => void 滚动时回调(用于绑定其他联合滚动的控件)
|
|
26
|
+
*/
|
|
27
|
+
constructor({ props, layout, events, }: {
|
|
28
|
+
props: {
|
|
29
|
+
page?: number;
|
|
30
|
+
cviews: Base<any, any>[];
|
|
31
|
+
};
|
|
32
|
+
layout: (make: MASConstraintMaker, view: UIView) => void;
|
|
33
|
+
events: {
|
|
34
|
+
changed?: (cview: PageViewer, page: number) => void;
|
|
35
|
+
floatPageChanged?: (cview: PageViewer, floatPage: number) => void;
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
get page(): number;
|
|
39
|
+
set page(page: number);
|
|
40
|
+
scrollToPage(page: number): void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
/**
|
|
3
|
+
* 创建一个刷新按钮,平时显示一个刷新的symbol,刷新时显示一个loading的symbol
|
|
4
|
+
* props:
|
|
5
|
+
* - tintColor
|
|
6
|
+
* - enabled
|
|
7
|
+
* - hidden
|
|
8
|
+
* events:
|
|
9
|
+
* - tapped
|
|
10
|
+
*/
|
|
11
|
+
export declare class RefreshButton extends Base<UIButtonView, UiTypes.ButtonOptions> {
|
|
12
|
+
_defineView: () => UiTypes.ButtonOptions;
|
|
13
|
+
_loading: boolean;
|
|
14
|
+
constructor({ props, layout, events, }: {
|
|
15
|
+
props?: {
|
|
16
|
+
tintColor?: UIColor;
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
hidden?: boolean;
|
|
19
|
+
};
|
|
20
|
+
layout?: (make: MASConstraintMaker, view: UIButtonView) => void;
|
|
21
|
+
events?: UiTypes.BaseViewEvents<UIButtonView>;
|
|
22
|
+
});
|
|
23
|
+
get loading(): boolean;
|
|
24
|
+
set loading(value: boolean);
|
|
25
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
interface RotatingViewProps {
|
|
3
|
+
image?: UIImage;
|
|
4
|
+
tintColor?: UIColor;
|
|
5
|
+
contentMode?: number;
|
|
6
|
+
cview?: Base<any, any>;
|
|
7
|
+
rps?: number;
|
|
8
|
+
clockwise?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 创建一个可以旋转的视图。理论上来说,这个视图的布局必须是方形的。
|
|
12
|
+
*
|
|
13
|
+
* @method startRotating() 开始旋转
|
|
14
|
+
* @method stopRotating() 结束旋转,请注意旋转是不能立即结束的,必须等到动画归位
|
|
15
|
+
*/
|
|
16
|
+
export declare class RotatingView extends Base<UIView, UiTypes.ViewOptions> {
|
|
17
|
+
private _props;
|
|
18
|
+
private _rotatingFlag;
|
|
19
|
+
private _innerView;
|
|
20
|
+
_defineView: () => UiTypes.ViewOptions;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param props 属性
|
|
24
|
+
* - image: UIImage
|
|
25
|
+
* - tintColor: UIColor
|
|
26
|
+
* - contentMode = 1
|
|
27
|
+
* - cview 使用自定义的cview,如果设置上面三项将失效
|
|
28
|
+
* - rps = 0.5 每秒转多少圈
|
|
29
|
+
* - clockwise = true 是否顺时针旋转
|
|
30
|
+
* @param layout 布局
|
|
31
|
+
* @param events 事件
|
|
32
|
+
* - ready?: (cview: RotatingView) => void 默认的ready事件是自动开始旋转;也可以手动指定其他效果
|
|
33
|
+
*/
|
|
34
|
+
constructor({ props, layout, events, }: {
|
|
35
|
+
props: RotatingViewProps;
|
|
36
|
+
layout: (make: MASConstraintMaker, view: UIView) => void;
|
|
37
|
+
events: {
|
|
38
|
+
ready?: (cview: RotatingView) => void;
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
startRotating(): void;
|
|
42
|
+
stopRotating(): void;
|
|
43
|
+
_rotateView(view: AllUIView): void;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
import { Input, Label, ContentView } from "./single-views";
|
|
3
|
+
interface SearchBarProps {
|
|
4
|
+
placeholder: string;
|
|
5
|
+
cancelText: string;
|
|
6
|
+
tintColor: UIColor;
|
|
7
|
+
bgcolor: UIColor;
|
|
8
|
+
style: 0 | 1 | 2;
|
|
9
|
+
accessoryCview?: Base<any, any>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 搜索框
|
|
13
|
+
*
|
|
14
|
+
* 有三种样式可供选择,通过 style 属性设置
|
|
15
|
+
*
|
|
16
|
+
* @method focus() 聚焦
|
|
17
|
+
* @method blur() 失焦
|
|
18
|
+
* @property text: string 文本
|
|
19
|
+
*/
|
|
20
|
+
export declare class SearchBar extends Base<UIView, UiTypes.ViewOptions> {
|
|
21
|
+
_props: SearchBarProps;
|
|
22
|
+
_defineView: () => UiTypes.ViewOptions;
|
|
23
|
+
cviews: {
|
|
24
|
+
input: Input;
|
|
25
|
+
iconInput: ContentView;
|
|
26
|
+
cancelButton: Label;
|
|
27
|
+
bgview: ContentView;
|
|
28
|
+
};
|
|
29
|
+
_layouts: {
|
|
30
|
+
iconInput: {
|
|
31
|
+
normal: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
32
|
+
focused?: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
33
|
+
};
|
|
34
|
+
cancelButton: {
|
|
35
|
+
normal: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
36
|
+
};
|
|
37
|
+
bgview: {
|
|
38
|
+
normal: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
39
|
+
focused?: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
_focused: boolean;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param props 属性
|
|
46
|
+
* - text: string
|
|
47
|
+
* - style: number 搜索框的样式
|
|
48
|
+
* - 0: 取消按钮在输入框内,聚焦时显示取消按钮
|
|
49
|
+
* - 1: 取消按钮在输入框右侧,聚焦时会有左右移动的动画
|
|
50
|
+
* - 2: 取消按钮布局同 1,但是 placeholder 平时显示在中间,聚焦时才会移动到左边。
|
|
51
|
+
* 如果使用此样式,建议每次 blur 的时候都清除 text。
|
|
52
|
+
* - accessoryCview: cview 请通过下面的事件来和 SearchBar 互相操作
|
|
53
|
+
* - placeholder: string
|
|
54
|
+
* - cancelText: string
|
|
55
|
+
* - tintColor: \$color("systemLink")
|
|
56
|
+
* - bgcolor: colors.searchBarBgcolor
|
|
57
|
+
* @param layout 布局
|
|
58
|
+
* @param events 事件
|
|
59
|
+
* - didBeginEditing: cview => void
|
|
60
|
+
* - didEndEditing: cview => void
|
|
61
|
+
* - changed: cview => void
|
|
62
|
+
* - returned: cview => void
|
|
63
|
+
*/
|
|
64
|
+
constructor({ props, layout, events, }: {
|
|
65
|
+
props: Partial<SearchBarProps>;
|
|
66
|
+
layout: (make: MASConstraintMaker, view: UIView) => void;
|
|
67
|
+
events?: {
|
|
68
|
+
didBeginEditing?: (cview: SearchBar) => void;
|
|
69
|
+
didEndEditing?: (cview: SearchBar) => void;
|
|
70
|
+
changed?: (cview: SearchBar) => void;
|
|
71
|
+
returned?: (cview: SearchBar) => void;
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
_defineLayouts(cancelButtonWidth: number, placeholderWidth: number): {
|
|
75
|
+
iconInput: {
|
|
76
|
+
normal: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
77
|
+
focused: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
78
|
+
};
|
|
79
|
+
cancelButton: {
|
|
80
|
+
normal: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
81
|
+
};
|
|
82
|
+
bgview: {
|
|
83
|
+
normal: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
84
|
+
focused?: undefined;
|
|
85
|
+
};
|
|
86
|
+
} | {
|
|
87
|
+
iconInput: {
|
|
88
|
+
normal: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
89
|
+
focused?: undefined;
|
|
90
|
+
};
|
|
91
|
+
cancelButton: {
|
|
92
|
+
normal: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
93
|
+
};
|
|
94
|
+
bgview: {
|
|
95
|
+
normal: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
96
|
+
focused: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
97
|
+
};
|
|
98
|
+
} | {
|
|
99
|
+
iconInput: {
|
|
100
|
+
normal: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
101
|
+
focused: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
102
|
+
};
|
|
103
|
+
cancelButton: {
|
|
104
|
+
normal: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
105
|
+
};
|
|
106
|
+
bgview: {
|
|
107
|
+
normal: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
108
|
+
focused: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
_onFocused(): void;
|
|
112
|
+
_onBlurred(): void;
|
|
113
|
+
focus(): void;
|
|
114
|
+
blur(): void;
|
|
115
|
+
set text(text: string);
|
|
116
|
+
get text(): string;
|
|
117
|
+
}
|
|
118
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* 创建新的 UIViewController,主要用于 formSheet 和 pageSheet
|
|
5
|
+
*
|
|
6
|
+
* ## 参数:
|
|
7
|
+
* - presentMode: number, default: 1, pageSheet: 1, formSheet: 2
|
|
8
|
+
* - animated: boolean = true 是否启用动画效果
|
|
9
|
+
* - interactiveDismissalDisabled: boolean = false 是否禁用下拉退出
|
|
10
|
+
* - bgcolor: $color $color("secondarySurface")
|
|
11
|
+
* - cview: Cview
|
|
12
|
+
* - dismissalHandler: function 退出时的回调
|
|
13
|
+
*
|
|
14
|
+
* ## 方法:
|
|
15
|
+
* - present()
|
|
16
|
+
* - dismiss()
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
export declare class Sheet<T extends Base<U, R>, U extends AllUIView, R extends UiTypes.AllViewOptions> {
|
|
20
|
+
id: string;
|
|
21
|
+
_animated: boolean;
|
|
22
|
+
_presentMode: number;
|
|
23
|
+
_interactiveDismissalDisabled: boolean;
|
|
24
|
+
_bgcolor: UIColor;
|
|
25
|
+
_cview?: T;
|
|
26
|
+
_dismissalHandler?: () => void;
|
|
27
|
+
_PSViewController: any;
|
|
28
|
+
_PSViewControllerView: any;
|
|
29
|
+
constructor({ presentMode, animated, interactiveDismissalDisabled, bgcolor, cview, dismissalHandler, }: {
|
|
30
|
+
presentMode?: number;
|
|
31
|
+
animated?: boolean;
|
|
32
|
+
interactiveDismissalDisabled?: boolean;
|
|
33
|
+
bgcolor?: UIColor;
|
|
34
|
+
cview?: T;
|
|
35
|
+
dismissalHandler?: () => void;
|
|
36
|
+
});
|
|
37
|
+
_create(): void;
|
|
38
|
+
_define(): void;
|
|
39
|
+
_add(cview: T): void;
|
|
40
|
+
present(): void;
|
|
41
|
+
dismiss(): void;
|
|
42
|
+
}
|