@nutui/nutui 3.1.22-beta.0 → 3.1.22-beta.3

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 +4019 -19251
  2. package/dist/nutui.umd.js +4012 -19344
  3. package/dist/packages/_es/ActionSheet.js +26 -157
  4. package/dist/packages/_es/Address.js +119 -542
  5. package/dist/packages/_es/AddressList.js +113 -613
  6. package/dist/packages/_es/Audio.js +62 -264
  7. package/dist/packages/_es/AudioOperate.js +18 -107
  8. package/dist/packages/_es/Avatar.js +42 -165
  9. package/dist/packages/_es/AvatarGroup.js +14 -73
  10. package/dist/packages/_es/BackTop.js +43 -156
  11. package/dist/packages/_es/Badge.js +14 -86
  12. package/dist/packages/_es/Barrage.js +41 -120
  13. package/dist/packages/_es/Button.js +23 -128
  14. package/dist/packages/_es/Calendar.js +24 -237
  15. package/dist/packages/_es/CalendarItem.js +1 -1
  16. package/dist/packages/_es/Card.js +10 -107
  17. package/dist/packages/_es/Cascader.js +156 -500
  18. package/dist/packages/_es/Category.js +15 -58
  19. package/dist/packages/_es/CategoryPane.js +11 -111
  20. package/dist/packages/_es/Cell.js +21 -100
  21. package/dist/packages/_es/CellGroup.js +9 -44
  22. package/dist/packages/_es/Checkbox.js +31 -113
  23. package/dist/packages/_es/CheckboxGroup.js +29 -58
  24. package/dist/packages/_es/CircleProgress.js +28 -151
  25. package/dist/packages/_es/Col.js +14 -56
  26. package/dist/packages/_es/Collapse.js +24 -85
  27. package/dist/packages/_es/CollapseItem.js +70 -261
  28. package/dist/packages/_es/Comment.js +64 -434
  29. package/dist/packages/_es/CountDown.js +61 -242
  30. package/dist/packages/_es/CountUp.js +149 -546
  31. package/dist/packages/_es/DatePicker.js +107 -322
  32. package/dist/packages/_es/Dialog.js +69 -261
  33. package/dist/packages/_es/Divider.js +18 -68
  34. package/dist/packages/_es/Drag.js +56 -197
  35. package/dist/packages/_es/Ecard.js +24 -159
  36. package/dist/packages/_es/Elevator.js +63 -198
  37. package/dist/packages/_es/Empty.js +12 -71
  38. package/dist/packages/_es/FixedNav.js +15 -122
  39. package/dist/packages/_es/Form.js +64 -151
  40. package/dist/packages/_es/FormItem.js +15 -110
  41. package/dist/packages/_es/Grid.js +5 -6
  42. package/dist/packages/_es/GridItem.js +33 -144
  43. package/dist/packages/_es/Icon.js +15 -40
  44. package/dist/packages/_es/ImagePreview.js +74 -298
  45. package/dist/packages/_es/Indicator.js +15 -62
  46. package/dist/packages/_es/InfiniteLoading.js +66 -258
  47. package/dist/packages/_es/Input.js +51 -413
  48. package/dist/packages/_es/InputNumber.js +41 -160
  49. package/dist/packages/_es/Layout.js +4 -5
  50. package/dist/packages/_es/List.js +23 -110
  51. package/dist/packages/_es/Menu.js +30 -118
  52. package/dist/packages/_es/MenuItem.js +34 -162
  53. package/dist/packages/_es/Navbar.js +30 -192
  54. package/dist/packages/_es/NoticeBar.js +83 -387
  55. package/dist/packages/_es/Notify.js +81 -236
  56. package/dist/packages/_es/NumberKeyboard.js +41 -272
  57. package/dist/packages/_es/OldPicker.js +140 -464
  58. package/dist/packages/_es/OverLay.js +32 -105
  59. package/dist/packages/_es/Pagination.js +39 -157
  60. package/dist/packages/_es/Picker.js +138 -459
  61. package/dist/packages/_es/Popover.js +327 -965
  62. package/dist/packages/_es/Popup.js +64 -303
  63. package/dist/packages/_es/Price.js +16 -118
  64. package/dist/packages/_es/Progress.js +14 -146
  65. package/dist/packages/_es/PullRefresh.js +92 -346
  66. package/dist/packages/_es/Radio.js +22 -90
  67. package/dist/packages/_es/RadioGroup.js +8 -37
  68. package/dist/packages/_es/Range.js +92 -417
  69. package/dist/packages/_es/Rate.js +16 -139
  70. package/dist/packages/_es/Row.js +22 -64
  71. package/dist/packages/_es/SearchBar.js +46 -247
  72. package/dist/packages/_es/ShortPassword.js +35 -225
  73. package/dist/packages/_es/SideNavBar.js +33 -89
  74. package/dist/packages/_es/SideNavBarItem.js +11 -46
  75. package/dist/packages/_es/Signature.js +46 -165
  76. package/dist/packages/_es/Skeleton.js +20 -136
  77. package/dist/packages/_es/Sku.js +93 -499
  78. package/dist/packages/_es/Step.js +25 -119
  79. package/dist/packages/_es/Steps.js +18 -53
  80. package/dist/packages/_es/Sticky.js +53 -138
  81. package/dist/packages/_es/SubSideNavBar.js +26 -90
  82. package/dist/packages/_es/Swipe.js +46 -183
  83. package/dist/packages/_es/Swiper.js +121 -433
  84. package/dist/packages/_es/SwiperItem.js +22 -53
  85. package/dist/packages/_es/Switch.js +21 -116
  86. package/dist/packages/_es/TabPane.js +12 -39
  87. package/dist/packages/_es/Tabbar.js +17 -72
  88. package/dist/packages/_es/TabbarItem.js +29 -151
  89. package/dist/packages/_es/Table.js +27 -186
  90. package/dist/packages/_es/Tabs.js +51 -209
  91. package/dist/packages/_es/Tag.js +20 -97
  92. package/dist/packages/_es/TextArea.js +42 -160
  93. package/dist/packages/_es/TimeDetail.js +23 -84
  94. package/dist/packages/_es/TimePannel.js +19 -52
  95. package/dist/packages/_es/TimeSelect.js +15 -103
  96. package/dist/packages/_es/Toast.js +80 -319
  97. package/dist/packages/_es/Uploader.js +112 -460
  98. package/dist/packages/_es/Video.js +83 -340
  99. package/dist/packages/_es/common.js +38 -128
  100. package/dist/packages/_es/component.js +35 -76
  101. package/dist/packages/_es/index.js +5 -6
  102. package/dist/packages/_es/index2.js +9 -30
  103. package/dist/packages/_es/index3.js +6 -8
  104. package/dist/packages/_es/index4.js +13 -58
  105. package/dist/packages/_es/index5.js +120 -675
  106. package/dist/packages/_es/plugin-vue_export-helper.js +7 -8
  107. package/dist/packages/_es/pxCheck.js +3 -5
  108. package/dist/packages/_es/raf.js +8 -15
  109. package/dist/packages/button/index.scss +2 -1
  110. package/dist/packages/cell/index.scss +11 -0
  111. package/dist/packages/checkbox/index.scss +6 -0
  112. package/dist/packages/dialog/index.scss +1 -0
  113. package/dist/packages/elevator/index.scss +21 -0
  114. package/dist/packages/input/index.scss +13 -1
  115. package/dist/packages/locale/lang/baseLang.d.ts +1 -0
  116. package/dist/packages/locale/lang/baseLang.js +3 -3
  117. package/dist/packages/locale/lang/en-US.d.ts +8 -0
  118. package/dist/packages/locale/lang/en-US.js +5 -97
  119. package/dist/packages/locale/lang/id-ID.d.ts +8 -0
  120. package/dist/packages/locale/lang/id-ID.js +5 -97
  121. package/dist/packages/locale/lang/index.js +16 -38
  122. package/dist/packages/locale/lang/zh-CN.d.ts +8 -0
  123. package/dist/packages/locale/lang/zh-CN.js +5 -97
  124. package/dist/packages/locale/lang/zh-TW.d.ts +8 -0
  125. package/dist/packages/locale/lang/zh-TW.js +5 -97
  126. package/dist/packages/radio/index.scss +1 -0
  127. package/dist/packages/switch/index.scss +3 -3
  128. package/dist/packages/tabpane/index.scss +1 -0
  129. package/dist/smartips/attributes.json +62 -10
  130. package/dist/smartips/tags.json +17 -4
  131. package/dist/style.css +1 -1
  132. package/dist/styles/themes/default.scss +49 -49
  133. package/dist/styles/themes/jdb.scss +49 -49
  134. package/dist/styles/themes/jdt.scss +49 -49
  135. package/dist/styles/variables-jdb.scss +10 -1
  136. package/dist/styles/variables-jdt.scss +10 -1
  137. package/dist/styles/variables.scss +10 -1
  138. package/dist/types/__VUE/address/index.vue.d.ts +5 -5
  139. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -0
  140. package/dist/types/__VUE/audiooperate/index.vue.d.ts +1 -0
  141. package/dist/types/__VUE/avatar/index.vue.d.ts +4 -4
  142. package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
  143. package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
  144. package/dist/types/__VUE/button/index.vue.d.ts +2 -2
  145. package/dist/types/__VUE/cascader/index.vue.d.ts +1 -1
  146. package/dist/types/__VUE/cell/index.vue.d.ts +11 -4
  147. package/dist/types/__VUE/checkbox/common.d.ts +59 -0
  148. package/dist/types/__VUE/checkbox/index.vue.d.ts +18 -5
  149. package/dist/types/__VUE/checkboxgroup/index.vue.d.ts +7 -0
  150. package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
  151. package/dist/types/__VUE/dialog/index.d.ts +9 -2
  152. package/dist/types/__VUE/dialog/index.vue.d.ts +23 -8
  153. package/dist/types/__VUE/ecard/index.vue.d.ts +3 -3
  154. package/dist/types/__VUE/elevator/index.vue.d.ts +29 -0
  155. package/dist/types/__VUE/empty/index.vue.d.ts +2 -2
  156. package/dist/types/__VUE/formitem/index.vue.d.ts +3 -10
  157. package/dist/types/__VUE/grid/index.vue.d.ts +4 -4
  158. package/dist/types/__VUE/griditem/index.vue.d.ts +1 -1
  159. package/dist/types/__VUE/input/index.vue.d.ts +2 -2
  160. package/dist/types/__VUE/noticebar/index.vue.d.ts +1 -1
  161. package/dist/types/__VUE/oldpicker/index.vue.d.ts +2 -2
  162. package/dist/types/__VUE/picker/index.vue.d.ts +2 -2
  163. package/dist/types/__VUE/popover/index.vue.d.ts +2 -2
  164. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  165. package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
  166. package/dist/types/__VUE/row/index.vue.d.ts +2 -2
  167. package/dist/types/__VUE/shortpassword/index.vue.d.ts +2 -2
  168. package/dist/types/__VUE/step/index.vue.d.ts +2 -2
  169. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  170. package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
  171. package/dist/types/__VUE/timeselect/index.vue.d.ts +9 -2
  172. package/dist/types/__VUE/toast/index.vue.d.ts +3 -3
  173. package/dist/types/__VUE/uploader/index.vue.d.ts +2 -2
  174. package/dist/types/__VUE/video/index.vue.d.ts +1 -1
  175. package/dist/types/index.d.ts +1 -1
  176. package/package.json +2 -1
