@nutui/nutui 4.0.0 → 4.0.1-2.beta-1

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 (285) hide show
  1. package/CHANGELOG.md +226 -0
  2. package/README.md +34 -65
  3. package/dist/nutui.es.js +10 -17
  4. package/dist/nutui.js +16202 -0
  5. package/dist/nutui.umd.js +1 -7
  6. package/dist/packages/_es/ActionSheet.js +79 -94
  7. package/dist/packages/_es/Address.js +260 -345
  8. package/dist/packages/_es/AddressList.js +269 -354
  9. package/dist/packages/_es/Animate.js +46 -38
  10. package/dist/packages/_es/Audio.js +128 -180
  11. package/dist/packages/_es/AudioOperate.js +60 -52
  12. package/dist/packages/_es/Avatar.js +67 -75
  13. package/dist/packages/_es/AvatarGroup.js +23 -31
  14. package/dist/packages/_es/Backtop.js +59 -99
  15. package/dist/packages/_es/Badge.js +39 -46
  16. package/dist/packages/_es/Barrage.js +68 -145
  17. package/dist/packages/_es/Button.js +47 -66
  18. package/dist/packages/_es/Calendar.js +135 -152
  19. package/dist/packages/_es/CalendarItem.js +6 -6
  20. package/dist/packages/_es/Card.js +42 -56
  21. package/dist/packages/_es/Cascader.js +323 -433
  22. package/dist/packages/_es/Category.js +29 -39
  23. package/dist/packages/_es/CategoryPane.js +57 -83
  24. package/dist/packages/_es/Cell.js +56 -71
  25. package/dist/packages/_es/CellGroup.js +19 -27
  26. package/dist/packages/_es/Checkbox.js +109 -138
  27. package/dist/packages/_es/CheckboxGroup.js +38 -61
  28. package/dist/packages/_es/CircleProgress.js +67 -96
  29. package/dist/packages/_es/Col.js +23 -31
  30. package/dist/packages/_es/Collapse.js +37 -67
  31. package/dist/packages/_es/CollapseItem.js +91 -184
  32. package/dist/packages/_es/Comment.js +207 -279
  33. package/dist/packages/_es/ConfigProvider.js +38 -56
  34. package/dist/packages/_es/Countdown.js +100 -194
  35. package/dist/packages/_es/Countup.js +232 -428
  36. package/dist/packages/_es/DatePicker.js +169 -245
  37. package/dist/packages/_es/Dialog.js +163 -188
  38. package/dist/packages/_es/Divider.js +42 -40
  39. package/dist/packages/_es/Drag.js +70 -153
  40. package/dist/packages/_es/Ecard.js +64 -104
  41. package/dist/packages/_es/Elevator.js +144 -201
  42. package/dist/packages/_es/Ellipsis.js +95 -159
  43. package/dist/packages/_es/Empty.js +23 -39
  44. package/dist/packages/_es/FixedNav.js +93 -116
  45. package/dist/packages/_es/Form.js +108 -164
  46. package/dist/packages/_es/FormItem.js +48 -61
  47. package/dist/packages/_es/Grid.js +5 -6
  48. package/dist/packages/_es/GridItem.js +58 -84
  49. package/dist/packages/_es/Image.js +98 -88
  50. package/dist/packages/_es/ImagePreview.js +262 -392
  51. package/dist/packages/_es/Indicator.js +30 -34
  52. package/dist/packages/_es/InfiniteLoading.js +83 -117
  53. package/dist/packages/_es/Input.js +176 -223
  54. package/dist/packages/_es/InputNumber.js +81 -117
  55. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  56. package/dist/packages/_es/Invoice.js +105 -113
  57. package/dist/packages/_es/Layout.js +3 -4
  58. package/dist/packages/_es/List.js +147 -89
  59. package/dist/packages/_es/Menu.js +96 -152
  60. package/dist/packages/_es/MenuItem.js +117 -153
  61. package/dist/packages/_es/Navbar.js +103 -119
  62. package/dist/packages/_es/Noticebar.js +207 -273
  63. package/dist/packages/_es/Notify.js +110 -147
  64. package/dist/packages/_es/NumberKeyboard.js +127 -202
  65. package/dist/packages/_es/Overlay.js +53 -66
  66. package/dist/packages/_es/Pagination.js +70 -100
  67. package/dist/packages/_es/Picker.js +276 -425
  68. package/dist/packages/_es/Popover.js +122 -225
  69. package/dist/packages/_es/Popup.js +4 -4
  70. package/dist/packages/_es/Price.js +47 -80
  71. package/dist/packages/_es/Progress.js +63 -79
  72. package/dist/packages/_es/PullRefresh.js +96 -157
  73. package/dist/packages/_es/Radio.js +4 -4
  74. package/dist/packages/_es/RadioGroup.js +3 -3
  75. package/dist/packages/_es/Range.js +205 -329
  76. package/dist/packages/_es/Rate.js +93 -122
  77. package/dist/packages/_es/Row.js +21 -27
  78. package/dist/packages/_es/Searchbar.js +130 -160
  79. package/dist/packages/_es/ShortPassword.js +69 -93
  80. package/dist/packages/_es/SideNavbar.js +49 -59
  81. package/dist/packages/_es/SideNavbarItem.js +22 -32
  82. package/dist/packages/_es/Signature.js +83 -128
  83. package/dist/packages/_es/Skeleton.js +110 -130
  84. package/dist/packages/_es/Sku.js +251 -326
  85. package/dist/packages/_es/Step.js +60 -69
  86. package/dist/packages/_es/Steps.js +26 -31
  87. package/dist/packages/_es/Sticky.js +4 -4
  88. package/dist/packages/_es/SubSideNavbar.js +52 -56
  89. package/dist/packages/_es/Swipe.js +84 -137
  90. package/dist/packages/_es/Swiper.js +175 -310
  91. package/dist/packages/_es/SwiperItem.js +28 -44
  92. package/dist/packages/_es/Switch.js +55 -67
  93. package/dist/packages/_es/TabPane.js +32 -20
  94. package/dist/packages/_es/Tabbar.js +41 -52
  95. package/dist/packages/_es/TabbarItem.js +61 -81
  96. package/dist/packages/_es/Table.js +110 -148
  97. package/dist/packages/_es/Tabs.js +284 -205
  98. package/dist/packages/_es/Tag.js +44 -61
  99. package/dist/packages/_es/Textarea.js +80 -124
  100. package/dist/packages/_es/TimeDetail.js +49 -57
  101. package/dist/packages/_es/TimePannel.js +35 -31
  102. package/dist/packages/_es/TimeSelect.js +47 -68
  103. package/dist/packages/_es/Toast.js +150 -203
  104. package/dist/packages/_es/Tour.js +139 -175
  105. package/dist/packages/_es/TrendArrow.js +57 -58
  106. package/dist/packages/_es/Uploader.js +235 -359
  107. package/dist/packages/_es/Video.js +191 -298
  108. package/dist/packages/_es/Watermark.js +84 -98
  109. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  110. package/dist/packages/_es/common-d218746f.js +116 -0
  111. package/dist/packages/_es/component-234624bc.js +89 -0
  112. package/dist/packages/_es/index-14dfadc4.js +561 -0
  113. package/dist/packages/_es/index-192a3ef6.js +29 -0
  114. package/dist/packages/_es/index-360c5092.js +210 -0
  115. package/dist/packages/_es/index-496e6e05.js +24 -0
  116. package/dist/packages/_es/index-50eed3d9.js +7 -0
  117. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  118. package/dist/packages/_es/index-fadb0974.js +8 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  121. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  122. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  123. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  124. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  125. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  126. package/dist/packages/actionsheet/index.scss +2 -0
  127. package/dist/packages/actionsheet/style.mjs +0 -2
  128. package/dist/packages/address/index.scss +5 -2
  129. package/dist/packages/address/style.mjs +0 -3
  130. package/dist/packages/addresslist/index.scss +3 -0
  131. package/dist/packages/addresslist/style.mjs +0 -2
  132. package/dist/packages/audio/index.scss +2 -0
  133. package/dist/packages/audio/style.mjs +0 -1
  134. package/dist/packages/audiooperate/index.scss +2 -0
  135. package/dist/packages/audiooperate/style.mjs +0 -1
  136. package/dist/packages/badge/index.scss +3 -0
  137. package/dist/packages/button/index.scss +1 -1
  138. package/dist/packages/calendar/index.scss +3 -0
  139. package/dist/packages/calendar/style.mjs +0 -3
  140. package/dist/packages/card/index.scss +3 -0
  141. package/dist/packages/card/style.mjs +0 -2
  142. package/dist/packages/cascader/index.scss +4 -0
  143. package/dist/packages/cascader/style.mjs +0 -5
  144. package/dist/packages/cellgroup/index.scss +1 -1
  145. package/dist/packages/checkbox/index.scss +41 -0
  146. package/dist/packages/col/index.scss +2 -2
  147. package/dist/packages/comment/index.scss +2 -0
  148. package/dist/packages/comment/style.mjs +0 -1
  149. package/dist/packages/datepicker/index.scss +1 -2
  150. package/dist/packages/datepicker/style.mjs +0 -3
  151. package/dist/packages/dialog/index.scss +11 -0
  152. package/dist/packages/dialog/style.mjs +0 -3
  153. package/dist/packages/ecard/index.scss +2 -0
  154. package/dist/packages/ecard/style.mjs +0 -1
  155. package/dist/packages/fixednav/index.scss +2 -0
  156. package/dist/packages/fixednav/style.mjs +0 -1
  157. package/dist/packages/form/index.scss +1 -2
  158. package/dist/packages/form/style.mjs +0 -1
  159. package/dist/packages/formitem/index.scss +3 -0
  160. package/dist/packages/formitem/style.mjs +0 -1
  161. package/dist/packages/imagepreview/index.scss +5 -5
  162. package/dist/packages/imagepreview/style.mjs +0 -5
  163. package/dist/packages/input/index.scss +13 -13
  164. package/dist/packages/invoice/index.scss +6 -0
  165. package/dist/packages/invoice/style.mjs +0 -7
  166. package/dist/packages/list/index.scss +8 -8
  167. package/dist/packages/menuitem/index.scss +9 -10
  168. package/dist/packages/menuitem/style.mjs +0 -2
  169. package/dist/packages/navbar/index.scss +0 -1
  170. package/dist/packages/noticebar/index.scss +12 -2
  171. package/dist/packages/notify/index.scss +2 -0
  172. package/dist/packages/notify/style.mjs +0 -2
  173. package/dist/packages/numberkeyboard/index.scss +2 -0
  174. package/dist/packages/numberkeyboard/style.mjs +0 -2
  175. package/dist/packages/picker/index.scss +4 -9
  176. package/dist/packages/picker/style.mjs +0 -2
  177. package/dist/packages/popover/index.scss +2 -0
  178. package/dist/packages/popover/style.mjs +0 -2
  179. package/dist/packages/popup/index.scss +2 -0
  180. package/dist/packages/popup/style.mjs +0 -1
  181. package/dist/packages/price/index.scss +5 -10
  182. package/dist/packages/rate/index.scss +6 -9
  183. package/dist/packages/searchbar/index.scss +4 -0
  184. package/dist/packages/shortpassword/index.scss +18 -0
  185. package/dist/packages/shortpassword/style.mjs +0 -2
  186. package/dist/packages/signature/index.scss +2 -0
  187. package/dist/packages/signature/style.mjs +0 -1
  188. package/dist/packages/skeleton/index.scss +2 -0
  189. package/dist/packages/skeleton/style.mjs +0 -1
  190. package/dist/packages/sku/index.scss +4 -0
  191. package/dist/packages/sku/style.mjs +0 -4
  192. package/dist/packages/tabbaritem/index.scss +2 -0
  193. package/dist/packages/tabbaritem/style.mjs +0 -1
  194. package/dist/packages/tabs/index.scss +36 -2
  195. package/dist/packages/tabs/style.mjs +0 -1
  196. package/dist/packages/textarea/index.scss +2 -0
  197. package/dist/packages/timeselect/index.scss +2 -0
  198. package/dist/packages/timeselect/style.mjs +0 -2
  199. package/dist/packages/tour/index.scss +2 -0
  200. package/dist/packages/tour/style.mjs +0 -3
  201. package/dist/packages/uploader/index.scss +10 -2
  202. package/dist/packages/uploader/style.mjs +0 -2
  203. package/dist/resolver/index.d.ts +6 -0
  204. package/dist/resolver/index.js +1 -0
  205. package/dist/resolver/index.mjs +24 -0
  206. package/dist/resolver/package.json +20 -0
  207. package/dist/smartips/web-types.json +114 -15
  208. package/dist/style.css +1 -1
  209. package/dist/styles/themes/default.scss +155 -52
  210. package/dist/styles/themes/jdb.scss +155 -52
  211. package/dist/styles/themes/jddkh.scss +155 -52
  212. package/dist/styles/themes/jdt.scss +155 -52
  213. package/dist/styles/variables-jdb.scss +9 -1
  214. package/dist/styles/variables-jddkh.scss +9 -1
  215. package/dist/styles/variables-jdt.scss +9 -1
  216. package/dist/styles/variables.scss +8 -0
  217. package/dist/types/__VUE/address/index.vue.d.ts +2 -1
  218. package/dist/types/__VUE/addresslist/components/GeneralShell.vue.d.ts +1 -1
  219. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -1
  220. package/dist/types/__VUE/addresslist/index.vue.d.ts +1 -1
  221. package/dist/types/__VUE/animate/index.vue.d.ts +6 -0
  222. package/dist/types/__VUE/audiooperate/index.vue.d.ts +4 -4
  223. package/dist/types/__VUE/badge/index.vue.d.ts +9 -0
  224. package/dist/types/__VUE/button/type.d.ts +1 -0
  225. package/dist/types/__VUE/calendaritem/type.d.ts +1 -0
  226. package/dist/types/__VUE/collapse/index.vue.d.ts +31 -5
  227. package/dist/types/__VUE/collapseitem/index.vue.d.ts +117 -11
  228. package/dist/types/__VUE/configprovider/index.vue.d.ts +2 -2
  229. package/dist/types/__VUE/datepicker/index.vue.d.ts +1 -1
  230. package/dist/types/__VUE/dialog/index.d.ts +1 -0
  231. package/dist/types/__VUE/dialog/index.vue.d.ts +1 -0
  232. package/dist/types/__VUE/grid/index.vue.d.ts +1 -1
  233. package/dist/types/__VUE/image/index.vue.d.ts +14 -3
  234. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +9 -0
  235. package/dist/types/__VUE/imagepreview/index.vue.d.ts +1 -1
  236. package/dist/types/__VUE/input/index.vue.d.ts +27 -2
  237. package/dist/types/__VUE/list/index.vue.d.ts +42 -13
  238. package/dist/types/__VUE/list/type.d.ts +13 -0
  239. package/dist/types/__VUE/menu/index.vue.d.ts +0 -2
  240. package/dist/types/__VUE/menuitem/index.vue.d.ts +9 -17
  241. package/dist/types/__VUE/navbar/index.vue.d.ts +1 -1
  242. package/dist/types/__VUE/noticebar/index.vue.d.ts +5 -2
  243. package/dist/types/__VUE/picker/common.d.ts +2 -0
  244. package/dist/types/__VUE/picker/usePicker.d.ts +1 -1
  245. package/dist/types/__VUE/price/index.vue.d.ts +9 -0
  246. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  247. package/dist/types/__VUE/row/index.vue.d.ts +1 -1
  248. package/dist/types/__VUE/searchbar/index.vue.d.ts +121 -5
  249. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  250. package/dist/types/__VUE/swiper/index.vue.d.ts +9 -2
  251. package/dist/types/__VUE/switch/index.vue.d.ts +1 -0
  252. package/dist/types/__VUE/table/common.d.ts +55 -2
  253. package/dist/types/__VUE/tabpane/index.vue.d.ts +1 -4
  254. package/dist/types/__VUE/tabs/hooks.d.ts +12 -0
  255. package/dist/types/__VUE/tabs/index.vue.d.ts +35 -5
  256. package/dist/types/__VUE/tabs/types.d.ts +12 -0
  257. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  258. package/dist/types/__VUE/toast/index.vue.d.ts +11 -4
  259. package/dist/types/__VUE/uploader/type.d.ts +2 -1
  260. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  261. package/dist/types/index.d.ts +1 -2
  262. package/dist/types/resolver/index.d.ts +6 -0
  263. package/dist/types/utils/date.d.ts +4 -0
  264. package/dist/types/utils/useTaroRect/index.d.ts +1 -1
  265. package/dist/types/utils/util.d.ts +1 -1
  266. package/package.json +13 -6
  267. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  268. package/dist/packages/_es/common-b9a5e726.js +0 -145
  269. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  270. package/dist/packages/_es/index-29892cda.js +0 -33
  271. package/dist/packages/_es/index-2ae3ae87.js +0 -846
  272. package/dist/packages/_es/index-43c34ac6.js +0 -30
  273. package/dist/packages/_es/index-54d03fc1.js +0 -8
  274. package/dist/packages/_es/index-79c5dc33.js +0 -10
  275. package/dist/packages/_es/index-7a7385e4.js +0 -67
  276. package/dist/packages/_es/index-991c279f.js +0 -244
  277. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  278. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  279. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  280. package/dist/packages/_es/interceptor-956b24fc.js +0 -29
  281. package/dist/packages/_es/mountComponent-1ece4110.js +0 -39
  282. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  283. package/dist/packages/_es/raf-729dad54.js +0 -25
  284. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
  285. /package/dist/types/utils/{interceptor.d.ts → Interceptor.d.ts} +0 -0
