@nutui/nutui 3.1.22-beta.3 → 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 (207) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +3 -4
  3. package/dist/nutui.es.js +20426 -4050
  4. package/dist/nutui.umd.js +20529 -4049
  5. package/dist/packages/_es/ActionSheet.js +149 -36
  6. package/dist/packages/_es/Address.js +535 -129
  7. package/dist/packages/_es/AddressList.js +615 -113
  8. package/dist/packages/_es/Animate.js +64 -0
  9. package/dist/packages/_es/Audio.js +257 -72
  10. package/dist/packages/_es/AudioOperate.js +100 -32
  11. package/dist/packages/_es/Avatar.js +162 -54
  12. package/dist/packages/_es/AvatarGroup.js +73 -14
  13. package/dist/packages/_es/BackTop.js +156 -43
  14. package/dist/packages/_es/Badge.js +86 -14
  15. package/dist/packages/_es/Barrage.js +120 -41
  16. package/dist/packages/_es/Button.js +128 -23
  17. package/dist/packages/_es/Calendar.js +246 -24
  18. package/dist/packages/_es/CalendarItem.js +2 -1
  19. package/dist/packages/_es/Card.js +107 -10
  20. package/dist/packages/_es/Cascader.js +496 -179
  21. package/dist/packages/_es/Category.js +58 -15
  22. package/dist/packages/_es/CategoryPane.js +111 -11
  23. package/dist/packages/_es/Cell.js +108 -21
  24. package/dist/packages/_es/CellGroup.js +44 -9
  25. package/dist/packages/_es/Checkbox.js +134 -29
  26. package/dist/packages/_es/CheckboxGroup.js +79 -29
  27. package/dist/packages/_es/CircleProgress.js +150 -28
  28. package/dist/packages/_es/Col.js +56 -14
  29. package/dist/packages/_es/Collapse.js +110 -24
  30. package/dist/packages/_es/CollapseItem.js +252 -80
  31. package/dist/packages/_es/Comment.js +434 -64
  32. package/dist/packages/_es/ConfigProvider.js +25 -0
  33. package/dist/packages/_es/CountDown.js +238 -75
  34. package/dist/packages/_es/CountUp.js +539 -159
  35. package/dist/packages/_es/DatePicker.js +315 -117
  36. package/dist/packages/_es/Dialog.js +289 -79
  37. package/dist/packages/_es/Divider.js +65 -32
  38. package/dist/packages/_es/Drag.js +197 -56
  39. package/dist/packages/_es/Ecard.js +159 -24
  40. package/dist/packages/_es/Elevator.js +255 -77
  41. package/dist/packages/_es/Ellipsis.js +206 -0
  42. package/dist/packages/_es/Empty.js +71 -12
  43. package/dist/packages/_es/FixedNav.js +122 -15
  44. package/dist/packages/_es/Form.js +151 -64
  45. package/dist/packages/_es/FormItem.js +114 -15
  46. package/dist/packages/_es/Grid.js +6 -5
  47. package/dist/packages/_es/GridItem.js +144 -33
  48. package/dist/packages/_es/Icon.js +40 -15
  49. package/dist/packages/_es/Image.js +142 -0
  50. package/dist/packages/_es/ImagePreview.js +547 -84
  51. package/dist/packages/_es/Indicator.js +62 -15
  52. package/dist/packages/_es/InfiniteLoading.js +249 -76
  53. package/dist/packages/_es/Input.js +433 -51
  54. package/dist/packages/_es/InputNumber.js +160 -41
  55. package/dist/packages/_es/Layout.js +5 -4
  56. package/dist/packages/_es/List.js +106 -37
  57. package/dist/packages/_es/Menu.js +168 -29
  58. package/dist/packages/_es/MenuItem.js +173 -34
  59. package/dist/packages/_es/Navbar.js +192 -30
  60. package/dist/packages/_es/NoticeBar.js +380 -93
  61. package/dist/packages/_es/Notify.js +227 -91
  62. package/dist/packages/_es/NumberKeyboard.js +272 -41
  63. package/dist/packages/_es/OldPicker.js +457 -149
  64. package/dist/packages/_es/OverLay.js +98 -40
  65. package/dist/packages/_es/Pagination.js +157 -39
  66. package/dist/packages/_es/Picker.js +460 -148
  67. package/dist/packages/_es/Popover.js +957 -337
  68. package/dist/packages/_es/Popup.js +299 -74
  69. package/dist/packages/_es/Price.js +118 -16
  70. package/dist/packages/_es/Progress.js +146 -14
  71. package/dist/packages/_es/PullRefresh.js +339 -100
  72. package/dist/packages/_es/Radio.js +90 -22
  73. package/dist/packages/_es/RadioGroup.js +37 -8
  74. package/dist/packages/_es/Range.js +408 -102
  75. package/dist/packages/_es/Rate.js +193 -16
  76. package/dist/packages/_es/Row.js +64 -22
  77. package/dist/packages/_es/SearchBar.js +238 -56
  78. package/dist/packages/_es/ShortPassword.js +225 -35
  79. package/dist/packages/_es/SideNavBar.js +81 -43
  80. package/dist/packages/_es/SideNavBarItem.js +46 -11
  81. package/dist/packages/_es/Signature.js +160 -60
  82. package/dist/packages/_es/Skeleton.js +136 -20
  83. package/dist/packages/_es/Sku.js +491 -103
  84. package/dist/packages/_es/Step.js +115 -39
  85. package/dist/packages/_es/Steps.js +53 -18
  86. package/dist/packages/_es/Sticky.js +138 -53
  87. package/dist/packages/_es/SubSideNavBar.js +82 -36
  88. package/dist/packages/_es/Swipe.js +178 -60
  89. package/dist/packages/_es/Swiper.js +433 -121
  90. package/dist/packages/_es/SwiperItem.js +53 -22
  91. package/dist/packages/_es/Switch.js +116 -21
  92. package/dist/packages/_es/TabPane.js +39 -12
  93. package/dist/packages/_es/Tabbar.js +72 -17
  94. package/dist/packages/_es/TabbarItem.js +151 -29
  95. package/dist/packages/_es/Table.js +178 -37
  96. package/dist/packages/_es/Tabs.js +202 -59
  97. package/dist/packages/_es/Tag.js +97 -20
  98. package/dist/packages/_es/TextArea.js +160 -42
  99. package/dist/packages/_es/TimeDetail.js +79 -37
  100. package/dist/packages/_es/TimePannel.js +48 -33
  101. package/dist/packages/_es/TimeSelect.js +112 -15
  102. package/dist/packages/_es/Toast.js +310 -90
  103. package/dist/packages/_es/Uploader.js +455 -120
  104. package/dist/packages/_es/Video.js +332 -93
  105. package/dist/packages/_es/common.js +128 -38
  106. package/dist/packages/_es/component.js +76 -35
  107. package/dist/packages/_es/index.js +6 -5
  108. package/dist/packages/_es/index2.js +30 -9
  109. package/dist/packages/_es/index3.js +8 -6
  110. package/dist/packages/_es/index4.js +64 -13
  111. package/dist/packages/_es/index5.js +783 -130
  112. package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
  113. package/dist/packages/_es/pxCheck.js +5 -3
  114. package/dist/packages/_es/raf.js +15 -8
  115. package/dist/packages/animate/index.scss +299 -0
  116. package/dist/packages/cell/index.scss +7 -1
  117. package/dist/packages/checkbox/index.scss +10 -0
  118. package/dist/packages/configprovider/index.scss +2 -0
  119. package/dist/packages/ellipsis/index.scss +12 -0
  120. package/dist/packages/formitem/index.scss +12 -0
  121. package/dist/packages/griditem/index.scss +11 -0
  122. package/dist/packages/image/index.scss +39 -0
  123. package/dist/packages/imagepreview/index.scss +26 -2
  124. package/dist/packages/input/index.scss +13 -0
  125. package/dist/packages/inputnumber/index.scss +21 -0
  126. package/dist/packages/locale/lang/baseLang.js +3 -3
  127. package/dist/packages/locale/lang/en-US.js +105 -5
  128. package/dist/packages/locale/lang/id-ID.js +105 -5
  129. package/dist/packages/locale/lang/index.js +38 -16
  130. package/dist/packages/locale/lang/zh-CN.js +105 -5
  131. package/dist/packages/locale/lang/zh-TW.js +105 -5
  132. package/dist/packages/menu/index.scss +45 -36
  133. package/dist/packages/menuitem/index.scss +4 -0
  134. package/dist/packages/navbar/index.scss +9 -0
  135. package/dist/packages/pagination/index.scss +19 -0
  136. package/dist/packages/radio/index.scss +18 -0
  137. package/dist/packages/range/index.scss +19 -0
  138. package/dist/packages/rate/index.scss +1 -1
  139. package/dist/packages/searchbar/index.scss +21 -0
  140. package/dist/packages/switch/index.scss +1 -0
  141. package/dist/packages/tabbar/index.scss +5 -0
  142. package/dist/packages/tabbaritem/index.scss +7 -0
  143. package/dist/packages/tabpane/index.scss +5 -0
  144. package/dist/packages/tabs/index.scss +22 -0
  145. package/dist/packages/textarea/index.scss +8 -0
  146. package/dist/smartips/attributes.json +140 -4
  147. package/dist/smartips/tags.json +55 -6
  148. package/dist/smartips/web-types.json +6963 -0
  149. package/dist/style.css +1 -1
  150. package/dist/style.es.js +1 -1
  151. package/dist/styles/font/config.json +3 -1
  152. package/dist/styles/font/demo_index.html +49 -3
  153. package/dist/styles/font/iconfont.css +11 -3
  154. package/dist/styles/font/iconfont.js +15 -15
  155. package/dist/styles/font/iconfont.json +14 -0
  156. package/dist/styles/font/iconfont.ttf +0 -0
  157. package/dist/styles/font/iconfont.woff +0 -0
  158. package/dist/styles/font/iconfont.woff2 +0 -0
  159. package/dist/styles/themes/default.scss +54 -50
  160. package/dist/styles/themes/jdb.scss +54 -50
  161. package/dist/styles/themes/jdt.scss +54 -50
  162. package/dist/styles/variables-jdb.scss +12 -0
  163. package/dist/styles/variables-jdt.scss +12 -0
  164. package/dist/styles/variables.scss +12 -0
  165. package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
  166. package/dist/types/__VUE/address/index.vue.d.ts +7 -7
  167. package/dist/types/__VUE/animate/index.vue.d.ts +48 -0
  168. package/dist/types/__VUE/animate/type.d.ts +6 -0
  169. package/dist/types/__VUE/avatar/index.vue.d.ts +3 -3
  170. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  171. package/dist/types/__VUE/calendaritem/index.vue.d.ts +10 -2
  172. package/dist/types/__VUE/cascader/index.vue.d.ts +2 -2
  173. package/dist/types/__VUE/circleprogress/index.vue.d.ts +2 -2
  174. package/dist/types/__VUE/collapse/index.vue.d.ts +3 -1
  175. package/dist/types/__VUE/configprovider/common.d.ts +20 -0
  176. package/dist/types/__VUE/configprovider/index.vue.d.ts +33 -0
  177. package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
  178. package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
  179. package/dist/types/__VUE/ellipsis/index.vue.d.ts +72 -0
  180. package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
  181. package/dist/types/__VUE/grid/index.vue.d.ts +2 -2
  182. package/dist/types/__VUE/image/index.vue.d.ts +105 -0
  183. package/dist/types/__VUE/image/type.d.ts +6 -0
  184. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
  185. package/dist/types/__VUE/imagepreview/index.vue.d.ts +56 -24
  186. package/dist/types/__VUE/menu/index.vue.d.ts +31 -4
  187. package/dist/types/__VUE/menuitem/index.vue.d.ts +12 -3
  188. package/dist/types/__VUE/noticebar/index.vue.d.ts +1 -1
  189. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
  190. package/dist/types/__VUE/oldpicker/index.vue.d.ts +4 -4
  191. package/dist/types/__VUE/picker/index.vue.d.ts +4 -4
  192. package/dist/types/__VUE/popover/index.vue.d.ts +8 -8
  193. package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
  194. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  195. package/dist/types/__VUE/rate/common.d.ts +149 -0
  196. package/dist/types/__VUE/rate/index.vue.d.ts +17 -7
  197. package/dist/types/__VUE/row/index.vue.d.ts +2 -2
  198. package/dist/types/__VUE/shortpassword/index.vue.d.ts +2 -2
  199. package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
  200. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  201. package/dist/types/__VUE/swiper/index.vue.d.ts +2 -2
  202. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  203. package/dist/types/__VUE/timeselect/index.vue.d.ts +3 -2
  204. package/dist/types/__VUE/uploader/uploader.d.ts +1 -0
  205. package/dist/types/index.d.ts +1 -1
  206. package/dist/types/nutui.d.ts +5 -1
  207. package/package.json +5 -4
