jsbox-cview 1.6.0 → 1.6.2

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 (46) hide show
  1. package/.prettierignore +6 -0
  2. package/.prettierrc +3 -0
  3. package/components/alert/input-alert.ts +4 -17
  4. package/components/alert/login-alert.ts +4 -17
  5. package/components/alert/plain-alert.ts +4 -17
  6. package/components/alert/uialert.ts +6 -16
  7. package/components/base.ts +1 -4
  8. package/components/custom-navigation-bar.ts +13 -38
  9. package/components/dialogs/dialog-sheet.ts +4 -13
  10. package/components/dialogs/form-dialog.ts +3 -6
  11. package/components/dialogs/list-dialog.ts +2 -5
  12. package/components/dynamic-contextmenu-view.ts +11 -27
  13. package/components/dynamic-itemsize-matrix.ts +8 -12
  14. package/components/dynamic-preference-listview.ts +14 -35
  15. package/components/dynamic-rowheight-list.ts +3 -8
  16. package/components/enhanced-imageview.ts +4 -9
  17. package/components/flowlayout.ts +6 -14
  18. package/components/image-pager.ts +1 -2
  19. package/components/oc-webview.ts +6 -24
  20. package/components/page-control.ts +2 -7
  21. package/components/pageviewer-titlebar.ts +5 -15
  22. package/components/pageviewer.ts +4 -13
  23. package/components/rotating-view.ts +1 -3
  24. package/components/searchbar.ts +16 -56
  25. package/components/sheet.ts +4 -18
  26. package/components/single-views.ts +6 -36
  27. package/components/spinners/loading-dual-ring.ts +2 -8
  28. package/components/spinners/loading-wedges.ts +4 -20
  29. package/components/spinners/spinner-androidstyle.ts +2 -7
  30. package/components/static-preference-listview.ts +6 -26
  31. package/components/tabbar.ts +7 -20
  32. package/controller/base-controller.ts +2 -10
  33. package/controller/pageviewer-controller.ts +3 -11
  34. package/controller/presented-page-controller.ts +2 -8
  35. package/controller/splitview-controller.ts +7 -26
  36. package/controller/tabbar-controller.ts +3 -11
  37. package/dist/index.js +1 -0
  38. package/index.ts +1 -0
  39. package/package.json +3 -2
  40. package/test/dynamic-itemsize-matrix.ts +2 -7
  41. package/test/flowlayout.ts +3 -11
  42. package/test/static-preference-listview.ts +1 -4
  43. package/tsconfig.json +1 -2
  44. package/utils/cvid.ts +1 -2
  45. package/utils/path.ts +1 -4
  46. package/utils/uitools.ts +5 -8
@@ -63,19 +63,14 @@ export class EnhancedImageView extends Base<UIView, UiTypes.ViewOptions> {
63
63
  $delay(0.1, () =>
64
64
  this._addGesture(view, (gesture: any) => {
65
65
  const location = gesture.$locationInView(view.ocValue());
66
- const realLocation = $point(
67
- location.x - view.bounds.x,
68
- location.y - view.bounds.y
69
- );
66
+ const realLocation = $point(location.x - view.bounds.x, location.y - view.bounds.y);
70
67
  const frame = this.view.frame;
71
68
  if (realLocation.y <= frame.height / 2) {
72
- if (events.upperLocationTouched)
73
- events.upperLocationTouched(this);
69
+ if (events.upperLocationTouched) events.upperLocationTouched(this);
74
70
  } else {
75
- if (events.lowerLocationTouched)
76
- events.lowerLocationTouched(this);
71
+ if (events.lowerLocationTouched) events.lowerLocationTouched(this);
77
72
  }
78
- })
73
+ }),
79
74
  );
80
75
  },
81
76
  },
@@ -30,10 +30,7 @@ import { Base } from "./base";
30
30
  * - set items(items: FlowlayoutItem[]) 设置子视图
31
31
  * - get items(): FlowlayoutItem[] 获取子视图
32
32
  */