@@ -1,165 +1,46 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
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";
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";
10
10
  import "../locale/lang";
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 };
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 };
@@ -1,11 +1,10 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { c as createComponent } from "./component.js";
6
+ import { c as o } from "./component.js";
7
7
  import "vue";
8
8
  import "../locale/lang";
9
- const { create } = createComponent("layout");
10
- const _sfc_main = create({});
11
- export { _sfc_main as default };
9
+ const { create: t } = o("layout"), a = t({});
10
+ export { a as default };
@@ -5,125 +5,38 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
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) => {
8
+ var __spreadValues = (a2, b) => {
9
9
  for (var prop in b || (b = {}))
10
10
  if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
11
+ __defNormalProp(a2, prop, b[prop]);
12
12
  if (__getOwnPropSymbols)
13
13
  for (var prop of __getOwnPropSymbols(b)) {
14
14
  if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
15
+ __defNormalProp(a2, prop, b[prop]);
16
16
  }
17
- return a;
17
+ return a2;
18
18
  };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
19
+ var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
22
22
  * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
25
- import { ref, reactive, computed, watch, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, Fragment, renderList, renderSlot } from "vue";
26
- import { c as createComponent } from "./component.js";
27
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
25
+ 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";
26
+ import { c as g } from "./component.js";
27
+ import { _ as p } from "./plugin-vue_export-helper.js";
28
28
  import "../locale/lang";
29
- const { componentName, create } = createComponent("list");
30
- const _sfc_main = create({
31
- props: {
32
- height: {
33
- type: [Number],
34
- default: 50
35
- },
36
- listData: {
37
- type: Array,
38
- default: () => {
39
- return [];
40
- }
41
- },
42
- containerHeight: {
43
- type: [Number],
44
- default: document.documentElement.clientHeight || document.body.clientHeight || 667
45
- }
46
- },
47
- emits: ["scroll", "scroll-bottom"],
48
- setup(props, { emit }) {
49
- const list = ref(null);
50
- const state = reactive({
51
- startOffset: 0,
52
- start: 0,
53
- list: props.listData.slice()
54
- });
55
- const visibleCount = computed(() => {
56
- return Math.ceil(props.containerHeight / props.height);
57
- });
58
- const end = computed(() => {
59
- return state.start + visibleCount.value;
60
- });
61
- const getTransform = computed(() => {
62
- return `translate3d(0, ${state.startOffset}px, 0)`;
63
- });
64
- const classes = computed(() => {
65
- const prefixCls = componentName;
66
- return {
67
- [prefixCls]: true
68
- };
69
- });
70
- const listHeight = computed(() => {
71
- return state.list.length * props.height;
72
- });
73
- const visibleData = computed(() => {
74
- return state.list.slice(state.start, Math.min(end.value, state.list.length));
75
- });
76
- const handleScrollEvent = () => {
77
- var _a;
78
- const scrollTop = (_a = list.value) == null ? void 0 : _a.scrollTop;
79
- state.start = Math.floor(scrollTop / props.height);
80
- if (end.value > state.list.length) {
81
- emit("scroll");
82
- emit("scroll-bottom");
83
- }
84
- state.startOffset = scrollTop - scrollTop % props.height;
85
- };
86
- watch(() => props.listData, () => {
87
- state.list = props.listData.slice();
88
- });
89
- return __spreadProps(__spreadValues({}, toRefs(state)), {
90
- list,
91
- getTransform,
92
- listHeight,
93
- visibleData,
94
- classes,
95
- handleScrollEvent
96
- });
97
- }
98
- });
99
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
100
- return openBlock(), createElementBlock("view", {
101
- class: normalizeClass(_ctx.classes),
102
- onScrollPassive: _cache[0] || (_cache[0] = (...args) => _ctx.handleScrollEvent && _ctx.handleScrollEvent(...args)),
103
- ref: "list"
104
- }, [
105
- createElementVNode("div", {
106
- class: "nut-list-phantom",
107
- style: normalizeStyle({ height: _ctx.listHeight + "px" })
108
- }, null, 4),
109
- createElementVNode("div", {
110
- class: "nut-list-container",
111
- style: normalizeStyle({ transform: _ctx.getTransform })
112
- }, [
113
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleData, (item, index2) => {
114
- return openBlock(), createElementBlock("div", {
115
- class: "nut-list-item",
116
- style: normalizeStyle({ height: _ctx.height + "px" }),
117
- key: item
118
- }, [
119
- renderSlot(_ctx.$slots, "default", {
120
- item,
121
- index: index2
122
- })
123
- ], 4);
124
- }), 128))
125
- ], 4)
126
- ], 34);
127
- }
128
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
129
- export { index as default };
29
+ const { componentName: f, create: d } = g("list");
30
+ 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 }) {
31
+ 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)));
32
+ return s(() => a2.listData, () => {
33
+ o2.list = a2.listData.slice();
34
+ }), __spreadProps(__spreadValues({}, i(o2)), { list: n2, getTransform: m2, listHeight: g2, visibleData: p2, classes: u2, handleScrollEvent: () => {
35
+ var _a;
36
+ const t2 = (_a = n2.value) == null ? void 0 : _a.scrollTop;
37
+ o2.start = Math.floor(t2 / a2.height), h2.value > o2.list.length && (r2("scroll"), r2("scroll-bottom")), o2.startOffset = t2 - t2 % a2.height;
38
+ } });
39
+ } }), [["render", function(t2, e2, l2, s2, i2, g2) {
40
+ 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);
41
+ }]]);
42
+ export { v as default };
@@ -1,124 +1,36 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref, computed, 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";
6
+ import { ref as e, computed as t, reactive as o, provide as n, resolveComponent as l, openBlock as s, createElementBlock as r, normalizeClass as a, createElementVNode as i, Fragment as u, renderList as c, normalizeStyle as p, toDisplayString as m, createVNode as d, renderSlot as f } from "vue";
7
+ import { c as h } from "./component.js";
8
+ import { u as v } from "./index2.js";
9
+ import { _ as g } from "./plugin-vue_export-helper.js";
10
10
  import "../locale/lang";
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
- duration: {
23
- type: [Number, String],
24
- default: 0
25
- },
26
- closeOnClickOverlay: {
27
- type: Boolean,
28
- default: true
29
- }
30
- },
31
- setup(props, { emit, slots }) {
32
- const barRef = ref();
33
- const offset = ref(0);
34
- const useChildren = () => {
35
- const publicChildren = reactive([]);
36
- const internalChildren = reactive([]);
37
- const linkChildren2 = (value) => {
38
- const link = (child) => {
39
- if (child.proxy) {
40
- internalChildren.push(child);
41
- publicChildren.push(child.proxy);
42
- }
43
- };
44
- provide("menuParent", Object.assign({
45
- link,
46
- children: publicChildren,
47
- internalChildren
48
- }, value));
49
- };
50
- return {
51
- children: publicChildren,
52
- linkChildren: linkChildren2
53
- };
54
- };
55
- const { children, linkChildren } = useChildren();
56
- const opened = computed(() => children.some((item) => item.state.showWrapper));
57
- const classes = computed(() => {
58
- const prefixCls = componentName;
59
- return {
60
- [prefixCls]: true
61
- };
62
- });
63
- const updateOffset = () => {
64
- if (barRef.value) {
65
- const rect = useRect(barRef);
66
- offset.value = rect.bottom;
67
- }
68
- };
69
- linkChildren({ props, offset });
70
- const toggleItem = (active) => {
71
- children.forEach((item, index2) => {
72
- if (index2 === active) {
73
- updateOffset();
74
- item.toggle();
75
- } else if (item.state.showPopup) {
76
- item.toggle(false, { immediate: true });
11
+ const { componentName: _, create: w } = h("menu"), y = w({ props: { activeColor: { type: String, default: "" }, overlay: { type: Boolean, default: true }, duration: { type: [Number, String], default: 0 }, closeOnClickOverlay: { type: Boolean, default: true } }, setup(l2, { emit: s2, slots: r2 }) {
12
+ const a2 = e(), i2 = e(0), { children: u2, linkChildren: c2 } = (() => {
13
+ const e2 = o([]), t2 = o([]);
14
+ return { children: e2, linkChildren: (o2) => {
15
+ n("menuParent", Object.assign({ link: (o3) => {
16
+ o3.proxy && (t2.push(o3), e2.push(o3.proxy));
17
+ }, children: e2, internalChildren: t2 }, o2));
18
+ } };
19
+ })(), p2 = t(() => u2.some((e2) => e2.state.showWrapper)), m2 = t(() => ({ [_]: true }));
20
+ c2({ props: l2, offset: i2 });
21
+ return { toggleItem: (e2) => {
22
+ u2.forEach((t2, o2) => {
23
+ o2 === e2 ? ((() => {
24
+ if (a2.value) {
25
+ const e3 = v(a2);
26
+ i2.value = e3.bottom;
77
27
  }
78
- });
79
- };
80
- return {
81
- toggleItem,
82
- children,
83
- opened,
84
- classes,
85
- barRef
86
- };
87
- }
88
- });
89
- const _hoisted_1 = ["onClick"];
90
- const _hoisted_2 = { class: "nut-menu__title-text" };
91
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
92
- const _component_nut_icon = resolveComponent("nut-icon");
93
- return openBlock(), createElementBlock("view", {
94
- class: normalizeClass(_ctx.classes)
95
- }, [
96
- createElementVNode("view", {
97
- class: normalizeClass(["nut-menu__bar", { opened: _ctx.opened }]),
98
- ref: "barRef"
99
- }, [
100
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.children, (item, index2) => {
101
- return openBlock(), createElementBlock("view", {
102
- key: index2,
103
- class: normalizeClass(["nut-menu__item", { disabled: item.disabled, active: item.state.showPopup }]),
104
- onClick: ($event) => !item.disabled && _ctx.toggleItem(index2),
105
- style: normalizeStyle({ color: item.state.showPopup ? _ctx.activeColor : "" })
106
- }, [
107
- createElementVNode("view", {
108
- class: normalizeClass(["nut-menu__title", { active: item.state.showPopup }])
109
- }, [
110
- createElementVNode("view", _hoisted_2, toDisplayString(item.renderTitle()), 1),
111
- createVNode(_component_nut_icon, {
112
- name: item.titleIcon,
113
- size: "10",
114
- class: "nut-menu__title-icon"
115
- }, null, 8, ["name"])
116
- ], 2)
117
- ], 14, _hoisted_1);
118
- }), 128))
119
- ], 2),
120
- renderSlot(_ctx.$slots, "default")
121
- ], 2);
122
- }
123
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
124
- export { index as default };
28
+ })(), t2.toggle()) : t2.state.showPopup && t2.toggle(false, { immediate: true });
29
+ });
30
+ }, children: u2, opened: p2, classes: m2, barRef: a2 };
31
+ } }), b = ["onClick"], C = { class: "nut-menu__title-text" };
32
+ var k = g(y, [["render", function(e2, t2, o2, n2, h2, v2) {
33
+ const g2 = l("nut-icon");
34
+ return s(), r("view", { class: a(e2.classes) }, [i("view", { class: a(["nut-menu__bar", { opened: e2.opened }]), ref: "barRef" }, [(s(true), r(u, null, c(e2.children, (t3, o3) => (s(), r("view", { key: o3, class: a(["nut-menu__item", { disabled: t3.disabled, active: t3.state.showPopup }]), onClick: (n3) => !t3.disabled && e2.toggleItem(o3), style: p({ color: t3.state.showPopup ? e2.activeColor : "" }) }, [i("view", { class: a(["nut-menu__title", { active: t3.state.showPopup }]) }, [i("view", C, m(t3.renderTitle()), 1), d(g2, { name: t3.titleIcon, size: "10", class: "nut-menu__title-icon" }, null, 8, ["name"])], 2)], 14, b))), 128))], 2), f(e2.$slots, "default")], 2);
35
+ }]]);
36
+ export { k as default };