jsbox-cview 1.3.5 → 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.
Files changed (79) hide show
  1. package/components/alert/input-alert.ts +12 -6
  2. package/components/alert/login-alert.ts +11 -7
  3. package/components/alert/plain-alert.ts +9 -6
  4. package/components/alert/uialert.ts +3 -4
  5. package/components/base.ts +3 -4
  6. package/components/custom-navigation-bar.ts +52 -53
  7. package/components/dialogs/dialog-sheet.ts +10 -15
  8. package/components/dialogs/form-dialog.ts +5 -7
  9. package/components/dialogs/list-dialog.ts +9 -6
  10. package/components/dialogs/text-dialog.ts +7 -6
  11. package/components/dynamic-itemsize-matrix.ts +25 -26
  12. package/components/dynamic-preference-listview.ts +29 -31
  13. package/components/dynamic-rowheight-list.ts +10 -11
  14. package/components/enhanced-imageview.ts +4 -4
  15. package/components/flowlayout.ts +233 -0
  16. package/components/image-pager.ts +16 -10
  17. package/components/page-control.ts +16 -13
  18. package/components/pageviewer-titlebar.ts +15 -16
  19. package/components/pageviewer.ts +16 -15
  20. package/components/rotating-view.ts +27 -22
  21. package/components/searchbar.ts +30 -25
  22. package/components/sheet.ts +16 -17
  23. package/components/single-views.ts +107 -105
  24. package/components/spinners/loading-dual-ring.ts +15 -8
  25. package/components/spinners/loading-wedges.ts +8 -4
  26. package/components/spinners/spinner-androidstyle.ts +15 -16
  27. package/components/static-preference-listview.ts +94 -95
  28. package/components/symbol-button.ts +16 -30
  29. package/components/tabbar.ts +24 -25
  30. package/controller/base-controller.ts +57 -58
  31. package/controller/controller-router.ts +2 -3
  32. package/controller/pageviewer-controller.ts +16 -15
  33. package/controller/presented-page-controller.ts +14 -13
  34. package/controller/splitview-controller.ts +22 -13
  35. package/controller/tabbar-controller.ts +15 -15
  36. package/dist/components/alert/input-alert.js +12 -5
  37. package/dist/components/alert/login-alert.js +10 -5
  38. package/dist/components/alert/plain-alert.js +9 -5
  39. package/dist/components/alert/uialert.js +3 -3
  40. package/dist/components/base.js +4 -4
  41. package/dist/components/custom-navigation-bar.js +30 -30
  42. package/dist/components/dialogs/dialog-sheet.js +9 -12
  43. package/dist/components/dialogs/form-dialog.js +5 -5
  44. package/dist/components/dialogs/list-dialog.js +9 -5
  45. package/dist/components/dialogs/text-dialog.js +7 -5
  46. package/dist/components/dynamic-itemsize-matrix.js +15 -15
  47. package/dist/components/dynamic-preference-listview.js +4 -4
  48. package/dist/components/dynamic-rowheight-list.js +3 -3
  49. package/dist/components/enhanced-imageview.js +3 -3
  50. package/dist/components/flowlayout.js +184 -0
  51. package/dist/components/image-pager.js +14 -9
  52. package/dist/components/page-control.js +21 -18
  53. package/dist/components/pageviewer-titlebar.js +15 -15
  54. package/dist/components/pageviewer.js +16 -14
  55. package/dist/components/rotating-view.js +24 -19
  56. package/dist/components/searchbar.js +29 -24
  57. package/dist/components/sheet.js +13 -14
  58. package/dist/components/single-views.js +5 -5
  59. package/dist/components/spinners/loading-dual-ring.js +12 -5
  60. package/dist/components/spinners/loading-wedges.js +7 -3
  61. package/dist/components/spinners/spinner-androidstyle.js +13 -15
  62. package/dist/components/static-preference-listview.js +94 -94
  63. package/dist/components/symbol-button.js +0 -14
  64. package/dist/components/tabbar.js +24 -24
  65. package/dist/controller/base-controller.js +36 -36
  66. package/dist/controller/controller-router.js +2 -2
  67. package/dist/controller/pageviewer-controller.js +10 -8
  68. package/dist/controller/presented-page-controller.js +8 -6
  69. package/dist/controller/splitview-controller.js +19 -12
  70. package/dist/controller/tabbar-controller.js +3 -3
  71. package/dist/index.js +1 -2
  72. package/dist/test/flowlayout.js +74 -0
  73. package/index.ts +1 -2
  74. package/package.json +1 -1
  75. package/test/flowlayout.ts +77 -0
  76. package/components/artificial-flowlayout.ts +0 -321
  77. package/components/spinners/loading-double-rings.ts +0 -121
  78. package/dist/components/artificial-flowlayout.js +0 -258
  79. package/dist/components/spinners/loading-double-rings.js +0 -104
