@nutui/nutui 3.1.22 → 3.1.23-beta.0

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 (176) hide show
  1. package/dist/nutui.es.js +20418 -4214
  2. package/dist/nutui.umd.js +20524 -4216
  3. package/dist/packages/_es/ActionSheet.js +149 -17
  4. package/dist/packages/_es/Address.js +535 -110
  5. package/dist/packages/_es/AddressList.js +615 -113
  6. package/dist/packages/_es/Animate.js +59 -17
  7. package/dist/packages/_es/Audio.js +257 -53
  8. package/dist/packages/_es/AudioOperate.js +100 -13
  9. package/dist/packages/_es/Avatar.js +162 -38
  10. package/dist/packages/_es/AvatarGroup.js +73 -14
  11. package/dist/packages/_es/BackTop.js +156 -43
  12. package/dist/packages/_es/Badge.js +86 -14
  13. package/dist/packages/_es/Barrage.js +120 -41
  14. package/dist/packages/_es/Button.js +128 -23
  15. package/dist/packages/_es/Calendar.js +246 -30
  16. package/dist/packages/_es/CalendarItem.js +1 -1
  17. package/dist/packages/_es/Card.js +107 -10
  18. package/dist/packages/_es/Cascader.js +496 -147
  19. package/dist/packages/_es/Category.js +58 -15
  20. package/dist/packages/_es/CategoryPane.js +111 -11
  21. package/dist/packages/_es/Cell.js +108 -21
  22. package/dist/packages/_es/CellGroup.js +44 -9
  23. package/dist/packages/_es/Checkbox.js +134 -29
  24. package/dist/packages/_es/CheckboxGroup.js +79 -29
  25. package/dist/packages/_es/CircleProgress.js +150 -28
  26. package/dist/packages/_es/Col.js +56 -14
  27. package/dist/packages/_es/Collapse.js +109 -32
  28. package/dist/packages/_es/CollapseItem.js +253 -59
  29. package/dist/packages/_es/Comment.js +434 -64
  30. package/dist/packages/_es/ConfigProvider.js +20 -8
  31. package/dist/packages/_es/CountDown.js +238 -56
  32. package/dist/packages/_es/CountUp.js +539 -140
  33. package/dist/packages/_es/DatePicker.js +315 -98
  34. package/dist/packages/_es/Dialog.js +289 -60
  35. package/dist/packages/_es/Divider.js +65 -13
  36. package/dist/packages/_es/Drag.js +197 -56
  37. package/dist/packages/_es/Ecard.js +159 -24
  38. package/dist/packages/_es/Elevator.js +255 -58
  39. package/dist/packages/_es/Ellipsis.js +200 -58
  40. package/dist/packages/_es/Empty.js +71 -12
  41. package/dist/packages/_es/FixedNav.js +122 -15
  42. package/dist/packages/_es/Form.js +151 -64
  43. package/dist/packages/_es/FormItem.js +114 -15
  44. package/dist/packages/_es/Grid.js +6 -5
  45. package/dist/packages/_es/GridItem.js +144 -33
  46. package/dist/packages/_es/Icon.js +40 -15
  47. package/dist/packages/_es/Image.js +137 -26
  48. package/dist/packages/_es/ImagePreview.js +547 -76
  49. package/dist/packages/_es/Indicator.js +62 -15
  50. package/dist/packages/_es/InfiniteLoading.js +249 -57
  51. package/dist/packages/_es/Input.js +433 -51
  52. package/dist/packages/_es/InputNumber.js +160 -41
  53. package/dist/packages/_es/Layout.js +5 -4
  54. package/dist/packages/_es/List.js +106 -18
  55. package/dist/packages/_es/Menu.js +168 -44
  56. package/dist/packages/_es/MenuItem.js +173 -37
  57. package/dist/packages/_es/Navbar.js +192 -30
  58. package/dist/packages/_es/NoticeBar.js +380 -74
  59. package/dist/packages/_es/Notify.js +227 -72
  60. package/dist/packages/_es/NumberKeyboard.js +272 -41
  61. package/dist/packages/_es/OldPicker.js +457 -130
  62. package/dist/packages/_es/OverLay.js +98 -24
  63. package/dist/packages/_es/Pagination.js +157 -39
  64. package/dist/packages/_es/Picker.js +460 -129
  65. package/dist/packages/_es/Popover.js +957 -318
  66. package/dist/packages/_es/Popup.js +299 -55
  67. package/dist/packages/_es/Price.js +118 -16
  68. package/dist/packages/_es/Progress.js +146 -14
  69. package/dist/packages/_es/PullRefresh.js +339 -84
  70. package/dist/packages/_es/Radio.js +90 -22
  71. package/dist/packages/_es/RadioGroup.js +37 -8
  72. package/dist/packages/_es/Range.js +408 -83
  73. package/dist/packages/_es/Rate.js +192 -36
  74. package/dist/packages/_es/Row.js +64 -22
  75. package/dist/packages/_es/SearchBar.js +238 -37
  76. package/dist/packages/_es/ShortPassword.js +225 -35
  77. package/dist/packages/_es/SideNavBar.js +81 -24
  78. package/dist/packages/_es/SideNavBarItem.js +46 -11
  79. package/dist/packages/_es/Signature.js +160 -41
  80. package/dist/packages/_es/Skeleton.js +136 -20
  81. package/dist/packages/_es/Sku.js +491 -84
  82. package/dist/packages/_es/Step.js +115 -20
  83. package/dist/packages/_es/Steps.js +53 -18
  84. package/dist/packages/_es/Sticky.js +138 -53
  85. package/dist/packages/_es/SubSideNavBar.js +82 -17
  86. package/dist/packages/_es/Swipe.js +178 -41
  87. package/dist/packages/_es/Swiper.js +433 -121
  88. package/dist/packages/_es/SwiperItem.js +53 -22
  89. package/dist/packages/_es/Switch.js +116 -21
  90. package/dist/packages/_es/TabPane.js +39 -12
  91. package/dist/packages/_es/Tabbar.js +72 -17
  92. package/dist/packages/_es/TabbarItem.js +151 -29
  93. package/dist/packages/_es/Table.js +178 -18
  94. package/dist/packages/_es/Tabs.js +202 -43
  95. package/dist/packages/_es/Tag.js +97 -20
  96. package/dist/packages/_es/TextArea.js +160 -42
  97. package/dist/packages/_es/TimeDetail.js +79 -18
  98. package/dist/packages/_es/TimePannel.js +48 -14
  99. package/dist/packages/_es/TimeSelect.js +112 -15
  100. package/dist/packages/_es/Toast.js +310 -71
  101. package/dist/packages/_es/Uploader.js +455 -104
  102. package/dist/packages/_es/Video.js +332 -74
  103. package/dist/packages/_es/common.js +128 -38
  104. package/dist/packages/_es/component.js +76 -35
  105. package/dist/packages/_es/index.js +6 -5
  106. package/dist/packages/_es/index2.js +30 -9
  107. package/dist/packages/_es/index3.js +8 -6
  108. package/dist/packages/_es/index4.js +64 -13
  109. package/dist/packages/_es/index5.js +780 -164
  110. package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
  111. package/dist/packages/_es/pxCheck.js +5 -3
  112. package/dist/packages/_es/raf.js +15 -8
  113. package/dist/packages/imagepreview/index.scss +6 -1
  114. package/dist/packages/locale/lang/baseLang.js +3 -3
  115. package/dist/packages/locale/lang/en-US.js +105 -5
  116. package/dist/packages/locale/lang/id-ID.js +105 -5
  117. package/dist/packages/locale/lang/index.js +38 -16
  118. package/dist/packages/locale/lang/zh-CN.js +105 -5
  119. package/dist/packages/locale/lang/zh-TW.js +105 -5
  120. package/dist/smartips/attributes.json +8 -0
  121. package/dist/smartips/tags.json +3 -1
  122. package/dist/smartips/web-types.json +19 -1
  123. package/dist/style.css +1 -1
  124. package/dist/style.es.js +1 -1
  125. package/dist/styles/themes/default.scss +41 -41
  126. package/dist/styles/themes/jdb.scss +41 -41
  127. package/dist/styles/themes/jdt.scss +41 -41
  128. package/dist/types/__VUE/actionsheet/index.vue.d.ts +5 -5
  129. package/dist/types/__VUE/address/index.vue.d.ts +7 -7
  130. package/dist/types/__VUE/avatar/index.vue.d.ts +4 -4
  131. package/dist/types/__VUE/avatargroup/index.vue.d.ts +2 -2
  132. package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
  133. package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
  134. package/dist/types/__VUE/button/index.vue.d.ts +8 -8
  135. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  136. package/dist/types/__VUE/cascader/index.vue.d.ts +4 -4
  137. package/dist/types/__VUE/cell/index.vue.d.ts +6 -6
  138. package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
  139. package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
  140. package/dist/types/__VUE/comment/index.vue.d.ts +2 -2
  141. package/dist/types/__VUE/datepicker/index.vue.d.ts +4 -4
  142. package/dist/types/__VUE/dialog/index.vue.d.ts +4 -4
  143. package/dist/types/__VUE/fixednav/index.vue.d.ts +4 -4
  144. package/dist/types/__VUE/grid/index.vue.d.ts +4 -4
  145. package/dist/types/__VUE/image/index.vue.d.ts +4 -4
  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/input/index.vue.d.ts +4 -4
  149. package/dist/types/__VUE/inputnumber/index.vue.d.ts +2 -2
  150. package/dist/types/__VUE/menu/index.vue.d.ts +2 -2
  151. package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
  152. package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
  153. package/dist/types/__VUE/notify/index.vue.d.ts +2 -2
  154. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
  155. package/dist/types/__VUE/oldpicker/index.vue.d.ts +5 -5
  156. package/dist/types/__VUE/picker/Column.vue.d.ts +1 -1
  157. package/dist/types/__VUE/picker/index.vue.d.ts +6 -6
  158. package/dist/types/__VUE/popover/index.vue.d.ts +8 -8
  159. package/dist/types/__VUE/popup/index.vue.d.ts +6 -6
  160. package/dist/types/__VUE/radio/index.vue.d.ts +4 -4
  161. package/dist/types/__VUE/range/index.vue.d.ts +4 -4
  162. package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
  163. package/dist/types/__VUE/skeleton/index.vue.d.ts +4 -4
  164. package/dist/types/__VUE/sku/index.vue.d.ts +5 -5
  165. package/dist/types/__VUE/step/index.vue.d.ts +2 -2
  166. package/dist/types/__VUE/sticky/index.vue.d.ts +4 -4
  167. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  168. package/dist/types/__VUE/swiper/index.vue.d.ts +2 -2
  169. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  170. package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
  171. package/dist/types/__VUE/tag/index.vue.d.ts +2 -2
  172. package/dist/types/__VUE/timeselect/index.vue.d.ts +2 -2
  173. package/dist/types/__VUE/toast/index.vue.d.ts +4 -4
  174. package/dist/types/__VUE/uploader/index.vue.d.ts +4 -4
  175. package/dist/types/index.d.ts +1 -1
  176. package/package.json +1 -2
