@nutui/nutui 4.0.12-beta.1 → 4.0.12

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 (158) hide show
  1. package/dist/nutui.es.js +1 -1
  2. package/dist/nutui.js +1 -1
  3. package/dist/nutui.umd.js +1 -1
  4. package/dist/packages/_es/ActionSheet.js +111 -78
  5. package/dist/packages/_es/Address.js +375 -250
  6. package/dist/packages/_es/AddressList.js +354 -269
  7. package/dist/packages/_es/Animate.js +58 -41
  8. package/dist/packages/_es/Audio.js +197 -128
  9. package/dist/packages/_es/AudioOperate.js +71 -60
  10. package/dist/packages/_es/Avatar.js +89 -66
  11. package/dist/packages/_es/AvatarGroup.js +31 -23
  12. package/dist/packages/_es/Backtop.js +99 -59
  13. package/dist/packages/_es/Badge.js +47 -36
  14. package/dist/packages/_es/Barrage.js +147 -68
  15. package/dist/packages/_es/Button.js +66 -47
  16. package/dist/packages/_es/Calendar.js +157 -135
  17. package/dist/packages/_es/CalendarItem.js +6 -6
  18. package/dist/packages/_es/Card.js +56 -42
  19. package/dist/packages/_es/Cascader.js +474 -315
  20. package/dist/packages/_es/Category.js +39 -29
  21. package/dist/packages/_es/CategoryPane.js +83 -57
  22. package/dist/packages/_es/Cell.js +71 -56
  23. package/dist/packages/_es/CellGroup.js +27 -19
  24. package/dist/packages/_es/Checkbox.js +156 -109
  25. package/dist/packages/_es/CheckboxGroup.js +59 -38
  26. package/dist/packages/_es/CircleProgress.js +96 -67
  27. package/dist/packages/_es/Col.js +31 -23
  28. package/dist/packages/_es/Collapse.js +58 -33
  29. package/dist/packages/_es/CollapseItem.js +108 -78
  30. package/dist/packages/_es/Comment.js +279 -207
  31. package/dist/packages/_es/ConfigProvider.js +55 -37
  32. package/dist/packages/_es/Countdown.js +212 -100
  33. package/dist/packages/_es/Countup.js +445 -232
  34. package/dist/packages/_es/DatePicker.js +265 -162
  35. package/dist/packages/_es/Dialog.js +213 -161
  36. package/dist/packages/_es/Divider.js +57 -42
  37. package/dist/packages/_es/Drag.js +153 -70
  38. package/dist/packages/_es/Ecard.js +104 -64
  39. package/dist/packages/_es/Elevator.js +219 -143
  40. package/dist/packages/_es/Ellipsis.js +178 -95
  41. package/dist/packages/_es/Empty.js +39 -23
  42. package/dist/packages/_es/FixedNav.js +116 -93
  43. package/dist/packages/_es/Form.js +178 -107
  44. package/dist/packages/_es/FormItem.js +61 -48
  45. package/dist/packages/_es/Grid.js +6 -5
  46. package/dist/packages/_es/GridItem.js +84 -58
  47. package/dist/packages/_es/Image.js +130 -90
  48. package/dist/packages/_es/ImagePreview.js +412 -256
  49. package/dist/packages/_es/Indicator.js +34 -30
  50. package/dist/packages/_es/InfiniteLoading.js +136 -83
  51. package/dist/packages/_es/Input.js +264 -160
  52. package/dist/packages/_es/InputNumber.js +117 -81
  53. package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
  54. package/dist/packages/_es/Invoice.js +130 -104
  55. package/dist/packages/_es/Layout.js +4 -3
  56. package/dist/packages/_es/List.js +215 -117
  57. package/dist/packages/_es/Menu.js +150 -95
  58. package/dist/packages/_es/MenuItem.js +154 -109
  59. package/dist/packages/_es/Navbar.js +119 -103
  60. package/dist/packages/_es/Noticebar.js +312 -197
  61. package/dist/packages/_es/Notify.js +166 -110
  62. package/dist/packages/_es/NumberKeyboard.js +202 -127
  63. package/dist/packages/_es/Overlay.js +80 -52
  64. package/dist/packages/_es/Pagination.js +100 -70
  65. package/dist/packages/_es/Picker.js +437 -275
  66. package/dist/packages/_es/Popover.js +225 -122
  67. package/dist/packages/_es/Popup.js +4 -4
  68. package/dist/packages/_es/Price.js +82 -44
  69. package/dist/packages/_es/Progress.js +79 -63
  70. package/dist/packages/_es/PullRefresh.js +173 -95
  71. package/dist/packages/_es/Radio.js +4 -4
  72. package/dist/packages/_es/RadioGroup.js +3 -3
  73. package/dist/packages/_es/Range.js +347 -204
  74. package/dist/packages/_es/Rate.js +141 -92
  75. package/dist/packages/_es/Row.js +27 -21
  76. package/dist/packages/_es/Searchbar.js +174 -123
  77. package/dist/packages/_es/ShortPassword.js +93 -69
  78. package/dist/packages/_es/SideNavbar.js +80 -49
  79. package/dist/packages/_es/SideNavbarItem.js +32 -22
  80. package/dist/packages/_es/Signature.js +146 -83
  81. package/dist/packages/_es/Skeleton.js +130 -110
  82. package/dist/packages/_es/Sku.js +343 -250
  83. package/dist/packages/_es/Step.js +86 -59
  84. package/dist/packages/_es/Steps.js +31 -26
  85. package/dist/packages/_es/Sticky.js +4 -4
  86. package/dist/packages/_es/SubSideNavbar.js +74 -52
  87. package/dist/packages/_es/Swipe.js +155 -83
  88. package/dist/packages/_es/Swiper.js +311 -174
  89. package/dist/packages/_es/SwiperItem.js +44 -28
  90. package/dist/packages/_es/Switch.js +68 -55
  91. package/dist/packages/_es/TabPane.js +41 -30
  92. package/dist/packages/_es/Tabbar.js +52 -41
  93. package/dist/packages/_es/TabbarItem.js +82 -61
  94. package/dist/packages/_es/Table.js +165 -109
  95. package/dist/packages/_es/Tabs.js +388 -240
  96. package/dist/packages/_es/Tag.js +61 -44
  97. package/dist/packages/_es/Textarea.js +124 -80
  98. package/dist/packages/_es/TimeDetail.js +76 -49
  99. package/dist/packages/_es/TimePannel.js +48 -34
  100. package/dist/packages/_es/TimeSelect.js +68 -47
  101. package/dist/packages/_es/Toast.js +218 -144
  102. package/dist/packages/_es/Tour.js +192 -138
  103. package/dist/packages/_es/TrendArrow.js +77 -57
  104. package/dist/packages/_es/Uploader.js +359 -234
  105. package/dist/packages/_es/Video.js +316 -191
  106. package/dist/packages/_es/Watermark.js +117 -84
  107. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
  108. package/dist/packages/_es/common-b9a5e726.js +145 -0
  109. package/dist/packages/_es/component-81a4c1d0.js +145 -0
  110. package/dist/packages/_es/index-29892cda.js +33 -0
  111. package/dist/packages/_es/index-43c34ac6.js +30 -0
  112. package/dist/packages/_es/index-54d03fc1.js +8 -0
  113. package/dist/packages/_es/index-79c5dc33.js +10 -0
  114. package/dist/packages/_es/index-7a7385e4.js +67 -0
  115. package/dist/packages/_es/index-87422be8.js +942 -0
  116. package/dist/packages/_es/index-da0a7662.js +259 -0
  117. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
  120. package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
  121. package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
  122. package/dist/packages/_es/raf-729dad54.js +25 -0
  123. package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
  124. package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
  125. package/dist/packages/locale/lang/en-US.js +39 -36
  126. package/dist/packages/locale/lang/id-ID.js +39 -36
  127. package/dist/packages/locale/lang/index.js +44 -22
  128. package/dist/packages/locale/lang/zh-CN.js +38 -35
  129. package/dist/packages/locale/lang/zh-TW.js +38 -35
  130. package/dist/resolver/index.js +26 -1
  131. package/dist/resolver/index.mjs +17 -14
  132. package/dist/smartips/web-types.json +1 -1
  133. package/dist/style.css +1 -1
  134. package/dist/styles/themes/default.scss +50 -50
  135. package/dist/styles/themes/jdb.scss +50 -50
  136. package/dist/styles/themes/jddkh.scss +50 -50
  137. package/dist/styles/themes/jdt.scss +50 -50
  138. package/dist/types/index.d.ts +1 -1
  139. package/package.json +2 -2
  140. package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
  141. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
  142. package/dist/packages/_es/common-d218746f.js +0 -116
  143. package/dist/packages/_es/component-234624bc.js +0 -89
  144. package/dist/packages/_es/index-14dfadc4.js +0 -561
  145. package/dist/packages/_es/index-192a3ef6.js +0 -29
  146. package/dist/packages/_es/index-360c5092.js +0 -210
  147. package/dist/packages/_es/index-496e6e05.js +0 -24
  148. package/dist/packages/_es/index-50eed3d9.js +0 -7
  149. package/dist/packages/_es/index-53ec2d4d.js +0 -34
  150. package/dist/packages/_es/index-fadb0974.js +0 -8
  151. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
  152. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
  153. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
  154. package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
  155. package/dist/packages/_es/pxCheck-38173291.js +0 -4
  156. package/dist/packages/_es/raf-a74f1a06.js +0 -16
  157. package/dist/packages/_es/renderIcon-47498b32.js +0 -5
  158. package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
