@minilo/ui 0.0.7 → 0.0.8

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 (212) hide show
  1. package/package.json +2 -2
  2. package/minilo/dist/index.css +0 -1
  3. package/minilo/dist/index.full.js +0 -8393
  4. package/minilo/dist/index.full.min.js +0 -2
  5. package/minilo/dist/index.full.min.js.map +0 -1
  6. package/minilo/dist/index.full.min.mjs +0 -2
  7. package/minilo/dist/index.full.min.mjs.map +0 -1
  8. package/minilo/dist/index.full.mjs +0 -8373
  9. package/minilo/es/components/button/index.d.ts +0 -47
  10. package/minilo/es/components/button/index.mjs +0 -6
  11. package/minilo/es/components/button/index.vue.d.ts +0 -29
  12. package/minilo/es/components/button/index.vue.mjs +0 -5
  13. package/minilo/es/components/button/index.vue2.mjs +0 -67
  14. package/minilo/es/components/button/type.d.ts +0 -10
  15. package/minilo/es/components/chart/index.d.ts +0 -49
  16. package/minilo/es/components/chart/index.mjs +0 -6
  17. package/minilo/es/components/chart/index.vue.d.ts +0 -33
  18. package/minilo/es/components/chart/index.vue.mjs +0 -5
  19. package/minilo/es/components/chart/index.vue2.mjs +0 -124
  20. package/minilo/es/components/chart/type.d.ts +0 -7
  21. package/minilo/es/components/detail/index.d.ts +0 -37
  22. package/minilo/es/components/detail/index.mjs +0 -6
  23. package/minilo/es/components/detail/index.vue.d.ts +0 -23
  24. package/minilo/es/components/detail/index.vue.mjs +0 -5
  25. package/minilo/es/components/detail/index.vue2.mjs +0 -194
  26. package/minilo/es/components/detail/renderLabel.vue.d.ts +0 -8
  27. package/minilo/es/components/detail/renderLabel.vue.mjs +0 -5
  28. package/minilo/es/components/detail/renderLabel.vue2.mjs +0 -23
  29. package/minilo/es/components/detail/renderTooltip.vue.d.ts +0 -8
  30. package/minilo/es/components/detail/renderTooltip.vue.mjs +0 -5
  31. package/minilo/es/components/detail/renderTooltip.vue2.mjs +0 -23
  32. package/minilo/es/components/detail/type.d.ts +0 -27
  33. package/minilo/es/components/image-upload-pro/index.d.ts +0 -544
  34. package/minilo/es/components/image-upload-pro/index.mjs +0 -7
  35. package/minilo/es/components/image-upload-pro/index.vue.d.ts +0 -546
  36. package/minilo/es/components/image-upload-pro/index.vue.mjs +0 -5
  37. package/minilo/es/components/image-upload-pro/index.vue2.mjs +0 -657
  38. package/minilo/es/components/image-upload-pro/type.d.ts +0 -147
  39. package/minilo/es/components/image-upload-pro/type.mjs +0 -81
  40. package/minilo/es/components/index.d.ts +0 -11
  41. package/minilo/es/components/index.mjs +0 -14
  42. package/minilo/es/components/number-range-input/index.d.ts +0 -41
  43. package/minilo/es/components/number-range-input/index.mjs +0 -6
  44. package/minilo/es/components/number-range-input/index.vue.d.ts +0 -33
  45. package/minilo/es/components/number-range-input/index.vue.mjs +0 -5
  46. package/minilo/es/components/number-range-input/index.vue2.mjs +0 -150
  47. package/minilo/es/components/number-range-input/props.d.ts +0 -10
  48. package/minilo/es/components/search/index.d.ts +0 -488
  49. package/minilo/es/components/search/index.mjs +0 -6
  50. package/minilo/es/components/search/index.vue.d.ts +0 -554
  51. package/minilo/es/components/search/index.vue.mjs +0 -5
  52. package/minilo/es/components/search/index.vue2.mjs +0 -297
  53. package/minilo/es/components/search/props.d.ts +0 -107
  54. package/minilo/es/components/search/props.mjs +0 -55
  55. package/minilo/es/components/search-table/index.mjs +0 -6
  56. package/minilo/es/components/search-table/index.vue.d.ts +0 -189
  57. package/minilo/es/components/search-table/index.vue.mjs +0 -5
  58. package/minilo/es/components/search-table/index.vue2.mjs +0 -198
  59. package/minilo/es/components/search-table/props.d.ts +0 -69
  60. package/minilo/es/components/search-table/props.mjs +0 -69
  61. package/minilo/es/components/search-table/render.d.ts +0 -11
  62. package/minilo/es/components/search-table/render.mjs +0 -19
  63. package/minilo/es/components/tree-select/index.d.ts +0 -34
  64. package/minilo/es/components/tree-select/index.mjs +0 -6
  65. package/minilo/es/components/tree-select/index.vue.d.ts +0 -23
  66. package/minilo/es/components/tree-select/index.vue.mjs +0 -5
  67. package/minilo/es/components/tree-select/index.vue2.mjs +0 -229
  68. package/minilo/es/components/tree-select/type.d.ts +0 -34
  69. package/minilo/es/components/tree-select-dialog/index.d.ts +0 -64
  70. package/minilo/es/components/tree-select-dialog/index.mjs +0 -7
  71. package/minilo/es/components/tree-select-dialog/index.vue.d.ts +0 -26
  72. package/minilo/es/components/tree-select-dialog/index.vue.mjs +0 -5
  73. package/minilo/es/components/tree-select-dialog/index.vue2.mjs +0 -145
  74. package/minilo/es/components/tree-select-dialog/type.d.ts +0 -9
  75. package/minilo/es/components/tree-select-dialog/type.mjs +0 -24
  76. package/minilo/es/components/tree-select-drawer/index.d.ts +0 -69
  77. package/minilo/es/components/tree-select-drawer/index.mjs +0 -7
  78. package/minilo/es/components/tree-select-drawer/index.vue.d.ts +0 -26
  79. package/minilo/es/components/tree-select-drawer/index.vue.mjs +0 -5
  80. package/minilo/es/components/tree-select-drawer/index.vue2.mjs +0 -151
  81. package/minilo/es/components/tree-select-drawer/type.d.ts +0 -10
  82. package/minilo/es/components/tree-select-drawer/type.mjs +0 -20
  83. package/minilo/es/components/virtual-list/index.d.ts +0 -59
  84. package/minilo/es/components/virtual-list/index.mjs +0 -6
  85. package/minilo/es/components/virtual-list/index.vue.d.ts +0 -39
  86. package/minilo/es/components/virtual-list/index.vue.mjs +0 -5
  87. package/minilo/es/components/virtual-list/index.vue2.mjs +0 -423
  88. package/minilo/es/components/virtual-list/type.d.ts +0 -20
  89. package/minilo/es/node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.5.26_typescript@5.9.3_/node_modules/@element-plus/icons-vue/dist/index.mjs +0 -41
  90. package/minilo/es/node_modules/.pnpm/@vueuse_core@13.9.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/core/index.mjs +0 -73
  91. package/minilo/es/node_modules/.pnpm/@vueuse_shared@13.9.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/shared/index.mjs +0 -76
  92. package/minilo/es/packages/utils/dist/func/common.mjs +0 -14
  93. package/minilo/es/packages/utils/dist/request/index.mjs +0 -105
  94. package/minilo/es/resolver/index.d.ts +0 -8
  95. package/minilo/es/resolver/index.mjs +0 -26
  96. package/minilo/es/utils/index.d.ts +0 -28
  97. package/minilo/es/utils/index.mjs +0 -30
  98. package/minilo/lib/components/button/index.d.ts +0 -47
  99. package/minilo/lib/components/button/index.js +0 -11
  100. package/minilo/lib/components/button/index.vue.d.ts +0 -29
  101. package/minilo/lib/components/button/index.vue.js +0 -9
  102. package/minilo/lib/components/button/index.vue2.js +0 -71
  103. package/minilo/lib/components/button/type.d.ts +0 -10
  104. package/minilo/lib/components/chart/index.d.ts +0 -49
  105. package/minilo/lib/components/chart/index.js +0 -11
  106. package/minilo/lib/components/chart/index.vue.d.ts +0 -33
  107. package/minilo/lib/components/chart/index.vue.js +0 -9
  108. package/minilo/lib/components/chart/index.vue2.js +0 -128
  109. package/minilo/lib/components/chart/type.d.ts +0 -7
  110. package/minilo/lib/components/detail/index.d.ts +0 -37
  111. package/minilo/lib/components/detail/index.js +0 -11
  112. package/minilo/lib/components/detail/index.vue.d.ts +0 -23
  113. package/minilo/lib/components/detail/index.vue.js +0 -9
  114. package/minilo/lib/components/detail/index.vue2.js +0 -198
  115. package/minilo/lib/components/detail/renderLabel.vue.d.ts +0 -8
  116. package/minilo/lib/components/detail/renderLabel.vue.js +0 -9
  117. package/minilo/lib/components/detail/renderLabel.vue2.js +0 -27
  118. package/minilo/lib/components/detail/renderTooltip.vue.d.ts +0 -8
  119. package/minilo/lib/components/detail/renderTooltip.vue.js +0 -9
  120. package/minilo/lib/components/detail/renderTooltip.vue2.js +0 -27
  121. package/minilo/lib/components/detail/type.d.ts +0 -27
  122. package/minilo/lib/components/image-upload-pro/index.d.ts +0 -544
  123. package/minilo/lib/components/image-upload-pro/index.js +0 -13
  124. package/minilo/lib/components/image-upload-pro/index.vue.d.ts +0 -546
  125. package/minilo/lib/components/image-upload-pro/index.vue.js +0 -9
  126. package/minilo/lib/components/image-upload-pro/index.vue2.js +0 -661
  127. package/minilo/lib/components/image-upload-pro/type.d.ts +0 -147
  128. package/minilo/lib/components/image-upload-pro/type.js +0 -83
  129. package/minilo/lib/components/index.d.ts +0 -11
  130. package/minilo/lib/components/index.js +0 -33
  131. package/minilo/lib/components/number-range-input/index.d.ts +0 -41
  132. package/minilo/lib/components/number-range-input/index.js +0 -11
  133. package/minilo/lib/components/number-range-input/index.vue.d.ts +0 -33
  134. package/minilo/lib/components/number-range-input/index.vue.js +0 -9
  135. package/minilo/lib/components/number-range-input/index.vue2.js +0 -154
  136. package/minilo/lib/components/number-range-input/props.d.ts +0 -10
  137. package/minilo/lib/components/search/index.d.ts +0 -488
  138. package/minilo/lib/components/search/index.js +0 -11
  139. package/minilo/lib/components/search/index.vue.d.ts +0 -554
  140. package/minilo/lib/components/search/index.vue.js +0 -9
  141. package/minilo/lib/components/search/index.vue2.js +0 -301
  142. package/minilo/lib/components/search/props.d.ts +0 -107
  143. package/minilo/lib/components/search/props.js +0 -58
  144. package/minilo/lib/components/search-table/index.js +0 -11
  145. package/minilo/lib/components/search-table/index.vue.d.ts +0 -189
  146. package/minilo/lib/components/search-table/index.vue.js +0 -9
  147. package/minilo/lib/components/search-table/index.vue2.js +0 -202
  148. package/minilo/lib/components/search-table/props.d.ts +0 -69
  149. package/minilo/lib/components/search-table/props.js +0 -72
  150. package/minilo/lib/components/search-table/render.d.ts +0 -11
  151. package/minilo/lib/components/search-table/render.js +0 -23
  152. package/minilo/lib/components/tree-select/index.d.ts +0 -34
  153. package/minilo/lib/components/tree-select/index.js +0 -11
  154. package/minilo/lib/components/tree-select/index.vue.d.ts +0 -23
  155. package/minilo/lib/components/tree-select/index.vue.js +0 -9
  156. package/minilo/lib/components/tree-select/index.vue2.js +0 -233
  157. package/minilo/lib/components/tree-select/type.d.ts +0 -34
  158. package/minilo/lib/components/tree-select-dialog/index.d.ts +0 -64
  159. package/minilo/lib/components/tree-select-dialog/index.js +0 -13
  160. package/minilo/lib/components/tree-select-dialog/index.vue.d.ts +0 -26
  161. package/minilo/lib/components/tree-select-dialog/index.vue.js +0 -9
  162. package/minilo/lib/components/tree-select-dialog/index.vue2.js +0 -149
  163. package/minilo/lib/components/tree-select-dialog/type.d.ts +0 -9
  164. package/minilo/lib/components/tree-select-dialog/type.js +0 -26
  165. package/minilo/lib/components/tree-select-drawer/index.d.ts +0 -69
  166. package/minilo/lib/components/tree-select-drawer/index.js +0 -13
  167. package/minilo/lib/components/tree-select-drawer/index.vue.d.ts +0 -26
  168. package/minilo/lib/components/tree-select-drawer/index.vue.js +0 -9
  169. package/minilo/lib/components/tree-select-drawer/index.vue2.js +0 -155
  170. package/minilo/lib/components/tree-select-drawer/type.d.ts +0 -10
  171. package/minilo/lib/components/tree-select-drawer/type.js +0 -22
  172. package/minilo/lib/components/virtual-list/index.d.ts +0 -59
  173. package/minilo/lib/components/virtual-list/index.js +0 -11
  174. package/minilo/lib/components/virtual-list/index.vue.d.ts +0 -39
  175. package/minilo/lib/components/virtual-list/index.vue.js +0 -9
  176. package/minilo/lib/components/virtual-list/index.vue2.js +0 -427
  177. package/minilo/lib/components/virtual-list/type.d.ts +0 -20
  178. package/minilo/lib/node_modules/.pnpm/@element-plus_icons-vue@2.3.1_vue@3.5.26_typescript@5.9.3_/node_modules/@element-plus/icons-vue/dist/index.js +0 -44
  179. package/minilo/lib/node_modules/.pnpm/@vueuse_core@13.9.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/core/index.js +0 -84
  180. package/minilo/lib/node_modules/.pnpm/@vueuse_shared@13.9.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/shared/index.js +0 -83
  181. package/minilo/lib/packages/utils/dist/func/common.js +0 -16
  182. package/minilo/lib/packages/utils/dist/request/index.js +0 -115
  183. package/minilo/lib/resolver/index.d.ts +0 -8
  184. package/minilo/lib/resolver/index.js +0 -28
  185. package/minilo/lib/utils/index.d.ts +0 -28
  186. package/minilo/lib/utils/index.js +0 -34
  187. package/minilo/theme-chalk/index.css +0 -1
  188. package/minilo/theme-chalk/ml-button.css +0 -1
  189. package/minilo/theme-chalk/ml-chart.css +0 -1
  190. package/minilo/theme-chalk/ml-detail.css +0 -1
  191. package/minilo/theme-chalk/ml-image-upload-pro.css +0 -1
  192. package/minilo/theme-chalk/ml-number-range-input.css +0 -1
  193. package/minilo/theme-chalk/ml-search-table.css +0 -1
  194. package/minilo/theme-chalk/ml-search.css +0 -1
  195. package/minilo/theme-chalk/ml-tree-select-dialog.css +0 -0
  196. package/minilo/theme-chalk/ml-tree-select-drawer.css +0 -0
  197. package/minilo/theme-chalk/ml-tree-select.css +0 -1
  198. package/minilo/theme-chalk/ml-virtual-list.css +0 -1
  199. package/minilo/theme-chalk/src/button.scss +0 -22
  200. package/minilo/theme-chalk/src/chart.scss +0 -11
  201. package/minilo/theme-chalk/src/default/variable.scss +0 -1
  202. package/minilo/theme-chalk/src/detail.scss +0 -9
  203. package/minilo/theme-chalk/src/image-upload-pro.scss +0 -70
  204. package/minilo/theme-chalk/src/index.scss +0 -14
  205. package/minilo/theme-chalk/src/mixins/mixin.scss +0 -273
  206. package/minilo/theme-chalk/src/number-range-input.scss +0 -9
  207. package/minilo/theme-chalk/src/search-table.scss +0 -47
  208. package/minilo/theme-chalk/src/search.scss +0 -20
  209. package/minilo/theme-chalk/src/tree-select-dialog.scss +0 -0
  210. package/minilo/theme-chalk/src/tree-select-drawer.scss +0 -0
  211. package/minilo/theme-chalk/src/tree-select.scss +0 -47
  212. package/minilo/theme-chalk/src/virtual-list.scss +0 -49