@@ -1,46 +1,165 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { computed as e, resolveComponent as u, openBlock as l, createElementBlock as t, normalizeClass as a, normalizeStyle as n, createVNode as r, createElementVNode as d } from "vue";
7
- import { c as i } from "./component.js";
8
- import { p as m } from "./pxCheck.js";
9
- import { _ as o } from "./plugin-vue_export-helper.js";
6
+ import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, createElementVNode } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { p as pxCheck } from "./pxCheck.js";
9
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
10
  import "../locale/lang";
11
- const { componentName: s, create: c } = i("inputnumber"), b = c({ props: { modelValue: { type: [Number, String], default: 0 }, inputWidth: { type: [Number, String], default: "" }, buttonSize: { type: [Number, String], default: "" }, min: { type: [Number, String], default: 1 }, max: { type: [Number, String], default: 9999 }, step: { type: [Number, String], default: 1 }, decimalPlaces: { type: [Number, String], default: 0 }, disabled: { type: Boolean, default: false }, readonly: { type: Boolean, default: false } }, emits: ["update:modelValue", "change", "blur", "focus", "reduce", "add", "overlimit"], setup(u2, { emit: l2 }) {
12
- const t2 = e(() => ({ [s]: true, [`${s}--disabled`]: u2.disabled })), a2 = (e2, t3) => {
13
- let a3 = Number(e2).toFixed(Number(u2.decimalPlaces));
14
- l2("update:modelValue", a3, t3), l2("change", a3, t3);
15
- }, n2 = (e2 = Number(u2.modelValue)) => e2 < Number(u2.max) && !u2.disabled, r2 = (e2 = Number(u2.modelValue)) => e2 > Number(u2.min) && !u2.disabled;
16
- return { classes: t2, change: (e2) => {
17
- const u3 = e2.target;
18
- l2("update:modelValue", u3.valueAsNumber, e2);
19
- }, blur: (e2) => {
20
- if (u2.disabled)
21
- return;
22
- if (u2.readonly)
23
- return;
24
- let t3 = e2.target.valueAsNumber;
25
- t3 < Number(u2.min) ? t3 = Number(u2.min) : t3 > Number(u2.max) && (t3 = Number(u2.max)), a2(t3, e2), l2("blur", e2);
26
- }, focus: (e2) => {
27
- u2.disabled || u2.readonly || l2("focus", e2);
28
- }, add: (e2) => {
29
- if (l2("add", e2), n2()) {
30
- let l3 = Number(u2.modelValue) + Number(u2.step);
31
- a2(l3, e2);
32
- } else
33
- l2("overlimit", e2, "add");
34
- }, addAllow: n2, reduce: (e2) => {
35
- if (l2("reduce", e2), r2()) {
36
- let l3 = Number(u2.modelValue) - Number(u2.step);
37
- a2(l3, e2);
38
- } else
39
- l2("overlimit", e2, "reduce");
40
- }, reduceAllow: r2, pxCheck: m };
41
- } }), p = ["min", "max", "disabled", "readonly", "value"];
42
- var f = o(b, [["render", function(e2, i2, m2, o2, s2, c2) {
43
- const b2 = u("nut-icon");
44
- return l(), t("view", { class: a(e2.classes), style: n({ height: e2.pxCheck(e2.buttonSize) }) }, [r(b2, { name: "minus", class: a(["nut-inputnumber__icon", { "nut-inputnumber__icon--disabled": !e2.reduceAllow() }]), size: e2.buttonSize, onClick: e2.reduce }, null, 8, ["class", "size", "onClick"]), d("input", { type: "number", min: e2.min, max: e2.max, style: n({ width: e2.pxCheck(e2.inputWidth) }), disabled: e2.disabled, readonly: e2.readonly, value: e2.modelValue, onInput: i2[0] || (i2[0] = (...u2) => e2.change && e2.change(...u2)), onBlur: i2[1] || (i2[1] = (...u2) => e2.blur && e2.blur(...u2)), onFocus: i2[2] || (i2[2] = (...u2) => e2.focus && e2.focus(...u2)) }, null, 44, p), r(b2, { name: "plus", class: a(["nut-inputnumber__icon", { "nut-inputnumber__icon--disabled": !e2.addAllow() }]), size: e2.buttonSize, onClick: e2.add }, null, 8, ["class", "size", "onClick"])], 6);
45
- }]]);
46
- export { f as default };
11
+ const { componentName, create } = createComponent("inputnumber");
12
+ const _sfc_main = create({
13
+ props: {
14
+ modelValue: {
15
+ type: [Number, String],
16
+ default: 0
17
+ },
18
+ inputWidth: {
19
+ type: [Number, String],
20
+ default: ""
21
+ },
22
+ buttonSize: {
23
+ type: [Number, String],
24
+ default: ""
25
+ },
26
+ min: {
27
+ type: [Number, String],
28
+ default: 1
29
+ },
30
+ max: {
31
+ type: [Number, String],
32
+ default: 9999
33
+ },
34
+ step: {
35
+ type: [Number, String],
36
+ default: 1
37
+ },
38
+ decimalPlaces: {
39
+ type: [Number, String],
40
+ default: 0
41
+ },
42
+ disabled: {
43
+ type: Boolean,
44
+ default: false
45
+ },
46
+ readonly: {
47
+ type: Boolean,
48
+ default: false
49
+ }
50
+ },
51
+ emits: ["update:modelValue", "change", "blur", "focus", "reduce", "add", "overlimit"],
52
+ setup(props, { emit }) {
53
+ const classes = computed(() => {
54
+ const prefixCls = componentName;
55
+ return {
56
+ [prefixCls]: true,
57
+ [`${prefixCls}--disabled`]: props.disabled
58
+ };
59
+ });
60
+ const fixedDecimalPlaces = (v) => {
61
+ return Number(v).toFixed(Number(props.decimalPlaces));
62
+ };
63
+ const change = (event) => {
64
+ const input = event.target;
65
+ emit("update:modelValue", input.valueAsNumber, event);
66
+ };
67
+ const emitChange = (value, event) => {
68
+ let output_value = fixedDecimalPlaces(value);
69
+ emit("update:modelValue", output_value, event);
70
+ emit("change", output_value, event);
71
+ };
72
+ const addAllow = (value = Number(props.modelValue)) => {
73
+ return value < Number(props.max) && !props.disabled;
74
+ };
75
+ const reduceAllow = (value = Number(props.modelValue)) => {
76
+ return value > Number(props.min) && !props.disabled;
77
+ };
78
+ const reduce = (event) => {
79
+ emit("reduce", event);
80
+ if (reduceAllow()) {
81
+ let output_value = Number(props.modelValue) - Number(props.step);
82
+ emitChange(output_value, event);
83
+ } else {
84
+ emit("overlimit", event, "reduce");
85
+ }
86
+ };
87
+ const add = (event) => {
88
+ emit("add", event);
89
+ if (addAllow()) {
90
+ let output_value = Number(props.modelValue) + Number(props.step);
91
+ emitChange(output_value, event);
92
+ } else {
93
+ emit("overlimit", event, "add");
94
+ }
95
+ };
96
+ const focus = (event) => {
97
+ if (props.disabled)
98
+ return;
99
+ if (props.readonly)
100
+ return;
101
+ emit("focus", event);
102
+ };
103
+ const blur = (event) => {
104
+ if (props.disabled)
105
+ return;
106
+ if (props.readonly)
107
+ return;
108
+ const input = event.target;
109
+ let value = input.valueAsNumber;
110
+ if (value < Number(props.min)) {
111
+ value = Number(props.min);
112
+ } else if (value > Number(props.max)) {
113
+ value = Number(props.max);
114
+ }
115
+ emitChange(value, event);
116
+ emit("blur", event);
117
+ };
118
+ return {
119
+ classes,
120
+ change,
121
+ blur,
122
+ focus,
123
+ add,
124
+ addAllow,
125
+ reduce,
126
+ reduceAllow,
127
+ pxCheck
128
+ };
129
+ }
130
+ });
131
+ const _hoisted_1 = ["min", "max", "disabled", "readonly", "value"];
132
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
133
+ const _component_nut_icon = resolveComponent("nut-icon");
134
+ return openBlock(), createElementBlock("view", {
135
+ class: normalizeClass(_ctx.classes),
136
+ style: normalizeStyle({ height: _ctx.pxCheck(_ctx.buttonSize) })
137
+ }, [
138
+ createVNode(_component_nut_icon, {
139
+ name: "minus",
140
+ class: normalizeClass(["nut-inputnumber__icon", { "nut-inputnumber__icon--disabled": !_ctx.reduceAllow() }]),
141
+ size: _ctx.buttonSize,
142
+ onClick: _ctx.reduce
143
+ }, null, 8, ["class", "size", "onClick"]),
144
+ createElementVNode("input", {
145
+ type: "number",
146
+ min: _ctx.min,
147
+ max: _ctx.max,
148
+ style: normalizeStyle({ width: _ctx.pxCheck(_ctx.inputWidth) }),
149
+ disabled: _ctx.disabled,
150
+ readonly: _ctx.readonly,
151
+ value: _ctx.modelValue,
152
+ onInput: _cache[0] || (_cache[0] = (...args) => _ctx.change && _ctx.change(...args)),
153
+ onBlur: _cache[1] || (_cache[1] = (...args) => _ctx.blur && _ctx.blur(...args)),
154
+ onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.focus && _ctx.focus(...args))
155
+ }, null, 44, _hoisted_1),
156
+ createVNode(_component_nut_icon, {
157
+ name: "plus",
158
+ class: normalizeClass(["nut-inputnumber__icon", { "nut-inputnumber__icon--disabled": !_ctx.addAllow() }]),
159
+ size: _ctx.buttonSize,
160
+ onClick: _ctx.add
161
+ }, null, 8, ["class", "size", "onClick"])
162
+ ], 6);
163
+ }
164
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
165
+ export { index as default };
@@ -1,10 +1,11 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { c as o } from "./component.js";
6
+ import { c as createComponent } from "./component.js";
7
7
  import "vue";
