@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,272 +1,169 @@
1
- import { ref, computed, onMounted, watch, resolveComponent, openBlock, createElementBlock, Fragment, renderSlot, createCommentVNode, createElementVNode, normalizeClass, normalizeStyle, createVNode, withCtx, renderList, withModifiers, createBlock, resolveDynamicComponent, toDisplayString } from "vue";
2
- import { i as isArray, c as createComponent } from "./component-81a4c1d0.js";
3
- import { r as renderIcon } from "./renderIcon-3d0fd47c.js";
4
- import { u as useRect } from "./index-29892cda.js";
5
- import { P as Popup } from "./index-991c279f.js";
6
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ import { ref as g, computed as k, onMounted as j, watch as G, resolveComponent as J, openBlock as d, createElementBlock as C, Fragment as V, renderSlot as q, createCommentVNode as P, createElementVNode as I, normalizeClass as R, normalizeStyle as B, createVNode as K, withCtx as Q, renderList as X, withModifiers as Y, createBlock as Z, resolveDynamicComponent as x, toDisplayString as _ } from "vue";
2
+ import { i as ee, c as te } from "./component-234624bc.js";
3
+ import { r as oe } from "./renderIcon-47498b32.js";
4
+ import { u as z } from "./index-192a3ef6.js";
5
+ import { P as D } from "./index-360c5092.js";
6
+ import { _ as ne } from "./_plugin-vue_export-helper-dad06003.js";
7
7
  import "../locale/lang";
8
8
  import "./Overlay.js";
9
9
  import "@nutui/icons-vue";