33
- export class Flowlayout<T extends FlowlayoutItem> extends Base<
34
- UIView,
35
- UiTypes.ViewOptions
36
- > {
33
+ export class Flowlayout<T extends FlowlayoutItem> extends Base<UIView, UiTypes.ViewOptions> {
37
34
  private _width: number; // 缓存宽度,用于判断是否需要重新布局
38
35
  private _props: {
39
36
  items: T[];
@@ -84,7 +81,7 @@ export class Flowlayout<T extends FlowlayoutItem> extends Base<
84
81
  didLongPress: events?.didLongPress,
85
82
  flowlayout: this,
86
83
  index,
87
- })
84
+ }),
88
85
  );
89
86
  this._defineView = () => ({
90
87
  type: "view",
@@ -98,8 +95,7 @@ export class Flowlayout<T extends FlowlayoutItem> extends Base<
98
95
  if (this._width !== sender.frame.width) {
99
96
  this._width = sender.frame.width;
100
97
  const height = this._layoutWrappers();
101
- if (!this._props.fixedHeight)
102
- sender.updateLayout((make) => make.height.equalTo(height));
98
+ if (!this._props.fixedHeight) sender.updateLayout((make) => make.height.equalTo(height));
103
99
  }
104
100
  },
105
101
  },
@@ -126,13 +122,12 @@ export class Flowlayout<T extends FlowlayoutItem> extends Base<
126
122
  didLongPress: this._events?.didLongPress,
127
123
  flowlayout: this,
128
124
  index,
129
- })
125
+ }),
130
126
  );
131
127
  this.view.views.forEach((v) => v.remove());
132
128
  this._wrappers.forEach((wrapper) => this.view.add(wrapper.definition));
133
129
  const height = this._layoutWrappers();
134
- if (!this._props.fixedHeight)
135
- this.view.updateLayout((make) => make.height.equalTo(height));
130
+ if (!this._props.fixedHeight) this.view.updateLayout((make) => make.height.equalTo(height));
136
131
  }
137
132
 
