hzzt-plus 2.0.4 → 2.0.6

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 (68) hide show
  1. package/dist/index.full.js +19 -13
  2. package/dist/index.full.min.js +11 -11
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +11 -11
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +19 -13
  7. package/dist/locale/en.js +1 -1
  8. package/dist/locale/en.min.js +1 -1
  9. package/dist/locale/en.min.mjs +1 -1
  10. package/dist/locale/en.mjs +1 -1
  11. package/dist/locale/zh-cn.js +1 -1
  12. package/dist/locale/zh-cn.min.js +1 -1
  13. package/dist/locale/zh-cn.min.mjs +1 -1
  14. package/dist/locale/zh-cn.mjs +1 -1
  15. package/es/components/collapse/index.mjs +2 -2
  16. package/es/components/collapse/src/collapse.mjs +88 -0
  17. package/es/components/collapse/src/collapse.mjs.map +1 -1
  18. package/es/components/collapse/src/collapse2.mjs +0 -88
  19. package/es/components/collapse/src/collapse2.mjs.map +1 -1
  20. package/es/components/index.mjs +1 -1
  21. package/es/components/lazy-list/index.mjs +2 -2
  22. package/es/components/lazy-list/src/lazy-list.mjs +22 -80
  23. package/es/components/lazy-list/src/lazy-list.mjs.map +1 -1
  24. package/es/components/lazy-list/src/lazy-list2.mjs +80 -22
  25. package/es/components/lazy-list/src/lazy-list2.mjs.map +1 -1
  26. package/es/components/scroll/index.mjs +2 -2
  27. package/es/components/scroll/src/scroll.mjs +0 -90
  28. package/es/components/scroll/src/scroll.mjs.map +1 -1
  29. package/es/components/scroll/src/scroll2.mjs +90 -0
  30. package/es/components/scroll/src/scroll2.mjs.map +1 -1
  31. package/es/components/select/src/select2.mjs +7 -2
  32. package/es/components/select/src/select2.mjs.map +1 -1
  33. package/es/components/tab/index.d.ts +2 -0
  34. package/es/components/tab/src/index.mjs +10 -9
  35. package/es/components/tab/src/index.mjs.map +1 -1
  36. package/es/components/tab/src/index.vue.d.ts +2 -0
  37. package/es/index.mjs +1 -1
  38. package/es/version.d.ts +1 -1
  39. package/es/version.mjs +1 -1
  40. package/es/version.mjs.map +1 -1
  41. package/lib/components/collapse/index.js +2 -2
  42. package/lib/components/collapse/src/collapse.js +91 -0
  43. package/lib/components/collapse/src/collapse.js.map +1 -1
  44. package/lib/components/collapse/src/collapse2.js +0 -91
  45. package/lib/components/collapse/src/collapse2.js.map +1 -1
  46. package/lib/components/index.js +1 -1
  47. package/lib/components/lazy-list/index.js +2 -2
  48. package/lib/components/lazy-list/src/lazy-list.js +23 -80
  49. package/lib/components/lazy-list/src/lazy-list.js.map +1 -1
  50. package/lib/components/lazy-list/src/lazy-list2.js +80 -23
  51. package/lib/components/lazy-list/src/lazy-list2.js.map +1 -1
  52. package/lib/components/scroll/index.js +2 -2
  53. package/lib/components/scroll/src/scroll.js +0 -93
  54. package/lib/components/scroll/src/scroll.js.map +1 -1
  55. package/lib/components/scroll/src/scroll2.js +93 -0
  56. package/lib/components/scroll/src/scroll2.js.map +1 -1
  57. package/lib/components/select/src/select2.js +6 -1
  58. package/lib/components/select/src/select2.js.map +1 -1
  59. package/lib/components/tab/index.d.ts +2 -0
  60. package/lib/components/tab/src/index.js +9 -8
  61. package/lib/components/tab/src/index.js.map +1 -1
  62. package/lib/components/tab/src/index.vue.d.ts +2 -0
  63. package/lib/index.js +1 -1
  64. package/lib/version.d.ts +1 -1
  65. package/lib/version.js +1 -1
  66. package/lib/version.js.map +1 -1
  67. package/package.json +1 -1
  68. package/web-types.json +1 -1
@@ -1,4 +1,4 @@
1
- /*! Hzzt Plus v2.0.4 */
1
+ /*! Hzzt Plus v2.0.6 */
2
2
 
3
3
  import { getCurrentScope, onScopeDispose, unref, getCurrentInstance, onMounted, nextTick, readonly, shallowRef, watchEffect, watch, ref, computed, defineComponent, openBlock, createElementBlock, createElementVNode, warn, isRef, inject, provide, renderSlot, mergeProps, toRef, onUnmounted, useAttrs as useAttrs$1, useSlots, normalizeClass, normalizeStyle, createCommentVNode, Fragment, createBlock, withCtx, resolveDynamicComponent, withModifiers, createVNode, toDisplayString, onBeforeUnmount, Transition, withDirectives, vShow, reactive, onActivated, onUpdated, cloneVNode, Text, Comment, Teleport as Teleport$1, onBeforeMount, onDeactivated, toRaw, vModelCheckbox, createTextVNode, toRefs, vModelRadio, h, resolveComponent, renderList, onBeforeUpdate, withKeys, vModelText, createSlots, resolveDirective, toHandlerKey, normalizeProps, guardReactiveProps } from 'vue';
4
4
 
@@ -12961,7 +12961,7 @@ var ConfigProvider$1 = ConfigProvider;
12961
12961
 
12962
12962
  const HzztConfigProvider = withInstall$1(ConfigProvider$1);
12963
12963
 
12964
- const version$1 = "2.0.4";
12964
+ const version$1 = "2.0.6";
12965
12965
 
