jsbox-cview 1.3.4 → 1.4.0
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/components/alert/input-alert.ts +12 -6
- package/components/alert/login-alert.ts +11 -7
- package/components/alert/plain-alert.ts +9 -6
- package/components/alert/uialert.ts +3 -4
- package/components/base.ts +3 -4
- package/components/custom-navigation-bar.ts +52 -53
- package/components/dialogs/dialog-sheet.ts +10 -15
- package/components/dialogs/form-dialog.ts +5 -7
- package/components/dialogs/list-dialog.ts +9 -6
- package/components/dialogs/text-dialog.ts +7 -6
- package/components/dynamic-itemsize-matrix.ts +25 -26
- package/components/dynamic-preference-listview.ts +29 -31
- package/components/dynamic-rowheight-list.ts +10 -11
- package/components/enhanced-imageview.ts +4 -4
- package/components/flowlayout.ts +233 -0
- package/components/image-pager.ts +16 -10
- package/components/page-control.ts +16 -13
- package/components/pageviewer-titlebar.ts +15 -16
- package/components/pageviewer.ts +16 -15
- package/components/rotating-view.ts +27 -22
- package/components/searchbar.ts +30 -25
- package/components/sheet.ts +16 -17
- package/components/single-views.ts +107 -105
- package/components/spinners/loading-dual-ring.ts +15 -8
- package/components/spinners/loading-wedges.ts +8 -4
- package/components/spinners/spinner-androidstyle.ts +15 -16
- package/components/static-preference-listview.ts +94 -95
- package/components/symbol-button.ts +15 -23
- package/components/tabbar.ts +24 -25
- package/controller/base-controller.ts +57 -58
- package/controller/controller-router.ts +2 -3
- package/controller/pageviewer-controller.ts +16 -15
- package/controller/presented-page-controller.ts +14 -13
- package/controller/splitview-controller.ts +22 -13
- package/controller/tabbar-controller.ts +15 -15
- package/dist/components/alert/input-alert.js +12 -5
- package/dist/components/alert/login-alert.js +10 -5
- package/dist/components/alert/plain-alert.js +9 -5
- package/dist/components/alert/uialert.js +3 -3
- package/dist/components/base.js +4 -4
- package/dist/components/custom-navigation-bar.js +30 -30
- package/dist/components/dialogs/dialog-sheet.js +9 -12
- package/dist/components/dialogs/form-dialog.js +5 -5
- package/dist/components/dialogs/list-dialog.js +9 -5
- package/dist/components/dialogs/text-dialog.js +7 -5
- package/dist/components/dynamic-itemsize-matrix.js +15 -15
- package/dist/components/dynamic-preference-listview.js +4 -4
- package/dist/components/dynamic-rowheight-list.js +3 -3
- package/dist/components/enhanced-imageview.js +3 -3
- package/dist/components/flowlayout.js +184 -0
- package/dist/components/image-pager.js +14 -9
- package/dist/components/page-control.js +21 -18
- package/dist/components/pageviewer-titlebar.js +15 -15
- package/dist/components/pageviewer.js +16 -14
- package/dist/components/rotating-view.js +24 -19
- package/dist/components/searchbar.js +29 -24
- package/dist/components/sheet.js +13 -14
- package/dist/components/single-views.js +5 -5
- package/dist/components/spinners/loading-dual-ring.js +12 -5
- package/dist/components/spinners/loading-wedges.js +7 -3
- package/dist/components/spinners/spinner-androidstyle.js +13 -15
- package/dist/components/static-preference-listview.js +94 -94
- package/dist/components/symbol-button.js +10 -18
- package/dist/components/tabbar.js +24 -24
- package/dist/controller/base-controller.js +36 -36
- package/dist/controller/controller-router.js +2 -2
- package/dist/controller/pageviewer-controller.js +10 -8
- package/dist/controller/presented-page-controller.js +8 -6
- package/dist/controller/splitview-controller.js +19 -12
- package/dist/controller/tabbar-controller.js +3 -3
- package/dist/index.js +1 -2
- package/dist/test/flowlayout.js +74 -0
- package/index.ts +1 -2
- package/package.json +1 -1
- package/test/flowlayout.ts +77 -0
- package/components/artificial-flowlayout.ts +0 -321
- package/components/spinners/loading-double-rings.ts +0 -121
- package/dist/components/artificial-flowlayout.js +0 -258
- package/dist/components/spinners/loading-double-rings.js +0 -104
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* # CView InputAlert
|
|
3
|
-
*
|
|
4
|
-
* 显示一个输入框提示
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import {
|
|
8
2
|
UIAlertActionStyle,
|
|
9
3
|
UIAlertControllerStyle,
|
|
@@ -13,6 +7,18 @@ import {
|
|
|
13
7
|
|
|
14
8
|
import { l10n } from "../../utils/l10n";
|
|
15
9
|
|
|
10
|
+
/**
|
|
11
|
+
* 显示一个输入框提示
|
|
12
|
+
*
|
|
13
|
+
* @param title 标题
|
|
14
|
+
* @param message 内容
|
|
15
|
+
* @param text 输入框默认文字
|
|
16
|
+
* @param placeholder 输入框占位符
|
|
17
|
+
* @param type 输入框类型
|
|
18
|
+
* @param secure 是否安全输入
|
|
19
|
+
* @param cancelText 取消按钮文字
|
|
20
|
+
* @param confirmText 确认按钮文字
|
|
21
|
+
*/
|
|
16
22
|
export function inputAlert({
|
|
17
23
|
title = "",
|
|
18
24
|
message = "",
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* # CView LoginAlert
|
|
3
|
-
*
|
|
4
|
-
* 显示一个登录输入框提示
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import {
|
|
8
2
|
UIAlertActionStyle,
|
|
9
3
|
UIAlertControllerStyle,
|
|
@@ -13,6 +7,16 @@ import {
|
|
|
13
7
|
|
|
14
8
|
import { l10n } from "../../utils/l10n";
|
|
15
9
|
|
|
10
|
+
/**
|
|
11
|
+
* 显示一个登录输入框提示
|
|
12
|
+
*
|
|
13
|
+
* @param title 标题
|
|
14
|
+
* @param message 内容
|
|
15
|
+
* @param placeholder1 输入框1的占位符
|
|
16
|
+
* @param placeholder2 输入框2的占位符
|
|
17
|
+
* @param cancelText 取消按钮文字
|
|
18
|
+
* @param confirmText 确认按钮文字
|
|
19
|
+
*/
|
|
16
20
|
export function loginAlert({
|
|
17
21
|
title = "",
|
|
18
22
|
message = "",
|
|
@@ -27,7 +31,7 @@ export function loginAlert({
|
|
|
27
31
|
placeholder2?: string;
|
|
28
32
|
cancelText?: string;
|
|
29
33
|
confirmText?: string;
|
|
30
|
-
|
|
34
|
+
} = {}): Promise<{ username: string; password: string }> {
|
|
31
35
|
return new Promise((resolve, reject) => {
|
|
32
36
|
const alertVC = new UIAlertController(
|
|
33
37
|
title,
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* # CView PlainAlert
|
|
3
|
-
*
|
|
4
|
-
* 显示一个文字提示
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import {
|
|
8
2
|
UIAlertActionStyle,
|
|
9
3
|
UIAlertControllerStyle,
|
|
@@ -13,6 +7,15 @@ import {
|
|
|
13
7
|
|
|
14
8
|
import { l10n } from "../../utils/l10n";
|
|
15
9
|
|
|
10
|
+
/**
|
|
11
|
+
* 显示一个文字提示
|
|
12
|
+
*
|
|
13
|
+
* @param title 标题
|
|
14
|
+
* @param message 内容
|
|
15
|
+
* @param cancelText 取消按钮文字
|
|
16
|
+
* @param confirmText 确认按钮文字
|
|
17
|
+
* @returns Promise
|
|
18
|
+
*/
|
|
16
19
|
export function plainAlert({
|
|
17
20
|
title = "",
|
|
18
21
|
message = "",
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Alert的基础类
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
export const UIAlertActionStyle = {
|
|
6
2
|
Default: 0,
|
|
7
3
|
Cancel: 1,
|
|
@@ -33,6 +29,9 @@ export class UIAlertAction {
|
|
|
33
29
|
}
|
|
34
30
|
}
|
|
35
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Alert的基础类
|
|
34
|
+
*/
|
|
36
35
|
export class UIAlertController {
|
|
37
36
|
title: string;
|
|
38
37
|
message: string;
|
package/components/base.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { cvid } from '../utils/cvid';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
4
|
+
*
|
|
3
5
|
* 组件 Base 基类,用于创建自定义组件。CView 的所有子类都应该继承自 Base。
|
|
4
6
|
*
|
|
5
7
|
* ## 属性
|
|
@@ -15,9 +17,6 @@
|
|
|
15
17
|
* - 通过组件化的方式,将JSBox view的定义和实例绑定,使用起来更加方便
|
|
16
18
|
* - 可以便利地创建自定义组件
|
|
17
19
|
*/
|
|
18
|
-
|
|
19
|
-
import { cvid } from '../utils/cvid';
|
|
20
|
-
|
|
21
20
|
export abstract class Base<T extends AllUIView, R extends UiTypes.AllViewOptions> {
|
|
22
21
|
readonly id: string;
|
|
23
22
|
private _view?: T;
|
|
@@ -1,56 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* # CView Custom NavigationBar
|
|
3
|
-
*
|
|
4
|
-
* 仿制 navBar
|
|
5
|
-
*
|
|
6
|
-
* ## features:
|
|
7
|
-
*
|
|
8
|
-
* - 拥有隐藏、最小化、普通、扩展四种布局方式
|
|
9
|
-
* - 隐藏: 什么都不显示
|
|
10
|
-
* - 最小化: safeAreaHeight 为 25, 只显示 titleView, 若用 title, font 为\$font(14)
|
|
11
|
-
* - 普通: safeAreaHeight 为 50, 显示 titleView, leftBarButtonItems 或 popButton, rightBarButtonItems, 若用 title, font 为\$font("bold", 17)
|
|
12
|
-
* - 扩展: safeAreaHeight 为 100, 除上面的之外, 再显示一个 toolView
|
|
13
|
-
* - 自动适应全面屏和非全面屏
|
|
14
|
-
*
|
|
15
|
-
* ## Arguments
|
|
16
|
-
*
|
|
17
|
-
* props:
|
|
18
|
-
*
|
|
19
|
-
* - 读写 style: number 0, 1, 2, 3,指定布局
|
|
20
|
-
* - 读写 title: string 但必须使用此种方案才可以在生成后写入,自动创建 Label 作为 titleView
|
|
21
|
-
* - titleView: cview 自定义的 titleView
|
|
22
|
-
* - popButtonEnabled: boolean 返回上一级的按钮,若为 true,则 leftBarButtonItems 忽略
|
|
23
|
-
* - popButtonTitle: string 返回上一级的按钮标题
|
|
24
|
-
* - popToRootEnabled: boolean popButton 是否可以长按返回到顶级
|
|
25
|
-
* - leftBarButtonItems: cview[]
|
|
26
|
-
* | {symbol: string, handler: () => void, tintColor?: UIColor}[]
|
|
27
|
-
* | {title: string, handler: () => void, tintColor?: UIColor}[]
|
|
28
|
-
* | {image: UIImage, handler: () => void, tintColor?: UIColor}[]
|
|
29
|
-
* 如果用的是 cview,其布局将被重新指定,即不需要(也不能)指定布局。可以通过 cview.width 来指定应有的宽度,如果没有此属性,则宽度为 50
|
|
30
|
-
* 建议最多放两个
|
|
31
|
-
* - rightBarButtonItems 定义同上,建议最多放两个
|
|
32
|
-
* - toolView: cview 在 expanded 模式下才会显现的
|
|
33
|
-
* - tintColor: UIColor 这将作用于 title, popButton, 自动创建的 barButton
|
|
34
|
-
* - bgcolor: UIColor 如不设置,则自动使用 blur(style 10),如果设置则没有 blur 效果
|
|
35
|
-
*
|
|
36
|
-
* events:
|
|
37
|
-
*
|
|
38
|
-
* - hidden: cview => void hide()时执行
|
|
39
|
-
* - minimized: cview => void minimize()时执行
|
|
40
|
-
* - restored: cview => void restore()时执行
|
|
41
|
-
* - expanded: cview => void expand()时执行
|
|
42
|
-
* - popHandler: cview => void 返回上一级时执行,需要popButtonEnabled
|
|
43
|
-
* - popToRootHandler: cview => void 返回顶级时执行,需要popButtonEnabled和popToRootEnabled
|
|
44
|
-
* - titleTapped: cview => void 点击标题时执行,需要使用title
|
|
45
|
-
*
|
|
46
|
-
* methods:
|
|
47
|
-
*
|
|
48
|
-
* - hide() 隐藏布局
|
|
49
|
-
* - minimize() 最小化布局
|
|
50
|
-
* - restore() 普通布局
|
|
51
|
-
* - expand() 扩展布局
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
1
|
import { Base } from "./base";
|
|
55
2
|
import { ContentView, Label, Button, Blur } from "./single-views";
|
|
56
3
|
import { SymbolButton } from "./symbol-button";
|
|
@@ -126,6 +73,58 @@ interface NavigationBarCViews {
|
|
|
126
73
|
separator?: ContentView;
|
|
127
74
|
}
|
|
128
75
|
|
|
76
|
+
/**
|
|
77
|
+
* # CView Custom NavigationBar
|
|
78
|
+
*
|
|
79
|
+
* 仿制 navBar
|
|
80
|
+
*
|
|
81
|
+
* ## features:
|
|
82
|
+
*
|
|
83
|
+
* - 拥有隐藏、最小化、普通、扩展四种布局方式
|
|
84
|
+
* - 隐藏: 什么都不显示
|
|
85
|
+
* - 最小化: safeAreaHeight 为 25, 只显示 titleView, 若用 title, font 为\$font(14)
|
|
86
|
+
* - 普通: safeAreaHeight 为 50, 显示 titleView, leftBarButtonItems 或 popButton, rightBarButtonItems, 若用 title, font 为\$font("bold", 17)
|
|
87
|
+
* - 扩展: safeAreaHeight 为 100, 除上面的之外, 再显示一个 toolView
|
|
88
|
+
* - 自动适应全面屏和非全面屏
|
|
89
|
+
*
|
|
90
|
+
* ## Arguments
|
|
91
|
+
*
|
|
92
|
+
* props:
|
|
93
|
+
*
|
|
94
|
+
* - 读写 style: number 0, 1, 2, 3,指定布局
|
|
95
|
+
* - 读写 title: string 但必须使用此种方案才可以在生成后写入,自动创建 Label 作为 titleView
|
|
96
|
+
* - titleView: cview 自定义的 titleView
|
|
97
|
+
* - popButtonEnabled: boolean 返回上一级的按钮,若为 true,则 leftBarButtonItems 忽略
|
|
98
|
+
* - popButtonTitle: string 返回上一级的按钮标题
|
|
99
|
+
* - popToRootEnabled: boolean popButton 是否可以长按返回到顶级
|
|
100
|
+
* - leftBarButtonItems: cview[]
|
|
101
|
+
* | {symbol: string, handler: () => void, tintColor?: UIColor}[]
|
|
102
|
+
* | {title: string, handler: () => void, tintColor?: UIColor}[]
|
|
103
|
+
* | {image: UIImage, handler: () => void, tintColor?: UIColor}[]
|
|
104
|
+
* 如果用的是 cview,其布局将被重新指定,即不需要(也不能)指定布局。可以通过 cview.width 来指定应有的宽度,如果没有此属性,则宽度为 50
|
|
105
|
+
* 建议最多放两个
|
|
106
|
+
* - rightBarButtonItems 定义同上,建议最多放两个
|
|
107
|
+
* - toolView: cview 在 expanded 模式下才会显现的
|
|
108
|
+
* - tintColor: UIColor 这将作用于 title, popButton, 自动创建的 barButton
|
|
109
|
+
* - bgcolor: UIColor 如不设置,则自动使用 blur(style 10),如果设置则没有 blur 效果
|
|
110
|
+
*
|
|
111
|
+
* events:
|
|
112
|
+
*
|
|
113
|
+
* - hidden: cview => void hide()时执行
|
|
114
|
+
* - minimized: cview => void minimize()时执行
|
|
115
|
+
* - restored: cview => void restore()时执行
|
|
116
|
+
* - expanded: cview => void expand()时执行
|
|
117
|
+
* - popHandler: cview => void 返回上一级时执行,需要popButtonEnabled
|
|
118
|
+
* - popToRootHandler: cview => void 返回顶级时执行,需要popButtonEnabled和popToRootEnabled
|
|
119
|
+
* - titleTapped: cview => void 点击标题时执行,需要使用title
|
|
120
|
+
*
|
|
121
|
+
* methods:
|
|
122
|
+
*
|
|
123
|
+
* - hide() 隐藏布局
|
|
124
|
+
* - minimize() 最小化布局
|
|
125
|
+
* - restore() 普通布局
|
|
126
|
+
* - expand() 扩展布局
|
|
127
|
+
*/
|
|
129
128
|
export class CustomNavigationBar extends Base<UIView | UIBlurView, UiTypes.ViewOptions | UiTypes.BlurOptions> {
|
|
130
129
|
_props: NavigationBarProps;
|
|
131
130
|
_events: NavigationBarEvents;
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* # cview DialogSheet
|
|
3
|
-
*
|
|
4
|
-
* dialog所需要的sheet
|
|
5
|
-
*
|
|
6
|
-
* ## 参数
|
|
7
|
-
* - `title` 标题
|
|
8
|
-
* - `cview` CView
|
|
9
|
-
* - `doneHandler` 完成时的回调
|
|
10
|
-
* - `presentMode` presentMode
|
|
11
|
-
* - `bgcolor` 背景颜色
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
1
|
import { Sheet } from "../sheet";
|
|
15
2
|
|
|
16
3
|
import { CustomNavigationBar } from "../custom-navigation-bar";
|
|
@@ -18,8 +5,16 @@ import { l10n } from "../../utils/l10n";
|
|
|
18
5
|
import { ContentView } from "../single-views";
|
|
19
6
|
import { Base } from "../base";
|
|
20
7
|
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
/**
|
|
9
|
+
* dialog所需要的sheet
|
|
10
|
+
*
|
|
11
|
+
* @param title 标题
|
|
12
|
+
* @param cview 内容视图
|
|
13
|
+
* @param doneHandler 完成时的回调
|
|
14
|
+
* @param presentMode 显示模式
|
|
15
|
+
* @param bgcolor 背景颜色
|
|
16
|
+
*/
|
|
17
|
+
export class DialogSheet extends Sheet<ContentView, UIView, UiTypes.ViewOptions> {
|
|
23
18
|
_props: {
|
|
24
19
|
title: string;
|
|
25
20
|
cview: Base<any, any>;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* # CView Form Dialog
|
|
3
|
-
*
|
|
4
|
-
* 显示一个表单
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import { PreferenceListView, PreferenceSection } from "../static-preference-listview";
|
|
8
2
|
import { DialogSheet } from "./dialog-sheet";
|
|
9
3
|
|
|
10
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 显示一个表单
|
|
6
|
+
* @param sections 表单分组, 请参考`PreferenceListView`中的`PreferenceSection`
|
|
7
|
+
* @param title 标题
|
|
8
|
+
*/
|
|
11
9
|
export function formDialog({ sections, title }: { sections: PreferenceSection[]; title: string }) {
|
|
12
10
|
const view = new PreferenceListView({ sections });
|
|
13
11
|
const sheet = new DialogSheet({
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* # CView List Dialog
|
|
3
|
-
*
|
|
4
|
-
* 显示一个列表以供选择
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import { DialogSheet } from './dialog-sheet';
|
|
8
2
|
import { List } from '../single-views';
|
|
9
3
|
|
|
4
|
+
/**
|
|
5
|
+
* 显示一个列表以供选择
|
|
6
|
+
*
|
|
7
|
+
* @param items 选项
|
|
8
|
+
* @param multiSelectEnabled 是否允许多选
|
|
9
|
+
* @param value 默认选中的选项
|
|
10
|
+
* @param values 默认选中的选项, 配合multiSelectEnabled使用
|
|
11
|
+
* @param title 标题
|
|
12
|
+
*/
|
|
10
13
|
export function listDialog({ items, multiSelectEnabled, value, values = [], title }: {
|
|
11
14
|
items: string[];
|
|
12
15
|
multiSelectEnabled?: boolean;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* # CView Text Dialog
|
|
3
|
-
*
|
|
4
|
-
* 返回一个Promise用于输入文本
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import { Text } from "../single-views";
|
|
8
2
|
import { DialogSheet } from "./dialog-sheet";
|
|
9
3
|
|
|
4
|
+
/**
|
|
5
|
+
* 返回一个Promise用于输入文本
|
|
6
|
+
* @param title 标题
|
|
7
|
+
* @param text 初始文本
|
|
8
|
+
* @param placeholder 占位符
|
|
9
|
+
* @param editable 是否可编辑
|
|
10
|
+
*/
|
|
10
11
|
export function textDialog({ title, text = "", placeholder = "", editable = true }: {
|
|
11
12
|
title: string;
|
|
12
13
|
text?: string;
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
import { Base } from './base';
|
|
2
|
+
import { Matrix } from "./single-views";
|
|
3
|
+
|
|
4
|
+
interface DynamicItemSizeMatrixProps extends UiTypes.MatrixProps {
|
|
5
|
+
fixedItemHeight: number;
|
|
6
|
+
minItemWidth: number;
|
|
7
|
+
maxColumns: number;
|
|
8
|
+
spacing: number;
|
|
9
|
+
maxTotalWidth: number;
|
|
10
|
+
dynamicHeightEnabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface DynamicItemSizeMatrixEvents extends UiTypes.MatrixEvents {
|
|
14
|
+
itemHeight?: (width: number) => number;
|
|
15
|
+
heightChanged?: (sender: DynamicItemSizeMatrix, height: number) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface DynamicItemSizeMatrixPropsPartial extends UiTypes.MatrixProps {
|
|
19
|
+
fixedItemHeight?: number;
|
|
20
|
+
minItemWidth?: number;
|
|
21
|
+
maxColumns?: number;
|
|
22
|
+
spacing?: number;
|
|
23
|
+
dynamicHeightEnabled?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
1
26
|
/**
|
|
2
27
|
* # CView Dynamic ItemSize Matrix
|
|
3
28
|
*
|
|
@@ -40,32 +65,6 @@
|
|
|
40
65
|
* 方法:
|
|
41
66
|
* - heightToWidth(width) 计算特定width时的应有的高度
|
|
42
67
|
*/
|
|
43
|
-
|
|
44
|
-
import { Base } from './base';
|
|
45
|
-
import { Matrix } from "./single-views";
|
|
46
|
-
|
|
47
|
-
interface DynamicItemSizeMatrixProps extends UiTypes.MatrixProps {
|
|
48
|
-
fixedItemHeight: number;
|
|
49
|
-
minItemWidth: number;
|
|
50
|
-
maxColumns: number;
|
|
51
|
-
spacing: number;
|
|
52
|
-
maxTotalWidth: number;
|
|
53
|
-
dynamicHeightEnabled?: boolean;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
interface DynamicItemSizeMatrixEvents extends UiTypes.MatrixEvents {
|
|
57
|
-
itemHeight?: (width: number) => number;
|
|
58
|
-
heightChanged?: (sender: DynamicItemSizeMatrix, height: number) => void;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
interface DynamicItemSizeMatrixPropsPartial extends UiTypes.MatrixProps {
|
|
62
|
-
fixedItemHeight?: number;
|
|
63
|
-
minItemWidth?: number;
|
|
64
|
-
maxColumns?: number;
|
|
65
|
-
spacing?: number;
|
|
66
|
-
dynamicHeightEnabled?: boolean;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
68
|
export class DynamicItemSizeMatrix extends Base<UIView, UiTypes.ViewOptions> {
|
|
70
69
|
private _props: DynamicItemSizeMatrixProps;
|
|
71
70
|
private _events: DynamicItemSizeMatrixEvents;
|
|
@@ -1,32 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* # cview PreferenceListView_dynamic
|
|
3
|
-
*
|
|
4
|
-
* 便捷的设置列表实现. 样式以及功能均以 PreferenceListView_static 为准.
|
|
5
|
-
*
|
|
6
|
-
* 优势在于:
|
|
7
|
-
*
|
|
8
|
-
* - 可以实现 sections 重新写入.
|
|
9
|
-
*
|
|
10
|
-
* 劣势在于:
|
|
11
|
-
*
|
|
12
|
-
* - 由于每个 cell 不能单独布局, 因此标题和内容的长度无法动态调整, 在两者都比较短的情况下没有问题, 长了布局可能会重叠.
|
|
13
|
-
* - 不能真正实现 selectable 为 false, 分割线仍然会闪动
|
|
14
|
-
*
|
|
15
|
-
* 为了缓解上面的问题, 让修改布局无需调整源代码, 增加下列 props:
|
|
16
|
-
*
|
|
17
|
-
* - stringLeftInset?: number = 120 将同时作用于 string, number, integer, list, 但是由于后三者内容可控, 可视为只作用于 string
|
|
18
|
-
* - infoAndLinkLeftInset?: number = 120 作用于 info, link
|
|
19
|
-
* - sliderWidth?: number = 200 作用于 slider
|
|
20
|
-
* - tabWidth?: number = 200 作用于 tab
|
|
21
|
-
* 注意以上的修改是应用于 template, 而不是应用于单个 cell 的
|
|
22
|
-
*
|
|
23
|
-
* 独特方法:
|
|
24
|
-
*
|
|
25
|
-
* - cview.sections = sections 可以写入新的 sections
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
1
|
import { Base } from "./base";
|
|
29
|
-
import {
|
|
2
|
+
import {
|
|
30
3
|
PreferenceSection,
|
|
31
4
|
PrefsRow,
|
|
32
5
|
PrefsRowString,
|
|
@@ -43,7 +16,7 @@ import {
|
|
|
43
16
|
PrefsRowAction,
|
|
44
17
|
selectableTypes,
|
|
45
18
|
excludedTypes
|
|
46
|
-
|
|
19
|
+
} from "./static-preference-listview";
|
|
47
20
|
|
|
48
21
|
|
|
49
22
|
interface CunstomProps extends UiTypes.ListProps {
|
|
@@ -60,8 +33,33 @@ interface RequiredCunstomProps extends UiTypes.ListProps {
|
|
|
60
33
|
tabWidth: number;
|
|
61
34
|
}
|
|
62
35
|
|
|
63
|
-
|
|
64
|
-
|
|
36
|
+
/**
|
|
37
|
+
* # cview PreferenceListView_dynamic
|
|
38
|
+
*
|
|
39
|
+
* 便捷的设置列表实现. 样式以及功能均以 PreferenceListView_static 为准.
|
|
40
|
+
*
|
|
41
|
+
* 优势在于:
|
|
42
|
+
*
|
|
43
|
+
* - 可以实现 sections 重新写入.
|
|
44
|
+
*
|
|
45
|
+
* 劣势在于:
|
|
46
|
+
*
|
|
47
|
+
* - 由于每个 cell 不能单独布局, 因此标题和内容的长度无法动态调整, 在两者都比较短的情况下没有问题, 长了布局可能会重叠.
|
|
48
|
+
* - 不能真正实现 selectable 为 false, 分割线仍然会闪动
|
|
49
|
+
*
|
|
50
|
+
* 为了缓解上面的问题, 让修改布局无需调整源代码, 增加下列 props:
|
|
51
|
+
*
|
|
52
|
+
* - stringLeftInset?: number = 120 将同时作用于 string, number, integer, list, 但是由于后三者内容可控, 可视为只作用于 string
|
|
53
|
+
* - infoAndLinkLeftInset?: number = 120 作用于 info, link
|
|
54
|
+
* - sliderWidth?: number = 200 作用于 slider
|
|
55
|
+
* - tabWidth?: number = 200 作用于 tab
|
|
56
|
+
* 注意以上的修改是应用于 template, 而不是应用于单个 cell 的
|
|
57
|
+
*
|
|
58
|
+
* 独特方法:
|
|
59
|
+
*
|
|
60
|
+
* - cview.sections = sections 可以写入新的 sections
|
|
61
|
+
*/
|
|
62
|
+
export class DynamicPreferenceListView extends Base<UIListView, UiTypes.ListOptions> {
|
|
65
63
|
_defineView: () => UiTypes.ListOptions;
|
|
66
64
|
private _sections: PreferenceSection[];
|
|
67
65
|
private _props: RequiredCunstomProps;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { Base } from './base';
|
|
2
|
+
|
|
3
|
+
interface DynamicRowHeightListProps extends Omit<UiTypes.ListProps, "data" | "template"> { }
|
|
4
|
+
interface DynamicRowHeightListEvents extends Omit<UiTypes.ListEvents, "rowHeight"> { }
|
|
5
|
+
interface DynamicRowHeightListCView extends Base<any, any> {
|
|
6
|
+
heightToWidth: (width: number) => number;
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
10
|
* # cview Dynamic RowHeight List
|
|
3
11
|
*
|
|
@@ -13,19 +21,10 @@
|
|
|
13
21
|
*
|
|
14
22
|
* 除了 props.data, props.template 和 events.rowHeight 不可用,其他均和 list 一致
|
|
15
23
|
*/
|
|
16
|
-
|
|
17
|
-
import { Base } from './base';
|
|
18
|
-
|
|
19
|
-
interface DynamicRowHeightListProps extends Omit<UiTypes.ListProps, "data" | "template"> {}
|
|
20
|
-
interface DynamicRowHeightListEvents extends Omit<UiTypes.ListEvents, "rowHeight"> {}
|
|
21
|
-
interface DynamicRowHeightListCView extends Base<any, any> {
|
|
22
|
-
heightToWidth: (width: number) => number;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class DynamicRowHeightList extends Base<UIListView, UiTypes.ListOptions>{
|
|
24
|
+
export class DynamicRowHeightList extends Base<UIListView, UiTypes.ListOptions> {
|
|
26
25
|
_defineView: () => UiTypes.ListOptions;
|
|
27
26
|
constructor({ sections, rows, props, layout, events }: {
|
|
28
|
-
sections?: {title: string, rows: DynamicRowHeightListCView[]}[];
|
|
27
|
+
sections?: { title: string, rows: DynamicRowHeightListCView[] }[];
|
|
29
28
|
rows?: DynamicRowHeightListCView[];
|
|
30
29
|
props: DynamicRowHeightListProps;
|
|
31
30
|
layout: (make: MASConstraintMaker, view: UIListView) => void;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
import { Scroll } from "./single-views";
|
|
3
|
+
import { cvid } from "../utils/cvid";
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* 此组件是为了加强 imageView,实现以下目的:
|
|
3
7
|
* 1. 点击实现上下翻页
|
|
@@ -15,10 +19,6 @@
|
|
|
15
19
|
* upperLocationTouched: (sender: EnhancedImageView) => void, 上半部分被点击
|
|
16
20
|
* lowerLocationTouched: (sender: EnhancedImageView) => void, 下半部分被点击
|
|
17
21
|
*/
|
|
18
|
-
import { Base } from "./base";
|
|
19
|
-
import { Scroll } from "./single-views";
|
|
20
|
-
import { cvid } from "../utils/cvid";
|
|
21
|
-
|
|
22
22
|
export class EnhancedImageView extends Base<UIView, UiTypes.ViewOptions> {
|
|
23
23
|
private _props: { src: string; maxZoomScale: number };
|
|
24
24
|
private _scroll: Scroll;
|