jsbox-cview 1.5.21 → 1.5.23

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 (114) hide show
  1. package/components/alert/input-alert.ts +5 -7
  2. package/components/alert/login-alert.ts +7 -7
  3. package/components/alert/plain-alert.ts +3 -3
  4. package/components/alert/uialert.ts +14 -6
  5. package/components/base.ts +12 -8
  6. package/components/custom-navigation-bar.ts +106 -88
  7. package/components/dialogs/dialog-sheet.ts +12 -8
  8. package/components/dialogs/form-dialog.ts +29 -16
  9. package/components/dialogs/list-dialog.ts +26 -20
  10. package/components/dialogs/text-dialog.ts +13 -8
  11. package/components/dynamic-contextmenu-view.ts +57 -25
  12. package/components/dynamic-itemsize-matrix.ts +45 -40
  13. package/components/dynamic-preference-listview.ts +135 -117
  14. package/components/dynamic-rowheight-list.ts +32 -20
  15. package/components/enhanced-imageview.ts +37 -28
  16. package/components/flowlayout.ts +61 -42
  17. package/components/image-pager.ts +33 -29
  18. package/components/page-control.ts +15 -11
  19. package/components/pageviewer-titlebar.ts +29 -22
  20. package/components/pageviewer.ts +33 -23
  21. package/components/refresh-button.ts +8 -8
  22. package/components/rotating-view.ts +24 -20
  23. package/components/searchbar.ts +113 -65
  24. package/components/sheet.ts +23 -17
  25. package/components/single-views.ts +228 -72
  26. package/components/spinners/loading-dual-ring.ts +21 -15
  27. package/components/spinners/loading-wedges.ts +24 -18
  28. package/components/spinners/spinner-androidstyle.ts +58 -47
  29. package/components/static-preference-listview.ts +197 -151
  30. package/components/symbol-button.ts +23 -22
  31. package/components/tabbar.ts +80 -64
  32. package/controller/base-controller.ts +42 -35
  33. package/controller/controller-router.ts +4 -4
  34. package/controller/pageviewer-controller.ts +41 -27
  35. package/controller/presented-page-controller.ts +27 -15
  36. package/controller/splitview-controller.ts +77 -44
  37. package/controller/tabbar-controller.ts +33 -23
  38. package/dist/components/alert/input-alert.js +3 -3
  39. package/dist/components/alert/login-alert.js +5 -5
  40. package/dist/components/alert/plain-alert.js +1 -1
  41. package/dist/components/alert/uialert.js +4 -4
  42. package/dist/components/base.js +2 -1
  43. package/dist/components/custom-navigation-bar.js +61 -59
  44. package/dist/components/dialogs/dialog-sheet.js +5 -5
  45. package/dist/components/dialogs/form-dialog.js +2 -2
  46. package/dist/components/dialogs/list-dialog.js +15 -15
  47. package/dist/components/dialogs/text-dialog.js +6 -6
  48. package/dist/components/dynamic-contextmenu-view.js +11 -8
  49. package/dist/components/dynamic-itemsize-matrix.js +15 -13
  50. package/dist/components/dynamic-preference-listview.js +95 -90
  51. package/dist/components/dynamic-rowheight-list.js +7 -6
  52. package/dist/components/enhanced-imageview.js +18 -16
  53. package/dist/components/flowlayout.js +15 -14
  54. package/dist/components/image-pager.js +22 -21
  55. package/dist/components/page-control.js +2 -2
  56. package/dist/components/pageviewer-titlebar.js +20 -17
  57. package/dist/components/pageviewer.js +13 -12
  58. package/dist/components/refresh-button.js +5 -5
  59. package/dist/components/rotating-view.js +11 -11
  60. package/dist/components/searchbar.js +53 -41
  61. package/dist/components/sheet.js +4 -4
  62. package/dist/components/single-views.js +68 -68
  63. package/dist/components/spinners/loading-dual-ring.js +10 -10
  64. package/dist/components/spinners/loading-wedges.js +15 -15
  65. package/dist/components/spinners/spinner-androidstyle.js +45 -43
  66. package/dist/components/static-preference-listview.js +101 -102
  67. package/dist/components/symbol-button.js +14 -13
  68. package/dist/components/tabbar.js +54 -50
  69. package/dist/controller/base-controller.js +17 -14
  70. package/dist/controller/pageviewer-controller.js +13 -11
  71. package/dist/controller/presented-page-controller.js +6 -4
  72. package/dist/controller/splitview-controller.js +48 -31
  73. package/dist/controller/tabbar-controller.js +13 -12
  74. package/dist/test/custom-navigation-bar.js +11 -9
  75. package/dist/test/dynamic-contextmenu-view.js +16 -14
  76. package/dist/test/dynamic-itemsize-matrix.js +18 -17
  77. package/dist/test/dynamic-preference-listview.js +29 -29
  78. package/dist/test/flowlayout.js +33 -27
  79. package/dist/test/form-dialog.js +15 -13
  80. package/dist/test/pageviewer-controller.js +10 -7
  81. package/dist/test/pageviewer-titlebar.js +3 -3
  82. package/dist/test/pageviewer.js +16 -7
  83. package/dist/test/refresh-button.js +4 -4
  84. package/dist/test/searchbar.js +7 -7
  85. package/dist/test/splitview-controller.js +14 -11
  86. package/dist/test/static-preference-listview.js +29 -30
  87. package/dist/test/tabbar-controller.js +15 -12
  88. package/dist/utils/colors.js +1 -2
  89. package/dist/utils/l10n.js +28 -28
  90. package/dist/utils/path.js +2 -2
  91. package/dist/utils/rect.js +30 -8
  92. package/dist/utils/uitools.js +29 -19
  93. package/index.ts +43 -43
  94. package/package.json +2 -2
  95. package/test/custom-navigation-bar.ts +28 -28
  96. package/test/dynamic-contextmenu-view.ts +23 -21
  97. package/test/dynamic-itemsize-matrix.ts +27 -22
  98. package/test/dynamic-preference-listview.ts +35 -35
  99. package/test/flowlayout.ts +43 -33
  100. package/test/form-dialog.ts +44 -43
  101. package/test/pageviewer-controller.ts +13 -11
  102. package/test/pageviewer-titlebar.ts +4 -5
  103. package/test/pageviewer.ts +17 -8
  104. package/test/refresh-button.ts +5 -5
  105. package/test/searchbar.ts +8 -8
  106. package/test/splitview-controller.ts +31 -30
  107. package/test/static-preference-listview.ts +35 -34
  108. package/test/tabbar-controller.ts +32 -29
  109. package/utils/colors.ts +7 -8
  110. package/utils/cvid.ts +1 -2
  111. package/utils/l10n.ts +32 -32
  112. package/utils/path.ts +9 -9
  113. package/utils/rect.ts +31 -8
  114. package/utils/uitools.ts +30 -22
