@opentiny/vue-renderless 3.13.2 → 3.14.1

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 (320) hide show
  1. package/action-sheet/index.js +20 -13
  2. package/action-sheet/vue.js +8 -7
  3. package/amount/index.js +100 -25
  4. package/amount/vue.js +102 -26
  5. package/anchor/index.js +1 -0
  6. package/area/index.js +8 -8
  7. package/area/vue.js +5 -5
  8. package/async-flowchart/index.js +16 -3
  9. package/autocomplete/index.js +58 -14
  10. package/autocomplete/vue.js +40 -12
  11. package/badge/index.js +12 -0
  12. package/badge/vue.js +6 -4
  13. package/breadcrumb/vue.js +3 -1
  14. package/breadcrumb-item/vue.js +6 -2
  15. package/button/index.js +5 -1
  16. package/calendar/index.js +2 -86
  17. package/calendar-bar/index.js +18 -4
  18. package/calendar-view/index.js +5 -1
  19. package/calendar-view/vue.js +16 -3
  20. package/card-group/vue.js +4 -2
  21. package/cascader/index.js +86 -34
  22. package/cascader/vue.js +61 -20
  23. package/cascader-menu/index.js +7 -7
  24. package/cascader-menu/vue.js +2 -3
  25. package/cascader-mobile/index.js +36 -23
  26. package/cascader-mobile/vue.js +6 -0
  27. package/cascader-node/index.js +13 -1
  28. package/cascader-node/vue.js +15 -4
  29. package/cascader-panel/index.js +1 -1
  30. package/cascader-select/column-index.js +150 -0
  31. package/cascader-select/column.js +120 -0
  32. package/cascader-select/index.js +29 -165
  33. package/cascader-select/usePicker.js +251 -0
  34. package/cascader-select/useTouch.js +65 -0
  35. package/cascader-select/vue.js +35 -47
  36. package/cell/vue.js +2 -1
  37. package/chart-bar/index.js +2 -3
  38. package/chart-core/deps/constants.js +43 -43
  39. package/chart-core/index.js +1 -1
  40. package/chart-gauge/index.js +2 -2
  41. package/chart-heatmap/index.js +17 -10
  42. package/chart-line/index.js +8 -9
  43. package/chart-tree/index.js +2 -2
  44. package/chart-waterfall/index.js +4 -6
  45. package/checkbox/index.js +18 -1
  46. package/checkbox/vue.js +15 -7
  47. package/checkbox-group/vue.js +1 -0
  48. package/col/vue.js +1 -1
  49. package/collapse/index.js +3 -3
  50. package/color-select-panel/vue.js +0 -7
  51. package/column-list-item/index.js +17 -1
  52. package/column-list-item/vue.js +8 -3
  53. package/common/bigInt.js +2 -2
  54. package/common/date.js +7 -5
  55. package/common/deps/clickoutside.js +6 -2
  56. package/common/deps/date-util.js +4 -2
  57. package/common/deps/dom.js +19 -4
  58. package/common/deps/popper.js +44 -11
  59. package/common/deps/resize-event.js +1 -0
  60. package/common/deps/touch-emulator.js +4 -1
  61. package/common/deps/tree-model/node.js +2 -2
  62. package/common/deps/tree-model/tree-store.js +2 -13
  63. package/common/deps/useRect.js +25 -0
  64. package/common/deps/vue-popper.js +38 -20
  65. package/common/index.js +2 -2
  66. package/common/runtime.js +1 -1
  67. package/common/string.js +2 -2
  68. package/common/type.js +2 -1
  69. package/common/validate/rules/enum.js +1 -1
  70. package/common/validate/rules/pattern.js +2 -2
  71. package/common/validate/rules/range.js +8 -5
  72. package/common/validate/rules/required.js +1 -1
  73. package/common/validate/rules/type.js +5 -5
  74. package/common/validate/rules/whitespace.js +1 -1
  75. package/common/validate/util.js +15 -16
  76. package/common/validate/validations/integer.js +1 -1
  77. package/common/validate/validations/method.js +1 -1
  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 +15 -6
  85. package/date-table/index.js +35 -53
  86. package/date-table/vue.js +4 -2
  87. package/dialog-box/index.js +46 -14
  88. package/dialog-box/vue.js +30 -7
  89. package/dialog-select/index.js +6 -3
  90. package/dialog-select/vue.js +8 -4
  91. package/drawer/index.js +27 -5
  92. package/drawer/vue.js +14 -7
  93. package/dropdown/index.js +7 -7
  94. package/dropdown/vue.js +6 -2
  95. package/dropdown-item/index.js +9 -1
  96. package/dropdown-item/mf.js +6 -10
  97. package/dropdown-item/vue.js +20 -7
  98. package/dropdown-menu/index.js +20 -7
  99. package/dropdown-menu/vue.js +4 -3
  100. package/exception/index.js +2 -7
  101. package/exception/vue.js +7 -10
  102. package/fall-menu/index.js +5 -1
  103. package/fall-menu/vue.js +13 -2
  104. package/file-upload/index.js +68 -18
  105. package/file-upload/vue.js +38 -8
  106. package/filter-box/index.js +1 -0
  107. package/float-button/index.js +42 -0
  108. package/float-button/vue.js +101 -0
  109. package/floating-button/index.js +62 -16
  110. package/floating-button/vue.js +27 -9
  111. package/flowchart/index.js +134 -25
  112. package/flowchart/node.js +13 -4
  113. package/flowchart/vue.js +16 -4
  114. package/form/vue.js +8 -0
  115. package/form-item/index.js +5 -5
  116. package/form-item/vue.js +3 -1
  117. package/fullscreen/index.js +5 -5
  118. package/fullscreen/vue.js +3 -3
  119. package/grid/plugins/export.js +5 -2
  120. package/grid/utils/column.js +1 -0
  121. package/grid/utils/dom.js +7 -1
  122. package/image/index.js +6 -1
  123. package/image/vue.js +6 -3
  124. package/image-viewer/index.js +62 -51
  125. package/image-viewer/vue.js +17 -5
  126. package/input/index.js +81 -20
  127. package/input/vue.js +44 -18
  128. package/ip-address/index.js +61 -19
  129. package/ip-address/vue.js +22 -4
  130. package/link/vue.js +3 -1
  131. package/loading/index.js +2 -2
  132. package/loading/vue.js +8 -2
  133. package/logout/index.js +1 -1
  134. package/menu/index.js +15 -2
  135. package/menu/vue.js +22 -17
  136. package/mind-map/index.js +47 -0
  137. package/mind-map/vue.js +53 -0
  138. package/modal/index.js +44 -4
  139. package/modal/vue.js +18 -4
  140. package/multi-select/index.js +186 -11
  141. package/multi-select/vue.js +60 -15
  142. package/multi-select-item/index.js +23 -0
  143. package/multi-select-item/vue.js +31 -0
  144. package/numeric/index.js +48 -12
  145. package/numeric/vue.js +44 -19
  146. package/option/index.js +27 -9
  147. package/option/vue.js +37 -21
  148. package/option-group/index.js +3 -3
  149. package/package.json +1 -1
  150. package/pager/index.js +18 -4
  151. package/pager/vue.js +16 -5
  152. package/picker/index.js +290 -77
  153. package/picker/mb.js +42 -0
  154. package/picker/vue.js +76 -20
  155. package/picker-column/index.js +1 -1
  156. package/pop-upload/vue.js +3 -0
  157. package/popconfirm/index.js +3 -6
  158. package/popconfirm/vue.js +1 -1
  159. package/popeditor/index.js +73 -34
  160. package/popeditor/vue.js +15 -11
  161. package/popover/index.js +4 -4
  162. package/popover/vue.js +6 -6
  163. package/popup/index.js +3 -3
  164. package/popup/vue.js +5 -5
  165. package/pull-refresh/index.js +13 -13
  166. package/pull-refresh/vue.js +5 -4
  167. package/radio/index.js +0 -17
  168. package/radio/vue.js +4 -10
  169. package/rate/index.js +1 -1
  170. package/rate/vue.js +0 -2
  171. package/record/index.js +4 -1
  172. package/rich-text/clipboard.js +54 -0
  173. package/rich-text/index.js +192 -0
  174. package/rich-text/module/file-upload.js +107 -0
  175. package/rich-text/module/image-drop.js +63 -0
  176. package/rich-text/module/image-upload.js +89 -0
  177. package/rich-text/options.js +141 -0
  178. package/rich-text/table-module.js +382 -0
  179. package/rich-text/vue.js +102 -0
  180. package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
  181. package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
  182. package/scrollbar/index.js +11 -11
  183. package/scrollbar/vue-bar.js +3 -3
  184. package/scrollbar/vue.js +5 -5
  185. package/search/index.js +9 -9
  186. package/search/vue.js +8 -6
  187. package/select/index.js +442 -393
  188. package/select/vue.js +278 -164
  189. package/select-dropdown/index.js +61 -3
  190. package/select-dropdown/vue.js +85 -8
  191. package/select-view/index.js +3 -1
  192. package/selected-box/index.js +2 -0
  193. package/selected-box/vue.js +6 -3
  194. package/signature/index.js +241 -0
  195. package/signature/vue.js +88 -0
  196. package/skeleton/index.js +14 -0
  197. package/skeleton/vue.js +15 -0
  198. package/skeleton-item/vue.js +15 -0
  199. package/slider/index.js +70 -17
  200. package/slider/vue.js +16 -7
  201. package/split/index.js +5 -3
  202. package/split/vue.js +4 -6
  203. package/standard-list-item/index.js +15 -1
  204. package/standard-list-item/vue.js +6 -5
  205. package/steps/index.js +25 -2
  206. package/steps/slide-bar.js +8 -1
  207. package/steps/vue.js +15 -3
  208. package/tab-item-mf/vue.js +14 -8
  209. package/tab-nav/index.js +30 -5
  210. package/tab-nav/vue.js +16 -4
  211. package/tabbar/vue.js +9 -3
  212. package/tabbar-item/vue.js +3 -2
  213. package/tabs/index.js +16 -4
  214. package/tabs/vue.js +2 -1
  215. package/tabs-mf/index.js +20 -6
  216. package/tabs-mf/vue-nav.js +26 -11
  217. package/tabs-mf/vue.js +7 -7
  218. package/tabs-mf/wheel.js +1 -0
  219. package/tag/index.js +1 -1
  220. package/tag-group/index.js +2 -1
  221. package/time/index.js +5 -2
  222. package/time/vue.js +1 -1
  223. package/time-line/index.js +3 -3
  224. package/time-line/vue.js +2 -2
  225. package/time-picker-mobile/index.js +24 -5
  226. package/time-picker-mobile/vue.js +17 -7
  227. package/time-range/index.js +2 -0
  228. package/timeline-item/vue.js +1 -1
  229. package/tooltip/index.js +6 -3
  230. package/tooltip/vue.js +4 -4
  231. package/transfer/index.js +20 -22
  232. package/transfer/vue.js +1 -6
  233. package/transfer-panel/vue.js +3 -5
  234. package/tree/index.js +21 -4
  235. package/tree/vue.js +10 -8
  236. package/tree-menu/index.js +29 -3
  237. package/tree-menu/vue.js +28 -15
  238. package/tree-node/index.js +18 -18
  239. package/tree-node/vue.js +6 -5
  240. package/types/action-sheet.type.d.ts +118 -1
  241. package/types/amount.type.d.ts +168 -1
  242. package/types/area.type.d.ts +134 -1
  243. package/types/async-flowchart.type.d.ts +72 -0
  244. package/types/autocomplete.type.d.ts +199 -1
  245. package/types/badge.type.d.ts +3 -1
  246. package/types/breadcrumb-item.type.d.ts +2 -0
  247. package/types/breadcrumb.type.d.ts +2 -0
  248. package/types/button-group.type.d.ts +3 -3
  249. package/types/button.type.d.ts +4 -0
  250. package/types/cascader-menu.type.d.ts +3 -4
  251. package/types/cascader-node.type.d.ts +5 -2
  252. package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
  253. package/types/cascader-panel.type.d.ts +3 -241
  254. package/types/cascader.type.d.ts +329 -1
  255. package/types/checkbox.type.d.ts +6 -0
  256. package/types/collapse.type.d.ts +19 -2
  257. package/types/date-picker.type.d.ts +38 -1
  258. package/types/dialog-box.type.d.ts +13 -3
  259. package/types/drawer.type.d.ts +133 -1
  260. package/types/{dropdown-item.type-8ea6c633.d.ts → dropdown-item.type-8475a549.d.ts} +7 -13
  261. package/types/dropdown-item.type.d.ts +1 -1
  262. package/types/dropdown-menu.type.d.ts +1 -1
  263. package/types/dropdown.type.d.ts +1 -5
  264. package/types/fall-menu.type.d.ts +94 -1
  265. package/types/file-upload.type.d.ts +1 -1
  266. package/types/float-button.type.d.ts +123 -0
  267. package/types/form-item.type.d.ts +1 -1
  268. package/types/{form.type-d0fd42f3.d.ts → form.type-a2dc0099.d.ts} +4 -1
  269. package/types/form.type.d.ts +1 -1
  270. package/types/{index-e0250f63.d.ts → index-b012f687.d.ts} +9 -0
  271. package/types/input.type.d.ts +2 -6
  272. package/types/ip-address.type.d.ts +160 -1
  273. package/types/link.type.d.ts +6 -3
  274. package/types/loading.type.d.ts +7 -0
  275. package/types/mind-map.type.d.ts +20 -0
  276. package/types/modal.type.d.ts +29 -2
  277. package/types/numeric.type.d.ts +41 -10
  278. package/types/pager.type.d.ts +12 -0
  279. package/types/picker.type.d.ts +18 -0
  280. package/types/popconfirm.type.d.ts +86 -1
  281. package/types/popeditor.type.d.ts +4 -0
  282. package/types/popover.type.d.ts +3 -3
  283. package/types/progress.type.d.ts +2 -0
  284. package/types/radio.type.d.ts +0 -4
  285. package/types/rate.type.d.ts +236 -1
  286. package/types/search.type.d.ts +88 -1
  287. package/types/shared.type.d.ts +1 -1
  288. package/types/skeleton-item.type.d.ts +38 -0
  289. package/types/skeleton.type.d.ts +45 -0
  290. package/types/slider.type.d.ts +49 -10
  291. package/types/steps.type.d.ts +14 -3
  292. package/types/tab-bar.type.d.ts +1 -1
  293. package/types/tab-nav.type.d.ts +7 -2
  294. package/types/tabs.type.d.ts +9 -1
  295. package/types/tag-group.type.d.ts +64 -1
  296. package/types/{time-line.type-d7daa669.d.ts → time-line.type-b155cb4f.d.ts} +12 -0
  297. package/types/time-line.type.d.ts +1 -1
  298. package/types/timeline-item.type.d.ts +1 -1
  299. package/types/tooltip.type.d.ts +2 -2
  300. package/types/transfer.type.d.ts +185 -1
  301. package/types/tree-menu.type.d.ts +210 -1
  302. package/types/upload-dragger.type.d.ts +1 -1
  303. package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-6d6e3d0e.d.ts} +35 -8
  304. package/types/upload-list.type.d.ts +1 -1
  305. package/types/upload.type.d.ts +1 -1
  306. package/types/user-head.type.d.ts +146 -1
  307. package/types/wizard.type.d.ts +1 -0
  308. package/upload/index.js +64 -34
  309. package/upload/vue.js +9 -5
  310. package/upload-dragger/index.js +22 -20
  311. package/upload-list/index.js +24 -18
  312. package/upload-list/vue.js +9 -4
  313. package/user/index.js +35 -26
  314. package/user/vue.js +1 -1
  315. package/user-head/index.js +3 -3
  316. package/watermark/index.js +11 -0
  317. package/wheel/index.js +3 -0
  318. package/wizard/vue.js +4 -2
  319. package/common/deps/modal-queue.js +0 -6
  320. package/common/deps/requestAnimationFrame.js +0 -25
