@nutui/nutui 3.1.19-beta.1 → 3.1.19-beta.4

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 (236) hide show
  1. package/README.md +9 -8
  2. package/dist/nutui.es.js +3044 -3533
  3. package/dist/nutui.umd.js +3135 -3536
  4. package/dist/packages/_es/ActionSheet.js +64 -42
  5. package/dist/packages/_es/Address.js +69 -78
  6. package/dist/packages/_es/Audio.js +12 -12
  7. package/dist/packages/_es/AudioOperate.js +1 -1
  8. package/dist/packages/_es/Avatar.js +3 -3
  9. package/dist/packages/_es/BackTop.js +110 -68
  10. package/dist/packages/_es/Badge.js +3 -3
  11. package/dist/packages/_es/Barrage.js +55 -62
  12. package/dist/packages/_es/Button.js +2 -2
  13. package/dist/packages/_es/Calendar.js +27 -32
  14. package/dist/packages/_es/CalendarItem.js +3 -3
  15. package/dist/packages/_es/Card.js +5 -6
  16. package/dist/packages/_es/Cascader.js +9 -9
  17. package/dist/packages/_es/Cell.js +11 -4
  18. package/dist/packages/_es/CellGroup.js +1 -1
  19. package/dist/packages/_es/Checkbox.js +13 -3
  20. package/dist/packages/_es/CheckboxGroup.js +2 -2
  21. package/dist/packages/_es/CircleProgress.js +40 -149
  22. package/dist/packages/_es/Col.js +1 -1
  23. package/dist/packages/_es/Collapse.js +8 -34
  24. package/dist/packages/_es/CollapseItem.js +59 -90
  25. package/dist/packages/_es/CountDown.js +11 -10
  26. package/dist/packages/_es/CountUp.js +51 -43
  27. package/dist/packages/_es/DatePicker.js +22 -23
  28. package/dist/packages/_es/Dialog.js +91 -12
  29. package/dist/packages/_es/Divider.js +4 -4
  30. package/dist/packages/_es/Drag.js +54 -92
  31. package/dist/packages/_es/Ecard.js +153 -0
  32. package/dist/packages/_es/Elevator.js +50 -75
  33. package/dist/packages/_es/Empty.js +8 -7
  34. package/dist/packages/_es/FixedNav.js +10 -11
  35. package/dist/packages/_es/Form.js +5 -9
  36. package/dist/packages/_es/FormItem.js +1 -1
  37. package/dist/packages/_es/Grid.js +1 -1
  38. package/dist/packages/_es/GridItem.js +26 -8
  39. package/dist/packages/_es/Icon.js +1 -1
  40. package/dist/packages/_es/ImagePreview.js +83 -14
  41. package/dist/packages/_es/Indicator.js +3 -3
  42. package/dist/packages/_es/InfiniteLoading.js +107 -93
  43. package/dist/packages/_es/Input.js +21 -20
  44. package/dist/packages/_es/InputNumber.js +16 -23
  45. package/dist/packages/_es/Layout.js +1 -1
  46. package/dist/packages/_es/List.js +34 -41
  47. package/dist/packages/_es/Menu.js +12 -15
  48. package/dist/packages/_es/MenuItem.js +7 -7
  49. package/dist/packages/_es/Navbar.js +5 -4
  50. package/dist/packages/_es/NoticeBar.js +40 -47
  51. package/dist/packages/_es/Notify.js +166 -27
  52. package/dist/packages/_es/NumberKeyboard.js +22 -11
  53. package/dist/packages/_es/OldPicker.js +120 -122
  54. package/dist/packages/_es/OverLay.js +25 -5
  55. package/dist/packages/_es/Pagination.js +14 -13
  56. package/dist/packages/_es/Picker.js +23 -45
  57. package/dist/packages/_es/Popover.js +29 -154
  58. package/dist/packages/_es/Popup.js +69 -6
  59. package/dist/packages/_es/Price.js +5 -17
  60. package/dist/packages/_es/Progress.js +23 -19
  61. package/dist/packages/_es/PullRefresh.js +1 -1
  62. package/dist/packages/_es/Radio.js +14 -4
  63. package/dist/packages/_es/RadioGroup.js +1 -1
  64. package/dist/packages/_es/Range.js +33 -46
  65. package/dist/packages/_es/Rate.js +19 -16
  66. package/dist/packages/_es/Row.js +1 -1
  67. package/dist/packages/_es/SearchBar.js +11 -12
  68. package/dist/packages/_es/ShortPassword.js +75 -96
  69. package/dist/packages/_es/SideNavBar.js +16 -5
  70. package/dist/packages/_es/SideNavBarItem.js +1 -1
  71. package/dist/packages/_es/Signature.js +88 -69
  72. package/dist/packages/_es/Skeleton.js +11 -8
  73. package/dist/packages/_es/Sku.js +57 -49
  74. package/dist/packages/_es/Step.js +1 -1
  75. package/dist/packages/_es/Steps.js +1 -1
  76. package/dist/packages/_es/Sticky.js +23 -28
  77. package/dist/packages/_es/SubSideNavBar.js +1 -1
  78. package/dist/packages/_es/Swipe.js +26 -39
  79. package/dist/packages/_es/Swiper.js +14 -32
  80. package/dist/packages/_es/SwiperItem.js +2 -2
  81. package/dist/packages/_es/Switch.js +3 -3
  82. package/dist/packages/_es/TabPane.js +1 -1
  83. package/dist/packages/_es/Tabbar.js +3 -3
  84. package/dist/packages/_es/TabbarItem.js +21 -11
  85. package/dist/packages/_es/Table.js +18 -17
  86. package/dist/packages/_es/Tabs.js +20 -21
  87. package/dist/packages/_es/Tag.js +4 -4
  88. package/dist/packages/_es/TextArea.js +47 -48
  89. package/dist/packages/_es/TimeDetail.js +3 -4
  90. package/dist/packages/_es/TimePannel.js +3 -3
  91. package/dist/packages/_es/TimeSelect.js +7 -8
  92. package/dist/packages/_es/Toast.js +170 -41
  93. package/dist/packages/_es/Uploader.js +145 -116
  94. package/dist/packages/_es/Video.js +9 -8
  95. package/dist/packages/_es/common.js +1 -1
  96. package/dist/packages/_es/component.js +165 -3
  97. package/dist/packages/_es/index.js +6 -44
  98. package/dist/packages/_es/index2.js +31 -8
  99. package/dist/packages/_es/index3.js +7 -58
  100. package/dist/packages/_es/index4.js +56 -413
  101. package/dist/packages/_es/{index.taro.js → index5.js} +113 -140
  102. package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
  103. package/dist/packages/_es/pxCheck.js +1 -1
  104. package/dist/packages/_es/raf.js +19 -0
  105. package/dist/packages/actionsheet/index.scss +8 -0
  106. package/dist/packages/ecard/index.scss +83 -0
  107. package/dist/style.css +1 -1
  108. package/dist/styles/themes/default.scss +48 -47
  109. package/dist/styles/themes/jdt.scss +48 -47
  110. package/dist/styles/variables-jdt.scss +3 -0
  111. package/dist/styles/variables.scss +3 -0
  112. package/dist/types/__VUE/actionsheet/index.d.ts +280 -0
  113. package/dist/types/__VUE/address/index.d.ts +386 -0
  114. package/dist/types/__VUE/audio/index.d.ts +92 -0
  115. package/dist/types/__VUE/audiooperate/index.d.ts +68 -0
  116. package/dist/types/__VUE/avatar/index.d.ts +66 -0
  117. package/dist/types/__VUE/backtop/index.d.ts +105 -0
  118. package/dist/types/__VUE/badge/index.d.ts +94 -0
  119. package/dist/types/__VUE/barrage/index.d.ts +80 -0
  120. package/dist/types/__VUE/button/index.d.ts +116 -0
  121. package/dist/types/__VUE/calendar/index.d.ts +155 -0
  122. package/dist/types/__VUE/calendaritem/index.d.ts +195 -0
  123. package/dist/types/__VUE/card/index.d.ts +81 -0
  124. package/dist/types/__VUE/cascader/cascader-item.d.ts +76 -0
  125. package/dist/types/__VUE/cascader/helper.d.ts +8 -0
  126. package/dist/types/__VUE/cascader/index.d.ts +76 -0
  127. package/dist/types/__VUE/cascader/tree.d.ts +17 -0
  128. package/dist/types/__VUE/cascader/types.d.ts +30 -0
  129. package/dist/types/__VUE/cell/index.d.ts +109 -0
  130. package/dist/types/__VUE/cellgroup/index.d.ts +38 -0
  131. package/dist/types/__VUE/checkbox/index.d.ts +102 -0
  132. package/dist/types/__VUE/checkboxgroup/index.d.ts +39 -0
  133. package/dist/types/__VUE/circleprogress/index.d.ts +66 -0
  134. package/dist/types/__VUE/col/index.d.ts +42 -0
  135. package/dist/types/__VUE/collapse/index.d.ts +104 -0
  136. package/dist/types/__VUE/collapseitem/index.d.ts +83 -0
  137. package/dist/types/__VUE/countdown/index.d.ts +91 -0
  138. package/dist/types/__VUE/countup/index.d.ts +216 -0
  139. package/dist/types/__VUE/datepicker/index.d.ts +347 -0
  140. package/dist/types/__VUE/datepicker/utils.d.ts +5 -0
  141. package/dist/types/__VUE/dialog/index.d.ts +306 -0
  142. package/dist/types/__VUE/divider/index.d.ts +47 -0
  143. package/dist/types/__VUE/drag/index.d.ts +61 -0
  144. package/dist/types/__VUE/ecard/index.d.ts +123 -0
  145. package/dist/types/__VUE/elevator/index.d.ts +71 -0
  146. package/dist/types/__VUE/empty/index.d.ts +47 -0
  147. package/dist/types/__VUE/fixednav/index.d.ts +96 -0
  148. package/dist/types/__VUE/form/common.d.ts +20 -0
  149. package/dist/types/__VUE/form/index.d.ts +32 -0
  150. package/dist/types/__VUE/form/types.d.ts +13 -0
  151. package/dist/types/__VUE/formitem/index.d.ts +120 -0
  152. package/dist/types/__VUE/formitem/types.d.ts +10 -0
  153. package/dist/types/__VUE/grid/common.d.ts +91 -0
  154. package/dist/types/__VUE/grid/index.d.ts +100 -0
  155. package/dist/types/__VUE/griditem/index.d.ts +80 -0
  156. package/dist/types/__VUE/icon/index.d.ts +74 -0
  157. package/dist/types/__VUE/imagepreview/index.d.ts +125 -0
  158. package/dist/types/__VUE/indicator/index.d.ts +70 -0
  159. package/dist/types/__VUE/infiniteloading/index.d.ts +140 -0
  160. package/dist/types/__VUE/input/index.d.ts +337 -0
  161. package/dist/types/__VUE/input/util.d.ts +5 -0
  162. package/dist/types/__VUE/inputnumber/index.d.ts +117 -0
  163. package/dist/types/__VUE/layout/index.d.ts +13 -0
  164. package/dist/types/__VUE/list/index.d.ts +48 -0
  165. package/dist/types/__VUE/menu/index.d.ts +51 -0
  166. package/dist/types/__VUE/menuitem/index.d.ts +77 -0
  167. package/dist/types/__VUE/navbar/index.d.ts +83 -0
  168. package/dist/types/__VUE/noticebar/index.d.ts +209 -0
  169. package/dist/types/__VUE/notify/index.d.ts +103 -0
  170. package/dist/types/__VUE/numberkeyboard/index.d.ts +124 -0
  171. package/dist/types/__VUE/oldpicker/Column.d.ts +96 -0
  172. package/dist/types/__VUE/oldpicker/commonProps.d.ts +22 -0
  173. package/dist/types/__VUE/oldpicker/index.d.ts +360 -0
  174. package/dist/types/__VUE/oldpicker/types.d.ts +24 -0
  175. package/dist/types/__VUE/overlay/index.d.ts +1614 -0
  176. package/dist/types/__VUE/pagination/index.d.ts +112 -0
  177. package/dist/types/__VUE/picker/Column.d.ts +90 -0
  178. package/dist/types/__VUE/picker/index.d.ts +343 -0
  179. package/dist/types/__VUE/picker/types.d.ts +26 -0
  180. package/dist/types/__VUE/popover/index.d.ts +233 -0
  181. package/dist/types/__VUE/popup/index.d.ts +1734 -0
  182. package/dist/types/__VUE/popup/use-lock-scroll.d.ts +5 -0
  183. package/dist/types/__VUE/price/index.d.ts +87 -0
  184. package/dist/types/__VUE/progress/index.d.ts +138 -0
  185. package/dist/types/__VUE/pullrefresh/index.d.ts +128 -0
  186. package/dist/types/__VUE/pullrefresh/use-touch.d.ts +20 -0
  187. package/dist/types/__VUE/pullrefresh/util.d.ts +6 -0
  188. package/dist/types/__VUE/radio/index.d.ts +90 -0
  189. package/dist/types/__VUE/radiogroup/index.d.ts +48 -0
  190. package/dist/types/__VUE/range/index.d.ts +156 -0
  191. package/dist/types/__VUE/rate/index.d.ts +142 -0
  192. package/dist/types/__VUE/row/index.d.ts +63 -0
  193. package/dist/types/__VUE/searchbar/index.d.ts +100 -0
  194. package/dist/types/__VUE/shortpassword/index.d.ts +137 -0
  195. package/dist/types/__VUE/sidenavbar/index.d.ts +36 -0
  196. package/dist/types/__VUE/sidenavbaritem/index.d.ts +41 -0
  197. package/dist/types/__VUE/signature/index.d.ts +73 -0
  198. package/dist/types/__VUE/skeleton/common.d.ts +63 -0
  199. package/dist/types/__VUE/skeleton/index.d.ts +117 -0
  200. package/dist/types/__VUE/sku/components/SkuHeader.d.ts +27 -0
  201. package/dist/types/__VUE/sku/components/SkuOperate.d.ts +70 -0
  202. package/dist/types/__VUE/sku/components/SkuSelect.d.ts +30 -0
  203. package/dist/types/__VUE/sku/components/SkuStepper.d.ts +67 -0
  204. package/dist/types/__VUE/sku/index.d.ts +300 -0
  205. package/dist/types/__VUE/step/index.d.ts +70 -0
  206. package/dist/types/__VUE/steps/index.d.ts +47 -0
  207. package/dist/types/__VUE/sticky/index.d.ts +63 -0
  208. package/dist/types/__VUE/subsidenavbar/index.d.ts +54 -0
  209. package/dist/types/__VUE/swipe/index.d.ts +69 -0
  210. package/dist/types/__VUE/swiper/index.d.ts +163 -0
  211. package/dist/types/__VUE/swiper/use-touch.d.ts +20 -0
  212. package/dist/types/__VUE/swiperitem/index.d.ts +24 -0
  213. package/dist/types/__VUE/switch/index.d.ts +136 -0
  214. package/dist/types/__VUE/tabbar/index.d.ts +84 -0
  215. package/dist/types/__VUE/tabbaritem/index.d.ts +108 -0
  216. package/dist/types/__VUE/table/common.d.ts +55 -0
  217. package/dist/types/__VUE/table/index.d.ts +76 -0
  218. package/dist/types/__VUE/table/renderColumn.d.ts +20 -0
  219. package/dist/types/__VUE/table/types.d.ts +19 -0
  220. package/dist/types/__VUE/tabpane/index.d.ts +47 -0
  221. package/dist/types/__VUE/tabs/index.d.ts +128 -0
  222. package/dist/types/__VUE/tag/index.d.ts +89 -0
  223. package/dist/types/__VUE/textarea/index.d.ts +121 -0
  224. package/dist/types/__VUE/timedetail/index.d.ts +48 -0
  225. package/dist/types/__VUE/timepannel/index.d.ts +43 -0
  226. package/dist/types/__VUE/timeselect/index.d.ts +82 -0
  227. package/dist/types/__VUE/toast/index.d.ts +149 -0
  228. package/dist/types/__VUE/uploader/index.d.ts +258 -0
  229. package/dist/types/__VUE/uploader/uploader.d.ts +25 -0
  230. package/dist/types/__VUE/video/index.d.ts +123 -0
  231. package/dist/{index.d.ts → types/index.d.ts} +0 -0
  232. package/dist/types/nutui.d.ts +93 -0
  233. package/package.json +14 -5
  234. package/dist/nutui.d.ts +0 -104
  235. package/dist/packages/_es/use-lock-scroll.js +0 -23
  236. package/dist/packages/_es/util.js +0 -47
