@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,81 +1,236 @@
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 { reactive as e, onMounted as t, ref as o, watch as n, resolveComponent as i, openBlock as l, createBlock as s, withCtx as r, createElementVNode as u, normalizeClass as d, normalizeStyle as p, renderSlot as a, createElementBlock as c, Fragment as m, createTextVNode as y, toDisplayString as f, createVNode as g, render as v, h as C } from "vue";
7
- import { c as b } from "./component.js";
8
- import h from "./Popup.js";
9
- import { _ as k } from "./plugin-vue_export-helper.js";
6
+ import { reactive, onMounted, ref, watch, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createElementBlock, Fragment, createTextVNode, toDisplayString, createVNode, render, h } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import Popup from "./Popup.js";
9
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
10
  import "../locale/lang";
11
11
  import "./OverLay.js";
12
12
  import "./Icon.js";
13
13
  import "./pxCheck.js";
14
- const { componentName: T, create: w } = b("notify");
15
- var S = k(w({ components: { [h.name]: h }, props: { id: String, color: { type: String, default: "" }, msg: { type: String, default: "" }, duration: { type: Number, default: 3e3 }, className: { type: String, default: "" }, background: { type: String, default: "" }, type: { type: String, default: "danger" }, showPopup: { type: Boolean, default: false }, position: { type: String, default: "top" }, isWrapTeleport: { type: Boolean, default: true }, onClose: Function, onClick: Function, unmount: Function }, setup(i2, { slots: l2 }) {
16
- let s2 = null;
17
- const r2 = e({ mounted: false });
18
- t(() => {
19
- });
20
- const u2 = o(false), d2 = () => {
21
- s2 && (clearTimeout(s2), s2 = null);
22
- }, p2 = () => {
23
- r2.mounted = false;
24
- }, a2 = () => {
25
- d2(), i2.duration && (s2 = setTimeout(() => {
26
- p2();
27
- }, i2.duration));
14
+ const { componentName, create } = createComponent("notify");
15
+ const _sfc_main = create({
16
+ components: {
17
+ [Popup.name]: Popup
18
+ },
19
+ props: {
20
+ id: String,
21
+ color: { type: String, default: "" },
22
+ msg: { type: String, default: "" },
23
+ duration: { type: Number, default: 3e3 },
24
+ className: {
25
+ type: String,
26
+ default: ""
27
+ },
28
+ background: { type: String, default: "" },
29
+ type: {
30
+ type: String,
31
+ default: "danger"
32
+ },
33
+ showPopup: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ position: {
38
+ type: String,
39
+ default: "top"
40
+ },
41
+ isWrapTeleport: {
42
+ type: Boolean,
43
+ default: true
44
+ },
45
+ onClose: Function,
46
+ onClick: Function,
47
+ unmount: Function
48
+ },
49
+ setup(props, { slots }) {
50
+ let timer = null;
51
+ const state = reactive({
52
+ mounted: false
53
+ });
54
+ onMounted(() => {
55
+ });
56
+ const visible = ref(false);
57
+ const clickCover = () => {
58
+ props.onClick && props.onClick();
59
+ };
60
+ const clearTimer = () => {
61
+ if (timer) {
62
+ clearTimeout(timer);
63
+ timer = null;
64
+ }
65
+ };
66
+ const hide = () => {
67
+ state.mounted = false;
68
+ };
69
+ const show = () => {
70
+ clearTimer();
71
+ if (props.duration) {
72
+ timer = setTimeout(() => {
73
+ hide();
74
+ }, props.duration);
75
+ }
76
+ };
77
+ if (props.duration) {
78
+ show();
79
+ }
80
+ watch(() => props.duration, (val) => {
81
+ if (val) {
82
+ show();
83
+ }
84
+ });
85
+ const onAfterLeave = () => {
86
+ clearTimer();
87
+ props.unmount && props.unmount(props.id);
88
+ props.onClose && props.onClose();
89
+ };
90
+ return { state, hide, onAfterLeave, clickCover, visible };
91
+ }
92
+ });
93
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
94
+ const _component_nut_popup = resolveComponent("nut-popup");
95
+ return openBlock(), createBlock(_component_nut_popup, {
96
+ visible: _ctx.showPopup,
97
+ "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.showPopup = $event),
98
+ position: _ctx.position,
99
+ overlay: false,
100
+ isWrapTeleport: _ctx.isWrapTeleport
101
+ }, {
102
+ default: withCtx(() => [
103
+ createElementVNode("div", {
104
+ class: normalizeClass(["nut-notify", `nut-notify--${_ctx.type}`, _ctx.className]),
105
+ style: normalizeStyle({ color: _ctx.color, background: _ctx.background }),
106
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
107
+ }, [
108
+ _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
109
+ createTextVNode(toDisplayString(_ctx.msg), 1)
110
+ ], 64))
111
+ ], 6)
112
+ ]),
113
+ _: 3
114
+ }, 8, ["visible", "position", "isWrapTeleport"]);
115
+ }
116
+ var Notify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
117
+ const defaultOptions = {
118
+ type: "base",
119
+ showPopup: true,
120
+ visible: true,
121
+ msg: "",
122
+ color: void 0,
123
+ background: void 0,
124
+ duration: 3e3,
125
+ className: "",
126
+ onClosed: null,
127
+ onClick: null,
128
+ onOpened: null,
129
+ textTimer: null,
130
+ unmount: null
131
+ };
132
+ let idsMap = [];
133
+ let optsMap = [];
134
+ const clearNotify = (id) => {
135
+ if (id) {
136
+ const container = document.getElementById(id);
137
+ optsMap = optsMap.filter((item) => item.id !== id);
138
+ idsMap = idsMap.filter((item) => item !== id);
139
+ if (container) {
140
+ document.body.removeChild(container);
141
+ }
142
+ } else {
143
+ idsMap.forEach((item) => {
144
+ const container = document.getElementById(item);
145
+ if (container) {
146
+ document.body.removeChild(container);
147
+ }
148
+ });
149
+ optsMap = [];
150
+ idsMap = [];
151
+ }
152
+ };
153
+ const updateNotify = (opts) => {
154
+ const container = document.getElementById(opts.id);
155
+ if (container) {
156
+ const currentOpt = optsMap.find((item) => item.id === opts.id);
157
+ if (currentOpt) {
158
+ opts = { ...defaultOptions, ...currentOpt, ...opts };
159
+ } else {
160
+ opts = { ...defaultOptions, ...opts };
161
+ }
162
+ const instance = createVNode(Notify, opts);
163
+ render(instance, container);
164
+ return instance.component.ctx;
165
+ }
166
+ };
167
+ const mountNotify = (opts) => {
168
+ opts.unmount = clearNotify;
169
+ let _id;
170
+ if (opts.id) {
171
+ _id = opts.id;
172
+ if (idsMap.find((item) => item === opts.id)) {
173
+ return updateNotify(opts);
174
+ }
175
+ } else {
176
+ _id = new Date().getTime() + "";
177
+ }
178
+ opts = { ...defaultOptions, ...opts };
179
+ opts.id = _id;
180
+ idsMap.push(opts.id);
181
+ optsMap.push(opts);
182
+ const root = document.createElement("view");
183
+ root.id = "notify-" + opts.id;
184
+ const Wrapper = {
185
+ setup() {
186
+ opts.teleport = `#notify-${opts.id}`;
187
+ onMounted(() => {
188
+ setTimeout(() => {
189
+ document.body.removeChild(root);
190
+ }, opts.duration);
191
+ });
192
+ return () => {
193
+ return h(Notify, opts);
194
+ };
195
+ }
28
196
  };
29
- i2.duration && a2(), n(() => i2.duration, (e2) => {
30
- e2 && a2();
31
- });
32
- return { state: r2, hide: p2, onAfterLeave: () => {
33
- d2(), i2.unmount && i2.unmount(i2.id), i2.onClose && i2.onClose();
34
- }, clickCover: () => {
35
- i2.onClick && i2.onClick();
36
- }, visible: u2 };
37
- } }), [["render", function(e2, t2, o2, n2, g2, v2) {
38
- const C2 = i("nut-popup");
39
- return l(), s(C2, { visible: e2.showPopup, "onUpdate:visible": t2[1] || (t2[1] = (t3) => e2.showPopup = t3), position: e2.position, overlay: false, isWrapTeleport: e2.isWrapTeleport }, { default: r(() => [u("div", { class: d(["nut-notify", `nut-notify--${e2.type}`, e2.className]), style: p({ color: e2.color, background: e2.background }), onClick: t2[0] || (t2[0] = (...t3) => e2.clickCover && e2.clickCover(...t3)) }, [e2.$slots.default ? a(e2.$slots, "default", { key: 0 }) : (l(), c(m, { key: 1 }, [y(f(e2.msg), 1)], 64))], 6)]), _: 3 }, 8, ["visible", "position", "isWrapTeleport"]);
40
- }]]);
41
- const j = { type: "base", showPopup: true, visible: true, msg: "", color: void 0, background: void 0, duration: 3e3, className: "", onClosed: null, onClick: null, onOpened: null, textTimer: null, unmount: null };
42
- let x = [], P = [];
43
- const B = (e2) => {
44
- if (e2) {
45
- const t2 = document.getElementById(e2);
46
- P = P.filter((t3) => t3.id !== e2), x = x.filter((t3) => t3 !== e2), t2 && document.body.removeChild(t2);
47
- } else
48
- x.forEach((e3) => {
49
- const t2 = document.getElementById(e3);
50
- t2 && document.body.removeChild(t2);
51
- }), P = [], x = [];
52
- }, E = (e2) => {
53
- let o2;
54
- if (e2.unmount = B, e2.id) {
55
- if (o2 = e2.id, x.find((t2) => t2 === e2.id))
56
- return ((e3) => {
57
- const t2 = document.getElementById(e3.id);
58
- if (t2) {
59
- const o3 = P.find((t3) => t3.id === e3.id);
60
- e3 = o3 ? { ...j, ...o3, ...e3 } : { ...j, ...e3 };
61
- const n3 = g(S, e3);
62
- return v(n3, t2), n3.component.ctx;
63
- }
64
- })(e2);
65
- } else
66
- o2 = new Date().getTime() + "";
67
- (e2 = { ...j, ...e2 }).id = o2, x.push(e2.id), P.push(e2);
68
- const n2 = document.createElement("view");
69
- n2.id = "notify-" + e2.id;
70
- const i2 = g({ setup: () => (e2.teleport = `#notify-${e2.id}`, t(() => {
71
- setTimeout(() => {
72
- document.body.removeChild(n2);
73
- }, e2.duration);
74
- }), () => C(S, e2)) });
75
- document.body.appendChild(n2), v(i2, n2);
76
- }, N = { text: (e2, t2 = {}) => E({ ...t2, msg: e2 }), primary: (e2, t2 = {}) => E({ ...t2, msg: e2, type: "primary" }), success: (e2, t2 = {}) => E({ ...t2, msg: e2, type: "success" }), danger: (e2, t2 = {}) => E({ ...t2, msg: e2, type: "danger" }), warn: (e2, t2 = {}) => E({ ...t2, msg: e2, type: "warning" }), hide() {
77
- B();
78
- }, install(e2) {
79
- e2.use(S), e2.config.globalProperties.$notify = N;
80
- } };
81
- export { S as Notify, N as NotifyFunction, N as default };
197
+ const instance = createVNode(Wrapper);
198
+ document.body.appendChild(root);
199
+ render(instance, root);
200
+ };
201
+ const errorMsg = (msg) => {
202
+ if (!msg) {
203
+ console.warn("[NutUI Notify]: msg\u4E0D\u80FD\u4E3A\u7A7A");
204
+ return;
205
+ }
206
+ };
207
+ const NotifyFunction = {
208
+ text(msg, obj = {}) {
209
+ errorMsg(msg);
210
+ return mountNotify({ ...obj, msg });
211
+ },
212
+ primary(msg, obj = {}) {
213
+ errorMsg(msg);
214
+ return mountNotify({ ...obj, msg, type: "primary" });
215
+ },
216
+ success(msg, obj = {}) {
217
+ errorMsg(msg);
218
+ return mountNotify({ ...obj, msg, type: "success" });
219
+ },
220
+ danger(msg, obj = {}) {
221
+ errorMsg(msg);
222
+ return mountNotify({ ...obj, msg, type: "danger" });
223
+ },
224
+ warn(msg, obj = {}) {
225
+ errorMsg(msg);
226
+ return mountNotify({ ...obj, msg, type: "warning" });
227
+ },
228
+ hide() {
229
+ clearNotify();
230
+ },
231
+ install(app) {
232
+ app.use(Notify);
233
+ app.config.globalProperties.$notify = NotifyFunction;
234
+ }
235
+ };
236
+ export { Notify, NotifyFunction, NotifyFunction as default };
@@ -1,47 +1,278 @@
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, computed as t, watch as o, onMounted as l, resolveComponent as a, openBlock as r, createBlock as n, withCtx as s, createElementVNode as i, createElementBlock as u, toDisplayString as d, createCommentVNode as p, Fragment as c, renderList as y, normalizeClass as m, createTextVNode as h } from "vue";
7
- import { c as v } from "./component.js";
8
- import { _ as f } from "./plugin-vue_export-helper.js";
6
+ import { ref, computed, watch, onMounted, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, createElementBlock, toDisplayString, createCommentVNode, Fragment, renderList, normalizeClass, createTextVNode } 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 { create: b, translate: g } = v("numberkeyboard"), k = b({ props: { confirmText: { type: String, default: "" }, title: { type: String, default: "" }, visible: { type: Boolean, default: false }, type: { type: String, default: "default" }, customKey: { type: Array, default: () => [] }, value: { type: String, default: "" }, maxlength: { type: [Number, String], default: 6 }, randomKeys: { type: Boolean, default: false }, overlay: { type: Boolean, default: true }, isWrapTeleport: { type: Boolean, default: true }, teleport: { type: [String, Element], default: "body" }, popClass: { type: String, default: "" } }, emits: ["input", "delete", "close", "update:value"], setup(a2, { emit: r2 }) {
11
- const n2 = e(void 0), s2 = e(a2.visible), i2 = e();
12
- function u2() {
13
- const { customKey: e2 } = a2;
14
- let t2 = { id: "lock", type: "lock" }, o2 = Array.isArray(e2) ? e2 : [e2];
15
- return o2.length === 1 && (t2 = { id: o2[0], type: "custom" }), [...d2(), t2, { id: 0, type: "number" }, { id: "delete", type: "delete" }];
10
+ const { create, translate } = createComponent("numberkeyboard");
11
+ const _sfc_main = create({
12
+ props: {
13
+ confirmText: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ title: {
18
+ type: String,
19
+ default: ""
20
+ },
21
+ visible: {
22
+ type: Boolean,
23
+ default: false
24
+ },
25
+ type: {
26
+ type: String,
27
+ default: "default"
28
+ },
29
+ customKey: {
30
+ type: Array,
31
+ default: () => []
32
+ },
33
+ value: {
34
+ type: String,
35
+ default: ""
36
+ },
37
+ maxlength: {
38
+ type: [Number, String],
39
+ default: 6
40
+ },
41
+ randomKeys: {
42
+ type: Boolean,
43
+ default: false
44
+ },
45
+ overlay: {
46
+ type: Boolean,
47
+ default: true
48
+ },
49
+ isWrapTeleport: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ teleport: {
54
+ type: [String, Element],
55
+ default: "body"
56
+ },
57
+ popClass: {
58
+ type: String,
59
+ default: ""
60
+ }
61
+ },
62
+ emits: ["input", "delete", "close", "update:value"],
63
+ setup(props, { emit }) {
64
+ const clickKeyIndex = ref(void 0);
65
+ const show = ref(props.visible);
66
+ const root = ref();
67
+ function defaultKey() {
68
+ const { customKey } = props;
69
+ let object = {
70
+ id: "lock",
71
+ type: "lock"
72
+ };
73
+ let customKeys = Array.isArray(customKey) ? customKey : [customKey];
74
+ if (customKeys.length === 1) {
75
+ object = {
76
+ id: customKeys[0],
77
+ type: "custom"
78
+ };
79
+ }
80
+ return [...getBasicKeys(), object, { id: 0, type: "number" }, { id: "delete", type: "delete" }];
81
+ }
82
+ function getBasicKeys() {
83
+ const keys = [];
84
+ for (let i = 1; i <= 9; i++) {
85
+ keys.push({ id: i, type: "number" });
86
+ }
87
+ if (props.randomKeys) {
88
+ return keys.sort(() => Math.random() > 0.5 ? 1 : -1);
89
+ }
90
+ return keys;
91
+ }
92
+ function genCustomKeys() {
93
+ const keys = getBasicKeys();
94
+ const { customKey } = props;
95
+ let customKeys = Array.isArray(customKey) ? customKey : [customKey];
96
+ if (customKeys.length > 2) {
97
+ customKeys = [customKeys[0], customKeys[1]];
98
+ }
99
+ if (customKeys.length === 1) {
100
+ if (props.title) {
101
+ keys.push({ id: customKeys[0], type: "custom" }, { id: 0, type: "number" }, { id: "delete", type: "delete" });
102
+ } else {
103
+ keys.push({ id: 0, type: "number" }, { id: customKeys[0], type: "custom" });
104
+ }
105
+ } else if (customKeys.length === 2) {
106
+ keys.push({ id: customKeys[0], type: "custom" }, { id: 0, type: "number" }, { id: customKeys[1], type: "custom" });
107
+ if (props.title) {
108
+ keys.push({ id: "delete", type: "delete" });
109
+ }
110
+ } else {
111
+ keys.push({ id: 0, type: "number" });
112
+ }
113
+ return keys;
114
+ }
115
+ const keysList = computed(() => {
116
+ if (props.type == "rightColumn" || props.title != "") {
117
+ return genCustomKeys();
118
+ }
119
+ return defaultKey();
120
+ });
121
+ watch(() => props.visible, (value) => {
122
+ show.value = value;
123
+ });
124
+ function onTouchstart(item, event) {
125
+ event.stopPropagation();
126
+ clickKeyIndex.value = item.id;
127
+ if (item.type == "number" || item.type == "custom") {
128
+ emit("input", item.id);
129
+ if (props.value.length < props.maxlength) {
130
+ emit("update:value", props.value + item.id);
131
+ }
132
+ }
133
+ if (item.type == "lock") {
134
+ closeBoard();
135
+ }
136
+ if (item.type == "delete") {
137
+ emit("delete");
138
+ emit("update:value", props.value.slice(0, props.value.length - 1));
139
+ }
140
+ }
141
+ function onTouchMove(id, event) {
142
+ event.stopPropagation();
143
+ }
144
+ function onTouchEnd(event) {
145
+ event.preventDefault();
146
+ clickKeyIndex.value = void 0;
147
+ }
148
+ function closeBoard() {
149
+ emit("close");
150
+ }
151
+ onMounted(() => {
152
+ });
153
+ return {
154
+ clickKeyIndex,
155
+ defaultKey,
156
+ closeBoard,
157
+ onTouchEnd,
158
+ onTouchMove,
159
+ onTouchstart,
160
+ keysList,
161
+ genCustomKeys,
162
+ getBasicKeys,
163
+ root,
164
+ show,
165
+ translate
166
+ };
16
167
  }
17
- function d2() {
18
- const e2 = [];
19
- for (let t2 = 1; t2 <= 9; t2++)
20
- e2.push({ id: t2, type: "number" });
21
- return a2.randomKeys ? e2.sort(() => Math.random() > 0.5 ? 1 : -1) : e2;
22
- }
23
- function p2() {
24
- const e2 = d2(), { customKey: t2 } = a2;
25
- let o2 = Array.isArray(t2) ? t2 : [t2];
26
- return o2.length > 2 && (o2 = [o2[0], o2[1]]), o2.length === 1 ? a2.title ? e2.push({ id: o2[0], type: "custom" }, { id: 0, type: "number" }, { id: "delete", type: "delete" }) : e2.push({ id: 0, type: "number" }, { id: o2[0], type: "custom" }) : o2.length === 2 ? (e2.push({ id: o2[0], type: "custom" }, { id: 0, type: "number" }, { id: o2[1], type: "custom" }), a2.title && e2.push({ id: "delete", type: "delete" })) : e2.push({ id: 0, type: "number" }), e2;
27
- }
28
- const c2 = t(() => a2.type == "rightColumn" || a2.title != "" ? p2() : u2());
29
- function y2() {
30
- r2("close");
31
- }
32
- return o(() => a2.visible, (e2) => {
33
- s2.value = e2;
34
- }), l(() => {
35
- }), { clickKeyIndex: n2, defaultKey: u2, closeBoard: y2, onTouchEnd: function(e2) {
36
- e2.preventDefault(), n2.value = void 0;
37
- }, onTouchMove: function(e2, t2) {
38
- t2.stopPropagation();
39
- }, onTouchstart: function(e2, t2) {
40
- t2.stopPropagation(), n2.value = e2.id, e2.type != "number" && e2.type != "custom" || (r2("input", e2.id), a2.value.length < a2.maxlength && r2("update:value", a2.value + e2.id)), e2.type == "lock" && y2(), e2.type == "delete" && (r2("delete"), r2("update:value", a2.value.slice(0, a2.value.length - 1)));
41
- }, keysList: c2, genCustomKeys: p2, getBasicKeys: d2, root: i2, show: s2, translate: g };
42
- } }), T = { class: "nut-numberkeyboard", ref: "root" }, K = { key: 0, class: "number-board-header" }, C = { class: "tit" }, x = { class: "number-board-body" }, B = { class: "number-board" }, E = ["onTouchstart", "onTouchmove"], w = { key: 1, src: "https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png" }, A = { key: 2, src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png" }, S = { key: 0, class: "number-board-sidebar" }, j = { class: "key-board-wrapper" }, I = [i("img", { src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png" }, null, -1)];
43
- var M = f(k, [["render", function(e2, t2, o2, l2, v2, f2) {
44
- const b2 = a("nut-popup");
45
- return r(), n(b2, { visible: e2.show, "onUpdate:visible": t2[6] || (t2[6] = (t3) => e2.show = t3), position: "bottom", teleport: e2.teleport, popClass: e2.popClass, overlay: e2.overlay, onClickOverlay: t2[7] || (t2[7] = (t3) => e2.closeBoard()), isWrapTeleport: e2.isWrapTeleport, "overlay-class": "nut-numberkeyboard-overlay" }, { default: s(() => [i("div", T, [e2.title ? (r(), u("div", K, [i("h3", C, d(e2.title), 1), i("span", { class: "keyboard-close", onClick: t2[0] || (t2[0] = (t3) => e2.closeBoard()) }, d(e2.translate("done")), 1)])) : p("", true), i("div", x, [i("div", B, [(r(true), u(c, null, y(e2.keysList, (o3) => (r(), u("div", { class: m(["key-board-wrapper", { "key-board-wrapper-large": o3.id == 0 && e2.type == "rightColumn" && Array.isArray(e2.customKey) && e2.customKey.length == 1 }]), key: "key" + o3.id }, [i("div", { class: m(["key", { active: o3.id == e2.clickKeyIndex }, { lock: o3.type == "lock" }, { delete: o3.type == "delete" }]), onTouchstart: (t3) => e2.onTouchstart(o3, t3), onTouchmove: (t3) => e2.onTouchMove(o3, t3), onTouchend: t2[1] || (t2[1] = (t3) => e2.onTouchEnd(t3)) }, [o3.type == "number" || o3.type == "custom" ? (r(), u(c, { key: 0 }, [h(d(o3.id), 1)], 64)) : p("", true), o3.type == "lock" ? (r(), u("img", w)) : p("", true), o3.type == "delete" ? (r(), u("img", A)) : p("", true)], 42, E)], 2))), 128))]), e2.type == "rightColumn" ? (r(), u("div", S, [i("div", j, [i("div", { class: m(["key", { active: e2.clickKeyIndex == "delete" }]), onTouchstart: t2[2] || (t2[2] = (t3) => e2.onTouchstart({ id: "delete", type: "delete" }, t3)), onTouchmove: t2[3] || (t2[3] = (t3) => e2.onTouchMove({ id: "delete", type: "delete" }, t3)), onTouchend: t2[4] || (t2[4] = (...t3) => e2.onTouchEnd && e2.onTouchEnd(...t3)) }, I, 34)]), e2.title == "" ? (r(), u("div", { key: 0, class: "key-board-wrapper key-board-finish", onClick: t2[5] || (t2[5] = (t3) => e2.closeBoard()) }, [i("div", { class: m(["key", "finish", { activeFinsh: e2.clickKeyIndex == "finish" }]) }, d(e2.confirmText || e2.translate("done")), 3)])) : p("", true)])) : p("", true)])], 512)]), _: 1 }, 8, ["visible", "teleport", "popClass", "overlay", "isWrapTeleport"]);
46
- }]]);
47
- export { M as default };
168
+ });
169
+ const _hoisted_1 = {
170
+ class: "nut-numberkeyboard",
171
+ ref: "root"
172
+ };
173
+ const _hoisted_2 = {
174
+ key: 0,
175
+ class: "number-board-header"
176
+ };
177
+ const _hoisted_3 = { class: "tit" };
178
+ const _hoisted_4 = { class: "number-board-body" };
179
+ const _hoisted_5 = { class: "number-board" };
180
+ const _hoisted_6 = ["onTouchstart", "onTouchmove"];
181
+ const _hoisted_7 = {
182
+ key: 1,
183
+ src: "https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png"
184
+ };
185
+ const _hoisted_8 = {
186
+ key: 2,
187
+ src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png"
188
+ };
189
+ const _hoisted_9 = {
190
+ key: 0,
191
+ class: "number-board-sidebar"
192
+ };
193
+ const _hoisted_10 = { class: "key-board-wrapper" };
194
+ const _hoisted_11 = /* @__PURE__ */ createElementVNode("img", { src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png" }, null, -1);
195
+ const _hoisted_12 = [
196
+ _hoisted_11
197
+ ];
198
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
199
+ const _component_nut_popup = resolveComponent("nut-popup");
200
+ return openBlock(), createBlock(_component_nut_popup, {
201
+ visible: _ctx.show,
202
+ "onUpdate:visible": _cache[6] || (_cache[6] = ($event) => _ctx.show = $event),
203
+ position: "bottom",
204
+ teleport: _ctx.teleport,
205
+ popClass: _ctx.popClass,
206
+ overlay: _ctx.overlay,
207
+ onClickOverlay: _cache[7] || (_cache[7] = ($event) => _ctx.closeBoard()),
208
+ isWrapTeleport: _ctx.isWrapTeleport,
209
+ "overlay-class": "nut-numberkeyboard-overlay"
210
+ }, {
211
+ default: withCtx(() => [
212
+ createElementVNode("div", _hoisted_1, [
213
+ _ctx.title ? (openBlock(), createElementBlock("div", _hoisted_2, [
214
+ createElementVNode("h3", _hoisted_3, toDisplayString(_ctx.title), 1),
215
+ createElementVNode("span", {
216
+ class: "keyboard-close",
217
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.closeBoard())
218
+ }, toDisplayString(_ctx.translate("done")), 1)
219
+ ])) : createCommentVNode("", true),
220
+ createElementVNode("div", _hoisted_4, [
221
+ createElementVNode("div", _hoisted_5, [
222
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.keysList, (item) => {
223
+ return openBlock(), createElementBlock("div", {
224
+ class: normalizeClass([
225
+ "key-board-wrapper",
226
+ {
227
+ "key-board-wrapper-large": item.id == 0 && _ctx.type == "rightColumn" && Array.isArray(_ctx.customKey) && _ctx.customKey.length == 1
228
+ }
229
+ ]),
230
+ key: "key" + item.id
231
+ }, [
232
+ createElementVNode("div", {
233
+ class: normalizeClass([
234
+ "key",
235
+ { active: item.id == _ctx.clickKeyIndex },
236
+ { lock: item.type == "lock" },
237
+ { delete: item.type == "delete" }
238
+ ]),
239
+ onTouchstart: (event) => _ctx.onTouchstart(item, event),
240
+ onTouchmove: (event) => _ctx.onTouchMove(item, event),
241
+ onTouchend: _cache[1] || (_cache[1] = (event) => _ctx.onTouchEnd(event))
242
+ }, [
243
+ item.type == "number" || item.type == "custom" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
244
+ createTextVNode(toDisplayString(item.id), 1)
245
+ ], 64)) : createCommentVNode("", true),
246
+ item.type == "lock" ? (openBlock(), createElementBlock("img", _hoisted_7)) : createCommentVNode("", true),
247
+ item.type == "delete" ? (openBlock(), createElementBlock("img", _hoisted_8)) : createCommentVNode("", true)
248
+ ], 42, _hoisted_6)
249
+ ], 2);
250
+ }), 128))
251
+ ]),
252
+ _ctx.type == "rightColumn" ? (openBlock(), createElementBlock("div", _hoisted_9, [
253
+ createElementVNode("div", _hoisted_10, [
254
+ createElementVNode("div", {
255
+ class: normalizeClass(["key", { active: _ctx.clickKeyIndex == "delete" }]),
256
+ onTouchstart: _cache[2] || (_cache[2] = (event) => _ctx.onTouchstart({ id: "delete", type: "delete" }, event)),
257
+ onTouchmove: _cache[3] || (_cache[3] = (event) => _ctx.onTouchMove({ id: "delete", type: "delete" }, event)),
258
+ onTouchend: _cache[4] || (_cache[4] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
259
+ }, _hoisted_12, 34)
260
+ ]),
261
+ _ctx.title == "" ? (openBlock(), createElementBlock("div", {
262
+ key: 0,
263
+ class: "key-board-wrapper key-board-finish",
264
+ onClick: _cache[5] || (_cache[5] = ($event) => _ctx.closeBoard())
265
+ }, [
266
+ createElementVNode("div", {
267
+ class: normalizeClass(["key", "finish", { activeFinsh: _ctx.clickKeyIndex == "finish" }])
268
+ }, toDisplayString(_ctx.confirmText || _ctx.translate("done")), 3)
269
+ ])) : createCommentVNode("", true)
270
+ ])) : createCommentVNode("", true)
271
+ ])
272
+ ], 512)
273
+ ]),
274
+ _: 1
275
+ }, 8, ["visible", "teleport", "popClass", "overlay", "isWrapTeleport"]);
276
+ }
277
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
278
+ export { index as default };