@opentiny/vue-renderless 3.12.0 → 3.13.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/action-sheet/index.js +20 -13
  2. package/action-sheet/vue.js +8 -7
  3. package/alert/index.js +50 -1
  4. package/alert/vue.js +36 -9
  5. package/amount/index.js +100 -25
  6. package/amount/vue.js +102 -26
  7. package/anchor/index.js +1 -0
  8. package/area/index.js +8 -8
  9. package/area/vue.js +5 -5
  10. package/async-flowchart/index.js +16 -3
  11. package/autocomplete/index.js +58 -14
  12. package/autocomplete/vue.js +40 -12
  13. package/badge/index.js +12 -0
  14. package/badge/vue.js +6 -4
  15. package/breadcrumb/vue.js +3 -1
  16. package/breadcrumb-item/vue.js +6 -2
  17. package/button/index.js +5 -1
  18. package/calendar/index.js +2 -86
  19. package/calendar-bar/index.js +20 -6
  20. package/calendar-view/index.js +10 -12
  21. package/calendar-view/vue.js +17 -4
  22. package/cascader/index.js +80 -34
  23. package/cascader/vue.js +49 -19
  24. package/cascader-menu/index.js +7 -7
  25. package/cascader-menu/vue.js +2 -3
  26. package/cascader-mobile/index.js +37 -24
  27. package/cascader-mobile/vue.js +7 -1
  28. package/cascader-node/index.js +13 -1
  29. package/cascader-node/vue.js +15 -4
  30. package/cascader-panel/index.js +1 -1
  31. package/cascader-select/column-index.js +150 -0
  32. package/cascader-select/column.js +120 -0
  33. package/cascader-select/index.js +29 -165
  34. package/cascader-select/usePicker.js +251 -0
  35. package/cascader-select/useTouch.js +65 -0
  36. package/cascader-select/vue.js +35 -47
  37. package/cascader-view/index.js +1 -1
  38. package/cell/vue.js +2 -1
  39. package/chart-bar/index.js +2 -3
  40. package/chart-core/deps/constants.js +43 -43
  41. package/chart-core/index.js +1 -1
  42. package/chart-gauge/index.js +2 -2
  43. package/chart-heatmap/index.js +17 -10
  44. package/chart-line/index.js +8 -9
  45. package/chart-tree/index.js +2 -2
  46. package/chart-waterfall/index.js +4 -6
  47. package/checkbox/index.js +17 -0
  48. package/checkbox/vue.js +16 -7
  49. package/checkbox-group/vue.js +2 -0
  50. package/col/index.js +7 -2
  51. package/col/vue.js +1 -1
  52. package/collapse/index.js +3 -3
  53. package/color-select-panel/vue.js +0 -7
  54. package/column-list-item/index.js +17 -1
  55. package/column-list-item/vue.js +8 -3
  56. package/common/date.js +2 -0
  57. package/common/deps/dom.js +19 -4
  58. package/common/deps/popper.js +48 -5
  59. package/common/deps/touch-emulator.js +4 -1
  60. package/common/deps/tree-model/node.js +1 -1
  61. package/common/deps/tree-model/tree-store.js +2 -13
  62. package/common/deps/useRect.js +25 -0
  63. package/common/deps/vue-popper.js +22 -10
  64. package/common/index.js +1 -1
  65. package/common/runtime.js +1 -1
  66. package/common/type.js +2 -1
  67. package/common/validate/rules/enum.js +1 -1
  68. package/common/validate/rules/pattern.js +2 -2
  69. package/common/validate/rules/range.js +8 -5
  70. package/common/validate/rules/required.js +1 -1
  71. package/common/validate/rules/type.js +5 -5
  72. package/common/validate/rules/whitespace.js +1 -1
  73. package/common/validate/util.js +15 -16
  74. package/common/validate/validations/integer.js +1 -1
  75. package/common/validate/validations/method.js +1 -1
  76. package/container/index.js +17 -1
  77. package/container/vue.js +12 -3
  78. package/currency/index.js +74 -7
  79. package/currency/vue.js +21 -5
  80. package/date-panel/index.js +16 -0
  81. package/date-panel/vue.js +8 -2
  82. package/date-picker-mobile/index.js +12 -0
  83. package/date-picker-mobile/vue.js +7 -1
  84. package/date-range/vue.js +12 -5
  85. package/date-table/index.js +5 -0
  86. package/date-table/vue.js +3 -1
  87. package/dialog-box/index.js +17 -6
  88. package/dialog-select/index.js +6 -3
  89. package/dialog-select/vue.js +8 -4
  90. package/drawer/index.js +26 -5
  91. package/drawer/vue.js +13 -7
  92. package/dropdown/index.js +7 -7
  93. package/dropdown/vue.js +6 -2
  94. package/dropdown-item/index.js +9 -1
  95. package/dropdown-item/mf.js +6 -10
  96. package/dropdown-item/vue.js +21 -8
  97. package/dropdown-menu/index.js +20 -7
  98. package/dropdown-menu/vue.js +4 -3
  99. package/exception/index.js +2 -7
  100. package/exception/vue.js +7 -10
  101. package/fall-menu/index.js +5 -1
  102. package/fall-menu/vue.js +13 -2
  103. package/file-upload/index.js +47 -12
  104. package/file-upload/vue.js +38 -8
  105. package/filter-box/index.js +1 -0
  106. package/floating-button/index.js +62 -16
  107. package/floating-button/vue.js +27 -9
  108. package/flowchart/index.js +134 -25
  109. package/flowchart/node.js +13 -4
  110. package/flowchart/vue.js +16 -4
  111. package/form/vue.js +3 -1
  112. package/form-item/index.js +4 -4
  113. package/form-item/vue.js +3 -1
  114. package/fullscreen/index.js +5 -5
  115. package/fullscreen/vue.js +3 -3
  116. package/grid/utils/common.js +10 -5
  117. package/grid/utils/dom.js +7 -1
  118. package/image/index.js +6 -0
  119. package/image/vue.js +6 -3
  120. package/image-viewer/index.js +62 -51
  121. package/image-viewer/vue.js +17 -5
  122. package/input/index.js +89 -22
  123. package/input/vue.js +52 -21
  124. package/ip-address/index.js +61 -19
  125. package/ip-address/vue.js +22 -4
  126. package/label/index.js +56 -0
  127. package/label/vue.js +26 -0
  128. package/link/vue.js +3 -1
  129. package/loading/vue.js +8 -2
  130. package/logout/index.js +1 -1
  131. package/mask/index.js +13 -0
  132. package/mask/vue.js +18 -0
  133. package/mind-map/index.js +47 -0
  134. package/mind-map/vue.js +53 -0
  135. package/multi-select/index.js +150 -10
  136. package/multi-select/vue.js +46 -11
  137. package/multi-select-item/index.js +17 -0
  138. package/multi-select-item/vue.js +31 -0
  139. package/numeric/index.js +51 -9
  140. package/numeric/vue.js +44 -14
  141. package/option/index.js +12 -5
  142. package/option/vue.js +15 -7
  143. package/option-group/index.js +3 -3
  144. package/package.json +1 -1
  145. package/pager/index.js +372 -0
  146. package/pager/vue.js +125 -2
  147. package/picker/index.js +253 -48
  148. package/picker/mb.js +42 -0
  149. package/picker/vue.js +70 -17
  150. package/picker-column/index.js +1 -1
  151. package/pop-upload/index.js +0 -2
  152. package/pop-upload/vue.js +3 -4
  153. package/popconfirm/index.js +3 -6
  154. package/popconfirm/vue.js +1 -1
  155. package/popeditor/index.js +55 -24
  156. package/popeditor/vue.js +15 -11
  157. package/popover/index.js +4 -4
  158. package/popover/vue.js +6 -6
  159. package/popup/index.js +3 -3
  160. package/popup/vue.js +5 -5
  161. package/pull-refresh/index.js +57 -65
  162. package/pull-refresh/vue.js +23 -7
  163. package/radio/index.js +0 -17
  164. package/radio/vue.js +4 -10
  165. package/rate/index.js +1 -1
  166. package/rate/vue.js +0 -2
  167. package/record/index.js +4 -1
  168. package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
  169. package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
  170. package/scrollbar/index.js +11 -11
  171. package/scrollbar/vue-bar.js +3 -3
  172. package/scrollbar/vue.js +5 -5
  173. package/search/index.js +1 -1
  174. package/search/vue.js +3 -1
  175. package/select/index.js +185 -113
  176. package/select/vue.js +105 -20
  177. package/select-dropdown/index.js +62 -4
  178. package/select-dropdown/vue.js +85 -8
  179. package/select-view/index.js +3 -1
  180. package/signature/index.js +241 -0
  181. package/signature/vue.js +88 -0
  182. package/skeleton/index.js +14 -0
  183. package/skeleton/vue.js +15 -0
  184. package/skeleton-item/vue.js +15 -0
  185. package/slider/index.js +27 -7
  186. package/slider/vue.js +26 -7
  187. package/split/index.js +1 -1
  188. package/split/vue.js +4 -6
  189. package/standard-list-item/index.js +15 -1
  190. package/standard-list-item/vue.js +6 -5
  191. package/steps/index.js +25 -2
  192. package/steps/slide-bar.js +8 -1
  193. package/steps/vue.js +15 -3
  194. package/tab-item-mf/vue.js +14 -8
  195. package/tab-nav/index.js +9 -4
  196. package/tab-nav/vue.js +6 -2
  197. package/tabbar/vue.js +9 -3
  198. package/tabbar-item/vue.js +3 -2
  199. package/tabs/index.js +1 -1
  200. package/tabs/vue.js +1 -0
  201. package/tabs-mf/index.js +20 -6
  202. package/tabs-mf/vue-nav.js +26 -11
  203. package/tabs-mf/vue.js +7 -7
  204. package/tag/index.js +1 -1
  205. package/tag/vue.js +5 -1
  206. package/tag-group/index.js +2 -1
  207. package/tall-storage/index.js +4 -5
  208. package/time/index.js +4 -1
  209. package/time/vue.js +1 -1
  210. package/time-line/vue.js +1 -1
  211. package/time-picker-mobile/index.js +24 -5
  212. package/time-picker-mobile/vue.js +17 -7
  213. package/time-range/index.js +2 -0
  214. package/time-spinner/index.js +0 -3
  215. package/time-spinner/vue.js +2 -3
  216. package/timeline-item/vue.js +1 -1
  217. package/tooltip/index.js +1 -2
  218. package/tooltip/vue.js +3 -3
  219. package/transfer/index.js +20 -22
  220. package/transfer/vue.js +1 -6
  221. package/transfer-panel/vue.js +3 -5
  222. package/tree/index.js +21 -4
  223. package/tree/vue.js +10 -8
  224. package/tree-menu/index.js +27 -3
  225. package/tree-menu/vue.js +27 -14
  226. package/tree-node/index.js +12 -10
  227. package/tree-node/vue.js +6 -5
  228. package/types/action-menu.type.d.ts +5 -0
  229. package/types/action-sheet.type.d.ts +118 -1
  230. package/types/alert.type.d.ts +16 -1
  231. package/types/amount.type.d.ts +168 -1
  232. package/types/area.type.d.ts +134 -1
  233. package/types/async-flowchart.type.d.ts +72 -0
  234. package/types/autocomplete.type.d.ts +199 -1
  235. package/types/badge.type.d.ts +3 -1
  236. package/types/breadcrumb-item.type.d.ts +2 -0
  237. package/types/breadcrumb.type.d.ts +2 -0
  238. package/types/button.type.d.ts +5 -0
  239. package/types/cascader-menu.type.d.ts +3 -4
  240. package/types/cascader-node.type.d.ts +5 -2
  241. package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
  242. package/types/cascader-panel.type.d.ts +3 -241
  243. package/types/cascader.type.d.ts +327 -1
  244. package/types/checkbox.type.d.ts +9 -0
  245. package/types/collapse.type.d.ts +19 -2
  246. package/types/date-picker.type.d.ts +33 -0
  247. package/types/dialog-box.type.d.ts +5 -1
  248. package/types/drawer.type.d.ts +132 -1
  249. package/types/{dropdown-item.type-bf83e929.d.ts → dropdown-item.type-8475a549.d.ts} +8 -14
  250. package/types/dropdown-item.type.d.ts +1 -1
  251. package/types/dropdown-menu.type.d.ts +1 -1
  252. package/types/dropdown.type.d.ts +2 -5
  253. package/types/fall-menu.type.d.ts +94 -1
  254. package/types/file-upload.type.d.ts +1 -1
  255. package/types/form-item.type.d.ts +1 -1
  256. package/types/{form.type-d0fd42f3.d.ts → form.type-d88482e4.d.ts} +3 -0
  257. package/types/form.type.d.ts +1 -1
  258. package/types/input.type.d.ts +23 -9
  259. package/types/ip-address.type.d.ts +160 -1
  260. package/types/label.type.d.ts +81 -0
  261. package/types/link.type.d.ts +6 -3
  262. package/types/mind-map.type.d.ts +20 -0
  263. package/types/modal.type.d.ts +4 -2
  264. package/types/numeric.type.d.ts +36 -9
  265. package/types/pager.type.d.ts +171 -1
  266. package/types/picker.type.d.ts +14 -0
  267. package/types/popconfirm.type.d.ts +85 -1
  268. package/types/popeditor.type.d.ts +4 -0
  269. package/types/popover.type.d.ts +3 -3
  270. package/types/radio.type.d.ts +0 -4
  271. package/types/rate.type.d.ts +236 -1
  272. package/types/search.type.d.ts +88 -1
  273. package/types/shared.type.d.ts +1 -1
  274. package/types/skeleton-item.type.d.ts +38 -0
  275. package/types/skeleton.type.d.ts +45 -0
  276. package/types/slider.type.d.ts +8 -1
  277. package/types/steps.type.d.ts +14 -3
  278. package/types/tab-item.type.d.ts +0 -1
  279. package/types/tab-nav.type.d.ts +6 -1
  280. package/types/tabs.type.d.ts +5 -0
  281. package/types/tag-group.type.d.ts +64 -1
  282. package/types/tag.type.d.ts +12 -0
  283. package/types/tooltip.type.d.ts +1 -1
  284. package/types/transfer.type.d.ts +183 -1
  285. package/types/tree-menu.type.d.ts +210 -1
  286. package/types/upload-dragger.type.d.ts +1 -1
  287. package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-1078fba2.d.ts} +27 -6
  288. package/types/upload-list.type.d.ts +1 -1
  289. package/types/upload.type.d.ts +1 -1
  290. package/types/wizard.type.d.ts +1 -0
  291. package/upload/index.js +59 -29
  292. package/upload/vue.js +6 -4
  293. package/upload-list/index.js +14 -14
  294. package/upload-list/vue.js +5 -2
  295. package/user/index.js +5 -4
  296. package/user-head/index.js +1 -1
  297. package/wheel/index.js +3 -0
  298. package/wizard/vue.js +4 -2