12966
12966
  const makeInstaller = (components = []) => {
12967
12967
  const install = (app, options) => {
@@ -25750,7 +25750,7 @@ const _hoisted_3$8 = /* @__PURE__ */ createElementVNode("span", { class: "caret"
25750
25750
  const _hoisted_4$7 = { class: "hzzt-dropdown-menu" };
25751
25751
  const _hoisted_5$4 = ["onClick"];
25752
25752
  const _hoisted_6$3 = { class: "submenu" };
25753
- const _hoisted_7$3 = ["onClick"];
25753
+ const _hoisted_7$2 = ["onClick"];
25754
25754
  const __default__$h = defineComponent({
25755
25755
  name: "HzztDropDown"
25756
25756
  });
@@ -25845,7 +25845,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
25845
25845
  createElementVNode("a", {
25846
25846
  class: "hzzt-dropdown-menu-item-label",
25847
25847
  onClick: ($event) => selectValue([option[__props.props.value], child[__props.props.value]])
25848
- }, toDisplayString(child[__props.props.label]), 9, _hoisted_7$3)
25848
+ }, toDisplayString(child[__props.props.label]), 9, _hoisted_7$2)
25849
25849
  ], 2);
25850
25850
  }), 128))
25851
25851
  ], 2)
@@ -25985,11 +25985,7 @@ const _hoisted_2$9 = { class: "flex align-items-center" };
25985
25985
  const _hoisted_3$6 = { class: "flex" };
25986
25986
  const _hoisted_4$5 = ["onClick"];
25987
25987
  const _hoisted_5$2 = { class: "hzzt-tab-badge" };
25988
- const _hoisted_6$2 = {
25989
- key: 0,
25990
- class: "hzzt-tab-badge-count"
25991
- };
25992
- const _hoisted_7$2 = { class: "flex wrap" };
25988
+ const _hoisted_6$2 = { class: "flex wrap" };
25993
25989
  const __default__$f = defineComponent({
25994
25990
  name: "HzztTab"
25995
25991
  });
@@ -26017,7 +26013,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
26017
26013
  key: `${tab.name}-${tab.number}`,
26018
26014
  ...tab,
26019
26015
  number: Number(tab.number || 0),
26020
- hide: tab.hide
26016
+ hide: tab.hide,
26017
+ bgColor: tab.bgColor || ""
26021
26018
  };
26022
26019
  }).filter((tab) => !tab.hide));
26023
26020
  function tabClick(tab, event) {
@@ -26044,7 +26041,11 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
26044
26041
  createElementVNode("p", {
26045
26042
  class: normalizeClass([{ active: __props.modelValue === tab.name }, "hzzt-tab-badge-text"])
26046
26043
  }, toDisplayString(tab.label), 3),
26047
- tab.number && tab.number !== 0 ? (openBlock(), createElementBlock("p", _hoisted_6$2, toDisplayString(tab.number > 999 ? "999+" : tab.number), 1)) : createCommentVNode("v-if", true),
26044
+ tab.number && tab.number !== 0 ? (openBlock(), createElementBlock("p", {
26045
+ key: 0,
26046
+ class: "hzzt-tab-badge-count",
26047
+ style: normalizeStyle({ backgroundColor: tab.bgColor })
26048
+ }, toDisplayString(tab.number > 999 ? "999+" : tab.number), 5)) : createCommentVNode("v-if", true),
26048
26049
  __props.closable ? (openBlock(), createBlock(HzztIcon$1, {
26049
26050
  key: 1,
26050
26051
  class: "is-icon-close",
@@ -26058,7 +26059,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
26058
26059
  renderSlot(_ctx.$slots, "filter"),
26059
26060
  renderSlot(_ctx.$slots, "extra")
26060
26061
  ]),
26061
- createElementVNode("div", _hoisted_7$2, [
26062
+ createElementVNode("div", _hoisted_6$2, [
26062
26063
  renderSlot(_ctx.$slots, "right")
26063
26064
  ])
26064
26065
  ]);
@@ -27999,7 +28000,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
27999
28000
  }, unref(_selectProps), {
28000
28001
  onChange: selectChange,
28001
28002
  onVisibleChange: selectVisibleChange
28002
- }), null, 16, ["class", "modelValue"])) : createCommentVNode("v-if", true)
28003
+ }), {
28004
+ default: withCtx(({ item }) => [
28005
+ renderSlot(_ctx.$slots, "default", { item })
28006
+ ]),
28007
+ _: 3
28008
+ }, 16, ["class", "modelValue"])) : createCommentVNode("v-if", true)
28003
28009
  ], 6);
28004
28010
  };
28005
28011
  }
package/dist/locale/en.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Hzzt Plus v2.0.4 */
1
+ /*! Hzzt Plus v2.0.6 */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -1,2 +1,2 @@
1
- /*! Hzzt Plus v2.0.4 */(function(e,r){typeof exports=="object"&&typeof module!="undefined"?module.exports=r():typeof define=="function"&&define.amd?define(r):(e=typeof globalThis!="undefined"?globalThis:e||self,e.HzztPlusLocaleEn=r())})(this,function(){"use strict";var e={name:"en",hzzt:{collapse:{expand:"expand",retract:"retract"},pagination:{total:"",strip:""},pageSize:{total:"Total ",strip:"",page:"page",d:"",per_page:"per page"},quarterpicker:{prevYear:"Previous Year",nextYear:"Next Year",year:"",firstQuarter:"First quarter",secondQuarter:"Second quarter",thirdQuarter:"Third quarter",fourthQuarter:"Fourth quarter"}}};return e});
1
+ /*! Hzzt Plus v2.0.6 */(function(e,r){typeof exports=="object"&&typeof module!="undefined"?module.exports=r():typeof define=="function"&&define.amd?define(r):(e=typeof globalThis!="undefined"?globalThis:e||self,e.HzztPlusLocaleEn=r())})(this,function(){"use strict";var e={name:"en",hzzt:{collapse:{expand:"expand",retract:"retract"},pagination:{total:"",strip:""},pageSize:{total:"Total ",strip:"",page:"page",d:"",per_page:"per page"},quarterpicker:{prevYear:"Previous Year",nextYear:"Next Year",year:"",firstQuarter:"First quarter",secondQuarter:"Second quarter",thirdQuarter:"Third quarter",fourthQuarter:"Fourth quarter"}}};return e});
2
2
  //# sourceMappingURL=en.min.js.map
