@minilo/ui 0.0.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 (165) hide show
  1. package/README.md +44 -0
  2. package/minilo/dist/index.css +1 -0
  3. package/minilo/dist/index.full.js +7054 -0
  4. package/minilo/dist/index.full.min.js +2 -0
  5. package/minilo/dist/index.full.min.js.map +1 -0
  6. package/minilo/dist/index.full.min.mjs +2 -0
  7. package/minilo/dist/index.full.min.mjs.map +1 -0
  8. package/minilo/dist/index.full.mjs +7041 -0
  9. package/minilo/es/components/button/index.d.ts +47 -0
  10. package/minilo/es/components/button/index.mjs +6 -0
  11. package/minilo/es/components/button/index.vue.d.ts +29 -0
  12. package/minilo/es/components/button/index.vue.mjs +5 -0
  13. package/minilo/es/components/button/index.vue2.mjs +67 -0
  14. package/minilo/es/components/button/type.d.ts +10 -0
  15. package/minilo/es/components/button/type.mjs +1 -0
  16. package/minilo/es/components/chart/index.d.ts +49 -0
  17. package/minilo/es/components/chart/index.mjs +6 -0
  18. package/minilo/es/components/chart/index.vue.d.ts +33 -0
  19. package/minilo/es/components/chart/index.vue.mjs +5 -0
  20. package/minilo/es/components/chart/index.vue2.mjs +124 -0
  21. package/minilo/es/components/chart/type.d.ts +7 -0
  22. package/minilo/es/components/chart/type.mjs +1 -0
  23. package/minilo/es/components/detail/index.d.ts +37 -0
  24. package/minilo/es/components/detail/index.mjs +6 -0
  25. package/minilo/es/components/detail/index.vue.d.ts +23 -0
  26. package/minilo/es/components/detail/index.vue.mjs +5 -0
  27. package/minilo/es/components/detail/index.vue2.mjs +194 -0
  28. package/minilo/es/components/detail/renderLabel.vue.d.ts +8 -0
  29. package/minilo/es/components/detail/renderLabel.vue.mjs +5 -0
  30. package/minilo/es/components/detail/renderLabel.vue2.mjs +23 -0
  31. package/minilo/es/components/detail/renderTooltip.vue.d.ts +8 -0
  32. package/minilo/es/components/detail/renderTooltip.vue.mjs +5 -0
  33. package/minilo/es/components/detail/renderTooltip.vue2.mjs +23 -0
  34. package/minilo/es/components/detail/type.d.ts +27 -0
  35. package/minilo/es/components/detail/type.mjs +1 -0
  36. package/minilo/es/components/index.d.ts +7 -0
  37. package/minilo/es/components/index.mjs +7 -0
  38. package/minilo/es/components/number-range-input/index.d.ts +41 -0
  39. package/minilo/es/components/number-range-input/index.mjs +6 -0
  40. package/minilo/es/components/number-range-input/index.vue.d.ts +33 -0
  41. package/minilo/es/components/number-range-input/index.vue.mjs +5 -0
  42. package/minilo/es/components/number-range-input/index.vue2.mjs +150 -0
  43. package/minilo/es/components/number-range-input/props.d.ts +10 -0
  44. package/minilo/es/components/number-range-input/props.mjs +1 -0
  45. package/minilo/es/components/search/index.d.ts +586 -0
  46. package/minilo/es/components/search/index.mjs +6 -0
  47. package/minilo/es/components/search/index.vue.d.ts +750 -0
  48. package/minilo/es/components/search/index.vue.mjs +5 -0
  49. package/minilo/es/components/search/index.vue2.mjs +298 -0
  50. package/minilo/es/components/search/props.d.ts +107 -0
  51. package/minilo/es/components/search/props.mjs +55 -0
  52. package/minilo/es/components/search-table/index.d.ts +274 -0
  53. package/minilo/es/components/search-table/index.mjs +6 -0
  54. package/minilo/es/components/search-table/index.vue.d.ts +173 -0
  55. package/minilo/es/components/search-table/index.vue.mjs +5 -0
  56. package/minilo/es/components/search-table/index.vue2.mjs +195 -0
  57. package/minilo/es/components/search-table/props.d.ts +69 -0
  58. package/minilo/es/components/search-table/props.mjs +69 -0
  59. package/minilo/es/components/search-table/render.d.ts +11 -0
  60. package/minilo/es/components/search-table/render.mjs +19 -0
  61. package/minilo/es/components/virtual-list/index.d.ts +59 -0
  62. package/minilo/es/components/virtual-list/index.mjs +6 -0
  63. package/minilo/es/components/virtual-list/index.vue.d.ts +39 -0
  64. package/minilo/es/components/virtual-list/index.vue.mjs +5 -0
  65. package/minilo/es/components/virtual-list/index.vue2.mjs +421 -0
  66. package/minilo/es/components/virtual-list/type.d.ts +20 -0
  67. package/minilo/es/components/virtual-list/type.mjs +1 -0
  68. package/minilo/es/index.d.ts +1087 -0
  69. package/minilo/es/node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.5.17_typescript@5.8.3_/node_modules/@element-plus/icons-vue/dist/index.mjs +25 -0
  70. package/minilo/es/node_modules/.pnpm/@vueuse_core@13.6.0_vue@3.5.17_typescript@5.9.3_/node_modules/@vueuse/core/index.mjs +73 -0
  71. package/minilo/es/node_modules/.pnpm/@vueuse_shared@13.6.0_vue@3.5.17_typescript@5.9.3_/node_modules/@vueuse/shared/index.mjs +76 -0
  72. package/minilo/es/packages/utils/dist/func/common.mjs +14 -0
  73. package/minilo/es/packages/utils/dist/request/index.mjs +110 -0
  74. package/minilo/es/resolver/index.d.ts +8 -0
  75. package/minilo/es/resolver/index.mjs +26 -0
  76. package/minilo/es/utils/index.d.ts +28 -0
  77. package/minilo/es/utils/index.mjs +30 -0
  78. package/minilo/lib/components/button/index.d.ts +47 -0
  79. package/minilo/lib/components/button/index.js +11 -0
  80. package/minilo/lib/components/button/index.vue.d.ts +29 -0
  81. package/minilo/lib/components/button/index.vue.js +9 -0
  82. package/minilo/lib/components/button/index.vue2.js +71 -0
  83. package/minilo/lib/components/button/type.d.ts +10 -0
  84. package/minilo/lib/components/button/type.js +2 -0
  85. package/minilo/lib/components/chart/index.d.ts +49 -0
  86. package/minilo/lib/components/chart/index.js +11 -0
  87. package/minilo/lib/components/chart/index.vue.d.ts +33 -0
  88. package/minilo/lib/components/chart/index.vue.js +9 -0
  89. package/minilo/lib/components/chart/index.vue2.js +128 -0
  90. package/minilo/lib/components/chart/type.d.ts +7 -0
  91. package/minilo/lib/components/chart/type.js +2 -0
  92. package/minilo/lib/components/detail/index.d.ts +37 -0
  93. package/minilo/lib/components/detail/index.js +11 -0
  94. package/minilo/lib/components/detail/index.vue.d.ts +23 -0
  95. package/minilo/lib/components/detail/index.vue.js +9 -0
  96. package/minilo/lib/components/detail/index.vue2.js +198 -0
  97. package/minilo/lib/components/detail/renderLabel.vue.d.ts +8 -0
  98. package/minilo/lib/components/detail/renderLabel.vue.js +9 -0
  99. package/minilo/lib/components/detail/renderLabel.vue2.js +27 -0
  100. package/minilo/lib/components/detail/renderTooltip.vue.d.ts +8 -0
  101. package/minilo/lib/components/detail/renderTooltip.vue.js +9 -0
  102. package/minilo/lib/components/detail/renderTooltip.vue2.js +27 -0
  103. package/minilo/lib/components/detail/type.d.ts +27 -0
  104. package/minilo/lib/components/detail/type.js +2 -0
  105. package/minilo/lib/components/index.d.ts +7 -0
  106. package/minilo/lib/components/index.js +19 -0
  107. package/minilo/lib/components/number-range-input/index.d.ts +41 -0
  108. package/minilo/lib/components/number-range-input/index.js +11 -0
  109. package/minilo/lib/components/number-range-input/index.vue.d.ts +33 -0
  110. package/minilo/lib/components/number-range-input/index.vue.js +9 -0
  111. package/minilo/lib/components/number-range-input/index.vue2.js +154 -0
  112. package/minilo/lib/components/number-range-input/props.d.ts +10 -0
  113. package/minilo/lib/components/number-range-input/props.js +2 -0
  114. package/minilo/lib/components/search/index.d.ts +586 -0
  115. package/minilo/lib/components/search/index.js +11 -0
  116. package/minilo/lib/components/search/index.vue.d.ts +750 -0
  117. package/minilo/lib/components/search/index.vue.js +9 -0
  118. package/minilo/lib/components/search/index.vue2.js +302 -0
  119. package/minilo/lib/components/search/props.d.ts +107 -0
  120. package/minilo/lib/components/search/props.js +58 -0
  121. package/minilo/lib/components/search-table/index.d.ts +274 -0
  122. package/minilo/lib/components/search-table/index.js +11 -0
  123. package/minilo/lib/components/search-table/index.vue.d.ts +173 -0
  124. package/minilo/lib/components/search-table/index.vue.js +9 -0
  125. package/minilo/lib/components/search-table/index.vue2.js +199 -0
  126. package/minilo/lib/components/search-table/props.d.ts +69 -0
  127. package/minilo/lib/components/search-table/props.js +72 -0
  128. package/minilo/lib/components/search-table/render.d.ts +11 -0
  129. package/minilo/lib/components/search-table/render.js +23 -0
  130. package/minilo/lib/components/virtual-list/index.d.ts +59 -0
  131. package/minilo/lib/components/virtual-list/index.js +11 -0
  132. package/minilo/lib/components/virtual-list/index.vue.d.ts +39 -0
  133. package/minilo/lib/components/virtual-list/index.vue.js +9 -0
  134. package/minilo/lib/components/virtual-list/index.vue2.js +425 -0
  135. package/minilo/lib/components/virtual-list/type.d.ts +20 -0
  136. package/minilo/lib/components/virtual-list/type.js +2 -0
  137. package/minilo/lib/index.d.ts +1087 -0
  138. package/minilo/lib/node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.5.17_typescript@5.8.3_/node_modules/@element-plus/icons-vue/dist/index.js +27 -0
  139. package/minilo/lib/node_modules/.pnpm/@vueuse_core@13.6.0_vue@3.5.17_typescript@5.9.3_/node_modules/@vueuse/core/index.js +84 -0
  140. package/minilo/lib/node_modules/.pnpm/@vueuse_shared@13.6.0_vue@3.5.17_typescript@5.9.3_/node_modules/@vueuse/shared/index.js +83 -0
  141. package/minilo/lib/packages/utils/dist/func/common.js +16 -0
  142. package/minilo/lib/packages/utils/dist/request/index.js +120 -0
  143. package/minilo/lib/resolver/index.d.ts +8 -0
  144. package/minilo/lib/resolver/index.js +28 -0
  145. package/minilo/lib/utils/index.d.ts +28 -0
  146. package/minilo/lib/utils/index.js +34 -0
  147. package/minilo/theme-chalk/index.css +1 -0
  148. package/minilo/theme-chalk/ml-button.css +1 -0
  149. package/minilo/theme-chalk/ml-chart.css +1 -0
  150. package/minilo/theme-chalk/ml-detail.css +1 -0
  151. package/minilo/theme-chalk/ml-number-range-input.css +1 -0
  152. package/minilo/theme-chalk/ml-search-table.css +1 -0
  153. package/minilo/theme-chalk/ml-search.css +1 -0
  154. package/minilo/theme-chalk/ml-virtual-list.css +1 -0
  155. package/minilo/theme-chalk/src/button.scss +22 -0
  156. package/minilo/theme-chalk/src/chart.scss +11 -0
  157. package/minilo/theme-chalk/src/default/variable.scss +1 -0
  158. package/minilo/theme-chalk/src/detail.scss +9 -0
  159. package/minilo/theme-chalk/src/index.scss +12 -0
  160. package/minilo/theme-chalk/src/mixins/mixin.scss +273 -0
  161. package/minilo/theme-chalk/src/number-range-input.scss +9 -0
  162. package/minilo/theme-chalk/src/search-table.scss +47 -0
  163. package/minilo/theme-chalk/src/search.scss +20 -0
  164. package/minilo/theme-chalk/src/virtual-list.scss +49 -0
  165. package/package.json +107 -0
