@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
@@ -18,22 +18,18 @@ 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
  */
25
25
  import { reactive, computed, onBeforeMount, watch, toRefs, resolveComponent, openBlock, createBlock } from "vue";
26
- import nutPicker from "./Picker.js";
27
- import { p as popupProps } from "./index4.js";
26
+ import picker from "./Picker.js";
27
+ import { popupProps } from "./Popup.js";
28
28
  import { c as createComponent } from "./component.js";
29
29
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
30
- import "./Popup.js";
31
- import "./use-lock-scroll.js";
32
30
  import "./OverLay.js";
33
31
  import "./Icon.js";
34
32
  import "./pxCheck.js";
35
- import "./index.js";
36
- import "@tarojs/taro";
37
33
  function padZero(num, targetLength = 2) {
38
34
  let str = num + "";
39
35
  while (str.length < targetLength) {
@@ -56,7 +52,7 @@ const zhCNType = {
56
52
  };
57
53
  const _sfc_main = create({
58
54
  components: {
59
- nutPicker
55
+ [picker.name]: picker
60
56
  },
61
57
  props: __spreadProps(__spreadValues({}, popupProps), {
62
58
  modelValue: null,
@@ -66,11 +62,11 @@ const _sfc_main = create({
66
62
  },
67
63
  okText: {
68
64
  type: String,
69
- default: "\u786E\u5B9A"
65
+ default: ""
70
66
  },
71
67
  cancelText: {
72
68
  type: String,
73
- default: "\u53D6\u6D88"
69
+ default: ""
74
70
  },
75
71
  type: {
76
72
  type: String,
@@ -123,12 +119,12 @@ const _sfc_main = create({
123
119
  const boundary = props[`${type}Date`];
124
120
  const year = boundary.getFullYear();
125
121
  let month = 1;
126
- let date = 1;
122
+ let day = 1;
127
123
  let hour = 0;
128
124
  let minute = 0;
129
125
  if (type === "max") {
130
126
  month = 12;
131
- date = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
127
+ day = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
132
128
  hour = 23;
133
129
  minute = 59;
134
130
  }
@@ -136,8 +132,8 @@ const _sfc_main = create({
136
132
  if (value.getFullYear() === year) {
137
133
  month = boundary.getMonth() + 1;
138
134
  if (value.getMonth() + 1 === month) {
139
- date = boundary.getDate();
140
- if (value.getDate() === date) {
135
+ day = boundary.getDate();
136
+ if (value.getDate() === day) {
141
137
  hour = boundary.getHours();
142
138
  if (value.getHours() === hour) {
143
139
  minute = boundary.getMinutes();
@@ -148,15 +144,15 @@ const _sfc_main = create({
148
144
  return {
149
145
  [`${type}Year`]: year,
150
146
  [`${type}Month`]: month,
151
- [`${type}Date`]: date,
147
+ [`${type}Day`]: day,
152
148
  [`${type}Hour`]: hour,
153
149
  [`${type}Minute`]: minute,
154
150
  [`${type}Seconds`]: seconds
155
151
  };
156
152
  };
157
153
  const ranges = computed(() => {
158
- const { maxYear, maxDate, maxMonth, maxHour, maxMinute, maxSeconds } = getBoundary("max", state.currentDate);
159
- const { minYear, minDate, minMonth, minHour, minMinute, minSeconds } = getBoundary("min", state.currentDate);
154
+ const { maxYear, maxDay, maxMonth, maxHour, maxMinute, maxSeconds } = getBoundary("max", state.currentDate);
155
+ const { minYear, minDay, minMonth, minHour, minMinute, minSeconds } = getBoundary("min", state.currentDate);
160
156
  let result = [
161
157
  {
162
158
  type: "year",
@@ -168,7 +164,7 @@ const _sfc_main = create({
168
164
  },
169
165
  {
170
166
  type: "day",
171
- range: [minDate, maxDate]
167
+ range: [minDay, maxDay]
172
168
  },
173
169
  {
174
170
  type: "hour",
@@ -193,6 +189,9 @@ const _sfc_main = create({
193
189
  case "time":
194
190
  result = result.slice(3, 6);
195
191
  break;
192
+ case "year-month":
193
+ result = result.slice(0, 2);
194
+ break;
196
195
  case "month-day":
197
196
  result = result.slice(1, 3);
198
197
  break;
@@ -238,7 +237,7 @@ const _sfc_main = create({
238
237
  };
239
238
  const generateValue = (min, max, val, type, columnIndex) => {
240
239
  const arr = [];
241
- let index = 0;
240
+ let index2 = 0;
242
241
  while (min <= max) {
243
242
  arr.push(formatterOption(type, min));
244
243
  if (type === "minute") {
@@ -247,10 +246,10 @@ const _sfc_main = create({
247
246
  min++;
248
247
  }
249
248
  if (min <= val) {
250
- index++;
249
+ index2++;
251
250
  }
252
251
  }
253
- state.selectedValue[columnIndex] = arr[index].value;
252
+ state.selectedValue[columnIndex] = arr[index2].value;
254
253
  return props.filter ? props.filter(type, arr) : arr;
255
254
  };
256
255
  const getDateIndex = (type) => {
@@ -312,5 +311,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
312
311
  isWrapTeleport: _ctx.isWrapTeleport
313
312
  }, null, 8, ["modelValue", "visible", "okText", "cancelText", "onClose", "columns", "onChange", "title", "onConfirm", "isWrapTeleport"]);
314
313
  }
315
- var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
316
- export { index_taro as default };
314
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
315
+ export { index as default };
@@ -17,21 +17,24 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __publicField = (obj, key, value) => {
21
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
+ return value;
23
+ };
20
24
  /*!
21
- * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
25
+ * @nutui/nutui v3.1.19-beta.4 Tue Apr 12 2022 17:39:20 GMT+0800 (中国标准时间)
22
26
  * (c) 2022 @jdf2e.
23
27
  * Released under the MIT License.
24
28
  */
25
- import { ref, onMounted, watch, computed, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, createElementBlock, renderSlot, Fragment, createTextVNode, toDisplayString, createCommentVNode, normalizeStyle } from "vue";
29
+ import { ref, onMounted, watch, computed, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, createElementBlock, renderSlot, Fragment, createTextVNode, toDisplayString, createCommentVNode, normalizeStyle, createVNode, render, h } from "vue";
26
30
  import { c as createComponent } from "./component.js";
27
31
  import Popup, { popupProps } from "./Popup.js";
28
32
  import Button from "./Button.js";
29
33
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
30
- import "./use-lock-scroll.js";
31
34
  import "./OverLay.js";
32
35
  import "./Icon.js";
33
36
  import "./pxCheck.js";
34
- const { componentName, create } = createComponent("dialog");
37
+ const { componentName, create, translate } = createComponent("dialog");
35
38
  const _sfc_main = create({
36
39
  inheritAttrs: false,
37
40
  components: {
@@ -65,11 +68,11 @@ const _sfc_main = create({
65
68
  },
66
69
  cancelText: {
67
70
  type: String,
68
- default: "\u53D6\u6D88"
71
+ default: ""
69
72
  },
70
73
  okText: {
71
74
  type: String,
72
- default: "\u786E\u5B9A"
75
+ default: ""
73
76
  },
74
77
  okBtnDisabled: {
75
78
  type: Boolean,
@@ -125,15 +128,16 @@ const _sfc_main = create({
125
128
  }
126
129
  };
127
130
  const onOk = () => {
128
- closed();
129
131
  emit("ok");
132
+ closed();
130
133
  };
131
134
  return {
132
135
  closed,
133
136
  classes,
134
137
  onCancel,
135
138
  onOk,
136
- showPopup
139
+ showPopup,
140
+ translate
137
141
  };
138
142
  }
139
143
  });
@@ -187,7 +191,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
187
191
  onClick: _ctx.onCancel
188
192
  }, {
189
193
  default: withCtx(() => [
190
- createTextVNode(toDisplayString(_ctx.cancelText), 1)
194
+ createTextVNode(toDisplayString(_ctx.cancelText || _ctx.translate("cancel")), 1)
191
195
  ]),
192
196
  _: 1
193
197
  }, 8, ["onClick"])) : createCommentVNode("", true),
@@ -200,7 +204,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
200
204
  onClick: _ctx.onOk
201
205
  }, {
202
206
  default: withCtx(() => [
203
- createTextVNode(toDisplayString(_ctx.okText), 1)
207
+ createTextVNode(toDisplayString(_ctx.okText || _ctx.translate("confirm")), 1)
204
208
  ]),
205
209
  _: 1
206
210
  }, 8, ["class", "disabled", "onClick"])) : createCommentVNode("", true)
@@ -211,5 +215,80 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
211
215
  _: 3
212
216
  }, 8, ["teleport", "visible", "close-on-click-overlay", "lock-scroll", "onClickOverlay", "onClickCloseIcon"]);
213
217
  }
214
- var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
215
- export { index_taro as default };
218
+ var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
219
+ class DialogOptions {
220
+ constructor() {
221
+ __publicField(this, "title", "");
222
+ __publicField(this, "content", "");
223
+ __publicField(this, "cancelText", "");
224
+ __publicField(this, "okText", "");
225
+ __publicField(this, "textAlign", "center");
226
+ __publicField(this, "teleport", "body");
227
+ __publicField(this, "id", new Date().getTime());
228
+ __publicField(this, "footerDirection", "horizontal");
229
+ __publicField(this, "onUpdate", (value) => {
230
+ });
231
+ __publicField(this, "onOk", () => {
232
+ });
233
+ __publicField(this, "onCancel", () => {
234
+ });
235
+ __publicField(this, "onClose", () => {
236
+ });
237
+ __publicField(this, "onClosed", () => {
238
+ });
239
+ __publicField(this, "visible", true);
240
+ __publicField(this, "noFooter", false);
241
+ __publicField(this, "noOkBtn", false);
242
+ __publicField(this, "noCancelBtn", false);
243
+ __publicField(this, "okBtnDisabled", false);
244
+ __publicField(this, "closeOnPopstate", false);
245
+ __publicField(this, "lockScroll", false);
246
+ }
247
+ }
248
+ class DialogFunction {
249
+ constructor(_options) {
250
+ __publicField(this, "options", new DialogOptions());
251
+ __publicField(this, "close", () => {
252
+ });
253
+ __publicField(this, "setDefaultOptions", (options) => {
254
+ });
255
+ __publicField(this, "resetDefaultOptions", () => {
256
+ });
257
+ let options = Object.assign(this.options, _options);
258
+ let elWarp = document.body;
259
+ let teleport = options.teleport;
260
+ if (teleport != "body") {
261
+ if (typeof teleport == "string") {
262
+ elWarp = document.querySelector(teleport);
263
+ } else {
264
+ elWarp = options.teleport;
265
+ }
266
+ }
267
+ const root = document.createElement("view");
268
+ root.id = "dialog-" + options.id;
269
+ const Wrapper = {
270
+ setup() {
271
+ options.onUpdate = (val) => {
272
+ if (val == false) {
273
+ elWarp.removeChild(root);
274
+ }
275
+ };
276
+ options.teleport = `#${root.id}`;
277
+ return () => {
278
+ return h(Dialog, options);
279
+ };
280
+ }
281
+ };
282
+ const instance = createVNode(Wrapper);
283
+ elWarp.appendChild(root);
284
+ render(instance, root);
285
+ }
286
+ }
287
+ const _Dialog = function(options) {
288
+ return new DialogFunction(options);
289
+ };
290
+ _Dialog.install = (app) => {
291
+ app.use(Dialog);
292
+ app.config.globalProperties.$dialog = _Dialog;
293
+ };
294
+ export { Dialog, DialogOptions, _Dialog 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
  */
@@ -39,11 +39,11 @@ const _sfc_main = create({
39
39
  }
40
40
  });
41
41
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
42
- return openBlock(), createElementBlock("view", {
42
+ return openBlock(), createElementBlock("div", {
43
43
  class: normalizeClass(_ctx.classes)
44
44
  }, [
45
45
  renderSlot(_ctx.$slots, "default")
46
46
  ], 2);
47
47
  }
48
- var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
49
- export { index_taro as default };
48
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
49
+ export { index as default };
@@ -1,25 +1,12 @@
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, reactive, computed, onMounted, onActivated, onDeactivated, openBlock, createElementBlock, normalizeClass, withModifiers, normalizeStyle, renderSlot } from "vue";
6
+ import { ref, reactive, computed, onMounted, onActivated, onDeactivated, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import Taro, { eventCenter, getCurrentInstance } from "@tarojs/taro";
8
+ import { r as requestAniFrame } from "./raf.js";
9
9
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
- const _window = window;
11
- function requestAniFrame() {
12
- if (typeof _window !== "undefined") {
13
- return _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function(callback) {
14
- _window.setTimeout(callback, 1e3 / 60);
15
- };
16
- } else {
17
- return function(callback) {
18
- setTimeout(callback, 1e3 / 60);
19
- };
20
- }
21
- }
22
- var requestAniFrame$1 = requestAniFrame();
23
10
  const { componentName, create } = createComponent("drag");
24
11
  const _sfc_main = create({
25
12
  props: {
@@ -53,13 +40,10 @@ const _sfc_main = create({
53
40
  screenHeight: 0,
54
41
  startTop: 0,
55
42
  startLeft: 0,
56
- initTop: 0,
57
43
  nx: 0,
58
44
  ny: 0,
59
45
  xPum: 0,
60
46
  yPum: 0,
61
- top: 0,
62
- left: 0,
63
47
  position: { x: 0, y: 0 },
64
48
  boundary: {
65
49
  top: 0,
@@ -69,57 +53,54 @@ const _sfc_main = create({
69
53
  }
70
54
  });
71
55
  const classes = computed(() => {
72
- const prefixCls = "nut-taro-drag";
56
+ const prefixCls = componentName;
73
57
  return {
74
58
  [prefixCls]: true
75
59
  };
76
60
  });
77
- const domElem = Taro.getSystemInfoSync();
78
61
  function getInfo() {
79
- const query = Taro.createSelectorQuery();
80
- query.select(".myDrag").boundingClientRect((rec) => {
81
- state.elWidth = rec.width;
82
- state.elHeight = rec.height;
83
- state.initTop = rec.top;
84
- }).exec();
85
- state.screenWidth = domElem.screenWidth;
86
- state.screenHeight = domElem.screenHeight;
62
+ const domElem = document.documentElement;
63
+ state.elWidth = myDrag.value.offsetWidth;
64
+ state.elHeight = myDrag.value.offsetHeight;
65
+ state.screenWidth = domElem.clientWidth || 375;
66
+ state.screenHeight = domElem.clientHeight || 667;
87
67
  }
88
- function goLeft() {
68
+ function goLeft(target) {
89
69
  if (state.boundary.left) {
90
- if (+state.left.split("px")[0] > state.boundary.left) {
91
- state.left = +state.left.split("px")[0] - 10 + "px";
92
- requestAniFrame$1(() => {
93
- goLeft();
70
+ if (+target.style.left.split("px")[0] > state.boundary.left) {
71
+ target.style.left = +target.style.left.split("px")[0] - 10 + "px";
72
+ requestAniFrame(() => {
73
+ goLeft(target);
94
74
  });
95
75
  } else {
96
- state.left = `${state.boundary.left}px`;
76
+ target.style.left = `${state.boundary.left}px`;
97
77
  }
98
78
  } else {
99
- if (+state.left.split("px")[0] > 10) {
100
- state.left = +state.left.split("px")[0] - 10 + "px";
101
- requestAniFrame$1(() => {
102
- goLeft();
79
+ if (+target.style.left.split("px")[0] > 10) {
80
+ target.style.left = +target.style.left.split("px")[0] - 10 + "px";
81
+ requestAniFrame(() => {
82
+ goLeft(target);
103
83
  });
104
84
  } else {
105
- state.left = "0px";
85
+ target.style.left = "0px";
106
86
  }
107
87
  }
108
88
  }
109
- function goRight(rightLocation) {
110
- if (rightLocation - parseInt(state.left.split("px")[0]) > 10) {
111
- state.left = parseInt(state.left.split("px")[0]) + 10 + "px";
112
- requestAniFrame$1(() => {
113
- goRight(rightLocation);
89
+ function goRight(target, rightLocation) {
90
+ if (rightLocation - parseInt(target.style.left.split("px")[0]) > 10) {
91
+ target.style.left = parseInt(target.style.left.split("px")[0]) + 10 + "px";
92
+ requestAniFrame(() => {
93
+ goRight(target, rightLocation);
114
94
  });
115
95
  } else {
116
- state.left = rightLocation + "px";
96
+ target.style.left = rightLocation + "px";
117
97
  }
118
98
  }
119
99
  function touchMove(e) {
120
100
  e.preventDefault();
121
- if (e.touches.length === 1) {
122
- const touch = e.touches[0];
101
+ const target = e.currentTarget;
102
+ if (e.targetTouches.length === 1) {
103
+ const touch = e.targetTouches[0];
123
104
  state.nx = touch.clientX - state.position.x;
124
105
  state.ny = touch.clientY - state.position.y;
125
106
  state.xPum = state.startLeft + state.nx;
@@ -136,14 +117,15 @@ const _sfc_main = create({
136
117
  state.yPum = state.screenHeight - state.elHeight - state.boundary.bottom;
137
118
  }
138
119
  if (props.direction != "y") {
139
- state.left = state.xPum;
120
+ target.style.left = state.xPum + "px";
140
121
  }
141
122
  if (props.direction != "x") {
142
- state.top = state.yPum;
123
+ target.style.top = state.yPum + "px";
143
124
  }
144
125
  }
145
126
  }
146
127
  function touchEnd(e) {
128
+ const target = e.currentTarget;
147
129
  const touch = e.changedTouches[0];
148
130
  let currX = touch.clientX;
149
131
  const rightLocation = state.screenWidth - state.elWidth - state.boundary.right;
@@ -156,48 +138,34 @@ const _sfc_main = create({
156
138
  }
157
139
  if (props.direction != "y" && props.attract) {
158
140
  if (currX < state.screenWidth / 2) {
159
- requestAniFrame$1(() => {
160
- goLeft();
141
+ requestAniFrame(() => {
142
+ goLeft(target);
161
143
  });
162
144
  } else {
163
- requestAniFrame$1(() => {
164
- goRight(rightLocation);
145
+ requestAniFrame(() => {
146
+ goRight(target, rightLocation);
165
147
  });
166
148
  }
167
149
  }
168
- if (props.direction !== "x") {
169
- state.top = state.yPum;
150
+ if (props.direction != "x") {
151
+ target.style.top = state.yPum + "px";
170
152
  }
171
153
  }
172
154
  function touchStart(e) {
173
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
174
- const query = Taro.createSelectorQuery();
175
- let id = (_a = e == null ? void 0 : e.mpEvent) == null ? void 0 : _a.currentTarget.id;
176
- let offsetTop = (_b = e == null ? void 0 : e.currentTarget) == null ? void 0 : _b.offsetTop;
177
- let offsetLeft = (_c = e == null ? void 0 : e.currentTarget) == null ? void 0 : _c.offsetLeft;
155
+ const target = e.currentTarget;
178
156
  const touches = e.touches[0];
179
- const mobileTop = (_f = (_e = (_d = e.touches[0]) == null ? void 0 : _d.target) == null ? void 0 : _e.parentNode) == null ? void 0 : _f.style.top;
180
- const mobileLeft = (_i = (_h = (_g = e.touches[0]) == null ? void 0 : _g.target) == null ? void 0 : _h.parentNode) == null ? void 0 : _i.style.left;
181
- query.selectAll(".myDrag").boundingClientRect((rec) => {
182
- rec.forEach((element) => {
183
- if (id && id == element.id) {
184
- state.startTop = element.top - offsetTop;
185
- state.startLeft = element.left - offsetLeft;
186
- } else if (mobileTop) {
187
- state.startTop = Number(mobileTop.slice(0, -2));
188
- state.startLeft = Number(mobileLeft.slice(0, -2));
189
- }
190
- });
191
- }).exec();
157
+ const touch = e.targetTouches[0];
158
+ state.startTop = target.offsetTop;
159
+ state.startLeft = target.offsetLeft;
192
160
  state.position.x = touches.clientX;
193
161
  state.position.y = touches.clientY;
162
+ state.nx = touch.clientX - state.position.x;
163
+ state.ny = touch.clientY - state.position.y;
164
+ state.xPum = state.startLeft + state.nx;
165
+ state.yPum = state.startTop + state.ny;
194
166
  }
195
167
  onMounted(() => {
196
- setTimeout(() => {
197
- getInfo();
198
- }, 200);
199
- eventCenter.once(getCurrentInstance().router.onReady, () => {
200
- });
168
+ getInfo();
201
169
  state.boundary = props.boundary;
202
170
  });
203
171
  onActivated(() => {
@@ -216,26 +184,20 @@ const _sfc_main = create({
216
184
  myDrag,
217
185
  touchStart,
218
186
  touchMove,
219
- touchEnd,
220
- state
187
+ touchEnd
221
188
  };
222
189
  }
223
190
  });
224
191
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
225
192
  return openBlock(), createElementBlock("view", {
226
- class: normalizeClass([_ctx.classes, "myDrag"]),
193
+ class: normalizeClass(_ctx.classes),
227
194
  ref: "myDrag",
228
195
  onTouchstart: _cache[0] || (_cache[0] = ($event) => _ctx.touchStart($event)),
229
- onTouchmove: _cache[1] || (_cache[1] = withModifiers(($event) => _ctx.touchMove($event), ["prevent"])),
230
- catchtouchmove: "true",
231
- style: normalizeStyle({
232
- transform: ` translate(${_ctx.state.left + "px"}, ${_ctx.state.top + "px"})`,
233
- top: _ctx.state.top + "px",
234
- left: _ctx.state.left + "px"
235
- })
196
+ onTouchmove: _cache[1] || (_cache[1] = ($event) => _ctx.touchMove($event)),
197
+ onTouchend: _cache[2] || (_cache[2] = ($event) => _ctx.touchEnd($event))
236
198
  }, [
237
199
  renderSlot(_ctx.$slots, "default")
238
- ], 38);
200
+ ], 34);
239
201
  }
240
- var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
241
- export { index_taro as default };
202
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
203
+ export { index as default };