@hlw-uni/mp-vue 1.0.3 → 1.0.5

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.
@@ -6,5 +6,3 @@ export interface MenuItem {
6
6
  url?: string;
7
7
  action?: () => void;
8
8
  }
9
- declare const _default: any;
10
- export default _default;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,11 @@
2
2
  * @hlw-uni/mp-vue — Vue 组件库统一导出
3
3
  */
4
4
  export { default as HlwAd } from './components/hlw-ad/index.vue';
5
- export { default as HlwAvatar } from './components/hlw-avatar/index';
6
- export { default as HlwEmpty } from './components/hlw-empty/index';
7
- export { default as HlwLoading } from './components/hlw-loading/index';
8
- export { default as HlwMenuList, type MenuItem } from './components/hlw-menu-list/index';
5
+ export { default as HlwAvatar } from './components/hlw-avatar/index.vue';
6
+ export { default as HlwCard } from './components/hlw-card/index.vue';
7
+ export { default as HlwEmpty } from './components/hlw-empty/index.vue';
8
+ export { default as HlwHeader } from './components/hlw-header/index.vue';
9
+ export { default as HlwLoading } from './components/hlw-loading/index.vue';
10
+ export { default as HlwMenuList } from './components/hlw-menu-list/index.vue';
11
+ export { default as HlwPage } from './components/hlw-page/index.vue';
12
+ export type { MenuItem } from './components/hlw-menu-list/types';
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.HlwUniVue = {}, global.vue));
3
3
  })(this, function(exports2, vue) {
4
4
  "use strict";
5
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
5
+ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
6
6
  ...{ name: "HlwAd" },
7
7
  __name: "index",
8
8
  props: {
@@ -33,114 +33,265 @@
33
33
  };
34
34
  }
35
35
  });