@@ -1,26 +1,25 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.19-beta.4 Tue Apr 12 2022 17:39:20 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref, computed, watch, onMounted, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, toDisplayString, withDirectives, vModelText, createCommentVNode, Fragment, renderList } from "vue";
6
+ import { ref, computed, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, toDisplayString, withDirectives, normalizeStyle, vModelText, Fragment, renderList, createCommentVNode } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import Taro, { eventCenter, getCurrentInstance } from "@tarojs/taro";
9
8
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
- const { create } = createComponent("shortpassword");
9
+ const { create, translate } = createComponent("shortpassword");
11
10
  const _sfc_main = create({
12
11
  props: {
13
12
  title: {
14
13
  type: String,
15
- default: "\u8BF7\u8F93\u5165\u5BC6\u7801"
14
+ default: ""
16
15
  },
17
16
  desc: {
18
17
  type: String,
19
- default: "\u60A8\u4F7F\u7528\u4E86\u865A\u62DF\u8D44\u4EA7\uFF0C\u8BF7\u8FDB\u884C\u9A8C\u8BC1"
18
+ default: ""
20
19
  },
21
20
  tips: {
22
21
  type: String,
23
- default: "\u5FD8\u8BB0\u5BC6\u7801"
22
+ default: ""
24
23
  },
25
24
  visible: {
26
25
  type: Boolean,
@@ -45,6 +44,10 @@ const _sfc_main = create({
45
44
  length: {
46
45
  type: [String, Number],
47
46
  default: 6
47
+ },
48
+ isWrapTeleport: {
49
+ type: Boolean,
50
+ default: true
48
51
  }
49
52
  },
50
53
  emits: ["update:modelValue", "update:visible", "complete", "change", "ok", "tips", "close", "cancel"],
@@ -53,42 +56,21 @@ const _sfc_main = create({
53
56
  const realpwd = ref();
54
57
  const comLen = computed(() => range(Number(props.length)));
55
58
  const show = ref(props.visible);
56
- const refRandomId = Math.random().toString(36).slice(-8);
57
- const randRef = ref(refRandomId);
58
- const isWx = ref(false);
59
59
  function sureClick() {
60
60
  emit("ok", realInput.value);
61
61
  }
62
62
  function focus() {
63
- let dom = "";
64
- if (isWx.value) {
65
- setTimeout(() => {
66
- if (!document.getElementById("nut-input-real-taro-" + randRef.value))
67
- return;
68
- dom = document.getElementById("nut-input-real-taro-" + randRef.value);
69
- if (!dom)
70
- return;
71
- dom.focus();
72
- }, 150);
73
- } else {
74
- dom = document.getElementsByClassName("nut-input-real")[0];
75
- let h = dom.children[0];
76
- h.focus();
77
- }
63
+ realpwd.value.focus();
78
64
  }
79
65
  watch(() => props.visible, (value) => {
80
66
  show.value = value;
81
- if (value) {
82
- randRef.value = Math.random().toString(36).slice(-8);
83
- if (Taro.getEnv() === "WEB") {
84
- isWx.value = false;
85
- } else {
86
- isWx.value = true;
87
- }
88
- }
89
67
  });
90
68
  watch(() => props.modelValue, (value) => {
91
69
  realInput.value = value;
70
+ emit("update:modelValue", value);
71
+ }, {
72
+ deep: true,
73
+ immediate: true
92
74
  });
93
75
  function changeValue(e) {
94
76
  const input = e.target;
@@ -117,46 +99,55 @@ const _sfc_main = create({
117
99
  function onTips() {
118
100
  emit("tips");
119
101
  }
120
- onMounted(() => {
121
- eventCenter.once(getCurrentInstance().router.onReady, () => {
122
- });
123
- if (Taro.getEnv() === "WEB") {
124
- isWx.value = false;
125
- } else {
126
- isWx.value = true;
102
+ function systemStyle() {
103
+ let u = navigator.userAgent;
104
+ let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1;
105
+ let isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
106
+ if (isIOS) {
107
+ return {
108
+ paddingRight: "1200px"
109
+ };
127
110
  }
128
- });
111
+ if (isAndroid) {
112
+ return {
113
+ opacity: 0,
114
+ zindex: 10
115
+ };
116
+ }
117
+ }
129
118
  return {
130
119
  comLen,
131
120
  sureClick,
132
121
  realInput,
133
122
  realpwd,
123
+ focus,
134
124
  range,
135
125
  changeValue,
136
126
  close,
137
127
  onTips,
138
- focus,
139
128
  show,
129
+ systemStyle,
140
130
  closeIcon,
141
- isWx,
142
- refRandomId,
143
- randRef
131
+ translate
144
132
  };
145
133
  }
146
134
  });
147
135
  const _hoisted_1 = { class: "nut-shortpsd-title" };
148
- const _hoisted_2 = { class: "nut-shortpsdWx-subtitle" };
149
- const _hoisted_3 = ["id", "maxlength"];
150
- const _hoisted_4 = { class: "nut-input-w" };
151
- const _hoisted_5 = /* @__PURE__ */ createElementVNode("view", { class: "nut-input-site" }, null, -1);
152
- const _hoisted_6 = {
136
+ const _hoisted_2 = { class: "nut-shortpsd-subtitle" };
137
+ const _hoisted_3 = { class: "nut-input-normalw" };
138
+ const _hoisted_4 = /* @__PURE__ */ createElementVNode("div", { class: "nut-input-site" }, null, -1);
139
+ const _hoisted_5 = {
153
140
  key: 0,
154
141
  class: "nut-shortpsd-icon"
155
142
  };
156
- const _hoisted_7 = { class: "nut-shortpsd-message" };
157
- const _hoisted_8 = { class: "nut-shortpsd-error" };
143
+ const _hoisted_6 = { class: "nut-shortpsd-message" };
144
+ const _hoisted_7 = { class: "nut-shortpsd-error" };
145
+ const _hoisted_8 = {
146
+ key: 0,
147
+ class: "nut-shortpsd-forget"
148
+ };
158
149
  const _hoisted_9 = {
159
- key: 1,
150
+ key: 0,
160
151
  class: "nut-shortpsd-footer"
161
152
  };
162
153
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
@@ -170,82 +161,70 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
170
161
  textAlign: "center"
171
162
  },
172
163
  visible: _ctx.show,
173
- "onUpdate:visible": _cache[8] || (_cache[8] = ($event) => _ctx.show = $event),
164
+ "onUpdate:visible": _cache[6] || (_cache[6] = ($event) => _ctx.show = $event),
174
165
  closeable: true,
175
166
  onClickCloseIcon: _ctx.closeIcon,
176
167
  "close-on-click-overlay": _ctx.closeOnClickOverlay,
177
- onClickOverlay: _ctx.close
168
+ onClickOverlay: _ctx.close,
169
+ isWrapTeleport: _ctx.isWrapTeleport
178
170
  }, {
179
171
  default: withCtx(() => [
180
- createElementVNode("view", _hoisted_1, toDisplayString(_ctx.title), 1),
181
- createElementVNode("view", _hoisted_2, toDisplayString(_ctx.desc), 1),
182
- _ctx.isWx && _ctx.visible ? withDirectives((openBlock(), createElementBlock("input", {
183
- key: 0,
184
- class: "nut-input-real-taro",
185
- id: "nut-input-real-taro-" + _ctx.randRef,
186
- type: "number",
187
- maxlength: _ctx.length,
188
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.realInput = $event),
189
- onInput: _cache[1] || (_cache[1] = (...args) => _ctx.changeValue && _ctx.changeValue(...args))
190
- }, null, 40, _hoisted_3)), [
191
- [vModelText, _ctx.realInput]
192
- ]) : createCommentVNode("", true),
193
- createElementVNode("view", _hoisted_4, [
194
- !_ctx.isWx ? withDirectives((openBlock(), createElementBlock("input", {
195
- key: 0,
172
+ createElementVNode("view", _hoisted_1, toDisplayString(_ctx.title || _ctx.translate("title")), 1),
173
+ createElementVNode("view", _hoisted_2, toDisplayString(_ctx.desc || _ctx.translate("desc")), 1),
174
+ createElementVNode("div", _hoisted_3, [
175
+ withDirectives(createElementVNode("input", {
196
176
  ref: "realpwd",
197
177
  class: "nut-input-real",
198
178
  type: "number",
199
179
  maxlength: "6",
200
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.realInput = $event),
201
- onInput: _cache[3] || (_cache[3] = (...args) => _ctx.changeValue && _ctx.changeValue(...args))
202
- }, null, 544)), [
180
+ style: normalizeStyle(_ctx.systemStyle()),
181
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.realInput = $event),
182
+ onInput: _cache[1] || (_cache[1] = (...args) => _ctx.changeValue && _ctx.changeValue(...args))
183
+ }, null, 36), [
203
184
  [vModelText, _ctx.realInput]
204
- ]) : createCommentVNode("", true),
205
- _hoisted_5,
185
+ ]),
186
+ _hoisted_4,
206
187
  createElementVNode("view", {
207
- class: "nut-shortpsd-fake-taro",
208
- onClick: _cache[4] || (_cache[4] = (...args) => _ctx.focus && _ctx.focus(...args))
188
+ class: "nut-shortpsd-fake",
189
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.focus && _ctx.focus(...args))
209
190
  }, [
210
- (openBlock(true), createElementBlock(Fragment, null, renderList(new Array(_ctx.comLen), (sublen, index) => {
191
+ (openBlock(true), createElementBlock(Fragment, null, renderList(new Array(_ctx.comLen), (sublen, index2) => {
211
192
  return openBlock(), createElementBlock("view", {
212
193
  class: "nut-shortpsd-li",
213
- key: index
194
+ key: index2
214
195
  }, [
215
- String(_ctx.realInput).length > index ? (openBlock(), createElementBlock("view", _hoisted_6)) : createCommentVNode("", true)
196
+ String(_ctx.realInput).length > index2 ? (openBlock(), createElementBlock("view", _hoisted_5)) : createCommentVNode("", true)
216
197
  ]);
217
198
  }), 128))
218
199
  ])
219
200
  ]),
220
- createElementVNode("view", _hoisted_7, [
221
- createElementVNode("view", _hoisted_8, toDisplayString(_ctx.errorMsg), 1),
222
- _ctx.tips ? (openBlock(), createElementBlock("view", {
223
- key: 0,
224
- class: "nut-shortpsd-forget",
225
- onClick: _cache[5] || (_cache[5] = (...args) => _ctx.onTips && _ctx.onTips(...args))
226
- }, [
201
+ createElementVNode("view", _hoisted_6, [
202
+ createElementVNode("view", _hoisted_7, toDisplayString(_ctx.errorMsg), 1),
203
+ _ctx.tips || _ctx.translate("tips") ? (openBlock(), createElementBlock("view", _hoisted_8, [
227
204
  createVNode(_component_nut_icon, {
228
205
  class: "icon",
229
206
  size: "11px",
230
207
  name: "tips"
231
208
  }),
232
- createElementVNode("view", null, toDisplayString(_ctx.tips), 1)
209
+ createElementVNode("view", {
210
+ onClick: _cache[3] || (_cache[3] = (...args) => _ctx.onTips && _ctx.onTips(...args))
211
+ }, toDisplayString(_ctx.tips || _ctx.translate("tips")), 1)
233
212
  ])) : createCommentVNode("", true)
234
213
  ]),
235
214
  !_ctx.noButton ? (openBlock(), createElementBlock("view", _hoisted_9, [
236
215
  createElementVNode("view", {
237
216
  class: "nut-shortpsd-cancle",
238
- onClick: _cache[6] || (_cache[6] = (...args) => _ctx.close && _ctx.close(...args))
239
- }, "\u53D6\u6D88"),
217
+ onClick: _cache[4] || (_cache[4] = (...args) => _ctx.close && _ctx.close(...args))
218
+ }, toDisplayString(_ctx.translate("cancel")), 1),
240
219
  createElementVNode("view", {
241
220
  class: "nut-shortpsd-sure",
242
- onClick: _cache[7] || (_cache[7] = (...args) => _ctx.sureClick && _ctx.sureClick(...args))
243
- }, "\u786E\u8BA4")
221
+ onClick: _cache[5] || (_cache[5] = (...args) => _ctx.sureClick && _ctx.sureClick(...args))
222
+ }, toDisplayString(_ctx.translate("confirm")), 1)
244
223
  ])) : createCommentVNode("", true)
245
224
  ]),
246
225
  _: 1
247
- }, 8, ["visible", "onClickCloseIcon", "close-on-click-overlay", "onClickOverlay"])
226
+ }, 8, ["visible", "onClickCloseIcon", "close-on-click-overlay", "onClickOverlay", "isWrapTeleport"])
248
227
  ]);
249
228
  }
250
- var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
251
- export { index_taro as default };
229
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
230
+ export { index as default };
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.19-beta.4 Tue Apr 12 2022 17:39:20 GMT+0800 (中国标准时间)
22
22
  * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -37,7 +37,8 @@ const _sfc_main = create({
37
37
  setup: (props, context) => {
38
38
  const list = ref(null);
39
39
  const state = reactive({
40
- count: 1
40
+ count: 1,
41
+ observer: null
41
42
  });
42
43
  const classes = computed(() => {
43
44
  const prefixCls = componentName;
@@ -57,7 +58,7 @@ const _sfc_main = create({
57
58
  };
58
59
  const handleSlots = () => {
59
60
  let childNodes = list.value.childNodes;
60
- if (childNodes && childNodes.length) {
61
+ if (childNodes.length) {
61
62
  childNodes = Array.from(childNodes).filter((item) => item.nodeType !== 3).map((item) => {
62
63
  return item;
63
64
  });
@@ -66,6 +67,16 @@ const _sfc_main = create({
66
67
  };
67
68
  onMounted(() => {
68
69
  handleSlots();
70
+ state.observer = new MutationObserver(function() {
71
+ state.count = 1;
72
+ handleSlots();
73
+ });
74
+ state.observer.observe(list.value, {
75
+ attributes: false,
76
+ childList: true,
77
+ characterData: false,
78
+ subtree: false
79
+ });
69
80
  });
70
81
  return __spreadProps(__spreadValues({}, toRefs(state)), {
71
82
  list,
@@ -89,5 +100,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
89
100
  ])
90
101
  ], 2);
91
102
  }
92
- var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
93
- export { index_taro as default };
103
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
104
+ export { index as default };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.19-beta.4 Tue Apr 12 2022 17:39:20 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,10 +1,28 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1
20
  /*!
2
- * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.19-beta.4 Tue Apr 12 2022 17:39:20 GMT+0800 (中国标准时间)
3
22
  * (c) 2022 @jdf2e.
4
23
  * Released under the MIT License.
5
24
  */
6
- import Taro from "@tarojs/taro";
7
- import { computed, reactive, onMounted, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createVNode, withCtx, createTextVNode } from "vue";
25
+ import { ref, computed, reactive, onMounted, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createVNode, withCtx, createTextVNode } from "vue";
8
26
  import { c as createComponent } from "./component.js";
9
27
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
28
  const { componentName, create } = createComponent("signature");
@@ -34,6 +52,8 @@ const _sfc_main = create({
34
52
  components: {},
35
53
  emits: ["confirm", "clear"],
36
54
  setup(props, { emit }) {
55
+ const canvas = ref(null);
56
+ const wrap = ref(null);
37
57
  const classes = computed(() => {
38
58
  const prefixCls = componentName;
39
59
  return {
@@ -42,126 +62,125 @@ const _sfc_main = create({
42
62
  };
43
63
  });
44
64
  const state = reactive({
45
- canvas: null,
46
65
  canvasHeight: 0,
47
66
  canvasWidth: 0,
48
- ctx: null
67
+ ctx: null,
68
+ isSupportTouch: "ontouchstart" in window,
69
+ events: "ontouchstart" in window ? ["touchstart", "touchmove", "touchend", "touchleave"] : ["mousedown", "mousemove", "mouseup", "mouseleave"]
49
70
  });
71
+ const isCanvasSupported = () => {
72
+ let elem = document.createElement("canvas");
73
+ return !!(elem.getContext && elem.getContext("2d"));
74
+ };
75
+ const addEvent = () => {
76
+ canvas.value.addEventListener(state.events[0], startEventHandler, false);
77
+ };
50
78
  const startEventHandler = (event) => {
51
79
  event.preventDefault();
52
80
  state.ctx.beginPath();
53
81
  state.ctx.lineWidth = props.lineWidth;
54
82
  state.ctx.strokeStyle = props.strokeStyle;
83
+ canvas.value.addEventListener(state.events[1], moveEventHandler, false);
84
+ canvas.value.addEventListener(state.events[2], endEventHandler, false);
85
+ canvas.value.addEventListener(state.events[3], leaveEventHandler, false);
55
86
  };
56
87
  const moveEventHandler = (event) => {
57
88
  event.preventDefault();
58
- let evt = event.changedTouches[0];
59
- let mouseX = evt.x;
60
- let mouseY = evt.y;
89
+ let evt = state.isSupportTouch ? event.touches[0] : event;
90
+ let coverPos = canvas.value.getBoundingClientRect();
91
+ let mouseX = evt.clientX - coverPos.left;
92
+ let mouseY = evt.clientY - coverPos.top;
61
93
  state.ctx.lineTo(mouseX, mouseY);
62
94
  state.ctx.stroke();
63
95
  };
64
96
  const endEventHandler = (event) => {
65
97
  event.preventDefault();
98
+ canvas.value.removeEventListener(state.events[1], moveEventHandler, false);
99
+ canvas.value.removeEventListener(state.events[2], endEventHandler, false);
66
100
  };
67
101
  const leaveEventHandler = (event) => {
68
102
  event.preventDefault();
103
+ canvas.value.removeEventListener(state.events[1], moveEventHandler, false);
104
+ canvas.value.removeEventListener(state.events[2], endEventHandler, false);
69
105
  };
70
106
  const clear = () => {
107
+ canvas.value.addEventListener(state.events[2], endEventHandler, false);
71
108
  state.ctx.clearRect(0, 0, state.canvasWidth, state.canvasHeight);
72
109
  state.ctx.closePath();
73
110
  emit("clear");
74
111
  };
75
112
  const confirm = () => {
76
- onSave();
113
+ onSave(canvas.value);
77
114
  };
78
- const onSave = () => {
79
- if (!state.canvas) {
80
- return;
115
+ const onSave = (canvas2) => {
116
+ let dataurl;
117
+ switch (props.type) {
118
+ case "png":
119
+ dataurl = canvas2.toDataURL("image/png");
120
+ break;
121
+ case "jpg":
122
+ dataurl = canvas2.toDataURL("image/jpeg", 0.8);
123
+ break;
81
124
  }
82
- Taro.createSelectorQuery().select("#spcanvas").fields({
83
- node: true,
84
- size: true
85
- }).exec(async (res) => {
86
- Taro.canvasToTempFilePath({
87
- canvas: res[0].node,
88
- fileType: props.type
89
- }).then((res2) => {
90
- emit("confirm", res2.tempFilePath);
91
- }).catch((e) => {
92
- emit("confirm", e);
93
- });
94
- });
125
+ clear();
126
+ emit("confirm", canvas2, dataurl);
95
127
  };
96
128
  onMounted(() => {
97
- setTimeout(() => {
98
- Taro.createSelectorQuery().select("#spcanvas").fields({
99
- node: true,
100
- size: true
101
- }, function(res) {
102
- const canvas = res.node;
103
- const ctx = canvas.getContext("2d");
104
- state.canvas = canvas;
105
- state.ctx = ctx;
106
- state.canvasWidth = res.width;
107
- state.canvasHeight = res.height;
108
- }).exec();
109
- }, 500);
129
+ if (isCanvasSupported()) {
130
+ state.ctx = canvas.value.getContext("2d");
131
+ state.canvasWidth = wrap.value.offsetWidth;
132
+ state.canvasHeight = wrap.value.offsetHeight;
133
+ addEvent();
134
+ }
110
135
  });
111
- return {
112
- confirm,
113
- clear,
114
- classes,
115
- startEventHandler,
116
- moveEventHandler,
117
- endEventHandler,
118
- leaveEventHandler
119
- };
136
+ return __spreadProps(__spreadValues({}, toRefs(state)), { canvas, wrap, isCanvasSupported, confirm, clear, classes });
120
137
  }
121
138
  });
122
- const _hoisted_1 = { class: "nut-signature-inner" };
123
- const _hoisted_2 = /* @__PURE__ */ createTextVNode("\u91CD\u7B7E");
124
- const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u786E\u8BA4");
139
+ const _hoisted_1 = {
140
+ class: "nut-signature-inner",
141
+ ref: "wrap"
142
+ };
143
+ const _hoisted_2 = ["height", "width"];
144
+ const _hoisted_3 = {
145
+ key: 1,
146
+ class: "nut-signature-unsopport"
147
+ };
148
+ const _hoisted_4 = /* @__PURE__ */ createTextVNode("\u91CD\u7B7E");
149
+ const _hoisted_5 = /* @__PURE__ */ createTextVNode("\u786E\u8BA4");
125
150
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
126
151
  const _component_nut_button = resolveComponent("nut-button");
127
152
  return openBlock(), createElementBlock("div", {
128
153
  class: normalizeClass(_ctx.classes)
129
154
  }, [
130
155
  createElementVNode("div", _hoisted_1, [
131
- createElementVNode("canvas", {
132
- class: "spcanvas",
133
- id: "spcanvas",
134
- canvasId: "spcanvas",
135
- "canvas-id": "spcanvas",
136
- type: "2d",
137
- "disable-scroll": "true",
138
- onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.startEventHandler && _ctx.startEventHandler(...args)),
139
- onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.moveEventHandler && _ctx.moveEventHandler(...args)),
140
- onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.endEventHandler && _ctx.endEventHandler(...args)),
141
- onTouchleave: _cache[3] || (_cache[3] = (...args) => _ctx.leaveEventHandler && _ctx.leaveEventHandler(...args))
142
- }, null, 32)
143
- ]),
156
+ (() => _ctx.isCanvasSupported()) ? (openBlock(), createElementBlock("canvas", {
157
+ key: 0,
158
+ ref: "canvas",
159
+ height: _ctx.canvasHeight,
160
+ width: _ctx.canvasWidth
161
+ }, null, 8, _hoisted_2)) : (openBlock(), createElementBlock("p", _hoisted_3, _toDisplayString(_ctx.unSupportTpl), 1))
162
+ ], 512),
144
163
  createVNode(_component_nut_button, {
145
164
  class: "nut-signature-btn",
146
165
  type: "default",
147
- onClick: _cache[4] || (_cache[4] = ($event) => _ctx.clear())
166
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.clear())
148
167
  }, {
149
168
  default: withCtx(() => [
150
- _hoisted_2
169
+ _hoisted_4
151
170
  ]),
152
171
  _: 1
153
172
  }),
154
173
  createVNode(_component_nut_button, {
155
174
  class: "nut-signature-btn",
156
175
  type: "primary",
157
- onClick: _cache[5] || (_cache[5] = ($event) => _ctx.confirm())
176
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.confirm())
158
177
  }, {
159
178
  default: withCtx(() => [
160
- _hoisted_3
179
+ _hoisted_5
161
180
  ]),
162
181
  _: 1
163
182
  })
164
183
  ], 2);
165
184
  }
166
- var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
167
- export { index_taro as default };
185
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
186
+ export { index as default };
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.19-beta.4 Tue Apr 12 2022 17:39:20 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { c as createComponent } from "./component.js";
7
- import { toRefs, computed, onMounted, resolveComponent, openBlock, createElementBlock, renderSlot, createElementVNode, createBlock, normalizeClass, normalizeStyle, createCommentVNode, Fragment, renderList } from "vue";
7
+ import { toRefs, computed, onMounted, resolveComponent, openBlock, createElementBlock, renderSlot, createCommentVNode, createElementVNode, createBlock, normalizeClass, normalizeStyle, Fragment, renderList } from "vue";
8
8
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
9
  const component = {
10
10
  props: {
@@ -94,7 +94,10 @@ const _hoisted_2 = {
94
94
  key: 1,
95
95
  class: "skeleton"
96
96
  };
97
- const _hoisted_3 = /* @__PURE__ */ createElementVNode("view", { class: "skeleton-animation" }, null, -1);
97
+ const _hoisted_3 = {
98
+ key: 0,
99
+ class: "skeleton-animation"
100
+ };
98
101
  const _hoisted_4 = { class: "content" };
99
102
  const _hoisted_5 = { class: "content-line" };
100
103
  const _hoisted_6 = {
@@ -106,7 +109,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
106
109
  return !_ctx.loading ? (openBlock(), createElementBlock("view", _hoisted_1, [
107
110
  renderSlot(_ctx.$slots, "default")
108
111
  ])) : (openBlock(), createElementBlock("view", _hoisted_2, [
109
- _hoisted_3,
112
+ _ctx.animated ? (openBlock(), createElementBlock("view", _hoisted_3)) : createCommentVNode("", true),
110
113
  createElementVNode("view", _hoisted_4, [
111
114
  _ctx.avatar ? (openBlock(), createBlock(_component_nut_avatar, {
112
115
  key: 0,
@@ -122,9 +125,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
122
125
  }, null, 6)) : createCommentVNode("", true),
123
126
  createElementVNode("view", _hoisted_5, [
124
127
  _ctx.title ? (openBlock(), createElementBlock("view", _hoisted_6)) : createCommentVNode("", true),
125
- (openBlock(true), createElementBlock(Fragment, null, renderList(Number(_ctx.row), (item, index) => {
128
+ (openBlock(true), createElementBlock(Fragment, null, renderList(Number(_ctx.row), (item, index2) => {
126
129
  return openBlock(), createElementBlock("view", {
127
- key: index,
130
+ key: index2,
128
131
  class: normalizeClass(_ctx.blockClass),
129
132
  style: normalizeStyle({ width: _ctx.width, height: _ctx.height })
130
133
  }, null, 6);
@@ -133,5 +136,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
133
136
  ])
134
137
  ]));
135
138
  }
136
- var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
137
- export { index_taro as default };
139
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
140
+ export { index as default };