@@ -1,2 +1,2 @@
1
- /*! Hzzt Plus v2.0.4 */var r={name:"en",hzzt:{collapse:{expand:"expand",retract:"retract"},pagination:{total:"",strip:""},pageSize:{total:"Total ",strip:"",page:"page",d:"",per_page:"per page"},quarterpicker:{prevYear:"Previous Year",nextYear:"Next Year",year:"",firstQuarter:"First quarter",secondQuarter:"Second quarter",thirdQuarter:"Third quarter",fourthQuarter:"Fourth quarter"}}};export{r as default};
1
+ /*! Hzzt Plus v2.0.6 */var r={name:"en",hzzt:{collapse:{expand:"expand",retract:"retract"},pagination:{total:"",strip:""},pageSize:{total:"Total ",strip:"",page:"page",d:"",per_page:"per page"},quarterpicker:{prevYear:"Previous Year",nextYear:"Next Year",year:"",firstQuarter:"First quarter",secondQuarter:"Second quarter",thirdQuarter:"Third quarter",fourthQuarter:"Fourth quarter"}}};export{r as default};
2
2
  //# sourceMappingURL=en.min.mjs.map
@@ -1,4 +1,4 @@
1
- /*! Hzzt Plus v2.0.4 */
1
+ /*! Hzzt Plus v2.0.6 */
2
2
 