@@ -1,427 +0,0 @@
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
- console.log("\u5916\u90E8entries:", entries);
129
- let needUpdate = false;
130
- const changedIndices = [];
131
- for (const entry of entries) {
132
- console.log("entry:", entry);
133
- const target = entry.target;
134
- const index = parseInt(target.dataset.index || "0");
135
- const pos = positions.value[index];
136
- if (!pos) continue;
137
- const newHeight = entry.contentRect.height;
138
- const oldHeight = pos.height;
139
- if (Math.abs(newHeight - oldHeight) > 1) {
140
- needUpdate = true;
141
- changedIndices.push(index);
142
- pos.height = newHeight;
143
- pos.bottom = pos.top + newHeight;
144
- }
145
- }
146
- if (needUpdate) {
147
- if (resizeUpdateTimer !== null) {
148
- clearTimeout(resizeUpdateTimer);
149
- }
150
- resizeUpdateTimer = window.setTimeout(() => {
151
- const minChangedIndex = Math.min(...changedIndices);
152
- for (let i = minChangedIndex + 1; i < positions.value.length; i++) {
153
- const currentPos = positions.value[i];
154
- const prevPos = positions.value[i - 1];
155
- if (currentPos && prevPos) {
156
- currentPos.top = prevPos.bottom;
157
- currentPos.bottom = currentPos.top + currentPos.height;
158
- }
159
- }
160
- changedIndices.length = 0;
161
- resizeUpdateTimer = null;
162
- }, 16);
163
- }
164
- });
165
- observeVisibleItems();
166
- };
167
- const observeVisibleItems = () => {
168
- if (!resizeObserver || props.itemEqual) return;
169
- resizeObserver.disconnect();
170
- const nodes = containerRef.value?.querySelectorAll(`.${index.bem("virtual-list", "item")}`);
171
- if (!nodes) return;
172
- nodes.forEach((node) => {
173
- resizeObserver.observe(node);
174
- });
175
- };
176
- const calculateRange = () => {
177
- const element = containerRef.value;
178
- if (!element) return;
179
- const scrollTop = element.scrollTop;
180
- const clientHeight = element.clientHeight;
181
- let start = 0;
182
- let end = 0;
183
- if (props.itemEqual) {
184
- start = Math.floor(scrollTop / ITEM_HEIGHT.value);
185
- const viewItemSize = Math.ceil(clientHeight / ITEM_HEIGHT.value);
186
- end = start + viewItemSize;
187
- } else {
188
- if (positions.value.length === 0) return;
189
- start = getStartIndex(scrollTop);
190
- let totalHeight = 0;
191
- const targetHeight = clientHeight + PRE_LOAD_COUNT.value * ESTIMATED_ITEM_HEIGHT.value;
192
- for (let i = start; i < positions.value.length; i++) {
193
- const pos = positions.value[i];
194
- if (!pos) break;
195
- totalHeight += pos.height;
196
- if (totalHeight >= targetHeight) {
197
- end = i + 1;
198
- break;
199
- }
200
- end = i + 1;
201
- }
202
- }
203
- const maxVisibleItems = 10;
204
- if (end - start > maxVisibleItems) {
205
- end = start + maxVisibleItems;
206
- }
207
- showRange.value = {
208
- start: Math.max(0, start - PRE_LOAD_COUNT.value),
209
- end: Math.min(props.dataSource.length, end + PRE_LOAD_COUNT.value)
210
- };
211
- };
212
- const checkLoadMore = () => {
213
- const element = containerRef.value;
214
- if (!element || props.loading || props.finished) return;
215
- const scrollTop = element.scrollTop;
216
- const clientHeight = element.clientHeight;
217
- const totalHeight = scrollViewHeight.value;
218
- const distanceToBottom = totalHeight - scrollTop - clientHeight;
219
- if (distanceToBottom < props.threshold) {
220
- emit("load-more");
221
- }
222
- };
223
- const onContainerScroll = () => {
224
- if (isRafPending) return;
225
- isRafPending = true;
226
- rafId = requestAnimationFrame(() => {
227
- updatePositions();
228
- calculateRange();
229
- if (props.finished !== void 0 && !props.finished) {
230
- checkLoadMore();
231
- }
232
- isRafPending = false;
233
- });
234
- };
235
- vue.watch(
236
- () => props.dataSource.length,
237
- (newLen, oldLen = 0) => {
238
- if (newLen !== oldLen) {
239
- if (props.itemEqual) {
240
- initPositions();
241
- } else {
242
- if (newLen > oldLen) {
243
- const height = ESTIMATED_ITEM_HEIGHT.value;
244
- for (let i = oldLen; i < newLen; i++) {
245
- const lastPos = positions.value[i - 1];
246
- positions.value.push({
247
- index: i,
248
- height,
249
- top: lastPos ? lastPos.bottom : 0,
250
- bottom: (lastPos ? lastPos.bottom : 0) + height
251
- });
252
- }
253
- } else {
254
- positions.value = positions.value.slice(0, newLen);
255
- }
256
- }
257
- requestAnimationFrame(() => {
258
- updatePositions();
259
- calculateRange();
260
- if (!props.itemEqual) {
261
- observeVisibleItems();
262
- }
263
- });
264
- }
265
- },
266
- { immediate: true }
267
- );
268
- vue.watch(
269
- () => showRange.value,
270
- () => {
271
- if (!props.itemEqual && resizeObserver) {
272
- if (rafId !== null) {
273
- cancelAnimationFrame(rafId);
274
- }
275
- rafId = requestAnimationFrame(() => {
276
- observeVisibleItems();
277
- rafId = null;
278
- });
279
- }
280
- },
281
- { deep: true }
282
- );
283
- vue.onMounted(() => {
284
- initPositions();
285
- initResizeObserver();
286
- requestAnimationFrame(() => {
287
- updatePositions();
288
- calculateRange();
289
- });
290
- });
291
- vue.onUnmounted(() => {
292
- if (rafId !== null) {
293
- cancelAnimationFrame(rafId);
294
- }
295
- if (resizeUpdateTimer !== null) {
296
- clearTimeout(resizeUpdateTimer);
297
- }
298
- if (resizeObserver) {
299
- resizeObserver.disconnect();
300
- resizeObserver = null;
301
- }
302
- });
303
- return (_ctx, _cache) => {
304
- return vue.openBlock(), vue.createElementBlock(
305
- "div",
306
- {
307
- class: vue.normalizeClass(vue.unref(index.bem)("virtual-list"))
308
- },
309
- [
310
- vue.createElementVNode(
311
- "div",
312
- {
313
- class: vue.normalizeClass(vue.unref(index.bem)("virtual-list", "container")),
314
- ref_key: "containerRef",
315
- ref: containerRef,
316
- style: vue.normalizeStyle({
317
- height: SCROLL_VIEW_HEIGHT.value + "px",
318
- overflow: "auto"
319
- }),
320
- onScroll: onContainerScroll
321
- },
322
- [
323
- vue.createElementVNode(
324
- "div",
325
- {
326
- class: vue.normalizeClass(vue.unref(index.bem)("virtual-list", "phantom")),
327
- style: vue.normalizeStyle({
328
- height: scrollViewHeight.value + "px"
329
- })
330
- },
331
- [
332
- vue.createElementVNode(
333
- "div",
334
- {
335
- class: vue.normalizeClass(vue.unref(index.bem)("virtual-list", "content")),
336
- style: vue.normalizeStyle({
337
- transform: `translateY(${scrollViewOffset.value}px)`
338
- })
339
- },
340
- [
341
- (vue.openBlock(true), vue.createElementBlock(
342
- vue.Fragment,
343
- null,
344
- vue.renderList(currentViewList.value, (item) => {
345
- return vue.openBlock(), vue.createElementBlock("div", {
346
- key: item.index,
347
- class: vue.normalizeClass(vue.unref(index.bem)("virtual-list", "item")),
348
- "data-index": item.index,
349
- style: vue.normalizeStyle(__props.itemEqual ? { height: ITEM_HEIGHT.value + "px" } : {})
350
- }, [
351
- vue.renderSlot(_ctx.$slots, "default", {
352
- item: item.data,
353
- index: item.index
354
- })
355
- ], 14, _hoisted_1);
356
- }),
357
- 128
358
- /* KEYED_FRAGMENT */
359
- ))
360
- ],
361
- 6
362
- /* CLASS, STYLE */
363
- )
364
- ],
365
- 6
366
- /* CLASS, STYLE */
367
- ),
368
- vue.createCommentVNode(" \u52A0\u8F7D\u72B6\u6001\u63D0\u793A\uFF08\u5728\u5BB9\u5668\u5185\u90E8\uFF09 "),
369
- props.loading ? (vue.openBlock(), vue.createElementBlock(
370
- "div",
371
- {
372
- key: 0,
373
- class: vue.normalizeClass(vue.unref(index.bem)("virtual-list", "loading-tip"))
374
- },
375
- [
376
- vue.renderSlot(_ctx.$slots, "loading", {}, () => [
377
- _cache[0] || (_cache[0] = vue.createElementVNode(
378
- "span",
379
- { class: "loading-spinner" },
380
- null,
381
- -1
382
- /* CACHED */
383
- )),
384
- _cache[1] || (_cache[1] = vue.createElementVNode(
385
- "span",
386
- null,
387
- "\u52A0\u8F7D\u4E2D...",
388
- -1
389
- /* CACHED */
390
- ))
391
- ])
392
- ],
393
- 2
394
- /* CLASS */
395
- )) : vue.createCommentVNode("v-if", true),
396
- vue.createCommentVNode(" \u52A0\u8F7D\u5B8C\u6210\u63D0\u793A "),
397
- props.finished && !props.loading ? (vue.openBlock(), vue.createElementBlock(
398
- "div",
399
- {
400
- key: 1,
401
- class: vue.normalizeClass(vue.unref(index.bem)("virtual-list", "finished-tip"))
402
- },
403
- [
404
- vue.renderSlot(_ctx.$slots, "finished", {}, () => [
405
- _cache[2] || (_cache[2] = vue.createTextVNode(
406
- "\u5DF2\u52A0\u8F7D\u5168\u90E8\u6570\u636E",
407
- -1
408
- /* CACHED */
409
- ))
410
- ])
411
- ],
412
- 2
413
- /* CLASS */
414
- )) : vue.createCommentVNode("v-if", true)
415
- ],
416
- 38
417
- /* CLASS, STYLE, NEED_HYDRATION */
418
- )
419
- ],
420
- 2
421
- /* CLASS */
422
- );
423
- };
424
- }
425
- });
426
-
427
- exports.default = _sfc_main;
@@ -1,20 +0,0 @@
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
- }
@@ -1,44 +0,0 @@
1
- 'use strict';
2
-
3
- var vue = require('vue');
4
-
5
- var search_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
6
- name: "Search",
7
- __name: "search",
8
- setup(__props) {
9
- return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
10
- xmlns: "http://www.w3.org/2000/svg",
11
- viewBox: "0 0 1024 1024"
12
- }, [
13
- vue.createElementVNode("path", {
14
- fill: "currentColor",
15
- d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"
16
- })
17
- ]));
18
- }
19
- });
20
- var search_default = search_vue_vue_type_script_setup_true_lang_default;
21
- var warning_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
22
- name: "Warning",
23
- __name: "warning",
24
- setup(__props) {
25
- return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
26
- xmlns: "http://www.w3.org/2000/svg",
27
- viewBox: "0 0 1024 1024"
28
- }, [
29
- vue.createElementVNode("path", {
30
- fill: "currentColor",
31
- d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 832a384 384 0 0 0 0-768 384 384 0 0 0 0 768m48-176a48 48 0 1 1-96 0 48 48 0 0 1 96 0m-48-464a32 32 0 0 1 32 32v288a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
32
- })
33
- ]));
34
- }
35
- });
36
- var warning_default = warning_vue_vue_type_script_setup_true_lang_default;
37
- /*! Bundled license information:
38
-
39
- @element-plus/icons-vue/dist/index.js:
40
- (*! Element Plus Icons Vue v2.3.1 *)
41
- */
42
-
43
- exports.Search = search_default;
44
- exports.Warning = warning_default;
@@ -1,84 +0,0 @@
1
- 'use strict';
2
-
3
- var index = require('../../../../@vueuse_shared@13.9.0_vue@3.5.26_typescript@5.9.3_/node_modules/@vueuse/shared/index.js');
4
- var vue = require('vue');
5
-
6
- const defaultWindow = index.isClient ? window : void 0;
7
-
8
- function unrefElement(elRef) {
9
- var _a;
10
- const plain = vue.toValue(elRef);
11
- return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
12
- }
13
-
14
- // @__NO_SIDE_EFFECTS__
15
- function useMounted() {
16
- const isMounted = vue.shallowRef(false);
17
- const instance = vue.getCurrentInstance();
18
- if (instance) {
19
- vue.onMounted(() => {
20
- isMounted.value = true;
21
- }, instance);
22
- }
23
- return isMounted;
24
- }
25
-
26
- // @__NO_SIDE_EFFECTS__
27
- function useSupported(callback) {
28
- const isMounted = useMounted();
29
- return vue.computed(() => {
30
- isMounted.value;
31
- return Boolean(callback());
32
- });
33
- }
34
-
35
- function useResizeObserver(target, callback, options = {}) {
36
- const { window = defaultWindow, ...observerOptions } = options;
37
- let observer;
38
- const isSupported = useSupported(() => window && "ResizeObserver" in window);
39
- const cleanup = () => {
40
- if (observer) {
41
- observer.disconnect();
42
- observer = void 0;
43
- }
44
- };
45
- const targets = vue.computed(() => {
46
- const _targets = vue.toValue(target);
47
- return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
48
- });
49
- const stopWatch = vue.watch(
50
- targets,
51
- (els) => {
52
- cleanup();
53
- if (isSupported.value && window) {
54
- observer = new ResizeObserver(callback);
55
- for (const _el of els) {
56
- if (_el)
57
- observer.observe(_el, observerOptions);
58
- }
59
- }
60
- },
61
- { immediate: true, flush: "post" }
62
- );
63
- const stop = () => {
64
- cleanup();
65
- stopWatch();
66
- };
67
- index.tryOnScopeDispose(stop);
68
- return {
69
- isSupported,
70
- stop
71
- };
72
- }
73
-
74
- exports.createFilterWrapper = index.createFilterWrapper;
75
- exports.debounceFilter = index.debounceFilter;
76
- exports.isClient = index.isClient;
77
- exports.noop = index.noop;
78
- exports.tryOnScopeDispose = index.tryOnScopeDispose;
79
- exports.useDebounceFn = index.useDebounceFn;
80
- exports.defaultWindow = defaultWindow;
81
- exports.unrefElement = unrefElement;
82
- exports.useMounted = useMounted;
83
- exports.useResizeObserver = useResizeObserver;
84
- exports.useSupported = useSupported;
@@ -1,83 +0,0 @@
1
- 'use strict';
2
-
3
- var vue = require('vue');
4
-
5
- function tryOnScopeDispose(fn) {
6
- if (vue.getCurrentScope()) {
7
- vue.onScopeDispose(fn);
8
- return true;
9
- }
10
- return false;
11
- }
12
-
13
- const isClient = typeof window !== "undefined" && typeof document !== "undefined";
14
- typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
15
- const noop = () => {
16
- };
17
-
18
- function createFilterWrapper(filter, fn) {
19
- function wrapper(...args) {
20
- return new Promise((resolve, reject) => {
21
- Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject);
22
- });
23
- }
24
- return wrapper;
25
- }
26
- function debounceFilter(ms, options = {}) {
27
- let timer;
28
- let maxTimer;
29
- let lastRejector = noop;
30
- const _clearTimeout = (timer2) => {
31
- clearTimeout(timer2);
32
- lastRejector();
33
- lastRejector = noop;
34
- };
35
- let lastInvoker;
36
- const filter = (invoke) => {
37
- const duration = vue.toValue(ms);
38
- const maxDuration = vue.toValue(options.maxWait);
39
- if (timer)
40
- _clearTimeout(timer);
41
- if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
42
- if (maxTimer) {
43
- _clearTimeout(maxTimer);
44
- maxTimer = void 0;
45
- }
46
- return Promise.resolve(invoke());
47
- }
48
- return new Promise((resolve, reject) => {
49
- lastRejector = options.rejectOnCancel ? reject : resolve;
50
- lastInvoker = invoke;
51
- if (maxDuration && !maxTimer) {
52
- maxTimer = setTimeout(() => {
53
- if (timer)
54
- _clearTimeout(timer);
55
- maxTimer = void 0;
56
- resolve(lastInvoker());
57
- }, maxDuration);
58
- }
59
- timer = setTimeout(() => {
60
- if (maxTimer)
61
- _clearTimeout(maxTimer);
62
- maxTimer = void 0;
63
- resolve(invoke());
64
- }, duration);
65
- });
66
- };
67
- return filter;
68
- }
69
-
70
- // @__NO_SIDE_EFFECTS__
71
- function useDebounceFn(fn, ms = 200, options = {}) {
72
- return createFilterWrapper(
73
- debounceFilter(ms, options),
74
- fn
75
- );
76
- }
77
-
78
- exports.createFilterWrapper = createFilterWrapper;
79
- exports.debounceFilter = debounceFilter;
80
- exports.isClient = isClient;
81
- exports.noop = noop;
82
- exports.tryOnScopeDispose = tryOnScopeDispose;
83
- exports.useDebounceFn = useDebounceFn;
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- function getNestedValue(obj, path, defaultValue) {
4
- if (typeof obj !== "object" || obj === null || !path) {
5
- return defaultValue;
6
- }
7
- const keys = path.split(".").filter((key) => key !== "");
8
- return keys.reduce((current, key) => {
9
- if (typeof current !== "object" || current === null) {
10
- return defaultValue;
11
- }
12
- return current[key] !== void 0 ? current[key] : defaultValue;
13
- }, obj);
14
- }
15
-
16
- exports.getNestedValue = getNestedValue;