@@ -1,98 +1,3 @@
1
- /**
2
- * # cview PreferenceListView_static
3
- *
4
- * 便捷的设置列表实现. 其所有 cell 均为静态 cell, 可以同时使用 list 控件的 props(除了 template, data)和 events(除了 didSelect), 同时具有独特方法 set(key, value), 以及独特方法 changed
5
- *
6
- * sections 为 Array, 里面的 section 定义:
7
- *
8
- * - title?: string 标题.
9
- * - rows: {type: string}[] 内容
10
- *
11
- * row定义:
12
- *
13
- * - 通用:
14
- *
15
- * - type: string 类型. 包括'string', 'number', 'integer', 'stepper','boolean', 'slider', 'list', 'tab', 'interactive-info', 'info', 'link', 'action'
16
- * - key?: string 键. 如没有则不会返回其值.
17
- * - title?: string 标题
18
- * - value?: any 在下面专项里详解.
19
- * - titleColor?: $color = $color("primaryText") 标题颜色
20
- *
21
- * - string:
22
- *
23
- * - value?: string
24
- * - placeholder?: string
25
- * - textColor?: $color = $color("primaryText")
26
- *
27
- * - number, integer:
28
- *
29
- * - value?: number
30
- * - placeholder?: string
31
- * - textColor?: $color = $color("primaryText")
32
- * - min?: number 最小值
33
- * - max?: number 最大值
34
- *
35
- * - stepper:
36
- *
37
- * - value?: number
38
- * - placeholder?: string
39
- * - min?: number 最小值
40
- * - max?: number 最大值
41
- *
42
- * - boolean:
43
- *
44
- * - value?: boolean
45
- * - onColor?: $color = $color("#34C85A")
46
- * - thumbColor
47
- *
48
- * - slider:
49
- *
50
- * - value?: number 即 slider.value
51
- * - decimal?: number = 1 精度
52
- * - min?: number
53
- * - max?: number
54
- * - minColor?: $color = $color("systemLink")
55
- * - maxColor?: $color
56
- * - thumbColor?: $color
57
- *
58
- * - list:
59
- *
60
- * - value?: number 即 index, -1 时为不选
61
- * - items?: string[]
62
- *
63
- * - tab:
64
- *
65
- * - value?: number 即 index, -1 时为不选
66
- * - items?: string[]
67
- *
68
- * - info:
69
- *
70
- * - value?: string
71
- *
72
- * - interactive-info:
73
- *
74
- * - value?: string
75
- * - copyable?: boolean = false
76
- *
77
- * - link:
78
- *
79
- * - value?: string url
80
- *
81
- * - action:
82
- *
83
- * - value?: function 点击后会执行的函数
84
- * - destructive?: boolean = false 是否为危险动作,若是则为红色
85
- *
86
- * Methods:
87
- *
88
- * - set(key, value) 设定 key 对应的 value
89
- * - cview.values 获取全部的 values
90
- *
91
- * Events:
92
- *
93
- * - changed: values => {}
94
- */
95
-
96
1
  import { Base } from "./base";