138
133
  _layoutWrappers(): number {
@@ -192,10 +187,7 @@ interface FlowlayoutItem extends Base<any, any> {
192
187
  itemWidth: () => number;
193
188
  }
194
189
 
195
- class WrapperView<T extends FlowlayoutItem> extends Base<
196
- UIView,
197
- UiTypes.ViewOptions
198
- > {
190
+ class WrapperView<T extends FlowlayoutItem> extends Base<UIView, UiTypes.ViewOptions> {
199
191
  _defineView: () => UiTypes.ViewOptions;
200
192
  item: T;
201
193
  constructor({
@@ -108,8 +108,7 @@ export class ImagePager extends Base<UIView, UiTypes.ViewOptions> {
108
108
  const oldPage = this.page;
109
109
  this._props.page = Math.round(target.x / sender.frame.width);
110
110
  //this.loadsrc(this.page, true);
111
- if (oldPage !== this.page && events.changed)
112
- events.changed(this.page);
111
+ if (oldPage !== this.page && events.changed) events.changed(this.page);
113
112
  },
114
113
  didScroll: (sender) => {
115
114
  this.loadsrc(this.page + 1, true);
@@ -17,7 +17,7 @@ import { Base } from "./base";
17
17
  * - didStart?: (sender: any) => void;
18
18
  * - didFinish?: (sender: any) => void;
19
19
  * - didFail?: (sender: any, error: NSError | null) => void;
20
- *
20
+ *
21
21
  * events中sender的any类型实际为WKWebView OC类型
22
22
  *
23
23
  * ## Methods
@@ -50,15 +50,8 @@ export class OCWebView extends Base<UIView, UiTypes.RuntimeOptions> {
50
50
  super();
51
51
  // ====== 创建 WebView ======
52
52
  const config = $objc("WKWebViewConfiguration").invoke("new");
53
- config.invoke(
54
- "setWebsiteDataStore:",
55
- $objc("WKWebsiteDataStore").invoke("defaultDataStore"),
56
- );
57
- const webView = $objc("WKWebView").invoke(
58
- "alloc.initWithFrame:configuration:",
59
- $rect(0, 0, 0, 0),
60
- config,
61
- );
53
+ config.invoke("setWebsiteDataStore:", $objc("WKWebsiteDataStore").invoke("defaultDataStore"));
54
+ const webView = $objc("WKWebView").invoke("alloc.initWithFrame:configuration:", $rect(0, 0, 0, 0), config);
62
55
  this.webView = webView;
63
56
 
64
57
  this._defineView = () => {
@@ -75,27 +68,16 @@ export class OCWebView extends Base<UIView, UiTypes.RuntimeOptions> {
75
68
  const navDelegate = $delegate({
76
69
  type: "WKNavigationDelegate",
77
70
  events: {
78
- "webView:didStartProvisionalNavigation:": (
79
- wv: any,
80
- nav: any,
81
- ) => {
71
+ "webView:didStartProvisionalNavigation:": (wv: any, nav: any) => {
82
72
  events.didStart && events.didStart(wv);
83
73
  },
84
74
  "webView:didFinishNavigation:": (wv: any, nav: any) => {
85
75
  events.didFinish && events.didFinish(wv);
86
76
  },
87
- "webView:didFailNavigation:withError:": (
88
- wv: any,
89
- nav: any,
90
- e: any,
91
- ) => {
77
+ "webView:didFailNavigation:withError:": (wv: any, nav: any, e: any) => {
92
78
  events.didFail && events.didFail(wv, e ? e.jsValue() : null);
93
79
  },
94
- "webView:didFailProvisionalNavigation:withError:": (
95
- wv: any,
96
- nav: any,
97
- e: any,
98
- ) => {
80
+ "webView:didFailProvisionalNavigation:withError:": (wv: any, nav: any, e: any) => {
99
81
  events.didFail && events.didFail(wv, e ? e.jsValue() : null);
100
82
  },
101
83
  },
@@ -67,14 +67,9 @@ export class PageControl extends Runtime {
67
67
  const pageControl = $objc("UIPageControl").$new();
68
68
  pageControl.$setNumberOfPages(this._numberOfPages);
69
69
  pageControl.$setCurrentPage(this._currentPage);
70
- if (this._pageIndicatorTintColor)
71
- pageControl.$setPageIndicatorTintColor(
72
- this._pageIndicatorTintColor.ocValue()
73
- );
70
+ if (this._pageIndicatorTintColor) pageControl.$setPageIndicatorTintColor(this._pageIndicatorTintColor.ocValue());
74
71
  if (this._currentPageIndicatorTintColor)
75
- pageControl.$setCurrentPageIndicatorTintColor(
76
- this._currentPageIndicatorTintColor.ocValue()
77
- );
72
+ pageControl.$setCurrentPageIndicatorTintColor(this._currentPageIndicatorTintColor.ocValue());
78
73
 
79
74
  pageControl.$addEventHandler({
80
75
  events: $UIEvent.valueChanged,
@@ -63,17 +63,13 @@ export class PageViewerTitleBar extends Base<UIView, UiTypes.ViewOptions> {
63
63
  };
64
64
  const { changed, ...restEvents } = events;
65
65
  this._floatedIndex = this._props.index;
66
- this._lineStartLocationPercentage =
67
- this._floatedIndex / this._props.items.length;
66
+ this._lineStartLocationPercentage = this._floatedIndex / this._props.items.length;
68
67
  this.labels = this._props.items.map((n, i) => {
69
68
  return new Label({
70
69
  props: {
71
70
  text: n,
72
71
  font: $font("bold", 17),
73
- textColor:
74
- i === this.index
75
- ? this._props.selectedItemColor
76
- : this._props.defaultItemColor,
72
+ textColor: i === this.index ? this._props.selectedItemColor : this._props.defaultItemColor,
77
73
  align: $align.center,
78
74
  userInteractionEnabled: true,
79
75
  },
@@ -101,9 +97,7 @@ export class PageViewerTitleBar extends Base<UIView, UiTypes.ViewOptions> {
101
97
  },
102
98
  layout: (make, view) => {
103
99
  make.left.bottom.inset(0);
104
- make.width
105
- .equalTo(view.super)
106
- .multipliedBy(this._floatedIndex / this._props.items.length);
100
+ make.width.equalTo(view.super).multipliedBy(this._floatedIndex / this._props.items.length);
107
101
  },
108
102
  });
109
103
  this.line = new ContentView({
@@ -125,11 +119,7 @@ export class PageViewerTitleBar extends Base<UIView, UiTypes.ViewOptions> {
125
119
  },
126
120
  layout,
127
121
  events: restEvents,
128
- views: [
129
- this.stack.definition,
130
- this.placeholderView.definition,
131
- this.line.definition,
132
- ],
122
+ views: [this.stack.definition, this.placeholderView.definition, this.line.definition],
133
123
  };
134
124
  };
135
125
  }
@@ -158,7 +148,7 @@ export class PageViewerTitleBar extends Base<UIView, UiTypes.ViewOptions> {
158
148
  n.view.textColor = weightedAverageColors(
159
149
  this._props.selectedItemColor,
160
150
  this._props.defaultItemColor,
161
- floatedIndex - i > 0 ? 1 - (floatedIndex - i) : 1 - (i - floatedIndex)
151
+ floatedIndex - i > 0 ? 1 - (floatedIndex - i) : 1 - (i - floatedIndex),
162
152
  );
163
153
  } else {
164
154
  n.view.textColor = this._props.defaultItemColor;
@@ -75,26 +75,17 @@ export class PageViewer extends Base<UIView, UiTypes.ViewOptions> {
75
75
  events: {
76
76
  layoutSubviews: (sender) => {
77
77
  this._pageWidth = sender.frame.width;
78
- if (this._pageWidth)
79
- sender.contentSize = $size(
80
- this._pageWidth * this._props.cviews.length,
81
- 0
82
- );
78
+ if (this._pageWidth) sender.contentSize = $size(this._pageWidth * this._props.cviews.length, 0);
83
79
  },
84
80
  willEndDragging: (sender, velocity, target) => {
85
81
  const oldPage = this.page;
86
82
  this._props.page = Math.round(target.x / this._pageWidth);
87
- if (oldPage !== this.page && this._events.changed)
88
- this._events.changed(this, this.page);
83
+ if (oldPage !== this.page && this._events.changed) this._events.changed(this, this.page);
89
84
  },
90
85
  didScroll: (sender) => {
91
86
  const rawPage = sender.contentOffset.x / this._pageWidth;
92
- this._floatPage = Math.min(
93
- Math.max(0, rawPage),
94
- this._props.cviews.length - 1
95
- );
96
- if (this._events.floatPageChanged)
97
- this._events.floatPageChanged(this, this._floatPage);
87
+ this._floatPage = Math.min(Math.max(0, rawPage), this._props.cviews.length - 1);
88
+ if (this._events.floatPageChanged) this._events.floatPageChanged(this, this._floatPage);
98
89
  },
99
90
  },
100
91
  layout: $layout.fill,
@@ -60,9 +60,7 @@ export class RotatingView extends Base<UIView, UiTypes.ViewOptions> {
60
60
  if (!this._props.image) throw new Error("image is required");
61
61
  this._innerView = new Image({
62
62
  props: {
63
- image: this._props.tintColor
64
- ? this._props.image.alwaysTemplate
65
- : this._props.image,
63
+ image: this._props.tintColor ? this._props.image.alwaysTemplate : this._props.image,
66
64
  tintColor: this._props.tintColor,
67
65
  contentMode: this._props.contentMode,
68
66
  },
@@ -110,8 +110,7 @@ export class SearchBar extends Base<UIView, UiTypes.ViewOptions> {
110
110
  placeholder: this._props.placeholder,
111
111
  bgcolor: $color("clear"),
112
112
  radius: 0,
113
- accessoryView:
114
- this._props.accessoryCview && this._props.accessoryCview.definition,
113
+ accessoryView: this._props.accessoryCview && this._props.accessoryCview.definition,
115
114
  },
116
115
  layout: (make, view) => {
117
116
  make.left.equalTo(view.prev.right);
@@ -201,11 +200,7 @@ export class SearchBar extends Base<UIView, UiTypes.ViewOptions> {
201
200
  clipsToBounds: true,
202
201
  },
203
202
  layout,
204
- views: [
205
- this.cviews.bgview.definition,
206
- this.cviews.iconInput.definition,
207
- this.cviews.cancelButton.definition,
208
- ],
203
+ views: [this.cviews.bgview.definition, this.cviews.iconInput.definition, this.cviews.cancelButton.definition],
209
204
  };
210
205
  };
211
206
  }
@@ -214,17 +209,11 @@ export class SearchBar extends Base<UIView, UiTypes.ViewOptions> {
214
209
  switch (this._props.style) {
215
210
  case 0: {
216
211
  const IconInputLayout = $layout.fill;
217
- const IconInputLayoutFocused = (
218
- make: MASConstraintMaker,
219
- view: AllUIView
220
- ) => {
212
+ const IconInputLayoutFocused = (make: MASConstraintMaker, view: AllUIView) => {
221
213
  make.left.top.bottom.inset(0);
222
214
  make.right.inset(cancelButtonWidth);
223
215
  };
224
- const cancelButtonLayout = (
225
- make: MASConstraintMaker,
226
- view: AllUIView
227
- ) => {
216
+ const cancelButtonLayout = (make: MASConstraintMaker, view: AllUIView) => {
228
217
  make.right.top.bottom.inset(0);
229
218
  make.width.equalTo(cancelButtonWidth);
230
219
  };
@@ -243,19 +232,13 @@ export class SearchBar extends Base<UIView, UiTypes.ViewOptions> {
243
232
  make.left.top.bottom.inset(0);
244
233
  make.right.equalTo(view.prev);
245
234
  };
246
- const cancelButtonLayout = (
247
- make: MASConstraintMaker,
248
- view: AllUIView
249
- ) => {
235
+ const cancelButtonLayout = (make: MASConstraintMaker, view: AllUIView) => {
250
236
  make.top.bottom.inset(0);
251
237
  make.left.equalTo(view.prev.prev.right);
252
238
  make.width.equalTo(cancelButtonWidth);
253
239
  };
254
240
  const bgviewLayoutNormal = $layout.fill;
255
- const bgviewLayoutFocused = (
256
- make: MASConstraintMaker,
257
- view: AllUIView
258
- ) => {
241
+ const bgviewLayoutFocused = (make: MASConstraintMaker, view: AllUIView) => {
259
242
  make.left.top.bottom.inset(0);
260
243
  make.right.inset(cancelButtonWidth);
261
244
  };
@@ -266,34 +249,22 @@ export class SearchBar extends Base<UIView, UiTypes.ViewOptions> {
266
249
  };
267
250
  }
268
251
  case 2: {
269
- const IconInputLayoutNormal = (
270
- make: MASConstraintMaker,
271
- view: AllUIView
272
- ) => {
252
+ const IconInputLayoutNormal = (make: MASConstraintMaker, view: AllUIView) => {
273
253
  make.center.equalTo(view.super);
274
254
  make.top.bottom.inset(0);
275
255
  make.width.equalTo(placeholderWidth + 50);
276
256
  };
277
- const IconInputLayoutFocused = (
278
- make: MASConstraintMaker,
279
- view: AllUIView
280
- ) => {
257
+ const IconInputLayoutFocused = (make: MASConstraintMaker, view: AllUIView) => {
281
258
  make.left.top.bottom.inset(0);
282
259
  make.right.inset(cancelButtonWidth);
283
260
  };
284
- const cancelButtonLayout = (
285
- make: MASConstraintMaker,
286
- view: AllUIView
287
- ) => {
261
+ const cancelButtonLayout = (make: MASConstraintMaker, view: AllUIView) => {
288
262
  make.right.top.bottom.inset(0);
289
263
  make.left.equalTo(view.prev.prev.right);
290
264
  make.width.equalTo(cancelButtonWidth);
291
265
  };
292
266
  const bgviewLayoutNormal = $layout.fill;
293
- const bgviewLayoutFocused = (
294
- make: MASConstraintMaker,
295
- view: AllUIView
296
- ) => {
267
+ const bgviewLayoutFocused = (make: MASConstraintMaker, view: AllUIView) => {
297
268
  make.left.top.bottom.inset(0);
298
269
  make.right.inset(cancelButtonWidth);
299
270
  };
@@ -313,8 +284,7 @@ export class SearchBar extends Base<UIView, UiTypes.ViewOptions> {
313
284
 
314
285
  _onFocused() {
315
286
  this._focused = true;
316
- if (this._layouts.iconInput.focused)
317
- this.cviews.iconInput.view.remakeLayout(this._layouts.iconInput.focused);
287
+ if (this._layouts.iconInput.focused) this.cviews.iconInput.view.remakeLayout(this._layouts.iconInput.focused);
318
288
  switch (this._props.style) {
319
289
  case 0: {
320
290
  $ui.animate({
@@ -327,8 +297,7 @@ export class SearchBar extends Base<UIView, UiTypes.ViewOptions> {
327
297
  break;
328
298
  }
329
299
  case 1: {
330
- if (this._layouts.bgview.focused)
331
- this.cviews.bgview.view.remakeLayout(this._layouts.bgview.focused);
300
+ if (this._layouts.bgview.focused) this.cviews.bgview.view.remakeLayout(this._layouts.bgview.focused);
332
301
  $ui.animate({
333
302
  duration: 0.2,
334
303
  animation: () => {
@@ -339,12 +308,8 @@ export class SearchBar extends Base<UIView, UiTypes.ViewOptions> {
339
308
  break;
340
309
  }
341
310
  case 2: {
342
- if (this._layouts.iconInput.focused)
343
- this.cviews.iconInput.view.remakeLayout(
344
- this._layouts.iconInput.focused
345
- );
346
- if (this._layouts.bgview.focused)
347
- this.cviews.bgview.view.remakeLayout(this._layouts.bgview.focused);
311
+ if (this._layouts.iconInput.focused) this.cviews.iconInput.view.remakeLayout(this._layouts.iconInput.focused);
312
+ if (this._layouts.bgview.focused) this.cviews.bgview.view.remakeLayout(this._layouts.bgview.focused);
348
313
  $ui.animate({
349
314
  duration: 0.2,
350
315
  animation: () => {
@@ -390,15 +355,10 @@ export class SearchBar extends Base<UIView, UiTypes.ViewOptions> {
390
355
  inset: 20,
391
356
  });
392
357
  const textWidth = getTextWidth(this.text, { inset: 20 });
393
- const IconInputLayoutInputing = (
394
- make: MASConstraintMaker,
395
- view: AllUIView
396
- ) => {
358
+ const IconInputLayoutInputing = (make: MASConstraintMaker, view: AllUIView) => {
397
359
  make.center.equalTo(view.super);
398
360
  make.top.bottom.inset(0);
399
- make.width
400
- .equalTo(Math.max(textWidth, placeholderWidth) + 50)
401
- .priority(999);
361
+ make.width.equalTo(Math.max(textWidth, placeholderWidth) + 50).priority(999);
402
362
  make.width.lessThanOrEqualTo(view.super).priority(1000);
403
363
  };
404
364
  this.cviews.iconInput.view.remakeLayout(IconInputLayoutInputing);
@@ -31,11 +31,7 @@ const UIModalPresentationStyle = {
31
31
  * - dismiss()
32
32
  *
33
33
  */
34
- export class Sheet<
35
- T extends Base<U, R>,
36
- U extends AllUIView,
37
- R extends UiTypes.AllViewOptions
38
- > {
34
+ export class Sheet<T extends Base<U, R>, U extends AllUIView, R extends UiTypes.AllViewOptions> {
39
35
  id: string;
40
36
  _animated: boolean;
41
37
  _presentMode: number;
@@ -76,8 +72,7 @@ export class Sheet<
76
72
  this._PSViewControllerView = this._PSViewController.$view();
77
73
  this._PSViewControllerView.$setBackgroundColor(this._bgcolor);
78
74
  this._PSViewController.$setModalPresentationStyle(this._presentMode);
79
- if (this._interactiveDismissalDisabled)
80
- this._PSViewController.$setModalInPresentation(true);
75
+ if (this._interactiveDismissalDisabled) this._PSViewController.$setModalInPresentation(true);
81
76
  if (this._cview) this._add(this._cview);
82
77
  }
83
78
 
@@ -100,19 +95,10 @@ export class Sheet<
100
95
 
101
96
  present() {
102
97
  this._create();
103
- $ui.controller
104
- .ocValue()
105
- .invoke(
106
- "presentModalViewController:animated",
107
- this._PSViewController,
108
- this._animated
109
- );
98
+ $ui.controller.ocValue().invoke("presentModalViewController:animated", this._PSViewController, this._animated);
110
99
  }
111
100
 
112
101
  dismiss() {
113
- this._PSViewController.invoke(
114
- "dismissModalViewControllerAnimated",
115
- this._animated
116
- );
102
+ this._PSViewController.invoke("dismissModalViewControllerAnimated", this._animated);
117
103
  }
118
104
  }
@@ -9,7 +9,7 @@ export class SingleView<
9
9
  V extends UIBaseView,
10
10
  P extends UiTypes.BaseViewProps,
11
11
  E extends UiTypes.BaseViewEvents<V>,
12
- O extends UiTypes.AllViewOptions
12
+ O extends UiTypes.AllViewOptions,
13
13
  > extends Base<V, O> {
14
14
  _type: T;
15
15
  _props?: P;
@@ -397,13 +397,7 @@ export class Stepper extends SingleView<
397
397
  }
398
398
  }
399
399
 
400
- export class Text extends SingleView<
401
- "text",
402
- UITextView,
403
- UiTypes.TextProps,
404
- UiTypes.TextEvents,
405
- UiTypes.TextOptions
406
- > {
400
+ export class Text extends SingleView<"text", UITextView, UiTypes.TextProps, UiTypes.TextEvents, UiTypes.TextOptions> {
407
401
  constructor({
408
402
  props,
409
403
  layout,
@@ -537,13 +531,7 @@ export class Stack extends SingleView<
537
531
  }
538
532
  }
539
533
 
540
- export class Tab extends SingleView<
541
- "tab",
542
- UITabView,
543
- UiTypes.TabProps,
544
- UiTypes.TabEvents,
545
- UiTypes.TabOptions
546
- > {
534
+ export class Tab extends SingleView<"tab", UITabView, UiTypes.TabProps, UiTypes.TabEvents, UiTypes.TabOptions> {
547
535
  constructor({
548
536
  props,
549
537
  layout,
@@ -565,13 +553,7 @@ export class Tab extends SingleView<
565
553
  }
566
554
  }
567
555
 
568
- export class Menu extends SingleView<
569
- "menu",
570
- UIMenuView,
571
- UiTypes.MenuProps,
572
- UiTypes.MenuEvents,
573
- UiTypes.MenuOptions
574
- > {
556
+ export class Menu extends SingleView<"menu", UIMenuView, UiTypes.MenuProps, UiTypes.MenuEvents, UiTypes.MenuOptions> {
575
557
  constructor({
576
558
  props,
577
559
  layout,
@@ -621,13 +603,7 @@ export class Map extends SingleView<
621
603
  }
622
604
  }
623
605
 
624
- export class Web extends SingleView<
625
- "web",
626
- UIWebView,
627
- UiTypes.WebProps,
628
- UiTypes.WebEvents,
629
- UiTypes.WebOptions
630
- > {
606
+ export class Web extends SingleView<"web", UIWebView, UiTypes.WebProps, UiTypes.WebEvents, UiTypes.WebOptions> {
631
607
  constructor({
632
608
  props,
633
609
  layout,
@@ -649,13 +625,7 @@ export class Web extends SingleView<
649
625
  }
650
626
  }
651
627
 
652
- export class List extends SingleView<
653
- "list",
654
- UIListView,
655
- UiTypes.ListProps,
656
- UiTypes.ListEvents,
657
- UiTypes.ListOptions
658
- > {
628
+ export class List extends SingleView<"list", UIListView, UiTypes.ListProps, UiTypes.ListEvents, UiTypes.ListOptions> {
659
629
  constructor({
660
630
  props,
661
631
  layout,
@@ -4,13 +4,7 @@ class CanvasComponet extends Base<UICanvasView, UiTypes.CanvasOptions> {
4
4
  _tintColor: UIColor;
5
5
  startAngle: number;
6
6
  _defineView: () => UiTypes.CanvasOptions;
7
- constructor({
8
- tintColor,
9
- startAngle,
10
- }: {
11
- tintColor: UIColor;
12
- startAngle: number;
13
- }) {
7
+ constructor({ tintColor, startAngle }: { tintColor: UIColor; startAngle: number }) {
14
8
  super();
15
9
  this._tintColor = tintColor;
16
10
  this.startAngle = startAngle;
@@ -34,7 +28,7 @@ class CanvasComponet extends Base<UICanvasView, UiTypes.CanvasOptions> {
34
28
  radius / 2 - 20,
35
29
  this.startAngle,
36
30
  this.startAngle + (Math.PI * 2 * 1) / 4,
37
- false
31
+ false,
38
32
  );
39
33
  ctx.strokePath();
40
34
  },
@@ -4,13 +4,7 @@ class CanvasComponet extends Base<UICanvasView, UiTypes.CanvasOptions> {
4
4
  _tintColor: UIColor;
5
5
  startAngle: number;
6
6
  _defineView: () => UiTypes.CanvasOptions;
7
- constructor({
8
- tintColor,
9
- startAngle,
10
- }: {
11
- tintColor: UIColor;
12
- startAngle: number;
13
- }) {
7
+ constructor({ tintColor, startAngle }: { tintColor: UIColor; startAngle: number }) {
14
8
  super();
15
9
  this._tintColor = tintColor;
16
10
  this.startAngle = startAngle;
@@ -32,7 +26,7 @@ class CanvasComponet extends Base<UICanvasView, UiTypes.CanvasOptions> {
32
26
  radius / 2,
33
27
  this.startAngle,
34
28
  this.startAngle + (Math.PI * 2 * 1) / 4,
35
- true
29
+ true,
36
30
  );
37
31
  ctx.addLineToPoint(radius / 2, radius / 2);
38
32
  ctx.closePath();
@@ -59,12 +53,7 @@ export class Wedges extends Base<UIView, UiTypes.ViewOptions> {
59
53
  * @param layout 布局
60
54
  */
61
55
  constructor({
62
- colors = [
63
- $color("#f5542e"),
64
- $color("#f2c327"),
65
- $color("#008b6e"),
66
- $color("#00aede"),
67
- ],
56
+ colors = [$color("#f5542e"), $color("#f2c327"), $color("#008b6e"), $color("#00aede")],
68
57
  layout,
69
58
  }: {
70
59
  colors?: UIColor[];
@@ -94,12 +83,7 @@ export class Wedges extends Base<UIView, UiTypes.ViewOptions> {
94
83
  props: {
95
84
  id: this.id,
96
85
  },
97
- views: [
98
- canvas1.definition,
99
- canvas2.definition,
100
- canvas3.definition,
101
- canvas4.definition,
102
- ],
86
+ views: [canvas1.definition, canvas2.definition, canvas3.definition, canvas4.definition],
103
87
  layout,
104
88
  events: {
105
89
  ready: async (sender) => {
@@ -12,10 +12,7 @@ interface AndroidStyleSpinnerProps {
12
12
  * 安卓风格的加载指示器, 基于Lottie实现, 效果是一个圆环一边旋转一边缩放。
13
13
  * 由于帧数有限,不建议在大视图上使用。
14
14
  */
15
- export class AndroidStyleSpinner extends Base<
16
- UILottieView,
17
- UiTypes.LottieOptions
18
- > {
15
+ export class AndroidStyleSpinner extends Base<UILottieView, UiTypes.LottieOptions> {
19
16
  private _props: AndroidStyleSpinnerProps;
20
17
  _defineView: () => UiTypes.LottieOptions;
21
18
 
@@ -260,9 +257,7 @@ export class AndroidStyleSpinner extends Base<
260
257
  layout:
261
258
  layout ||
262
259
  ((make, view) => {
263
- make.size.equalTo(
264
- $size(this._props.diameter, this._props.diameter)
265
- );
260
+ make.size.equalTo($size(this._props.diameter, this._props.diameter));
266
261
  make.center.equalTo(view.super);
267
262
  }),
268
263
  events: {