36
- const index$3 = vue.defineComponent({
37
- name: "Avatar",
36
+ const _hoisted_1$6 = ["src"];
37
+ const _hoisted_2$6 = {
38
+ key: 1,
39
+ class: "hlw-avatar__placeholder"
40
+ };
41
+ const _hoisted_3$4 = { class: "hlw-avatar__initial" };
42
+ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
43
+ __name: "index",
38
44
  props: {
39
- src: { type: String },
40
- name: { type: String },
41
- size: { type: String, default: "medium" }
45
+ src: {},
46
+ name: {},
47
+ size: {}
42
48
  },
43
- setup(props) {
49
+ setup(__props) {
50
+ const props = __props;
44
51
  const loadError = vue.ref(false);
45
52
  const initial = vue.computed(() => {
46
53
  if (!props.name)
47
54
  return "?";
48
55
  return props.name.charAt(0).toUpperCase();
49
56
  });
50
- function onError() {
51
- loadError.value = true;
57
+ return (_ctx, _cache) => {
58
+ return vue.openBlock(), vue.createElementBlock("view", {
59
+ class: vue.normalizeClass(`hlw-avatar hlw-avatar--${__props.size ?? "medium"}`)
60
+ }, [
61
+ __props.src && !loadError.value ? (vue.openBlock(), vue.createElementBlock("image", {
62
+ key: 0,
63
+ class: "hlw-avatar__image",
64
+ src: __props.src,
65
+ mode: "aspectFill",
66
+ onError: _cache[0] || (_cache[0] = ($event) => loadError.value = true)
67
+ }, null, 40, _hoisted_1$6)) : (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$6, [
68
+ vue.createElementVNode("text", _hoisted_3$4, vue.toDisplayString(initial.value), 1)
69
+ ]))
70
+ ], 2);
71
+ };
72
+ }
73
+ });
74
+ const _export_sfc = (sfc, props) => {
75
+ const target = sfc.__vccOpts || sfc;
76
+ for (const [key, val] of props) {
77
+ target[key] = val;
78
+ }
79
+ return target;
80
+ };
81
+ const index$6 = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-7e8f98a5"]]);
82
+ const _hoisted_1$5 = { class: "hlw-card" };
83
+ const _hoisted_2$5 = {
84
+ key: 0,
85
+ class: "hlw-card-header"
86
+ };
87
+ const _hoisted_3$3 = { class: "flex items-center justify-between px-5 py-4 border-0 border-b border-dashed border-slate-200 bg-slate-50/30" };
88
+ const _hoisted_4$2 = { key: 0 };
89
+ const _hoisted_5$1 = { class: "text-sm font-bold text-slate-800 flex items-center gap-2 tracking-wide" };
90
+ const _hoisted_6$1 = { key: 1 };
91
+ const _hoisted_7$1 = {
92
+ key: 0,
93
+ class: "text-[10px] text-slate-400 bg-slate-50 px-2 py-1 rounded border border-slate-100 tracking-wide"
94
+ };
95
+ const _hoisted_8 = { class: "hlw-card-body" };
96
+ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
97
+ ...{
98
+ options: {
99
+ styleIsolation: "shared",
100
+ virtualHost: true
52
101
  }
53
- return () => {
54
- const sizeClass = `hlw-avatar--${props.size}`;
55
- return (
56
- // @ts-ignore - uni app nodes
57
- h("view", { class: `hlw-avatar ${sizeClass}` }, [
58
- props.src && !loadError.value ? (
59
- // @ts-ignore
60
- h("image", {
61
- class: "hlw-avatar__image",
62
- src: props.src,
63
- mode: "aspectFill",
64
- onError
65
- })
66
- ) : (
67
- // @ts-ignore
68
- h("view", { class: "hlw-avatar__placeholder" }, [
69
- // @ts-ignore
70
- h("text", { class: "hlw-avatar__initial" }, initial.value)
102
+ },
103
+ __name: "index",
104
+ props: {
105
+ title: { default: "" },
106
+ icon: { default: "" },
107
+ iconColor: { default: "" },
108
+ extra: { default: "" }
109
+ },
110
+ setup(__props) {
111
+ return (_ctx, _cache) => {
112
+ return vue.openBlock(), vue.createElementBlock("view", _hoisted_1$5, [
113
+ _ctx.$slots.header || __props.title || __props.icon || _ctx.$slots["header-left"] || _ctx.$slots["header-right"] ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$5, [
114
+ vue.renderSlot(_ctx.$slots, "header", {}, () => [
115
+ vue.createElementVNode("view", _hoisted_3$3, [
116
+ _ctx.$slots["header-left"] || __props.title || __props.icon ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_4$2, [
117
+ vue.renderSlot(_ctx.$slots, "header-left", {}, () => [
118
+ vue.createElementVNode("view", _hoisted_5$1, [
119
+ __props.icon ? (vue.openBlock(), vue.createElementBlock("text", {
120
+ key: 0,
121
+ class: vue.normalizeClass([__props.icon, __props.iconColor])
122
+ }, null, 2)) : vue.createCommentVNode("", true),
123
+ vue.createElementVNode("text", null, vue.toDisplayString(__props.title), 1)
124
+ ])
125
+ ], true)
126
+ ])) : vue.createCommentVNode("", true),
127
+ _ctx.$slots["header-right"] || __props.extra ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_6$1, [
128
+ vue.renderSlot(_ctx.$slots, "header-right", {}, () => [
129
+ __props.extra ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_7$1, vue.toDisplayString(__props.extra), 1)) : vue.createCommentVNode("", true)
130
+ ], true)
131
+ ])) : vue.createCommentVNode("", true)
71
132
  ])
72
- )
133
+ ], true)
134
+ ])) : vue.createCommentVNode("", true),
135
+ vue.createElementVNode("view", _hoisted_8, [
136
+ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
73
137
  ])
74
- );
138
+ ]);
75
139
  };
76
140
  }
77
141
  });