package/image/vue.js CHANGED
@@ -13,7 +13,8 @@ import {
13
13
  clickHandler,
14
14
  closeViewer,
15
15
  mounted,
16
- deleteHander
16
+ deleteHander,
17
+ filterImageUrl
17
18
  } from "./index";
18
19
  const api = [
19
20
  "state",
@@ -46,7 +47,8 @@ const initState = ({
46
47
  showViewer: false,
47
48
  getPreview: computed(() => api2.computedGetPreview()),
48
49
  getImageStyle: computed(() => api2.computedGetImageStyle()),
49
- getAlignCenter: computed(() => api2.computedGetAlignCenter())
50
+ getAlignCenter: computed(() => api2.computedGetAlignCenter()),
51
+ src: computed(() => api2.filterImageUrl())
50
52
  });
51
53
  return state;
52
54
  };
@@ -75,7 +77,8 @@ const initApi = ({
75
77
  loadImage: loadImage({ api: api2, state, props, attrs }),
76
78
  computedGetImageStyle: computedGetImageStyle({ api: api2, props }),
77
79
  addLazyLoadListener: addLazyLoadListener({ api: api2, props, state, vm }),
78
- deleteHander: deleteHander(emit)
80
+ deleteHander: deleteHander(emit),
81
+ filterImageUrl: filterImageUrl(props)
79
82
  });
