@nutui/nutui 4.0.0 → 4.0.1-2.beta-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 (285) hide show
  1. package/CHANGELOG.md +226 -0
  2. package/README.md +34 -65
  3. package/dist/nutui.es.js +10 -17
  4. package/dist/nutui.js +16202 -0
  5. package/dist/nutui.umd.js +1 -7
  6. package/dist/packages/_es/ActionSheet.js +79 -94
  7. package/dist/packages/_es/Address.js +260 -345
  8. package/dist/packages/_es/AddressList.js +269 -354
  9. package/dist/packages/_es/Animate.js +46 -38
  10. package/dist/packages/_es/Audio.js +128 -180
  11. package/dist/packages/_es/AudioOperate.js +60 -52
  12. package/dist/packages/_es/Avatar.js +67 -75
  13. package/dist/packages/_es/AvatarGroup.js +23 -31
  14. package/dist/packages/_es/Backtop.js +59 -99
  15. package/dist/packages/_es/Badge.js +39 -46
  16. package/dist/packages/_es/Barrage.js +68 -145
  17. package/dist/packages/_es/Button.js +47 -66
  18. package/dist/packages/_es/Calendar.js +135 -152
  19. package/dist/packages/_es/CalendarItem.js +6 -6
  20. package/dist/packages/_es/Card.js +42 -56
  21. package/dist/packages/_es/Cascader.js +323 -433
  22. package/dist/packages/_es/Category.js +29 -39
  23. package/dist/packages/_es/CategoryPane.js +57 -83
  24. package/dist/packages/_es/Cell.js +56 -71
  25. package/dist/packages/_es/CellGroup.js +19 -27
  26. package/dist/packages/_es/Checkbox.js +109 -138
  27. package/dist/packages/_es/CheckboxGroup.js +38 -61
  28. package/dist/packages/_es/CircleProgress.js +67 -96
  29. package/dist/packages/_es/Col.js +23 -31
  30. package/dist/packages/_es/Collapse.js +37 -67
  31. package/dist/packages/_es/CollapseItem.js +91 -184
  32. package/dist/packages/_es/Comment.js +207 -279
  33. package/dist/packages/_es/ConfigProvider.js +38 -56
  34. package/dist/packages/_es/Countdown.js +100 -194
  35. package/dist/packages/_es/Countup.js +232 -428
  36. package/dist/packages/_es/DatePicker.js +169 -245
  37. package/dist/packages/_es/Dialog.js +163 -188
  38. package/dist/packages/_es/Divider.js +42 -40
  39. package/dist/packages/_es/Drag.js +70 -153
  40. package/dist/packages/_es/Ecard.js +64 -104
  41. package/dist/packages/_es/Elevator.js +144 -201
  42. package/dist/packages/_es/Ellipsis.js +95 -159
  43. package/dist/packages/_es/Empty.js +23 -39
  44. package/dist/packages/_es/FixedNav.js +93 -116
  45. package/dist/packages/_es/Form.js +108 -164
  46. package/dist/packages/_es/FormItem.js +48 -61
  47. package/dist/packages/_es/Grid.js +5 -6
  48. package/dist/packages/_es/GridItem.js +58 -84
  49. package/dist/packages/_es/Image.js +98 -88
  50. package/dist/packages/_es/ImagePreview.js +262 -392
  51. package/dist/packages/_es/Indicator.js +30 -34
  52. package/dist/packages/_es/InfiniteLoading.js +83 -117
  53. package/dist/packages/_es/Input.js +176 -223
  54. package/dist/packages/_es/InputNumber.js +81 -117
  55. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  56. package/dist/packages/_es/Invoice.js +105 -113
  57. package/dist/packages/_es/Layout.js +3 -4
  58. package/dist/packages/_es/List.js +147 -89
  59. package/dist/packages/_es/Menu.js +96 -152
  60. package/dist/packages/_es/MenuItem.js +117 -153
  61. package/dist/packages/_es/Navbar.js +103 -119
  62. package/dist/packages/_es/Noticebar.js +207 -273
  63. package/dist/packages/_es/Notify.js +110 -147
  64. package/dist/packages/_es/NumberKeyboard.js +127 -202
  65. package/dist/packages/_es/Overlay.js +53 -66
  66. package/dist/packages/_es/Pagination.js +70 -100
  67. package/dist/packages/_es/Picker.js +276 -425
  68. package/dist/packages/_es/Popover.js +122 -225
  69. package/dist/packages/_es/Popup.js +4 -4
  70. package/dist/packages/_es/Price.js +47 -80
  71. package/dist/packages/_es/Progress.js +63 -79
  72. package/dist/packages/_es/PullRefresh.js +96 -157
  73. package/dist/packages/_es/Radio.js +4 -4
  74. package/dist/packages/_es/RadioGroup.js +3 -3
  75. package/dist/packages/_es/Range.js +205 -329
  76. package/dist/packages/_es/Rate.js +93 -122
  77. package/dist/packages/_es/Row.js +21 -27
  78. package/dist/packages/_es/Searchbar.js +130 -160
  79. package/dist/packages/_es/ShortPassword.js +69 -93
  80. package/dist/packages/_es/SideNavbar.js +49 -59
  81. package/dist/packages/_es/SideNavbarItem.js +22 -32
  82. package/dist/packages/_es/Signature.js +83 -128
  83. package/dist/packages/_es/Skeleton.js +110 -130
  84. package/dist/packages/_es/Sku.js +251 -326
  85. package/dist/packages/_es/Step.js +60 -69
  86. package/dist/packages/_es/Steps.js +26 -31
  87. package/dist/packages/_es/Sticky.js +4 -4
  88. package/dist/packages/_es/SubSideNavbar.js +52 -56
  89. package/dist/packages/_es/Swipe.js +84 -137
  90. package/dist/packages/_es/Swiper.js +175 -310
  91. package/dist/packages/_es/SwiperItem.js +28 -44
  92. package/dist/packages/_es/Switch.js +55 -67
  93. package/dist/packages/_es/TabPane.js +32 -20
  94. package/dist/packages/_es/Tabbar.js +41 -52
  95. package/dist/packages/_es/TabbarItem.js +61 -81
  96. package/dist/packages/_es/Table.js +110 -148
  97. package/dist/packages/_es/Tabs.js +284 -205
  98. package/dist/packages/_es/Tag.js +44 -61
  99. package/dist/packages/_es/Textarea.js +80 -124
  100. package/dist/packages/_es/TimeDetail.js +49 -57
  101. package/dist/packages/_es/TimePannel.js +35 -31
  102. package/dist/packages/_es/TimeSelect.js +47 -68
  103. package/dist/packages/_es/Toast.js +150 -203
  104. package/dist/packages/_es/Tour.js +139 -175
  105. package/dist/packages/_es/TrendArrow.js +57 -58
  106. package/dist/packages/_es/Uploader.js +235 -359
  107. package/dist/packages/_es/Video.js +191 -298
  108. package/dist/packages/_es/Watermark.js +84 -98
  109. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  110. package/dist/packages/_es/common-d218746f.js +116 -0
  111. package/dist/packages/_es/component-234624bc.js +89 -0
  112. package/dist/packages/_es/index-14dfadc4.js +561 -0
  113. package/dist/packages/_es/index-192a3ef6.js +29 -0
  114. package/dist/packages/_es/index-360c5092.js +210 -0
  115. package/dist/packages/_es/index-496e6e05.js +24 -0
  116. package/dist/packages/_es/index-50eed3d9.js +7 -0
  117. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  118. package/dist/packages/_es/index-fadb0974.js +8 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  121. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  122. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  123. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  124. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  125. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  126. package/dist/packages/actionsheet/index.scss +2 -0
  127. package/dist/packages/actionsheet/style.mjs +0 -2
  128. package/dist/packages/address/index.scss +5 -2
  129. package/dist/packages/address/style.mjs +0 -3
  130. package/dist/packages/addresslist/index.scss +3 -0
  131. package/dist/packages/addresslist/style.mjs +0 -2
  132. package/dist/packages/audio/index.scss +2 -0
  133. package/dist/packages/audio/style.mjs +0 -1
  134. package/dist/packages/audiooperate/index.scss +2 -0
  135. package/dist/packages/audiooperate/style.mjs +0 -1
  136. package/dist/packages/badge/index.scss +3 -0
  137. package/dist/packages/button/index.scss +1 -1
  138. package/dist/packages/calendar/index.scss +3 -0
  139. package/dist/packages/calendar/style.mjs +0 -3
  140. package/dist/packages/card/index.scss +3 -0
  141. package/dist/packages/card/style.mjs +0 -2
  142. package/dist/packages/cascader/index.scss +4 -0
  143. package/dist/packages/cascader/style.mjs +0 -5
  144. package/dist/packages/cellgroup/index.scss +1 -1
  145. package/dist/packages/checkbox/index.scss +41 -0
  146. package/dist/packages/col/index.scss +2 -2
  147. package/dist/packages/comment/index.scss +2 -0
  148. package/dist/packages/comment/style.mjs +0 -1
  149. package/dist/packages/datepicker/index.scss +1 -2
  150. package/dist/packages/datepicker/style.mjs +0 -3
  151. package/dist/packages/dialog/index.scss +11 -0
  152. package/dist/packages/dialog/style.mjs +0 -3
  153. package/dist/packages/ecard/index.scss +2 -0
  154. package/dist/packages/ecard/style.mjs +0 -1
  155. package/dist/packages/fixednav/index.scss +2 -0
  156. package/dist/packages/fixednav/style.mjs +0 -1
  157. package/dist/packages/form/index.scss +1 -2
  158. package/dist/packages/form/style.mjs +0 -1
  159. package/dist/packages/formitem/index.scss +3 -0
  160. package/dist/packages/formitem/style.mjs +0 -1
  161. package/dist/packages/imagepreview/index.scss +5 -5
  162. package/dist/packages/imagepreview/style.mjs +0 -5
  163. package/dist/packages/input/index.scss +13 -13
  164. package/dist/packages/invoice/index.scss +6 -0
  165. package/dist/packages/invoice/style.mjs +0 -7
  166. package/dist/packages/list/index.scss +8 -8
  167. package/dist/packages/menuitem/index.scss +9 -10
  168. package/dist/packages/menuitem/style.mjs +0 -2
  169. package/dist/packages/navbar/index.scss +0 -1
  170. package/dist/packages/noticebar/index.scss +12 -2
  171. package/dist/packages/notify/index.scss +2 -0
  172. package/dist/packages/notify/style.mjs +0 -2
  173. package/dist/packages/numberkeyboard/index.scss +2 -0
  174. package/dist/packages/numberkeyboard/style.mjs +0 -2
  175. package/dist/packages/picker/index.scss +4 -9
  176. package/dist/packages/picker/style.mjs +0 -2
  177. package/dist/packages/popover/index.scss +2 -0
  178. package/dist/packages/popover/style.mjs +0 -2
  179. package/dist/packages/popup/index.scss +2 -0
  180. package/dist/packages/popup/style.mjs +0 -1
  181. package/dist/packages/price/index.scss +5 -10
  182. package/dist/packages/rate/index.scss +6 -9
  183. package/dist/packages/searchbar/index.scss +4 -0
  184. package/dist/packages/shortpassword/index.scss +18 -0
  185. package/dist/packages/shortpassword/style.mjs +0 -2
  186. package/dist/packages/signature/index.scss +2 -0
  187. package/dist/packages/signature/style.mjs +0 -1
  188. package/dist/packages/skeleton/index.scss +2 -0
  189. package/dist/packages/skeleton/style.mjs +0 -1
  190. package/dist/packages/sku/index.scss +4 -0
  191. package/dist/packages/sku/style.mjs +0 -4
  192. package/dist/packages/tabbaritem/index.scss +2 -0
  193. package/dist/packages/tabbaritem/style.mjs +0 -1
  194. package/dist/packages/tabs/index.scss +36 -2
  195. package/dist/packages/tabs/style.mjs +0 -1
  196. package/dist/packages/textarea/index.scss +2 -0
  197. package/dist/packages/timeselect/index.scss +2 -0
  198. package/dist/packages/timeselect/style.mjs +0 -2
  199. package/dist/packages/tour/index.scss +2 -0
  200. package/dist/packages/tour/style.mjs +0 -3
  201. package/dist/packages/uploader/index.scss +10 -2
  202. package/dist/packages/uploader/style.mjs +0 -2
  203. package/dist/resolver/index.d.ts +6 -0
  204. package/dist/resolver/index.js +1 -0
  205. package/dist/resolver/index.mjs +24 -0
  206. package/dist/resolver/package.json +20 -0
  207. package/dist/smartips/web-types.json +114 -15
  208. package/dist/style.css +1 -1
  209. package/dist/styles/themes/default.scss +155 -52
  210. package/dist/styles/themes/jdb.scss +155 -52
  211. package/dist/styles/themes/jddkh.scss +155 -52
  212. package/dist/styles/themes/jdt.scss +155 -52
  213. package/dist/styles/variables-jdb.scss +9 -1
  214. package/dist/styles/variables-jddkh.scss +9 -1
  215. package/dist/styles/variables-jdt.scss +9 -1
  216. package/dist/styles/variables.scss +8 -0
  217. package/dist/types/__VUE/address/index.vue.d.ts +2 -1
  218. package/dist/types/__VUE/addresslist/components/GeneralShell.vue.d.ts +1 -1
  219. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -1
  220. package/dist/types/__VUE/addresslist/index.vue.d.ts +1 -1
  221. package/dist/types/__VUE/animate/index.vue.d.ts +6 -0
  222. package/dist/types/__VUE/audiooperate/index.vue.d.ts +4 -4
  223. package/dist/types/__VUE/badge/index.vue.d.ts +9 -0
  224. package/dist/types/__VUE/button/type.d.ts +1 -0
  225. package/dist/types/__VUE/calendaritem/type.d.ts +1 -0
  226. package/dist/types/__VUE/collapse/index.vue.d.ts +31 -5
  227. package/dist/types/__VUE/collapseitem/index.vue.d.ts +117 -11
  228. package/dist/types/__VUE/configprovider/index.vue.d.ts +2 -2
  229. package/dist/types/__VUE/datepicker/index.vue.d.ts +1 -1
  230. package/dist/types/__VUE/dialog/index.d.ts +1 -0
  231. package/dist/types/__VUE/dialog/index.vue.d.ts +1 -0
  232. package/dist/types/__VUE/grid/index.vue.d.ts +1 -1
  233. package/dist/types/__VUE/image/index.vue.d.ts +14 -3
  234. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +9 -0
  235. package/dist/types/__VUE/imagepreview/index.vue.d.ts +1 -1
  236. package/dist/types/__VUE/input/index.vue.d.ts +27 -2
  237. package/dist/types/__VUE/list/index.vue.d.ts +42 -13
  238. package/dist/types/__VUE/list/type.d.ts +13 -0
  239. package/dist/types/__VUE/menu/index.vue.d.ts +0 -2
  240. package/dist/types/__VUE/menuitem/index.vue.d.ts +9 -17
  241. package/dist/types/__VUE/navbar/index.vue.d.ts +1 -1
  242. package/dist/types/__VUE/noticebar/index.vue.d.ts +5 -2
  243. package/dist/types/__VUE/picker/common.d.ts +2 -0
  244. package/dist/types/__VUE/picker/usePicker.d.ts +1 -1
  245. package/dist/types/__VUE/price/index.vue.d.ts +9 -0
  246. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  247. package/dist/types/__VUE/row/index.vue.d.ts +1 -1
  248. package/dist/types/__VUE/searchbar/index.vue.d.ts +121 -5
  249. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  250. package/dist/types/__VUE/swiper/index.vue.d.ts +9 -2
  251. package/dist/types/__VUE/switch/index.vue.d.ts +1 -0
  252. package/dist/types/__VUE/table/common.d.ts +55 -2
  253. package/dist/types/__VUE/tabpane/index.vue.d.ts +1 -4
  254. package/dist/types/__VUE/tabs/hooks.d.ts +12 -0
  255. package/dist/types/__VUE/tabs/index.vue.d.ts +35 -5
  256. package/dist/types/__VUE/tabs/types.d.ts +12 -0
  257. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  258. package/dist/types/__VUE/toast/index.vue.d.ts +11 -4
  259. package/dist/types/__VUE/uploader/type.d.ts +2 -1
  260. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  261. package/dist/types/index.d.ts +1 -2
  262. package/dist/types/resolver/index.d.ts +6 -0
  263. package/dist/types/utils/date.d.ts +4 -0
  264. package/dist/types/utils/useTaroRect/index.d.ts +1 -1
  265. package/dist/types/utils/util.d.ts +1 -1
  266. package/package.json +13 -6
  267. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  268. package/dist/packages/_es/common-b9a5e726.js +0 -145
  269. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  270. package/dist/packages/_es/index-29892cda.js +0 -33
  271. package/dist/packages/_es/index-2ae3ae87.js +0 -846
  272. package/dist/packages/_es/index-43c34ac6.js +0 -30
  273. package/dist/packages/_es/index-54d03fc1.js +0 -8
  274. package/dist/packages/_es/index-79c5dc33.js +0 -10
  275. package/dist/packages/_es/index-7a7385e4.js +0 -67
  276. package/dist/packages/_es/index-991c279f.js +0 -244
  277. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  278. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  279. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  280. package/dist/packages/_es/interceptor-956b24fc.js +0 -29
  281. package/dist/packages/_es/mountComponent-1ece4110.js +0 -39
  282. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  283. package/dist/packages/_es/raf-729dad54.js +0 -25
  284. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
  285. /package/dist/types/utils/{interceptor.d.ts → Interceptor.d.ts} +0 -0