78
- const index$2 = vue.defineComponent({
79
- name: "Empty",
142
+ const index$5 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-787fc3a7"]]);
143
+ const _hoisted_1$4 = { class: "hlw-empty" };
144
+ const _hoisted_2$4 = ["src"];
145
+ const _hoisted_3$2 = {
146
+ key: 1,
147
+ class: "hlw-empty__icon"
148
+ };
149
+ const _hoisted_4$1 = { class: "hlw-empty__text" };
150
+ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
151
+ __name: "index",
80
152
  props: {
81
- text: { type: String },
82
- image: { type: String }
153
+ text: {},
154
+ image: {}
83
155
  },
84
- setup(props) {
85
- const slots = vue.useSlots();
86
- return () => {
156
+ setup(__props) {
157
+ return (_ctx, _cache) => {
158
+ return vue.openBlock(), vue.createElementBlock("view", _hoisted_1$4, [
159
+ __props.image ? (vue.openBlock(), vue.createElementBlock("image", {
160
+ key: 0,
161
+ class: "hlw-empty__image",
162
+ src: __props.image,
163
+ mode: "aspectFit"
164
+ }, null, 8, _hoisted_2$4)) : (vue.openBlock(), vue.createElementBlock("text", _hoisted_3$2, "📦")),
165
+ vue.createElementVNode("text", _hoisted_4$1, vue.toDisplayString(__props.text || "暂无数据"), 1),
166
+ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
167
+ ]);
168
+ };
169
+ }
170
+ });
171
+ const index$4 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-72364322"]]);
172
+ const _hoisted_1$3 = { class: "header-title" };
173
+ const _hoisted_2$3 = {
174
+ key: 0,
175
+ class: "header-title"
176
+ };
177
+ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
178
+ __name: "index",
179
+ props: {
180
+ extraHeight: { default: 0 },
181
+ bgClass: { default: "" },
182
+ isBack: { type: Boolean, default: false },
183
+ title: { default: "" }
184
+ },
185
+ emits: ["back"],
186
+ setup(__props, { emit: __emit }) {
187
+ const getNavBarContentHeight = () => {
87
188
  var _a;
88
- return (
89
- // @ts-ignore
90
- h("view", { class: "hlw-empty" }, [
91
- props.image ? (
92
- // @ts-ignore
93
- h("image", { class: "hlw-empty__image", src: props.image, mode: "aspectFit" })
94
- ) : (
95
- // @ts-ignore
96
- h("view", { class: "hlw-empty__icon" }, [
97
- // @ts-ignore
98
- h("text", "📦")
99
- ])
100
- ),
101
- // @ts-ignore
102
- h("text", { class: "hlw-empty__text" }, props.text || "暂无数据"),
103
- (_a = slots.default) == null ? void 0 : _a.call(slots)
104
- ])
105
- );
189
+ try {
190
+ const menuInfo = (_a = uni.getMenuButtonBoundingClientRect) == null ? void 0 : _a.call(uni);
191
+ if (!menuInfo)
192
+ return 44;
193
+ const systemInfo = uni.getSystemInfoSync();
194
+ return (menuInfo.top - systemInfo.statusBarHeight) * 2 + menuInfo.height;
195
+ } catch {
196
+ return 44;
197
+ }
198
+ };
199
+ const getStatusBarHeight = () => {
200
+ try {
201
+ const systemInfo = uni.getSystemInfoSync();
202
+ return systemInfo.statusBarHeight || 20;
203
+ } catch {
204
+ return 20;
205
+ }
206
+ };
207
+ const NAV_BAR_CONTENT_HEIGHT = getNavBarContentHeight();
208
+ const props = __props;
209
+ const emit = __emit;
210
+ const handleBack = () => {
211
+ emit("back");
212
+ uni.navigateBack({ delta: 1 });
213
+ };
214
+ const slots = vue.useSlots();
215
+ const hasBgSlot = vue.computed(() => !props.isBack && !!slots.bg);
216
+ const statusBarHeight = vue.ref(getStatusBarHeight());
217
+ const totalNavBarHeight = vue.computed(() => statusBarHeight.value + NAV_BAR_CONTENT_HEIGHT + props.extraHeight);
218
+ return (_ctx, _cache) => {
219
+ return vue.openBlock(), vue.createElementBlock("view", {
220
+ class: "hlw-header",
221
+ style: vue.normalizeStyle({ height: totalNavBarHeight.value + "px" })
222
+ }, [
223
+ vue.createElementVNode("view", {
224
+ class: vue.normalizeClass(["header-bg-layer", hasBgSlot.value ? "" : props.bgClass])
225
+ }, [
226
+ !props.isBack ? vue.renderSlot(_ctx.$slots, "bg", { key: 0 }, void 0, true) : vue.createCommentVNode("", true)
227
+ ], 2),
228
+ vue.createElementVNode("view", {
229
+ class: "status-bar-spacer",
230
+ style: vue.normalizeStyle({ height: statusBarHeight.value + "px" })
231
+ }, null, 4),
232
+ vue.createElementVNode("view", {
233
+ class: "header-content-area",
234
+ style: vue.normalizeStyle({ height: vue.unref(NAV_BAR_CONTENT_HEIGHT) + "px" })
235
+ }, [
236
+ props.isBack ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
237
+ vue.createElementVNode("view", {
238
+ class: "header-back",
239
+ onClick: handleBack
240
+ }, [..._cache[0] || (_cache[0] = [
241
+ vue.createElementVNode("text", { class: "iconfont icon-back" }, null, -1)
242
+ ])]),
243
+ vue.createElementVNode("view", _hoisted_1$3, vue.toDisplayString(props.title), 1),
244
+ _cache[1] || (_cache[1] = vue.createElementVNode("view", { class: "header-placeholder" }, null, -1))
245
+ ], 64)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }, () => [
246
+ props.title ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$3, vue.toDisplayString(props.title), 1)) : vue.createCommentVNode("", true)
247
+ ], true)
248
+ ], 4)
249
+ ], 4);
106
250
  };
