@nutui/nutui 3.1.22-beta.5 → 3.1.23-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 (168) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +3 -4
  3. package/dist/nutui.es.js +20412 -4214
  4. package/dist/nutui.umd.js +20518 -4216
  5. package/dist/packages/_es/ActionSheet.js +149 -17
  6. package/dist/packages/_es/Address.js +535 -110
  7. package/dist/packages/_es/AddressList.js +615 -113
  8. package/dist/packages/_es/Animate.js +59 -17
  9. package/dist/packages/_es/Audio.js +257 -53
  10. package/dist/packages/_es/AudioOperate.js +100 -13
  11. package/dist/packages/_es/Avatar.js +162 -38
  12. package/dist/packages/_es/AvatarGroup.js +73 -14
  13. package/dist/packages/_es/BackTop.js +156 -43
  14. package/dist/packages/_es/Badge.js +86 -14
  15. package/dist/packages/_es/Barrage.js +120 -41
  16. package/dist/packages/_es/Button.js +128 -23
  17. package/dist/packages/_es/Calendar.js +246 -30
  18. package/dist/packages/_es/CalendarItem.js +1 -1
  19. package/dist/packages/_es/Card.js +107 -10
  20. package/dist/packages/_es/Cascader.js +496 -147
  21. package/dist/packages/_es/Category.js +58 -15
  22. package/dist/packages/_es/CategoryPane.js +111 -11
  23. package/dist/packages/_es/Cell.js +108 -21
  24. package/dist/packages/_es/CellGroup.js +44 -9
  25. package/dist/packages/_es/Checkbox.js +134 -29
  26. package/dist/packages/_es/CheckboxGroup.js +79 -29
  27. package/dist/packages/_es/CircleProgress.js +150 -28
  28. package/dist/packages/_es/Col.js +56 -14
  29. package/dist/packages/_es/Collapse.js +109 -32
  30. package/dist/packages/_es/CollapseItem.js +253 -59
  31. package/dist/packages/_es/Comment.js +434 -64
  32. package/dist/packages/_es/ConfigProvider.js +20 -8
  33. package/dist/packages/_es/CountDown.js +238 -56
  34. package/dist/packages/_es/CountUp.js +539 -140
  35. package/dist/packages/_es/DatePicker.js +315 -98
  36. package/dist/packages/_es/Dialog.js +289 -60
  37. package/dist/packages/_es/Divider.js +65 -13
  38. package/dist/packages/_es/Drag.js +197 -56
  39. package/dist/packages/_es/Ecard.js +159 -24
  40. package/dist/packages/_es/Elevator.js +255 -58
  41. package/dist/packages/_es/Ellipsis.js +200 -58
  42. package/dist/packages/_es/Empty.js +71 -12
  43. package/dist/packages/_es/FixedNav.js +122 -15
  44. package/dist/packages/_es/Form.js +151 -64
  45. package/dist/packages/_es/FormItem.js +114 -15
  46. package/dist/packages/_es/Grid.js +6 -5
  47. package/dist/packages/_es/GridItem.js +144 -33
  48. package/dist/packages/_es/Icon.js +40 -15
  49. package/dist/packages/_es/Image.js +137 -26
  50. package/dist/packages/_es/ImagePreview.js +547 -76
  51. package/dist/packages/_es/Indicator.js +62 -15
  52. package/dist/packages/_es/InfiniteLoading.js +249 -57
  53. package/dist/packages/_es/Input.js +433 -51
  54. package/dist/packages/_es/InputNumber.js +160 -41
  55. package/dist/packages/_es/Layout.js +5 -4
  56. package/dist/packages/_es/List.js +106 -18
  57. package/dist/packages/_es/Menu.js +168 -44
  58. package/dist/packages/_es/MenuItem.js +173 -37
  59. package/dist/packages/_es/Navbar.js +192 -30
  60. package/dist/packages/_es/NoticeBar.js +380 -74
  61. package/dist/packages/_es/Notify.js +227 -72
  62. package/dist/packages/_es/NumberKeyboard.js +272 -41
  63. package/dist/packages/_es/OldPicker.js +457 -130
  64. package/dist/packages/_es/OverLay.js +98 -24
  65. package/dist/packages/_es/Pagination.js +157 -39
  66. package/dist/packages/_es/Picker.js +454 -129
  67. package/dist/packages/_es/Popover.js +957 -318
  68. package/dist/packages/_es/Popup.js +299 -55
  69. package/dist/packages/_es/Price.js +118 -16
  70. package/dist/packages/_es/Progress.js +146 -14
  71. package/dist/packages/_es/PullRefresh.js +339 -84
  72. package/dist/packages/_es/Radio.js +90 -22
  73. package/dist/packages/_es/RadioGroup.js +37 -8
  74. package/dist/packages/_es/Range.js +408 -83
  75. package/dist/packages/_es/Rate.js +192 -36
  76. package/dist/packages/_es/Row.js +64 -22
  77. package/dist/packages/_es/SearchBar.js +238 -37
  78. package/dist/packages/_es/ShortPassword.js +225 -35
  79. package/dist/packages/_es/SideNavBar.js +81 -24
  80. package/dist/packages/_es/SideNavBarItem.js +46 -11
  81. package/dist/packages/_es/Signature.js +160 -41
  82. package/dist/packages/_es/Skeleton.js +136 -20
  83. package/dist/packages/_es/Sku.js +491 -84
  84. package/dist/packages/_es/Step.js +115 -20
  85. package/dist/packages/_es/Steps.js +53 -18
  86. package/dist/packages/_es/Sticky.js +138 -53
  87. package/dist/packages/_es/SubSideNavBar.js +82 -17
  88. package/dist/packages/_es/Swipe.js +178 -41
  89. package/dist/packages/_es/Swiper.js +433 -121
  90. package/dist/packages/_es/SwiperItem.js +53 -22
  91. package/dist/packages/_es/Switch.js +116 -21
  92. package/dist/packages/_es/TabPane.js +39 -12
  93. package/dist/packages/_es/Tabbar.js +72 -17
  94. package/dist/packages/_es/TabbarItem.js +151 -29
  95. package/dist/packages/_es/Table.js +178 -18
  96. package/dist/packages/_es/Tabs.js +202 -43
  97. package/dist/packages/_es/Tag.js +97 -20
  98. package/dist/packages/_es/TextArea.js +160 -42
  99. package/dist/packages/_es/TimeDetail.js +79 -18
  100. package/dist/packages/_es/TimePannel.js +48 -14
  101. package/dist/packages/_es/TimeSelect.js +112 -15
  102. package/dist/packages/_es/Toast.js +310 -71
  103. package/dist/packages/_es/Uploader.js +455 -104
  104. package/dist/packages/_es/Video.js +332 -74
  105. package/dist/packages/_es/common.js +128 -38
  106. package/dist/packages/_es/component.js +76 -35
  107. package/dist/packages/_es/index.js +6 -5
  108. package/dist/packages/_es/index2.js +30 -9
  109. package/dist/packages/_es/index3.js +8 -6
  110. package/dist/packages/_es/index4.js +64 -13
  111. package/dist/packages/_es/index5.js +780 -164
  112. package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
  113. package/dist/packages/_es/pxCheck.js +5 -3
  114. package/dist/packages/_es/raf.js +15 -8
  115. package/dist/packages/imagepreview/index.scss +6 -1
  116. package/dist/packages/locale/lang/baseLang.js +3 -3
  117. package/dist/packages/locale/lang/en-US.js +105 -5
  118. package/dist/packages/locale/lang/id-ID.js +105 -5
  119. package/dist/packages/locale/lang/index.js +38 -16
  120. package/dist/packages/locale/lang/zh-CN.js +105 -5
  121. package/dist/packages/locale/lang/zh-TW.js +105 -5
  122. package/dist/packages/picker/index.scss +13 -0
  123. package/dist/smartips/attributes.json +8 -0
  124. package/dist/smartips/tags.json +3 -1
  125. package/dist/smartips/web-types.json +19 -1
  126. package/dist/style.css +1 -1
  127. package/dist/style.es.js +1 -1
  128. package/dist/styles/themes/default.scss +49 -49
  129. package/dist/styles/themes/jdb.scss +49 -49
  130. package/dist/styles/themes/jdt.scss +49 -49
  131. package/dist/styles/variables-jdb.scss +4 -1
  132. package/dist/styles/variables-jdt.scss +4 -1
  133. package/dist/styles/variables.scss +1 -1
  134. package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
  135. package/dist/types/__VUE/address/index.vue.d.ts +4 -4
  136. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  137. package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
  138. package/dist/types/__VUE/cell/index.vue.d.ts +2 -2
  139. package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
  140. package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
  141. package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
  142. package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
  143. package/dist/types/__VUE/ecard/index.vue.d.ts +2 -2
  144. package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
  145. package/dist/types/__VUE/grid/index.vue.d.ts +3 -3
  146. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
  147. package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
  148. package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
  149. package/dist/types/__VUE/input/index.vue.d.ts +2 -2
  150. package/dist/types/__VUE/menu/index.vue.d.ts +4 -4
  151. package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
  152. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
  153. package/dist/types/__VUE/oldpicker/index.vue.d.ts +3 -3
  154. package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
  155. package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
  156. package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
  157. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  158. package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
  159. package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
  160. package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
  161. package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
  162. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  163. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  164. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  165. package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
  166. package/dist/types/__VUE/toast/index.vue.d.ts +1 -1
  167. package/dist/types/index.d.ts +1 -1
  168. package/package.json +1 -2