3
3
  var en = {
4
4
  name: "en",
@@ -1,4 +1,4 @@
1
- /*! Hzzt Plus v2.0.4 */
1
+ /*! Hzzt Plus v2.0.6 */
2
2
 
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -1,2 +1,2 @@
1
- /*! Hzzt Plus v2.0.4 */(function(u,e){typeof exports=="object"&&typeof module!="undefined"?module.exports=e():typeof define=="function"&&define.amd?define(e):(u=typeof globalThis!="undefined"?globalThis:u||self,u.HzztPlusLocaleZhCn=e())})(this,function(){"use strict";var u={name:"zh-cn",hzzt:{collapse:{expand:"\u5C55\u5F00",retract:"\u6536\u8D77"},pagination:{total:"\u5171",strip:"\u6761"},pageSize:{total:"\u5171",strip:"\u6761",d:"\u7B2C",page:"\u9875",per_page:"\u6BCF\u9875"},quarterpicker:{prevYear:"\u524D\u4E00\u5E74",nextYear:"\u540E\u4E00\u5E74",year:"\u5E74",firstQuarter:"\u7B2C\u4E00\u5B63\u5EA6",secondQuarter:"\u7B2C\u4E8C\u5B63\u5EA6",thirdQuarter:"\u7B2C\u4E09\u5B63\u5EA6",fourthQuarter:"\u7B2C\u56DB\u5B63\u5EA6"}}};return u});
1
+ /*! Hzzt Plus v2.0.6 */(function(u,e){typeof exports=="object"&&typeof module!="undefined"?module.exports=e():typeof define=="function"&&define.amd?define(e):(u=typeof globalThis!="undefined"?globalThis:u||self,u.HzztPlusLocaleZhCn=e())})(this,function(){"use strict";var u={name:"zh-cn",hzzt:{collapse:{expand:"\u5C55\u5F00",retract:"\u6536\u8D77"},pagination:{total:"\u5171",strip:"\u6761"},pageSize:{total:"\u5171",strip:"\u6761",d:"\u7B2C",page:"\u9875",per_page:"\u6BCF\u9875"},quarterpicker:{prevYear:"\u524D\u4E00\u5E74",nextYear:"\u540E\u4E00\u5E74",year:"\u5E74",firstQuarter:"\u7B2C\u4E00\u5B63\u5EA6",secondQuarter:"\u7B2C\u4E8C\u5B63\u5EA6",thirdQuarter:"\u7B2C\u4E09\u5B63\u5EA6",fourthQuarter:"\u7B2C\u56DB\u5B63\u5EA6"}}};return u});
2
2
  //# sourceMappingURL=zh-cn.min.js.map
@@ -1,2 +1,2 @@
1
- /*! Hzzt Plus v2.0.4 */var u={name:"zh-cn",hzzt:{collapse:{expand:"\u5C55\u5F00",retract:"\u6536\u8D77"},pagination:{total:"\u5171",strip:"\u6761"},pageSize:{total:"\u5171",strip:"\u6761",d:"\u7B2C",page:"\u9875",per_page:"\u6BCF\u9875"},quarterpicker:{prevYear:"\u524D\u4E00\u5E74",nextYear:"\u540E\u4E00\u5E74",year:"\u5E74",firstQuarter:"\u7B2C\u4E00\u5B63\u5EA6",secondQuarter:"\u7B2C\u4E8C\u5B63\u5EA6",thirdQuarter:"\u7B2C\u4E09\u5B63\u5EA6",fourthQuarter:"\u7B2C\u56DB\u5B63\u5EA6"}}};export{u as default};
1
+ /*! Hzzt Plus v2.0.6 */var u={name:"zh-cn",hzzt:{collapse:{expand:"\u5C55\u5F00",retract:"\u6536\u8D77"},pagination:{total:"\u5171",strip:"\u6761"},pageSize:{total:"\u5171",strip:"\u6761",d:"\u7B2C",page:"\u9875",per_page:"\u6BCF\u9875"},quarterpicker:{prevYear:"\u524D\u4E00\u5E74",nextYear:"\u540E\u4E00\u5E74",year:"\u5E74",firstQuarter:"\u7B2C\u4E00\u5B63\u5EA6",secondQuarter:"\u7B2C\u4E8C\u5B63\u5EA6",thirdQuarter:"\u7B2C\u4E09\u5B63\u5EA6",fourthQuarter:"\u7B2C\u56DB\u5B63\u5EA6"}}};export{u as default};
2
2
  //# sourceMappingURL=zh-cn.min.mjs.map
@@ -1,4 +1,4 @@
1
- /*! Hzzt Plus v2.0.4 */
1
+ /*! Hzzt Plus v2.0.6 */
2
2
 
3
3
  var zhCn = {
4
4
  name: "zh-cn",
@@ -1,6 +1,6 @@
1
1
  import '../../utils/index.mjs';
2
- import Collapse from './src/collapse2.mjs';
3
- import './src/collapse.mjs';
2
+ import Collapse from './src/collapse.mjs';
3
+ import './src/collapse2.mjs';
4
4
  import { withInstall } from '../../utils/vue/install.mjs';
5
5
 
6
6
  const HzztCollapse = withInstall(Collapse);
@@ -1,2 +1,90 @@
1
+ import { defineComponent, ref, watch, openBlock, createElementBlock, createElementVNode, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createVNode, unref, withDirectives, vShow } from 'vue';
2
+ import '../../../hooks/index.mjs';
3
+ import HzztIcon from '../../icon/src/index.mjs';
4
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
+ import { useLocale } from '../../../hooks/use-locale/index.mjs';
1
6
 
7
+ const _hoisted_1 = { class: "hzzt-collapse flex column" };
8
+ const _hoisted_2 = { class: "hzzt-collapse__top" };
9
+ const _hoisted_3 = { class: "hzzt-collapse__title" };
10
+ const _hoisted_4 = {
11
+ key: 0,
12
+ class: "hzzt-collapse__line"
13
+ };
14
+ const _hoisted_5 = { class: "hzzt-collapse__content flex-1" };
15
+ const __default__ = defineComponent({
16
+ name: "HzztCollapse"
17
+ });
18
+ const _sfc_main = /* @__PURE__ */ defineComponent({
19
+ ...__default__,
20
+ props: {
21
+ defaultActive: {
22
+ type: Boolean,
23
+ default: true
24
+ },
25
+ title: {
26
+ type: String,
27
+ default: ""
28
+ },
29
+ showLine: {
30
+ type: Boolean,
31
+ default: true
32
+ },
33
+ modelValue: {
34
+ type: Boolean,
35
+ default: true
36
+ }
37
+ },
38
+ emits: ["update:modelValue"],
39
+ setup(__props, { emit }) {
40
+ const props = __props;
41
+ const { t } = useLocale();
42
+ const expand = ref(props.modelValue);
43
+ if (!props.defaultActive) {
44
+ emit("update:modelValue", false);
45
+ expand.value = false;
46
+ }
47
+ watch(() => props.modelValue, (v) => {
48
+ expand.value = v;
49
+ });
50
+ function toggle() {
51
+ expand.value = !expand.value;
52
+ emit("update:modelValue", expand.value);
53
+ }
54
+ return (_ctx, _cache) => {
55
+ return openBlock(), createElementBlock("div", _hoisted_1, [
56
+ createElementVNode("div", _hoisted_2, [
57
+ createElementVNode("div", _hoisted_3, [
58
+ renderSlot(_ctx.$slots, "title", {}, () => [
59
+ createTextVNode(toDisplayString(__props.title), 1)
60
+ ])
61
+ ]),
62
+ __props.showLine ? (openBlock(), createElementBlock("div", _hoisted_4)) : createCommentVNode("v-if", true),
63
+ renderSlot(_ctx.$slots, "toggle-btn", {}, () => [
64
+ createElementVNode("div", {
65
+ class: "hzzt-collapse__btn",
66
+ onClick: toggle
67
+ }, [
68
+ createVNode(HzztIcon, {
69
+ name: !expand.value ? "hzzt-plus-square-outline" : "hzzt-minus-square-outline",
70
+ class: "hzzt-collapse__icon",
71
+ size: "14"
72
+ }, null, 8, ["name"]),
73
+ createElementVNode("span", null, toDisplayString(expand.value ? unref(t)("hzzt.collapse.retract") : unref(t)("hzzt.collapse.expand")), 1)
74
+ ])
75
+ ])
76
+ ]),
77
+ withDirectives(createElementVNode("div", _hoisted_5, [
78
+ renderSlot(_ctx.$slots, "default")
79
+ ], 512), [
80
+ [vShow, expand.value]
81
+ ]),
82
+ renderSlot(_ctx.$slots, "active", { active: expand.value })
83
+ ]);
84
+ };
85
+ }
86
+ });
87
+ var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "collapse.vue"]]);
88
+
89
+ export { Collapse as default };
2
90
  //# sourceMappingURL=collapse.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"collapse.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"collapse.mjs","sources":["../../../../../../packages/components/collapse/src/collapse.vue"],"sourcesContent":["<template>\n <div class=\"hzzt-collapse flex column\">\n <div class=\"hzzt-collapse__top\">\n <div class=\"hzzt-collapse__title\">\n <slot name=\"title\">\n {{ title }}\n </slot>\n </div>\n <div v-if=\"showLine\" class=\"hzzt-collapse__line\" />\n <slot name=\"toggle-btn\">\n <div class=\"hzzt-collapse__btn\" @click=\"toggle\">\n <hzzt-icon :name=\"!expand ? 'hzzt-plus-square-outline' : 'hzzt-minus-square-outline'\"\n class=\"hzzt-collapse__icon\" size=\"14\" />\n <span>{{ expand ? t('hzzt.collapse.retract') : t('hzzt.collapse.expand') }}</span>\n </div>\n </slot>\n </div>\n <div v-show=\"expand\" class=\"hzzt-collapse__content flex-1\">\n <slot />\n </div>\n\n <slot :active=\"expand\" name=\"active\" />\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import {useLocale} from '@hzzt-plus/hooks'\n import HzztIcon from '@hzzt-plus/components/icon/src/index.vue'\n import {ref, watch} from 'vue'\n\n defineOptions({\n name: 'HzztCollapse',\n })\n const {t} = useLocale()\n const props = defineProps({\n defaultActive: {\n type: Boolean,\n default: true,\n },\n title: {\n type: String,\n default: '',\n },\n showLine: {\n type: Boolean,\n default: true,\n },\n modelValue: {\n type: Boolean,\n default: true,\n },\n })\n const emit = defineEmits(['update:modelValue'])\n\n const expand = ref(props.modelValue)\n\n if (!props.defaultActive) {\n emit('update:modelValue', false);\n expand.value = false;\n }\n\n watch(() => props.modelValue, (v) => {\n expand.value = v;\n })\n\n function toggle() {\n expand.value = !expand.value;\n emit('update:modelValue', expand.value);\n }\n\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;mCA8BgB,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAM,MAAA,EAAC,CAAC,EAAA,GAAI,SAAU,EAAA,CAAA;AAqBtB,IAAM,MAAA,MAAA,GAAS,GAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AAEnC,IAAI,IAAA,CAAC,MAAM,aAAe,EAAA;AACxB,MAAA,IAAA,CAAK,qBAAqB,KAAK,CAAA,CAAA;AAC/B,MAAA,MAAA,CAAO,KAAQ,GAAA,KAAA,CAAA;AAAA,KACjB;AAEA,IAAA,KAAA,CAAM,MAAM,KAAA,CAAM,UAAY,EAAA,CAAC,CAAM,KAAA;AACnC,MAAA,MAAA,CAAO,KAAQ,GAAA,CAAA,CAAA;AAAA,KAChB,CAAA,CAAA;AAED,IAAA,SAAS,MAAS,GAAA;AAChB,MAAO,MAAA,CAAA,KAAA,GAAQ,CAAC,MAAO,CAAA,KAAA,CAAA;AACvB,MAAK,IAAA,CAAA,mBAAA,EAAqB,OAAO,KAAK,CAAA,CAAA;AAAA,KACxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,90 +1,2 @@