@@ -1,169 +1,272 @@
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";
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-da0a7662.js";
6
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
7
7
  import "../locale/lang";
8
8
  import "./Overlay.js";
9
9
  import "@nutui/icons-vue";
10
- const { create: re } = te("popover"), le = re({
10
+ const { create } = createComponent("popover");
11
+ const _sfc_main = create({
11
12
  components: {
12
- [D.name]: D
13
+ [Popup.name]: Popup
13
14
  },
14
15
  props: {
15
- visible: { type: Boolean, default: !1 },
16
+ visible: { type: Boolean, default: false },
16
17
  list: { type: Array, default: [] },
17
18
  theme: { type: String, default: "light" },
18
19
  location: { type: String, default: "bottom" },
19
20
  offset: { type: Array, default: [0, 12] },
20
21
  arrowOffset: { type: Number, default: 0 },
21
22
  customClass: { type: String, default: "" },
22
- showArrow: { type: Boolean, default: !0 },
23
+ showArrow: { type: Boolean, default: true },
23
24
  duration: { type: [Number, String], default: 0.3 },
24
- overlay: { type: Boolean, default: !1 },
25
+ overlay: { type: Boolean, default: false },
25
26
  overlayClass: { type: String, default: "" },
26
27
  overlayStyle: { type: Object },
27
- closeOnClickOverlay: { type: Boolean, default: !0 },
28
- closeOnClickAction: { type: Boolean, default: !0 },
29
- closeOnClickOutside: { type: Boolean, default: !0 },
28
+ closeOnClickOverlay: { type: Boolean, default: true },
29
+ closeOnClickAction: { type: Boolean, default: true },
30
+ closeOnClickOutside: { type: Boolean, default: true },
30
31
  targetId: { type: String, default: "" },
31
32
  bgColor: { type: String, default: "" }
32
33
  },
33
34
  emits: ["update", "update:visible", "close", "choose", "open"],
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)
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)
49
90
  return {};
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`);
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
+ }
56
116
  }
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`);
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
+ }
60
129
  }