97
2
  import { getTextWidth } from "../utils/uitools";
98
3
 
@@ -881,6 +786,100 @@ class ActionCell extends Cell {
881
786
  }
882
787
  }
883
788
 
789
+ /**
790
+ * # cview PreferenceListView_static
791
+ *
792
+ * 便捷的设置列表实现. 其所有 cell 均为静态 cell, 可以同时使用 list 控件的 props(除了 template, data)和 events(除了 didSelect), 同时具有独特方法 set(key, value), 以及独特方法 changed
793
+ *
794
+ * sections 为 Array, 里面的 section 定义:
795
+ *
796
+ * - title?: string 标题.
797
+ * - rows: {type: string}[] 内容
798
+ *
799
+ * row定义:
800
+ *
801
+ * - 通用:
802
+ *
803
+ * - type: string 类型. 包括'string', 'number', 'integer', 'stepper','boolean', 'slider', 'list', 'tab', 'interactive-info', 'info', 'link', 'action'
804
+ * - key?: string 键. 如没有则不会返回其值.
805
+ * - title?: string 标题
806
+ * - value?: any 在下面专项里详解.
807
+ * - titleColor?: $color = $color("primaryText") 标题颜色
808
+ *
809
+ * - string:
810
+ *
811
+ * - value?: string
812
+ * - placeholder?: string
813
+ * - textColor?: $color = $color("primaryText")
814
+ *
815
+ * - number, integer:
816
+ *
817
+ * - value?: number
818
+ * - placeholder?: string
819
+ * - textColor?: $color = $color("primaryText")
820
+ * - min?: number 最小值
821
+ * - max?: number 最大值
822
+ *
823
+ * - stepper:
824
+ *
825
+ * - value?: number
826
+ * - placeholder?: string
827
+ * - min?: number 最小值
828
+ * - max?: number 最大值
829
+ *
830
+ * - boolean:
831
+ *
832
+ * - value?: boolean
833
+ * - onColor?: $color = $color("#34C85A")
834
+ * - thumbColor
835
+ *
836
+ * - slider:
837
+ *
838
+ * - value?: number 即 slider.value
839
+ * - decimal?: number = 1 精度
840
+ * - min?: number
841
+ * - max?: number
842
+ * - minColor?: $color = $color("systemLink")
843
+ * - maxColor?: $color
844
+ * - thumbColor?: $color
845
+ *
846
+ * - list:
847
+ *
848
+ * - value?: number 即 index, -1 时为不选
849
+ * - items?: string[]
850
+ *
851
+ * - tab:
852
+ *
853
+ * - value?: number 即 index, -1 时为不选
854
+ * - items?: string[]
855
+ *
856
+ * - info:
857
+ *
858
+ * - value?: string
859
+ *
860
+ * - interactive-info:
861
+ *
862
+ * - value?: string
863
+ * - copyable?: boolean = false
864
+ *
865
+ * - link:
866
+ *
867
+ * - value?: string url
868
+ *
869
+ * - action:
870
+ *
871
+ * - value?: function 点击后会执行的函数
872
+ * - destructive?: boolean = false 是否为危险动作,若是则为红色
873
+ *
874
+ * Methods:
875
+ *
876
+ * - set(key, value) 设定 key 对应的 value
877
+ * - cview.values 获取全部的 values
878
+ *
879
+ * Events:
880
+ *
881
+ * - changed: values => {}
882
+ */
884
883
  export class PreferenceListView extends Base<UIListView, UiTypes.ListOptions> {
885
884
  _defineView: () => UiTypes.ListOptions;
886
885
  _sections: PreferenceSection[];
@@ -1,18 +1,3 @@
1
- /**
2
- * #cview symbolButton
3
- *
4
- * 创建可以自动规范symbol大小的button,兼容image,可以设定insets
5
- *
6
- * props:
7
- * - symbol
8
- * - image
9
- * - tintColor
10
- * - insets
11
- *
12
- * events:
13
- * - tapped
14
- */
15
-
16
1
  import { Base } from "./base";
17
2
 
18
3
  interface SymbolButtonProps extends UiTypes.ButtonProps {
@@ -22,6 +7,7 @@ interface SymbolButtonProps extends UiTypes.ButtonProps {
22
7
  interface SymbolButtonPropsOptional extends UiTypes.ButtonProps {
23
8
  insets?: JBInsets
24
9
  }
10
+
25
11
  /**
26
12
  * 创建可以自动规范symbol大小的button,兼容image,可以设定insets
27
13
  * props:
@@ -35,10 +21,10 @@ interface SymbolButtonPropsOptional extends UiTypes.ButtonProps {
35
21
  export class SymbolButton extends Base<UIButtonView, UiTypes.ButtonOptions> {
36
22
  _props: SymbolButtonProps
37
23
  _defineView: () => UiTypes.ButtonOptions;
38
- constructor({
39
- props,
40
- layout,
41
- events = {}
24
+ constructor({
25
+ props,
26
+ layout,
27
+ events = {}
42
28
  }: {
43
29
  props: SymbolButtonPropsOptional;
44
30
  layout?: (make: MASConstraintMaker, view: UIButtonView) => void;
@@ -52,17 +38,17 @@ export class SymbolButton extends Base<UIButtonView, UiTypes.ButtonOptions> {
52
38
  };
53
39
  this._layout = layout;
54
40
  this._defineView = () => {
55
- const props = this._props.menu
56
- ? {
57
- radius: 0,
58
- bgcolor: $color("clear"),
59
- id: this.id,
60
- menu: this._props.menu,
61
- } : {
62
- radius: 0,
63
- bgcolor: $color("clear"),
64
- id: this.id
65
- }
41
+ const props = this._props.menu
42
+ ? {
43
+ radius: 0,
44
+ bgcolor: $color("clear"),
45
+ id: this.id,
46
+ menu: this._props.menu,
47
+ } : {
48
+ radius: 0,
49
+ bgcolor: $color("clear"),
50
+ id: this.id
51
+ }
66
52
  return {
67
53
  type: "button",
68
54
  props,
@@ -1,28 +1,3 @@
1
- /**
2
- * 本组件是为了仿制 UITabBar
3
- * 本组件不能指定布局而是应该指定 height(如果需要的话)
4
- * 典型的使用方式是添加在布局为$layout.fill的视图中,并指定 items
5
- *
6
- * props:
7
- *
8
- * - 只写 height: number = 50
9
- * - 只写 items: {symbol?: string, image?:UIImage, title?: string}[]
10
- * - 只写 bgcolor?: UIColor 如果不指定则背景使用blur(style 10),若指定则使用纯色视图
11
- * - 读写 index: number = 0
12
- * - 只写 selectedSegmentTintColor = $color("tintColor")
13
- * - 只写 defaultSegmentTintColor = colors.footBarDefaultSegmentColor
14
- *
15
- * events:
16
- *
17
- * - changed: (cview, index) => void
18
- * - doubleTapped: (cview, index) => void
19
- *
20
- * methods:
21
- *
22
- * - hide(animated=true) 隐藏
23
- * - show(animated=true) 显示
24
- */
25
-
26
1
  import { footBarDefaultSegmentColor } from "../utils/colors";
27
2
  import { Base } from "./base";
28
3
 
@@ -230,6 +205,30 @@ class ImageCell extends Base<UIView, UiTypes.ViewOptions> {
230
205
  }
231
206
  }
232
207
 
208
+ /**
209
+ * 本组件是为了仿制 UITabBar
210
+ * 本组件不能指定布局而是应该指定 height(如果需要的话)
211
+ * 典型的使用方式是添加在布局为$layout.fill的视图中,并指定 items
212
+ *
213
+ * props:
214
+ *
215
+ * - 只写 height: number = 50
216
+ * - 只写 items: {symbol?: string, image?:UIImage, title?: string}[]
217
+ * - 只写 bgcolor?: UIColor 如果不指定则背景使用blur(style 10),若指定则使用纯色视图
218
+ * - 读写 index: number = 0
219
+ * - 只写 selectedSegmentTintColor = $color("tintColor")
220
+ * - 只写 defaultSegmentTintColor = colors.footBarDefaultSegmentColor
221
+ *
222
+ * events:
223
+ *
224
+ * - changed: (cview, index) => void
225
+ * - doubleTapped: (cview, index) => void
226
+ *
227
+ * methods:
228
+ *
229
+ * - hide(animated=true) 隐藏
230
+ * - show(animated=true) 显示
231
+ */
233
232
  export class TabBar extends Base<UIView | UIBlurView, UiTypes.ViewOptions | UiTypes.BlurOptions> {
234
233
  _props: {
235
234
  height: number;
@@ -1,3 +1,60 @@
1
+ import { Base } from '../components/base';
2
+ import { ContentView } from '../components/single-views';
3
+ import { cvid } from "../utils/cvid";
4
+ import { router } from "./controller-router";
5
+
6
+ /**
7
+ * status
8
+ * - created = 0 被创建,未被加载
9
+ * - loaded = 1 被加载,显示状态未知
10
+ * - appeared= 2 处于可显示状态
11
+ * - disappeared = 3 处于不显示状态
12
+ * - removed = 4 根视图被移除
13
+ * 其中只有 2 和 3 可以相互转化,其他不可以
14
+ */
15
+ const controllerStatus = {
16
+ created: 0,
17
+ loaded: 1,
18
+ appeared: 2,
19
+ disappeared: 3,
20
+ removed: 4
21
+ };
22
+
23
+ export class ControllerRootView extends ContentView {
24
+ constructor({
25
+ props,
26
+ layout,
27
+ events
28
+ }: {
29
+ props: { bgcolor: UIColor };
30
+ layout: (make: MASConstraintMaker, view: UIView) => void;
31
+ events: { ready: (sender: UIView) => void };
32
+ }) {
33
+ super({ props, layout, events });
34
+ }
35
+
36
+ set views(views: UiTypes.AllViewOptions[] | Base<any, any>[]) {
37
+ const _views: UiTypes.AllViewOptions[] = views.map(v => {
38
+ if (v instanceof Base) return v.definition;
39
+ return v;
40
+ })
41
+ this._views = _views;
42
+ }
43
+ }
44
+
45
+ export interface BaseControllerProps {
46
+ id?: string;
47
+ bgcolor?: UIColor;
48
+ }
49
+
50
+ export interface BaseControllerEvents {
51
+ didCreate?: (controller: BaseController) => void;
52
+ didLoad?: (controller: BaseController) => void;
53
+ didAppear?: (controller: BaseController) => void;
54
+ didDisappear?: (controller: BaseController) => void;
55
+ didRemove?: (controller: BaseController) => void;
56
+ }
57
+
1
58
  /**
2
59
  * # CView Base Controller
3
60
  *
@@ -57,64 +114,6 @@
57
114
  *
58
115
  * - rootView 可以直接通过 rootView.views 设置其_views 属性,其中元素可以为 view 定义也可以为 cview
59
116
  */
60
-
61
- import { Base } from '../components/base';
62
- import { ContentView } from '../components/single-views';
63
- import { cvid } from "../utils/cvid";
64
- import { router } from "./controller-router";
65
-
66
- /**
67
- * status
68
- * - created = 0 被创建,未被加载
69
- * - loaded = 1 被加载,显示状态未知
70
- * - appeared= 2 处于可显示状态
71
- * - disappeared = 3 处于不显示状态
72
- * - removed = 4 根视图被移除
73
- * 其中只有 2 和 3 可以相互转化,其他不可以
74
- */
75
- const controllerStatus = {
76
- created: 0,
77
- loaded: 1,
78
- appeared: 2,
79
- disappeared: 3,
80
- removed: 4
81
- };
82
-
83
- export class ControllerRootView extends ContentView {
84
- constructor({
85
- props,
86
- layout,
87
- events
88
- }: {
89
- props: { bgcolor: UIColor };
90
- layout: (make: MASConstraintMaker, view: UIView) => void;
91
- events: { ready: (sender: UIView) => void };
92
- }) {
93
- super({ props, layout, events });
94
- }
95
-
96
- set views(views: UiTypes.AllViewOptions[] | Base<any, any>[]) {
97
- const _views: UiTypes.AllViewOptions[] = views.map(v => {
98
- if (v instanceof Base) return v.definition;
99
- return v;
100
- })
101
- this._views = _views;
102
- }
103
- }
104
-
105
- export interface BaseControllerProps {
106
- id?: string;
107
- bgcolor?: UIColor;
108
- }
109
-
110
- export interface BaseControllerEvents {
111
- didCreate?: (controller: BaseController) => void;
112
- didLoad?: (controller: BaseController) => void;
113
- didAppear?: (controller: BaseController) => void;
114
- didDisappear?: (controller: BaseController) => void;
115
- didRemove?: (controller: BaseController) => void;
116
- }
117
-
118
117
  export class BaseController {
119
118
  protected _props: BaseControllerProps;
120
119
  protected _events: BaseControllerEvents;
@@ -1,3 +1,5 @@
1
+ import { BaseController } from "./base-controller";
2
+
1
3
  /**
2
4
  * 控制器的路由器,用于管理控制器的集合和操作。
3
5
  *
@@ -12,9 +14,6 @@
12
14
  * - `get(id: string)`:根据控制器的ID获取控制器。
13
15
  *
14
16
  */
15
-
16
- import { BaseController } from "./base-controller";
17
-
18
17
  class Router {
19
18
  private _set: Set<BaseController>;
20
19
  root?: BaseController;
@@ -1,14 +1,3 @@
1
- /**
2
- * # CView PageViewer Controller
3
- *
4
- * 一个可以左右滑动翻页的控制器。
5
- *
6
- * Props:
7
- *
8
- * - items: { controller: Controller, title: string }[]
9
- * - navBarProps: {} 可用于 navBar 的其他属性,不包括 title 和 titleView
10
- */
11
-
12
1
  import { BaseController, BaseControllerProps, BaseControllerEvents, ControllerRootView } from "./base-controller";
13
2
  import { PageViewer } from "../components/pageviewer";
14
3
  import { PageViewerTitleBar } from "../components/pageviewer-titlebar";
@@ -20,6 +9,16 @@ interface PageViewerControllerProps extends BaseControllerProps {
20
9
  index?: number;
21
10
  }
22
11
 
12
+ /**
13
+ * # CView PageViewer Controller
14
+ *
15
+ * 一个可以左右滑动翻页的控制器。
16
+ *
17
+ * Props:
18
+ *
19
+ * - items: { controller: Controller, title: string }[]
20
+ * - navBarProps: {} 可用于 navBar 的其他属性,不包括 title 和 titleView
21
+ */
23
22
  export class PageViewerController extends BaseController {
24
23
  protected _props: PageViewerControllerProps;
25
24
  cviews: {
@@ -32,10 +31,12 @@ export class PageViewerController extends BaseController {
32
31
  layout?: (make: MASConstraintMaker, view: UIView) => void;
33
32
  events?: BaseControllerEvents;
34
33
  }) {
35
- super({ props: {
36
- id: props.id,
37
- bgcolor: props.bgcolor
38
- }, layout, events });
34
+ super({
35
+ props: {
36
+ id: props.id,
37
+ bgcolor: props.bgcolor
38
+ }, layout, events
39
+ });
39
40
  this._props = props;
40
41
  this.cviews = {} as {
41
42
  pageviewer: PageViewer;
@@ -1,3 +1,12 @@
1
+ import { BaseController, BaseControllerProps, BaseControllerEvents, ControllerRootView } from "./base-controller";
2
+ import { Sheet } from "../components/sheet";
3
+
4
+ interface PresentedPageControllerProps extends BaseControllerProps {
5
+ presentMode?: number;
6
+ animated?: boolean;
7
+ interactiveDismissalDisabled?: boolean;
8
+ }
9
+
1
10
  /** # CView PresentedPageController
2
11
  *
3
12
  * ## Props
@@ -15,16 +24,6 @@
15
24
  * ## 布局
16
25
  * 此控制器的 layout 必定为 `$layout.fill`,无需自行设定
17
26
  */
18
-
19
- import { BaseController, BaseControllerProps, BaseControllerEvents, ControllerRootView } from "./base-controller";
20
- import { Sheet } from "../components/sheet";
21
-
22
- interface PresentedPageControllerProps extends BaseControllerProps {
23
- presentMode?: number;
24
- animated?: boolean;
25
- interactiveDismissalDisabled?: boolean;
26
- }
27
-
28
27
  export class PresentedPageController extends BaseController {
29
28
  private _sheet: Sheet<ControllerRootView, UIView, UiTypes.ViewOptions>;
30
29
  constructor({ props, layout, events }: {
@@ -32,9 +31,11 @@ export class PresentedPageController extends BaseController {
32
31
  layout?: (make: MASConstraintMaker, view: UIView) => void;
33
32
  events?: BaseControllerEvents;
34
33
  } = {}) {
35
- super({ props: {
36
- id: props?.id
37
- }, layout, events });
34
+ super({
35
+ props: {
36
+ id: props?.id
37
+ }, layout, events
38
+ });
38
39
  this._sheet = new Sheet<ControllerRootView, UIView, UiTypes.ViewOptions>({
39
40
  presentMode: props?.presentMode || 1,
40
41
  animated: props?.animated || true,
@@ -1,15 +1,3 @@
1
- /** # CView SplitView Controller
2
- *
3
- * 实现左右分栏布局的控制器, 本身不提供除了分割线以外的视觉效果
4
- *
5
- * 此控制器加载后,会禁用原本的ScreenEdgePanGesture,此控制器应该作为根控制器使用
6
- *
7
- * ## Props
8
- *
9
- * - 只写 items: { controller: Controller, bgcolor: UIColor }[] 其中第一个放在主视图上, 第二个放在次视图上
10
- * - 读写 sideBarShown: boolean = false 侧栏是否显示
11
- */
12
-
13
1
  import { BaseController, BaseControllerProps, BaseControllerEvents } from "./base-controller";
14
2
  import { Base } from "../components/base";
15
3
  import { ContentView } from "../components/single-views";
@@ -173,9 +161,21 @@ interface SplitViewControllerProps extends BaseControllerProps {
173
161
  items: { controller: BaseController, bgcolor: UIColor }[];
174
162
  }
175
163
 
164
+ /** # CView SplitView Controller
165
+ *
166
+ * 实现左右分栏布局的控制器, 本身不提供除了分割线以外的视觉效果
167
+ *
168
+ * 此控制器加载后,会禁用原本的ScreenEdgePanGesture,此控制器应该作为根控制器使用
169
+ *
170
+ * ## Props
171
+ *
172
+ * - 只写 items: { controller: Controller, bgcolor: UIColor }[] 其中第一个放在主视图上, 第二个放在次视图上
173
+ * - 读写 sideBarShown: boolean = false 侧栏是否显示
174
+ */
176
175
  export class SplitViewController extends BaseController {
177
176
  private _screenEdgePanGestureObject: any;
178
177
  private _sideBarShown: boolean;
178
+ private _canShowSidebar: boolean;
179
179
  cviews: {
180
180
  primaryView: ContentView;
181
181
  secondaryView: SecondaryView;
@@ -193,6 +193,7 @@ export class SplitViewController extends BaseController {
193
193
  }, layout, events
194
194
  });
195
195
  this._sideBarShown = false;
196
+ this._canShowSidebar = true;
196
197
  this.cviews = {} as {
197
198
  primaryView: ContentView;
198
199
  secondaryView: SecondaryView;
@@ -231,7 +232,7 @@ export class SplitViewController extends BaseController {
231
232
  ]
232
233
  });
233
234
  this._screenEdgePanGestureObject = this._defineGestureObject(() => {
234
- if (!this.sideBarShown) this.sideBarShown = true;
235
+ if (!this.sideBarShown && this._canShowSidebar) this.sideBarShown = true;
235
236
  });
236
237
  this.rootView.views = [this.cviews.secondaryView, this.cviews.primaryView];
237
238
  }
@@ -320,4 +321,12 @@ export class SplitViewController extends BaseController {
320
321
  }
321
322
  this._sideBarShown = bool;
322
323
  }
324
+
325
+ get canShowSidebar() {
326
+ return this._canShowSidebar;
327
+ }
328
+
329
+ set canShowSidebar(bool: boolean) {
330
+ this._canShowSidebar = bool;
331
+ }
323
332
  }
@@ -1,18 +1,3 @@
1
- /**
2
- * # CView TabBar Controller
3
- *
4
- * TabBarController 是一个 PagingController
5
- *
6
- * ## 属性
7
- *
8
- * - items: {title?: string,
9
- * symbol?: string,
10
- * image?: UIImage,
11
- * tintColor?: UIColor,
12
- * bgcolor?: UIColor,
13
- * controller: Controller}[]
14
- * - index: number = 0
15
- */
16
1
  import { BaseController, BaseControllerProps, BaseControllerEvents } from "./base-controller";
17
2
  import { ContentView } from "../components/single-views";
18
3
  import { TabBar } from "../components/tabbar";
@@ -29,6 +14,21 @@ interface TabBarControllerProps extends BaseControllerProps {
29
14
  index?: number;
30
15
  }
31
16
 
17
+ /**
18
+ * # CView TabBar Controller
19
+ *
20
+ * TabBarController 是一个 PagingController
21
+ *
22
+ * ## 属性
23
+ *
24
+ * - items: {title?: string,
25
+ * symbol?: string,
26
+ * image?: UIImage,
27
+ * tintColor?: UIColor,
28
+ * bgcolor?: UIColor,
29
+ * controller: Controller}[]
30
+ * - index: number = 0
31
+ */
32
32
  export class TabBarController extends BaseController {
33
33
  _props: TabBarControllerProps;
34
34
  cviews: {
@@ -1,13 +1,20 @@
1
1
  "use strict";
2
- /**
3
- * # CView InputAlert
4
- *
5
- * 显示一个输入框提示
6
- */
7
2
  Object.defineProperty(exports, "__esModule", { value: true });
8
3
  exports.inputAlert = void 0;
9
4
  const uialert_1 = require("./uialert");
10
5
  const l10n_1 = require("../../utils/l10n");
6
+ /**
7
+ * 显示一个输入框提示
8
+ *
9
+ * @param title 标题
10
+ * @param message 内容
11
+ * @param text 输入框默认文字
12
+ * @param placeholder 输入框占位符
13
+ * @param type 输入框类型
14
+ * @param secure 是否安全输入
15
+ * @param cancelText 取消按钮文字
16
+ * @param confirmText 确认按钮文字
17
+ */
11
18
  function inputAlert({ title = "", message = "", text = "", placeholder, type = 0, secure = false, cancelText = (0, l10n_1.l10n)("CANCEL"), confirmText = (0, l10n_1.l10n)("OK") }) {
12
19
  return new Promise((resolve, reject) => {
13
20
  const alertVC = new uialert_1.UIAlertController(title, message, uialert_1.UIAlertControllerStyle.Alert);