@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,81 +1,387 @@
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 { h as e, ref as t, reactive as l, computed as o, watch as i, onMounted as n, onActivated as s, onDeactivated as a, onUnmounted as c, toRefs as r, resolveComponent as d, openBlock as p, createElementBlock as u, normalizeClass as m, withDirectives as h, normalizeStyle as y, renderSlot as f, createBlock as g, createCommentVNode as k, createElementVNode as w, createTextVNode as v, toDisplayString as C, withModifiers as b, createVNode as S, vShow as I, Fragment as L, renderList as x } from "vue";
7
- import { c as A } from "./component.js";
8
- import { _ as B } from "./plugin-vue_export-helper.js";
6
+ import { h, ref, reactive, computed, watch, onMounted, onActivated, onDeactivated, onUnmounted, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, withDirectives, normalizeStyle, renderSlot, createBlock, createCommentVNode, createElementVNode, createTextVNode, toDisplayString, withModifiers, createVNode, vShow, Fragment, renderList } 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: $, create: N } = A("noticebar"), T = N({ props: { direction: { type: String, default: "across" }, list: { type: Array, default: () => [] }, standTime: { type: Number, default: 1e3 }, complexAm: { type: Boolean, default: false }, height: { type: Number, default: 40 }, text: { type: String, default: "" }, closeMode: { type: Boolean, default: false }, wrapable: { type: Boolean, default: false }, leftIcon: { type: String, default: "" }, rightIcon: { type: String, default: "" }, color: { type: String, default: "" }, background: { type: String, default: "" }, delay: { type: [String, Number], default: 1 }, scrollable: { type: Boolean, default: null }, speed: { type: Number, default: 50 } }, components: { ScrollItem: function(t2) {
11
- return t2.item.props.style = t2.style, t2.item.key = t2.key, e(t2.item);
12
- } }, emits: ["click", "close"], setup(e2, { emit: d2, slots: p2 }) {
13
- const u2 = t(null), m2 = t(null), h2 = l({ wrapWidth: 0, firstRound: true, duration: 0, offsetWidth: 0, showNoticeBar: true, animationClass: "", animate: false, scrollList: [], distance: 0, timer: null, keepAlive: false, isCanScroll: null }), y2 = o(() => ({ [$]: true })), f2 = o(() => h2.isCanScroll == null ? e2.wrapable : !h2.isCanScroll && !e2.wrapable), g2 = o(() => e2.leftIcon != "close"), k2 = o(() => {
14
- let t2 = {};
15
- return e2.color && (t2.color = e2.color), e2.background && (t2.background = e2.background), e2.direction == "vertical" && (t2.height = `${e2.height}px`), t2;
16
- }), w2 = o(() => ({ animationDelay: (h2.firstRound ? e2.delay : 0) + "s", animationDuration: h2.duration + "s", transform: `translateX(${h2.firstRound ? 0 : h2.wrapWidth + "px"})` })), v2 = o(() => {
17
- let t2 = "";
18
- return e2.leftIcon && (t2 = e2.leftIcon), t2;
19
- }), C2 = o(() => {
20
- let t2 = {};
21
- if (e2.complexAm)
22
- t2 = { transform: `translateY(${h2.distance}px)` };
23
- else if (h2.animate) {
24
- let l2 = ~~(e2.height / e2.speed / 4);
25
- t2 = { transition: `all ${l2 == 0 ? ~~(e2.height / e2.speed) : l2}s`, "margin-top": `-${e2.height}px` };
10
+ const { componentName, create } = createComponent("noticebar");
11
+ const _sfc_main = create({
12
+ props: {
13
+ direction: {
14
+ type: String,
15
+ default: "across"
16
+ },
17
+ list: {
18
+ type: Array,
19
+ default: () => {
20
+ return [];
21
+ }
22
+ },
23
+ standTime: {
24
+ type: Number,
25
+ default: 1e3
26
+ },
27
+ complexAm: {
28
+ type: Boolean,
29
+ default: false
30
+ },
31
+ height: {
32
+ type: Number,
33
+ default: 40
34
+ },
35
+ text: {
36
+ type: String,
37
+ default: ""
38
+ },
39
+ closeMode: {
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ wrapable: {
44
+ type: Boolean,
45
+ default: false
46
+ },
47
+ leftIcon: { type: String, default: "" },
48
+ rightIcon: { type: String, default: "" },
49
+ color: {
50
+ type: String,
51
+ default: ""
52
+ },
53
+ background: {
54
+ type: String,
55
+ default: ""
56
+ },
57
+ delay: {
58
+ type: [String, Number],
59
+ default: 1
60
+ },
61
+ scrollable: {
62
+ type: Boolean,
63
+ default: null
64
+ },
65
+ speed: {
66
+ type: Number,
67
+ default: 50
26
68
  }
27
- return t2;
28
- });
29
- i(() => e2.text, (e3) => {
30
- b2();
31
- }), i(() => e2.list, (e3) => {
32
- h2.scrollList = [].concat(e3);
33
- });
34
- const b2 = (t2) => {
35
- h2.showNoticeBar != 0 && setTimeout(() => {
36
- if (!u2.value || !m2.value)
69
+ },
70
+ components: {
71
+ ScrollItem: function(props) {
72
+ props.item.props.style = props.style;
73
+ props.item.key = props.key;
74
+ return h(props.item);
75
+ }
76
+ },
77
+ emits: ["click", "close"],
78
+ setup(props, { emit, slots }) {
79
+ const wrap = ref(null);
80
+ const content = ref(null);
81
+ const state = reactive({
82
+ wrapWidth: 0,
83
+ firstRound: true,
84
+ duration: 0,
85
+ offsetWidth: 0,
86
+ showNoticeBar: true,
87
+ animationClass: "",
88
+ animate: false,
89
+ scrollList: [],
90
+ distance: 0,
91
+ timer: null,
92
+ keepAlive: false,
93
+ isCanScroll: null
94
+ });
95
+ const classes = computed(() => {
96
+ const prefixCls = componentName;
97
+ return {
98
+ [prefixCls]: true
99
+ };
100
+ });
101
+ const isEllipsis = computed(() => {
102
+ if (state.isCanScroll == null) {
103
+ return props.wrapable;
104
+ } else {
105
+ return !state.isCanScroll && !props.wrapable;
106
+ }
107
+ });
108
+ const iconShow = computed(() => {
109
+ if (props.leftIcon == "close") {
110
+ return false;
111
+ } else {
112
+ return true;
113
+ }
114
+ });
115
+ const barStyle = computed(() => {
116
+ let style = {};
117
+ props.color && (style.color = props.color);
118
+ props.background && (style.background = props.background);
119
+ if (props.direction == "vertical") {
120
+ style.height = `${props.height}px`;
121
+ }
122
+ return style;
123
+ });
124
+ const contentStyle = computed(() => {
125
+ return {
126
+ animationDelay: (state.firstRound ? props.delay : 0) + "s",
127
+ animationDuration: state.duration + "s",
128
+ transform: `translateX(${state.firstRound ? 0 : state.wrapWidth + "px"})`
129
+ };
130
+ });
131
+ const iconBg = computed(() => {
132
+ let iconBg2 = "";
133
+ if (props.leftIcon) {
134
+ iconBg2 = props.leftIcon;
135
+ }
136
+ return iconBg2;
137
+ });
138
+ const horseLampStyle = computed(() => {
139
+ let styles = {};
140
+ if (props.complexAm) {
141
+ styles = {
142
+ transform: `translateY(${state.distance}px)`
143
+ };
144
+ } else {
145
+ if (state.animate) {
146
+ let a = ~~(props.height / props.speed / 4);
147
+ styles = {
148
+ transition: `all ${a == 0 ? ~~(props.height / props.speed) : a}s`,
149
+ "margin-top": `-${props.height}px`
150
+ };
151
+ }
152
+ }
153
+ return styles;
154
+ });
155
+ watch(() => props.text, (value) => {
156
+ initScrollWrap();
157
+ });
158
+ watch(() => props.list, (value) => {
159
+ state.scrollList = [].concat(value);
160
+ });
161
+ const initScrollWrap = (value) => {
162
+ if (state.showNoticeBar == false) {
37
163
  return;
38
- const t3 = u2.value.getBoundingClientRect().width, l2 = m2.value.getBoundingClientRect().width;
39
- h2.isCanScroll = e2.scrollable == null ? l2 > t3 : e2.scrollable, h2.isCanScroll ? (h2.wrapWidth = t3, h2.offsetWidth = l2, h2.duration = l2 / e2.speed, h2.animationClass = "play") : h2.animationClass = "";
40
- }, 0);
41
- }, S2 = () => {
42
- h2.animate = true, setTimeout(() => {
43
- h2.scrollList.push(h2.scrollList[0]), h2.scrollList.shift(), h2.animate = false;
44
- }, ~~(e2.height / e2.speed / 4 * 1e3));
45
- }, I2 = (t2, l2) => {
46
- setTimeout(() => {
47
- h2.distance -= e2.height / 100, l2 && (h2.scrollList.push(h2.scrollList[0]), h2.scrollList.shift(), h2.distance = 0);
48
- }, t2 * e2.speed);
49
- };
50
- return n(() => {
51
- e2.direction == "vertical" ? (p2.default ? h2.scrollList = [].concat(p2.default()[0].children) : h2.scrollList = [].concat(e2.list), setTimeout(() => {
52
- e2.complexAm ? h2.timer = setInterval(() => {
53
- for (let e3 = 0; e3 < 100; e3++)
54
- I2(e3, !(e3 < 99));
55
- }, e2.standTime + 100 * e2.speed) : (S2(), h2.timer = setInterval(S2, ~~(e2.height / e2.speed / 4 * 1e3) + e2.standTime));
56
- }, e2.standTime)) : b2(e2.text);
57
- }), s(() => {
58
- h2.keepAlive && (h2.keepAlive = false);
59
- }), a(() => {
60
- h2.keepAlive = true, clearInterval(h2.timer);
61
- }), c(() => {
62
- clearInterval(h2.timer);
63
- }), { ...r(e2), ...r(h2), isEllipsis: f2, classes: y2, iconShow: g2, barStyle: k2, contentStyle: w2, iconBg: v2, horseLampStyle: C2, wrap: u2, content: m2, handleClick: (e3) => {
64
- d2("click", e3);
65
- }, onClickIcon: (t2) => {
66
- e2.closeMode && (h2.showNoticeBar = !e2.closeMode), d2("close", t2);
67
- }, onAnimationEnd: () => {
68
- h2.firstRound = false, setTimeout(() => {
69
- h2.duration = (h2.offsetWidth + h2.wrapWidth) / e2.speed, h2.animationClass = "play-infinite";
70
- }, 0);
71
- }, go: (e3) => {
72
- d2("click", e3);
73
- }, handleClickIcon: () => {
74
- d2("close", h2.scrollList[0]);
75
- }, slots: p2 };
76
- } }), E = { ref: "wrap", class: "wrap" }, W = ["onClick"];
77
- var M = B(T, [["render", function(e2, t2, l2, o2, i2, n2) {
78
- const s2 = d("nut-icon"), a2 = d("ScrollItem");
79
- return p(), u("view", { class: m(e2.classes) }, [e2.direction == "across" ? h((p(), u("view", { key: 0, class: m(["nut-noticebar-page", { withicon: e2.closeMode, close: e2.closeMode, wrapable: e2.wrapable }]), style: y(e2.barStyle), onClick: t2[3] || (t2[3] = (...t3) => e2.handleClick && e2.handleClick(...t3)) }, [e2.iconShow ? (p(), u("view", { key: 0, class: "left-icon", style: y({ "background-image": `url(${e2.iconBg})` }) }, [f(e2.$slots, "left-icon", {}, () => [e2.iconBg ? k("", true) : (p(), g(s2, { key: 0, name: "notice", size: "16", color: e2.color }, null, 8, ["color"]))])], 4)) : k("", true), w("view", E, [w("view", { ref: "content", class: m(["content", e2.animationClass, { "nut-ellipsis": e2.isEllipsis }]), style: y(e2.contentStyle), onAnimationend: t2[0] || (t2[0] = (...t3) => e2.onAnimationEnd && e2.onAnimationEnd(...t3)), onWebkitAnimationEnd: t2[1] || (t2[1] = (...t3) => e2.onAnimationEnd && e2.onAnimationEnd(...t3)) }, [f(e2.$slots, "default", {}, () => [v(C(e2.text), 1)])], 38)], 512), e2.closeMode || e2.rightIcon ? (p(), u("view", { key: 1, class: "right-icon", onClick: t2[2] || (t2[2] = b((...t3) => e2.onClickIcon && e2.onClickIcon(...t3), ["stop"])) }, [f(e2.$slots, "right-icon", {}, () => [S(s2, { name: e2.rightIcon ? e2.rightIcon : "close", color: e2.color }, null, 8, ["name", "color"])])])) : k("", true)], 6)), [[I, e2.showNoticeBar]]) : k("", true), e2.scrollList.length > 0 && e2.direction == "vertical" ? (p(), u("view", { key: 1, class: "nut-noticebar-vertical", style: y(e2.barStyle) }, [e2.slots.default ? (p(), u("view", { key: 0, class: "horseLamp_list", style: y(e2.horseLampStyle) }, [(p(true), u(L, null, x(e2.scrollList, (t3, l3) => (p(), g(a2, { key: l3, style: y({ height: e2.height + "px", "line-height": e2.height + "px" }), item: t3 }, null, 8, ["style", "item"]))), 128))], 4)) : (p(), u("ul", { key: 1, class: "horseLamp_list", style: y(e2.horseLampStyle) }, [(p(true), u(L, null, x(e2.scrollList, (t3, l3) => (p(), u("li", { class: "horseLamp_list_item", key: l3, style: y({ height: e2.height }), onClick: (l4) => e2.go(t3) }, C(t3), 13, W))), 128))], 4)), w("view", { class: "go", onClick: t2[4] || (t2[4] = (t3) => !e2.slots.rightIcon && e2.handleClickIcon()) }, [e2.slots.rightIcon ? f(e2.$slots, "rightIcon", { key: 0 }) : e2.closeMode ? (p(), g(s2, { key: 1, type: "cross", color: e2.color, size: "11px" }, null, 8, ["color"])) : k("", true)])], 4)) : k("", true)], 2);
80
- }]]);
81
- export { M as default };
164
+ }
165
+ setTimeout(() => {
166
+ if (!wrap.value || !content.value) {
167
+ return;
168
+ }
169
+ const wrapWidth = wrap.value.getBoundingClientRect().width;
170
+ const offsetWidth = content.value.getBoundingClientRect().width;
171
+ state.isCanScroll = props.scrollable == null ? offsetWidth > wrapWidth : props.scrollable;
172
+ console.log(111, state.isCanScroll);
173
+ if (state.isCanScroll) {
174
+ state.wrapWidth = wrapWidth;
175
+ state.offsetWidth = offsetWidth;
176
+ state.duration = offsetWidth / props.speed;
177
+ state.animationClass = "play";
178
+ } else {
179
+ state.animationClass = "";
180
+ }
181
+ }, 0);
182
+ };
183
+ const handleClick = (event) => {
184
+ emit("click", event);
185
+ };
186
+ const onClickIcon = (event) => {
187
+ if (props.closeMode) {
188
+ state.showNoticeBar = !props.closeMode;
189
+ }
190
+ emit("close", event);
191
+ };
192
+ const onAnimationEnd = () => {
193
+ state.firstRound = false;
194
+ setTimeout(() => {
195
+ state.duration = (state.offsetWidth + state.wrapWidth) / props.speed;
196
+ state.animationClass = "play-infinite";
197
+ }, 0);
198
+ };
199
+ const startRollEasy = () => {
200
+ showhorseLamp();
201
+ state.timer = setInterval(showhorseLamp, ~~(props.height / props.speed / 4 * 1e3) + props.standTime);
202
+ };
203
+ const showhorseLamp = () => {
204
+ state.animate = true;
205
+ setTimeout(() => {
206
+ state.scrollList.push(state.scrollList[0]);
207
+ state.scrollList.shift();
208
+ state.animate = false;
209
+ }, ~~(props.height / props.speed / 4 * 1e3));
210
+ };
211
+ const startRoll = () => {
212
+ state.timer = setInterval(() => {
213
+ let chunk = 100;
214
+ for (let i = 0; i < chunk; i++) {
215
+ scroll(i, i < chunk - 1 ? false : true);
216
+ }
217
+ }, props.standTime + 100 * props.speed);
218
+ };
219
+ const scroll = (n, last) => {
220
+ setTimeout(() => {
221
+ state.distance -= props.height / 100;
222
+ if (last) {
223
+ state.scrollList.push(state.scrollList[0]);
224
+ state.scrollList.shift();
225
+ state.distance = 0;
226
+ }
227
+ }, n * props.speed);
228
+ };
229
+ const go = (item) => {
230
+ emit("click", item);
231
+ };
232
+ const handleClickIcon = () => {
233
+ emit("close", state.scrollList[0]);
234
+ };
235
+ onMounted(() => {
236
+ if (props.direction == "vertical") {
237
+ if (slots.default) {
238
+ state.scrollList = [].concat(slots.default()[0].children);
239
+ } else {
240
+ state.scrollList = [].concat(props.list);
241
+ }
242
+ setTimeout(() => {
243
+ props.complexAm ? startRoll() : startRollEasy();
244
+ }, props.standTime);
245
+ } else {
246
+ initScrollWrap(props.text);
247
+ }
248
+ });
249
+ onActivated(() => {
250
+ if (state.keepAlive) {
251
+ state.keepAlive = false;
252
+ }
253
+ });
254
+ onDeactivated(() => {
255
+ state.keepAlive = true;
256
+ clearInterval(state.timer);
257
+ });
258
+ onUnmounted(() => {
259
+ clearInterval(state.timer);
260
+ });
261
+ return {
262
+ ...toRefs(props),
263
+ ...toRefs(state),
264
+ isEllipsis,
265
+ classes,
266
+ iconShow,
267
+ barStyle,
268
+ contentStyle,
269
+ iconBg,
270
+ horseLampStyle,
271
+ wrap,
272
+ content,
273
+ handleClick,
274
+ onClickIcon,
275
+ onAnimationEnd,
276
+ go,
277
+ handleClickIcon,
278
+ slots
279
+ };
280
+ }
281
+ });
282
+ const _hoisted_1 = {
283
+ ref: "wrap",
284
+ class: "wrap"
285
+ };
286
+ const _hoisted_2 = ["onClick"];
287
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
288
+ const _component_nut_icon = resolveComponent("nut-icon");
289
+ const _component_ScrollItem = resolveComponent("ScrollItem");
290
+ return openBlock(), createElementBlock("view", {
291
+ class: normalizeClass(_ctx.classes)
292
+ }, [
293
+ _ctx.direction == "across" ? withDirectives((openBlock(), createElementBlock("view", {
294
+ key: 0,
295
+ class: normalizeClass(["nut-noticebar-page", { withicon: _ctx.closeMode, close: _ctx.closeMode, wrapable: _ctx.wrapable }]),
296
+ style: normalizeStyle(_ctx.barStyle),
297
+ onClick: _cache[3] || (_cache[3] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
298
+ }, [
299
+ _ctx.iconShow ? (openBlock(), createElementBlock("view", {
300
+ key: 0,
301
+ class: "left-icon",
302
+ style: normalizeStyle({ "background-image": `url(${_ctx.iconBg})` })
303
+ }, [
304
+ renderSlot(_ctx.$slots, "left-icon", {}, () => [
305
+ !_ctx.iconBg ? (openBlock(), createBlock(_component_nut_icon, {
306
+ key: 0,
307
+ name: "notice",
308
+ size: "16",
309
+ color: _ctx.color
310
+ }, null, 8, ["color"])) : createCommentVNode("", true)
311
+ ])
312
+ ], 4)) : createCommentVNode("", true),
313
+ createElementVNode("view", _hoisted_1, [
314
+ createElementVNode("view", {
315
+ ref: "content",
316
+ class: normalizeClass(["content", _ctx.animationClass, { "nut-ellipsis": _ctx.isEllipsis }]),
317
+ style: normalizeStyle(_ctx.contentStyle),
318
+ onAnimationend: _cache[0] || (_cache[0] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args)),
319
+ onWebkitAnimationEnd: _cache[1] || (_cache[1] = (...args) => _ctx.onAnimationEnd && _ctx.onAnimationEnd(...args))
320
+ }, [
321
+ renderSlot(_ctx.$slots, "default", {}, () => [
322
+ createTextVNode(toDisplayString(_ctx.text), 1)
323
+ ])
324
+ ], 38)
325
+ ], 512),
326
+ _ctx.closeMode || _ctx.rightIcon ? (openBlock(), createElementBlock("view", {
327
+ key: 1,
328
+ class: "right-icon",
329
+ onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.onClickIcon && _ctx.onClickIcon(...args), ["stop"]))
330
+ }, [
331
+ renderSlot(_ctx.$slots, "right-icon", {}, () => [
332
+ createVNode(_component_nut_icon, {
333
+ name: _ctx.rightIcon ? _ctx.rightIcon : "close",
334
+ color: _ctx.color
335
+ }, null, 8, ["name", "color"])
336
+ ])
337
+ ])) : createCommentVNode("", true)
338
+ ], 6)), [
339
+ [vShow, _ctx.showNoticeBar]
340
+ ]) : createCommentVNode("", true),
341
+ _ctx.scrollList.length > 0 && _ctx.direction == "vertical" ? (openBlock(), createElementBlock("view", {
342
+ key: 1,
343
+ class: "nut-noticebar-vertical",
344
+ style: normalizeStyle(_ctx.barStyle)
345
+ }, [
346
+ _ctx.slots.default ? (openBlock(), createElementBlock("view", {
347
+ key: 0,
348
+ class: "horseLamp_list",
349
+ style: normalizeStyle(_ctx.horseLampStyle)
350
+ }, [
351
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index2) => {
352
+ return openBlock(), createBlock(_component_ScrollItem, {
353
+ key: index2,
354
+ style: normalizeStyle({ height: _ctx.height + "px", "line-height": _ctx.height + "px" }),
355
+ item
356
+ }, null, 8, ["style", "item"]);
357
+ }), 128))
358
+ ], 4)) : (openBlock(), createElementBlock("ul", {
359
+ key: 1,
360
+ class: "horseLamp_list",
361
+ style: normalizeStyle(_ctx.horseLampStyle)
362
+ }, [
363
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.scrollList, (item, index2) => {
364
+ return openBlock(), createElementBlock("li", {
365
+ class: "horseLamp_list_item",
366
+ key: index2,
367
+ style: normalizeStyle({ height: _ctx.height }),
368
+ onClick: ($event) => _ctx.go(item)
369
+ }, toDisplayString(item), 13, _hoisted_2);
370
+ }), 128))
371
+ ], 4)),
372
+ createElementVNode("view", {
373
+ class: "go",
374
+ onClick: _cache[4] || (_cache[4] = ($event) => !_ctx.slots.rightIcon && _ctx.handleClickIcon())
375
+ }, [
376
+ _ctx.slots.rightIcon ? renderSlot(_ctx.$slots, "rightIcon", { key: 0 }) : _ctx.closeMode ? (openBlock(), createBlock(_component_nut_icon, {
377
+ key: 1,
378
+ type: "cross",
379
+ color: _ctx.color,
380
+ size: "11px"
381
+ }, null, 8, ["color"])) : createCommentVNode("", true)
382
+ ])
383
+ ], 4)) : createCommentVNode("", true)
384
+ ], 2);
385
+ }
386
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
387
+ export { index as default };