@nutui/nutui 3.1.6 → 3.1.7

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 (92) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/nutui.d.ts +7 -1
  3. package/dist/nutui.es.js +1097 -517
  4. package/dist/nutui.umd.js +1158 -571
  5. package/dist/packages/_es/ActionSheet.js +158 -0
  6. package/dist/packages/_es/Address.js +525 -0
  7. package/dist/packages/_es/Avatar.js +87 -0
  8. package/dist/packages/_es/BackTop.js +159 -0
  9. package/dist/packages/_es/Badge.js +90 -0
  10. package/dist/packages/_es/Barrage.js +118 -0
  11. package/dist/packages/_es/Button.js +124 -0
  12. package/dist/packages/_es/Calendar.js +700 -0
  13. package/dist/packages/_es/Cell.js +95 -0
  14. package/dist/packages/_es/CellGroup.js +42 -0
  15. package/dist/packages/_es/Checkbox.js +109 -0
  16. package/dist/packages/_es/CheckboxGroup.js +62 -0
  17. package/dist/packages/_es/CircleProgress.js +109 -0
  18. package/dist/packages/_es/Col.js +53 -0
  19. package/dist/packages/_es/Collapse.js +89 -0
  20. package/dist/packages/_es/CollapseItem.js +257 -0
  21. package/dist/packages/_es/CountDown.js +224 -0
  22. package/dist/packages/_es/CountUp.js +547 -0
  23. package/dist/packages/_es/DatePicker.js +282 -0
  24. package/dist/packages/_es/Dialog.js +313 -0
  25. package/dist/packages/_es/Divider.js +49 -0
  26. package/dist/packages/_es/Drag.js +198 -0
  27. package/dist/packages/_es/Elevator.js +207 -0
  28. package/dist/packages/_es/FixedNav.js +127 -0
  29. package/dist/packages/_es/Icon.js +44 -0
  30. package/dist/packages/_es/ImagePreview.js +109 -0
  31. package/dist/packages/_es/InfiniteLoading.js +265 -0
  32. package/dist/packages/_es/Input.js +183 -0
  33. package/dist/packages/_es/InputNumber.js +172 -0
  34. package/dist/packages/_es/Layout.js +10 -0
  35. package/dist/packages/_es/MenuItem.js +180 -0
  36. package/dist/packages/_es/Navbar.js +160 -0
  37. package/dist/packages/_es/NoticeBar.js +389 -0
  38. package/dist/packages/_es/Notify.js +233 -0
  39. package/dist/packages/_es/NumberKeyboard.js +248 -0
  40. package/dist/packages/_es/OverLay.js +118 -0
  41. package/dist/packages/_es/Pagination.js +163 -0
  42. package/dist/packages/_es/Picker.js +485 -0
  43. package/dist/packages/_es/Popover.js +157 -0
  44. package/dist/packages/_es/Popup.js +268 -0
  45. package/dist/packages/_es/Price.js +104 -0
  46. package/dist/packages/_es/Progress.js +131 -0
  47. package/dist/packages/_es/Radio.js +72 -0
  48. package/dist/packages/_es/RadioGroup.js +37 -0
  49. package/dist/packages/_es/Range.js +350 -0
  50. package/dist/packages/_es/Rate.js +129 -0
  51. package/dist/packages/_es/Row.js +61 -0
  52. package/dist/packages/_es/ShortPassword.js +221 -0
  53. package/dist/packages/_es/Signature.js +167 -0
  54. package/dist/packages/_es/Step.js +116 -0
  55. package/dist/packages/_es/Steps.js +52 -0
  56. package/dist/packages/_es/Swipe.js +193 -0
  57. package/dist/packages/_es/Swiper.js +429 -0
  58. package/dist/packages/_es/SwiperItem.js +60 -0
  59. package/dist/packages/_es/Switch.js +90 -0
  60. package/dist/packages/_es/Tab.js +179 -0
  61. package/dist/packages/_es/TabPane.js +42 -0
  62. package/dist/packages/_es/TabPanel.js +30 -0
  63. package/dist/packages/_es/Tabbar.js +73 -0
  64. package/dist/packages/_es/TabbarItem.js +142 -0
  65. package/dist/packages/_es/Tag.js +98 -0
  66. package/dist/packages/_es/TextArea.js +127 -0
  67. package/dist/packages/_es/Toast.js +317 -0
  68. package/dist/packages/_es/Uploader.js +400 -0
  69. package/dist/packages/_es/Video.js +405 -0
  70. package/dist/packages/_es/component.js +26 -0
  71. package/dist/packages/_es/index.js +64 -0
  72. package/dist/packages/_es/index2.js +13 -0
  73. package/dist/packages/_es/plugin-vue_export-helper.js +12 -0
  74. package/dist/packages/_es/pxCheck.js +9 -0
  75. package/dist/packages/_es/raf.js +19 -0
  76. package/dist/packages/avatar/index.scss +0 -1
  77. package/dist/packages/badge/index.scss +35 -0
  78. package/dist/packages/calendar/index.scss +13 -0
  79. package/dist/packages/imagepreview/index.scss +48 -0
  80. package/dist/packages/input/index.scss +14 -7
  81. package/dist/packages/pagination/index.scss +51 -0
  82. package/dist/packages/popover/index.scss +159 -0
  83. package/dist/packages/shortpassword/index.scss +19 -7
  84. package/dist/packages/tabpane/index.scss +1 -0
  85. package/dist/packages/tabs/index.scss +1 -0
  86. package/dist/packages/tag/index.scss +47 -0
  87. package/dist/packages/uploader/index.scss +0 -1
  88. package/dist/style.css +1 -1
  89. package/dist/style.es.js +2 -1
  90. package/dist/styles/themes/default.scss +35 -28
  91. package/dist/styles/variables.scss +55 -32
  92. package/package.json +7 -7