10
- const { create } = createComponent("popover");
11
- const _sfc_main = create({
10
+ const { create: re } = te("popover"), le = re({
12
11
  components: {
13
- [Popup.name]: Popup
12
+ [D.name]: D
14
13
  },
15
14
  props: {
16
- visible: { type: Boolean, default: false },
15
+ visible: { type: Boolean, default: !1 },
17
16
  list: { type: Array, default: [] },
18
17
  theme: { type: String, default: "light" },
19
18
  location: { type: String, default: "bottom" },
20
19
  offset: { type: Array, default: [0, 12] },
21
20
  arrowOffset: { type: Number, default: 0 },
22
21
  customClass: { type: String, default: "" },
23
- showArrow: { type: Boolean, default: true },
22
+ showArrow: { type: Boolean, default: !0 },
24
23
  duration: { type: [Number, String], default: 0.3 },
25
- overlay: { type: Boolean, default: false },
24
+ overlay: { type: Boolean, default: !1 },
26
25
  overlayClass: { type: String, default: "" },
27
26
  overlayStyle: { type: Object },
28
- closeOnClickOverlay: { type: Boolean, default: true },
29
- closeOnClickAction: { type: Boolean, default: true },
30
- closeOnClickOutside: { type: Boolean, default: true },
27
+ closeOnClickOverlay: { type: Boolean, default: !0 },
28
+ closeOnClickAction: { type: Boolean, default: !0 },
29
+ closeOnClickOutside: { type: Boolean, default: !0 },
31
30
  targetId: { type: String, default: "" },
32
31
  bgColor: { type: String, default: "" }
33
32
  },
34
33
  emits: ["update", "update:visible", "close", "choose", "open"],
35
- setup(props, { emit }) {
36
- const popoverRef = ref();
37
- const popoverContentRef = ref();
38
- const showPopup = ref(props.visible);
39
- let rootRect = ref();
40
- let conentRootRect = ref();
41
- const popoverArrow = computed(() => {
42
- const prefixCls = "nut-popover-arrow";
43
- const loca = props.location;
44
- const direction = loca.split("-")[0];
45
- return `${prefixCls} ${prefixCls}-${direction} ${prefixCls}--${loca}`;
46
- });
47
- const popoverArrowStyle = computed(() => {
48
- const styles = {};
49
- const { bgColor, arrowOffset, location } = props;
50
- const direction = location.split("-")[0];
51
- const skew = location.split("-")[1];
52
- const base = 16;
53
- if (bgColor) {
54
- styles[`border${upperCaseFirst(direction)}Color`] = bgColor;
55
- }
56
- if (props.arrowOffset != 0) {
57
- if (["bottom", "top"].includes(direction)) {
58
- if (!skew) {
59
- styles.left = `calc(50% + ${arrowOffset}px)`;
60
- }
61
- if (skew == "start") {
62
- styles.left = `${base + arrowOffset}px`;
63
- }
64
- if (skew == "end") {
65
- styles.right = `${base - arrowOffset}px`;
66
- }
67
- }
68
- if (["left", "right"].includes(direction)) {
69
- if (!skew) {
70
- styles.top = `calc(50% - ${arrowOffset}px)`;
71
- }
72
- if (skew == "start") {
73
- styles.top = `${base - arrowOffset}px`;
74
- }
75
- if (skew == "end") {
76
- styles.bottom = `${base + arrowOffset}px`;
77
- }
78
- }
79
- }
80
- return styles;
81
- });
82
- const upperCaseFirst = (str) => {
83
- var str = str.toLowerCase();
84
- str = str.replace(/\b\w+\b/g, (word) => word.substring(0, 1).toUpperCase() + word.substring(1));
85
- return str;
86
- };
87
- const getRootPosition = computed(() => {
88
- let styles = {};
89
- if (!rootRect.value || !conentRootRect.value)
34
+ setup(t, { emit: l }) {
35
+ const h = g(), v = g(), S = g(t.visible);
36
+ let y = g(), u = g();
37
+ const r = k(() => {
38
+ const e = "nut-popover-arrow", o = t.location, n = o.split("-")[0];
39
+ return `${e} ${e}-${n} ${e}--${o}`;
40
+ }), w = k(() => {
41
+ const e = {}, { bgColor: o, arrowOffset: n, location: a } = t, s = a.split("-")[0], i = a.split("-")[1], p = 16;
42
+ return o && (e[`border${N(s)}Color`] = o), t.arrowOffset != 0 && (["bottom", "top"].includes(s) && (i || (e.left = `calc(50% + ${n}px)`), i == "start" && (e.left = `${p + n}px`), i == "end" && (e.right = `${p - n}px`)), ["left", "right"].includes(s) && (i || (e.top = `calc(50% - ${n}px)`), i == "start" && (e.top = `${p - n}px`), i == "end" && (e.bottom = `${p + n}px`))), e;
43
+ }), N = (o) => {
44
+ var o = o.toLowerCase();
45
+ return o = o.replace(/\b\w+\b/g, (n) => n.substring(0, 1).toUpperCase() + n.substring(1)), o;
46
+ }, F = k(() => {
47
+ let e = {};
48
+ if (!y.value || !u.value)
90
49
  return {};
91
- const conentWidth = conentRootRect.value.width;
92
- const conentHeight = conentRootRect.value.height;
93
- const { width, height, left, top } = rootRect.value;
94
- const { location, offset } = props;
95
- const direction = location.split("-")[0];
96
- const skew = location.split("-")[1];
97
- let cross = 0;
98
- let parallel = 0;
99
- if (isArray(offset) && offset.length == 2) {
100
- cross += +offset[1];
101
- parallel += +offset[0];
102
- }
103
- if (width) {
104
- if (["bottom", "top"].includes(direction)) {
105
- const h2 = direction == "bottom" ? height + cross : -(conentHeight + cross);
106
- styles.top = `${top + h2}px`;
107
- if (!skew) {
108
- styles.left = `${-(conentWidth - width) / 2 + left + parallel}px`;
109
- }
110
- if (skew == "start") {
111
- styles.left = `${left + parallel}px`;
112
- }
113
- if (skew == "end") {
114
- styles.left = `${rootRect.value.right + parallel}px`;
115
- }
50
+ const o = u.value.width, n = u.value.height, { width: a, height: s, left: i, top: p } = y.value, { location: W, offset: b } = t, $ = W.split("-")[0], f = W.split("-")[1];
51
+ let m = 0, c = 0;
52
+ if (ee(b) && b.length == 2 && (m += +b[1], c += +b[0]), a) {
53
+ if (["bottom", "top"].includes($)) {
54
+ const A = $ == "bottom" ? s + m : -(n + m);
55
+ e.top = `${p + A}px`, f || (e.left = `${-(o - a) / 2 + i + c}px`), f == "start" && (e.left = `${i + c}px`), f == "end" && (e.left = `${y.value.right + c}px`);
116
56
  }
117
- if (["left", "right"].includes(direction)) {
118
- const contentW = direction == "left" ? -(conentWidth + cross) : width + cross;
119
- styles.left = `${left + contentW}px`;
120
- if (!skew) {
121
- styles.top = `${top - conentHeight / 2 + height / 2 - 4 + parallel}px`;
122
- }
123
- if (skew == "start") {
124
- styles.top = `${top + parallel}px`;
125
- }
126
- if (skew == "end") {
127
- styles.top = `${top + height + parallel}px`;
128
- }
57
+ if (["left", "right"].includes($)) {
58
+ const A = $ == "left" ? -(o + m) : a + m;
59
+ e.left = `${i + A}px`, f || (e.top = `${p - n / 2 + s / 2 - 4 + c}px`), f == "start" && (e.top = `${p + c}px`), f == "end" && (e.top = `${p + s + c}px`);
129
60
  }
130
61
  }
131
- return styles;
132
- });
133
- const customStyle = computed(() => {
134
- const styles = {};
135
- if (props.bgColor) {
136
- styles.background = props.bgColor;
137
- }
138
- return styles;
139
- });
140
- const getContentWidth = () => {
141
- let rect2 = useRect(popoverRef.value);
142
- if (props.targetId) {
143
- rect2 = useRect(document.querySelector(`#${props.targetId}`));
144
- }
145
- rootRect.value = rect2;
146
- setTimeout(() => {
147
- conentRootRect.value = {
148
- height: popoverContentRef.value.clientHeight,
149
- width: popoverContentRef.value.clientWidth
62
+ return e;
63
+ }), H = k(() => {
64
+ const e = {};
65
+ return t.bgColor && (e.background = t.bgColor), e;
66
+ }), E = () => {
67
+ let e = z(h.value);
68
+ t.targetId && (e = z(document.querySelector(`#${t.targetId}`))), y.value = e, setTimeout(() => {
69
+ u.value = {
70
+ height: v.value.clientHeight,
71
+ width: v.value.clientWidth
150
72
  };
151
73
  }, 0);
152
74
  };
153
- onMounted(() => {
75
+ j(() => {
154
76
  setTimeout(() => {
155
- getContentWidth();
77
+ E();
156
78
  }, 200);
157
- });
158
- watch(
159
- () => props.visible,
160
- (value) => {
161
- showPopup.value = value;
162
- if (value) {
163
- window.addEventListener("touchstart", clickAway, true);
164
- getContentWidth();
165
- } else {
166
- window.removeEventListener("touchstart", clickAway, true);
167
- }
79
+ }), G(
80
+ () => t.visible,
81
+ (e) => {
82
+ S.value = e, e ? (window.addEventListener("touchstart", L, !0), E()) : window.removeEventListener("touchstart", L, !0);
168
83
  }
169
84
  );
170
- const update = (val) => {
171
- emit("update", val);
172
- emit("update:visible", val);
173
- };
174
- const openPopover = () => {
175
- update(!props.visible);
176
- emit("open");
177
- };
178
- const closePopover = () => {
179
- emit("update:visible", false);
180
- emit("close");
181
- };
182
- const chooseItem = (item, index) => {
183
- !item.disabled && emit("choose", item, index);
184
- if (props.closeOnClickAction) {
185
- closePopover();
186
- }
187
- };
188
- const clickAway = (event) => {
189
- const element = popoverRef.value;
190
- const elContent = popoverContentRef.value;
191
- let el = element && !element.contains(event.target);
192
- if (props.targetId) {
193
- const dom = document.querySelector(`#${props.targetId}`);
194
- el = dom && !dom.contains(event.target);
195
- }
196
- if (el && elContent && !elContent.contains(event.target) && props.closeOnClickOutside) {
197
- closePopover();
85
+ const M = (e) => {
86
+ l("update", e), l("update:visible", e);
87
+ }, T = () => {
88
+ M(!t.visible), l("open");
89
+ }, O = () => {
90
+ l("update:visible", !1), l("close");
91
+ }, U = (e, o) => {
92
+ !e.disabled && l("choose", e, o), t.closeOnClickAction && O();
93
+ }, L = (e) => {
94
+ const o = h.value, n = v.value;
95
+ let a = o && !o.contains(e.target);
96
+ if (t.targetId) {
97
+ const s = document.querySelector(`#${t.targetId}`);
98
+ a = s && !s.contains(e.target);
198
99
  }
100
+ a && n && !n.contains(e.target) && t.closeOnClickOutside && O();
199
101
  };
200
102
  return {
201
- showPopup,
202
- openPopover,
203
- popoverArrow,
204
- closePopover,
205
- chooseItem,
206
- popoverRef,
207
- popoverContentRef,
208
- getRootPosition,
209
- customStyle,
210
- popoverArrowStyle,
211
- renderIcon
103
+ showPopup: S,
104
+ openPopover: T,
105
+ popoverArrow: r,
106
+ closePopover: O,
107
+ chooseItem: U,
108
+ popoverRef: h,
109
+ popoverContentRef: v,
110
+ getRootPosition: F,
111
+ customStyle: H,
112
+ popoverArrowStyle: w,
113
+ renderIcon: oe
212
114
  };
213
115
  }
214
- });
215
- const _hoisted_1 = {
116
+ }), se = {
216
117
  ref: "popoverContentRef",
217
118
  class: "nut-popover-content-group"
218
- };
219
- const _hoisted_2 = ["onClick"];
220
- const _hoisted_3 = { class: "nut-popover-menu-item-name" };
221
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
222
- const _component_nut_popup = resolveComponent("nut-popup");
223
- return openBlock(), createElementBlock(Fragment, null, [
224
- !_ctx.targetId ? (openBlock(), createElementBlock("div", {
119
+ }, ie = ["onClick"], ae = { class: "nut-popover-menu-item-name" };
120
+ function pe(t, l, h, v, S, y) {
121
+ const u = J("nut-popup");
122
+ return d(), C(V, null, [
123
+ t.targetId ? P("", !0) : (d(), C("div", {
225
124
  key: 0,
226
125
  class: "nut-popover-wrapper",
227
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.openPopover && _ctx.openPopover(...args)),
126
+ onClick: l[0] || (l[0] = (...r) => t.openPopover && t.openPopover(...r)),
228
127
  ref: "popoverRef"
229
128
  }, [
230
- renderSlot(_ctx.$slots, "reference")
231
- ], 512)) : createCommentVNode("", true),
232
- createElementVNode("view", {
233
- class: normalizeClass(["nut-popover", `nut-popover--${_ctx.theme}`, `${_ctx.customClass}`]),
234
- style: normalizeStyle(_ctx.getRootPosition)
129
+ q(t.$slots, "reference")
130
+ ], 512)),
131
+ I("view", {
132
+ class: R(["nut-popover", `nut-popover--${t.theme}`, `${t.customClass}`]),
133
+ style: B(t.getRootPosition)
235
134
  }, [
236
- createVNode(_component_nut_popup, {
237
- popClass: `nut-popover-content nut-popover-content--${_ctx.location}`,
238
- style: normalizeStyle(_ctx.customStyle),
239
- visible: _ctx.showPopup,
240
- "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.showPopup = $event),
135
+ K(u, {
136
+ popClass: `nut-popover-content nut-popover-content--${t.location}`,
137
+ style: B(t.customStyle),
138
+ visible: t.showPopup,
139
+ "onUpdate:visible": l[1] || (l[1] = (r) => t.showPopup = r),
241
140
  position: "",
242
141
  transition: "nut-popover",
243
- overlay: _ctx.overlay,
244
- duration: _ctx.duration,
245
- overlayStyle: _ctx.overlayStyle,
246
- overlayClass: _ctx.overlayClass,
247
- closeOnClickOverlay: _ctx.closeOnClickOverlay
142
+ overlay: t.overlay,
143
+ duration: t.duration,
144
+ overlayStyle: t.overlayStyle,
145
+ overlayClass: t.overlayClass,
146
+ closeOnClickOverlay: t.closeOnClickOverlay
248
147
  }, {
249
- default: withCtx(() => [
250
- createElementVNode("view", _hoisted_1, [
251
- _ctx.showArrow ? (openBlock(), createElementBlock("view", {
148
+ default: Q(() => [
149
+ I("view", se, [
150
+ t.showArrow ? (d(), C("view", {
252
151
  key: 0,
253
- class: normalizeClass(_ctx.popoverArrow),
254
- style: normalizeStyle(_ctx.popoverArrowStyle)
255
- }, null, 6)) : createCommentVNode("", true),
256
- renderSlot(_ctx.$slots, "content"),
257
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.list, (item, index) => {
258
- return openBlock(), createElementBlock("view", {
259
- key: index,
260
- class: normalizeClass([item.className, item.disabled && "nut-popover-menu-disabled", "nut-popover-menu-item"]),
261
- onClick: withModifiers(($event) => _ctx.chooseItem(item, index), ["stop"])
262
- }, [
263
- item.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.renderIcon(item.icon)), {
264
- key: 0,
265
- class: "nut-popover-item-img"
266
- })) : createCommentVNode("", true),
267
- createElementVNode("view", _hoisted_3, toDisplayString(item.name), 1)
268
- ], 10, _hoisted_2);
269
- }), 128))
152
+ class: R(t.popoverArrow),
153
+ style: B(t.popoverArrowStyle)
154
+ }, null, 6)) : P("", !0),
155
+ q(t.$slots, "content"),
156
+ (d(!0), C(V, null, X(t.list, (r, w) => (d(), C("view", {
157
+ key: w,
158
+ class: R([r.className, r.disabled && "nut-popover-menu-disabled", "nut-popover-menu-item"]),
159
+ onClick: Y((N) => t.chooseItem(r, w), ["stop"])
160
+ }, [
161
+ r.icon ? (d(), Z(x(t.renderIcon(r.icon)), {
162
+ key: 0,
163
+ class: "nut-popover-item-img"
164
+ })) : P("", !0),
165
+ I("view", ae, _(r.name), 1)
166
+ ], 10, ie))), 128))
270
167
  ], 512)
271
168
  ]),
272
169
  _: 3
@@ -274,7 +171,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
274
171
  ], 6)
275
172
  ], 64);
276
173
  }
277
- const Popover = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
174
+ const he = /* @__PURE__ */ ne(le, [["render", pe]]);
278
175
  export {
279
- Popover as default
176
+ he as default
280
177
  };
@@ -1,10 +1,10 @@
1
- import { P } from "./index-991c279f.js";
1
+ import { P as f } from "./index-360c5092.js";
2
2
  import "vue";
3
- import "./_plugin-vue_export-helper-cc2b3d55.js";
4
- import "./component-81a4c1d0.js";
3
+ import "./_plugin-vue_export-helper-dad06003.js";
4
+ import "./component-234624bc.js";
5
5
  import "../locale/lang";
6
6
  import "./Overlay.js";
7
7
  import "@nutui/icons-vue";
8
8
  export {
9
- P as default
9
+ f as default
10
10
  };
@@ -1,9 +1,8 @@
1
- import { computed, openBlock, createElementBlock, normalizeClass, createCommentVNode, 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 c, openBlock as r, createElementBlock as i, normalizeClass as s, createCommentVNode as n, createElementVNode as f, toDisplayString as d } from "vue";
2
+ import { c as g } from "./component-234624bc.js";
3
+ import { _ as h } from "./_plugin-vue_export-helper-dad06003.js";
4
4
  import "../locale/lang";
5
- const { componentName, create } = createComponent("price");
6
- const _sfc_main = create({
5
+ const { componentName: u, create: S } = g("price"), $ = S({
7
6
  props: {
8
7
  price: {
9
8
  type: [Number, String],
@@ -11,7 +10,7 @@ const _sfc_main = create({
11
10
  },
12
11
  needSymbol: {
13
12
  type: Boolean,
14
- default: true
13
+ default: !0
15
14
  },
16
15
  symbol: {
17
16
  type: String,
@@ -23,7 +22,7 @@ const _sfc_main = create({
23
22
  },
24
23
  thousands: {
25
24
  type: Boolean,
26
- default: false
25
+ default: !1
27
26
  },
28
27
  position: {
29
28
  type: String,
@@ -32,89 +31,57 @@ const _sfc_main = create({
32
31
  size: {
33
32
  type: String,
34
33
  default: "normal"
34
+ },
35
+ strikeThrough: {
36
+ type: Boolean,
37
+ default: !1
35
38
  }
36
39
  },
37
- setup(props) {
38
- const classes = computed(() => {
39
- return {
40
- [componentName]: true
41
- };
42
- });
43
- const showSymbol = computed(() => {
44
- const symbol = props.needSymbol ? props.symbol : "";
45
- return symbol;
46
- });
47
- const checkPoint = (price) => {
48
- return String(price).indexOf(".") > 0;
49
- };
50
- const formatThousands = (num) => {
51
- if (Number(num) == 0) {
52
- num = 0;
53
- }
54
- if (checkPoint(num)) {
55
- num = Number(num).toFixed(props.decimalDigits);
56
- num = typeof num.split(".") === "string" ? num.split(".") : num.split(".")[0];
57
- } else {
58
- num = num.toString();
59
- }
60
- if (props.thousands) {
61
- return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,");
62
- } else {
63
- return num;
64
- }
65
- };
66
- const formatDecimal = (decimalNum) => {
67
- if (Number(decimalNum) == 0) {
68
- decimalNum = 0;
69
- }
70
- if (checkPoint(decimalNum)) {
71
- decimalNum = Number(decimalNum).toFixed(props.decimalDigits);
72
- decimalNum = typeof decimalNum.split(".") === "string" ? 0 : decimalNum.split(".")[1] ? decimalNum.split(".")[1] : 0;
73
- } else {
74
- decimalNum = 0;
75
- }
76
- const result = "0." + decimalNum;
77
- const resultFixed = Number(result).toFixed(props.decimalDigits);
78
- return String(resultFixed).substring(2, resultFixed.length);
79
- };
40
+ setup(t) {
41
+ const l = c(() => ({
42
+ [u]: !0,
43
+ [`${u}--strike`]: t.strikeThrough
44
+ })), a = c(() => t.needSymbol ? t.symbol : ""), o = (e) => String(e).indexOf(".") > 0;
80
45
  return {
81
- classes,
82
- showSymbol,
83
- checkPoint,
84
- formatThousands,
85
- formatDecimal
46
+ classes: l,
47
+ showSymbol: a,
48
+ checkPoint: o,
49
+ formatThousands: (e) => (Number(e) == 0 && (e = 0), o(e) ? (e = Number(e).toFixed(t.decimalDigits), e = typeof e.split(".") == "string" ? e.split(".") : e.split(".")[0]) : e = e.toString(), t.thousands ? (e || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") : e),
50
+ formatDecimal: (e) => {
51
+ Number(e) == 0 && (e = 0), o(e) ? (e = Number(e).toFixed(t.decimalDigits), e = typeof e.split(".") == "string" ? 0 : e.split(".")[1] ? e.split(".")[1] : 0) : e = 0;
52
+ const m = "0." + e, p = Number(m).toFixed(t.decimalDigits);
53
+ return String(p).substring(2, p.length);
54
+ }
86
55
  };
87
56
  }
88
- });
89
- const _hoisted_1 = ["innerHTML"];
90
- const _hoisted_2 = ["innerHTML"];
91
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
92
- return openBlock(), createElementBlock("view", {
93
- class: normalizeClass(_ctx.classes)
57
+ }), k = ["innerHTML"], w = ["innerHTML"];
58
+ function D(t, l, a, o, y, b) {
59
+ return r(), i("view", {
60
+ class: s(t.classes)
94
61
  }, [
95
- _ctx.needSymbol && _ctx.position == "before" ? (openBlock(), createElementBlock("view", {
62
+ t.needSymbol && t.position == "before" ? (r(), i("view", {
96
63
  key: 0,
97
- class: normalizeClass(["nut-price--symbol", `nut-price--symbol-${_ctx.size}`]),
98
- innerHTML: _ctx.showSymbol
99
- }, null, 10, _hoisted_1)) : createCommentVNode("", true),
100
- createElementVNode("view", {
101
- class: normalizeClass(`nut-price--${_ctx.size}`)
102
- }, toDisplayString(_ctx.formatThousands(_ctx.price)), 3),
103
- _ctx.decimalDigits != 0 ? (openBlock(), createElementBlock("view", {
64
+ class: s(["nut-price--symbol", `nut-price--symbol-${t.size}`]),
65
+ innerHTML: t.showSymbol
66
+ }, null, 10, k)) : n("", !0),
67
+ f("view", {
68
+ class: s(`nut-price--${t.size}`)
69
+ }, d(t.formatThousands(t.price)), 3),
70
+ t.decimalDigits != 0 ? (r(), i("view", {
104
71
  key: 1,
105
- class: normalizeClass(`nut-price--decimal-${_ctx.size}`)
106
- }, ".", 2)) : createCommentVNode("", true),
107
- createElementVNode("view", {
108
- class: normalizeClass(`nut-price--decimal-${_ctx.size}`)
109
- }, toDisplayString(_ctx.formatDecimal(_ctx.price)), 3),
110
- _ctx.needSymbol && _ctx.position == "after" ? (openBlock(), createElementBlock("view", {
72
+ class: s(`nut-price--decimal-${t.size}`)
73
+ }, ".", 2)) : n("", !0),
74
+ f("view", {
75
+ class: s(`nut-price--decimal-${t.size}`)
76
+ }, d(t.formatDecimal(t.price)), 3),
77
+ t.needSymbol && t.position == "after" ? (r(), i("view", {
111
78
  key: 2,
112
- class: normalizeClass(["nut-price--symbol", `nut-price--symbol-${_ctx.size}`]),
113
- innerHTML: _ctx.showSymbol
114
- }, null, 10, _hoisted_2)) : createCommentVNode("", true)
79
+ class: s(["nut-price--symbol", `nut-price--symbol-${t.size}`]),
80
+ innerHTML: t.showSymbol
81
+ }, null, 10, w)) : n("", !0)
115
82
  ], 2);
116
83
  }
117
- const Price = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
84
+ const F = /* @__PURE__ */ h($, [["render", D]]);
118
85
  export {
119
- Price as default
86
+ F as default
120
87
  };