8
8
  import "../locale/lang";
9
- const { create: t } = o("layout"), a = t({});
10
- export { a as default };
9
+ const { create } = createComponent("layout");
10
+ const _sfc_main = create({});
11
+ export { _sfc_main as default };
@@ -1,23 +1,111 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref as t, reactive as e, computed as l, watch as s, toRefs as i, openBlock as a, createElementBlock as r, normalizeClass as n, createElementVNode as o, normalizeStyle as c, Fragment as h, renderList as m, renderSlot as u } from "vue";
7
- import { c as g } from "./component.js";
8
- import { _ as p } from "./plugin-vue_export-helper.js";
6
+ import { ref, reactive, computed, watch, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, Fragment, renderList, renderSlot } 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: f, create: d } = g("list");
11
- var v = p(d({ props: { height: { type: [Number], default: 50 }, listData: { type: Array, default: () => [] }, containerHeight: { type: [Number], default: document.documentElement.clientHeight || document.body.clientHeight || 667 } }, emits: ["scroll", "scroll-bottom"], setup(a2, { emit: r2 }) {
12
- const n2 = t(null), o2 = e({ startOffset: 0, start: 0, list: a2.listData.slice() }), c2 = l(() => Math.ceil(a2.containerHeight / a2.height)), h2 = l(() => o2.start + c2.value), m2 = l(() => `translate3d(0, ${o2.startOffset}px, 0)`), u2 = l(() => ({ [f]: true })), g2 = l(() => o2.list.length * a2.height), p2 = l(() => o2.list.slice(o2.start, Math.min(h2.value, o2.list.length)));
13
- return s(() => a2.listData, () => {
14
- o2.list = a2.listData.slice();
15
- }), { ...i(o2), list: n2, getTransform: m2, listHeight: g2, visibleData: p2, classes: u2, handleScrollEvent: () => {
16
- var _a;
17
- const t2 = (_a = n2.value) == null ? void 0 : _a.scrollTop;
18
- o2.start = Math.floor(t2 / a2.height), h2.value > o2.list.length && (r2("scroll"), r2("scroll-bottom")), o2.startOffset = t2 - t2 % a2.height;
19
- } };
20
- } }), [["render", function(t2, e2, l2, s2, i2, g2) {
21
- return a(), r("view", { class: n(t2.classes), onScrollPassive: e2[0] || (e2[0] = (...e3) => t2.handleScrollEvent && t2.handleScrollEvent(...e3)), ref: "list" }, [o("div", { class: "nut-list-phantom", style: c({ height: t2.listHeight + "px" }) }, null, 4), o("div", { class: "nut-list-container", style: c({ transform: t2.getTransform }) }, [(a(true), r(h, null, m(t2.visibleData, (e3, l3) => (a(), r("div", { class: "nut-list-item", style: c({ height: t2.height + "px" }), key: e3 }, [u(t2.$slots, "default", { item: e3, index: l3 })], 4))), 128))], 4)], 34);
22
- }]]);
23
- export { v as default };
10
+ const { componentName, create } = createComponent("list");
11
+ const _sfc_main = create({
12
+ props: {
13
+ height: {
14
+ type: [Number],
15
+ default: 50
16
+ },
17
+ listData: {
18
+ type: Array,
19
+ default: () => {
20
+ return [];
21
+ }
22
+ },
23
+ containerHeight: {
24
+ type: [Number],
25
+ default: document.documentElement.clientHeight || document.body.clientHeight || 667
26
+ }
27
+ },
28
+ emits: ["scroll", "scroll-bottom"],
29
+ setup(props, { emit }) {
30
+ const list = ref(null);
31
+ const state = reactive({
32
+ startOffset: 0,
33
+ start: 0,
34
+ list: props.listData.slice()
35
+ });
36
+ const visibleCount = computed(() => {
37
+ return Math.ceil(props.containerHeight / props.height);
38
+ });
39
+ const end = computed(() => {
40
+ return state.start + visibleCount.value;
41
+ });
42
+ const getTransform = computed(() => {
43
+ return `translate3d(0, ${state.startOffset}px, 0)`;
44
+ });
45
+ const classes = computed(() => {
46
+ const prefixCls = componentName;
47
+ return {
48
+ [prefixCls]: true
49
+ };
50
+ });
51
+ const listHeight = computed(() => {
52
+ return state.list.length * props.height;
53
+ });
54
+ const visibleData = computed(() => {
55
+ return state.list.slice(state.start, Math.min(end.value, state.list.length));
56
+ });
57
+ const handleScrollEvent = () => {
58
+ var _a;
59
+ const scrollTop = (_a = list.value) == null ? void 0 : _a.scrollTop;
60
+ state.start = Math.floor(scrollTop / props.height);
61
+ if (end.value > state.list.length) {
62
+ emit("scroll");
63
+ emit("scroll-bottom");
64
+ }
65
+ state.startOffset = scrollTop - scrollTop % props.height;
66
+ };
67
+ watch(() => props.listData, () => {
68
+ state.list = props.listData.slice();
69
+ });
70
+ return {
71
+ ...toRefs(state),
72
+ list,
73
+ getTransform,
74
+ listHeight,
75
+ visibleData,
76
+ classes,
77
+ handleScrollEvent
78
+ };
79
+ }
80
+ });
81
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
82
+ return openBlock(), createElementBlock("view", {
83
+ class: normalizeClass(_ctx.classes),
84
+ onScrollPassive: _cache[0] || (_cache[0] = (...args) => _ctx.handleScrollEvent && _ctx.handleScrollEvent(...args)),
85
+ ref: "list"
86
+ }, [
87
+ createElementVNode("div", {
88
+ class: "nut-list-phantom",
89
+ style: normalizeStyle({ height: _ctx.listHeight + "px" })
90
+ }, null, 4),
91
+ createElementVNode("div", {
92
+ class: "nut-list-container",
93
+ style: normalizeStyle({ transform: _ctx.getTransform })
94
+ }, [
95
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleData, (item, index2) => {
96
+ return openBlock(), createElementBlock("div", {
97
+ class: "nut-list-item",
98
+ style: normalizeStyle({ height: _ctx.height + "px" }),
99
+ key: item
100
+ }, [
101
+ renderSlot(_ctx.$slots, "default", {
102
+ item,
103
+ index: index2
104
+ })
105
+ ], 4);
106
+ }), 128))
107
+ ], 4)
108
+ ], 34);
109
+ }
110
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
111
+ export { index as default };
@@ -1,51 +1,175 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22 Fri Jun 24 2022 18:11:16 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref as e, computed as t, onMounted as o, onUnmounted as l, reactive as n, provide as s, resolveComponent as r, openBlock as i, createElementBlock as a, normalizeClass as c, createElementVNode as u, Fragment as d, renderList as p, normalizeStyle as m, toDisplayString as f, createVNode as v, renderSlot as w } from "vue";
7
- import { c as g } from "./component.js";
8
- import { u as h } from "./index2.js";
9
- import { _ as y } from "./plugin-vue_export-helper.js";
6
+ import { ref, computed, onMounted, onUnmounted, reactive, provide, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, normalizeStyle, toDisplayString, createVNode, renderSlot } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { u as useRect } from "./index2.js";
9
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
10
  import "../locale/lang";