61
130
  }
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
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
72
150
  };
73
151
  }, 0);
74
152
  };
75
- j(() => {
153
+ onMounted(() => {
76
154
  setTimeout(() => {
77
- E();
155
+ getContentWidth();
78
156
  }, 200);
79
- }), G(
80
- () => t.visible,
81
- (e) => {
82
- S.value = e, e ? (window.addEventListener("touchstart", L, !0), E()) : window.removeEventListener("touchstart", L, !0);
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
+ }
83
168
  }
84
169
  );
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);
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();
99
198
  }
100
- a && n && !n.contains(e.target) && t.closeOnClickOutside && O();
101
199
  };
102
200
  return {
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
201
+ showPopup,
202
+ openPopover,
203
+ popoverArrow,
204
+ closePopover,
205
+ chooseItem,
206
+ popoverRef,
207
+ popoverContentRef,
208
+ getRootPosition,
209
+ customStyle,
210
+ popoverArrowStyle,
211
+ renderIcon
114
212
  };
115
213
  }
116
- }), se = {
214
+ });
215
+ const _hoisted_1 = {
117
216
  ref: "popoverContentRef",
118
217
  class: "nut-popover-content-group"
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", {
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", {
124
225
  key: 0,
125
226
  class: "nut-popover-wrapper",
126
- onClick: l[0] || (l[0] = (...r) => t.openPopover && t.openPopover(...r)),
227
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.openPopover && _ctx.openPopover(...args)),
127
228
  ref: "popoverRef"