@@ -1,9 +1,20 @@
1
- import { ref, reactive, computed, watch, onMounted, toRefs, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createTextVNode, withModifiers } from "vue";
2
- import { c as createComponent } from "./component-81a4c1d0.js";
3
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ var V = Object.defineProperty, z = Object.defineProperties;
2
+ var A = Object.getOwnPropertyDescriptors;
3
+ var C = Object.getOwnPropertySymbols;
4
+ var D = Object.prototype.hasOwnProperty, I = Object.prototype.propertyIsEnumerable;
5
+ var H = (e, l, o) => l in e ? V(e, l, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[l] = o, v = (e, l) => {
6
+ for (var o in l || (l = {}))
7
+ D.call(l, o) && H(e, o, l[o]);
8
+ if (C)
9
+ for (var o of C(l))
10
+ I.call(l, o) && H(e, o, l[o]);
11
+ return e;
12
+ }, w = (e, l) => z(e, A(l));
13
+ import { ref as S, reactive as L, computed as O, watch as R, onMounted as j, toRefs as q, openBlock as r, createElementBlock as u, normalizeClass as F, toDisplayString as m, createCommentVNode as x, createTextVNode as p, withModifiers as M } from "vue";
14
+ import { c as G } from "./component-234624bc.js";
15
+ import { _ as J } from "./_plugin-vue_export-helper-dad06003.js";
4
16
  import "../locale/lang";
5
- const { componentName, create } = createComponent("ellipsis");
6
- const _sfc_main = create({
17
+ const { componentName: K, create: Q } = G("ellipsis"), U = Q({
7
18
  props: {
8
19
  content: {
9
20
  type: String,
@@ -35,178 +46,103 @@ const _sfc_main = create({
35
46
  }
36
47
  },
37
48
  emits: ["click", "change"],
38
- setup(props, { emit }) {
39
- const root = ref(null);
40
- let container = null;
41
- let maxHeight = 0;
42
- const ellipsis = ref();
43
- const state = reactive({
44
- exceeded: false,
49
+ setup(e, { emit: l }) {
50
+ const o = S(null);
51
+ let n = null, y = 0;
52
+ const g = S(), s = L({
53
+ exceeded: !1,
45
54
  //是否超出
46
- expanded: false
55
+ expanded: !1
47
56
  //是否折叠
48
- });
49
- const classes = computed(() => {
50
- const prefixCls = componentName;
51
- return {
52
- [prefixCls]: true
53
- };
54
- });
55
- watch(
56
- () => props.content,
57
- (newV, oldVal) => {
58
- if (newV != oldVal) {
59
- createContainer();
60
- }
57
+ }), N = O(() => ({
58
+ [K]: !0
59
+ }));
60
+ R(
61
+ () => e.content,
62
+ (t, i) => {
63
+ t != i && T();
61
64
  }
62
- );
63
- onMounted(() => {
64
- createContainer();
65
+ ), j(() => {
66
+ T();
65
67
  });
66
- const createContainer = () => {
67
- if (!root.value)
68
+ const T = () => {
69
+ if (!o.value)
68
70
  return;
69
- const originStyle = window.getComputedStyle(root.value);
70
- container = document.createElement("div");
71
- const styleNames = Array.prototype.slice.apply(originStyle);
72
- styleNames.forEach((name) => {
73
- container.style.setProperty(name, originStyle.getPropertyValue(name));
74
- });
75
- container.style.position = "fixed";
76
- container.style.left = "999999px";
77
- container.style.top = "999999px";
78
- container.style.zIndex = "-1000";
79
- container.style.height = "auto";
80
- container.style.minHeight = "auto";
81
- container.style.maxHeight = "auto";
82
- container.style.textOverflow = "clip";
83
- container.style.whiteSpace = "normal";
84
- container.style.webkitLineClamp = "unset";
85
- container.style.display = "block";
86
- const lineHeight = pxToNumber(originStyle.lineHeight === "normal" ? props.lineHeight : originStyle.lineHeight);
87
- maxHeight = Math.floor(
88
- lineHeight * (Number(props.rows) + 0.5) + pxToNumber(originStyle.paddingTop) + pxToNumber(originStyle.paddingBottom)
89
- );
90
- container.innerText = props.content;
91
- document.body.appendChild(container);
92
- calcEllipse();
93
- };
94
- const calcEllipse = () => {
95
- if (container.offsetHeight <= maxHeight) {
96
- state.exceeded = false;
97
- document.body.removeChild(container);
98
- } else {
99
- state.exceeded = true;
100
- const end = props.content.length;
101
- const middle = Math.floor((0 + end) / 2);
102
- const ellipsised = props.direction === "middle" ? tailorMiddle([0, middle], [middle, end]) : tailor(0, end);
103
- ellipsis.value = ellipsised;
104
- document.body.removeChild(container);
105
- }
106
- };
107
- const tailor = (left, right) => {
108
- const actionText = state.expanded ? props.collapseText : props.expandText;
109
- const end = props.content.length;
110
- if (right - left <= 1) {
111
- if (props.direction === "end") {
112
- return {
113
- leading: props.content.slice(0, left) + props.symbol
114
- };
115
- } else {
116
- return {
117
- tailing: props.symbol + props.content.slice(right, end)
118
- };
119
- }
120
- }
121
- const middle = Math.round((left + right) / 2);
122
- if (props.direction === "end") {
123
- container.innerText = props.content.slice(0, middle) + props.symbol + actionText;
124
- } else {
125
- container.innerText = actionText + props.symbol + props.content.slice(middle, end);
71
+ const t = window.getComputedStyle(o.value);
72
+ n = document.createElement("div"), Array.prototype.slice.apply(t).forEach((a) => {
73
+ n.style.setProperty(a, t.getPropertyValue(a));
74
+ }), n.style.position = "fixed", n.style.left = "999999px", n.style.top = "999999px", n.style.zIndex = "-1000", n.style.height = "auto", n.style.minHeight = "auto", n.style.maxHeight = "auto", n.style.textOverflow = "clip", n.style.whiteSpace = "normal", n.style.webkitLineClamp = "unset", n.style.display = "block";
75
+ const c = k(t.lineHeight === "normal" ? e.lineHeight : t.lineHeight);
76
+ y = Math.floor(
77
+ c * (Number(e.rows) + 0.5) + k(t.paddingTop) + k(t.paddingBottom)
78
+ ), n.innerText = e.content, document.body.appendChild(n), $();
79
+ }, $ = () => {
80
+ if (n.offsetHeight <= y)
81
+ s.exceeded = !1, document.body.removeChild(n);
82
+ else {
83
+ s.exceeded = !0;
84
+ const t = e.content.length, i = Math.floor((0 + t) / 2), c = e.direction === "middle" ? h([0, i], [i, t]) : f(0, t);
85
+ g.value = c, document.body.removeChild(n);
126
86
  }
127
- if (container.offsetHeight <= maxHeight) {
128
- if (props.direction === "end") {
129
- return tailor(middle, right);
130
- } else {
131
- return tailor(left, middle);
132
- }
133
- } else {
134
- if (props.direction === "end") {
135
- return tailor(left, middle);
136
- } else {
137
- return tailor(middle, right);
138
- }
139
- }
140
- };
141
- const tailorMiddle = (leftPart, rightPart) => {
142
- const actionText = state.expanded ? props.collapseText : props.expandText;
143
- const end = props.content.length;
144
- if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
87
+ }, f = (t, i) => {
88
+ const c = s.expanded ? e.collapseText : e.expandText, a = e.content.length;
89
+ if (i - t <= 1)
90
+ return e.direction === "end" ? {
91
+ leading: e.content.slice(0, t) + e.symbol
92
+ } : {
93
+ tailing: e.symbol + e.content.slice(i, a)
94
+ };
95
+ const d = Math.round((t + i) / 2);
96
+ return e.direction === "end" ? n.innerText = e.content.slice(0, d) + e.symbol + c : n.innerText = c + e.symbol + e.content.slice(d, a), n.offsetHeight <= y ? e.direction === "end" ? f(d, i) : f(t, d) : e.direction === "end" ? f(t, d) : f(d, i);
97
+ }, h = (t, i) => {
98
+ const c = s.expanded ? e.collapseText : e.expandText, a = e.content.length;
99
+ if (t[1] - t[0] <= 1 && i[1] - i[0] <= 1)
145
100
  return {
146
- leading: props.content.slice(0, leftPart[0]) + props.symbol,
147
- tailing: props.symbol + props.content.slice(rightPart[1], end)
101
+ leading: e.content.slice(0, t[0]) + e.symbol,
102
+ tailing: e.symbol + e.content.slice(i[1], a)
148
103
  };
149
- }
150
- const leftPartMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
151
- const rightPartMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
152
- container.innerText = props.content.slice(0, leftPartMiddle) + props.symbol + actionText + props.symbol + props.content.slice(rightPartMiddle, end);
153
- if (container.offsetHeight <= maxHeight) {
154
- return tailorMiddle([leftPartMiddle, leftPart[1]], [rightPart[0], rightPartMiddle]);
155
- } else {
156
- return tailorMiddle([leftPart[0], leftPartMiddle], [rightPartMiddle, rightPart[1]]);
157
- }
158
- };
159
- const pxToNumber = (value) => {
160
- if (!value)
104
+ const d = Math.floor((t[0] + t[1]) / 2), b = Math.ceil((i[0] + i[1]) / 2);
105
+ return n.innerText = e.content.slice(0, d) + e.symbol + c + e.symbol + e.content.slice(b, a), n.offsetHeight <= y ? h([d, t[1]], [i[0], b]) : h([t[0], d], [b, i[1]]);
106
+ }, k = (t) => {
107
+ if (!t)
161
108
  return 0;
162
- const match = value.match(/^\d*(\.\d*)?/);
163
- return match ? Number(match[0]) : 0;
164
- };
165
- const clickHandle = (type) => {
166
- if (type == 1) {
167
- state.expanded = true;
168
- emit("change", "expand");
169
- } else {
170
- state.expanded = false;
171
- emit("change", "collapse");
172
- }
173
- };
174
- const handleClick = () => {
175
- emit("click");
109
+ const i = t.match(/^\d*(\.\d*)?/);
110
+ return i ? Number(i[0]) : 0;
111
+ }, E = (t) => {
112
+ t == 1 ? (s.expanded = !0, l("change", "expand")) : (s.expanded = !1, l("change", "collapse"));
113
+ }, B = () => {
114
+ l("click");
176
115
  };
177
- return { ...toRefs(state), root, ellipsis, classes, clickHandle, handleClick };
116
+ return w(v({}, q(s)), { root: o, ellipsis: g, classes: N, clickHandle: E, handleClick: B });
178
117
  }
179
- });
180
- const _hoisted_1 = { key: 0 };
181
- const _hoisted_2 = { key: 1 };
182
- const _hoisted_3 = { key: 2 };
183
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
184
- return openBlock(), createElementBlock("view", {
185
- class: normalizeClass(_ctx.classes),
186
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)),
118
+ }), W = { key: 0 }, X = { key: 1 }, Y = { key: 2 };
119
+ function Z(e, l, o, n, y, g) {
120
+ return r(), u("view", {
121
+ class: F(e.classes),
122
+ onClick: l[2] || (l[2] = (...s) => e.handleClick && e.handleClick(...s)),
187
123
  ref: "root"
188
124
  }, [
189
- !_ctx.exceeded ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.content), 1)) : createCommentVNode("", true),
190
- _ctx.exceeded && !_ctx.expanded ? (openBlock(), createElementBlock("view", _hoisted_2, [
191
- createTextVNode(toDisplayString(_ctx.ellipsis && _ctx.ellipsis.leading), 1),
192
- _ctx.expandText ? (openBlock(), createElementBlock("span", {
125
+ e.exceeded ? x("", !0) : (r(), u("view", W, m(e.content), 1)),
126
+ e.exceeded && !e.expanded ? (r(), u("view", X, [
127
+ p(m(e.ellipsis && e.ellipsis.leading), 1),
128
+ e.expandText ? (r(), u("span", {
193
129
  key: 0,
194
130
  class: "nut-ellipsis__text",
195
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.clickHandle(1), ["stop"]))
196
- }, toDisplayString(_ctx.expandText), 1)) : createCommentVNode("", true),
197
- createTextVNode(toDisplayString(_ctx.ellipsis && _ctx.ellipsis.tailing), 1)
198
- ])) : createCommentVNode("", true),
199
- _ctx.exceeded && _ctx.expanded ? (openBlock(), createElementBlock("view", _hoisted_3, [
200
- createTextVNode(toDisplayString(_ctx.content) + " ", 1),
201
- _ctx.expandText ? (openBlock(), createElementBlock("span", {
131
+ onClick: l[0] || (l[0] = M((s) => e.clickHandle(1), ["stop"]))
132
+ }, m(e.expandText), 1)) : x("", !0),
133
+ p(m(e.ellipsis && e.ellipsis.tailing), 1)
134
+ ])) : x("", !0),
135
+ e.exceeded && e.expanded ? (r(), u("view", Y, [
136
+ p(m(e.content) + " ", 1),
137
+ e.expandText ? (r(), u("span", {
202
138
  key: 0,
203
139
  class: "nut-ellipsis__text",
204
- onClick: _cache[1] || (_cache[1] = withModifiers(($event) => _ctx.clickHandle(2), ["stop"]))
205
- }, toDisplayString(_ctx.collapseText), 1)) : createCommentVNode("", true)
206
- ])) : createCommentVNode("", true)
140
+ onClick: l[1] || (l[1] = M((s) => e.clickHandle(2), ["stop"]))
141
+ }, m(e.collapseText), 1)) : x("", !0)
142
+ ])) : x("", !0)
207
143
  ], 2);
208
144
  }
209
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
145
+ const le = /* @__PURE__ */ J(U, [["render", Z]]);
210
146
  export {
211
- index as default
147
+ le as default
212
148
  };
@@ -1,14 +1,12 @@
1
- import { toRefs, computed, openBlock, createElementBlock, createElementVNode, normalizeStyle, renderSlot, Fragment, createCommentVNode, toDisplayString } from "vue";
2
- import { c as createComponent } from "./component-81a4c1d0.js";
3
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ import { toRefs as m, computed as c, openBlock as r, createElementBlock as a, createElementVNode as u, normalizeStyle as d, renderSlot as o, Fragment as f, createCommentVNode as n, toDisplayString as g } from "vue";
2
+ import { c as y } from "./component-234624bc.js";
3
+ import { _ as h } from "./_plugin-vue_export-helper-dad06003.js";
4
4
  import "../locale/lang";
5
- const { componentName, create, translate } = createComponent("empty");
6
- const defaultStatus = {
5
+ const { componentName: B, create: v, translate: $ } = y("empty"), S = {
7
6
  empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png",
8
7
  error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png",
9
8
  network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png"
10
- };
11
- const _sfc_main = create({
9
+ }, _ = v({
12
10
  props: {
13
11
  image: {
14
12
  type: String,
@@ -26,51 +24,37 @@ const _sfc_main = create({
26
24
  default: ""
27
25
  }
28
26
  },
29
- setup(props) {
30
- const { image, imageSize } = toRefs(props);
31
- const imgStyle = computed(() => {
32
- if (!imageSize.value) {
33
- return "";
34
- }
35
- if (typeof imageSize.value === "number") {
36
- return `width:${imageSize.value}px;height:${imageSize.value}px`;
37
- }
38
- return `width:${imageSize.value};height:${imageSize.value}`;
39
- });
40
- const isHttpUrl = image.value.startsWith("https://") || image.value.startsWith("http://") || image.value.startsWith("//");
41
- const imageUrl = isHttpUrl ? image.value : defaultStatus[image.value];
27
+ setup(e) {
28
+ const { image: s, imageSize: t } = m(e), i = c(() => t.value ? typeof t.value == "number" ? `width:${t.value}px;height:${t.value}px` : `width:${t.value};height:${t.value}` : "");
42
29
  return {
43
- imageUrl,
44
- imgStyle,
45
- translate
30
+ imageUrl: s.value.startsWith("https://") || s.value.startsWith("http://") || s.value.startsWith("//") ? s.value : S[s.value],
31
+ imgStyle: i,
32
+ translate: $
46
33
  };
47
34
  }
48
- });
49
- const _hoisted_1 = { class: "nut-empty" };
50
- const _hoisted_2 = ["src"];
51
- const _hoisted_3 = {
35
+ }), k = { class: "nut-empty" }, b = ["src"], w = {
52
36
  key: 1,
53
37
  class: "nut-empty__description"
54
38
  };
55
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
56
- return openBlock(), createElementBlock("view", _hoisted_1, [
57
- createElementVNode("view", {
39
+ function U(e, s, t, i, l, p) {
40
+ return r(), a("view", k, [
41
+ u("view", {
58
42
  class: "nut-empty__box",
59
- style: normalizeStyle(_ctx.imgStyle)
43
+ style: d(e.imgStyle)
60
44
  }, [
61
- _ctx.$slots.image ? renderSlot(_ctx.$slots, "image", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
62
- _ctx.imageUrl ? (openBlock(), createElementBlock("img", {
45
+ e.$slots.image ? o(e.$slots, "image", { key: 0 }) : (r(), a(f, { key: 1 }, [
46
+ e.imageUrl ? (r(), a("img", {
63
47
  key: 0,
64
48
  class: "nut-empty__box--img",
65
- src: _ctx.imageUrl
66
- }, null, 8, _hoisted_2)) : createCommentVNode("", true)
49
+ src: e.imageUrl
50
+ }, null, 8, b)) : n("", !0)
67
51
  ], 64))
68
52
  ], 4),
69
- _ctx.$slots.description ? renderSlot(_ctx.$slots, "description", { key: 0 }) : (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.description || _ctx.translate("noData")), 1)),
70
- _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("", true)
53
+ e.$slots.description ? o(e.$slots, "description", { key: 0 }) : (r(), a("view", w, g(e.description || e.translate("noData")), 1)),
54
+ e.$slots.default ? o(e.$slots, "default", { key: 2 }) : n("", !0)
71
55
  ]);
72
56
  }
73
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
57
+ const C = /* @__PURE__ */ h(_, [["render", U]]);
74
58
  export {
75
- index as default
59
+ C as default
76
60
  };
@@ -1,135 +1,112 @@
1
- import { c as createComponent } from "./component-81a4c1d0.js";
2
- import { computed, ref, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createBlock, createCommentVNode, renderSlot, createElementVNode, Fragment, renderList, toDisplayString, createVNode } from "vue";
3
- import Overlay from "./Overlay.js";
4
- import { Left } from "@nutui/icons-vue";
5
- import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
1
+ import { c as b } from "./component-234624bc.js";
2
+ import { computed as g, ref as $, resolveComponent as p, openBlock as s, createElementBlock as i, normalizeClass as v, normalizeStyle as S, createBlock as V, createCommentVNode as f, renderSlot as m, createElementVNode as l, Fragment as w, renderList as L, toDisplayString as u, createVNode as T } from "vue";
3
+ import y from "./Overlay.js";
4
+ import { Left as B } from "@nutui/icons-vue";
5
+ import { _ as h } from "./_plugin-vue_export-helper-dad06003.js";
6
6
  import "../locale/lang";
7
- const { componentName, translate } = createComponent("fixed-nav");
8
- const component = (components) => {
9
- return {
10
- components,
11
- props: {
12
- visible: {
13
- type: Boolean,
14
- default: false
15
- },
16
- overlay: {
17
- type: Boolean,
18
- default: true
19
- },
20
- navList: {
21
- default: () => [],
22
- type: Array
23
- },
24
- activeColor: {
25
- default: "",
26
- type: String
27
- },
28
- activeText: {
29
- default: "",
30
- type: String
31
- },
32
- unActiveText: {
33
- default: "",
34
- type: String
35
- },
36
- position: {
37
- default: () => {
38
- return {
39
- top: "auto",
40
- bottom: "auto"
41
- };
42
- },
43
- type: Object
44
- },
45
- type: {
46
- default: "right",
47
- type: String
48
- }
7
+ const { componentName: x, translate: A } = b("fixed-nav"), N = (e) => ({
8
+ components: e,
9
+ props: {
10
+ visible: {
11
+ type: Boolean,
12
+ default: !1
49
13
  },
50
- emits: ["update:visible", "selected"],
51
- setup(props, { emit }) {
52
- const classes = computed(() => {
53
- const prefixCls = componentName;
54
- return {
55
- [prefixCls]: true,
56
- active: props.visible,
57
- [props.type]: true
58
- };
59
- });
60
- const current = ref(-1);
61
- const updateValue = (value = !props.visible) => {
62
- emit("update:visible", value);
63
- };
64
- const selected = (item, event) => {
65
- emit("selected", {
66
- item,
67
- event
68
- });
69
- current.value = item.id;
70
- };
71
- return { classes, updateValue, selected, translate, current };
14
+ overlay: {
15
+ type: Boolean,
16
+ default: !0
17
+ },
18
+ navList: {
19
+ default: () => [],
20
+ type: Array
21
+ },
22
+ activeColor: {
23
+ default: "",
24
+ type: String
25
+ },
26
+ activeText: {
27
+ default: "",
28
+ type: String
29
+ },
30
+ unActiveText: {
31
+ default: "",
32
+ type: String
33
+ },
34
+ position: {
35
+ default: () => ({
36
+ top: "auto",
37
+ bottom: "auto"
38
+ }),
39
+ type: Object
40
+ },
41
+ type: {
42
+ default: "right",
43
+ type: String
72
44
  }
73
- };
74
- };
75
- const { create } = createComponent("fixed-nav");
76
- const _sfc_main = create(
77
- component({
78
- [Overlay.name]: Overlay,
79
- Left
45
+ },
46
+ emits: ["update:visible", "selected"],
47
+ setup(n, { emit: a }) {
48
+ const c = g(() => ({
49
+ [x]: !0,
50
+ active: n.visible,
51
+ [n.type]: !0
52
+ })), r = $(-1);
53
+ return { classes: c, updateValue: (o = !n.visible) => {
54
+ a("update:visible", o);
55
+ }, selected: (o, t) => {
56
+ a("selected", {
57
+ item: o,
58
+ event: t
59
+ }), r.value = o.id;
60
+ }, translate: A, current: r };
61
+ }
62
+ }), { create: z } = b("fixed-nav"), E = z(
63
+ N({
64
+ [y.name]: y,
65
+ Left: B
80
66
  })
81
- );
82
- const _hoisted_1 = { class: "nut-fixed-nav__list" };
83
- const _hoisted_2 = ["onClick"];
84
- const _hoisted_3 = ["src"];
85
- const _hoisted_4 = { class: "span" };
86
- const _hoisted_5 = {
67
+ ), O = { class: "nut-fixed-nav__list" }, j = ["onClick"], D = ["src"], F = { class: "span" }, q = {
87
68
  key: 0,
88
69
  class: "b"
89
- };
90
- const _hoisted_6 = { class: "text" };
91
- function render(_ctx, _cache, $props, $setup, $data, $options) {
92
- const _component_nut_overlay = resolveComponent("nut-overlay");
93
- const _component_Left = resolveComponent("Left");
94
- return openBlock(), createElementBlock("view", {
95
- class: normalizeClass(_ctx.classes),
96
- style: normalizeStyle(_ctx.position)
70
+ }, G = { class: "text" };
71
+ function H(e, n, a, c, r, C) {
72
+ const d = p("nut-overlay"), o = p("Left");
73
+ return s(), i("view", {
74
+ class: v(e.classes),
75
+ style: S(e.position)
97
76
  }, [
98
- _ctx.overlay ? (openBlock(), createBlock(_component_nut_overlay, {
77
+ e.overlay ? (s(), V(d, {
99
78
  key: 0,
100
- visible: _ctx.visible,
79
+ visible: e.visible,
101
80
  "z-index": 200,
102
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.updateValue(false))
103
- }, null, 8, ["visible"])) : createCommentVNode("", true),
104
- renderSlot(_ctx.$slots, "list", {}, () => [
105
- createElementVNode("view", _hoisted_1, [
106
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.navList, (item, index2) => {
107
- return openBlock(), createElementBlock("view", {
108
- class: normalizeClass(["nut-fixed-nav__list-item", { active: item.id == _ctx.current }]),
109
- onClick: ($event) => _ctx.selected(item, $event),
110
- key: item.id || index2
111
- }, [
112
- createElementVNode("img", {
113
- src: item.icon
114
- }, null, 8, _hoisted_3),
115
- createElementVNode("view", _hoisted_4, toDisplayString(item.text), 1),
116
- item.num ? (openBlock(), createElementBlock("view", _hoisted_5, toDisplayString(item.num), 1)) : createCommentVNode("", true)
117
- ], 10, _hoisted_2);
118
- }), 128))
81
+ onClick: n[0] || (n[0] = (t) => e.updateValue(!1))
82
+ }, null, 8, ["visible"])) : f("", !0),
83
+ m(e.$slots, "list", {}, () => [
84
+ l("view", O, [
85
+ (s(!0), i(w, null, L(e.navList, (t, k) => (s(), i("view", {
86
+ class: v(["nut-fixed-nav__list-item", { active: t.id == e.current }]),
87
+ onClick: (_) => e.selected(t, _),
88
+ key: t.id || k
89
+ }, [
90
+ l("img", {
91
+ src: t.icon
92
+ }, null, 8, D),
93
+ l("view", F, u(t.text), 1),
94
+ t.num ? (s(), i("view", q, u(t.num), 1)) : f("", !0)
95
+ ], 10, j))), 128))
119
96
  ])
120
97
  ]),
121
- createElementVNode("div", {
98
+ l("div", {
122
99
  class: "nut-fixed-nav__btn",
123
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.updateValue())
100
+ onClick: n[1] || (n[1] = (t) => e.updateValue())
124
101
  }, [
125
- renderSlot(_ctx.$slots, "btn", {}, () => [
126
- createVNode(_component_Left, { color: "#fff" }),
127
- createElementVNode("view", _hoisted_6, toDisplayString(_ctx.visible ? _ctx.activeText || _ctx.translate("activeText") : _ctx.unActiveText || _ctx.translate("unActiveText")), 1)
102
+ m(e.$slots, "btn", {}, () => [
103
+ T(o, { color: "#fff" }),
104
+ l("view", G, u(e.visible ? e.activeText || e.translate("activeText") : e.unActiveText || e.translate("unActiveText")), 1)
128
105
  ])
129
106
  ])
130
107
  ], 6);
131
108
  }
132
- const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", render]]);
109
+ const R = /* @__PURE__ */ h(E, [["render", H]]);
133
110
  export {
134
- index as default
111
+ R as default
135
112
  };