@@ -23,7 +23,8 @@ class SearchBar extends base_1.Base {
23
23
  * - style: number 搜索框的样式
24
24
  * - 0: 取消按钮在输入框内,聚焦时显示取消按钮
25
25
  * - 1: 取消按钮在输入框右侧,聚焦时会有左右移动的动画
26
- * - 2: 取消按钮布局同 1,但是 placeholder 平时显示在中间,聚焦时才会移动到左边。如果使用此样式,建议每次 blur 的时候都清除 text。
26
+ * - 2: 取消按钮布局同 1,但是 placeholder 平时显示在中间,聚焦时才会移动到左边。
27
+ * 如果使用此样式,建议每次 blur 的时候都清除 text。
27
28
  * - accessoryCview: cview 请通过下面的事件来和 SearchBar 互相操作
28
29
  * - placeholder: string
29
30
  * - cancelText: string
@@ -36,11 +37,15 @@ class SearchBar extends base_1.Base {
36
37
  * - changed: cview => void
37
38
  * - returned: cview => void
38
39
  */
39
- constructor({ props, layout, events = {} }) {
40
+ constructor({ props, layout, events = {}, }) {
40
41
  super();
41
42
  this._props = Object.assign({ placeholder: (0, l10n_1.l10n)("SEARCH"), cancelText: (0, l10n_1.l10n)("CANCEL"), tintColor: $color("systemLink"), bgcolor: colors_1.searchBarBgcolor, style: 0 }, props);
42
- const cancelButtonWidth = (0, uitools_1.getTextWidth)(this._props.cancelText, { inset: 20 });
43
- const placeholderWidth = (0, uitools_1.getTextWidth)(this._props.placeholder, { inset: 20 });
43
+ const cancelButtonWidth = (0, uitools_1.getTextWidth)(this._props.cancelText, {
44
+ inset: 20,
45
+ });
46
+ const placeholderWidth = (0, uitools_1.getTextWidth)(this._props.placeholder, {
47
+ inset: 20,
48
+ });
44
49
  this._focused = false;
45
50
  this._layouts = this._defineLayouts(cancelButtonWidth, placeholderWidth);
46
51
  this.cviews = {};
@@ -50,36 +55,36 @@ class SearchBar extends base_1.Base {
50
55
  placeholder: this._props.placeholder,
51
56
  bgcolor: $color("clear"),
52
57
  radius: 0,
53
- accessoryView: this._props.accessoryCview && this._props.accessoryCview.definition
58
+ accessoryView: this._props.accessoryCview && this._props.accessoryCview.definition,
54
59
  },
55
60
  layout: (make, view) => {
56
61
  make.left.equalTo(view.prev.right);
57
62
  make.top.bottom.right.inset(0);
58
63
  },
59
64
  events: {
60
- changed: sender => {
65
+ changed: (sender) => {
61
66
  if (events.changed)
62
67
  events.changed(this);
63
68
  },
64
- didBeginEditing: sender => {
69
+ didBeginEditing: (sender) => {
65
70
  this._onFocused();
66
71
  if (events.didBeginEditing)
67
72
  events.didBeginEditing(this);
68
73
  },
69
- didEndEditing: sender => {
74
+ didEndEditing: (sender) => {
70
75
  if (events.didEndEditing)
71
76
  events.didEndEditing(this);
72
77
  },
73
- returned: sender => {
78
+ returned: (sender) => {
74
79
  this.blur();
75
80
  if (events.returned)
76
81
  events.returned(this);
77
- }
78
- }
82
+ },
83
+ },
79
84
  });
80
85
  this.cviews.iconInput = new single_views_1.ContentView({
81
86
  props: {
82
- bgcolor: undefined
87
+ bgcolor: undefined,
83
88
  },
84
89
  layout: this._layouts.iconInput.normal,
85
90
  views: [
@@ -92,22 +97,22 @@ class SearchBar extends base_1.Base {
92
97
  props: {
93
98
  //tintColor: searchBarSymbolColor,
94
99
  tintColor: $color("systemPlaceholderText"),
95
- symbol: "magnifyingglass"
100
+ symbol: "magnifyingglass",
96
101
  },
97
102
  layout: (make, view) => {
98
103
  make.size.equalTo($size(20, 20));
99
104
  make.center.equalTo(view.super);
100
- }
101
- }
105
+ },
106
+ },
102
107
  ],
103
108
  layout: (make, view) => {
104
109
  make.top.bottom.inset(0);
105
110
  make.width.equalTo(20);
106
111
  make.left.inset(6);
107
- }
112
+ },
108
113
  },
109
- this.cviews.input.definition
110
- ]
114
+ this.cviews.input.definition,
115
+ ],
111
116
  });