@@ -0,0 +1,127 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { computed, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, toDisplayString, createCommentVNode } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
+ const { componentName, create } = createComponent("textarea");
10
+ const _sfc_main = create({
11
+ props: {
12
+ modelValue: {
13
+ type: [String, Number],
14
+ default: ""
15
+ },
16
+ textAlign: {
17
+ type: String,
18
+ default: "left"
19
+ },
20
+ limitShow: {
21
+ type: Boolean,
22
+ default: false
23
+ },
24
+ maxLength: {
25
+ type: [String, Number],
26
+ default: ""
27
+ },
28
+ rows: {
29
+ type: [String, Number],
30
+ default: ""
31
+ },
32
+ placeholder: {
33
+ type: String,
34
+ default: "\u8BF7\u8F93\u5165\u5185\u5BB9"
35
+ },
36
+ readonly: {
37
+ type: Boolean,
38
+ default: false
39
+ },
40
+ disabled: {
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+ autosize: {
45
+ type: Boolean,
46
+ default: false
47
+ }
48
+ },
49
+ emits: ["update:modelValue", "change", "blur", "focus"],
50
+ setup(props, { emit }) {
51
+ const classes = computed(() => {
52
+ const prefixCls = componentName;
53
+ return {
54
+ [prefixCls]: true,
55
+ [`${prefixCls}--disabled`]: props.disabled
56
+ };
57
+ });
58
+ const styles = computed(() => {
59
+ return {
60
+ textAlign: props.textAlign,
61
+ resize: props.autosize ? "vertical" : "none"
62
+ };
63
+ });
64
+ const emitChange = (value, event) => {
65
+ if (props.maxLength && value.length > Number(props.maxLength)) {
66
+ value = value.substring(0, Number(props.maxLength));
67
+ }
68
+ emit("change", value, event);
69
+ emit("update:modelValue", value, event);
70
+ };
71
+ const change = (event) => {
72
+ const input = event.target;
73
+ emitChange(input.value, event);
74
+ };
75
+ const focus = (event) => {
76
+ if (props.disabled)
77
+ return;
78
+ if (props.readonly)
79
+ return;
80
+ emit("focus", event);
81
+ };
82
+ const blur = (event) => {
83
+ if (props.disabled)
84
+ return;
85
+ if (props.readonly)
86
+ return;
87
+ const input = event.target;
88
+ let value = input.value;
89
+ emitChange(value, event);
90
+ emit("blur", { value, event });
91
+ };
92
+ return {
93
+ classes,
94
+ styles,
95
+ change,
96
+ focus,
97
+ blur
98
+ };
99
+ }
100
+ });
101
+ const _hoisted_1 = ["rows", "disabled", "readonly", "value", "maxlength", "placeholder"];
102
+ const _hoisted_2 = {
103
+ key: 0,
104
+ class: "nut-textarea__limit"
105
+ };
106
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
107
+ return openBlock(), createElementBlock("view", {
108
+ class: normalizeClass(_ctx.classes)
109
+ }, [
110
+ createElementVNode("textarea", {
111
+ class: "nut-textarea__textarea",
112
+ style: normalizeStyle(_ctx.styles),
113
+ rows: _ctx.rows,
114
+ disabled: _ctx.disabled,
115
+ readonly: _ctx.readonly,
116
+ value: _ctx.modelValue,
117
+ onInput: _cache[0] || (_cache[0] = (...args) => _ctx.change && _ctx.change(...args)),
118
+ onBlur: _cache[1] || (_cache[1] = (...args) => _ctx.blur && _ctx.blur(...args)),
119
+ onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.focus && _ctx.focus(...args)),
120
+ maxlength: _ctx.maxLength,
121
+ placeholder: _ctx.placeholder
122
+ }, null, 44, _hoisted_1),
123
+ _ctx.limitShow ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.modelValue.length) + "/" + toDisplayString(_ctx.maxLength), 1)) : createCommentVNode("", true)
124
+ ], 2);
125
+ }
126
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
127
+ export { index as default };
@@ -0,0 +1,317 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ /*!
21
+ * @nutui/nutui v3.1.7 Thu Sep 30 2021 20:17:02 GMT+0800 (中国标准时间)
22
+ * (c) 2021 @jdf2e.
23
+ * Released under the MIT License.
24
+ */
25
+ import { reactive, onMounted, watch, computed, resolveComponent, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, createElementBlock, createVNode, createCommentVNode, vShow, render } from "vue";
26
+ import { c as createComponent } from "./component.js";
27
+ import _sfc_main$1 from "./Icon.js";
28
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
29
+ import "./pxCheck.js";
30
+ const { create } = createComponent("toast");
31
+ const _sfc_main = create({
32
+ components: {
33
+ [_sfc_main$1.name]: _sfc_main$1
34
+ },
35
+ props: {
36
+ id: String,
37
+ msg: String,
38
+ duration: {
39
+ type: Number,
40
+ default: 2e3
41
+ },
42
+ center: {
43
+ type: Boolean,
44
+ default: true
45
+ },
46
+ type: String,
47
+ customClass: String,
48
+ bottom: {
49
+ type: Number,
50
+ default: 30
51
+ },
52
+ size: {
53
+ type: [String, Number],
54
+ default: "base"
55
+ },
56
+ icon: String,
57
+ textAlignCenter: {
58
+ type: Boolean,
59
+ default: true
60
+ },
61
+ loadingRotate: {
62
+ type: Boolean,
63
+ default: true
64
+ },
65
+ bgColor: {
66
+ type: String,
67
+ default: "rgba(0, 0, 0, .8)"
68
+ },
69
+ onClose: Function,
70
+ unmount: Function,
71
+ cover: {
72
+ type: Boolean,
73
+ default: false
74
+ },
75
+ coverColor: {
76
+ type: String,
77
+ default: "rgba(0, 0, 0, 0)"
78
+ },
79
+ closeOnClickOverlay: {
80
+ type: Boolean,
81
+ default: false
82
+ }
83
+ },
84
+ setup(props) {
85
+ let timer;
86
+ const state = reactive({
87
+ mounted: false
88
+ });
89
+ onMounted(() => {
90
+ state.mounted = true;
91
+ });
92
+ const clearTimer = () => {
93
+ if (timer) {
94
+ clearTimeout(timer);
95
+ timer = null;
96
+ }
97
+ };
98
+ const hide = () => {
99
+ state.mounted = false;
100
+ };
101
+ const show = () => {
102
+ clearTimer();
103
+ if (props.duration) {
104
+ timer = setTimeout(() => {
105
+ hide();
106
+ }, props.duration);
107
+ }
108
+ };
109
+ const clickCover = () => {
110
+ if (props.closeOnClickOverlay) {
111
+ hide();
112
+ }
113
+ };
114
+ if (props.duration) {
115
+ show();
116
+ }
117
+ watch(() => props.duration, (val) => {
118
+ if (val) {
119
+ show();
120
+ }
121
+ });
122
+ const hasIcon = computed(() => {
123
+ if (props.type !== "text") {
124
+ return true;
125
+ } else {
126
+ return !!props.icon;
127
+ }
128
+ });
129
+ const toastBodyClass = computed(() => {
130
+ return [
131
+ "nut-toast",
132
+ { "nut-toast-center": props.center },
133
+ { "nut-toast-has-icon": hasIcon.value },
134
+ { "nut-toast-cover": props.cover },
135
+ { "nut-toast-loading": props.type === "loading" },
136
+ props.customClass,
137
+ "nut-toast-" + props.size
138
+ ];
139
+ });
140
+ const onAfterLeave = () => {
141
+ clearTimer();
142
+ props.unmount(props.id);
143
+ props.onClose && props.onClose();
144
+ };
145
+ return {
146
+ state,
147
+ hide,
148
+ clickCover,
149
+ hasIcon,
150
+ toastBodyClass,
151
+ onAfterLeave
152
+ };
153
+ }
154
+ });
155
+ const _hoisted_1 = {
156
+ key: 0,
157
+ class: "nut-toast-icon-wrapper"
158
+ };
159
+ const _hoisted_2 = ["innerHTML"];
160
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
161
+ const _component_nut_icon = resolveComponent("nut-icon");
162
+ return openBlock(), createBlock(Transition, {
163
+ name: "toast-fade",
164
+ onAfterLeave: _ctx.onAfterLeave
165
+ }, {
166
+ default: withCtx(() => [
167
+ withDirectives(createElementVNode("view", {
168
+ class: normalizeClass(_ctx.toastBodyClass),
169
+ style: normalizeStyle({
170
+ bottom: _ctx.center ? "auto" : _ctx.bottom + "px",
171
+ "background-color": _ctx.coverColor
172
+ }),
173
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
174
+ }, [
175
+ createElementVNode("view", {
176
+ class: "nut-toast-inner",
177
+ style: normalizeStyle({
178
+ "text-align": _ctx.textAlignCenter ? "center" : "left",
179
+ "background-color": _ctx.bgColor
180
+ })
181
+ }, [
182
+ _ctx.hasIcon ? (openBlock(), createElementBlock("view", _hoisted_1, [
183
+ createVNode(_component_nut_icon, {
184
+ size: "20",
185
+ color: "#ffffff",
186
+ name: _ctx.icon
187
+ }, null, 8, ["name"])
188
+ ])) : createCommentVNode("", true),
189
+ createElementVNode("view", {
190
+ class: "nut-toast-text",
191
+ innerHTML: _ctx.msg
192
+ }, null, 8, _hoisted_2)
193
+ ], 4)
194
+ ], 6), [
195
+ [vShow, _ctx.state.mounted]
196
+ ])
197
+ ]),
198
+ _: 1
199
+ }, 8, ["onAfterLeave"]);
200
+ }
201
+ var Toast = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
202
+ const defaultOptions = {
203
+ msg: "",
204
+ id: "",
205
+ duration: 2e3,
206
+ center: true,
207
+ type: "text",
208
+ customClass: "",
209
+ bottom: 30,
210
+ size: "base",
211
+ icon: null,
212
+ textAlignCenter: true,
213
+ loadingRotate: true,
214
+ bgColor: "rgba(0, 0, 0, .8)",
215
+ onClose: null,
216
+ unmount: null,
217
+ cover: false,
218
+ coverColor: "rgba(0, 0, 0, 0)",
219
+ closeOnClickOverlay: false
220
+ };
221
+ let idsMap = [];
222
+ let optsMap = [];
223
+ const clearToast = (id) => {
224
+ if (id) {
225
+ const container = document.getElementById(id);
226
+ optsMap = optsMap.filter((item) => item.id !== id);
227
+ idsMap = idsMap.filter((item) => item !== id);
228
+ if (container) {
229
+ document.body.removeChild(container);
230
+ }
231
+ } else {
232
+ idsMap.forEach((item) => {
233
+ const container = document.getElementById(item);
234
+ if (container) {
235
+ document.body.removeChild(container);
236
+ }
237
+ });
238
+ optsMap = [];
239
+ idsMap = [];
240
+ }
241
+ };
242
+ const updateToast = (opts) => {
243
+ const container = document.getElementById(opts.id);
244
+ if (container) {
245
+ const currentOpt = optsMap.find((item) => item.id === opts.id);
246
+ if (currentOpt) {
247
+ opts = __spreadValues(__spreadValues(__spreadValues({}, defaultOptions), currentOpt), opts);
248
+ } else {
249
+ opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
250
+ }
251
+ const instance = createVNode(Toast, opts);
252
+ render(instance, container);
253
+ return instance.component.ctx;
254
+ }
255
+ };
256
+ const mountToast = (opts) => {
257
+ opts.unmount = clearToast;
258
+ let _id;
259
+ if (opts.id) {
260
+ _id = opts.id;
261
+ if (idsMap.find((item) => item === opts.id)) {
262
+ return updateToast(opts);
263
+ }
264
+ } else {
265
+ _id = new Date().getTime() + "";
266
+ }
267
+ opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
268
+ opts.id = _id;
269
+ idsMap.push(opts.id);
270
+ optsMap.push(opts);
271
+ const container = document.createElement("div");
272
+ container.id = opts.id;
273
+ const instance = createVNode(Toast, opts);
274
+ render(instance, container);
275
+ document.body.appendChild(container);
276
+ return instance.component.ctx;
277
+ };
278
+ const errorMsg = (msg) => {
279
+ if (!msg) {
280
+ console.warn("[NutUI Toast]: msg\u4E0D\u80FD\u4E3A\u7A7A");
281
+ return;
282
+ }
283
+ };
284
+ const ToastFunction = {
285
+ text(msg, opts = {}) {
286
+ errorMsg(msg);
287
+ return mountToast(__spreadProps(__spreadValues({}, opts), { type: "text", msg }));
288
+ },
289
+ success(msg, opts = {}) {
290
+ errorMsg(msg);
291
+ return mountToast(__spreadProps(__spreadValues({ icon: "success" }, opts), { msg, type: "success" }));
292
+ },
293
+ fail(msg, opts = {}) {
294
+ errorMsg(msg);
295
+ return mountToast(__spreadProps(__spreadValues({ icon: "failure" }, opts), { msg, type: "fail" }));
296
+ },
297
+ warn(msg, opts = {}) {
298
+ errorMsg(msg);
299
+ return mountToast(__spreadProps(__spreadValues({ icon: "tips" }, opts), { msg, type: "warn" }));
300
+ },
301
+ loading(msg, opts = {}) {
302
+ return mountToast(__spreadProps(__spreadValues({
303
+ icon: "loading"
304
+ }, opts), {
305
+ msg,
306
+ type: "loading"
307
+ }));
308
+ },
309
+ hide() {
310
+ clearToast();
311
+ },
312
+ install(app) {
313
+ app.use(Toast);
314
+ app.config.globalProperties.$toast = ToastFunction;
315
+ }
316
+ };
317
+ export { Toast, ToastFunction, ToastFunction as default };