1
- import { defineComponent, ref, watch, openBlock, createElementBlock, createElementVNode, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createVNode, unref, withDirectives, vShow } from 'vue';
2
- import '../../../hooks/index.mjs';
3
- import HzztIcon from '../../icon/src/index.mjs';
4
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
- import { useLocale } from '../../../hooks/use-locale/index.mjs';
6
1
 
7
- const _hoisted_1 = { class: "hzzt-collapse flex column" };
8
- const _hoisted_2 = { class: "hzzt-collapse__top" };
9
- const _hoisted_3 = { class: "hzzt-collapse__title" };
10
- const _hoisted_4 = {
11
- key: 0,
12
- class: "hzzt-collapse__line"
13
- };
14
- const _hoisted_5 = { class: "hzzt-collapse__content flex-1" };
15
- const __default__ = defineComponent({
16
- name: "HzztCollapse"
17
- });
18
- const _sfc_main = /* @__PURE__ */ defineComponent({
19
- ...__default__,
20
- props: {
21
- defaultActive: {
22
- type: Boolean,
23
- default: true
24
- },
25
- title: {
26
- type: String,
27
- default: ""
28
- },
29
- showLine: {
30
- type: Boolean,
31
- default: true
32
- },
33
- modelValue: {
34
- type: Boolean,
35
- default: true
36
- }
37
- },
38
- emits: ["update:modelValue"],
39
- setup(__props, { emit }) {
40
- const props = __props;
41
- const { t } = useLocale();
42
- const expand = ref(props.modelValue);
43
- if (!props.defaultActive) {
44
- emit("update:modelValue", false);
45
- expand.value = false;
46
- }
47
- watch(() => props.modelValue, (v) => {
48
- expand.value = v;
49
- });
50
- function toggle() {
51
- expand.value = !expand.value;
52
- emit("update:modelValue", expand.value);
53
- }
54
- return (_ctx, _cache) => {
55
- return openBlock(), createElementBlock("div", _hoisted_1, [
56
- createElementVNode("div", _hoisted_2, [
57
- createElementVNode("div", _hoisted_3, [
58
- renderSlot(_ctx.$slots, "title", {}, () => [
59
- createTextVNode(toDisplayString(__props.title), 1)
60
- ])
61
- ]),
62
- __props.showLine ? (openBlock(), createElementBlock("div", _hoisted_4)) : createCommentVNode("v-if", true),
63
- renderSlot(_ctx.$slots, "toggle-btn", {}, () => [
64
- createElementVNode("div", {
65
- class: "hzzt-collapse__btn",
66
- onClick: toggle
67
- }, [
68
- createVNode(HzztIcon, {
69
- name: !expand.value ? "hzzt-plus-square-outline" : "hzzt-minus-square-outline",
70
- class: "hzzt-collapse__icon",
71
- size: "14"
72
- }, null, 8, ["name"]),
73
- createElementVNode("span", null, toDisplayString(expand.value ? unref(t)("hzzt.collapse.retract") : unref(t)("hzzt.collapse.expand")), 1)
74
- ])
75
- ])
76
- ]),
77
- withDirectives(createElementVNode("div", _hoisted_5, [
78
- renderSlot(_ctx.$slots, "default")
79
- ], 512), [
80
- [vShow, expand.value]
81
- ]),
82
- renderSlot(_ctx.$slots, "active", { active: expand.value })
83
- ]);
84
- };
85
- }
86
- });
87
- var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "collapse.vue"]]);
88
-
89
- export { Collapse as default };
90
2
  //# sourceMappingURL=collapse2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"collapse2.mjs","sources":["../../../../../../packages/components/collapse/src/collapse.vue"],"sourcesContent":["<template>\n <div class=\"hzzt-collapse flex column\">\n <div class=\"hzzt-collapse__top\">\n <div class=\"hzzt-collapse__title\">\n <slot name=\"title\">\n {{ title }}\n </slot>\n </div>\n <div v-if=\"showLine\" class=\"hzzt-collapse__line\" />\n <slot name=\"toggle-btn\">\n <div class=\"hzzt-collapse__btn\" @click=\"toggle\">\n <hzzt-icon :name=\"!expand ? 'hzzt-plus-square-outline' : 'hzzt-minus-square-outline'\"\n class=\"hzzt-collapse__icon\" size=\"14\" />\n <span>{{ expand ? t('hzzt.collapse.retract') : t('hzzt.collapse.expand') }}</span>\n </div>\n </slot>\n </div>\n <div v-show=\"expand\" class=\"hzzt-collapse__content flex-1\">\n <slot />\n </div>\n\n <slot :active=\"expand\" name=\"active\" />\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import {useLocale} from '@hzzt-plus/hooks'\n import HzztIcon from '@hzzt-plus/components/icon/src/index.vue'\n import {ref, watch} from 'vue'\n\n defineOptions({\n name: 'HzztCollapse',\n })\n const {t} = useLocale()\n const props = defineProps({\n defaultActive: {\n type: Boolean,\n default: true,\n },\n title: {\n type: String,\n default: '',\n },\n showLine: {\n type: Boolean,\n default: true,\n },\n modelValue: {\n type: Boolean,\n default: true,\n },\n })\n const emit = defineEmits(['update:modelValue'])\n\n const expand = ref(props.modelValue)\n\n if (!props.defaultActive) {\n emit('update:modelValue', false);\n expand.value = false;\n }\n\n watch(() => props.modelValue, (v) => {\n expand.value = v;\n })\n\n function toggle() {\n expand.value = !expand.value;\n emit('update:modelValue', expand.value);\n }\n\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;mCA8BgB,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAM,MAAA,EAAC,CAAC,EAAA,GAAI,SAAU,EAAA,CAAA;AAqBtB,IAAM,MAAA,MAAA,GAAS,GAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AAEnC,IAAI,IAAA,CAAC,MAAM,aAAe,EAAA;AACxB,MAAA,IAAA,CAAK,qBAAqB,KAAK,CAAA,CAAA;AAC/B,MAAA,MAAA,CAAO,KAAQ,GAAA,KAAA,CAAA;AAAA,KACjB;AAEA,IAAA,KAAA,CAAM,MAAM,KAAA,CAAM,UAAY,EAAA,CAAC,CAAM,KAAA;AACnC,MAAA,MAAA,CAAO,KAAQ,GAAA,CAAA,CAAA;AAAA,KAChB,CAAA,CAAA;AAED,IAAA,SAAS,MAAS,GAAA;AAChB,MAAO,MAAA,CAAA,KAAA,GAAQ,CAAC,MAAO,CAAA,KAAA,CAAA;AACvB,MAAK,IAAA,CAAA,mBAAA,EAAqB,OAAO,KAAK,CAAA,CAAA;AAAA,KACxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"collapse2.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -30,5 +30,5 @@ export { inputRangeEmits, inputRangeProps } from './input-range/src/input-range.
