jsbox-cview 1.6.6 → 1.6.8
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 +4 -2
- 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/pageviewer.js +12 -3
- 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 +108 -0
- package/dist/controller/base-controller.js +10 -25
- package/dist/controller/controller-router.d.ts +48 -0
- package/dist/controller/controller-router.js +2 -1
- package/dist/controller/controller-status.d.ts +16 -0
- package/dist/controller/controller-status.js +19 -0
- package/dist/controller/pageviewer-controller.d.ts +38 -0
- package/dist/controller/pageviewer-controller.js +32 -3
- 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 +5 -0
- package/dist/controller/tabbar-controller.d.ts +49 -0
- package/dist/controller/tabbar-controller.js +2 -3
- package/{index.ts → dist/index.d.ts} +2 -0
- package/dist/index.js +2 -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,389 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
type PreferenceCellTypes = "string" | "number" | "integer" | "stepper" | "boolean" | "slider" | "list" | "tab" | "date" | "info" | "interactive-info" | "link" | "symbol-action" | "action";
|
|
3
|
+
export interface PreferenceSection {
|
|
4
|
+
title: string;
|
|
5
|
+
rows: PrefsRow[];
|
|
6
|
+
}
|
|
7
|
+
export type PrefsRow = PrefsRowString | PrefsRowNumber | PrefsRowInteger | PrefsRowStepper | PrefsRowBoolean | PrefsRowSlider | PrefsRowList | PrefsRowTab | PrefsRowDate | PrefsRowInfo | PrefsRowInteractiveInfo | PrefsRowLink | PrefsRowSymbolAction | PrefsRowAction;
|
|
8
|
+
interface PrefsRowBase {
|
|
9
|
+
type: PreferenceCellTypes;
|
|
10
|
+
key?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
titleColor?: UIColor;
|
|
13
|
+
changedEvent?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export interface PrefsRowString extends PrefsRowBase {
|
|
16
|
+
type: "string";
|
|
17
|
+
value?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
textColor?: UIColor;
|
|
20
|
+
}
|
|
21
|
+
export interface PrefsRowNumber extends PrefsRowBase {
|
|
22
|
+
type: "number";
|
|
23
|
+
value?: number;
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
textColor?: UIColor;
|
|
26
|
+
min?: number;
|
|
27
|
+
max?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface PrefsRowInteger extends PrefsRowBase {
|
|
30
|
+
type: "integer";
|
|
31
|
+
value?: number;
|
|
32
|
+
placeholder?: string;
|
|
33
|
+
textColor?: UIColor;
|
|
34
|
+
min?: number;
|
|
35
|
+
max?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface PrefsRowStepper extends PrefsRowBase {
|
|
38
|
+
type: "stepper";
|
|
39
|
+
value?: number;
|
|
40
|
+
min?: number;
|
|
41
|
+
max?: number;
|
|
42
|
+
}
|
|
43
|
+
export interface PrefsRowBoolean extends PrefsRowBase {
|
|
44
|
+
type: "boolean";
|
|
45
|
+
value?: boolean;
|
|
46
|
+
onColor?: UIColor;
|
|
47
|
+
thumbColor?: UIColor;
|
|
48
|
+
}
|
|
49
|
+
export interface PrefsRowSlider extends PrefsRowBase {
|
|
50
|
+
type: "slider";
|
|
51
|
+
value?: number;
|
|
52
|
+
min?: number;
|
|
53
|
+
max?: number;
|
|
54
|
+
decimal?: number;
|
|
55
|
+
minColor?: UIColor;
|
|
56
|
+
maxColor?: UIColor;
|
|
57
|
+
thumbColor?: UIColor;
|
|
58
|
+
}
|
|
59
|
+
export interface PrefsRowList extends PrefsRowBase {
|
|
60
|
+
type: "list";
|
|
61
|
+
value?: number;
|
|
62
|
+
items: string[];
|
|
63
|
+
}
|
|
64
|
+
export interface PrefsRowTab extends PrefsRowBase {
|
|
65
|
+
type: "tab";
|
|
66
|
+
value?: number;
|
|
67
|
+
items: string[];
|
|
68
|
+
}
|
|
69
|
+
export interface PrefsRowDate extends PrefsRowBase {
|
|
70
|
+
type: "date";
|
|
71
|
+
value?: Date;
|
|
72
|
+
min?: Date;
|
|
73
|
+
max?: Date;
|
|
74
|
+
mode?: number;
|
|
75
|
+
interval?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface PrefsRowInfo extends PrefsRowBase {
|
|
78
|
+
type: "info";
|
|
79
|
+
value?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface PrefsRowInteractiveInfo extends PrefsRowBase {
|
|
82
|
+
type: "interactive-info";
|
|
83
|
+
value?: string;
|
|
84
|
+
copyable?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export interface PrefsRowLink extends PrefsRowBase {
|
|
87
|
+
type: "link";
|
|
88
|
+
value?: string;
|
|
89
|
+
}
|
|
90
|
+
export interface PrefsRowSymbolAction extends PrefsRowBase {
|
|
91
|
+
type: "symbol-action";
|
|
92
|
+
symbol?: string;
|
|
93
|
+
tintColor?: UIColor;
|
|
94
|
+
contentMode?: number;
|
|
95
|
+
symbolSize?: JBSize;
|
|
96
|
+
value?: () => void;
|
|
97
|
+
}
|
|
98
|
+
export interface PrefsRowAction extends PrefsRowBase {
|
|
99
|
+
type: "action";
|
|
100
|
+
value?: () => void;
|
|
101
|
+
destructive?: boolean;
|
|
102
|
+
}
|
|
103
|
+
export declare const selectableTypes: string[];
|
|
104
|
+
export declare const excludedTypes: string[];
|
|
105
|
+
type PreferenceValues = {
|
|
106
|
+
[key: string]: any;
|
|
107
|
+
};
|
|
108
|
+
type AllCells = StringCell | NumberCell | IntegerCell | StepperCell | BooleanCell | SliderCell | ListCell | TabCell | DateCell | InteractiveInfoCell | InfoCell | LinkCell | SymbolActionCell | ActionCell;
|
|
109
|
+
declare abstract class Cell extends Base<UIView, UiTypes.ViewOptions> {
|
|
110
|
+
abstract _type: string;
|
|
111
|
+
_key?: string;
|
|
112
|
+
_title?: string;
|
|
113
|
+
_value?: any;
|
|
114
|
+
_values: PreferenceValues;
|
|
115
|
+
_titleColor: UIColor;
|
|
116
|
+
_changedEvent?: () => void;
|
|
117
|
+
_defineView: () => UiTypes.ViewOptions;
|
|
118
|
+
constructor({ key, title, value, titleColor, changedEvent, }: {
|
|
119
|
+
key?: string;
|
|
120
|
+
title?: string;
|
|
121
|
+
value?: any;
|
|
122
|
+
titleColor?: UIColor;
|
|
123
|
+
changedEvent?: () => void;
|
|
124
|
+
}, values: PreferenceValues);
|
|
125
|
+
set value(value: any);
|
|
126
|
+
get value(): any;
|
|
127
|
+
get type(): string;
|
|
128
|
+
get key(): string | undefined;
|
|
129
|
+
abstract _handleValue(value: any): any;
|
|
130
|
+
abstract _defineValueView(): UiTypes.AllViewOptions;
|
|
131
|
+
_defineTitleView(): UiTypes.LabelOptions;
|
|
132
|
+
}
|
|
133
|
+
declare abstract class BaseStringCell extends Cell {
|
|
134
|
+
abstract _type: string;
|
|
135
|
+
_placeholder?: string;
|
|
136
|
+
_textColor?: UIColor;
|
|
137
|
+
constructor(props: PrefsRowString | PrefsRowNumber | PrefsRowInteger, values: PreferenceValues);
|
|
138
|
+
_defineValueView(): UiTypes.AllViewOptions;
|
|
139
|
+
_handleValue(text: string): string | number | undefined;
|
|
140
|
+
abstract _handleText(text: string): string | number | undefined;
|
|
141
|
+
}
|
|
142
|
+
declare class StringCell extends BaseStringCell {
|
|
143
|
+
readonly _type = "string";
|
|
144
|
+
constructor(props: PrefsRowString, values: PreferenceValues);
|
|
145
|
+
_handleText(text: string): string;
|
|
146
|
+
}
|
|
147
|
+
declare class NumberCell extends BaseStringCell {
|
|
148
|
+
readonly _type = "number";
|
|
149
|
+
_min?: number;
|
|
150
|
+
_max?: number;
|
|
151
|
+
constructor(props: PrefsRowNumber, values: PreferenceValues);
|
|
152
|
+
_handleText(text: string): number | undefined;
|
|
153
|
+
}
|
|
154
|
+
declare class IntegerCell extends BaseStringCell {
|
|
155
|
+
readonly _type = "integer";
|
|
156
|
+
_min: number;
|
|
157
|
+
_max?: number;
|
|
158
|
+
constructor(props: PrefsRowInteger, values: PreferenceValues);
|
|
159
|
+
_handleText(text: string): number | undefined;
|
|
160
|
+
}
|
|
161
|
+
declare class StepperCell extends Cell {
|
|
162
|
+
readonly _type = "stepper";
|
|
163
|
+
_max?: number;
|
|
164
|
+
_min: number;
|
|
165
|
+
constructor(props: PrefsRowStepper, values: PreferenceValues);
|
|
166
|
+
_defineValueView(): UiTypes.ViewOptions;
|
|
167
|
+
_handleValue(num: number): number;
|
|
168
|
+
}
|
|
169
|
+
declare class BooleanCell extends Cell {
|
|
170
|
+
readonly _type = "boolean";
|
|
171
|
+
_onColor: UIColor;
|
|
172
|
+
_thumbColor?: UIColor;
|
|
173
|
+
constructor(props: PrefsRowBoolean, values: PreferenceValues);
|
|
174
|
+
_defineValueView(): UiTypes.SwitchOptions;
|
|
175
|
+
_handleValue(bool: boolean): boolean;
|
|
176
|
+
}
|
|
177
|
+
declare class SliderCell extends Cell {
|
|
178
|
+
readonly _type = "slider";
|
|
179
|
+
_decimal: number;
|
|
180
|
+
_min: number;
|
|
181
|
+
_max: number;
|
|
182
|
+
_minColor: UIColor;
|
|
183
|
+
_maxColor?: UIColor;
|
|
184
|
+
_thumbColor?: UIColor;
|
|
185
|
+
constructor(props: PrefsRowSlider, values: PreferenceValues);
|
|
186
|
+
_defineValueView(): UiTypes.ViewOptions;
|
|
187
|
+
_handleValue(num: number): number;
|
|
188
|
+
}
|
|
189
|
+
declare class ListCell extends Cell {
|
|
190
|
+
readonly _type = "list";
|
|
191
|
+
_items: string[];
|
|
192
|
+
constructor(props: PrefsRowList, values: PreferenceValues);
|
|
193
|
+
_defineValueView(): UiTypes.ViewOptions;
|
|
194
|
+
_handleValue(num: number): number;
|
|
195
|
+
}
|
|
196
|
+
declare class TabCell extends Cell {
|
|
197
|
+
readonly _type = "tab";
|
|
198
|
+
_items: string[];
|
|
199
|
+
constructor(props: PrefsRowTab, values: PreferenceValues);
|
|
200
|
+
_defineValueView(): UiTypes.TabOptions;
|
|
201
|
+
_handleValue(num: number): number;
|
|
202
|
+
}
|
|
203
|
+
export declare function dateToString(mode: number, date?: Date): string;
|
|
204
|
+
declare class DateCell extends Cell {
|
|
205
|
+
readonly _type = "date";
|
|
206
|
+
_mode: number;
|
|
207
|
+
_interval?: number;
|
|
208
|
+
_min?: Date;
|
|
209
|
+
_max?: Date;
|
|
210
|
+
constructor(props: PrefsRowDate, values: PreferenceValues);
|
|
211
|
+
_defineValueView(): UiTypes.ViewOptions;
|
|
212
|
+
_handleValue(date: Date): Date;
|
|
213
|
+
}
|
|
214
|
+
declare class InfoCell extends Cell {
|
|
215
|
+
readonly _type = "info";
|
|
216
|
+
constructor(props: PrefsRowInfo, values: PreferenceValues);
|
|
217
|
+
_defineValueView(): UiTypes.LabelOptions;
|
|
218
|
+
_handleValue(text: string): string;
|
|
219
|
+
}
|
|
220
|
+
declare class InteractiveInfoCell extends Cell {
|
|
221
|
+
readonly _type = "interactive-info";
|
|
222
|
+
_copyable: boolean;
|
|
223
|
+
constructor(props: PrefsRowInteractiveInfo, values: PreferenceValues);
|
|
224
|
+
_defineValueView(): UiTypes.LabelOptions;
|
|
225
|
+
_handleValue(text: string): string;
|
|
226
|
+
}
|
|
227
|
+
declare class LinkCell extends Cell {
|
|
228
|
+
readonly _type = "link";
|
|
229
|
+
constructor(props: PrefsRowLink, values: PreferenceValues);
|
|
230
|
+
_defineValueView(): UiTypes.LabelOptions;
|
|
231
|
+
_handleValue(text: string): string;
|
|
232
|
+
}
|
|
233
|
+
declare class SymbolActionCell extends Cell {
|
|
234
|
+
readonly _type = "symbol-action";
|
|
235
|
+
_symbol: string;
|
|
236
|
+
_tintColor: UIColor;
|
|
237
|
+
_contentMode: number;
|
|
238
|
+
_symbolSize: JBSize;
|
|
239
|
+
constructor(props: PrefsRowSymbolAction, values: PreferenceValues);
|
|
240
|
+
_defineValueView(): UiTypes.ImageOptions;
|
|
241
|
+
_handleValue(): void;
|
|
242
|
+
}
|
|
243
|
+
declare class ActionCell extends Cell {
|
|
244
|
+
readonly _type = "action";
|
|
245
|
+
_destructive: boolean;
|
|
246
|
+
constructor(props: PrefsRowAction, values: PreferenceValues);
|
|
247
|
+
_defineTitleView(): UiTypes.LabelOptions;
|
|
248
|
+
_defineValueView(): UiTypes.LabelOptions;
|
|
249
|
+
_handleValue(): void;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* # cview PreferenceListView_static
|
|
253
|
+
*
|
|
254
|
+
* 便捷的设置列表实现. 其所有 cell 均为静态 cell,
|
|
255
|
+
* 可以同时使用 list 控件的 props(除了 template, data)和 events(除了 didSelect),
|
|
256
|
+
* 同时具有独特方法 set(key, value), 以及独特方法 changed
|
|
257
|
+
*
|
|
258
|
+
* sections 为 Array, 里面的 section 定义:
|
|
259
|
+
*
|
|
260
|
+
* - title?: string 标题.
|
|
261
|
+
* - rows: {type: string}[] 内容
|
|
262
|
+
*
|
|
263
|
+
* row定义:
|
|
264
|
+
*
|
|
265
|
+
* - 通用:
|
|
266
|
+
*
|
|
267
|
+
* - type: string 类型. 包括'string', 'number', 'integer', 'stepper',
|
|
268
|
+
* 'boolean', 'slider', 'list', 'tab', 'interactive-info', 'info',
|
|
269
|
+
* 'link', 'action'
|
|
270
|
+
* - key?: string 键. 如没有则不会返回其值.
|
|
271
|
+
* - title?: string 标题
|
|
272
|
+
* - value?: any 在下面专项里详解.
|
|
273
|
+
* - titleColor?: $color = $color("primaryText") 标题颜色
|
|
274
|
+
*
|
|
275
|
+
* - string:
|
|
276
|
+
*
|
|
277
|
+
* - value?: string
|
|
278
|
+
* - placeholder?: string
|
|
279
|
+
* - textColor?: $color = $color("primaryText")
|
|
280
|
+
*
|
|
281
|
+
* - number, integer:
|
|
282
|
+
*
|
|
283
|
+
* - value?: number
|
|
284
|
+
* - placeholder?: string
|
|
285
|
+
* - textColor?: $color = $color("primaryText")
|
|
286
|
+
* - min?: number 最小值
|
|
287
|
+
* - max?: number 最大值
|
|
288
|
+
*
|
|
289
|
+
* - stepper:
|
|
290
|
+
*
|
|
291
|
+
* - value?: number
|
|
292
|
+
* - placeholder?: string
|
|
293
|
+
* - min?: number 最小值
|
|
294
|
+
* - max?: number 最大值
|
|
295
|
+
*
|
|
296
|
+
* - boolean:
|
|
297
|
+
*
|
|
298
|
+
* - value?: boolean
|
|
299
|
+
* - onColor?: $color = $color("#34C85A")
|
|
300
|
+
* - thumbColor
|
|
301
|
+
*
|
|
302
|
+
* - slider:
|
|
303
|
+
*
|
|
304
|
+
* - value?: number 即 slider.value
|
|
305
|
+
* - decimal?: number = 1 精度
|
|
306
|
+
* - min?: number
|
|
307
|
+
* - max?: number
|
|
308
|
+
* - minColor?: $color = $color("systemLink")
|
|
309
|
+
* - maxColor?: $color
|
|
310
|
+
* - thumbColor?: $color
|
|
311
|
+
*
|
|
312
|
+
* - list:
|
|
313
|
+
*
|
|
314
|
+
* - value?: number 即 index, -1 时为不选
|
|
315
|
+
* - items?: string[]
|
|
316
|
+
*
|
|
317
|
+
* - tab:
|
|
318
|
+
*
|
|
319
|
+
* - value?: number 即 index, -1 时为不选
|
|
320
|
+
* - items?: string[]
|
|
321
|
+
*
|
|
322
|
+
* - date:
|
|
323
|
+
*
|
|
324
|
+
* - value?: Date
|
|
325
|
+
* - min?: Date
|
|
326
|
+
* - max?: Date
|
|
327
|
+
* - mode?: number = 2
|
|
328
|
+
* - interval?: number
|
|
329
|
+
*
|
|
330
|
+
* - info:
|
|
331
|
+
*
|
|
332
|
+
* - value?: string
|
|
333
|
+
*
|
|
334
|
+
* - interactive-info:
|
|
335
|
+
*
|
|
336
|
+
* - value?: string
|
|
337
|
+
* - copyable?: boolean = false
|
|
338
|
+
*
|
|
339
|
+
* - link:
|
|
340
|
+
*
|
|
341
|
+
* - value?: string url
|
|
342
|
+
*
|
|
343
|
+
* - symbol-action:
|
|
344
|
+
*
|
|
345
|
+
* - symbol?: string;
|
|
346
|
+
* - tintColor?: UIColor;
|
|
347
|
+
* - contentMode?: number;
|
|
348
|
+
* - symbolSize?: JBSize;
|
|
349
|
+
* - value?: function 点击后会执行的函数
|
|
350
|
+
*
|
|
351
|
+
* - action:
|
|
352
|
+
*
|
|
353
|
+
* - value?: function 点击后会执行的函数
|
|
354
|
+
* - destructive?: boolean = false 是否为危险动作,若是则为红色
|
|
355
|
+
*
|
|
356
|
+
* Methods:
|
|
357
|
+
*
|
|
358
|
+
* - set(key, value) 设定 key 对应的 value
|
|
359
|
+
* - cview.values 获取全部的 values
|
|
360
|
+
*
|
|
361
|
+
* Events:
|
|
362
|
+
*
|
|
363
|
+
* - changed: values => {}
|
|
364
|
+
*/
|
|
365
|
+
export declare class PreferenceListView extends Base<UIListView, UiTypes.ListOptions> {
|
|
366
|
+
_defineView: () => UiTypes.ListOptions;
|
|
367
|
+
_sections: PreferenceSection[];
|
|
368
|
+
_props: Partial<UiTypes.ListProps>;
|
|
369
|
+
_layout?: (make: MASConstraintMaker, view: UIListView) => void;
|
|
370
|
+
_values: PreferenceValues;
|
|
371
|
+
_cells: {
|
|
372
|
+
title: string;
|
|
373
|
+
rows: AllCells[];
|
|
374
|
+
}[];
|
|
375
|
+
constructor({ sections, props, layout, events, }: {
|
|
376
|
+
sections: PreferenceSection[];
|
|
377
|
+
props?: Partial<UiTypes.ListProps>;
|
|
378
|
+
layout?: (make: MASConstraintMaker, view: UIListView) => void;
|
|
379
|
+
events?: {
|
|
380
|
+
changed?: (values: {
|
|
381
|
+
[key: string]: any;
|
|
382
|
+
}) => void;
|
|
383
|
+
};
|
|
384
|
+
});
|
|
385
|
+
private _createCell;
|
|
386
|
+
get values(): PreferenceValues;
|
|
387
|
+
set(key: string, value: any): void;
|
|
388
|
+
}
|
|
389
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
interface SymbolButtonProps {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
symbol?: string;
|
|
5
|
+
image?: UIImage;
|
|
6
|
+
src?: string;
|
|
7
|
+
tintColor: UIColor;
|
|
8
|
+
contentMode: number;
|
|
9
|
+
insets: JBInsets;
|
|
10
|
+
menu?: UiTypes.ContextMenuOptions<UIButtonView>;
|
|
11
|
+
hidden: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 创建可以自动规范symbol大小的button,兼容image,可以设定insets
|
|
15
|
+
* props:
|
|
16
|
+
* - symbol
|
|
17
|
+
* - image
|
|
18
|
+
* - tintColor
|
|
19
|
+
* - insets
|
|
20
|
+
* - enabled
|
|
21
|
+
* - menu
|
|
22
|
+
* - hidden
|
|
23
|
+
* events:
|
|
24
|
+
* - tapped
|
|
25
|
+
*/
|
|
26
|
+
export declare class SymbolButton extends Base<UIButtonView, UiTypes.ButtonOptions> {
|
|
27
|
+
_props: SymbolButtonProps;
|
|
28
|
+
_defineView: () => UiTypes.ButtonOptions;
|
|
29
|
+
constructor({ props, layout, events, }: {
|
|
30
|
+
props: Partial<SymbolButtonProps>;
|
|
31
|
+
layout?: (make: MASConstraintMaker, view: UIButtonView) => void;
|
|
32
|
+
events?: UiTypes.BaseViewEvents<UIButtonView>;
|
|
33
|
+
});
|
|
34
|
+
set tintColor(tintColor: UIColor);
|
|
35
|
+
set image(image: UIImage);
|
|
36
|
+
set symbol(symbol: string);
|
|
37
|
+
set src(src: string);
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
declare class ImageLabelCell extends Base<UIView, UiTypes.ViewOptions> {
|
|
3
|
+
_props: {
|
|
4
|
+
symbol?: string;
|
|
5
|
+
image?: UIImage;
|
|
6
|
+
text: string;
|
|
7
|
+
index: number;
|
|
8
|
+
selectedSegmentTintColor: UIColor;
|
|
9
|
+
defaultSegmentTintColor: UIColor;
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
};
|
|
12
|
+
layouts: {
|
|
13
|
+
image_tightened: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
14
|
+
label_tightened: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
15
|
+
image_loosed: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
16
|
+
label_loosed: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
17
|
+
};
|
|
18
|
+
_defineView: () => UiTypes.ViewOptions;
|
|
19
|
+
constructor({ props, events, }: {
|
|
20
|
+
props: {
|
|
21
|
+
symbol?: string;
|
|
22
|
+
image?: UIImage;
|
|
23
|
+
text: string;
|
|
24
|
+
index: number;
|
|
25
|
+
selectedSegmentTintColor: UIColor;
|
|
26
|
+
defaultSegmentTintColor: UIColor;
|
|
27
|
+
selected?: boolean;
|
|
28
|
+
};
|
|
29
|
+
events: {
|
|
30
|
+
tapped?: (index: number) => void;
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
set selected(selected: boolean | undefined);
|
|
34
|
+
get selected(): boolean | undefined;
|
|
35
|
+
_useTightenedLayout(): void;
|
|
36
|
+
_useLoosedLayout(): void;
|
|
37
|
+
}
|
|
38
|
+
declare class ImageCell extends Base<UIView, UiTypes.ViewOptions> {
|
|
39
|
+
_props: {
|
|
40
|
+
symbol?: string;
|
|
41
|
+
image?: UIImage;
|
|
42
|
+
index: number;
|
|
43
|
+
selectedSegmentTintColor: UIColor;
|
|
44
|
+
defaultSegmentTintColor: UIColor;
|
|
45
|
+
selected?: boolean;
|
|
46
|
+
};
|
|
47
|
+
layouts: {
|
|
48
|
+
image_tightened: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
49
|
+
image_loosed: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
50
|
+
};
|
|
51
|
+
_defineView: () => UiTypes.ViewOptions;
|
|
52
|
+
constructor({ props, events, }: {
|
|
53
|
+
props: {
|
|
54
|
+
symbol?: string;
|
|
55
|
+
image?: UIImage;
|
|
56
|
+
index: number;
|
|
57
|
+
selectedSegmentTintColor: UIColor;
|
|
58
|
+
defaultSegmentTintColor: UIColor;
|
|
59
|
+
selected?: boolean;
|
|
60
|
+
};
|
|
61
|
+
events: {
|
|
62
|
+
tapped?: (index: number) => void;
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
set selected(selected: boolean | undefined);
|
|
66
|
+
get selected(): boolean | undefined;
|
|
67
|
+
_useTightenedLayout(): void;
|
|
68
|
+
_useLoosedLayout(): void;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 本组件是为了仿制 UITabBar
|
|
72
|
+
* 本组件不能指定布局而是应该指定 height(如果需要的话)
|
|
73
|
+
* 典型的使用方式是添加在布局为$layout.fill的视图中,并指定 items
|
|
74
|
+
*
|
|
75
|
+
* props:
|
|
76
|
+
*
|
|
77
|
+
* - 只写 height: number = 50
|
|
78
|
+
* - 只写 items: {symbol?: string, image?:UIImage, title?: string}[]
|
|
79
|
+
* - 只写 bgcolor?: UIColor 如果不指定则背景使用blur(style 10),若指定则使用纯色视图
|
|
80
|
+
* - 读写 index: number = 0
|
|
81
|
+
* - 只写 selectedSegmentTintColor = $color("tintColor")
|
|
82
|
+
* - 只写 defaultSegmentTintColor = colors.footBarDefaultSegmentColor
|
|
83
|
+
*
|
|
84
|
+
* events:
|
|
85
|
+
*
|
|
86
|
+
* - changed: (cview, index) => void
|
|
87
|
+
* - doubleTapped: (cview, index) => void
|
|
88
|
+
*
|
|
89
|
+
* methods:
|
|
90
|
+
*
|
|
91
|
+
* - hide(animated=true) 隐藏
|
|
92
|
+
* - show(animated=true) 显示
|
|
93
|
+
*/
|
|
94
|
+
export declare class TabBar extends Base<UIView | UIBlurView, UiTypes.ViewOptions | UiTypes.BlurOptions> {
|
|
95
|
+
_props: {
|
|
96
|
+
height: number;
|
|
97
|
+
items: {
|
|
98
|
+
symbol?: string;
|
|
99
|
+
image?: UIImage;
|
|
100
|
+
title?: string;
|
|
101
|
+
}[];
|
|
102
|
+
index: number;
|
|
103
|
+
selectedSegmentTintColor: UIColor;
|
|
104
|
+
defaultSegmentTintColor: UIColor;
|
|
105
|
+
bgcolor?: UIColor;
|
|
106
|
+
};
|
|
107
|
+
_index: number;
|
|
108
|
+
_cells: (ImageLabelCell | ImageCell)[];
|
|
109
|
+
_events: {
|
|
110
|
+
changed?: (cview: TabBar, index: number) => void;
|
|
111
|
+
doubleTapped?: (cview: TabBar, index: number) => void;
|
|
112
|
+
};
|
|
113
|
+
_defineView: () => UiTypes.ViewOptions | UiTypes.BlurOptions;
|
|
114
|
+
constructor({ props, events, }: {
|
|
115
|
+
props: {
|
|
116
|
+
height?: number;
|
|
117
|
+
items: {
|
|
118
|
+
symbol?: string;
|
|
119
|
+
image?: UIImage;
|
|
120
|
+
title?: string;
|
|
121
|
+
}[];
|
|
122
|
+
index?: number;
|
|
123
|
+
selectedSegmentTintColor?: UIColor;
|
|
124
|
+
defaultSegmentTintColor?: UIColor;
|
|
125
|
+
bgcolor?: UIColor;
|
|
126
|
+
};
|
|
127
|
+
events: {
|
|
128
|
+
changed?: (cview: TabBar, index: number) => void;
|
|
129
|
+
doubleTapped?: (cview: TabBar, index: number) => void;
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
_defineCells(): (ImageLabelCell | ImageCell)[];
|
|
133
|
+
get index(): number;
|
|
134
|
+
set index(index: number);
|
|
135
|
+
hide(animated?: boolean): void;
|
|
136
|
+
show(animated?: boolean): void;
|
|
137
|
+
_useTightenedLayout(): void;
|
|
138
|
+
_useLoosedLayout(): void;
|
|
139
|
+
}
|
|
140
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Base } from "../components/base";
|
|
2
|
+
import { ContentView } from "../components/single-views";
|
|
3
|
+
export declare class ControllerRootView extends ContentView {
|
|
4
|
+
constructor({ props, layout, events, }: {
|
|
5
|
+
props: {
|
|
6
|
+
bgcolor: UIColor;
|
|
7
|
+
};
|
|
8
|
+
layout: (make: MASConstraintMaker, view: UIView) => void;
|
|
9
|
+
events: {
|
|
10
|
+
ready: (sender: UIView) => void;
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
set views(views: UiTypes.AllViewOptions[] | Base<any, any>[]);
|
|
14
|
+
}
|
|
15
|
+
export interface BaseControllerProps {
|
|
16
|
+
id?: string;
|
|
17
|
+
bgcolor?: UIColor;
|
|
18
|
+
}
|
|
19
|
+
export interface BaseControllerEvents {
|
|
20
|
+
didLoad?: (controller: BaseController) => void;
|
|
21
|
+
didAppear?: (controller: BaseController) => void;
|
|
22
|
+
didDisappear?: (controller: BaseController) => void;
|
|
23
|
+
didRemove?: (controller: BaseController) => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* # CView Base Controller
|
|
27
|
+
*
|
|
28
|
+
* Cview 控件尽量保持非侵入性和功能专注。而控制器负责控件之间的关联和数据更新。
|
|
29
|
+
* 另外,控制器可以实现一些常用的页面构建形式,比如底部Tab分页,左侧滑动分页,弹出式页面等。
|
|
30
|
+
*
|
|
31
|
+
* ## 属性
|
|
32
|
+
*
|
|
33
|
+
* - id?: string 可以指定 id,如不指定,会自动赋值全局唯一 id
|
|
34
|
+
* - 只写 bgcolor?: UIColor = $color("primarySurface") rootView 的 bgcolor
|
|
35
|
+
* - 只读 cviews: {}
|
|
36
|
+
* - 只读 rootView
|
|
37
|
+
* - 只读 status
|
|
38
|
+
* - created = 0 被创建,未被加载
|
|
39
|
+
* - loaded = 1 被加载,显示状态未知
|
|
40
|
+
* - appearing = 2 处于可显示状态
|
|
41
|
+
* - disappearing = 3 处于不显示状态
|
|
42
|
+
* - removed = 4 根视图被移除
|
|
43
|
+
*
|
|
44
|
+
* ## 事件
|
|
45
|
+
*
|
|
46
|
+
* 5 个生命周期节点:创建、加载、显示、隐藏、销毁。后面四个具有生命周期事件。
|
|
47
|
+
*
|
|
48
|
+
* 创建阶段没有对应事件,此阶段适合为 rootView 添加子 view,
|
|
49
|
+
* 不能涉及对 UIView 的任何操作,因为此时 rootView 还未加载。
|
|
50
|
+
*
|
|
51
|
+
* 生命周期事件:
|
|
52
|
+
*
|
|
53
|
+
* 1. didLoad: controller => void 在 rootView 被加载之后执行
|
|
54
|
+
* - 可以在 rootView 的 ready 事件中自动执行,也可以手动执行加快速度
|
|
55
|
+
* - 也可以在这个节点为 rootView 添加子 view
|
|
56
|
+
* - 这个节点可以对 UIView 进行操作了
|
|
57
|
+
* - 可以向 Model 层请求初始数据
|
|
58
|
+
* 2. didAppear: controller => void 在 rootView 显现的时候执行
|
|
59
|
+
* - 向 Model 层请求刷新数据
|
|
60
|
+
* 3. didDisappear: controller => void 在 rootView 不可见的时候执行
|
|
61
|
+
* - 如果是持续执行的刷新行为,可以在此处转为暂停
|
|
62
|
+
* 4. didRemove: controller => void 在 rootView 被移除的时候执行
|
|
63
|
+
* - 应该在此节点释放自定义的 objc
|
|
64
|
+
* - 数据持久化
|
|
65
|
+
*
|
|
66
|
+
* ## 方法
|
|
67
|
+
*
|
|
68
|
+
* 加载方法:
|
|
69
|
+
*
|
|
70
|
+
* 1. uirender(props) 此方法只能使用一次,对应的 Controller 将成为顶级 Controller
|
|
71
|
+
* 2. uipush(props)
|
|
72
|
+
* 3. 直接让 rootView.definition 包含在其他 View 的 views 参数中
|
|
73
|
+
*
|
|
74
|
+
* 生命周期管理:
|
|
75
|
+
*
|
|
76
|
+
* 1. load() 会在 rootView 的 ready 事件中自动调用,也可以手动调用,以加速运行
|
|
77
|
+
* 2. appear()
|
|
78
|
+
* 3. disappear()
|
|
79
|
+
* 4. remove() 用来移除 Router 中的当前 Controller,**请注意此方法和 rootView 的移除无关**,
|
|
80
|
+
* 如果通过 uirender 和 uipush,可以在销毁时自动执行 remove()
|
|
81
|
+
*
|
|
82
|
+
* ## 其他
|
|
83
|
+
*
|
|
84
|
+
* - rootView 可以直接通过 rootView.views 设置其_views 属性,
|
|
85
|
+
* 其中元素可以为 view 定义也可以为 cview
|
|
86
|
+
*/
|
|
87
|
+
export declare class BaseController {
|
|
88
|
+
protected _props: BaseControllerProps;
|
|
89
|
+
protected _events: BaseControllerEvents;
|
|
90
|
+
readonly id: string;
|
|
91
|
+
private _status;
|
|
92
|
+
cviews: {
|
|
93
|
+
[key: string]: Base<any, any>;
|
|
94
|
+
};
|
|
95
|
+
readonly rootView: ControllerRootView;
|
|
96
|
+
constructor({ props, layout, events, }?: {
|
|
97
|
+
props?: BaseControllerProps;
|
|
98
|
+
layout?: (make: MASConstraintMaker, view: UIView) => void;
|
|
99
|
+
events?: BaseControllerEvents;
|
|
100
|
+
});
|
|
101
|
+
load(): void;
|
|
102
|
+
appear(): void;
|
|
103
|
+
disappear(): void;
|
|
104
|
+
remove(): void;
|
|
105
|
+
uirender(props: UiTypes.RootViewPrefs): void;
|
|
106
|
+
uipush(props: UiTypes.RootViewPrefs): void;
|
|
107
|
+
get status(): number;
|
|
108
|
+
}
|