@@ -1,62 +1,306 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref as e, reactive as o, computed as l, onMounted as n, onBeforeUnmount as i, onBeforeMount as t, onActivated as s, onDeactivated as c, watch as a, toRefs as r, resolveComponent as p, openBlock as d, createBlock as u, Teleport as v, normalizeClass as y, normalizeStyle as k, createCommentVNode as m, createVNode as C, Transition as f, withCtx as b, withDirectives as I, createElementVNode as x, renderSlot as S, createElementBlock as O, vShow as z } from "vue";
7
- import A, { overlayProps as w } from "./OverLay.js";
8
- import _ from "./Icon.js";
9
- import { c as h } from "./component.js";
10
- import { _ as g } from "./plugin-vue_export-helper.js";
6
+ import { ref, reactive, computed, onMounted, onBeforeUnmount, onBeforeMount, onActivated, onDeactivated, watch, toRefs, resolveComponent, openBlock, createBlock, Teleport, normalizeClass, normalizeStyle, createCommentVNode, createVNode, Transition, withCtx, withDirectives, createElementVNode, renderSlot, createElementBlock, vShow } from "vue";
7
+ import overlay, { overlayProps } from "./OverLay.js";
8
+ import _sfc_main$1 from "./Icon.js";
9
+ import { c as createComponent } from "./component.js";
10
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
11
11
  import "../locale/lang";