112
117
  this.cviews.cancelButton = new single_views_1.Label({
113
118
  props: {
@@ -116,40 +121,40 @@ class SearchBar extends base_1.Base {
116
121
  font: $font(17),
117
122
  align: $align.center,
118
123
  userInteractionEnabled: true,
119
- alpha: 0
124
+ alpha: 0,
120
125
  },
121
126
  layout: this._layouts.cancelButton.normal,
122
127
  events: {
123
- tapped: sender => this.blur()
124
- }
128
+ tapped: (sender) => this.blur(),
129
+ },
125
130
  });
126
131
  this.cviews.bgview = new single_views_1.ContentView({
127
132
  props: {
128
133
  bgcolor: this._props.bgcolor,
129
134
  radius: 8,
130
- userInteractionEnabled: true
135
+ userInteractionEnabled: true,
131
136
  },
132
137
  layout: this._layouts.bgview.normal,
133
138
  events: {
134
- tapped: sender => {
139
+ tapped: (sender) => {
135
140
  if (!this._focused)
136
141
  this.focus();
137
- }
138
- }
142
+ },
143
+ },
139
144
  });
140
145
  this._defineView = () => {
141
146
  return {
142
147
  type: "view",
143
148
  props: {
144
149
  id: this.id,
145
- clipsToBounds: true
150
+ clipsToBounds: true,
146
151
  },
147
152
  layout,
148
153
  views: [
149
154
  this.cviews.bgview.definition,
150
155
  this.cviews.iconInput.definition,
151
- this.cviews.cancelButton.definition
152
- ]
156
+ this.cviews.cancelButton.definition,
157
+ ],
153
158
  };