107
251
  }
108
252
  });
109
- const index$1 = vue.defineComponent({
110
- name: "Loading",
253
+ const index$3 = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-e6af34e4"]]);
254
+ const _hoisted_1$2 = { class: "hlw-loading" };
255
+ const _hoisted_2$2 = {
256
+ key: 0,
257
+ class: "hlw-loading__text"
258
+ };
259
+ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
260
+ __name: "index",
111
261
  props: {
112
- text: { type: String }
262
+ text: {}
113
263
  },
114
- setup(props) {
115
- return () => {
116
- const dots = Array.from(
117
- { length: 12 },
118
- (_, i) => (
119
- // @ts-ignore
120
- h("view", { key: i + 1, class: "hlw-loading__dot" })
121
- )
122
- );
123
- return (
124
- // @ts-ignore
125
- h("view", { class: "hlw-loading" }, [
126
- // @ts-ignore
127
- h("view", { class: "hlw-loading__spinner" }, dots),
128
- props.text ? (
129
- // @ts-ignore
130
- h("text", { class: "hlw-loading__text" }, props.text)
131
- ) : null
132
- ])
133
- );
264
+ setup(__props) {
265
+ return (_ctx, _cache) => {
266
+ return vue.openBlock(), vue.createElementBlock("view", _hoisted_1$2, [
267
+ _cache[0] || (_cache[0] = vue.createElementVNode("view", { class: "hlw-loading__spinner" }, null, -1)),
268
+ __props.text ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_2$2, vue.toDisplayString(__props.text), 1)) : vue.createCommentVNode("", true)
269
+ ]);
134
270
  };
135
271
  }
136
272
  });