128
229
  }, [
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)
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)
134
235
  }, [
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),
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),
140
241
  position: "",
141
242
  transition: "nut-popover",
142
- overlay: t.overlay,
143
- duration: t.duration,
144
- overlayStyle: t.overlayStyle,
145
- overlayClass: t.overlayClass,
146
- closeOnClickOverlay: t.closeOnClickOverlay
243
+ overlay: _ctx.overlay,
244
+ duration: _ctx.duration,
245
+ overlayStyle: _ctx.overlayStyle,
246
+ overlayClass: _ctx.overlayClass,
247
+ closeOnClickOverlay: _ctx.closeOnClickOverlay
147
248
  }, {
148
- default: Q(() => [
149
- I("view", se, [
150
- t.showArrow ? (d(), C("view", {
249
+ default: withCtx(() => [
250
+ createElementVNode("view", _hoisted_1, [
251
+ _ctx.showArrow ? (openBlock(), createElementBlock("view", {
151
252
  key: 0,
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))
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))
167
270
  ], 512)
168
271
  ]),
169
272
  _: 3
@@ -171,7 +274,7 @@ function pe(t, l, h, v, S, y) {
171
274
  ], 6)
172
275
  ], 64);
173
276
  }
174
- const he = /* @__PURE__ */ ne(le, [["render", pe]]);
277
+ const Popover = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
175
278
  export {
176
- he as default
279
+ Popover as default
177
280
  };
@@ -1,10 +1,10 @@
1
- import { P as f } from "./index-360c5092.js";
1
+ import { P } from "./index-da0a7662.js";
2
2
  import "vue";
3
- import "./_plugin-vue_export-helper-dad06003.js";
4
- import "./component-234624bc.js";
3
+ import "./_plugin-vue_export-helper-cc2b3d55.js";
4
+ import "./component-81a4c1d0.js";
5
5
  import "../locale/lang";
6
6
  import "./Overlay.js";
7
7
  import "@nutui/icons-vue";
8
8
  export {
9
- f as default
9
+ P as default
10
10
  };
@@ -1,8 +1,9 @@
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";
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";
4
4
  import "../locale/lang";
5
- const { componentName: u, create: S } = g("price"), $ = S({
5
+ const { componentName, create } = createComponent("price");
6
+ const _sfc_main = create({
6
7
  props: {
7
8
  price: {
8
9
  type: [Number, String],
@@ -10,7 +11,7 @@ const { componentName: u, create: S } = g("price"), $ = S({
10
11
  },
11
12
  needSymbol: {
12
13
  type: Boolean,
13
- default: !0
14
+ default: true
14
15
  },
15
16
  symbol: {
16
17
  type: String,
@@ -22,7 +23,7 @@ const { componentName: u, create: S } = g("price"), $ = S({
22
23
  },
23
24
  thousands: {
24
25
  type: Boolean,
25
- default: !1
26
+ default: false
26
27
  },
27
28
  position: {
28
29
  type: String,
@@ -34,54 +35,91 @@ const { componentName: u, create: S } = g("price"), $ = S({
34
35
  },
35
36
  strikeThrough: {
36
37
  type: Boolean,
37
- default: !1
38
+ default: false
38
39
  }
39
40
  },
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;
45
- return {
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);
41
+ setup(props) {
42
+ const classes = computed(() => {
43
+ return {
44
+ [componentName]: true,
45
+ [`${componentName}--strike`]: props.strikeThrough
46
+ };
47
+ });
48
+ const showSymbol = computed(() => {
49
+ const symbol = props.needSymbol ? props.symbol : "";
50
+ return symbol;
51
+ });
52
+ const checkPoint = (price) => {
53
+ return String(price).indexOf(".") > 0;
54
+ };
55
+ const formatThousands = (num) => {
56
+ if (Number(num) == 0) {
57
+ num = 0;
58
+ }
59
+ if (checkPoint(num)) {
60
+ num = Number(num).toFixed(props.decimalDigits);
61
+ num = typeof num.split(".") === "string" ? num.split(".") : num.split(".")[0];
62
+ } else {
63
+ num = num.toString();
54
64
  }
65
+ if (props.thousands) {
66
+ return (num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,");
67
+ } else {
68
+ return num;
69
+ }
70
+ };
71
+ const formatDecimal = (decimalNum) => {
72
+ if (Number(decimalNum) == 0) {
73
+ decimalNum = 0;
74
+ }
75
+ if (checkPoint(decimalNum)) {
76
+ decimalNum = Number(decimalNum).toFixed(props.decimalDigits);
77
+ decimalNum = typeof decimalNum.split(".") === "string" ? 0 : decimalNum.split(".")[1] ? decimalNum.split(".")[1] : 0;
78
+ } else {
79
+ decimalNum = 0;
80
+ }
81
+ const result = "0." + decimalNum;
82
+ const resultFixed = Number(result).toFixed(props.decimalDigits);
83
+ return String(resultFixed).substring(2, resultFixed.length);
84
+ };
85
+ return {
86
+ classes,
87
+ showSymbol,
88
+ checkPoint,
89
+ formatThousands,
90
+ formatDecimal
55
91
  };
56
92
  }
57
- }), k = ["innerHTML"], w = ["innerHTML"];
58
- function D(t, l, a, o, y, b) {
59
- return r(), i("view", {
60
- class: s(t.classes)
93
+ });
94
+ const _hoisted_1 = ["innerHTML"];
95
+ const _hoisted_2 = ["innerHTML"];
96
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
97
+ return openBlock(), createElementBlock("view", {
98
+ class: normalizeClass(_ctx.classes)
61
99
  }, [
62
- t.needSymbol && t.position == "before" ? (r(), i("view", {
100
+ _ctx.needSymbol && _ctx.position == "before" ? (openBlock(), createElementBlock("view", {
63
101
  key: 0,
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", {
102
+ class: normalizeClass(["nut-price--symbol", `nut-price--symbol-${_ctx.size}`]),
103
+ innerHTML: _ctx.showSymbol
104
+ }, null, 10, _hoisted_1)) : createCommentVNode("", true),
105
+ createElementVNode("view", {
106
+ class: normalizeClass(`nut-price--${_ctx.size}`)
107
+ }, toDisplayString(_ctx.formatThousands(_ctx.price)), 3),
108
+ _ctx.decimalDigits != 0 ? (openBlock(), createElementBlock("view", {
71
109
  key: 1,
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", {
110
+ class: normalizeClass(`nut-price--decimal-${_ctx.size}`)
111
+ }, ".", 2)) : createCommentVNode("", true),
112
+ createElementVNode("view", {
113
+ class: normalizeClass(`nut-price--decimal-${_ctx.size}`)
114
+ }, toDisplayString(_ctx.formatDecimal(_ctx.price)), 3),
115
+ _ctx.needSymbol && _ctx.position == "after" ? (openBlock(), createElementBlock("view", {
78
116
  key: 2,
79
- class: s(["nut-price--symbol", `nut-price--symbol-${t.size}`]),
80
- innerHTML: t.showSymbol
81
- }, null, 10, w)) : n("", !0)
117
+ class: normalizeClass(["nut-price--symbol", `nut-price--symbol-${_ctx.size}`]),
118
+ innerHTML: _ctx.showSymbol
119
+ }, null, 10, _hoisted_2)) : createCommentVNode("", true)
82
120
  ], 2);
83
121
  }
84
- const F = /* @__PURE__ */ h($, [["render", D]]);
122
+ const Price = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
85
123
  export {
86
- F as default
124
+ Price as default
87
125
  };