154
159
  };
155
160
  }
@@ -167,9 +172,12 @@ class SearchBar extends base_1.Base {
167
172
  };
168
173
  const bgviewLayout = $layout.fill;
169
174
  return {
170
- iconInput: { normal: IconInputLayout, focused: IconInputLayoutFocused },
175
+ iconInput: {
176
+ normal: IconInputLayout,
177
+ focused: IconInputLayoutFocused,
178
+ },
171
179
  cancelButton: { normal: cancelButtonLayout },
172
- bgview: { normal: bgviewLayout }
180
+ bgview: { normal: bgviewLayout },
173
181
  };
174
182
  }
175
183
  case 1: {
@@ -190,7 +198,7 @@ class SearchBar extends base_1.Base {
190
198
  return {
191
199
  iconInput: { normal: IconInputLayout },
192
200
  cancelButton: { normal: cancelButtonLayout },
193
- bgview: { normal: bgviewLayoutNormal, focused: bgviewLayoutFocused }
201
+ bgview: { normal: bgviewLayoutNormal, focused: bgviewLayoutFocused },
194
202
  };
195
203
  }
196
204
  case 2: {
@@ -216,10 +224,10 @@ class SearchBar extends base_1.Base {
216
224
  return {
217
225
  iconInput: {
218
226
  normal: IconInputLayoutNormal,
219
- focused: IconInputLayoutFocused
227
+ focused: IconInputLayoutFocused,
220
228
  },
221
229
  cancelButton: { normal: cancelButtonLayout },
222
- bgview: { normal: bgviewLayoutNormal, focused: bgviewLayoutFocused }
230
+ bgview: { normal: bgviewLayoutNormal, focused: bgviewLayoutFocused },
223
231
  };
224
232
  }
225
233
  default:
@@ -237,7 +245,7 @@ class SearchBar extends base_1.Base {
237
245
  animation: () => {
238
246
  this.cviews.iconInput.view.relayout();
239
247
  this.cviews.cancelButton.view.alpha = 1;
240
- }
248
+ },
241
249
  });
242
250
  break;
243
251
  }