137
- const index = vue.defineComponent({
138
- name: "MenuList",
273
+ const index$2 = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-14242381"]]);
274
+ const _hoisted_1$1 = { class: "hlw-menu-list" };
275
+ const _hoisted_2$1 = ["onTap"];
276
+ const _hoisted_3$1 = { class: "hlw-menu-list__left" };
277
+ const _hoisted_4 = {
278
+ key: 0,
279
+ class: "hlw-menu-list__icon"
280
+ };
281
+ const _hoisted_5 = { class: "hlw-menu-list__label" };
282
+ const _hoisted_6 = { class: "hlw-menu-list__right" };
283
+ const _hoisted_7 = {
284
+ key: 0,
285
+ class: "hlw-menu-list__value"
286
+ };
287
+ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
288
+ __name: "index",
139
289
  props: {
140
- items: { type: Array, required: true }
290
+ items: {}
141
291
  },
142
292
  emits: ["click"],
143
- setup(props, { emit }) {
293
+ setup(__props, { emit: __emit }) {
294
+ const emit = __emit;
144
295
  function onTap(item) {
145
296
  if (item.url) {
146
297
  uni.navigateTo({ url: item.url });
@@ -149,44 +300,81 @@
149
300
  }
150
301
  emit("click", item);
151
302
  }
152
- return () => {
153
- const items = props.items.map(
154
- (item) => (
155
- // @ts-ignore
156
- h("view", {
157
- class: "hlw-menu-list__item",
303
+ return (_ctx, _cache) => {
304
+ return vue.openBlock(), vue.createElementBlock("view", _hoisted_1$1, [
305
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.items, (item) => {
306
+ return vue.openBlock(), vue.createElementBlock("view", {
158
307
  key: item.key,
159
- onClick: () => onTap(item)
308
+ class: "hlw-menu-list__item",
309
+ onTap: ($event) => onTap(item)
160
310
  }, [
161
- // @ts-ignore
162
- h("view", { class: "hlw-menu-list__left" }, [
163
- item.icon ? (
164
- // @ts-ignore
165
- h("text", { class: "hlw-menu-list__icon" }, item.icon)
166
- ) : null,
167
- // @ts-ignore
168
- h("text", { class: "hlw-menu-list__label" }, item.label)
311
+ vue.createElementVNode("view", _hoisted_3$1, [
312
+ item.icon ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_4, vue.toDisplayString(item.icon), 1)) : vue.createCommentVNode("", true),
313
+ vue.createElementVNode("text", _hoisted_5, vue.toDisplayString(item.label), 1)
169
314
  ]),
170
- // @ts-ignore
171
- h("view", { class: "hlw-menu-list__right" }, [
172
- item.value ? (
173
- // @ts-ignore
174
- h("text", { class: "hlw-menu-list__value" }, item.value)
175
- ) : null,
176
- // @ts-ignore
177
- h("text", { class: "hlw-menu-list__arrow" }, "›")
315
+ vue.createElementVNode("view", _hoisted_6, [
316
+ item.value ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_7, vue.toDisplayString(item.value), 1)) : vue.createCommentVNode("", true),
317
+ _cache[0] || (_cache[0] = vue.createElementVNode("text", { class: "hlw-menu-list__arrow" }, "›", -1))
178
318
  ])
179
- ])
180
- )
181
- );
182
- return h("view", { class: "hlw-menu-list" }, items);
319
+ ], 40, _hoisted_2$1);
320
+ }), 128))
321
+ ]);
322
+ };
323
+ }
324
+ });
325
+ const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e465b0b4"]]);
326
+ const _hoisted_1 = { class: "hlw-page" };
327
+ const _hoisted_2 = { class: "hlw-page-header" };
328
+ const _hoisted_3 = { class: "hlw-page-footer" };
329
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
330
+ __name: "index",
331
+ props: {
332
+ title: { default: "" },
333
+ isBack: { type: Boolean, default: false },
334
+ bgClass: { default: "" }
335
+ },
336
+ setup(__props) {
337
+ return (_ctx, _cache) => {
338
+ const _component_hlw_header = vue.resolveComponent("hlw-header");
339
+ const _component_scroll_view = vue.resolveComponent("scroll-view");
340
+ return vue.openBlock(), vue.createElementBlock("view", _hoisted_1, [
341
+ vue.createElementVNode("view", _hoisted_2, [
342
+ vue.renderSlot(_ctx.$slots, "header", {}, () => [
343
+ __props.title || __props.isBack ? (vue.openBlock(), vue.createBlock(_component_hlw_header, {
344
+ key: 0,
345
+ title: __props.title,
346
+ "is-back": __props.isBack,
347
+ "bg-class": __props.bgClass
348
+ }, null, 8, ["title", "is-back", "bg-class"])) : vue.createCommentVNode("", true)
349
+ ], true)
350
+ ]),
351
+ vue.createVNode(_component_scroll_view, {
352
+ class: "hlw-page-content",
353
+ "scroll-y": true,
354
+ "enable-flex": true,
355
+ enhanced: true,
356
+ "show-scrollbar": true
357
+ }, {
358
+ default: vue.withCtx(() => [
359
+ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
360
+ ]),
361
+ _: 3
362
+ }),
363
+ vue.createElementVNode("view", _hoisted_3, [
364
+ vue.renderSlot(_ctx.$slots, "footer", {}, void 0, true)
365
+ ])
366
+ ]);
183
367
  };
184
368
  }
185
369
  });
186
- exports2.HlwAd = _sfc_main;
187
- exports2.HlwAvatar = index$3;
188
- exports2.HlwEmpty = index$2;
189
- exports2.HlwLoading = index$1;
190
- exports2.HlwMenuList = index;
370
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-155bc02a"]]);
371
+ exports2.HlwAd = _sfc_main$7;
372
+ exports2.HlwAvatar = index$6;
373
+ exports2.HlwCard = index$5;
374
+ exports2.HlwEmpty = index$4;
375
+ exports2.HlwHeader = index$3;
376
+ exports2.HlwLoading = index$2;
377
+ exports2.HlwMenuList = index$1;
378
+ exports2.HlwPage = index;
191
379
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
192
380
  });