@@ -1,84 +1,262 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a2, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a2, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a2, prop, b[prop]);
16
- }
17
- return a2;
18
- };
19
- var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b));
20
1
  /*!
21
- * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
22
3
  * (c) 2022 @jdf2e.
23
4
  * Released under the MIT License.
24
5
  */
25
- import { ref as e, reactive as t, computed as l, onMounted as i, watch as c, nextTick as n, toRefs as r, openBlock as s, createElementBlock as o, normalizeClass as a, createElementVNode as u, normalizeStyle as d, Fragment as h, renderList as p, toDisplayString as _, withDirectives as x, vShow as g, createCommentVNode as v, withModifiers as y } from "vue";
26
- import { c as f } from "./component.js";
27
- import { u as m } from "./index3.js";
28
- import { _ as k } from "./plugin-vue_export-helper.js";
6
+ import { ref, reactive, computed, onMounted, watch, nextTick, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, Fragment, renderList, toDisplayString, renderSlot, withDirectives, vShow, createCommentVNode, withModifiers } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { u as useExpose } from "./index3.js";
9
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
29
10
  import "../locale/lang";
30
- const { componentName: H, create: I } = f("elevator"), S = I({ props: { height: { type: [Number, String], default: "200px" }, acceptKey: { type: [String], default: "title" }, indexList: { type: Array, default: () => [] }, isSticky: { type: [Boolean], default: false }, spaceHeight: { type: [Number], default: 23 }, titleHeight: { type: [Number], default: 35 } }, emits: ["click-item", "click-index"], setup(s2, o2) {
31
- const a2 = e(null), u2 = t({ anchorIndex: 0, codeIndex: 0, listHeight: [], listGroup: [], touchState: { y1: 0, y2: 0 }, scrollStart: false, currentIndex: 0, currentData: {}, currentKey: "", scrollY: 0, diff: -1, fixedTop: 0 }), d2 = l(() => ({ [H]: true })), h2 = l(() => ({ transform: `translate3d(0, ${u2.scrollY + u2.fixedTop}px, 0)` })), p2 = l(() => a2.value.clientHeight), _2 = () => {
32
- let e2 = 0;
33
- u2.listHeight.push(e2);
34
- for (let t2 = 0; t2 < u2.listGroup.length; t2++) {
35
- e2 += u2.listGroup[t2].clientHeight, u2.listHeight.push(e2);
36
- }
37
- }, x2 = (e2) => {
38
- (e2 || e2 === 0) && (e2 < 0 && (e2 = 0), e2 > u2.listHeight.length - 2 && (e2 = u2.listHeight.length - 2), u2.codeIndex = e2, a2.value.scrollTo(0, u2.listHeight[e2]));
39
- }, g2 = (e2) => {
40
- let t2 = e2.target.scrollTop;
41
- const l2 = u2.listHeight;
42
- u2.scrollY = t2;
43
- for (let e3 = 0; e3 < l2.length - 1; e3++) {
44
- let t3 = l2[e3], i2 = l2[e3 + 1];
45
- if (u2.scrollY >= t3 && u2.scrollY < i2)
46
- return u2.currentIndex = e3, void (u2.diff = i2 - u2.scrollY);
11
+ const { componentName, create } = createComponent("elevator");
12
+ const _sfc_main = create({
13
+ props: {
14
+ height: {
15
+ type: [Number, String],
16
+ default: "200px"
17
+ },
18
+ acceptKey: {
19
+ type: [String],
20
+ default: "title"
21
+ },
22
+ indexList: {
23
+ type: Array,
24
+ default: () => {
25
+ return [];
26
+ }
27
+ },
28
+ isSticky: {
29
+ type: [Boolean],
30
+ default: false
31
+ },
32
+ spaceHeight: {
33
+ type: [Number],
34
+ default: 23
35
+ },
36
+ titleHeight: {
37
+ type: [Number],
38
+ default: 35
47
39
  }
48
- u2.currentIndex = l2.length - 2;
49
- };
50
- return i(() => {
51
- a2.value.addEventListener("scroll", g2);
52
- }), m({ scrollTo: x2 }), c(() => u2.listGroup.length, () => {
53
- u2.listHeight = [], n(_2);
54
- }), c(() => u2.diff, (e2) => {
55
- const t2 = u2.listHeight;
56
- let l2 = e2 > 0 && e2 < s2.titleHeight ? e2 - s2.titleHeight : 0;
57
- u2.scrollY + p2.value === t2[t2.length - 1] && l2 !== 0 && (l2 = 0), u2.fixedTop !== l2 && (u2.fixedTop = l2);
58
- }), __spreadProps(__spreadValues({ classes: d2 }, r(u2)), { fixedStyle: h2, clientHeight: p2, setListGroup: (e2) => {
59
- n(() => {
60
- u2.listGroup.includes(e2) || e2 == null || u2.listGroup.push(e2);
40
+ },
41
+ emits: ["click-item", "click-index"],
42
+ setup(props, context) {
43
+ const listview = ref(null);
44
+ const state = reactive({
45
+ anchorIndex: 0,
46
+ codeIndex: 0,
47
+ listHeight: [],
48
+ listGroup: [],
49
+ touchState: {
50
+ y1: 0,
51
+ y2: 0
52
+ },
53
+ scrollStart: false,
54
+ currentIndex: 0,
55
+ currentData: {},
56
+ currentKey: "",
57
+ scrollY: 0,
58
+ diff: -1,
59
+ fixedTop: 0
60
+ });
61
+ const classes = computed(() => {
62
+ const prefixCls = componentName;
63
+ return {
64
+ [prefixCls]: true
65
+ };
66
+ });
67
+ const fixedStyle = computed(() => {
68
+ return {
69
+ transform: `translate3d(0, ${state.scrollY + state.fixedTop}px, 0)`
70
+ };
71
+ });
72
+ const clientHeight = computed(() => {
73
+ return listview.value.clientHeight;
74
+ });
75
+ const getData = (el, name) => {
76
+ const prefix = "data-";
77
+ return el.getAttribute(prefix + name);
78
+ };
79
+ const setListGroup = (el) => {
80
+ nextTick(() => {
81
+ if (!state.listGroup.includes(el) && el != null) {
82
+ state.listGroup.push(el);
83
+ }
84
+ });
85
+ };
86
+ const calculateHeight = () => {
87
+ let height = 0;
88
+ state.listHeight.push(height);
89
+ for (let i = 0; i < state.listGroup.length; i++) {
90
+ let item = state.listGroup[i];
91
+ height += item.clientHeight;
92
+ state.listHeight.push(height);
93
+ }
94
+ };
95
+ const scrollTo = (index2) => {
96
+ if (!index2 && index2 !== 0) {
97
+ return;
98
+ }
99
+ if (index2 < 0)
100
+ index2 = 0;
101
+ if (index2 > state.listHeight.length - 2)
102
+ index2 = state.listHeight.length - 2;
103
+ state.codeIndex = index2;
104
+ listview.value.scrollTo(0, state.listHeight[index2]);
105
+ };
106
+ const touchStart = (e) => {
107
+ state.scrollStart = true;
108
+ let index2 = getData(e.target, "index");
109
+ let firstTouch = e.touches[0];
110
+ state.touchState.y1 = firstTouch.pageY;
111
+ state.anchorIndex = +index2;
112
+ state.codeIndex = +index2;
113
+ scrollTo(+index2);
114
+ };
115
+ const touchMove = (e) => {
116
+ let firstTouch = e.touches[0];
117
+ state.touchState.y2 = firstTouch.pageY;
118
+ let delta = (state.touchState.y2 - state.touchState.y1) / props.spaceHeight | 0;
119
+ state.codeIndex = state.anchorIndex + delta;
120
+ scrollTo(state.codeIndex);
121
+ };
122
+ const touchEnd = () => {
123
+ state.scrollStart = false;
124
+ };
125
+ const handleClickItem = (key, item) => {
126
+ context.emit("click-item", key, item);
127
+ state.currentData = item;
128
+ state.currentKey = key;
129
+ };
130
+ const handleClickIndex = (key) => {
131
+ context.emit("click-index", key);
132
+ };
133
+ const listViewScroll = (e) => {
134
+ let target = e.target;
135
+ let scrollTop = target.scrollTop;
136
+ const listHeight = state.listHeight;
137
+ state.scrollY = scrollTop;
138
+ for (let i = 0; i < listHeight.length - 1; i++) {
139
+ let height1 = listHeight[i];
140
+ let height2 = listHeight[i + 1];
141
+ if (state.scrollY >= height1 && state.scrollY < height2) {
142
+ state.currentIndex = i;
143
+ state.diff = height2 - state.scrollY;
144
+ return;
145
+ }
146
+ }
147
+ state.currentIndex = listHeight.length - 2;
148
+ };
149
+ onMounted(() => {
150
+ listview.value.addEventListener("scroll", listViewScroll);
151
+ });
152
+ useExpose({
153
+ scrollTo
154
+ });
155
+ watch(() => state.listGroup.length, () => {
156
+ state.listHeight = [];
157
+ nextTick(calculateHeight);
158
+ });
159
+ watch(() => state.diff, (newVal) => {
160
+ const listHeight = state.listHeight;
161
+ let fixedTop = newVal > 0 && newVal < props.titleHeight ? newVal - props.titleHeight : 0;
162
+ if (state.scrollY + clientHeight.value === listHeight[listHeight.length - 1]) {
163
+ if (fixedTop !== 0)
164
+ fixedTop = 0;
165
+ }
166
+ if (state.fixedTop === fixedTop)
167
+ return;
168
+ state.fixedTop = fixedTop;
61
169
  });
62
- }, listview: a2, touchStart: (e2) => {
63
- u2.scrollStart = true;
64
- let t2 = (l2 = e2.target, i2 = "index", l2.getAttribute("data-" + i2));
65
- var l2, i2;
66
- let c2 = e2.touches[0];
67
- u2.touchState.y1 = c2.pageY, u2.anchorIndex = +t2, u2.codeIndex = +t2, x2(+t2);
68
- }, touchMove: (e2) => {
69
- let t2 = e2.touches[0];
70
- u2.touchState.y2 = t2.pageY;
71
- let l2 = (u2.touchState.y2 - u2.touchState.y1) / s2.spaceHeight | 0;
72
- u2.codeIndex = u2.anchorIndex + l2, x2(u2.codeIndex);
73
- }, touchEnd: () => {
74
- u2.scrollStart = false;
75
- }, handleClickItem: (e2, t2) => {
76
- o2.emit("click-item", e2, t2), u2.currentData = t2, u2.currentKey = e2;
77
- }, handleClickIndex: (e2) => {
78
- o2.emit("click-index", e2);
79
- } });
80
- } }), K = { class: "nut-elevator__list__item__code" }, w = ["onClick", "innerHTML"], L = { class: "fixed-title" }, T = { class: "nut-elevator__bars__inner" }, Y = ["data-index", "onClick"];
81
- var C = k(S, [["render", function(e2, t2, l2, i2, c2, n2) {
82
- return s(), o("view", { class: a(e2.classes) }, [u("view", { class: "nut-elevator__list", ref: "listview", style: d({ height: isNaN(+e2.height) ? e2.height : `${e2.height}px` }) }, [(s(true), o(h, null, p(e2.indexList, (t3) => (s(), o("view", { class: "nut-elevator__list__item", key: t3[e2.acceptKey], ref: e2.setListGroup }, [u("view", K, _(t3[e2.acceptKey]), 1), (s(true), o(h, null, p(t3.list, (l3) => (s(), o("view", { class: a(["nut-elevator__list__item__name", { "nut-elevator__list__item__name--highcolor": e2.currentData.id === l3.id && e2.currentKey === t3[e2.acceptKey] }]), key: l3.id, onClick: (i3) => e2.handleClickItem(t3[e2.acceptKey], l3), innerHTML: l3.name }, null, 10, w))), 128))], 512))), 128)), e2.isSticky ? x((s(), o("view", { key: 0, class: "nut-elevator__list__fixed", style: d(e2.fixedStyle) }, [u("span", L, _(e2.indexList[e2.currentIndex][e2.acceptKey]), 1)], 4)), [[g, e2.scrollY > 0]]) : v("", true)], 4), e2.indexList.length ? x((s(), o("view", { key: 0, class: "nut-elevator__code--current" }, _(e2.indexList[e2.codeIndex][e2.acceptKey]), 513)), [[g, e2.scrollStart]]) : v("", true), u("view", { class: "nut-elevator__bars", onTouchstart: t2[0] || (t2[0] = (...t3) => e2.touchStart && e2.touchStart(...t3)), onTouchmove: t2[1] || (t2[1] = y((...t3) => e2.touchMove && e2.touchMove(...t3), ["stop", "prevent"])), onTouchend: t2[2] || (t2[2] = (...t3) => e2.touchEnd && e2.touchEnd(...t3)) }, [u("view", T, [(s(true), o(h, null, p(e2.indexList, (t3, l3) => (s(), o("view", { class: a(["nut-elevator__bars__inner__item", { active: t3[e2.acceptKey] === e2.indexList[e2.currentIndex][e2.acceptKey] }]), "data-index": l3, key: t3[e2.acceptKey], onClick: (l4) => e2.handleClickIndex(t3[e2.acceptKey]) }, _(t3[e2.acceptKey]), 11, Y))), 128))])], 32)], 2);
83
- }]]);
84
- export { C as default };
170
+ return {
171
+ classes,
172
+ ...toRefs(state),
173
+ fixedStyle,
174
+ clientHeight,
175
+ setListGroup,
176
+ listview,
177
+ touchStart,
178
+ touchMove,
179
+ touchEnd,
180
+ handleClickItem,
181
+ handleClickIndex
182
+ };
183
+ }
184
+ });
185
+ const _hoisted_1 = { class: "nut-elevator__list__item__code" };
186
+ const _hoisted_2 = ["onClick"];
187
+ const _hoisted_3 = ["innerHTML"];
188
+ const _hoisted_4 = { class: "fixed-title" };
189
+ const _hoisted_5 = { class: "nut-elevator__bars__inner" };
190
+ const _hoisted_6 = ["data-index", "onClick"];
191
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
192
+ return openBlock(), createElementBlock("view", {
193
+ class: normalizeClass(_ctx.classes)
194
+ }, [
195
+ createElementVNode("view", {
196
+ class: "nut-elevator__list",
197
+ ref: "listview",
198
+ style: normalizeStyle({ height: isNaN(+_ctx.height) ? _ctx.height : `${_ctx.height}px` })
199
+ }, [
200
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.indexList, (item) => {
201
+ return openBlock(), createElementBlock("view", {
202
+ class: "nut-elevator__list__item",
203
+ key: item[_ctx.acceptKey],
204
+ ref: _ctx.setListGroup
205
+ }, [
206
+ createElementVNode("view", _hoisted_1, toDisplayString(item[_ctx.acceptKey]), 1),
207
+ (openBlock(true), createElementBlock(Fragment, null, renderList(item.list, (subitem) => {
208
+ return openBlock(), createElementBlock("view", {
209
+ class: normalizeClass(["nut-elevator__list__item__name", {
210
+ "nut-elevator__list__item__name--highcolor": _ctx.currentData.id === subitem.id && _ctx.currentKey === item[_ctx.acceptKey]
211
+ }]),
212
+ key: subitem["id"],
213
+ onClick: ($event) => _ctx.handleClickItem(item[_ctx.acceptKey], subitem)
214
+ }, [
215
+ !_ctx.$slots.default ? (openBlock(), createElementBlock("span", {
216
+ key: 0,
217
+ innerHTML: subitem.name
218
+ }, null, 8, _hoisted_3)) : renderSlot(_ctx.$slots, "default", {
219
+ key: 1,
220
+ item: subitem
221
+ })
222
+ ], 10, _hoisted_2);
223
+ }), 128))
224
+ ], 512);
225
+ }), 128)),
226
+ _ctx.isSticky ? withDirectives((openBlock(), createElementBlock("view", {
227
+ key: 0,
228
+ class: "nut-elevator__list__fixed",
229
+ style: normalizeStyle(_ctx.fixedStyle)
230
+ }, [
231
+ createElementVNode("span", _hoisted_4, toDisplayString(_ctx.indexList[_ctx.currentIndex][_ctx.acceptKey]), 1)
232
+ ], 4)), [
233
+ [vShow, _ctx.scrollY > 0]
234
+ ]) : createCommentVNode("", true)
235
+ ], 4),
236
+ _ctx.indexList.length ? withDirectives((openBlock(), createElementBlock("view", {
237
+ key: 0,
238
+ class: "nut-elevator__code--current"
239
+ }, toDisplayString(_ctx.indexList[_ctx.codeIndex][_ctx.acceptKey]), 513)), [
240
+ [vShow, _ctx.scrollStart]
241
+ ]) : createCommentVNode("", true),
242
+ createElementVNode("view", {
243
+ class: "nut-elevator__bars",
244
+ onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.touchStart && _ctx.touchStart(...args)),
245
+ onTouchmove: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.touchMove && _ctx.touchMove(...args), ["stop", "prevent"])),
246
+ onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.touchEnd && _ctx.touchEnd(...args))
247
+ }, [
248
+ createElementVNode("view", _hoisted_5, [
249
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.indexList, (item, index2) => {
250
+ return openBlock(), createElementBlock("view", {
251
+ class: normalizeClass(["nut-elevator__bars__inner__item", { active: item[_ctx.acceptKey] === _ctx.indexList[_ctx.currentIndex][_ctx.acceptKey] }]),
252
+ "data-index": index2,
253
+ key: item[_ctx.acceptKey],
254
+ onClick: ($event) => _ctx.handleClickIndex(item[_ctx.acceptKey])
255
+ }, toDisplayString(item[_ctx.acceptKey]), 11, _hoisted_6);
256
+ }), 128))
257
+ ])
258
+ ], 32)
259
+ ], 2);
260
+ }
261
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
262
+ export { index as default };
@@ -0,0 +1,206 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.23-beta.0 Mon Jun 27 2022 17:55:50 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { ref, reactive, computed, watch, onMounted, toRefs, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createTextVNode, withModifiers } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
+ import "../locale/lang";
10
+ const { componentName, create } = createComponent("ellipsis");
11
+ const _sfc_main = create({
12
+ props: {
13
+ content: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ direction: {
18
+ type: String,
19
+ default: "end"
20
+ },
21
+ rows: {
22
+ type: [Number, String],
23
+ default: 1
24
+ },
25
+ expandText: {
26
+ type: String,
27
+ default: ""
28
+ },
29
+ collapseText: {
30
+ type: String,
31
+ default: ""
32
+ },
33
+ symbol: {
34
+ type: String,
35
+ default: "..."
36
+ }
37
+ },
38
+ emits: ["click", "change"],
39
+ setup(props, { emit }) {
40
+ const root = ref(null);
41
+ let container = null;
42
+ let maxHeight = 0;
43
+ const ellipsis = ref();
44
+ const state = reactive({
45
+ exceeded: false,
46
+ expanded: false
47
+ });
48
+ const classes = computed(() => {
49
+ const prefixCls = componentName;
50
+ return {
51
+ [prefixCls]: true
52
+ };
53
+ });
54
+ watch(() => props.content, (newV, oldVal) => {
55
+ if (newV != oldVal) {
56
+ if (container) {
57
+ document.body.appendChild(container);
58
+ }
59
+ createContainer();
60
+ }
61
+ });
62
+ onMounted(() => {
63
+ createContainer();
64
+ });
65
+ const createContainer = () => {
66
+ if (!root.value)
67
+ return;
68
+ const originStyle = window.getComputedStyle(root.value);
69
+ container = document.createElement("div");
70
+ const styleNames = Array.prototype.slice.apply(originStyle);
71
+ styleNames.forEach((name) => {
72
+ container.style.setProperty(name, originStyle.getPropertyValue(name));
73
+ });
74
+ container.style.position = "fixed";
75
+ container.style.left = "999999px";
76
+ container.style.top = "999999px";
77
+ container.style.zIndex = "-1000";
78
+ container.style.height = "auto";
79
+ container.style.minHeight = "auto";
80
+ container.style.maxHeight = "auto";
81
+ container.style.textOverflow = "clip";
82
+ container.style.whiteSpace = "normal";
83
+ container.style.webkitLineClamp = "unset";
84
+ container.style.display = "block";
85
+ const lineHeight = pxToNumber(originStyle.lineHeight);
86
+ maxHeight = Math.floor(lineHeight * (Number(props.rows) + 0.5) + pxToNumber(originStyle.paddingTop) + pxToNumber(originStyle.paddingBottom));
87
+ container.innerText = props.content;
88
+ document.body.appendChild(container);
89
+ calcEllipse();
90
+ };
91
+ const calcEllipse = () => {
92
+ if (container.offsetHeight <= maxHeight) {
93
+ state.exceeded = false;
94
+ } else {
95
+ state.exceeded = true;
96
+ const end = props.content.length;
97
+ const middle = Math.floor((0 + end) / 2);
98
+ const ellipsised = props.direction === "middle" ? tailorMiddle([0, middle], [middle, end]) : tailor(0, end);
99
+ ellipsis.value = ellipsised;
100
+ document.body.removeChild(container);
101
+ }
102
+ };
103
+ const tailor = (left, right) => {
104
+ const actionText = state.expanded ? props.collapseText : props.expandText;
105
+ const end = props.content.length;
106
+ if (right - left <= 1) {
107
+ if (props.direction === "end") {
108
+ return {
109
+ leading: props.content.slice(0, left) + props.symbol
110
+ };
111
+ } else {
112
+ return {
113
+ tailing: props.symbol + props.content.slice(right, end)
114
+ };
115
+ }
116
+ }
117
+ const middle = Math.round((left + right) / 2);
118
+ if (props.direction === "end") {
119
+ container.innerText = props.content.slice(0, middle) + props.symbol + actionText;
120
+ } else {
121
+ container.innerText = actionText + props.symbol + props.content.slice(middle, end);
122
+ }
123
+ if (container.offsetHeight <= maxHeight) {
124
+ if (props.direction === "end") {
125
+ return tailor(middle, right);
126
+ } else {
127
+ return tailor(left, middle);
128
+ }
129
+ } else {
130
+ if (props.direction === "end") {
131
+ return tailor(left, middle);
132
+ } else {
133
+ return tailor(middle, right);
134
+ }
135
+ }
136
+ };
137
+ const tailorMiddle = (leftPart, rightPart) => {
138
+ const actionText = state.expanded ? props.collapseText : props.expandText;
139
+ const end = props.content.length;
140
+ if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
141
+ return {
142
+ leading: props.content.slice(0, leftPart[0]) + props.symbol,
143
+ tailing: props.symbol + props.content.slice(rightPart[1], end)
144
+ };
145
+ }
146
+ const leftPartMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
147
+ const rightPartMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
148
+ container.innerText = props.content.slice(0, leftPartMiddle) + props.symbol + actionText + props.symbol + props.content.slice(rightPartMiddle, end);
149
+ if (container.offsetHeight <= maxHeight) {
150
+ return tailorMiddle([leftPartMiddle, leftPart[1]], [rightPart[0], rightPartMiddle]);
151
+ } else {
152
+ return tailorMiddle([leftPart[0], leftPartMiddle], [rightPartMiddle, rightPart[1]]);
153
+ }
154
+ };
155
+ const pxToNumber = (value) => {
156
+ if (!value)
157
+ return 0;
158
+ const match = value.match(/^\d*(\.\d*)?/);
159
+ return match ? Number(match[0]) : 0;
160
+ };
161
+ const clickHandle = (type) => {
162
+ if (type == 1) {
163
+ state.expanded = true;
164
+ emit("change", "expand");
165
+ } else {
166
+ state.expanded = false;
167
+ emit("change", "collapse");
168
+ }
169
+ };
170
+ const handleClick = () => {
171
+ emit("click");
172
+ };
173
+ return { ...toRefs(state), root, ellipsis, classes, clickHandle, handleClick };
174
+ }
175
+ });
176
+ const _hoisted_1 = { key: 0 };
177
+ const _hoisted_2 = { key: 1 };
178
+ const _hoisted_3 = { key: 2 };
179
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
180
+ return openBlock(), createElementBlock("view", {
181
+ class: normalizeClass(_ctx.classes),
182
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)),
183
+ ref: "root"
184
+ }, [
185
+ !_ctx.exceeded ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.content), 1)) : createCommentVNode("", true),
186
+ _ctx.exceeded && !_ctx.expanded ? (openBlock(), createElementBlock("view", _hoisted_2, [
187
+ createTextVNode(toDisplayString(_ctx.ellipsis.leading), 1),
188
+ _ctx.expandText ? (openBlock(), createElementBlock("span", {
189
+ key: 0,
190
+ class: "nut-ellipsis-text",
191
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.clickHandle(1), ["stop"]))
192
+ }, toDisplayString(_ctx.expandText), 1)) : createCommentVNode("", true),
193
+ createTextVNode(toDisplayString(_ctx.ellipsis.tailing), 1)
194
+ ])) : createCommentVNode("", true),
195
+ _ctx.exceeded && _ctx.expanded ? (openBlock(), createElementBlock("view", _hoisted_3, [
196
+ createTextVNode(toDisplayString(_ctx.content) + " ", 1),
197
+ _ctx.expandText ? (openBlock(), createElementBlock("span", {
198
+ key: 0,
199
+ class: "nut-ellipsis-text",
200
+ onClick: _cache[1] || (_cache[1] = withModifiers(($event) => _ctx.clickHandle(2), ["stop"]))
201
+ }, toDisplayString(_ctx.collapseText), 1)) : createCommentVNode("", true)
202
+ ])) : createCommentVNode("", true)
203
+ ], 2);
204
+ }
205
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
206
+ export { index as default };
@@ -1,17 +1,76 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 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 { toRefs as e, computed as t, openBlock as s, createElementBlock as a, createElementVNode as i, normalizeStyle as l, renderSlot as r, Fragment as p, createCommentVNode as m, toDisplayString as o } from "vue";
7
- import { c } from "./component.js";
8
- import { _ as n } from "./plugin-vue_export-helper.js";
6
+ import { toRefs, computed, openBlock, createElementBlock, createElementVNode, normalizeStyle, renderSlot, Fragment, createCommentVNode, toDisplayString } 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: u, create: g, translate: d } = c("empty"), y = { empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png", error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png", network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png" }, f = g({ props: { image: { type: String, default: "empty" }, imageSize: { type: [Number, String], default: "" }, description: { type: String, default: "" } }, setup(s2) {
11
- const { image: a2, imageSize: i2 } = e(s2), l2 = t(() => i2.value ? typeof i2.value == "number" ? `width:${i2.value}px;height:${i2.value}px` : `width:${i2.value};height:${i2.value}` : "");
12
- return { imageUrl: a2.value.startsWith("https://") || a2.value.startsWith("http://") || a2.value.startsWith("//") ? a2.value : y[a2.value], imgStyle: l2, translate: d };
13
- } }), v = { class: "nut-empty" }, h = ["src"], $ = { key: 1, class: "nut-empty-description" };
14
- var k = n(f, [["render", function(e2, t2, c2, n2, u2, g2) {
15
- return s(), a("view", v, [i("view", { class: "nut-empty-image", style: l(e2.imgStyle) }, [e2.$slots.image ? r(e2.$slots, "image", { key: 0 }) : (s(), a(p, { key: 1 }, [e2.imageUrl ? (s(), a("img", { key: 0, class: "img", src: e2.imageUrl }, null, 8, h)) : m("", true)], 64))], 4), e2.$slots.description ? r(e2.$slots, "description", { key: 0 }) : (s(), a("view", $, o(e2.description || e2.translate("noData")), 1)), e2.$slots.default ? r(e2.$slots, "default", { key: 2 }) : m("", true)]);
16
- }]]);
17
- export { k as default };
10
+ const { componentName, create, translate } = createComponent("empty");
11
+ const defaultStatus = {
12
+ empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png",
13
+ error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png",
14
+ network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png"
15
+ };
16
+ const _sfc_main = create({
17
+ props: {
18
+ image: {
19
+ type: String,
20
+ default: "empty"
21
+ },
22
+ imageSize: {
23
+ type: [Number, String],
24
+ default: ""
25
+ },
26
+ description: {
27
+ type: String,
28
+ default: ""
29
+ }
30
+ },
31
+ setup(props) {
32
+ const { image, imageSize } = toRefs(props);
33
+ const imgStyle = computed(() => {
34
+ if (!imageSize.value) {
35
+ return "";
36
+ }
37
+ if (typeof imageSize.value === "number") {
38
+ return `width:${imageSize.value}px;height:${imageSize.value}px`;
39
+ }
40
+ return `width:${imageSize.value};height:${imageSize.value}`;
41
+ });
42
+ const isHttpUrl = image.value.startsWith("https://") || image.value.startsWith("http://") || image.value.startsWith("//");
43
+ const imageUrl = isHttpUrl ? image.value : defaultStatus[image.value];
44
+ return {
45
+ imageUrl,
46
+ imgStyle,
47
+ translate
48
+ };
49
+ }
50
+ });
51
+ const _hoisted_1 = { class: "nut-empty" };
52
+ const _hoisted_2 = ["src"];
53
+ const _hoisted_3 = {
54
+ key: 1,
55
+ class: "nut-empty-description"
56
+ };
57
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
58
+ return openBlock(), createElementBlock("view", _hoisted_1, [
59
+ createElementVNode("view", {
60
+ class: "nut-empty-image",
61
+ style: normalizeStyle(_ctx.imgStyle)
62
+ }, [
63
+ _ctx.$slots.image ? renderSlot(_ctx.$slots, "image", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
64
+ _ctx.imageUrl ? (openBlock(), createElementBlock("img", {
65
+ key: 0,
66
+ class: "img",
67
+ src: _ctx.imageUrl
68
+ }, null, 8, _hoisted_2)) : createCommentVNode("", true)
69
+ ], 64))
70
+ ], 4),
71
+ _ctx.$slots.description ? renderSlot(_ctx.$slots, "description", { key: 0 }) : (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.description || _ctx.translate("noData")), 1)),
72
+ _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("", true)
73
+ ]);
74
+ }
75
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
76
+ export { index as default };