80
83
  };
81
84
  const initWatch = ({ watch, state, api: api2, props }) => {
@@ -27,14 +27,11 @@ const hide = ({ props, api, state }) => () => {
27
27
  };
28
28
  const deviceSupportInstall = ({ state, api, mode }) => () => {
29
29
  on(window, "resize", api.initPage);
30
- state.urlList = state.urlList.map((subItem) => {
31
- return xss.filterUrl(subItem);
32
- });
33
30
  state.urlList = state.urlList.map((subItem) => {
34
31
  let subItemObj = {};
35
32
  let lastSlashIndex = "";
36
33
  if (typeof subItem === "string") {
37
- subItem = xss.filterUrl(subItem);
34
+ subItem = api.filterImageUrl(subItem);
38
35
  if (state.isThumbnail || state.isMenuView) {
39
36
  lastSlashIndex = subItem.lastIndexOf("/");
40
37
  state.fileName = subItem.substring(lastSlashIndex + 1);
@@ -47,12 +44,15 @@ const deviceSupportInstall = ({ state, api, mode }) => () => {
47
44
  return { url: subItem, name: state.fileName };
48
45
  }
49
46
  } else if (typeof subItem === "object" && subItem !== null) {
47
+ subItem.url = api.filterImageUrl(subItem.url);
50
48
  if (!subItem.name) {
51
49
  lastSlashIndex = subItem.url.lastIndexOf("/");
52
50
  state.fileName = subItem.url.substring(lastSlashIndex + 1);
53
51
  subItem.name = state.fileName;
54
52
  }
55
53
  return subItem;
54
+ } else {
55
+ return null;
56
56
  }
57
57
  });
58
58
  state._keyDownHandler = rafThrottle((event) => {
@@ -173,23 +173,17 @@ const prev = ({ state, api, vm }) => () => {
173
173
  } else if (state.isMenuView) {
174
174
  prevElement = vm.$refs[`isMenuView_${state.index}`][0] || vm.$refs[`isMenuView_${state.index}`];
175
175
  }
176
- switch (state.index) {
177
- case 1:
178
- state.isThumbnail && vm.$refs.isThumbnailContent && (vm.$refs.isThumbnailContent.scrollTop = 0);
179
- state.isMenuView && vm.$refs.isMenuViewContent && (vm.$refs.isMenuViewContent.scrollTop = 0);
180
- state.scrollTop = 0;
181
- break;
182
- case state.urlList.length - 1:
183
- api.getLastPrev(prevElement);
184
- break;
185
- case state.urlList.length - 2:
186
- break;
187
- case state.urlList.length - 3:
188
- state.scrollTop = prevElement.offsetHeight;
189
- break;
190
- default:
191
- api.getDefaultPrev(prevElement);
192
- break;
176
+ if (state.index === 1) {
177
+ state.isThumbnail && vm.$refs.isThumbnailContent && (vm.$refs.isThumbnailContent.scrollTop = 0);
178
+ state.isMenuView && vm.$refs.isMenuViewContent && (vm.$refs.isMenuViewContent.scrollTop = 0);
179
+ state.scrollTop = 0;
180
+ } else if (state.index === state.urlList.length - 1) {
181
+ api.getLastPrev(prevElement);
182
+ } else if (state.index === state.urlList.length - 2) {
183
+ } else if (state.index === state.urlList.length - 3) {
184
+ state.scrollTop = prevElement.offsetHeight;
185
+ } else {
186
+ api.getDefaultPrev(prevElement);
193
187
  }
194
188
  };
195
189
  const getLastPrev = ({ state, vm }) => (prevElement) => {
@@ -219,30 +213,37 @@ const next = ({ state, api, vm }) => () => {
219
213
  } else if (state.isMenuView) {
220
214
  element = vm.$refs[`isMenuView_${state.index}`][0] || vm.$refs[`isMenuView_${state.index}`];
221
215
  }
222
- const rect = element && element.getBoundingClientRect();
223
- const top = rect.height;
224
- switch (state.index) {
225
- case 0:
226
- state.isThumbnail && vm.$refs.isThumbnailContent && (vm.$refs.isThumbnailContent.scrollTop = 0);
227
- state.isMenuView && vm.$refs.isMenuViewContent && (vm.$refs.isMenuViewContent.scrollTop = 0);
228
- state.scrollTop = 0;
229
- break;
230
- case 1:
231
- break;
232
- case 2:
233
- break;
234
- case 3:
235
- state.scrollTop = top;
236
- break;
237
- default:
238
- if (state.isThumbnail) {
239
- vm.$refs.isThumbnailContent && (vm.$refs.isThumbnailContent.scrollTop = state.scrollTop);
240
- state.scrollTop = state.scrollTop + element.offsetHeight + state.thumbnailTop;
241
- } else if (state.isMenuView) {
242
- vm.$refs.isMenuViewContent && (vm.$refs.isMenuViewContent.scrollTop = state.scrollTop);
243
- state.scrollTop = state.scrollTop + element.offsetHeight + state.menuTop;
244
- }
245
- break;
216
+ state.centerIndex = api.getCenterPosition(element) - 1;
217
+ let slientIndex = -1;
218
+ if (state.centerIndex > state.index) {
219
+ slientIndex = state.index;
220
+ }
221
+ if (state.index === 0) {
222
+ state.isThumbnail && vm.$refs.isThumbnailContent && (vm.$refs.isThumbnailContent.scrollTop = 0);
223
+ state.isMenuView && vm.$refs.isMenuViewContent && (vm.$refs.isMenuViewContent.scrollTop = 0);
224
+ state.scrollTop = 0;
225
+ } else if (state.index === slientIndex) {
226
+ } else {
227
+ if (state.isThumbnail) {
228
+ vm.$refs.isThumbnailContent && (vm.$refs.isThumbnailContent.scrollTop = state.scrollTop);
229
+ state.scrollTop = state.scrollTop + element.offsetHeight + state.thumbnailTop;
230
+ } else if (state.isMenuView) {
231
+ vm.$refs.isMenuViewContent && (vm.$refs.isMenuViewContent.scrollTop = state.scrollTop);
232
+ state.scrollTop = state.scrollTop + element.offsetHeight + state.menuTop;
233
+ }
234
+ }
235
+ };
236
+ const getCenterPosition = ({ state, vm }) => (element) => {
237
+ let contentHeight = 0;
238
+ let eleHeight = 0;
239
+ if (state.isThumbnail && vm.$refs.isThumbnailContent) {
240
+ contentHeight = vm.$refs.isThumbnailContent.getBoundingClientRect().height;
241
+ eleHeight = element.getBoundingClientRect().height + parseFloat(getComputedStyle(element).marginBottom) - 0;
242
+ return Math.ceil(contentHeight / eleHeight) / 2;
243
+ } else if (vm.$refs.isMenuViewContent && vm.$refs.isMenuViewContent) {
244
+ contentHeight = vm.$refs.isMenuViewContent.getBoundingClientRect().height;
245
+ eleHeight = element.getBoundingClientRect().height + parseFloat(getComputedStyle(element).marginTop) - 0;
246
+ return Math.ceil(contentHeight / eleHeight) / 2;
246
247
  }
247
248
  };
248
249
  const handleActions = (state, props, emit) => (action, options = {}) => {
@@ -295,11 +296,11 @@ const handleActions = (state, props, emit) => (action, options = {}) => {
295
296
  const computedIsSingle = (props) => () => props.urlList.length <= 1;
296
297
  const computedIsFirst = (state) => () => state.index === 0;
297
298
  const computedIsLast = ({ state, props }) => () => state.index === props.urlList.length - 1;
298
- const computedCurrentImg = (state) => () => {
299
+ const computedCurrentImg = ({ state, api }) => () => {
299
300
  if (typeof state.urlList[0] === "string") {
300
- return state.urlList[state.index];
301
+ return api.filterImageUrl(state.urlList[state.index]);
301
302
  } else if (typeof state.urlList[0] === "object" && state.urlList[0] !== null) {
302
- return state.urlList[state.index].url;
303
+ return api.filterImageUrl(state.urlList[state.index].url);
303
304
  }
304
305
  };
305
306
  const computedImgStyle = ({ state, constants }) => () => {
@@ -353,7 +354,7 @@ const getImageWidth = ({ state, parent, props, vm, mode }) => () => {
353
354
  }
354
355
  state.imageItemWidth = imageW;
355
356
  state.imageAllWidth = state.urlList.length * imageW;
356
- if (mode !== "mobile-first") {
357
+ if (mode === "mobile") {
357
358
  if (props.startPosition > 0) {
358
359
  state.index = props.startPosition;
359
360
  state.imageTransition = 0;
@@ -412,7 +413,7 @@ const swipeRight = ({ state, emit }) => () => {
412
413
  } else {
413
414
  state.arrowStyle = null;
414
415
  }
415
- if (state.imageTransform == 0 && state.index == 0) {
416
+ if (state.imageTransform === 0 && state.index === 0) {
416
417
  return;
417
418
  }
418
419
  state.index = (state.index - 1 + len) % len;
@@ -447,9 +448,13 @@ const langClick = (state) => () => {
447
448
  window.navigator.msSaveOrOpenBlob(blob, "img.png");
448
449
  } else {
449
450
  const a = document.createElement("a");
450
- a.href = state.currentImg;
451
+ a.style = "dispaly:none";
452
+ a.href = state.currentImg + "?response-content-type=application/octet-stream";
451
453
  a.setAttribute("download", "img");
454
+ a.setAttribute("target", "downloadFile");
455
+ document.body.appendChild(a);
452
456
  a.click();
457
+ document.body.removeChild(a);
453
458
  }
454
459
  };
455
460
  const touchstart = ({ state, mode, api }) => (e) => {
@@ -629,6 +634,10 @@ const selectOption = ({ state, api }) => (item, index) => {
629
634
  break;
630
635
  }
631
636
  };
637
+ const filterImageUrl = () => (imageUrl) => {
638
+ const isBase64 = /^data:image\/(png|jpg|jpeg|gif);base64,([a-zA-Z0-9+/]+={0,2})/;
639
+ return isBase64.test(imageUrl) ? imageUrl : xss.filterUrl(imageUrl);
640
+ };
632
641
  export {
633
642
  activeItems,
634
643
  beforeDestroy,
@@ -640,6 +649,8 @@ export {
640
649
  computedIsSingle,
641
650
  deviceSupportInstall,
642
651
  deviceSupportUninstall,
652
+ filterImageUrl,
653
+ getCenterPosition,
643
654
  getDefaultPrev,
644
655
  getImageWidth,
645
656
  getLastPrev,
@@ -34,7 +34,9 @@ import {
34
34
  selectOption,
35
35
  langClick,
36
36
  getLastPrev,
37
- getDefaultPrev
37
+ getDefaultPrev,
38
+ getCenterPosition,
39
+ filterImageUrl
38
40
  } from "./index";
39
41
  const api = [
40
42
  "state",
@@ -72,7 +74,7 @@ const initState = ({ reactive, computed, api: api2, mode, props, constants, inje
72
74
  mfPreviewVisible: inject("mfPreviewVisible", null),
73
75
  scale: 1,
74
76
  time: null,
75
- index: mode == "pc" || mode == "mobile-first" ? 0 : props.startPosition,
77
+ index: mode === "pc" || mode === "mobile-first" ? 0 : props.startPosition,
76
78
  imageName: "",
77
79
  isShow: false,
78
80
  infinite: true,
@@ -111,7 +113,8 @@ const initState = ({ reactive, computed, api: api2, mode, props, constants, inje
111
113
  fileName: "",
112
114
  scrollTop: 0,
113
115
  thumbnailTop: constants.THUMBNAILTOP,
114
- menuTop: constants.MENUTOP
116
+ menuTop: constants.MENUTOP,
117
+ centerIndex: -1
115
118
  });
116
119
  return state;
117
120
  };
@@ -135,7 +138,7 @@ const initApi = ({ api: api2, state, props, parent, nextTick, emit, t, constants
135
138
  computedIsLast: computedIsLast({ state, props }),
136
139
  watchVisible: watchVisible(state),
137
140
  deviceSupportUninstall: deviceSupportUninstall({ state, mode }),
138
- computedCurrentImg: computedCurrentImg(state),
141
+ computedCurrentImg: computedCurrentImg({ state, api: api2 }),
139
142
  computedImgStyle: computedImgStyle({ state, constants }),
140
143
  computeZIndex: computeZIndex({ constants, props }),
141
144
  hide: hide({ props, api: api2, state }),
@@ -152,7 +155,9 @@ const initApi = ({ api: api2, state, props, parent, nextTick, emit, t, constants
152
155
  selectOption: selectOption({ state, api: api2 }),
153
156
  langClick: langClick(state),
154
157
  getLastPrev: getLastPrev({ state, vm }),
155
- getDefaultPrev: getDefaultPrev({ state, vm })
158
+ getDefaultPrev: getDefaultPrev({ state, vm }),
159
+ getCenterPosition: getCenterPosition({ state, vm }),
160
+ filterImageUrl: filterImageUrl()
156
161
  });
157
162
  };
158
163
  const initWatch = ({ watch, state, api: api2, props, nextTick, vm }) => {
@@ -198,6 +203,13 @@ const initWatch = ({ watch, state, api: api2, props, nextTick, vm }) => {
198
203
  api2.getImageWidth();
199
204
  })
200
205
  );
206
+ watch(
207
+ () => props.urlList,
208
+ () => {
209
+ state.urlList = props.urlList;
210
+ },
211
+ { deep: true }
212
+ );
201
213
  };
202
214
  const renderless = (props, { computed, onMounted, onBeforeUnmount, onUpdated, reactive, watch, inject, provide }, { t, parent, nextTick, emit, constants, vm, mode }) => {
203
215
  const api2 = {};
package/input/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
+ import { omitText } from "../common/string";
2
3
  const HIDDEN_STYLE = `
3
4
  height:0 !important;visibility:hidden !important;overflow:hidden !important;
4
5
  position:absolute !important;z-index:-1000 !important;top:0 !important;right:0 !important
@@ -37,6 +38,11 @@ const showBox = (state) => () => {
37
38
  }
38
39
  state.boxVisibility = true;
39
40
  };
41
+ const inputStyle = ({ props }) => () => {
42
+ return {
43
+ textAlign: props.textAlign
44
+ };
45
+ };
40
46
  const calculateNodeStyling = () => (targetElement) => {
41
47
  const style = window.getComputedStyle(targetElement);
42
48
  const boxSizing = style.getPropertyValue(STYLE.BoxSizing);
@@ -51,6 +57,12 @@ const calcTextareaHeight = ({
51
57
  props,
52
58
  state
53
59
  }) => (targetElement, minRows = 1, maxRows = null) => {
60
+ if (!targetElement) {
61
+ return {
62
+ minHeight: "",
63
+ height: ""
64
+ };
65
+ }
54
66
  if (!hiddenTextarea) {
55
67
  hiddenTextarea = document.createElement("textarea");
56
68
  document.body.appendChild(hiddenTextarea);
@@ -71,7 +83,7 @@ const calcTextareaHeight = ({
71
83
  minHeight = minHeight + paddingSize + borderSize;
72
84
  }
73
85
  if (props.size) {
74
- minHeight = props.size == "mini" ? minHeight * 0.67 : props.size == "small" ? minHeight : minHeight * 1.17;
86
+ minHeight = props.size === "mini" ? minHeight * 0.67 : props.size === "small" ? minHeight : minHeight * 1.17;
75
87
  }
76
88
  if (props.height) {
77
89
  minHeight = props.height;
@@ -95,7 +107,7 @@ const calcTextareaHeight = ({
95
107
  hiddenTextarea = null;
96
108
  return textareaStyle;
97
109
  };
98
- const getInput = (refs) => () => refs.input || refs.textarea;
110
+ const getInput = (vm) => () => vm.$refs.input || vm.$refs.textarea;
99
111
  const blur = (api) => () => api.getInput().blur();
100
112
  const focus = (api) => () => api.getInput().focus();
101
113
  const select = (api) => () => api.getInput().select();
@@ -105,7 +117,8 @@ const handleBlur = ({
105
117
  eventName,
106
118
  emit,
107
119
  props,
108
- state
120
+ state,
121
+ vm
109
122
  }) => (event) => {
110
123
  state.focused = false;
111
124
  emit("blur", event);
@@ -113,6 +126,9 @@ const handleBlur = ({
113
126
  if (props.validateEvent) {
114
127
  api.dispatch(componentName, eventName, [props.modelValue]);
115
128
  }
129
+ if (props.hoverExpand) {
130
+ vm.$refs.textarea.scrollTop = 0;
131
+ }
116
132
  };
117
133
  const handleFocus = ({ api, emit, state }) => (event) => {
118
134
  state.focused = true;
@@ -132,7 +148,7 @@ const handleInput = ({ api, emit, nextTick, state }) => (event) => {
132
148
  nextTick(api.setNativeInputValue);
133
149
  };
134
150
  const handleChange = (emit) => (event) => emit("change", event.target.value);
135
- const resizeTextarea = ({ api, parent, refs, state }) => () => {
151
+ const resizeTextarea = ({ api, parent, vm, state, props }) => () => {
136
152
  if (isServer) {
137
153
  return;
138
154
  }
@@ -140,15 +156,22 @@ const resizeTextarea = ({ api, parent, refs, state }) => () => {
140
156
  if (type !== "textarea") {
141
157
  return;
142
158
  }
159
+ if (props.hoverExpand && !state.enteredTextarea) {
160
+ state.textareaCalcStyle = {
161
+ minHeight: state.textareaHeight,
162
+ height: state.textareaHeight
163
+ };
164
+ return;
165
+ }
143
166
  if (!autosize) {
144
167
  state.textareaCalcStyle = {
145
- minHeight: api.calcTextareaHeight(refs.textarea).minHeight
168
+ minHeight: api.calcTextareaHeight(vm.$refs.textarea).minHeight
146
169
  };
147
170
  return;
148
171
  }
149
172
  const minRows = autosize.minRows;
150
173
  const maxRows = autosize.maxRows;
151
- state.textareaCalcStyle = api.calcTextareaHeight(refs.textarea, minRows, maxRows);
174
+ state.textareaCalcStyle = api.calcTextareaHeight(vm.$refs.textarea, minRows, maxRows);
152
175
  };
153
176
  const setNativeInputValue = ({ api, state }) => () => {
154
177
  const input = api.getInput();
@@ -217,7 +240,7 @@ const handlePasswordVisible = ({ api, nextTick, state }) => () => {
217
240
  state.passwordVisible = !state.passwordVisible;
218
241
  nextTick(api.focus);
219
242
  };
220
- const getSuffixVisible = ({ parent, props, state }) => () => parent.$slots.suffix || props.suffixIcon || state.showClear || props.showPassword || state.isWordLimitVisible || state.validateState && state.needStatusIcon;
243
+ const getSuffixVisible = ({ parent, props, state }) => () => parent.$slots.suffix || props.suffixIcon || state.showClear || props.showPassword || state.isWordLimitVisible || state.validateState && state.needStatusIcon || props.mask && state.inputDisabled;
221
244
  const textLength = (value) => {
222
245
  if (typeof value === "number") {
223
246
  return String(value).length;
@@ -229,7 +252,7 @@ const watchFormSelect = ({ emit, props, state }) => (value) => {
229
252
  emit("update:modelValue", value);
230
253
  emit("change", value);
231
254
  const filterData = props.selectMenu.length && props.selectMenu.filter((item) => item.id === value).shift();
232
- state.checkedLable = filterData ? filterData.label : "";
255
+ state.checkedLabel = filterData ? filterData.label : "";
233
256
  }
234
257
  };
235
258
  const hasSelection = (api) => () => {
@@ -238,8 +261,25 @@ const hasSelection = (api) => () => {
238
261
  };
239
262
  const handleEnterDisplayOnlyContent = ({ state, props }) => ($event, type) => {
240
263
  const target = $event.target;
241
- if (target && (target.scrollWidth > target.offsetWidth || type === "textarea" && target.scrollHeight > target.offsetHeight)) {
264
+ state.displayOnlyTooltip = "";
265
+ if (!target) {
266
+ return;
267
+ }
268
+ const isOverText = target.scrollWidth > target.offsetWidth || type === "textarea" && target.scrollHeight > target.offsetHeight;
269
+ if (isOverText) {
242
270
  state.displayOnlyTooltip = props.displayOnlyContent || state.nativeInputValue;
271
+ } else {
272
+ let isOverTextWhenMask = false;
273
+ if (props.mask && state.maskValueVisible) {
274
+ const text = target.textContent;
275
+ const font = window.getComputedStyle(target).font;
276
+ const rect = target.getBoundingClientRect();
277
+ const iconWidth = 16 + 15;
278
+ isOverTextWhenMask = omitText(text, font, rect.width - iconWidth).o;
279
+ }
280
+ if (isOverTextWhenMask) {
281
+ state.displayOnlyTooltip = props.displayOnlyContent || state.nativeInputValue;
282
+ }
243
283
  }
244
284
  };
245
285
  const hiddenPassword = ({ state, props }) => () => {
@@ -250,30 +290,53 @@ const hiddenPassword = ({ state, props }) => () => {
250
290
  }
251
291
  return str;
252
292
  };
253
- const dispatchDisplayedValue = ({ state, props, dispatch, api }) => () => {
254
- if (state.isDisplayOnly) {
255
- dispatch("FormItem", "displayed-value-changed", {
256
- type: props.type || "text",
257
- val: api.getDisplayedValue()
258
- });
293
+ const getDisplayedMaskValue = ({ state }) => () => {
294
+ if (state.maskValueVisible) {
295
+ return state.nativeInputValue;
296
+ } else {
297
+ return state.nativeInputValue && state.maskSymbol;
259
298
  }
260
299
  };
261
- const getDisplayedValue = ({ state, props }) => () => {
262
- if (props.type === "password") {
263
- return state.hiddenPassword || "-";
264
- } else {
265
- return props.displayOnlyContent || state.nativeInputValue || "-";
300
+ const setInputDomValue = ({ state, props, nextTick, vm }) => (type) => {
301
+ nextTick(() => {
302
+ const input = vm.$refs.input;
303
+ if (props.mask && state.nativeInputValue && input) {
304
+ input.value = state.maskValueVisible || !state.inputDisabled ? state.nativeInputValue : state.maskSymbol;
305
+ }
306
+ if (type === "mask" && !props.mask && input) {
307
+ input.value = state.nativeInputValue;
308
+ }
309
+ });
310
+ };
311
+ const handleEnterTextarea = ({ api, state, props, nextTick }) => () => {
312
+ if (props.hoverExpand && !state.isDisplayOnly) {
313
+ state.enteredTextarea = true;
314
+ nextTick(api.resizeTextarea);
315
+ }
316
+ };
317
+ const handleLeaveTextarea = ({ api, state, props, nextTick, vm }) => () => {
318
+ if (props.hoverExpand && !state.isDisplayOnly) {
319
+ state.enteredTextarea = false;
320
+ nextTick(() => {
321
+ api.resizeTextarea();
322
+ vm.$refs.textarea.scrollTop = 0;
323
+ });
266
324
  }
267
325
  };
326
+ const getDisplayOnlyText = ({ parent, state, props }) => () => {
327
+ const text = props.displayOnlyContent || state.nativeInputValue;
328
+ const showEmptyValue = typeof props.showEmptyValue === "boolean" ? props.showEmptyValue : (parent.tinyForm || {}).showEmptyValue;
329
+ return showEmptyValue ? text : text || "-";
330
+ };
268
331
  export {
269
332
  blur,
270
333
  calcIconOffset,
271
334
  calcTextareaHeight,
272
335
  calculateNodeStyling,
273
336
  clear,
274
- dispatchDisplayedValue,
275
337
  focus,
276
- getDisplayedValue,
338
+ getDisplayOnlyText,
339
+ getDisplayedMaskValue,
277
340
  getInput,
278
341
  getSuffixVisible,
279
342
  handleBlur,
@@ -282,13 +345,17 @@ export {
282
345
  handleCompositionStart,
283
346
  handleCompositionUpdate,
284
347
  handleEnterDisplayOnlyContent,
348
+ handleEnterTextarea,
285
349
  handleFocus,
286
350
  handleInput,
351
+ handleLeaveTextarea,
287
352
  handlePasswordVisible,
288
353
  hasSelection,
289
354
  hiddenPassword,
355
+ inputStyle,
290
356
  resizeTextarea,
291
357
  select,
358
+ setInputDomValue,
292
359
  setNativeInputValue,
293
360
  showBox,
294
361
  textLength,