@@ -0,0 +1,425 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var vue = require('vue');
6
+ var index = require('../../utils/index.js');
7
+
8
+ const _hoisted_1 = ["data-index"];
9
+ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
10
+ ...{
11
+ name: "MlVirtualList"
12
+ },
13
+ __name: "index",
14
+ props: {
15
+ height: { type: Number, required: false, default: 500 },
16
+ itemHeight: { type: Number, required: false, default: 50 },
17
+ estimatedItemHeight: { type: Number, required: false, default: 50 },
18
+ itemEqual: { type: Boolean, required: false, default: true },
19
+ preLoadCount: { type: Number, required: false, default: 5 },
20
+ threshold: { type: Number, required: false, default: 200 },
21
+ dataSource: { type: Array, required: false, default: () => [] },
22
+ loading: { type: Boolean, required: false },
23
+ finished: { type: Boolean, required: false }
24
+ },
25
+ emits: ["load-more"],
26
+ setup(__props, { emit: __emit }) {
27
+ const props = __props;
28
+ const emit = __emit;
29
+ const SCROLL_VIEW_HEIGHT = vue.computed(() => props.height);
30
+ const ITEM_HEIGHT = vue.computed(() => props.itemHeight);
31
+ const ESTIMATED_ITEM_HEIGHT = vue.computed(() => props.estimatedItemHeight);
32
+ const PRE_LOAD_COUNT = vue.computed(() => props.preLoadCount);
33
+ const containerRef = vue.ref(null);
34
+ const positions = vue.ref([]);
35
+ const showRange = vue.ref({
36
+ start: 0,
37
+ end: 10
38
+ });
39
+ let rafId = null;
40
+ let isRafPending = false;
41
+ let resizeObserver = null;
42
+ let resizeUpdateTimer = null;
43
+ const initPositions = () => {
44
+ const data = props.dataSource;
45
+ const height = props.itemEqual ? ITEM_HEIGHT.value : ESTIMATED_ITEM_HEIGHT.value;
46
+ positions.value = data.map((_, index) => ({
47
+ index,
48
+ height,
49
+ top: index * height,
50
+ bottom: (index + 1) * height
51
+ }));
52
+ };
53
+ const scrollViewHeight = vue.computed(() => {
54
+ if (props.itemEqual) {
55
+ return props.dataSource.length * ITEM_HEIGHT.value;
56
+ }
57
+ const len = positions.value.length;
58
+ const lastPos = positions.value[len - 1];
59
+ if (len > 0 && lastPos) {
60
+ return lastPos.bottom;
61
+ }
62
+ return 0;
63
+ });
64
+ const scrollViewOffset = vue.computed(() => {
65
+ const start = showRange.value.start;
66
+ if (props.itemEqual) {
67
+ return start * ITEM_HEIGHT.value;
68
+ }
69
+ return start > 0 && positions.value[start] ? positions.value[start].top : 0;
70
+ });
71
+ const currentViewList = vue.computed(() => {
72
+ return props.dataSource.slice(showRange.value.start, showRange.value.end).map((el, index) => ({
73
+ data: el,
74
+ index: showRange.value.start + index
75
+ }));
76
+ });
77
+ const getStartIndex = (scrollTop) => {
78
+ let start = 0;
79
+ let end = positions.value.length - 1;
80
+ let mid = 0;
81
+ while (start <= end) {
82
+ mid = Math.floor((start + end) / 2);
83
+ const midPos = positions.value[mid];
84
+ if (!midPos) break;
85
+ const midBottom = midPos.bottom;
86
+ const midTop = midPos.top;
87
+ if (midTop <= scrollTop && midBottom > scrollTop) {
88
+ return mid;
89
+ } else if (midTop > scrollTop) {
90
+ end = mid - 1;
91
+ } else {
92
+ start = mid + 1;
93
+ }
94
+ }
95
+ return 0;
96
+ };
97
+ const updatePositions = () => {
98
+ if (props.itemEqual) return;
99
+ const nodes = containerRef.value?.querySelectorAll(".virtual-list-item");
100
+ if (!nodes || nodes.length === 0) return;
101
+ nodes.forEach((node) => {
102
+ const rect = node.getBoundingClientRect();
103
+ const height = rect.height;
104
+ const index = parseInt(node.dataset.index || "0");
105
+ const pos = positions.value[index];
106
+ if (!pos) return;
107
+ const oldHeight = pos.height || 0;
108
+ if (oldHeight !== height) {
109
+ pos.height = height;
110
+ pos.bottom = pos.top + height;
111
+ for (let i = index + 1; i < positions.value.length; i++) {
112
+ const currentPos = positions.value[i];
113
+ const prevPos = positions.value[i - 1];
114
+ if (currentPos && prevPos) {
115
+ currentPos.top = prevPos.bottom;
116
+ currentPos.bottom = currentPos.top + currentPos.height;
117
+ }
118
+ }
119
+ }
120
+ });
121
+ };
122
+ const initResizeObserver = () => {
123
+ if (props.itemEqual) return;
124
+ if (resizeObserver) {
125
+ resizeObserver.disconnect();
126
+ }
127
+ resizeObserver = new ResizeObserver((entries) => {
128
+ let needUpdate = false;
129
+ const changedIndices = [];
130
+ for (const entry of entries) {
131
+ const target = entry.target;
132
+ const index = parseInt(target.dataset.index || "0");
133
+ const pos = positions.value[index];
134
+ if (!pos) continue;
135
+ const newHeight = entry.contentRect.height;
136
+ const oldHeight = pos.height;
137
+ if (Math.abs(newHeight - oldHeight) > 1) {
138
+ needUpdate = true;
139
+ changedIndices.push(index);
140
+ pos.height = newHeight;
141
+ pos.bottom = pos.top + newHeight;
142
+ }
143
+ }
144
+ if (needUpdate) {
145
+ if (resizeUpdateTimer !== null) {
146
+ clearTimeout(resizeUpdateTimer);
147
+ }
148
+ resizeUpdateTimer = window.setTimeout(() => {
149
+ const minChangedIndex = Math.min(...changedIndices);
150
+ for (let i = minChangedIndex + 1; i < positions.value.length; i++) {
151
+ const currentPos = positions.value[i];
152
+ const prevPos = positions.value[i - 1];
153
+ if (currentPos && prevPos) {
154
+ currentPos.top = prevPos.bottom;
155
+ currentPos.bottom = currentPos.top + currentPos.height;
156
+ }
157
+ }
158
+ changedIndices.length = 0;
159
+ resizeUpdateTimer = null;
160
+ }, 16);
161
+ }
162
+ });
163
+ observeVisibleItems();
164
+ };
165
+ const observeVisibleItems = () => {
166
+ if (!resizeObserver || props.itemEqual) return;
167
+ resizeObserver.disconnect();
168
+ const nodes = containerRef.value?.querySelectorAll(".virtual-list-item");
169
+ if (!nodes) return;
170
+ nodes.forEach((node) => {
171
+ resizeObserver.observe(node);
172
+ });
173
+ };
174
+ const calculateRange = () => {
175
+ const element = containerRef.value;
176
+ if (!element) return;
177
+ const scrollTop = element.scrollTop;
178
+ const clientHeight = element.clientHeight;
179
+ let start = 0;
180
+ let end = 0;
181
+ if (props.itemEqual) {
182
+ start = Math.floor(scrollTop / ITEM_HEIGHT.value);
183
+ const viewItemSize = Math.ceil(clientHeight / ITEM_HEIGHT.value);
184
+ end = start + viewItemSize;
185
+ } else {
186
+ if (positions.value.length === 0) return;
187
+ start = getStartIndex(scrollTop);
188
+ let totalHeight = 0;
189
+ const targetHeight = clientHeight + PRE_LOAD_COUNT.value * ESTIMATED_ITEM_HEIGHT.value;
190
+ for (let i = start; i < positions.value.length; i++) {
191
+ const pos = positions.value[i];
192
+ if (!pos) break;
193
+ totalHeight += pos.height;
194
+ if (totalHeight >= targetHeight) {
195
+ end = i + 1;
196
+ break;
197
+ }
198
+ end = i + 1;
199
+ }
200
+ }
201
+ const maxVisibleItems = 10;
202
+ if (end - start > maxVisibleItems) {
203
+ end = start + maxVisibleItems;
204
+ }
205
+ showRange.value = {
206
+ start: Math.max(0, start - PRE_LOAD_COUNT.value),
207
+ end: Math.min(props.dataSource.length, end + PRE_LOAD_COUNT.value)
208
+ };
209
+ };
210
+ const checkLoadMore = () => {
211
+ const element = containerRef.value;
212
+ if (!element || props.loading || props.finished) return;
213
+ const scrollTop = element.scrollTop;
214
+ const clientHeight = element.clientHeight;
215
+ const totalHeight = scrollViewHeight.value;
216
+ const distanceToBottom = totalHeight - scrollTop - clientHeight;
217
+ if (distanceToBottom < props.threshold) {
218
+ emit("load-more");
219
+ }
220
+ };
221
+ const onContainerScroll = () => {
222
+ if (isRafPending) return;
223
+ isRafPending = true;
224
+ rafId = requestAnimationFrame(() => {
225
+ updatePositions();
226
+ calculateRange();
227
+ if (props.finished !== void 0 && !props.finished) {
228
+ checkLoadMore();
229
+ }
230
+ isRafPending = false;
231
+ });
232
+ };
233
+ vue.watch(
234
+ () => props.dataSource.length,
235
+ (newLen, oldLen = 0) => {
236
+ if (newLen !== oldLen) {
237
+ if (props.itemEqual) {
238
+ initPositions();
239
+ } else {
240
+ if (newLen > oldLen) {
241
+ const height = ESTIMATED_ITEM_HEIGHT.value;
242
+ for (let i = oldLen; i < newLen; i++) {
243
+ const lastPos = positions.value[i - 1];
244
+ positions.value.push({
245
+ index: i,
246
+ height,
247
+ top: lastPos ? lastPos.bottom : 0,
248
+ bottom: (lastPos ? lastPos.bottom : 0) + height
249
+ });
250
+ }
251
+ } else {
252
+ positions.value = positions.value.slice(0, newLen);
253
+ }
254
+ }
255
+ requestAnimationFrame(() => {
256
+ updatePositions();
257
+ calculateRange();
258
+ if (!props.itemEqual) {
259
+ observeVisibleItems();
260
+ }
261
+ });
262
+ }
263
+ },
264
+ { immediate: true }
265
+ );
266
+ vue.watch(
267
+ () => showRange.value,
268
+ () => {
269
+ if (!props.itemEqual && resizeObserver) {
270
+ if (rafId !== null) {
271
+ cancelAnimationFrame(rafId);
272
+ }
273
+ rafId = requestAnimationFrame(() => {
274
+ observeVisibleItems();
275
+ rafId = null;
276
+ });
277
+ }
278
+ },
279
+ { deep: true }
280
+ );
281
+ vue.onMounted(() => {
282
+ initPositions();
283
+ initResizeObserver();
284
+ requestAnimationFrame(() => {
285
+ updatePositions();
286
+ calculateRange();
287
+ });
288
+ });
289
+ vue.onUnmounted(() => {
290
+ if (rafId !== null) {
291
+ cancelAnimationFrame(rafId);
292
+ }
293
+ if (resizeUpdateTimer !== null) {
294
+ clearTimeout(resizeUpdateTimer);
295
+ }
296
+ if (resizeObserver) {
297
+ resizeObserver.disconnect();
298
+ resizeObserver = null;
299
+ }
300
+ });
301
+ return (_ctx, _cache) => {
302
+ return vue.openBlock(), vue.createElementBlock(
303
+ "div",
304
+ {
305
+ class: vue.normalizeClass(vue.unref(index.bem)("virtual-list"))
306
+ },
307
+ [
308
+ vue.createElementVNode(
309
+ "div",
310
+ {
311
+ class: vue.normalizeClass(vue.unref(index.bem)("virtual-list", "container")),
312
+ ref_key: "containerRef",
313
+ ref: containerRef,
314
+ style: vue.normalizeStyle({
315
+ height: SCROLL_VIEW_HEIGHT.value + "px",
316
+ overflow: "auto"
317
+ }),
318
+ onScroll: onContainerScroll
319
+ },
320
+ [
321
+ vue.createElementVNode(
322
+ "div",
323
+ {
324
+ class: vue.normalizeClass(vue.unref(index.bem)("virtual-list", "phantom")),
325
+ style: vue.normalizeStyle({
326
+ height: scrollViewHeight.value + "px"
327
+ })
328
+ },
329
+ [
330
+ vue.createElementVNode(
331
+ "div",
332
+ {
333
+ class: vue.normalizeClass(vue.unref(index.bem)("virtual-list", "content")),
334
+ style: vue.normalizeStyle({
335
+ transform: `translateY(${scrollViewOffset.value}px)`
336
+ })
337
+ },
338
+ [
339
+ (vue.openBlock(true), vue.createElementBlock(
340
+ vue.Fragment,
341
+ null,
342
+ vue.renderList(currentViewList.value, (item) => {
343
+ return vue.openBlock(), vue.createElementBlock("div", {
344
+ key: item.index,
345
+ class: vue.normalizeClass(vue.unref(index.bem)("virtual-list", "item")),
346
+ "data-index": item.index,
347
+ style: vue.normalizeStyle(__props.itemEqual ? { height: ITEM_HEIGHT.value + "px" } : {})
348
+ }, [
349
+ vue.renderSlot(_ctx.$slots, "default", {
350
+ item: item.data,
351
+ index: item.index
352
+ })
353
+ ], 14, _hoisted_1);
354
+ }),
355
+ 128
356
+ /* KEYED_FRAGMENT */
357
+ ))
358
+ ],
359
+ 6
360
+ /* CLASS, STYLE */
361
+ )
362
+ ],
363
+ 6
364
+ /* CLASS, STYLE */
365
+ ),
366
+ vue.createCommentVNode(" \u52A0\u8F7D\u72B6\u6001\u63D0\u793A\uFF08\u5728\u5BB9\u5668\u5185\u90E8\uFF09 "),
367
+ props.loading ? (vue.openBlock(), vue.createElementBlock(
368
+ "div",
369
+ {
370
+ key: 0,
371
+ class: vue.normalizeClass(vue.unref(index.bem)("virtual-list", "loading-tip"))
372
+ },
373
+ [
374
+ vue.renderSlot(_ctx.$slots, "loading", {}, () => [
375
+ _cache[0] || (_cache[0] = vue.createElementVNode(
376
+ "span",
377
+ { class: "loading-spinner" },
378
+ null,
379
+ -1
380
+ /* CACHED */
381
+ )),
382
+ _cache[1] || (_cache[1] = vue.createElementVNode(
383
+ "span",
384
+ null,
385
+ "\u52A0\u8F7D\u4E2D...",
386
+ -1
387
+ /* CACHED */
388
+ ))
389
+ ])
390
+ ],
391
+ 2
392
+ /* CLASS */
393
+ )) : vue.createCommentVNode("v-if", true),
394
+ vue.createCommentVNode(" \u52A0\u8F7D\u5B8C\u6210\u63D0\u793A "),
395
+ props.finished && !props.loading ? (vue.openBlock(), vue.createElementBlock(
396
+ "div",
397
+ {
398
+ key: 1,
399
+ class: vue.normalizeClass(vue.unref(index.bem)("virtual-list", "finished-tip"))
400
+ },
401
+ [
402
+ vue.renderSlot(_ctx.$slots, "finished", {}, () => [
403
+ _cache[2] || (_cache[2] = vue.createTextVNode(
404
+ "\u5DF2\u52A0\u8F7D\u5168\u90E8\u6570\u636E",
405
+ -1
406
+ /* CACHED */
407
+ ))
408
+ ])
409
+ ],
410
+ 2
411
+ /* CLASS */
412
+ )) : vue.createCommentVNode("v-if", true)
413
+ ],
414
+ 38
415
+ /* CLASS, STYLE, NEED_HYDRATION */
416
+ )
417
+ ],
418
+ 2
419
+ /* CLASS */
420
+ );
421
+ };
422
+ }
423
+ });
424
+
425
+ exports.default = _sfc_main;
@@ -0,0 +1,20 @@
1
+ export interface MlVirtualListProps {
2
+ /** 容器高度,默认 500px */
3
+ height?: number;
4
+ /** 列表项高度(定高模式必传) */
5
+ itemHeight?: number;
6
+ /** 列表项预估高度(不定高模式使用),默认 50px */
7
+ estimatedItemHeight?: number;
8
+ /** 是否为等高列表,true=定高,false=不定高,默认 true */
9
+ itemEqual?: boolean;
10
+ /** 预加载数量(上下各预加载几个) */
11
+ preLoadCount?: number;
12
+ /** 距离底部多少像素时触发加载 */
13
+ threshold?: number;
14
+ /** 数据源 */
15
+ dataSource?: any[];
16
+ /** 是否正在加载 */
17
+ loading?: boolean;
18
+ /** 是否已加载完所有数据 */
19
+ finished?: boolean;
20
+ }
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+