jsbox-cview 1.6.5 → 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/input-alert.js +1 -2
- package/dist/components/alert/login-alert.d.ts +21 -0
- package/dist/components/alert/login-alert.js +1 -2
- package/dist/components/alert/plain-alert.d.ts +15 -0
- package/dist/components/alert/plain-alert.js +1 -2
- 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/custom-navigation-bar.js +7 -1
- 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/form-dialog.js +1 -2
- package/dist/components/dialogs/list-dialog.d.ts +23 -0
- package/dist/components/dialogs/list-dialog.js +2 -3
- package/dist/components/dialogs/text-dialog.d.ts +13 -0
- package/dist/components/dialogs/text-dialog.js +1 -2
- package/dist/components/dynamic-contextmenu-view.d.ts +40 -0
- package/dist/components/dynamic-contextmenu-view.js +5 -1
- package/dist/components/dynamic-itemsize-matrix.d.ts +79 -0
- package/dist/components/dynamic-itemsize-matrix.js +18 -15
- package/dist/components/dynamic-itemsize-section-matrix.d.ts +115 -0
- package/dist/components/dynamic-itemsize-section-matrix.js +293 -0
- package/dist/components/dynamic-preference-listview.d.ts +63 -0
- package/dist/components/dynamic-preference-listview.js +25 -16
- package/dist/components/dynamic-rowheight-list.d.ts +38 -0
- package/dist/components/dynamic-rowheight-list.js +10 -3
- package/dist/components/enhanced-imageview.d.ts +41 -0
- package/dist/components/enhanced-imageview.js +1 -1
- package/dist/components/flowlayout.d.ts +63 -0
- package/dist/components/flowlayout.js +10 -13
- package/dist/components/image-pager.d.ts +49 -0
- package/dist/components/image-pager.js +6 -1
- package/dist/components/oc-webview.d.ts +64 -0
- package/dist/components/oc-webview.js +13 -5
- package/dist/components/page-control.d.ts +45 -0
- package/dist/components/page-control.js +2 -13
- package/dist/components/pageviewer-titlebar.d.ts +48 -0
- package/dist/components/pageviewer-titlebar.js +7 -13
- package/dist/components/pageviewer.d.ts +41 -0
- package/dist/components/pageviewer.js +4 -1
- package/dist/components/refresh-button.d.ts +25 -0
- package/dist/components/refresh-button.js +3 -4
- package/dist/components/rotating-view.d.ts +45 -0
- package/dist/components/rotating-view.js +10 -2
- package/dist/components/searchbar.d.ts +118 -0
- package/dist/components/searchbar.js +8 -1
- package/dist/components/sheet.d.ts +42 -0
- package/dist/components/single-views.d.ts +289 -0
- package/dist/components/single-views.js +11 -4
- 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/spinners/spinner-androidstyle.js +7 -1
- package/dist/components/static-preference-listview.d.ts +389 -0
- package/dist/components/static-preference-listview.js +13 -10
- package/dist/components/symbol-button.d.ts +39 -0
- package/dist/components/symbol-button.js +8 -1
- package/dist/components/tabbar.d.ts +140 -0
- package/dist/components/tabbar.js +8 -1
- 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/pageviewer-controller.js +4 -1
- package/dist/controller/presented-page-controller.d.ts +41 -0
- package/dist/controller/presented-page-controller.js +7 -9
- package/dist/controller/splitview-controller.d.ts +90 -0
- package/dist/controller/splitview-controller.js +27 -11
- package/dist/controller/tabbar-controller.d.ts +49 -0
- package/dist/controller/tabbar-controller.js +12 -15
- 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/l10n.js +1 -2
- package/dist/utils/path.d.ts +8 -0
- package/dist/utils/path.js +8 -9
- package/dist/utils/rect.d.ts +38 -0
- package/dist/utils/rect.js +8 -9
- package/dist/utils/uitools.d.ts +75 -0
- package/dist/utils/uitools.js +6 -6
- package/package.json +20 -5
- 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-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-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-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 {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PreferenceListView = exports.
|
|
3
|
+
exports.PreferenceListView = exports.excludedTypes = exports.selectableTypes = void 0;
|
|
4
|
+
exports.dateToString = dateToString;
|
|
4
5
|
const base_1 = require("./base");
|
|
5
6
|
const uitools_1 = require("../utils/uitools");
|
|
6
7
|
exports.selectableTypes = [
|
|
@@ -78,7 +79,6 @@ class BaseStringCell extends Cell {
|
|
|
78
79
|
this._textColor = textColor;
|
|
79
80
|
}
|
|
80
81
|
_defineValueView() {
|
|
81
|
-
var _a;
|
|
82
82
|
return {
|
|
83
83
|
type: "view",
|
|
84
84
|
props: {},
|
|
@@ -105,7 +105,7 @@ class BaseStringCell extends Cell {
|
|
|
105
105
|
type: "label",
|
|
106
106
|
props: {
|
|
107
107
|
id: "label",
|
|
108
|
-
text:
|
|
108
|
+
text: this._handleText(this._value)?.toString(),
|
|
109
109
|
align: $align.right,
|
|
110
110
|
font: $font(17),
|
|
111
111
|
textColor: this._textColor,
|
|
@@ -483,7 +483,6 @@ function dateToString(mode, date) {
|
|
|
483
483
|
return `${year}-${month}-${day} ${hours}:${minutes}`;
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
|
-
exports.dateToString = dateToString;
|
|
487
486
|
class DateCell extends Cell {
|
|
488
487
|
constructor(props, values) {
|
|
489
488
|
super(props, values);
|
|
@@ -642,13 +641,12 @@ class LinkCell extends Cell {
|
|
|
642
641
|
}
|
|
643
642
|
class SymbolActionCell extends Cell {
|
|
644
643
|
constructor(props, values) {
|
|
645
|
-
var _a, _b, _c;
|
|
646
644
|
super(props, values);
|
|
647
645
|
this._type = "symbol-action";
|
|
648
646
|
this._symbol = props.symbol || "";
|
|
649
|
-
this._tintColor =
|
|
650
|
-
this._contentMode =
|
|
651
|
-
this._symbolSize =
|
|
647
|
+
this._tintColor = props.tintColor ?? $color("primaryText");
|
|
648
|
+
this._contentMode = props.contentMode ?? 1;
|
|
649
|
+
this._symbolSize = props.symbolSize ?? $size(24, 24);
|
|
652
650
|
}
|
|
653
651
|
_defineValueView() {
|
|
654
652
|
return {
|
|
@@ -845,10 +843,15 @@ class PreferenceListView extends base_1.Base {
|
|
|
845
843
|
this._defineView = () => {
|
|
846
844
|
return {
|
|
847
845
|
type: "list",
|
|
848
|
-
props:
|
|
846
|
+
props: {
|
|
847
|
+
style: 2,
|
|
848
|
+
...this._props,
|
|
849
|
+
id: this.id,
|
|
850
|
+
data: this._cells.map((section) => ({
|
|
849
851
|
title: section.title,
|
|
850
852
|
rows: section.rows.map((cell) => cell.definition),
|
|
851
|
-
}))
|
|
853
|
+
})),
|
|
854
|
+
},
|
|
852
855
|
layout: this._layout,
|
|
853
856
|
events: {
|
|
854
857
|
didSelect: (sender, indexPath, data) => {
|
|
@@ -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 {};
|
|
@@ -18,7 +18,14 @@ const base_1 = require("./base");
|
|
|
18
18
|
class SymbolButton extends base_1.Base {
|
|
19
19
|
constructor({ props, layout, events = {}, }) {
|
|
20
20
|
super();
|
|
21
|
-
this._props =
|
|
21
|
+
this._props = {
|
|
22
|
+
enabled: true,
|
|
23
|
+
contentMode: 1,
|
|
24
|
+
insets: $insets(12.5, 12.5, 12.5, 12.5),
|
|
25
|
+
tintColor: $color("primaryText"),
|
|
26
|
+
hidden: false,
|
|
27
|
+
...props,
|
|
28
|
+
};
|
|
22
29
|
this._layout = layout;
|
|
23
30
|
this._defineView = () => {
|
|
24
31
|
const props = this._props.menu
|
|
@@ -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 {};
|
|
@@ -168,7 +168,14 @@ class ImageCell extends base_1.Base {
|
|
|
168
168
|
class TabBar extends base_1.Base {
|
|
169
169
|
constructor({ props, events = {}, }) {
|
|
170
170
|
super();
|
|
171
|
-
this._props =
|
|
171
|
+
this._props = {
|
|
172
|
+
height: 50,
|
|
173
|
+
index: 0,
|
|
174
|
+
selectedSegmentTintColor: $color("systemLink"),
|
|
175
|
+
defaultSegmentTintColor: colors_1.footBarDefaultSegmentColor,
|
|
176
|
+
//bgcolor: $color("secondarySurface"),
|
|
177
|
+
...props,
|
|
178
|
+
};
|
|
172
179
|
this._index = this._props.index;
|
|
173
180
|
this._events = events;
|
|
174
181
|
this._cells = this._defineCells();
|