@@ -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
@@ -56,6 +57,12 @@ const calcTextareaHeight = ({
56
57
  props,
57
58
  state
58
59
  }) => (targetElement, minRows = 1, maxRows = null) => {
60
+ if (!targetElement) {
61
+ return {
62
+ minHeight: "",
63
+ height: ""
64
+ };
65
+ }
59
66
  if (!hiddenTextarea) {
60
67
  hiddenTextarea = document.createElement("textarea");
61
68
  document.body.appendChild(hiddenTextarea);
@@ -76,7 +83,7 @@ const calcTextareaHeight = ({
76
83
  minHeight = minHeight + paddingSize + borderSize;
77
84
  }
78
85
  if (props.size) {
79
- 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;
80
87
  }
81
88
  if (props.height) {
82
89
  minHeight = props.height;
@@ -110,7 +117,8 @@ const handleBlur = ({
110
117
  eventName,
111
118
  emit,
112
119
  props,
113
- state
120
+ state,
121
+ vm
114
122
  }) => (event) => {
115
123
  state.focused = false;
116
124
  emit("blur", event);
@@ -118,6 +126,9 @@ const handleBlur = ({
118
126
  if (props.validateEvent) {
119
127
  api.dispatch(componentName, eventName, [props.modelValue]);
120
128
  }
129
+ if (props.hoverExpand) {
130
+ vm.$refs.textarea.scrollTop = 0;
131
+ }
121
132
  };
122
133
  const handleFocus = ({ api, emit, state }) => (event) => {
123
134
  state.focused = true;
@@ -137,7 +148,7 @@ const handleInput = ({ api, emit, nextTick, state }) => (event) => {
137
148
  nextTick(api.setNativeInputValue);
138
149
  };
139
150
  const handleChange = (emit) => (event) => emit("change", event.target.value);
140
- const resizeTextarea = ({ api, parent, refs, state }) => () => {
151
+ const resizeTextarea = ({ api, parent, vm, state, props }) => () => {
141
152
  if (isServer) {
142
153
  return;
143
154
  }
@@ -145,15 +156,22 @@ const resizeTextarea = ({ api, parent, refs, state }) => () => {
145
156
  if (type !== "textarea") {
146
157
  return;
147
158
  }
159
+ if (props.hoverExpand && !state.enteredTextarea) {
160
+ state.textareaCalcStyle = {
161
+ minHeight: state.textareaHeight,
162
+ height: state.textareaHeight
163
+ };
164
+ return;
165
+ }
148
166
  if (!autosize) {
149
167
  state.textareaCalcStyle = {
150
- minHeight: api.calcTextareaHeight(refs.textarea).minHeight
168
+ minHeight: api.calcTextareaHeight(vm.$refs.textarea).minHeight
151
169
  };
152
170
  return;
153
171
  }
154
172
  const minRows = autosize.minRows;
155
173
  const maxRows = autosize.maxRows;
156
- state.textareaCalcStyle = api.calcTextareaHeight(refs.textarea, minRows, maxRows);
174
+ state.textareaCalcStyle = api.calcTextareaHeight(vm.$refs.textarea, minRows, maxRows);
157
175
  };
158
176
  const setNativeInputValue = ({ api, state }) => () => {
159
177
  const input = api.getInput();
@@ -222,7 +240,7 @@ const handlePasswordVisible = ({ api, nextTick, state }) => () => {
222
240
  state.passwordVisible = !state.passwordVisible;
223
241
  nextTick(api.focus);
224
242
  };
225
- 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;
226
244
  const textLength = (value) => {
227
245
  if (typeof value === "number") {
228
246
  return String(value).length;
@@ -243,8 +261,25 @@ const hasSelection = (api) => () => {
243
261
  };
244
262
  const handleEnterDisplayOnlyContent = ({ state, props }) => ($event, type) => {
245
263
  const target = $event.target;
246
- 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) {
247
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
+ }
248
283
  }
249
284
  };
250
285
  const hiddenPassword = ({ state, props }) => () => {
@@ -255,30 +290,53 @@ const hiddenPassword = ({ state, props }) => () => {
255
290
  }
256
291
  return str;
257
292
  };
258
- const dispatchDisplayedValue = ({ state, props, dispatch, api }) => () => {
259
- if (state.isDisplayOnly) {
260
- dispatch("FormItem", "displayed-value-changed", {
261
- type: props.type || "text",
262
- val: api.getDisplayedValue()
263
- });
293
+ const getDisplayedMaskValue = ({ state }) => () => {
294
+ if (state.maskValueVisible) {
295
+ return state.nativeInputValue;
296
+ } else {
297
+ return state.nativeInputValue && state.maskSymbol;
264
298
  }
265
299
  };
266
- const getDisplayedValue = ({ state, props }) => () => {
267
- if (props.type === "password") {
268
- return state.hiddenPassword || "-";
269
- } else {
270
- 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);
271
315
  }
272
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
+ });
324
+ }
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
+ };
273
331
  export {
274
332
  blur,
275
333
  calcIconOffset,
276
334
  calcTextareaHeight,
277
335
  calculateNodeStyling,
278
336
  clear,
279
- dispatchDisplayedValue,
280
337
  focus,
281
- getDisplayedValue,
338
+ getDisplayOnlyText,
339
+ getDisplayedMaskValue,
282
340
  getInput,
283
341
  getSuffixVisible,
284
342
  handleBlur,
@@ -287,14 +345,17 @@ export {
287
345
  handleCompositionStart,
288
346
  handleCompositionUpdate,
289
347
  handleEnterDisplayOnlyContent,
348
+ handleEnterTextarea,
290
349
  handleFocus,
291
350
  handleInput,
351
+ handleLeaveTextarea,
292
352
  handlePasswordVisible,
293
353
  hasSelection,
294
354
  hiddenPassword,
295
355
  inputStyle,
296
356
  resizeTextarea,
297
357
  select,
358
+ setInputDomValue,
298
359
  setNativeInputValue,
299
360
  showBox,
300
361
  textLength,
package/input/vue.js CHANGED
@@ -29,9 +29,12 @@ import {
29
29
  hasSelection,
30
30
  handleEnterDisplayOnlyContent,
31
31
  hiddenPassword,
32
- dispatchDisplayedValue,
33
- getDisplayedValue,
34
- inputStyle
32
+ setInputDomValue,
33
+ getDisplayedMaskValue,
34
+ inputStyle,
35
+ handleEnterTextarea,
36
+ handleLeaveTextarea,
37
+ getDisplayOnlyText
35
38
  } from "./index";
36
39
  import useStorageBox from "../tall-storage/vue-storage-box";
37
40
  const api = [
@@ -65,7 +68,9 @@ const api = [
65
68
  "hasSelection",
66
69
  "handleEnterDisplayOnlyContent",
67
70
  "hiddenPassword",
68
- "inputStyle"
71
+ "inputStyle",
72
+ "handleEnterTextarea",
73
+ "handleLeaveTextarea"
69
74
  ];
70
75
  const initState = ({
71
76
  reactive,
@@ -74,22 +79,28 @@ const initState = ({
74
79
  props,
75
80
  parent,
76
81
  constants,
77
- api: api2
82
+ api: api2,
83
+ vm
78
84
  }) => {
79
85
  const state = reactive({
80
86
  mode,
87
+ maskSymbol: constants.MASKSYMBOL,
81
88
  focused: false,
82
89
  hovering: false,
83
90
  isComposing: false,
84
91
  passwordVisible: false,
92
+ maskValueVisible: false,
85
93
  boxVisibility: false,
86
94
  textareaCalcStyle: {},
87
95
  checkedLabel: "",
96
+ enteredTextarea: false,
88
97
  sheetvalue: props.modelValue,
89
98
  inputSize: computed(() => props.size || state.formItemSize),
99
+ inputSizeMf: computed(() => props.size || (parent.tinyForm || {}).size),
90
100
  showClear: computed(
91
101
  () => props.clearable && !state.inputDisabled && !props.readonly && state.nativeInputValue && (state.focused || state.hovering)
92
102
  ),
103
+ textareaHeight: vm.theme === "saas" ? "28px" : "30px",
93
104
  upperLimit: computed(() => parent.$attrs.maxlength),
94
105
  textLength: computed(() => textLength(props.modelValue)),
95
106
  inputExceed: computed(() => state.isWordLimitVisible && state.textLength > state.upperLimit),
@@ -119,7 +130,9 @@ const initState = ({
119
130
  () => (props.displayOnly || (parent.tinyForm || {}).displayOnly) && ["text", "textarea", "password", "number"].includes(props.type)
120
131
  ),
121
132
  displayOnlyTooltip: "",
122
- hiddenPassword: computed(() => api2.hiddenPassword())
133
+ hiddenPassword: computed(() => api2.hiddenPassword()),
134
+ displayedMaskValue: computed(() => api2.getDisplayedMaskValue()),
135
+ displayOnlyText: computed(() => api2.getDisplayOnlyText())
123
136
  });
124
137
  return state;
125
138
  };
@@ -132,7 +145,8 @@ const initApi = ({
132
145
  vm,
133
146
  props,
134
147
  CLASS_PREFIX,
135
- parent
148
+ parent,
149
+ nextTick
136
150
  }) => {
137
151
  Object.assign(api2, {
138
152
  state,
@@ -148,8 +162,10 @@ const initApi = ({
148
162
  calculateNodeStyling: calculateNodeStyling(),
149
163
  handleCompositionStart: handleCompositionStart(state),
150
164
  handleCompositionUpdate: handleCompositionUpdate(state),
151
- dispatchDisplayedValue: dispatchDisplayedValue({ state, props, dispatch, api: api2 }),
152
- getDisplayedValue: getDisplayedValue({ state, props }),
165
+ setInputDomValue: setInputDomValue({ state, props, nextTick, vm }),
166
+ getDisplayOnlyText: getDisplayOnlyText({ parent, props, state }),
167
+ handleEnterTextarea: handleEnterTextarea({ api: api2, state, props, nextTick }),
168
+ handleLeaveTextarea: handleLeaveTextarea({ api: api2, state, props, nextTick, vm }),
153
169
  inputStyle: inputStyle({ props })
154
170
  });
155
171
  };
@@ -163,7 +179,7 @@ const mergeApi = ({
163
179
  nextTick,
164
180
  parent,
165
181
  state,
166
- refs
182
+ vm
167
183
  }) => {
168
184
  const { storageData, isMemoryStorage, addMemory, searchMemory, selectedMemory } = storages;
169
185
  return Object.assign(api2, {
@@ -181,11 +197,12 @@ const mergeApi = ({
181
197
  emit,
182
198
  eventName: eventName.blur,
183
199
  props,
184
- state
200
+ state,
201
+ vm
185
202
  }),
186
203
  handleFocus: handleFocus({ api: api2, emit, state }),
187
204
  handleInput: handleInput({ api: api2, emit, nextTick, state }),
188
- resizeTextarea: resizeTextarea({ api: api2, parent, refs, state }),
205
+ resizeTextarea: resizeTextarea({ api: api2, parent, vm, state, props }),
189
206
  updateIconOffset: updateIconOffset(api2),
190
207
  calcTextareaHeight: calcTextareaHeight({
191
208
  api: api2,
@@ -198,7 +215,8 @@ const mergeApi = ({
198
215
  handlePasswordVisible: handlePasswordVisible({ api: api2, nextTick, state }),
199
216
  hasSelection: hasSelection(api2),
200
217
  handleEnterDisplayOnlyContent: handleEnterDisplayOnlyContent({ state, props }),
201
- hiddenPassword: hiddenPassword({ state, props })
218
+ hiddenPassword: hiddenPassword({ state, props }),
219
+ getDisplayedMaskValue: getDisplayedMaskValue({ state })
202
220
  });
203
221
  };
204
222
  const initWatch = ({
@@ -222,6 +240,15 @@ const initWatch = ({
222
240
  if (props.validateEvent) {
223
241
  api2.dispatch(componentName, eventName.change, [value]);
224
242
  }
243
+ api2.setInputDomValue();
244
+ }
245
+ );
246
+ watch(() => state.maskValueVisible, api2.setInputDomValue);
247
+ watch(() => state.inputDisabled, api2.setInputDomValue);
248
+ watch(
249
+ () => props.mask,
250
+ () => {
251
+ api2.setInputDomValue("mask");
225
252
  }
226
253
  );
227
254
  watch(
@@ -252,7 +279,6 @@ const initWatch = ({
252
279
  api2.setNativeInputValue();
253
280
  api2.resizeTextarea();
254
281
  api2.updateIconOffset();
255
- api2.dispatchDisplayedValue();
256
282
  });
257
283
  }
258
284
  );
@@ -270,17 +296,17 @@ const renderless = (props, { computed, onMounted, onUpdated, reactive, toRefs, w
270
296
  Input: constants.inputMode(mode),
271
297
  InputGroup: constants.inputGroupMode(mode)
272
298
  };
273
- const state = initState({ reactive, computed, mode, props, parent, constants, api: api2 });
274
- initApi({ api: api2, state, dispatch, broadcast, emit, refs, props, CLASS_PREFIX, parent, vm });
299
+ const state = initState({ reactive, computed, mode, props, parent, constants, api: api2, vm });
300
+ initApi({ api: api2, state, dispatch, broadcast, emit, refs, props, CLASS_PREFIX, parent, vm, nextTick });
275
301
  const storages = useStorageBox({ api: api2, props, reactive, toRefs });
276
302
  parent.tinyForm = parent.tinyForm || inject("form", null);
277
- mergeApi({ api: api2, storages, componentName, emit, eventName, props, state, nextTick, parent, refs });
303
+ mergeApi({ api: api2, storages, componentName, emit, eventName, props, state, nextTick, parent, vm });
278
304
  initWatch({ watch, state, api: api2, props, nextTick, emit, componentName, eventName });
279
305
  onMounted(() => {
280
306
  api2.setNativeInputValue();
281
307
  api2.resizeTextarea();
282
308
  api2.updateIconOffset();
283
- api2.dispatchDisplayedValue();
309
+ api2.setInputDomValue();
284
310
  dispatch("Select", "input-mounted", vm.$el);
285
311
  dispatch("Tooltip", "tooltip-update", vm.$el);
286
312
  });