11
- const { componentName: b, create: x } = g("menu"), C = x({ props: { activeColor: { type: String, default: "" }, overlay: { type: Boolean, default: true }, lockScroll: { type: Boolean, default: true }, duration: { type: [Number, String], default: 0 }, closeOnClickOverlay: { type: Boolean, default: true }, direction: { type: String, default: "down" }, scrollFixed: { type: [Boolean, String, Number], default: false }, titleClass: [String] }, setup(r2, { emit: i2, slots: a2 }) {
12
- const c2 = e(), u2 = e(0), d2 = e(false), { children: p2, linkChildren: m2 } = (() => {
13
- const e2 = n([]), t2 = n([]);
14
- return { children: e2, linkChildren: (o2) => {
15
- s("menuParent", Object.assign({ link: (o3) => {
16
- o3.proxy && (t2.push(o3), e2.push(o3.proxy));
17
- }, children: e2, internalChildren: t2 }, o2));
18
- } };
19
- })(), f2 = t(() => p2.some((e2) => e2.state.showWrapper)), v2 = t(() => ({ [b]: true, "scroll-fixed": d2.value }));
20
- m2({ props: r2, offset: u2 });
21
- const w2 = () => {
22
- const { scrollFixed: e2 } = r2, t2 = (o2 = window, Math.max(0, "scrollTop" in o2 ? o2.scrollTop : o2.pageYOffset));
23
- var o2;
24
- d2.value = t2 > (typeof e2 == "boolean" ? 30 : Number(e2));
25
- };
26
- return o(() => {
27
- const { scrollFixed: e2 } = r2;
28
- e2 && window.addEventListener("scroll", w2);
29
- }), l(() => {
30
- const { scrollFixed: e2 } = r2;
31
- e2 && window.removeEventListener("scroll", w2);
32
- }), { toggleItem: (e2) => {
33
- p2.forEach((t2, o2) => {
34
- o2 === e2 ? ((() => {
35
- if (c2.value) {
36
- const e3 = h(c2);
37
- r2.direction === "down" ? u2.value = e3.bottom : u2.value = window.innerHeight - e3.top;
11
+ const { componentName, create } = createComponent("menu");
12
+ const _sfc_main = create({
13
+ props: {
14
+ activeColor: {
15
+ type: String,
16
+ default: ""
17
+ },
18
+ overlay: {
19
+ type: Boolean,
20
+ default: true
21
+ },
22
+ lockScroll: {
23
+ type: Boolean,
24
+ default: true
25
+ },
26
+ duration: {
27
+ type: [Number, String],
28
+ default: 0
29
+ },
30
+ closeOnClickOverlay: {
31
+ type: Boolean,
32
+ default: true
33
+ },
34
+ direction: {
35
+ type: String,
36
+ default: "down"
37
+ },
38
+ scrollFixed: {
39
+ type: [Boolean, String, Number],
40
+ default: false
41
+ },
42
+ titleClass: [String]
43
+ },
44
+ setup(props, { emit, slots }) {
45
+ const barRef = ref();
46
+ const offset = ref(0);
47
+ const isScrollFixed = ref(false);
48
+ const useChildren = () => {
49
+ const publicChildren = reactive([]);
50
+ const internalChildren = reactive([]);
51
+ const linkChildren2 = (value) => {
52
+ const link = (child) => {
53
+ if (child.proxy) {
54
+ internalChildren.push(child);
55
+ publicChildren.push(child.proxy);
56
+ }
57
+ };
58
+ provide("menuParent", Object.assign({
59
+ link,
60
+ children: publicChildren,
61
+ internalChildren
62
+ }, value));
63
+ };
64
+ return {
65
+ children: publicChildren,
66
+ linkChildren: linkChildren2
67
+ };
68
+ };
69
+ const { children, linkChildren } = useChildren();
70
+ const opened = computed(() => children.some((item) => item.state.showWrapper));
71
+ const classes = computed(() => {
72
+ const prefixCls = componentName;
73
+ return {
74
+ [prefixCls]: true,
75
+ "scroll-fixed": isScrollFixed.value
76
+ };
77
+ });
78
+ const updateOffset = () => {
79
+ if (barRef.value) {
80
+ const rect = useRect(barRef);
81
+ if (props.direction === "down") {
82
+ offset.value = rect.bottom;
83
+ } else {
84
+ offset.value = window.innerHeight - rect.top;
85
+ }
86
+ }
87
+ };
88
+ linkChildren({ props, offset });
89
+ const toggleItem = (active) => {
90
+ children.forEach((item, index2) => {
91
+ if (index2 === active) {
92
+ updateOffset();
93
+ item.toggle();
94
+ } else if (item.state.showPopup) {
95
+ item.toggle(false, { immediate: true });
38
96
  }
39
- })(), t2.toggle()) : t2.state.showPopup && t2.toggle(false, { immediate: true });
97
+ });
98
+ };
99
+ const getScrollTop = (el) => {
100
+ return Math.max(0, "scrollTop" in el ? el.scrollTop : el.pageYOffset);
101
+ };
102
+ const onScroll = () => {
103
+ const { scrollFixed } = props;
104
+ const scrollTop = getScrollTop(window);
105
+ isScrollFixed.value = scrollTop > (typeof scrollFixed === "boolean" ? 30 : Number(scrollFixed));
106
+ };
107
+ const getClasses = (showPopup) => {
108
+ let str = "";
109
+ const { titleClass } = props;
110
+ if (showPopup) {
111
+ str += "active";
112
+ }
113
+ if (titleClass) {
114
+ str += ` ${titleClass}`;
115
+ }
116
+ return str;
117
+ };
118
+ onMounted(() => {
119
+ const { scrollFixed } = props;
120
+ if (scrollFixed) {
121
+ window.addEventListener("scroll", onScroll);
122
+ }
123
+ });
124
+ onUnmounted(() => {
125
+ const { scrollFixed } = props;
126
+ if (scrollFixed) {
127
+ window.removeEventListener("scroll", onScroll);
128
+ }
40
129
  });
41
- }, children: p2, opened: f2, classes: v2, barRef: c2, getClasses: (e2) => {
42
- let t2 = "";
43
- const { titleClass: o2 } = r2;
44
- return e2 && (t2 += "active"), o2 && (t2 += ` ${o2}`), t2;
45
- } };
46
- } }), _ = ["onClick"], k = { class: "nut-menu__title-text" };
47
- var S = y(C, [["render", function(e2, t2, o2, l2, n2, s2) {
48
- const g2 = r("nut-icon");
49
- return i(), a("view", { class: c(e2.classes) }, [u("view", { class: c(["nut-menu__bar", { opened: e2.opened }]), ref: "barRef" }, [(i(true), a(d, null, p(e2.children, (t3, o3) => (i(), a("view", { key: o3, class: c(["nut-menu__item", { disabled: t3.disabled, active: t3.state.showPopup }]), onClick: (l3) => !t3.disabled && e2.toggleItem(o3), style: m({ color: t3.state.showPopup ? e2.activeColor : "" }) }, [u("view", { class: c(["nut-menu__title", e2.getClasses(t3.state.showPopup)]) }, [u("view", k, f(t3.renderTitle()), 1), v(g2, { name: t3.titleIcon || (e2.direction === "up" ? "arrow-up" : "down-arrow"), size: "10", class: "nut-menu__title-icon" }, null, 8, ["name"])], 2)], 14, _))), 128))], 2), w(e2.$slots, "default")], 2);
50
- }]]);
51
- export { S as default };
130
+ return {
131
+ toggleItem,
132
+ children,
133
+ opened,
134
+ classes,
135
+ barRef,
136
+ getClasses
137
+ };
138
+ }
139
+ });
140
+ const _hoisted_1 = ["onClick"];
141
+ const _hoisted_2 = { class: "nut-menu__title-text" };
142
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
143
+ const _component_nut_icon = resolveComponent("nut-icon");
144
+ return openBlock(), createElementBlock("view", {
145
+ class: normalizeClass(_ctx.classes)
146
+ }, [
147
+ createElementVNode("view", {
148
+ class: normalizeClass(["nut-menu__bar", { opened: _ctx.opened }]),
149
+ ref: "barRef"
150
+ }, [
151
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.children, (item, index2) => {
152
+ return openBlock(), createElementBlock("view", {
153
+ key: index2,
154
+ class: normalizeClass(["nut-menu__item", { disabled: item.disabled, active: item.state.showPopup }]),
155
+ onClick: ($event) => !item.disabled && _ctx.toggleItem(index2),
156
+ style: normalizeStyle({ color: item.state.showPopup ? _ctx.activeColor : "" })
157
+ }, [
158
+ createElementVNode("view", {
159
+ class: normalizeClass(["nut-menu__title", _ctx.getClasses(item.state.showPopup)])
160
+ }, [
161
+ createElementVNode("view", _hoisted_2, toDisplayString(item.renderTitle()), 1),
162
+ createVNode(_component_nut_icon, {
163
+ name: item.titleIcon || (_ctx.direction === "up" ? "arrow-up" : "down-arrow"),
164
+ size: "10",
165
+ class: "nut-menu__title-icon"
166
+ }, null, 8, ["name"])
167
+ ], 2)
168
+ ], 14, _hoisted_1);
169
+ }), 128))
170
+ ], 2),
171
+ renderSlot(_ctx.$slots, "default")
172
+ ], 2);
173
+ }
174
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
175
+ export { index as default };