@@ -1,9 +1,20 @@
1
- import { ref, reactive, computed, onMounted, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot } from "vue";
2
- import { c as createComponent } from "./component-81a4c1d0.js";
3
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ var v = Object.defineProperty, h = Object.defineProperties;
2
+ var b = Object.getOwnPropertyDescriptors;
3
+ var u = Object.getOwnPropertySymbols;
4
+ var N = Object.prototype.hasOwnProperty, g = Object.prototype.propertyIsEnumerable;
5
+ var f = (s, t, e) => t in s ? v(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e, p = (s, t) => {
6
+ for (var e in t || (t = {}))
7
+ N.call(t, e) && f(s, e, t[e]);
8
+ if (u)
9
+ for (var e of u(t))
10
+ g.call(t, e) && f(s, e, t[e]);
11
+ return s;
12
+ }, m = (s, t) => h(s, b(t));
13
+ import { ref as x, reactive as y, computed as $, onMounted as w, toRefs as C, openBlock as S, createElementBlock as k, normalizeClass as A, createElementVNode as _, renderSlot as B } from "vue";
14
+ import { c as E } from "./component-234624bc.js";
15
+ import { _ as L } from "./_plugin-vue_export-helper-dad06003.js";
4
16
  import "../locale/lang";
5
- const { componentName, create } = createComponent("side-navbar");
6
- const _sfc_main = create({
17
+ const { componentName: M, create: z } = E("side-navbar"), D = z({
7
18
  props: {
8
19
  offset: {
9
20
  type: [String, Number],
@@ -11,74 +22,53 @@ const _sfc_main = create({
11
22
  }
12
23
  },
13
24
  emits: [],
14
- setup: (props) => {
15
- const list = ref(null);
16
- const state = reactive({
25
+ setup: (s) => {
26
+ const t = x(null), e = y({
17
27
  count: 1,
18
28
  observer: null
19
- });
20
- const classes = computed(() => {
21
- const prefixCls = componentName;
22
- return {
23
- [prefixCls]: true
24
- };
25
- });
26
- const setPaddingLeft = (nodeList, level = 1) => {
27
- for (let i = 0; i < nodeList.length; i++) {
28
- let item = nodeList[i];
29
- item.children[0].style.paddingLeft = +props.offset * level + "px";
30
- if (!item.className.includes("nut-side-navbar-item")) {
31
- setPaddingLeft(Array.from(item.children[1].children), ++state.count);
32
- }
33
- }
34
- state.count--;
35
- };
36
- const handleSlots = () => {
37
- let childNodes = list.value.childNodes;
38
- if (childNodes.length) {
39
- childNodes = Array.from(childNodes).filter((item) => item.nodeType !== 3).map((item) => {
40
- return item;
41
- });
42
- setPaddingLeft(childNodes);
29
+ }), i = $(() => ({
30
+ [M]: !0
31
+ })), a = (r, o = 1) => {
32
+ var d;
33
+ for (let l = 0; l < r.length; l++) {
34
+ let n = r[l];
35
+ (d = n == null ? void 0 : n.children) != null && d[0] && (n.children[0].style.paddingLeft = +s.offset * o + "px", n.className.includes("nut-side-navbar-item") || a(Array.from(n.children[1].children), ++e.count));
43
36
  }
37
+ e.count--;
38
+ }, c = () => {
39
+ let r = t.value.childNodes;
40
+ r.length && (r = Array.from(r).filter((o) => o.nodeType !== 3).map((o) => o), a(r));
44
41
  };
45
- onMounted(() => {
46
- handleSlots();
47
- state.observer = new MutationObserver(function() {
48
- state.count = 1;
49
- handleSlots();
50
- });
51
- state.observer.observe(list.value, {
52
- attributes: false,
53
- childList: true,
54
- characterData: false,
55
- subtree: false
42
+ return w(() => {
43
+ c(), e.observer = new MutationObserver(function() {
44
+ e.count = 1, c();
45
+ }), e.observer.observe(t.value, {
46
+ attributes: !1,
47
+ childList: !0,
48
+ characterData: !1,
49
+ subtree: !0
56
50
  });
51
+ }), m(p({}, C(e)), {
52
+ list: t,
53
+ classes: i
57
54
  });
58
- return {
59
- ...toRefs(state),
60
- list,
61
- classes
62
- };
63
55
  }
64
- });
65
- const _hoisted_1 = { class: "nut-side-navbar__content" };
66
- const _hoisted_2 = {
56
+ }), O = { class: "nut-side-navbar__content" }, P = {
67
57
  class: "nut-side-navbar__content__list",
68
58
  ref: "list"
69
59
  };
70
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
71
- return openBlock(), createElementBlock("view", {
72
- class: normalizeClass(_ctx.classes)
60
+ function R(s, t, e, i, a, c) {
61
+ return S(), k("view", {
62
+ class: A(s.classes)
73
63
  }, [
74
- createElementVNode("view", _hoisted_1, [
75
- createElementVNode("view", _hoisted_2, [
76
- renderSlot(_ctx.$slots, "default")
64
+ _("view", O, [
65
+ _("view", P, [
66
+ B(s.$slots, "default")
77
67
  ], 512)
78
68
  ])
79
69
  ], 2);
80
70
  }
81
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
71
+ const G = /* @__PURE__ */ L(D, [["render", R]]);
82
72
  export {
83
- index as default
73
+ G as default
84
74
  };
@@ -1,9 +1,8 @@
1
- import { computed, openBlock, createElementBlock, normalizeClass, withModifiers, createElementVNode, toDisplayString } from "vue";
2
- import { c as createComponent } from "./component-81a4c1d0.js";
3
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ import { computed as r, openBlock as l, createElementBlock as a, normalizeClass as c, withModifiers as p, createElementVNode as m, toDisplayString as d } from "vue";
2
+ import { c as f } from "./component-234624bc.js";
3
+ import { _ as k } from "./_plugin-vue_export-helper-dad06003.js";
4
4
  import "../locale/lang";
5
- const { componentName, create } = createComponent("side-navbar-item");
6
- const _sfc_main = create({
5
+ const { componentName: u, create: C } = f("side-navbar-item"), _ = C({
7
6
  props: {
8
7
  title: {
9
8
  type: String,
@@ -15,34 +14,25 @@ const _sfc_main = create({
15
14
  }
16
15
  },
17
16
  emits: ["click"],
18
- setup: (props, context) => {
19
- const classes = computed(() => {
20
- const prefixCls = componentName;
21
- return {
22
- [prefixCls]: true
23
- };
24
- });
25
- const handleClick = () => {
26
- context.emit("click");
27
- };
28
- return {
29
- classes,
30
- handleClick
31
- };
32
- }
33
- });
34
- const _hoisted_1 = ["ikey"];
35
- const _hoisted_2 = { class: "nut-side-navbar-item__title" };
36
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
37
- return openBlock(), createElementBlock("view", {
38
- class: normalizeClass(_ctx.classes),
39
- onClick: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"])),
40
- ikey: _ctx.ikey
17
+ setup: (e, t) => ({
18
+ classes: r(() => ({
19
+ [u]: !0
20
+ })),
21
+ handleClick: () => {
22
+ t.emit("click");
23
+ }
24
+ })
25
+ }), y = ["ikey"], h = { class: "nut-side-navbar-item__title" };
26
+ function $(e, t, s, i, o, g) {
27
+ return l(), a("view", {
28
+ class: c(e.classes),
29
+ onClick: t[0] || (t[0] = p((...n) => e.handleClick && e.handleClick(...n), ["stop"])),
30
+ ikey: e.ikey
41
31
  }, [
42
- createElementVNode("span", _hoisted_2, toDisplayString(_ctx.title), 1)
43
- ], 10, _hoisted_1);
32
+ m("span", h, d(e.title), 1)
33
+ ], 10, y);
44
34
  }
45
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
35
+ const B = /* @__PURE__ */ k(_, [["render", $]]);
46
36
  export {
47
- index as default
37
+ B as default
48
38
  };
@@ -1,11 +1,22 @@
1
- import { ref, computed, reactive, onMounted, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, withDirectives, vShow, toDisplayString, createCommentVNode, createVNode, withCtx, createTextVNode } from "vue";
2
- import { c as createComponent } from "./component-81a4c1d0.js";
3
- import Button from "./Button.js";
4
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ var $ = Object.defineProperty, B = Object.defineProperties;
2
+ var P = Object.getOwnPropertyDescriptors;
3
+ var h = Object.getOwnPropertySymbols;
4
+ var U = Object.prototype.hasOwnProperty, V = Object.prototype.propertyIsEnumerable;
5
+ var g = (e, s, n) => s in e ? $(e, s, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[s] = n, C = (e, s) => {
6
+ for (var n in s || (s = {}))
7
+ U.call(s, n) && g(e, n, s[n]);
8
+ if (h)
9
+ for (var n of h(s))
10
+ V.call(s, n) && g(e, n, s[n]);
11
+ return e;
12
+ }, y = (e, s) => B(e, P(s));
13
+ import { ref as E, computed as j, reactive as X, onMounted as Y, toRefs as z, resolveComponent as M, openBlock as S, createElementBlock as w, normalizeClass as O, createElementVNode as k, withDirectives as q, vShow as A, toDisplayString as p, createCommentVNode as F, createVNode as L, withCtx as b, createTextVNode as D } from "vue";
14
+ import { c as G } from "./component-234624bc.js";
15
+ import x from "./Button.js";
16
+ import { _ as I } from "./_plugin-vue_export-helper-dad06003.js";
5
17
  import "../locale/lang";
6
18
  import "@nutui/icons-vue";
7
- const { componentName, create, translate } = createComponent("signature");
8
- const _sfc_main = create({
19
+ const { componentName: J, create: K, translate: Q } = G("signature"), Z = K({
9
20
  props: {
10
21
  customClass: {
11
22
  type: String,
@@ -17,15 +28,7 @@ const _sfc_main = create({
17
28
  },
18
29
  strokeStyle: {
19
30
  type: String,
20
- default: () => {
21
- let bodyDom = document.getElementsByTagName("body");
22
- let clsName = bodyDom[0]["className"];
23
- if (clsName.indexOf("nut-theme-dark") == -1) {
24
- return "#000";
25
- } else {
26
- return "#fff";
27
- }
28
- }
31
+ default: () => document.getElementsByTagName("body")[0].className.indexOf("nut-theme-dark") == -1 ? "#000" : "#fff"
29
32
  },
30
33
  type: {
31
34
  type: String,
@@ -37,155 +40,107 @@ const _sfc_main = create({
37
40
  }
38
41
  },
39
42
  components: {
40
- [Button.name]: Button
43
+ [x.name]: x
41
44
  },
42
45
  emits: ["start", "end", "signing", "confirm", "clear"],
43
- setup(props, { emit }) {
44
- const canvas = ref(null);
45
- const wrap = ref(null);
46
- const classes = computed(() => {
47
- const prefixCls = componentName;
48
- return {
49
- [prefixCls]: true,
50
- [`${props.customClass}`]: props.customClass
51
- };
52
- });
53
- const state = reactive({
46
+ setup(e, { emit: s }) {
47
+ const n = E(null), l = E(null), m = j(() => ({
48
+ [J]: !0,
49
+ [`${e.customClass}`]: e.customClass
50
+ })), a = X({
54
51
  canvasHeight: 0,
55
52
  canvasWidth: 0,
56
53
  ctx: null,
57
54
  isSupportTouch: "ontouchstart" in window,
58
55
  events: "ontouchstart" in window ? ["touchstart", "touchmove", "touchend", "touchleave"] : ["mousedown", "mousemove", "mouseup", "mouseleave"]
59
- });
60
- const isCanvasSupported = () => {
61
- let elem = document.createElement("canvas");
62
- return !!(elem.getContext && elem.getContext("2d"));
63
- };
64
- const addEvent = () => {
65
- canvas.value.addEventListener(state.events[0], startEventHandler, false);
66
- };
67
- const startEventHandler = (event) => {
68
- event.preventDefault();
69
- state.ctx.beginPath();
70
- state.ctx.lineWidth = props.lineWidth;
71
- state.ctx.strokeStyle = props.strokeStyle;
72
- emit("start");
73
- canvas.value.addEventListener(state.events[1], moveEventHandler, false);
74
- canvas.value.addEventListener(state.events[2], endEventHandler, false);
75
- canvas.value.addEventListener(state.events[3], leaveEventHandler, false);
76
- };
77
- const moveEventHandler = (event) => {
78
- event.preventDefault();
79
- let evt = state.isSupportTouch ? event.touches[0] : event;
80
- emit("signing", evt);
81
- let coverPos = canvas.value.getBoundingClientRect();
82
- let mouseX = evt.clientX - coverPos.left;
83
- let mouseY = evt.clientY - coverPos.top;
84
- state.ctx.lineTo(mouseX, mouseY);
85
- state.ctx.stroke();
86
- };
87
- const endEventHandler = (event) => {
88
- event.preventDefault();
89
- emit("end");
90
- canvas.value.removeEventListener(state.events[1], moveEventHandler, false);
91
- canvas.value.removeEventListener(state.events[2], endEventHandler, false);
92
- };
93
- const leaveEventHandler = (event) => {
94
- event.preventDefault();
95
- canvas.value.removeEventListener(state.events[1], moveEventHandler, false);
96
- canvas.value.removeEventListener(state.events[2], endEventHandler, false);
97
- };
98
- const clear = () => {
99
- canvas.value.addEventListener(state.events[2], endEventHandler, false);
100
- state.ctx.clearRect(0, 0, state.canvasWidth, state.canvasHeight);
101
- state.ctx.closePath();
102
- emit("clear");
103
- };
104
- const confirm = () => {
105
- onSave(canvas.value);
106
- };
107
- const isCanvasBlank = (canvas2) => {
108
- if (!canvas2) {
109
- return true;
110
- }
111
- var blank = document.createElement("canvas");
112
- blank.width = canvas2.width;
113
- blank.height = canvas2.height;
114
- return (canvas2 == null ? void 0 : canvas2.toDataURL()) == blank.toDataURL();
115
- };
116
- const onSave = (canvas2) => {
117
- let dataurl;
118
- switch (props.type) {
56
+ }), r = () => {
57
+ let t = document.createElement("canvas");
58
+ return !!(t.getContext && t.getContext("2d"));
59
+ }, c = () => {
60
+ n.value.addEventListener(a.events[0], N, !1);
61
+ }, N = (t) => {
62
+ t.preventDefault(), a.ctx.beginPath(), a.ctx.lineWidth = e.lineWidth, a.ctx.strokeStyle = e.strokeStyle, s("start"), n.value.addEventListener(a.events[1], d, !1), n.value.addEventListener(a.events[2], i, !1), n.value.addEventListener(a.events[3], H, !1);
63
+ }, d = (t) => {
64
+ t.preventDefault();
65
+ let o = a.isSupportTouch ? t.touches[0] : t;
66
+ s("signing", o);
67
+ let u = n.value.getBoundingClientRect(), v = o.clientX - u.left, _ = o.clientY - u.top;
68
+ a.ctx.lineTo(v, _), a.ctx.stroke();
69
+ }, i = (t) => {
70
+ t.preventDefault(), s("end"), n.value.removeEventListener(a.events[1], d, !1), n.value.removeEventListener(a.events[2], i, !1);
71
+ }, H = (t) => {
72
+ t.preventDefault(), n.value.removeEventListener(a.events[1], d, !1), n.value.removeEventListener(a.events[2], i, !1);
73
+ }, T = () => {
74
+ n.value.addEventListener(a.events[2], i, !1), a.ctx.clearRect(0, 0, a.canvasWidth, a.canvasHeight), a.ctx.closePath(), s("clear");
75
+ }, W = () => {
76
+ R(n.value);
77
+ }, f = (t) => {
78
+ if (!t)
79
+ return !0;
80
+ var o = document.createElement("canvas");
81
+ return o.width = t.width, o.height = t.height, (t == null ? void 0 : t.toDataURL()) == o.toDataURL();
82
+ }, R = (t) => {
83
+ let o;
84
+ switch (e.type) {
119
85
  case "png":
120
- dataurl = canvas2.toDataURL("image/png");
86
+ o = t.toDataURL("image/png");
121
87
  break;
122
88
  case "jpg":
123
- dataurl = canvas2.toDataURL("image/jpeg", 0.8);
89
+ o = t.toDataURL("image/jpeg", 0.8);
124
90
  break;
125
91
  }
126
- const _canvas = isCanvasBlank(canvas2) ? "请绘制签名" : canvas2;
127
- const _filePath = isCanvasBlank(canvas2) ? "" : dataurl;
128
- clear();
129
- emit("confirm", _canvas, _filePath);
92
+ const u = f(t) ? "请绘制签名" : t, v = f(t) ? "" : o;
93
+ s("confirm", u, v);
130
94
  };
131
- onMounted(() => {
132
- if (isCanvasSupported()) {
133
- state.ctx = canvas.value.getContext("2d");
134
- state.canvasWidth = wrap.value.offsetWidth;
135
- state.canvasHeight = wrap.value.offsetHeight;
136
- addEvent();
137
- }
138
- });
139
- return { ...toRefs(state), canvas, wrap, isCanvasSupported, confirm, clear, classes, translate };
95
+ return Y(() => {
96
+ r() && (a.ctx = n.value.getContext("2d"), a.canvasWidth = l.value.offsetWidth, a.canvasHeight = l.value.offsetHeight, c());
97
+ }), y(C({}, z(a)), { canvas: n, wrap: l, isCanvasSupported: r, confirm: W, clear: T, classes: m, translate: Q });
140
98
  }
141
- });
142
- const _hoisted_1 = {
99
+ }), ee = {
143
100
  class: "nut-signature-inner",
144
101
  ref: "wrap"
145
- };
146
- const _hoisted_2 = ["height", "width"];
147
- const _hoisted_3 = {
102
+ }, te = ["height", "width"], ne = {
148
103
  key: 0,
149
104
  class: "nut-signature-unsopport"
150
105
  };
151
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
152
- const _component_nut_button = resolveComponent("nut-button");
153
- return openBlock(), createElementBlock("div", {
154
- class: normalizeClass(_ctx.classes)
106
+ function se(e, s, n, l, m, a) {
107
+ const r = M("nut-button");
108
+ return S(), w("div", {
109
+ class: O(e.classes)
155
110
  }, [
156
- createElementVNode("div", _hoisted_1, [
157
- withDirectives(createElementVNode("canvas", {
111
+ k("div", ee, [
112
+ q(k("canvas", {
158
113
  ref: "canvas",
159
- height: _ctx.canvasHeight,
160
- width: _ctx.canvasWidth
161
- }, null, 8, _hoisted_2), [
162
- [vShow, _ctx.isCanvasSupported()]
114
+ height: e.canvasHeight,
115
+ width: e.canvasWidth
116
+ }, null, 8, te), [
117
+ [A, e.isCanvasSupported()]
163
118
  ]),
164
- !_ctx.isCanvasSupported() ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(_ctx.unSupportTpl || _ctx.translate("unSupportTpl")), 1)) : createCommentVNode("", true)
119
+ e.isCanvasSupported() ? F("", !0) : (S(), w("p", ne, p(e.unSupportTpl || e.translate("unSupportTpl")), 1))
165
120
  ], 512),
166
- createVNode(_component_nut_button, {
121
+ L(r, {
167
122
  class: "nut-signature-btn",
168
123
  type: "default",
169
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.clear())
124
+ onClick: s[0] || (s[0] = (c) => e.clear())
170
125
  }, {
171
- default: withCtx(() => [
172
- createTextVNode(toDisplayString(_ctx.translate("reSign")), 1)
126
+ default: b(() => [
127
+ D(p(e.translate("reSign")), 1)
173
128
  ]),
174
129
  _: 1
175
130
  }),
176
- createVNode(_component_nut_button, {
131
+ L(r, {
177
132
  class: "nut-signature-btn",
178
133
  type: "primary",
179
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.confirm())
134
+ onClick: s[1] || (s[1] = (c) => e.confirm())
180
135
  }, {
181
- default: withCtx(() => [
182
- createTextVNode(toDisplayString(_ctx.translate("confirm")), 1)
136
+ default: b(() => [
137
+ D(p(e.translate("confirm")), 1)
183
138
  ]),
184
139
  _: 1
185
140
  })
186
141
  ], 2);
187
142
  }
188
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
143
+ const de = /* @__PURE__ */ I(Z, [["render", se]]);
189
144
  export {
190
- index as default
145
+ de as default
191
146
  };