30
30
  export { cascaderEmits, cascaderProps } from './cascader/src/cascader.mjs';
31
31
  export { selectEmits, selectProps } from './select/src/select.mjs';
32
32
  export { clickInputEmits, clickInputProps } from './click-input/src/click-input.mjs';
33
- export { lazyListEmits, lazyListProps } from './lazy-list/src/lazy-list2.mjs';
33
+ export { lazyListEmits, lazyListProps } from './lazy-list/src/lazy-list.mjs';
34
34
  //# sourceMappingURL=index.mjs.map
@@ -1,6 +1,6 @@
1
1
  import '../../utils/index.mjs';
2
- import LazyList from './src/lazy-list.mjs';
3
- export { lazyListEmits, lazyListProps } from './src/lazy-list2.mjs';
2
+ import LazyList from './src/lazy-list2.mjs';
3
+ export { lazyListEmits, lazyListProps } from './src/lazy-list.mjs';
4
4
  import { withInstall } from '../../utils/vue/install.mjs';
5
5
 
6
6
  const HzztLazyList = withInstall(LazyList);
@@ -1,85 +1,27 @@
1
- import { defineComponent, ref, computed, watch, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, normalizeStyle, Fragment, renderList, renderSlot } from 'vue';
2
- import { lazyListProps, lazyListEmits } from './lazy-list2.mjs';
3
- import '../../../hooks/index.mjs';
4
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
- import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
1
+ import '../../../utils/index.mjs';
2
+ import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
6
3
 
7
- const _hoisted_1 = ["onClick"];
8
- const __default__ = defineComponent({
9
- name: "HzztLazyList"
10
- });
11
- const _sfc_main = /* @__PURE__ */ defineComponent({
12
- ...__default__,
13
- props: lazyListProps,
14
- emits: lazyListEmits,
15
- setup(__props, { emit }) {
16
- const props = __props;
17
- const totalHeight = ref("100%");
18
- const marginTop = ref("0px");
19
- const currentIndex = ref(1);
20
- const current = ref(null);
21
- const nsLazy = useNamespace("lazy-list");
22
- const containerCls = computed(() => [
23
- "overflow-y-auto",
24
- nsLazy.b()
25
- ]);
26
- watch(() => props.data, () => {
27
- totalHeight.value = props.data.length * props.height + "px";
28
- }, {
29
- immediate: true
30
- });
31
- const calcList = computed(() => props.data.slice(currentIndex.value === 1 ? 0 : (currentIndex.value - 1) * props.size - props.size / 2, (currentIndex.value + 1) * props.size + props.size / 2));
32
- function scrollList(e) {
33
- const target = e.target;
34
- const scrollTop = target.scrollTop;
35
- if (scrollTop < props.size / 2 * props.height) {
36
- currentIndex.value = 1;
37
- } else {
38
- currentIndex.value = Math.ceil((scrollTop - props.size / 2 * props.height) / props.size / props.height);
39
- }
40
- if (currentIndex.value === 1) {
41
- marginTop.value = "0px";
42
- } else {
43
- marginTop.value = ((currentIndex.value - 1) * props.size - props.size / 2) * props.height + "px";
44
- }
45
- }
46
- function rowClick(row) {
47
- current.value = row;
48
- emit("row-click", row);
49
- }
50
- return (_ctx, _cache) => {
51
- return openBlock(), createElementBlock("div", {
52
- class: normalizeClass(unref(containerCls)),
53
- onScroll: scrollList
54
- }, [
55
- createElementVNode("div", {
56
- style: normalizeStyle({
57
- height: totalHeight.value,
58
- width: 0,
59
- float: "left"
60
- })
61
- }, null, 4),
62
- createElementVNode("div", {
63
- style: normalizeStyle({ marginTop: marginTop.value })
64
- }, [
65
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(calcList), (item) => {
66
- return openBlock(), createElementBlock("div", {
67
- key: item[_ctx.rowKey],
68
- style: normalizeStyle({
69
- height: _ctx.height + "px"
70
- }),
71
- class: normalizeClass(["hzzt-lazy-list__item", current.value === item ? "is-active" : ""]),
72
- onClick: ($event) => rowClick(item)
73
- }, [
74
- renderSlot(_ctx.$slots, "default", { data: item })
75
- ], 14, _hoisted_1);
76
- }), 128))
77
- ], 4)
78
- ], 34);
79
- };
4
+ const lazyListProps = buildProps({
5
+ size: {
6
+ type: Number,
7
+ default: 20
8
+ },
9
+ height: {
10
+ type: Number,
11
+ default: 30
12
+ },
13
+ data: {
14
+ type: definePropType(Array),
15
+ default: () => []
16
+ },
17
+ rowKey: {
18
+ type: String,
19
+ default: "id"
80
20
  }
81
21
  });