12
12
  import "./pxCheck.js";
13
- let B = 0;
14
- const { componentName: L, create: N } = h("popup");
15
- let $ = 2e3;
16
- const j = { ...w, position: { type: String, default: "center" }, transition: String, style: { type: Object }, popClass: { type: String, default: "" }, closeable: { type: Boolean, default: false }, closeIconPosition: { type: String, default: "top-right" }, closeIcon: { type: String, default: "close" }, destroyOnClose: { type: Boolean, default: true }, teleport: { type: [String, Element], default: "body" }, overlay: { type: Boolean, default: true }, round: { type: Boolean, default: false }, isWrapTeleport: { type: Boolean, default: true }, safeAreaInsetBottom: { type: Boolean, default: false } }, E = N({ components: { [A.name]: A, [_.name]: _ }, props: { ...j }, emits: ["click", "click-close-icon", "open", "close", "opend", "closed", "update:visible", "click-overlay"], setup(p2, { emit: d2 }) {
17
- const u2 = e(), v2 = o({ zIndex: p2.zIndex ? p2.zIndex : $, showSlot: true, transitionName: `popup-fade-${p2.position}`, overLayCount: 1, keepAlive: false, closed: p2.closeable }), [y2, k2] = (m2 = () => p2.lockScroll, [() => {
18
- m2() && (!B && document.body.classList.add("nut-overflow-hidden"), B++);
19
- }, () => {
20
- m2() && B && (B--, !B && document.body.classList.remove("nut-overflow-hidden"));
21
- }]);
22
- var m2;
23
- const C2 = l(() => ({ [L]: true, round: p2.round, [`popup-${p2.position}`]: true, [`popup-${p2.position}--safebottom`]: p2.position === "bottom" && p2.safeAreaInsetBottom, [p2.popClass]: true })), f2 = l(() => ({ zIndex: v2.zIndex, animationDuration: p2.duration ? `${p2.duration}s` : "initial", ...p2.style })), b2 = () => {
24
- p2.visible || (p2.zIndex !== void 0 && ($ = Number(p2.zIndex)), d2("update:visible", true), y2(), v2.zIndex = ++$), p2.destroyOnClose && (v2.showSlot = true), d2("open");
25
- }, I2 = () => {
26
- p2.visible && (k2(), d2("update:visible", false), p2.destroyOnClose && setTimeout(() => {
27
- v2.showSlot = false, d2("close");
28
- }, 1e3 * +p2.duration));
13
+ let count = 0;
14
+ const CLSNAME = "nut-overflow-hidden";
15
+ const useLockScroll = (isLock) => {
16
+ const lock = () => {
17
+ if (isLock()) {
18
+ !count && document.body.classList.add(CLSNAME);
19
+ count++;
20
+ }
29
21
  };
30
- return n(() => {
31
- p2.transition ? v2.transitionName = p2.transition : v2.transitionName = `popup-slide-${p2.position}`, p2.visible && b2();
32
- }), i(() => {
33
- p2.visible && I2();
34
- }), t(() => {
35
- p2.visible && k2();
36
- }), s(() => {
37
- v2.keepAlive && (d2("update:visible", true), v2.keepAlive = false);
38
- }), c(() => {
39
- p2.visible && (I2(), v2.keepAlive = true);
40
- }), a(() => p2.visible, (e2) => {
41
- e2 ? b2() : I2();
42
- }), a(() => p2.position, (e2) => {
43
- v2.transitionName = e2 === "center" ? "popup-fade" : `popup-slide-${e2}`;
44
- }), a(() => p2.closeable, (e2) => {
45
- v2.closed = e2;
46
- }), { ...r(v2), popStyle: f2, classes: C2, onClick: (e2) => {
47
- d2("click", e2);
48
- }, onClickCloseIcon: (e2) => {
49
- d2("click-close-icon", e2), I2();
50
- }, onClickOverlay: (e2) => {
51
- p2.closeOnClickOverlay && (d2("click-overlay", e2), I2());
52
- }, onOpened: (e2) => {
53
- d2("opend", e2);
54
- }, onClosed: (e2) => {
55
- d2("closed", e2);
56
- }, popupRef: u2 };
57
- } }), P = { key: 1 };
58
- var T = g(E, [["render", function(e2, o2, l2, n2, i2, t2) {
59
- const s2 = p("nut-overlay"), c2 = p("nut-icon");
60
- return e2.isWrapTeleport ? (d(), u(v, { key: 0, to: e2.teleport }, [e2.overlay ? (d(), u(s2, { key: 0, visible: e2.visible, "close-on-click-overlay": e2.closeOnClickOverlay, class: y(e2.overlayClass), style: k(e2.overlayStyle), "z-index": e2.zIndex, "lock-scroll": e2.lockScroll, duration: e2.duration, onClick: e2.onClickOverlay }, null, 8, ["visible", "close-on-click-overlay", "class", "style", "z-index", "lock-scroll", "duration", "onClick"])) : m("", true), C(f, { name: e2.transitionName, onAfterEnter: e2.onOpened, onAfterLeave: e2.onClosed }, { default: b(() => [I(x("view", { class: y(e2.classes), style: k(e2.popStyle), onClick: o2[1] || (o2[1] = (...o3) => e2.onClick && e2.onClick(...o3)), ref: "popupRef" }, [e2.showSlot ? S(e2.$slots, "default", { key: 0 }) : m("", true), e2.closed ? (d(), O("view", { key: 1, onClick: o2[0] || (o2[0] = (...o3) => e2.onClickCloseIcon && e2.onClickCloseIcon(...o3)), class: y(["nutui-popup__close-icon", "nutui-popup__close-icon--" + e2.closeIconPosition]) }, [C(c2, { name: e2.closeIcon, size: "12px" }, null, 8, ["name"])], 2)) : m("", true)], 6), [[z, e2.visible]])]), _: 3 }, 8, ["name", "onAfterEnter", "onAfterLeave"])], 8, ["to"])) : (d(), O("view", P, [e2.overlay ? (d(), u(s2, { key: 0, visible: e2.visible, "close-on-click-overlay": e2.closeOnClickOverlay, class: y(e2.overlayClass), style: k(e2.overlayStyle), "z-index": e2.zIndex, "lock-scroll": e2.lockScroll, duration: e2.duration, onClick: e2.onClickOverlay }, null, 8, ["visible", "close-on-click-overlay", "class", "style", "z-index", "lock-scroll", "duration", "onClick"])) : m("", true), C(f, { name: e2.transitionName, onAfterEnter: e2.onOpened, onAfterLeave: e2.onClosed }, { default: b(() => [I(x("view", { class: y(e2.classes), style: k(e2.popStyle), onClick: o2[3] || (o2[3] = (...o3) => e2.onClick && e2.onClick(...o3)) }, [e2.showSlot ? S(e2.$slots, "default", { key: 0 }) : m("", true), e2.closed ? (d(), O("view", { key: 1, onClick: o2[2] || (o2[2] = (...o3) => e2.onClickCloseIcon && e2.onClickCloseIcon(...o3)), class: y(["nutui-popup__close-icon", "nutui-popup__close-icon--" + e2.closeIconPosition]) }, [C(c2, { name: e2.closeIcon, size: "12px" }, null, 8, ["name"])], 2)) : m("", true)], 6), [[z, e2.visible]])]), _: 3 }, 8, ["name", "onAfterEnter", "onAfterLeave"])]));
61
- }]]);
62
- export { T as default, j as popupProps };
22
+ const unlock = () => {
23
+ if (isLock() && count) {
24
+ count--;
25
+ !count && document.body.classList.remove(CLSNAME);
26
+ }
27
+ };
28
+ return [lock, unlock];
29
+ };
30
+ const { componentName, create } = createComponent("popup");
31
+ let _zIndex = 2e3;
32
+ const popupProps = {
33
+ ...overlayProps,
34
+ position: {
35
+ type: String,
36
+ default: "center"
37
+ },
38
+ transition: String,
39
+ style: {
40
+ type: Object
41
+ },
42
+ popClass: {
43
+ type: String,
44
+ default: ""
45
+ },
46
+ closeable: {
47
+ type: Boolean,
48
+ default: false
49
+ },
50
+ closeIconPosition: {
51
+ type: String,
52
+ default: "top-right"
53
+ },
54
+ closeIcon: {
55
+ type: String,
56
+ default: "close"
57
+ },
58
+ destroyOnClose: {
59
+ type: Boolean,
60
+ default: true
61
+ },
62
+ teleport: {
63
+ type: [String, Element],
64
+ default: "body"
65
+ },
66
+ overlay: {
67
+ type: Boolean,
68
+ default: true
69
+ },
70
+ round: {
71
+ type: Boolean,
72
+ default: false
73
+ },
74
+ isWrapTeleport: {
75
+ type: Boolean,
76
+ default: true
77
+ },
78
+ safeAreaInsetBottom: {
79
+ type: Boolean,
80
+ default: false
81
+ }
82
+ };
83
+ const _sfc_main = create({
84
+ components: {
85
+ [overlay.name]: overlay,
86
+ [_sfc_main$1.name]: _sfc_main$1
87
+ },
88
+ props: {
89
+ ...popupProps
90
+ },
91
+ emits: ["click", "click-close-icon", "open", "close", "opend", "closed", "update:visible", "click-overlay"],
92
+ setup(props, { emit }) {
93
+ const popupRef = ref();
94
+ const state = reactive({
95
+ zIndex: props.zIndex ? props.zIndex : _zIndex,
96
+ showSlot: true,
97
+ transitionName: `popup-fade-${props.position}`,
98
+ overLayCount: 1,
99
+ keepAlive: false,
100
+ closed: props.closeable
101
+ });
102
+ const [lockScroll, unlockScroll] = useLockScroll(() => props.lockScroll);
103
+ const classes = computed(() => {
104
+ const prefixCls = componentName;
105
+ return {
106
+ [prefixCls]: true,
107
+ ["round"]: props.round,
108
+ [`popup-${props.position}`]: true,
109
+ [`popup-${props.position}--safebottom`]: props.position === "bottom" && props.safeAreaInsetBottom,
110
+ [props.popClass]: true
111
+ };
112
+ });
113
+ const popStyle = computed(() => {
114
+ return {
115
+ zIndex: state.zIndex,
116
+ animationDuration: props.duration ? `${props.duration}s` : "initial",
117
+ ...props.style
118
+ };
119
+ });
120
+ const open = () => {
121
+ if (!props.visible) {
122
+ if (props.zIndex !== void 0) {
123
+ _zIndex = Number(props.zIndex);
124
+ }
125
+ emit("update:visible", true);
126
+ lockScroll();
127
+ state.zIndex = ++_zIndex;
128
+ }
129
+ if (props.destroyOnClose) {
130
+ state.showSlot = true;
131
+ }
132
+ emit("open");
133
+ };
134
+ const close = () => {
135
+ if (props.visible) {
136
+ unlockScroll();
137
+ emit("update:visible", false);
138
+ if (props.destroyOnClose) {
139
+ setTimeout(() => {
140
+ state.showSlot = false;
141
+ emit("close");
142
+ }, +props.duration * 1e3);
143
+ }
144
+ }
145
+ };
146
+ const onClick = (e) => {
147
+ emit("click", e);
148
+ };
149
+ const onClickCloseIcon = (e) => {
150
+ emit("click-close-icon", e);
151
+ close();
152
+ };
153
+ const onClickOverlay = (e) => {
154
+ if (props.closeOnClickOverlay) {
155
+ emit("click-overlay", e);
156
+ close();
157
+ }
158
+ };
159
+ const onOpened = (e) => {
160
+ emit("opend", e);
161
+ };
162
+ const onClosed = (e) => {
163
+ emit("closed", e);
164
+ };
165
+ onMounted(() => {
166
+ props.transition ? state.transitionName = props.transition : state.transitionName = `popup-slide-${props.position}`;
167
+ props.visible && open();
168
+ });
169
+ onBeforeUnmount(() => {
170
+ props.visible && close();
171
+ });
172
+ onBeforeMount(() => {
173
+ if (props.visible) {
174
+ unlockScroll();
175
+ }
176
+ });
177
+ onActivated(() => {
178
+ if (state.keepAlive) {
179
+ emit("update:visible", true);
180
+ state.keepAlive = false;
181
+ }
182
+ });
183
+ onDeactivated(() => {
184
+ if (props.visible) {
185
+ close();
186
+ state.keepAlive = true;
187
+ }
188
+ });
189
+ watch(() => props.visible, (value) => {
190
+ if (value) {
191
+ open();
192
+ } else {
193
+ close();
194
+ }
195
+ });
196
+ watch(() => props.position, (value) => {
197
+ value === "center" ? state.transitionName = "popup-fade" : state.transitionName = `popup-slide-${value}`;
198
+ });
199
+ watch(() => props.closeable, (value) => {
200
+ state.closed = value;
201
+ });
202
+ return {
203
+ ...toRefs(state),
204
+ popStyle,
205
+ classes,
206
+ onClick,
207
+ onClickCloseIcon,
208
+ onClickOverlay,
209
+ onOpened,
210
+ onClosed,
211
+ popupRef
212
+ };
213
+ }
214
+ });
215
+ const _hoisted_1 = { key: 1 };
216
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
217
+ const _component_nut_overlay = resolveComponent("nut-overlay");
218
+ const _component_nut_icon = resolveComponent("nut-icon");
219
+ return _ctx.isWrapTeleport ? (openBlock(), createBlock(Teleport, {
220
+ key: 0,
221
+ to: _ctx.teleport
222
+ }, [
223
+ _ctx.overlay ? (openBlock(), createBlock(_component_nut_overlay, {
224
+ key: 0,
225
+ visible: _ctx.visible,
226
+ "close-on-click-overlay": _ctx.closeOnClickOverlay,
227
+ class: normalizeClass(_ctx.overlayClass),
228
+ style: normalizeStyle(_ctx.overlayStyle),
229
+ "z-index": _ctx.zIndex,
230
+ "lock-scroll": _ctx.lockScroll,
231
+ duration: _ctx.duration,
232
+ onClick: _ctx.onClickOverlay
233
+ }, null, 8, ["visible", "close-on-click-overlay", "class", "style", "z-index", "lock-scroll", "duration", "onClick"])) : createCommentVNode("", true),
234
+ createVNode(Transition, {
235
+ name: _ctx.transitionName,
236
+ onAfterEnter: _ctx.onOpened,
237
+ onAfterLeave: _ctx.onClosed
238
+ }, {
239
+ default: withCtx(() => [
240
+ withDirectives(createElementVNode("view", {
241
+ class: normalizeClass(_ctx.classes),
242
+ style: normalizeStyle(_ctx.popStyle),
243
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
244
+ ref: "popupRef"
245
+ }, [
246
+ _ctx.showSlot ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true),
247
+ _ctx.closed ? (openBlock(), createElementBlock("view", {
248
+ key: 1,
249
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClickCloseIcon && _ctx.onClickCloseIcon(...args)),
250
+ class: normalizeClass(["nutui-popup__close-icon", "nutui-popup__close-icon--" + _ctx.closeIconPosition])
251
+ }, [
252
+ createVNode(_component_nut_icon, {
253
+ name: _ctx.closeIcon,
254
+ size: "12px"
255
+ }, null, 8, ["name"])
256
+ ], 2)) : createCommentVNode("", true)
257
+ ], 6), [
258
+ [vShow, _ctx.visible]
259
+ ])
260
+ ]),
261
+ _: 3
262
+ }, 8, ["name", "onAfterEnter", "onAfterLeave"])
263
+ ], 8, ["to"])) : (openBlock(), createElementBlock("view", _hoisted_1, [
264
+ _ctx.overlay ? (openBlock(), createBlock(_component_nut_overlay, {
265
+ key: 0,
266
+ visible: _ctx.visible,
267
+ "close-on-click-overlay": _ctx.closeOnClickOverlay,
268
+ class: normalizeClass(_ctx.overlayClass),
269
+ style: normalizeStyle(_ctx.overlayStyle),
270
+ "z-index": _ctx.zIndex,
271
+ "lock-scroll": _ctx.lockScroll,
272
+ duration: _ctx.duration,
273
+ onClick: _ctx.onClickOverlay
274
+ }, null, 8, ["visible", "close-on-click-overlay", "class", "style", "z-index", "lock-scroll", "duration", "onClick"])) : createCommentVNode("", true),
275
+ createVNode(Transition, {
276
+ name: _ctx.transitionName,
277
+ onAfterEnter: _ctx.onOpened,
278
+ onAfterLeave: _ctx.onClosed
279
+ }, {
280
+ default: withCtx(() => [
281
+ withDirectives(createElementVNode("view", {
282
+ class: normalizeClass(_ctx.classes),
283
+ style: normalizeStyle(_ctx.popStyle),
284
+ onClick: _cache[3] || (_cache[3] = (...args) => _ctx.onClick && _ctx.onClick(...args))
285
+ }, [
286
+ _ctx.showSlot ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("", true),
287
+ _ctx.closed ? (openBlock(), createElementBlock("view", {
288
+ key: 1,
289
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.onClickCloseIcon && _ctx.onClickCloseIcon(...args)),
290
+ class: normalizeClass(["nutui-popup__close-icon", "nutui-popup__close-icon--" + _ctx.closeIconPosition])
291
+ }, [
292
+ createVNode(_component_nut_icon, {
293
+ name: _ctx.closeIcon,
294
+ size: "12px"
295
+ }, null, 8, ["name"])
296
+ ], 2)) : createCommentVNode("", true)
297
+ ], 6), [
298
+ [vShow, _ctx.visible]
299
+ ])
300
+ ]),
301
+ _: 3
302
+ }, 8, ["name", "onAfterEnter", "onAfterLeave"])
303
+ ]));
304
+ }
305
+ var Popup = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
306
+ export { Popup as default, popupProps };
@@ -1,21 +1,123 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { computed as e, openBlock as i, createElementBlock as t, normalizeClass as s, createCommentVNode as r, createElementVNode as o, toDisplayString as n } from "vue";
7
- import { c as l } from "./component.js";
8
- import { _ as a } from "./plugin-vue_export-helper.js";
6
+ import { computed, openBlock, createElementBlock, normalizeClass, createCommentVNode, createElementVNode, toDisplayString } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
9
  import "../locale/lang";
