@hlw-uni/mp-vue 1.2.2 → 1.2.21

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hlw-uni/mp-vue",
3
- "version": "1.2.2",
3
+ "version": "1.2.21",
4
4
  "description": "hlw-uni Vue 组件库 — 供小程序业务方使用的 UI 组件集合",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -11,41 +11,7 @@
11
11
  </slot>
12
12
  </view>
13
13
 
14
- <hlw-paging
15
- v-if="props.usePaging"
16
- ref="pagingRef"
17
- class="hlw-page-content hlw-page-content--paging"
18
- :model-value="props.modelValue"
19
- :fixed="false"
20
- :use-page-scroll="false"
21
- :height="'100%'"
22
- :refresher-enabled="props.refresherEnabled"
23
- :loading-more-enabled="props.loadingMoreEnabled"
24
- :default-page-size="props.defaultPageSize"
25
- :loading-text="props.loadingText"
26
- :empty-text="props.emptyText"
27
- :error-text="props.errorText"
28
- :empty-image="props.emptyImage"
29
- :use-default-loading="props.useDefaultLoading"
30
- :use-default-empty="props.useDefaultEmpty"
31
- @update:model-value="handleUpdateModelValue"
32
- @query="handleQuery"
33
- >
34
- <slot />
35
-
36
- <template v-if="$slots.loading" #loading="slotProps">
37
- <slot name="loading" :isLoadFailed="slotProps && slotProps.isLoadFailed" />
38
- </template>
39
- <template v-if="$slots.empty" #empty="slotProps">
40
- <slot name="empty" :isLoadFailed="slotProps && slotProps.isLoadFailed" />
41
- </template>
42
- <template v-if="$slots['empty-extra']" #empty-extra="slotProps">
43
- <slot name="empty-extra" :isLoadFailed="slotProps && slotProps.isLoadFailed" />
44
- </template>
45
- </hlw-paging>
46
-
47
14
  <scroll-view
48
- v-else
49
15
  class="hlw-page-content"
50
16
  :scroll-y="true"
51
17
  :enable-flex="true"
@@ -63,8 +29,6 @@
63
29
  </template>
64
30
 
65
31
  <script setup lang="ts">
66
- import { ref } from "vue";
67
- import type { HlwPagingRef } from "../hlw-paging/types";
68
32
  import { useThemePageStyle } from "../../composables/theme";
69
33
 
70
34
  defineOptions({
@@ -76,108 +40,15 @@ interface Props {
76
40
  title?: string;
77
41
  isBack?: boolean;
78
42
  bgClass?: string;
79
- usePaging?: boolean;
80
- modelValue?: any[];
81
- refresherEnabled?: boolean;
82
- loadingMoreEnabled?: boolean;
83
- defaultPageSize?: number;
84
- loadingText?: string;
85
- emptyText?: string;
86
- errorText?: string;
87
- emptyImage?: string;
88
- useDefaultLoading?: boolean;
89
- useDefaultEmpty?: boolean;
90
43
  }
91
44
 
92
45
  const props = withDefaults(defineProps<Props>(), {
93
46
  title: "",
94
47
  isBack: false,
95
48
  bgClass: "",
96
- usePaging: false,
97
- modelValue: () => [],
98
- useDefaultLoading: true,
99
- useDefaultEmpty: true,
100
49
  });
101
50
 
102
- const emit = defineEmits<{
103
- "update:modelValue": [value: any[]];
104
- query: [pageNo: number, pageSize: number, ...args: any[]];
105
- }>();
106
-
107
- const pagingRef = ref<HlwPagingRef<any> | null>(null);
108
51
  const { themePageStyle } = useThemePageStyle();
109
-
110
- function handleUpdateModelValue(value: any[]) {
111
- emit("update:modelValue", value ?? []);
112
- }
113
-
114
- function handleQuery(pageNo: number, pageSize: number, ...args: any[]) {
115
- emit("query", pageNo, pageSize, ...args);
116
- }
117
-
118
- const getPagingRef = () => pagingRef.value;
119
-
120
- const pagingMethodNames = [
121
- "reload",
122
- "refresh",
123
- "refreshToPage",
124
- "complete",
125
- "completeByTotal",
126
- "completeByNoMore",
127
- "completeByError",
128
- "completeByKey",
129
- "clear",
130
- "addDataFromTop",
131
- "resetTotalData",
132
- "endRefresh",
133
- "updateCustomRefresherHeight",
134
- "goF2",
135
- "closeF2",
136
- "doLoadMore",
137
- "updatePageScrollTop",
138
- "updatePageScrollTopHeight",
139
- "updatePageScrollBottomHeight",
140
- "updateLeftAndRightWidth",
141
- "updateFixedLayout",
142
- "doInsertVirtualListItem",
143
- "didUpdateVirtualListCell",
144
- "didDeleteVirtualListCell",
145
- "updateVirtualListRender",
146
- "setLocalPaging",
147
- "doChatRecordLoadMore",
148
- "addChatRecordData",
149
- "addKeyboardHeightChangeListener",
150
- "scrollToTop",
151
- "scrollToBottom",
152
- "scrollIntoViewById",
153
- "scrollIntoViewByNodeTop",
154
- "scrollToY",
155
- "scrollToX",
156
- "scrollIntoViewByIndex",
157
- "scrollIntoViewByView",
158
- "setSpecialEffects",
159
- "setListSpecialEffects",
160
- "updateCache",
161
- "getVersion",
162
- ] as const;
163
-
164
- type PagingMethodName = (typeof pagingMethodNames)[number];
165
-
166
- const exposed = pagingMethodNames.reduce((result, methodName) => {
167
- result[methodName] = (...args: any[]) => {
168
- return pagingRef.value?.[methodName]?.(...args);
169
- };
170
-
171
- return result;
172
- }, {
173
- pagingRef,
174
- getPagingRef,
175
- } as Record<string, any>);
176
-
177
- defineExpose(exposed as {
178
- pagingRef: typeof pagingRef;
179
- getPagingRef: () => HlwPagingRef<any> | null;
180
- } & Record<PagingMethodName, (...args: any[]) => any>);
181
52
  </script>
182
53
 
183
54
  <style lang="scss" scoped>
@@ -201,10 +72,6 @@ defineExpose(exposed as {
201
72
  width: 100%;
202
73
  }
203
74
 
204
- .hlw-page-content--paging {
205
- min-height: 0;
206
- }
207
-
208
75
  .hlw-page-footer {
209
76
  flex-shrink: 0;
210
77
  }