@@ -249,7 +257,7 @@ class SearchBar extends base_1.Base {
249
257
  animation: () => {
250
258
  this.cviews.bgview.view.relayout();
251
259
  this.cviews.cancelButton.view.alpha = 1;
252
- }
260
+ },
253
261
  });
254
262
  break;
255
263
  }
@@ -264,7 +272,7 @@ class SearchBar extends base_1.Base {
264
272
  this.cviews.iconInput.view.relayout();
265
273
  this.cviews.bgview.view.relayout();
266
274
  this.cviews.cancelButton.view.alpha = 1;
267
- }
275
+ },
268
276
  });
269
277
  break;
270
278
  }
@@ -282,7 +290,7 @@ class SearchBar extends base_1.Base {
282
290
  animation: () => {
283
291
  this.cviews.iconInput.view.relayout();
284
292
  this.cviews.cancelButton.view.alpha = 0;
285
- }
293
+ },
286
294
  });
287
295
  break;
288
296
  }
@@ -293,17 +301,21 @@ class SearchBar extends base_1.Base {
293
301
  animation: () => {
294
302
  this.cviews.bgview.view.relayout();
295
303
  this.cviews.cancelButton.view.alpha = 0;
296
- }
304
+ },
297
305
  });
298
306
  break;
299
307
  }
300
308
  case 2: {
301
- const placeholderWidth = (0, uitools_1.getTextWidth)(this._props.placeholder, { inset: 20 });
309
+ const placeholderWidth = (0, uitools_1.getTextWidth)(this._props.placeholder, {
310
+ inset: 20,
311
+ });
302
312
  const textWidth = (0, uitools_1.getTextWidth)(this.text, { inset: 20 });
303
313
  const IconInputLayoutInputing = (make, view) => {
304
314
  make.center.equalTo(view.super);
305
315
  make.top.bottom.inset(0);
306
- make.width.equalTo(Math.max(textWidth, placeholderWidth) + 50).priority(999);
316
+ make.width
317
+ .equalTo(Math.max(textWidth, placeholderWidth) + 50)
318
+ .priority(999);
307
319
  make.width.lessThanOrEqualTo(view.super).priority(1000);
308
320
  };
309
321
  this.cviews.iconInput.view.remakeLayout(IconInputLayoutInputing);
@@ -314,7 +326,7 @@ class SearchBar extends base_1.Base {
314
326
  this.cviews.iconInput.view.relayout();
315
327
  this.cviews.bgview.view.relayout();
316
328
  this.cviews.cancelButton.view.alpha = 0;
317
- }
329
+ },
318
330
  });
319
331
  break;
320
332
  }
@@ -12,7 +12,7 @@ const UIModalPresentationStyle = {
12
12
  overFullScreen: 5,
13
13
  overCurrentContext: 6,
14
14
  popover: 7,
15
- none: -1
15
+ none: -1,
16
16
  };
17
17
  /**
18
18
  *
@@ -32,7 +32,7 @@ const UIModalPresentationStyle = {
32
32
  *
33
33
  */
34
34
  class Sheet {
35
- constructor({ presentMode = UIModalPresentationStyle.pageSheet, animated = true, interactiveDismissalDisabled = false, bgcolor = $color("secondarySurface"), cview, dismissalHandler }) {
35
+ constructor({ presentMode = UIModalPresentationStyle.pageSheet, animated = true, interactiveDismissalDisabled = false, bgcolor = $color("secondarySurface"), cview, dismissalHandler, }) {
36
36
  this._animated = animated;
37
37
  this._presentMode = presentMode;
38
38
  this._interactiveDismissalDisabled = interactiveDismissalDisabled;
@@ -59,8 +59,8 @@ class Sheet {
59
59
  "viewDidDisappear:": () => {
60
60
  if (this._dismissalHandler)
61
61
  this._dismissalHandler();
62
- }
63
- }
62
+ },
63
+ },
64
64
  });
65
65
  }
66
66
  _add(cview) {