82
- var LazyList = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "lazy-list.vue"]]);
22
+ const lazyListEmits = {
23
+ "row-click": (row) => row
24
+ };
83
25
 
84
- export { LazyList as default };
26
+ export { lazyListEmits, lazyListProps };
85
27
  //# sourceMappingURL=lazy-list.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"lazy-list.mjs","sources":["../../../../../../packages/components/lazy-list/src/lazy-list.vue"],"sourcesContent":["<template>\n <div :class=\"containerCls\" @scroll=\"scrollList\">\n <div\n :style=\"{\n height: totalHeight,\n width: 0,\n float: 'left',\n }\"\n />\n <div :style=\"{marginTop: marginTop}\">\n <div\n v-for=\"item in calcList\"\n :key=\"item[rowKey]\"\n :style=\"{\n height: height+'px'\n }\"\n :class=\"['hzzt-lazy-list__item', current === item?'is-active':'']\"\n @click=\"rowClick(item)\"\n >\n <slot :data=\"item\" />\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {lazyListEmits, lazyListProps} from './lazy-list'\n import {computed, ref, watch} from \"vue\";\n import {useNamespace} from \"@hzzt-plus/hooks\";\n\n defineOptions({\n name: 'HzztLazyList',\n })\n\n const props = defineProps(lazyListProps)\n const emit = defineEmits(lazyListEmits)\n\n const totalHeight = ref('100%');\n const marginTop = ref('0px');\n const currentIndex = ref(1);\n const current = ref(null);\n\n const nsLazy = useNamespace('lazy-list');\n\n const containerCls = computed(() => [\n 'overflow-y-auto',\n nsLazy.b(),\n ])\n\n watch(() => props.data, () => {\n totalHeight.value = props.data.length * props.height + 'px';\n }, {\n immediate: true,\n });\n\n const calcList = computed(\n () => props.data.slice(currentIndex.value === 1 ? 0 : ((currentIndex.value - 1) * props.size -\n props.size / 2), (currentIndex.value + 1) * props.size + props.size / 2));\n\n function scrollList(e: Event) {\n const target = e.target as HTMLElement;\n const scrollTop = target.scrollTop;\n if (scrollTop < props.size / 2 * props.height) {\n currentIndex.value = 1;\n } else {\n currentIndex.value = Math.ceil((scrollTop - props.size / 2 * props.height) / props.size / props.height);\n }\n if (currentIndex.value === 1) {\n marginTop.value = '0px';\n } else {\n marginTop.value = ((currentIndex.value - 1) * props.size - props.size / 2) * props.height + 'px';\n }\n }\n\n function rowClick(row: any) {\n current.value = row;\n emit('row-click', row);\n }\n\n\n</script>\n"],"names":["_openBlock","_createElementBlock"],"mappings":";;;;;;;mCA8BgB,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,WAAA,GAAc,IAAI,MAAM,CAAA,CAAA;AAC9B,IAAM,MAAA,SAAA,GAAY,IAAI,KAAK,CAAA,CAAA;AAC3B,IAAM,MAAA,YAAA,GAAe,IAAI,CAAC,CAAA,CAAA;AAC1B,IAAM,MAAA,OAAA,GAAU,IAAI,IAAI,CAAA,CAAA;AAExB,IAAM,MAAA,MAAA,GAAS,aAAa,WAAW,CAAA,CAAA;AAEvC,IAAM,MAAA,YAAA,GAAe,SAAS,MAAM;AAAA,MAClC,iBAAA;AAAA,MACA,OAAO,CAAE,EAAA;AAAA,KACV,CAAA,CAAA;AAED,IAAM,KAAA,CAAA,MAAM,KAAM,CAAA,IAAA,EAAM,MAAM;AAC5B,MAAA,WAAA,CAAY,KAAQ,GAAA,KAAA,CAAM,IAAK,CAAA,MAAA,GAAS,MAAM,MAAS,GAAA,IAAA,CAAA;AAAA,KACtD,EAAA;AAAA,MACD,SAAW,EAAA,IAAA;AAAA,KACZ,CAAA,CAAA;AAED,IAAA,MAAM,QAAW,GAAA,QAAA,CAAA,MAAA,KAAA,CAAA,IAAA,CAAA,KAAA,CAAA,YAAA,CAAA,KAAA,KAAA,CAAA,GAAA,CAAA,GAAA,CAAA,YAAA,CAAA,KAAA,GAAA,CAAA,IAAA,KAAA,CAAA,IAAA,GAAA,KAAA,CAAA,IAAA,GAAA,CAAA,EAAA,CAAA,YAAA,CAAA,KAAA,GAAA,CAAA,IAAA,KAAA,CAAA,IAAA,GAAA,KAAA,CAAA,IAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA,IACf,mBAAiB,CAAA,CAAA,EAAA;AACwD,MAAC,MAAA,MAAA,GAAA,CAAA,CAAA,MAAA,CAAA;AAE5E,MAAA,MAAA,YAAoB,MAAU,CAAA,SAAA,CAAA;AAC5B,MAAA,IAAA,YAAiB,KAAA,CAAA,IAAA,GAAA,CAAA,GAAA,KAAA,CAAA,MAAA,EAAA;AACjB,QAAA,kBAAyB,GAAA,CAAA,CAAA;AACzB,OAAA,MAAgB;AACd,QAAA,YAAA,CAAa,KAAQ,GAAA,IAAA,CAAA,IAAA,CAAA,CAAA,SAAA,GAAA,KAAA,CAAA,IAAA,GAAA,CAAA,GAAA,KAAA,CAAA,MAAA,IAAA,KAAA,CAAA,IAAA,GAAA,KAAA,CAAA,MAAA,CAAA,CAAA;AAAA,OAChB;AACL,MAAA,IAAA,YAAqB,CAAA,KAAA,KAAA,CAAK,EAAM;AAAsE,QACxG,SAAA,CAAA,KAAA,GAAA,KAAA,CAAA;AACA,OAAI,MAAA;AACF,QAAA,SAAA,CAAU,KAAQ,GAAA,CAAA,CAAA,YAAA,CAAA,KAAA,GAAA,CAAA,IAAA,KAAA,CAAA,IAAA,GAAA,KAAA,CAAA,IAAA,GAAA,CAAA,IAAA,KAAA,CAAA,MAAA,GAAA,IAAA,CAAA;AAAA,OACb;AACL,KAAU;AAAkF,IAC9F,SAAA,QAAA,CAAA,GAAA,EAAA;AAAA,MACF,OAAA,CAAA,KAAA,GAAA,GAAA,CAAA;AAEA,MAAA,IAAA,CAAA,WAAkB,EAAU,GAAA,CAAA,CAAA;AAC1B,KAAA;AACA,IAAA,OAAK,aAAa,KAAG;AAAA,MACvB,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAAA,KAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"lazy-list.mjs","sources":["../../../../../../packages/components/lazy-list/src/lazy-list.ts"],"sourcesContent":["import {buildProps, definePropType} from '@hzzt-plus/utils'\nimport type {ExtractPropTypes} from 'vue'\nimport type LazyList from './lazy-list.vue'\n\nexport const lazyListProps = buildProps({\n size: {\n type: Number,\n default: 20,\n },\n height: {\n type: Number,\n default: 30,\n },\n data: {\n type: definePropType<Record<string, any>[]>(Array),\n default: () => [],\n },\n rowKey: {\n type: String,\n default: 'id',\n },\n})\n\nexport type LazyListProps = ExtractPropTypes<typeof lazyListProps>\n\nexport const lazyListEmits = {\n 'row-click': (row: any) => row\n}\n\nexport type LazyListEmits = typeof lazyListEmits\n\n\nexport type LazyListInstance = InstanceType<typeof LazyList>\n"],"names":[],"mappings":";;;AACY,MAAC,aAAa,GAAG,UAAU,CAAC;AACxC,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,aAAa,GAAG;AAC7B,EAAE,WAAW,EAAE,CAAC,GAAG,KAAK,GAAG;AAC3B;;;;"}