10
- const { componentName: m, create: p } = l("price"), c = p({ props: { price: { type: [Number, String], default: 0 }, needSymbol: { type: Boolean, default: true }, symbol: { type: String, default: "¥" }, decimalDigits: { type: [Number, String], default: 2 }, thousands: { type: Boolean, default: false }, position: { type: String, default: "before" }, size: { type: String, default: "large" } }, setup(i2) {
11
- const t2 = e(() => ({ [m]: true })), s2 = e(() => i2.needSymbol ? i2.symbol : ""), r2 = (e2) => String(e2).indexOf(".") > 0;
12
- return { classes: t2, showSymbol: s2, checkPoint: r2, formatThousands: (e2) => (Number(e2) == 0 && (e2 = 0), e2 = r2(e2) ? typeof (e2 = Number(e2).toFixed(i2.decimalDigits)).split(".") == "string" ? e2.split(".") : e2.split(".")[0] : e2.toString(), i2.thousands ? (e2 || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, "$1,") : e2), formatDecimal: (e2) => {
13
- Number(e2) == 0 && (e2 = 0), e2 = r2(e2) ? typeof (e2 = Number(e2).toFixed(i2.decimalDigits)).split(".") == "string" ? 0 : e2.split(".")[1] ? e2.split(".")[1] : 0 : 0;
14
- const t3 = Number("0." + e2).toFixed(i2.decimalDigits);
15
- return String(t3).substring(2, t3.length);
16
- } };
17
- } }), u = ["innerHTML"], d = ["innerHTML"];
18
- var y = a(c, [["render", function(e2, l2, a2, m2, p2, c2) {
19
- return i(), t("view", { class: s(e2.classes) }, [e2.needSymbol && e2.position == "before" ? (i(), t("view", { key: 0, class: s(["nut-price--symbol", `nut-price--symbol-${e2.size}`]), innerHTML: e2.showSymbol }, null, 10, u)) : r("", true), o("view", { class: s(`nut-price--${e2.size}`) }, n(e2.formatThousands(e2.price)), 3), e2.decimalDigits != 0 ? (i(), t("view", { key: 1, class: s(`nut-price--decimal-${e2.size}`) }, ".", 2)) : r("", true), o("view", { class: s(`nut-price--decimal-${e2.size}`) }, n(e2.formatDecimal(e2.price)), 3), e2.needSymbol && e2.position == "after" ? (i(), t("view", { key: 2, class: s(["nut-price--symbol", `nut-price--symbol-${e2.size}`]), innerHTML: e2.showSymbol }, null, 10, d)) : r("", true)], 2);
20
- }]]);
21
- export { y as default };
10
+ const { componentName, create } = createComponent("price");
11
+ const _sfc_main = create({
12
+ props: {
13
+ price: {
14
+ type: [Number, String],
15
+ default: 0
16
+ },
17
+ needSymbol: {
18
+ type: Boolean,
19
+ default: true
20
+ },
21
+ symbol: {
22
+ type: String,
23
+ default: "¥"
24
+ },
25
+ decimalDigits: {
26
+ type: [Number, String],
27
+ default: 2
28
+ },
29
+ thousands: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ position: {
34
+ type: String,
35
+ default: "before"
36
+ },
37
+ size: {
38
+ type: String,
39
+ default: "large"
40
+ }
41
+ },
42
+ setup(props) {
43
+ const classes = computed(() => {
44
+ return {
45
+ [componentName]: true
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();
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
91
+ };
92
+ }
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)
99
+ }, [
100
+ _ctx.needSymbol && _ctx.position == "before" ? (openBlock(), createElementBlock("view", {
101
+ key: 0,
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", {
109
+ key: 1,
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", {
116
+ key: 2,
117
+ class: normalizeClass(["nut-price--symbol", `nut-price--symbol-${_ctx.size}`]),
118
+ innerHTML: _ctx.showSymbol
119
+ }, null, 10, _hoisted_2)) : createCommentVNode("", true)
120
+ ], 2);
121
+ }
122
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
123
+ export { index as default };