@@ -1,27 +1,85 @@
1
- import '../../../utils/index.mjs';
2
- import { buildProps, definePropType } from '../../../utils/vue/props/runtime.mjs';
1
+ import { defineComponent, ref, computed, watch, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, normalizeStyle, Fragment, renderList, renderSlot } from 'vue';
2
+ import { lazyListProps, lazyListEmits } from './lazy-list.mjs';
3
+ import '../../../hooks/index.mjs';
4
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
+ import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
3
6
 
4
- const lazyListProps = buildProps({
5
- size: {
6
- type: Number,
7
- default: 20
8
- },
9
- height: {
10
- type: Number,
11
- default: 30
12
- },
13
- data: {
14
- type: definePropType(Array),
15
- default: () => []
16
- },
17
- rowKey: {
18
- type: String,
19
- default: "id"
7
+ const _hoisted_1 = ["onClick"];
8
+ const __default__ = defineComponent({
9
+ name: "HzztLazyList"
10
+ });
11
+ const _sfc_main = /* @__PURE__ */ defineComponent({
12
+ ...__default__,
13
+ props: lazyListProps,
14
+ emits: lazyListEmits,
15
+ setup(__props, { emit }) {
16
+ const props = __props;
17
+ const totalHeight = ref("100%");
18
+ const marginTop = ref("0px");
19
+ const currentIndex = ref(1);
20
+ const current = ref(null);
21
+ const nsLazy = useNamespace("lazy-list");
22
+ const containerCls = computed(() => [
23
+ "overflow-y-auto",
24
+ nsLazy.b()
25
+ ]);
26
+ watch(() => props.data, () => {
27
+ totalHeight.value = props.data.length * props.height + "px";
28
+ }, {
29
+ immediate: true
30
+ });
31
+ const calcList = computed(() => props.data.slice(currentIndex.value === 1 ? 0 : (currentIndex.value - 1) * props.size - props.size / 2, (currentIndex.value + 1) * props.size + props.size / 2));
32
+ function scrollList(e) {
33
+ const target = e.target;
34
+ const scrollTop = target.scrollTop;
35
+ if (scrollTop < props.size / 2 * props.height) {
36
+ currentIndex.value = 1;
37
+ } else {
38
+ currentIndex.value = Math.ceil((scrollTop - props.size / 2 * props.height) / props.size / props.height);
39
+ }
40
+ if (currentIndex.value === 1) {
41
+ marginTop.value = "0px";
42
+ } else {
43
+ marginTop.value = ((currentIndex.value - 1) * props.size - props.size / 2) * props.height + "px";
44
+ }
45
+ }
46
+ function rowClick(row) {
47
+ current.value = row;
48
+ emit("row-click", row);
49
+ }
50
+ return (_ctx, _cache) => {
51
+ return openBlock(), createElementBlock("div", {
52
+ class: normalizeClass(unref(containerCls)),
53
+ onScroll: scrollList
54
+ }, [
55
+ createElementVNode("div", {
56
+ style: normalizeStyle({
57
+ height: totalHeight.value,
58
+ width: 0,
59
+ float: "left"
60
+ })
61
+ }, null, 4),
62
+ createElementVNode("div", {
63
+ style: normalizeStyle({ marginTop: marginTop.value })
64
+ }, [
65
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(calcList), (item) => {
66
+ return openBlock(), createElementBlock("div", {
67
+ key: item[_ctx.rowKey],
68
+ style: normalizeStyle({
69
+ height: _ctx.height + "px"
70
+ }),
71
+ class: normalizeClass(["hzzt-lazy-list__item", current.value === item ? "is-active" : ""]),
72
+ onClick: ($event) => rowClick(item)
73
+ }, [
74
+ renderSlot(_ctx.$slots, "default", { data: item })
75
+ ], 14, _hoisted_1);
76
+ }), 128))
77
+ ], 4)
78
+ ], 34);
79
+ };
20
80
  }
21
81
  });
22
- const lazyListEmits = {
23
- "row-click": (row) => row
24
- };
82
+ var LazyList = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "lazy-list.vue"]]);
25
83
 
26
- export { lazyListEmits, lazyListProps };
84
+ export { LazyList as default };
27
85
  //# sourceMappingURL=lazy-list2.mjs.map