hzzt-plus 2.0.7 → 2.0.9

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 (98) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index.full.js +55 -8
  3. package/dist/index.full.min.js +14 -14
  4. package/dist/index.full.min.js.map +1 -1
  5. package/dist/index.full.min.mjs +15 -15
  6. package/dist/index.full.min.mjs.map +1 -1
  7. package/dist/index.full.mjs +55 -8
  8. package/dist/locale/en.js +1 -1
  9. package/dist/locale/en.min.js +1 -1
  10. package/dist/locale/en.min.mjs +1 -1
  11. package/dist/locale/en.mjs +1 -1
  12. package/dist/locale/zh-cn.js +1 -1
  13. package/dist/locale/zh-cn.min.js +1 -1
  14. package/dist/locale/zh-cn.min.mjs +1 -1
  15. package/dist/locale/zh-cn.mjs +1 -1
  16. package/es/components/cascader/src/cascader.d.ts +1 -0
  17. package/es/components/cascader/src/cascader.mjs +4 -0
  18. package/es/components/cascader/src/cascader.mjs.map +1 -1
  19. package/es/components/cascader/src/cascader.vue.d.ts +7 -0
  20. package/es/components/cascader/src/cascader2.mjs +37 -3
  21. package/es/components/cascader/src/cascader2.mjs.map +1 -1
  22. package/es/components/click-input/index.mjs +2 -2
  23. package/es/components/click-input/src/click-input.mjs +21 -84
  24. package/es/components/click-input/src/click-input.mjs.map +1 -1
  25. package/es/components/click-input/src/click-input2.mjs +84 -21
  26. package/es/components/click-input/src/click-input2.mjs.map +1 -1
  27. package/es/components/collapse/index.d.ts +6 -0
  28. package/es/components/collapse/src/collapse.vue.d.ts +6 -0
  29. package/es/components/collapse/src/collapse2.mjs +4 -0
  30. package/es/components/collapse/src/collapse2.mjs.map +1 -1
  31. package/es/components/icon/index.d.ts +6 -0
  32. package/es/components/icon/src/index.mjs +9 -4
  33. package/es/components/icon/src/index.mjs.map +1 -1
  34. package/es/components/icon/src/index.vue.d.ts +6 -0
  35. package/es/components/index.mjs +2 -2
  36. package/es/components/lazy-list/index.mjs +2 -2
  37. package/es/components/lazy-list/src/lazy-list.mjs +80 -22
  38. package/es/components/lazy-list/src/lazy-list.mjs.map +1 -1
  39. package/es/components/lazy-list/src/lazy-list2.mjs +22 -80
  40. package/es/components/lazy-list/src/lazy-list2.mjs.map +1 -1
  41. package/es/components/page-size/index.d.ts +6 -0
  42. package/es/components/page-size/src/index.vue.d.ts +6 -0
  43. package/es/components/pagination/index.d.ts +6 -0
  44. package/es/components/pagination/src/index.vue.d.ts +6 -0
  45. package/es/components/quarter-picker/index.d.ts +6 -0
  46. package/es/components/quarter-picker/src/index.vue.d.ts +6 -0
  47. package/es/components/scroll/src/scroll.vue.d.ts +6 -0
  48. package/es/components/select/src/select.vue.d.ts +6 -0
  49. package/es/components/tab/index.d.ts +6 -0
  50. package/es/components/tab/src/index.vue.d.ts +6 -0
  51. package/es/index.mjs +2 -2
  52. package/es/version.d.ts +1 -1
  53. package/es/version.mjs +1 -1
  54. package/es/version.mjs.map +1 -1
  55. package/lib/components/cascader/src/cascader.d.ts +1 -0
  56. package/lib/components/cascader/src/cascader.js +4 -0
  57. package/lib/components/cascader/src/cascader.js.map +1 -1
  58. package/lib/components/cascader/src/cascader.vue.d.ts +7 -0
  59. package/lib/components/cascader/src/cascader2.js +37 -3
  60. package/lib/components/cascader/src/cascader2.js.map +1 -1
  61. package/lib/components/click-input/index.js +2 -2
  62. package/lib/components/click-input/src/click-input.js +22 -84
  63. package/lib/components/click-input/src/click-input.js.map +1 -1
  64. package/lib/components/click-input/src/click-input2.js +84 -22
  65. package/lib/components/click-input/src/click-input2.js.map +1 -1
  66. package/lib/components/collapse/index.d.ts +6 -0
  67. package/lib/components/collapse/src/collapse.vue.d.ts +6 -0
  68. package/lib/components/collapse/src/collapse2.js +4 -0
  69. package/lib/components/collapse/src/collapse2.js.map +1 -1
  70. package/lib/components/icon/index.d.ts +6 -0
  71. package/lib/components/icon/src/index.js +8 -3
  72. package/lib/components/icon/src/index.js.map +1 -1
  73. package/lib/components/icon/src/index.vue.d.ts +6 -0
  74. package/lib/components/index.js +2 -2
  75. package/lib/components/lazy-list/index.js +2 -2
  76. package/lib/components/lazy-list/src/lazy-list.js +80 -23
  77. package/lib/components/lazy-list/src/lazy-list.js.map +1 -1
  78. package/lib/components/lazy-list/src/lazy-list2.js +23 -80
  79. package/lib/components/lazy-list/src/lazy-list2.js.map +1 -1
  80. package/lib/components/page-size/index.d.ts +6 -0
  81. package/lib/components/page-size/src/index.vue.d.ts +6 -0
  82. package/lib/components/pagination/index.d.ts +6 -0
  83. package/lib/components/pagination/src/index.vue.d.ts +6 -0
  84. package/lib/components/quarter-picker/index.d.ts +6 -0
  85. package/lib/components/quarter-picker/src/index.vue.d.ts +6 -0
  86. package/lib/components/scroll/src/scroll.vue.d.ts +6 -0
  87. package/lib/components/select/src/select.vue.d.ts +6 -0
  88. package/lib/components/tab/index.d.ts +6 -0
  89. package/lib/components/tab/src/index.vue.d.ts +6 -0
  90. package/lib/index.js +2 -2
  91. package/lib/version.d.ts +1 -1
  92. package/lib/version.js +1 -1
  93. package/lib/version.js.map +1 -1
  94. package/package.json +1 -1
  95. package/theme/hzzt-cascader.css +1 -1
  96. package/theme/index.css +1 -1
  97. package/theme/src/cascader.scss +3 -0
  98. package/web-types.json +1 -1
@@ -2,30 +2,92 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('../../../utils/index.js');
5
+ var vue = require('vue');
6
+ var clickInput = require('./click-input.js');
6
7
  require('../../../hooks/index.js');
7
- require('../../../constants/index.js');
8
- var runtime = require('../../../utils/vue/props/runtime.js');
9
- var index = require('../../../hooks/use-size/index.js');
10
- var event = require('../../../constants/event.js');
11
- var shared = require('@vue/shared');
8
+ var elementPlus = require('element-plus');
9
+ var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
10
+ var index = require('../../../hooks/use-namespace/index.js');
11
+ var index$1 = require('../../../hooks/use-size/index.js');
12
12
 
13
- const clickInputProps = runtime.buildProps({
14
- modelValue: {
15
- type: String,
16
- default: ""
17
- },
18
- disabled: Boolean,
19
- readonly: Boolean,
20
- inputProps: Object,
21
- size: index.useSizeProp
13
+ const __default__ = vue.defineComponent({
14
+ name: "HzztClickInput"
22
15
  });
23
- const clickInputEmits = {
24
- [event.UPDATE_MODEL_EVENT]: (value) => shared.isString(value),
25
- input: (value) => shared.isString(value),
26
- change: (value) => shared.isString(value)
27
- };
16
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
17
+ ...__default__,
18
+ props: clickInput.clickInputProps,
19
+ emits: clickInput.clickInputEmits,
20
+ setup(__props, { emit }) {
21
+ const props = __props;
22
+ const _inputVal = vue.ref(props.modelValue || "");
23
+ const inputVal = vue.ref(props.modelValue || "");
24
+ const inputRef = vue.ref();
25
+ const editable = vue.ref(false);
26
+ const nsInput = index.useNamespace("click-input");
27
+ const formSize = elementPlus.useFormSize();
28
+ const formDisabled = elementPlus.useFormDisabled();
29
+ const trueSize = vue.computed(() => props.size || formSize.value || index$1.useGlobalSize().value);
30
+ const trueDisabled = vue.computed(() => props.disabled || formDisabled.value);
31
+ const trueReadonly = vue.computed(() => trueDisabled.value || props.readonly || !editable.value);
32
+ const containerCls = vue.computed(() => [
33
+ nsInput.b(),
34
+ nsInput.m(trueSize.value),
35
+ "flex width-100% align-items-center"
36
+ ]);
37
+ const spanClass = vue.computed(() => [
38
+ nsInput.e("span"),
39
+ "flex width-100% align-items-center"
40
+ ]);
41
+ vue.watch(() => props.modelValue, (v) => {
42
+ inputVal.value = v || "";
43
+ _inputVal.value = v || "";
44
+ });
45
+ function input(val) {
46
+ emit("update:modelValue", val);
47
+ emit("input", val);
48
+ }
49
+ function change() {
50
+ editable.value = false;
51
+ if (_inputVal.value === inputVal.value) {
52
+ return;
53
+ }
54
+ input(inputVal.value);
55
+ emit("change", inputVal.value);
56
+ }
57
+ function edit() {
58
+ if (trueDisabled.value || props.readonly) {
59
+ return;
60
+ }
61
+ editable.value = true;
62
+ vue.nextTick(() => {
63
+ inputRef.value.focus();
64
+ });
65
+ }
66
+ return (_ctx, _cache) => {
67
+ return vue.openBlock(), vue.createElementBlock("div", {
68
+ class: vue.normalizeClass(vue.unref(containerCls))
69
+ }, [
70
+ !vue.unref(trueReadonly) ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElInput), vue.mergeProps({
71
+ key: 0,
72
+ ref_key: "inputRef",
73
+ ref: inputRef,
74
+ modelValue: inputVal.value,
75
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputVal.value = $event)
76
+ }, _ctx.inputProps, {
77
+ clearable: "",
78
+ size: vue.unref(trueSize),
79
+ onKeyup: vue.withKeys(change, ["enter"]),
80
+ onBlur: change
81
+ }), null, 16, ["modelValue", "size", "onKeyup"])) : (vue.openBlock(), vue.createElementBlock("div", {
82
+ key: 1,
83
+ class: vue.normalizeClass(["width-100%", vue.unref(spanClass)]),
84
+ onClick: edit
85
+ }, vue.toDisplayString(inputVal.value || " "), 3))
86
+ ], 2);
87
+ };
88
+ }
89
+ });
90
+ var ClickInput = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "click-input.vue"]]);
28
91
 
29
- exports.clickInputEmits = clickInputEmits;
30
- exports.clickInputProps = clickInputProps;
92
+ exports["default"] = ClickInput;
31
93
  //# sourceMappingURL=click-input2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"click-input2.js","sources":["../../../../../../packages/components/click-input/src/click-input.ts"],"sourcesContent":["import {buildProps, isString} from '@hzzt-plus/utils'\nimport {useSizeProp} from \"@hzzt-plus/hooks\";\n\nimport type { ExtractPropTypes } from 'vue'\nimport type ClickInput from './click-input.vue'\nimport {UPDATE_MODEL_EVENT} from \"@hzzt-plus/constants\";\n\nexport const clickInputProps = buildProps({\n modelValue: {\n type: String,\n default: '',\n },\n disabled: Boolean,\n readonly: Boolean,\n inputProps: Object,\n size: useSizeProp,\n})\n\nexport type ClickInputProps = ExtractPropTypes<typeof clickInputProps>\n\nexport const clickInputEmits = {\n [UPDATE_MODEL_EVENT]: (value: string) => isString(value),\n input: (value: string) => isString(value),\n change: (value: string) => isString(value),\n}\nexport type ClickInputEmits = typeof clickInputEmits\n\nexport type ClickInputInstance = InstanceType<typeof ClickInput>\n"],"names":["buildProps","useSizeProp","UPDATE_MODEL_EVENT","isString"],"mappings":";;;;;;;;;;;;AAGY,MAAC,eAAe,GAAGA,kBAAU,CAAC;AAC1C,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,UAAU,EAAE,MAAM;AACpB,EAAE,IAAI,EAAEC,iBAAW;AACnB,CAAC,EAAE;AACS,MAAC,eAAe,GAAG;AAC/B,EAAE,CAACC,wBAAkB,GAAG,CAAC,KAAK,KAAKC,eAAQ,CAAC,KAAK,CAAC;AAClD,EAAE,KAAK,EAAE,CAAC,KAAK,KAAKA,eAAQ,CAAC,KAAK,CAAC;AACnC,EAAE,MAAM,EAAE,CAAC,KAAK,KAAKA,eAAQ,CAAC,KAAK,CAAC;AACpC;;;;;"}
1
+ {"version":3,"file":"click-input2.js","sources":["../../../../../../packages/components/click-input/src/click-input.vue"],"sourcesContent":["<template>\n <div :class=\"containerCls\">\n <el-input\n v-if=\"!trueReadonly\"\n ref=\"inputRef\"\n v-model=\"inputVal\"\n v-bind=\"inputProps\"\n clearable\n :size=\"trueSize\"\n @keyup.enter=\"change\"\n @blur=\"change\"\n />\n <div v-else class=\"width-100%\" :class=\"spanClass\" @click=\"edit\">\n {{ inputVal || ' ' }}\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {computed, ref, watch, nextTick} from 'vue'\n import {clickInputEmits, clickInputProps} from './click-input'\n import {useGlobalSize, useNamespace} from \"@hzzt-plus/hooks\";\n import {useFormDisabled, useFormSize} from \"element-plus\";\n import {ElInput} from 'element-plus'\n\n defineOptions({\n name: 'HzztClickInput',\n })\n\n const props = defineProps(clickInputProps)\n const emit = defineEmits(clickInputEmits)\n\n const _inputVal = ref(props.modelValue || '');\n const inputVal = ref(props.modelValue || '');\n const inputRef = ref();\n const editable = ref(false);\n\n const nsInput = useNamespace('click-input')\n const formSize = useFormSize()\n const formDisabled = useFormDisabled()\n\n const trueSize = computed(\n () => props.size || formSize.value || useGlobalSize().value\n )\n\n const trueDisabled = computed(() => props.disabled || formDisabled.value)\n\n const trueReadonly = computed(() => trueDisabled.value || props.readonly || !editable.value)\n\n const containerCls = computed(() => [\n nsInput.b(),\n nsInput.m(trueSize.value),\n 'flex width-100% align-items-center',\n ])\n\n const spanClass = computed(() => [\n nsInput.e('span'),\n 'flex width-100% align-items-center',\n ])\n\n watch(() => props.modelValue, (v) => {\n inputVal.value = v || '';\n _inputVal.value = v || '';\n })\n\n function input(val: string) {\n emit('update:modelValue', val);\n emit('input', val);\n }\n\n function change() {\n editable.value = false;\n if (_inputVal.value === inputVal.value) {\n return;\n }\n input(inputVal.value);\n emit('change', inputVal.value);\n }\n\n function edit() {\n if (trueDisabled.value || props.readonly) {\n return;\n }\n editable.value = true;\n nextTick(() => {\n inputRef.value.focus();\n });\n }\n\n</script>\n"],"names":["ref","useNamespace","useFormSize","useFormDisabled","computed","useGlobalSize","watch","nextTick","_openBlock","_createElementBlock"],"mappings":";;;;;;;;;;;;uCAyBgB,CAAA;AAAA,EACZ,IAAM,EAAA,gBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAA,MAAM,SAAY,GAAAA,OAAA,CAAI,KAAM,CAAA,UAAA,IAAc,EAAE,CAAA,CAAA;AAC5C,IAAA,MAAM,QAAW,GAAAA,OAAA,CAAI,KAAM,CAAA,UAAA,IAAc,EAAE,CAAA,CAAA;AAC3C,IAAA,MAAM,WAAWA,OAAI,EAAA,CAAA;AACrB,IAAM,MAAA,QAAA,GAAWA,QAAI,KAAK,CAAA,CAAA;AAE1B,IAAM,MAAA,O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A,IAAA,SAAkB,CAAA,KAAA,KAAA,QAAA,CAAA,KAAA,EAAA;AAChB,QAAA,OAAS;AACT,OAAI;AACF,MAAA,KAAA,CAAA,QAAA,CAAA,KAAA,CAAA,CAAA;AAAA,MACF,IAAA,CAAA,QAAA,EAAA,QAAA,CAAA,KAAA,CAAA,CAAA;AACA,KAAA;AACA,IAAK,SAAA,IAAA,GAAA;AAAwB,MAC/B,IAAA,YAAA,CAAA,KAAA,IAAA,KAAA,CAAA,QAAA,EAAA;AAEA,QAAA,OAAgB;AACd,OAAI;AACF,MAAA,QAAA,CAAA,KAAA,GAAA,IAAA,CAAA;AAAA,MACFC,YAAA,CAAA,MAAA;AACA,QAAA,QAAiB,CAAA,KAAA,CAAA,KAAA,EAAA,CAAA;AACjB,OAAA,CAAA,CAAA;AACE,KAAA;AAAqB,IAAA,OACtB,CAAA,IAAA,EAAA,MAAA,KAAA;AAAA,MACH,OAAAC,aAAA,EAAA,EAAAC,sBAAA,CAAA,KAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -49,6 +49,8 @@ export declare const HzztCollapse: import("hzzt-plus/es/utils").SFCWithInstall<i
49
49
  type: StringConstructor;
50
50
  default: string;
51
51
  };
52
+ size: (NumberConstructor | StringConstructor)[];
53
+ color: StringConstructor;
52
54
  }, {
53
55
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
54
56
  name: {
@@ -59,6 +61,8 @@ export declare const HzztCollapse: import("hzzt-plus/es/utils").SFCWithInstall<i
59
61
  type: StringConstructor;
60
62
  default: string;
61
63
  };
64
+ size: (NumberConstructor | StringConstructor)[];
65
+ color: StringConstructor;
62
66
  }>> & {
63
67
  [x: string & `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
64
68
  }>>;
@@ -174,6 +178,8 @@ export declare const HzztCollapse: import("hzzt-plus/es/utils").SFCWithInstall<i
174
178
  type: StringConstructor;
175
179
  default: string;
176
180
  };
181
+ size: (NumberConstructor | StringConstructor)[];
182
+ color: StringConstructor;
177
183
  }>>, {
178
184
  type: string;
179
185
  }>;
@@ -49,6 +49,8 @@ declare const _default: import("vue").DefineComponent<{
49
49
  type: StringConstructor;
50
50
  default: string;
51
51
  };
52
+ size: (NumberConstructor | StringConstructor)[];
53
+ color: StringConstructor;
52
54
  }, {
53
55
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
54
56
  name: {
@@ -59,6 +61,8 @@ declare const _default: import("vue").DefineComponent<{
59
61
  type: StringConstructor;
60
62
  default: string;
61
63
  };
64
+ size: (NumberConstructor | StringConstructor)[];
65
+ color: StringConstructor;
62
66
  }>> & {
63
67
  [x: string & `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
64
68
  }>>;
@@ -174,6 +178,8 @@ declare const _default: import("vue").DefineComponent<{
174
178
  type: StringConstructor;
175
179
  default: string;
176
180
  };
181
+ size: (NumberConstructor | StringConstructor)[];
182
+ color: StringConstructor;
177
183
  }>>, {
178
184
  type: string;
179
185
  }>;
@@ -48,6 +48,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
48
48
  emit("update:modelValue", false);
49
49
  expand.value = false;
50
50
  }
51
+ vue.watch(() => props.defaultActive, (v) => {
52
+ emit("update:modelValue", v);
53
+ expand.value = v;
54
+ });
51
55
  vue.watch(() => props.modelValue, (v) => {
52
56
  expand.value = v;
53
57
  });
@@ -1 +1 @@
1
- {"version":3,"file":"collapse2.js","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":["useLocale","ref","watch"],"mappings":";;;;;;;;;;;;;;;;;;uCA8BgB,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAM,MAAA,EAAC,CAAC,EAAA,GAAIA,eAAU,EAAA,CAAA;AAqBtB,IAAM,MAAA,MAAA,GAASC,OAAI,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,IAAAC,SAAA,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.js","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.defaultActive, (v) => {\n emit('update:modelValue', v);\n expand.value = v;\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":["useLocale","ref","watch"],"mappings":";;;;;;;;;;;;;;;;;;uCA8BgB,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAM,MAAA,EAAC,CAAC,EAAA,GAAIA,eAAU,EAAA,CAAA;AAqBtB,IAAM,MAAA,MAAA,GAASC,OAAI,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,IAAAC,SAAA,CAAM,MAAM,KAAA,CAAM,aAAe,EAAA,CAAC,CAAM,KAAA;AACtC,MAAA,IAAA,CAAK,qBAAqB,CAAC,CAAA,CAAA;AAC3B,MAAA,MAAA,CAAO,KAAQ,GAAA,CAAA,CAAA;AAAA,KAChB,CAAA,CAAA;AAED,IAAAA,SAAA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -7,6 +7,8 @@ export declare const HzztIcon: import("hzzt-plus/es/utils").SFCWithInstall<impor
7
7
  type: StringConstructor;
8
8
  default: string;
9
9
  };
10
+ size: (NumberConstructor | StringConstructor)[];
11
+ color: StringConstructor;
10
12
  }, {
11
13
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
12
14
  name: {
@@ -17,6 +19,8 @@ export declare const HzztIcon: import("hzzt-plus/es/utils").SFCWithInstall<impor
17
19
  type: StringConstructor;
18
20
  default: string;
19
21
  };
22
+ size: (NumberConstructor | StringConstructor)[];
23
+ color: StringConstructor;
20
24
  }>> & {
21
25
  [x: string & `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
22
26
  }>>;
@@ -132,6 +136,8 @@ export declare const HzztIcon: import("hzzt-plus/es/utils").SFCWithInstall<impor
132
136
  type: StringConstructor;
133
137
  default: string;
134
138
  };
139
+ size: (NumberConstructor | StringConstructor)[];
140
+ color: StringConstructor;
135
141
  }>>, {
136
142
  type: string;
137
143
  }>> & {
@@ -19,19 +19,24 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
19
19
  type: {
20
20
  type: String,
21
21
  default: "el"
22
- }
22
+ },
23
+ size: [String, Number],
24
+ color: String
23
25
  },
24
26
  setup(__props) {
25
27
  const props = __props;
26
28
  const attrs = vue.useAttrs();
27
29
  const componentName = vue.computed(() => `hzzt-${props.type}-${props.name}`);
28
30
  return (_ctx, _cache) => {
29
- return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElIcon), vue.normalizeProps(vue.guardReactiveProps(vue.unref(attrs))), {
31
+ return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElIcon), vue.mergeProps(vue.unref(attrs), {
32
+ size: __props.size,
33
+ color: __props.color
34
+ }), {
30
35
  default: vue.withCtx(() => [
31
36
  (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(componentName))))
32
37
  ]),
33
38
  _: 1
34
- }, 16);
39
+ }, 16, ["size", "color"]);
35
40
  };
36
41
  }
37
42
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../packages/components/icon/src/index.vue"],"sourcesContent":["<template>\n <ElIcon v-bind=\"attrs\">\n <component :is=\"componentName\" />\n </ElIcon>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, useAttrs } from 'vue'\nimport { ElIcon } from 'element-plus'\n\ndefineOptions({\n name: 'HzztIcon',\n})\n\nconst props = defineProps({\n name: {\n type: String,\n required: true,\n },\n type: {\n type: String,\n default: 'el',\n },\n})\n\nconst attrs = useAttrs()\n\nconst componentName = computed(() => `hzzt-${props.type}-${props.name}`)\n</script>\n"],"names":["useAttrs","computed"],"mappings":";;;;;;;;uCAUc,CAAA;AAAA,EACZ,IAAM,EAAA,UAAA;AACR,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;AAaA,IAAA,MAAM,QAAQA,YAAS,EAAA,CAAA;AAEvB,IAAM,MAAA,aAAA,GAAgBC,aAAS,MAAM,CAAA,KAAA,EAAQ,MAAM,IAAI,CAAA,CAAA,EAAI,KAAM,CAAA,IAAI,CAAE,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../packages/components/icon/src/index.vue"],"sourcesContent":["<template>\n <ElIcon v-bind=\"attrs\" :size=\"size\" :color=\"color\">\n <component :is=\"componentName\" />\n </ElIcon>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, useAttrs } from 'vue'\nimport { ElIcon } from 'element-plus'\n\ndefineOptions({\n name: 'HzztIcon',\n})\n\nconst props = defineProps({\n name: {\n type: String,\n required: true,\n },\n type: {\n type: String,\n default: 'el',\n },\n size: [String, Number],\n color: String,\n})\n\nconst attrs = useAttrs()\n\nconst componentName = computed(() => `hzzt-${props.type}-${props.name}`)\n</script>\n"],"names":["useAttrs","computed"],"mappings":";;;;;;;;uCAUc,CAAA;AAAA,EACZ,IAAM,EAAA,UAAA;AACR,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;AAeA,IAAA,MAAM,QAAQA,YAAS,EAAA,CAAA;AAEvB,IAAM,MAAA,aAAA,GAAgBC,aAAS,MAAM,CAAA,KAAA,EAAQ,MAAM,IAAI,CAAA,CAAA,EAAI,KAAM,CAAA,IAAI,CAAE,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;"}
@@ -7,6 +7,8 @@ declare const _default: import("vue").DefineComponent<{
7
7
  type: StringConstructor;
8
8
  default: string;
9
9
  };
10
+ size: (NumberConstructor | StringConstructor)[];
11
+ color: StringConstructor;
10
12
  }, {
11
13
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
12
14
  name: {
@@ -17,6 +19,8 @@ declare const _default: import("vue").DefineComponent<{
17
19
  type: StringConstructor;
18
20
  default: string;
19
21
  };
22
+ size: (NumberConstructor | StringConstructor)[];
23
+ color: StringConstructor;
20
24
  }>> & {
21
25
  [x: string & `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
22
26
  }>>;
@@ -132,6 +136,8 @@ declare const _default: import("vue").DefineComponent<{
132
136
  type: StringConstructor;
133
137
  default: string;
134
138
  };
139
+ size: (NumberConstructor | StringConstructor)[];
140
+ color: StringConstructor;
135
141
  }>>, {
136
142
  type: string;
137
143
  }>;
@@ -33,8 +33,8 @@ var selectTextarea = require('./select-textarea/src/select-textarea.js');
33
33
  var inputRange = require('./input-range/src/input-range.js');
34
34
  var cascader = require('./cascader/src/cascader.js');
35
35
  var select = require('./select/src/select.js');
36
- var clickInput = require('./click-input/src/click-input2.js');
37
- var lazyList = require('./lazy-list/src/lazy-list.js');
36
+ var clickInput = require('./click-input/src/click-input.js');
37
+ var lazyList = require('./lazy-list/src/lazy-list2.js');
38
38
 
39
39
 
40
40
 
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('../../utils/index.js');
6
- var lazyList$1 = require('./src/lazy-list2.js');
7
- var lazyList = require('./src/lazy-list.js');
6
+ var lazyList$1 = require('./src/lazy-list.js');
7
+ var lazyList = require('./src/lazy-list2.js');
8
8
  var install = require('../../utils/vue/install.js');
9
9
 
10
10
  const HzztLazyList = install.withInstall(lazyList$1["default"]);
@@ -2,31 +2,88 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('../../../utils/index.js');
6
- var runtime = require('../../../utils/vue/props/runtime.js');
5
+ var vue = require('vue');
6
+ var lazyList = require('./lazy-list2.js');
7
+ require('../../../hooks/index.js');
8
+ var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
9
+ var index = require('../../../hooks/use-namespace/index.js');
7
10
 
8
- const lazyListProps = runtime.buildProps({
9
- size: {
10
- type: Number,
11
- default: 20
12
- },
13
- height: {
14
- type: Number,
15
- default: 30
16
- },
17
- data: {
18
- type: runtime.definePropType(Array),
19
- default: () => []
20
- },
21
- rowKey: {
22
- type: String,
23
- default: "id"
11
+ const _hoisted_1 = ["onClick"];
12
+ const __default__ = vue.defineComponent({
13
+ name: "HzztLazyList"
14
+ });
15
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
16
+ ...__default__,
17
+ props: lazyList.lazyListProps,
18
+ emits: lazyList.lazyListEmits,
19
+ setup(__props, { emit }) {
20
+ const props = __props;
21
+ const totalHeight = vue.ref("100%");
22
+ const marginTop = vue.ref("0px");
23
+ const currentIndex = vue.ref(1);
24
+ const current = vue.ref(null);
25
+ const nsLazy = index.useNamespace("lazy-list");
26
+ const containerCls = vue.computed(() => [
27
+ "overflow-y-auto",
28
+ nsLazy.b()
29
+ ]);
30
+ vue.watch(() => props.data, () => {
31
+ totalHeight.value = props.data.length * props.height + "px";
32
+ }, {
33
+ immediate: true
34
+ });
35
+ const calcList = vue.computed(() => props.data.slice(currentIndex.value === 1 ? 0 : (currentIndex.value - 1) * props.size - props.size / 2, (currentIndex.value + 1) * props.size + props.size / 2));
36
+ function scrollList(e) {
37
+ const target = e.target;
38
+ const scrollTop = target.scrollTop;
39
+ if (scrollTop < props.size / 2 * props.height) {
40
+ currentIndex.value = 1;
41
+ } else {
42
+ currentIndex.value = Math.ceil((scrollTop - props.size / 2 * props.height) / props.size / props.height);
43
+ }
44
+ if (currentIndex.value === 1) {
45
+ marginTop.value = "0px";
46
+ } else {
47
+ marginTop.value = ((currentIndex.value - 1) * props.size - props.size / 2) * props.height + "px";
48
+ }
49
+ }
50
+ function rowClick(row) {
51
+ current.value = row;
52
+ emit("row-click", row);
53
+ }
54
+ return (_ctx, _cache) => {
55
+ return vue.openBlock(), vue.createElementBlock("div", {
56
+ class: vue.normalizeClass(vue.unref(containerCls)),
57
+ onScroll: scrollList
58
+ }, [
59
+ vue.createElementVNode("div", {
60
+ style: vue.normalizeStyle({
61
+ height: totalHeight.value,
62
+ width: 0,
63
+ float: "left"
64
+ })
65
+ }, null, 4),
66
+ vue.createElementVNode("div", {
67
+ style: vue.normalizeStyle({ marginTop: marginTop.value })
68
+ }, [
69
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(calcList), (item) => {
70
+ return vue.openBlock(), vue.createElementBlock("div", {
71
+ key: item[_ctx.rowKey],
72
+ style: vue.normalizeStyle({
73
+ height: _ctx.height + "px"
74
+ }),
75
+ class: vue.normalizeClass(["hzzt-lazy-list__item", current.value === item ? "is-active" : ""]),
76
+ onClick: ($event) => rowClick(item)
77
+ }, [
78
+ vue.renderSlot(_ctx.$slots, "default", { data: item })
79
+ ], 14, _hoisted_1);
80
+ }), 128))
81
+ ], 4)
82
+ ], 34);
83
+ };
24
84
  }
25
85
  });
26
- const lazyListEmits = {
27
- "row-click": (row) => row
28
- };
86
+ var LazyList = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "lazy-list.vue"]]);
29
87
 
30
- exports.lazyListEmits = lazyListEmits;
31
- exports.lazyListProps = lazyListProps;
88
+ exports["default"] = LazyList;
32
89
  //# sourceMappingURL=lazy-list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lazy-list.js","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":["buildProps","definePropType"],"mappings":";;;;;;;AACY,MAAC,aAAa,GAAGA,kBAAU,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,EAAEC,sBAAc,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
+ {"version":3,"file":"lazy-list.js","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":["ref","useNamespace","computed","watch","_openBlock","_createElementBlock"],"mappings":";;;;;;;;;;;uCA8BgB,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,WAAA,GAAcA,QAAI,MAAM,CAAA,CAAA;AAC9B,IAAM,MAAA,SAAA,GAAYA,QAAI,KAAK,CAAA,CAAA;AAC3B,IAAM,MA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AA,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,OAAAE,aAAA,EAAA,EAAAC,sBAAA,CAAA,KAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,88 +2,31 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var vue = require('vue');
6
- var lazyList = require('./lazy-list.js');
7
- require('../../../hooks/index.js');
8
- var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
9
- var index = require('../../../hooks/use-namespace/index.js');
5
+ require('../../../utils/index.js');
6
+ var runtime = require('../../../utils/vue/props/runtime.js');
10
7
 
11
- const _hoisted_1 = ["onClick"];
12
- const __default__ = vue.defineComponent({
13
- name: "HzztLazyList"
14
- });
15
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
16
- ...__default__,
17
- props: lazyList.lazyListProps,
18
- emits: lazyList.lazyListEmits,
19
- setup(__props, { emit }) {
20
- const props = __props;
21
- const totalHeight = vue.ref("100%");
22
- const marginTop = vue.ref("0px");
23
- const currentIndex = vue.ref(1);
24
- const current = vue.ref(null);
25
- const nsLazy = index.useNamespace("lazy-list");
26
- const containerCls = vue.computed(() => [
27
- "overflow-y-auto",
28
- nsLazy.b()
29
- ]);
30
- vue.watch(() => props.data, () => {
31
- totalHeight.value = props.data.length * props.height + "px";
32
- }, {
33
- immediate: true
34
- });
35
- const calcList = vue.computed(() => props.data.slice(currentIndex.value === 1 ? 0 : (currentIndex.value - 1) * props.size - props.size / 2, (currentIndex.value + 1) * props.size + props.size / 2));
36
- function scrollList(e) {
37
- const target = e.target;
38
- const scrollTop = target.scrollTop;
39
- if (scrollTop < props.size / 2 * props.height) {
40
- currentIndex.value = 1;
41
- } else {
42
- currentIndex.value = Math.ceil((scrollTop - props.size / 2 * props.height) / props.size / props.height);
43
- }
44
- if (currentIndex.value === 1) {
45
- marginTop.value = "0px";
46
- } else {
47
- marginTop.value = ((currentIndex.value - 1) * props.size - props.size / 2) * props.height + "px";
48
- }
49
- }
50
- function rowClick(row) {
51
- current.value = row;
52
- emit("row-click", row);
53
- }
54
- return (_ctx, _cache) => {
55
- return vue.openBlock(), vue.createElementBlock("div", {
56
- class: vue.normalizeClass(vue.unref(containerCls)),
57
- onScroll: scrollList
58
- }, [
59
- vue.createElementVNode("div", {
60
- style: vue.normalizeStyle({
61
- height: totalHeight.value,
62
- width: 0,
63
- float: "left"
64
- })
65
- }, null, 4),
66
- vue.createElementVNode("div", {
67
- style: vue.normalizeStyle({ marginTop: marginTop.value })
68
- }, [
69
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(calcList), (item) => {
70
- return vue.openBlock(), vue.createElementBlock("div", {
71
- key: item[_ctx.rowKey],
72
- style: vue.normalizeStyle({
73
- height: _ctx.height + "px"
74
- }),
75
- class: vue.normalizeClass(["hzzt-lazy-list__item", current.value === item ? "is-active" : ""]),
76
- onClick: ($event) => rowClick(item)
77
- }, [
78
- vue.renderSlot(_ctx.$slots, "default", { data: item })
79
- ], 14, _hoisted_1);
80
- }), 128))
81
- ], 4)
82
- ], 34);
83
- };
8
+ const lazyListProps = runtime.buildProps({
9
+ size: {
10
+ type: Number,
11
+ default: 20
12
+ },
13
+ height: {
14
+ type: Number,
15
+ default: 30
16
+ },
17
+ data: {
18
+ type: runtime.definePropType(Array),
19
+ default: () => []
20
+ },
21
+ rowKey: {
22
+ type: String,
23
+ default: "id"
84
24
  }
85
25
  });
86
- var LazyList = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "lazy-list.vue"]]);
26
+ const lazyListEmits = {
27
+ "row-click": (row) => row
28
+ };
87
29
 
88
- exports["default"] = LazyList;
30
+ exports.lazyListEmits = lazyListEmits;
31
+ exports.lazyListProps = lazyListProps;
89
32
  //# sourceMappingURL=lazy-list2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lazy-list2.js","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":["ref","useNamespace","computed","watch","_openBlock","_createElementBlock"],"mappings":";;;;;;;;;;;uCA8BgB,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,WAAA,GAAcA,QAAI,MAAM,CAAA,CAAA;AAC9B,IAAM,MAAA,SAAA,GAAYA,QAAI,KAAK,CAAA,CAAA;AAC3B,IAAM,MAAA,YAAA,GAAeA,QAAI,CAAC,CAAA,CAAA;AAC1B,IAAM,MAAA,OAAA,GAAUA,QAAI,IAAI,CAAA,CAAA;AAExB,IAAM,MAAA,MAAA,GAASC,mBAAa,WAAW,CAAA,CAAA;AAEvC,IAAM,MAAA,YAAA,GAAeC,aAAS,MAAM;AAAA,MAClC,iBAAA;AAAA,MACA,OAAO,CAAE,EAAA;AAAA,KACV,CAAA,CAAA;AAED,IAAMC,SAAA,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,EAA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,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,OAAAE,aAAA,EAAA,EAAAC,sBAAA,CAAA,KAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"lazy-list2.js","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":["buildProps","definePropType"],"mappings":";;;;;;;AACY,MAAC,aAAa,GAAGA,kBAAU,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,EAAEC,sBAAc,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;;;;;"}
@@ -13093,6 +13093,8 @@ export declare const HzztPageSize: import("hzzt-plus/es/utils").SFCWithInstall<i
13093
13093
  type: StringConstructor;
13094
13094
  default: string;
13095
13095
  };
13096
+ size: (NumberConstructor | StringConstructor)[];
13097
+ color: StringConstructor;
13096
13098
  }, {
13097
13099
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
13098
13100
  name: {
@@ -13103,6 +13105,8 @@ export declare const HzztPageSize: import("hzzt-plus/es/utils").SFCWithInstall<i
13103
13105
  type: StringConstructor;
13104
13106
  default: string;
13105
13107
  };
13108
+ size: (NumberConstructor | StringConstructor)[];
13109
+ color: StringConstructor;
13106
13110
  }>> & {
13107
13111
  [x: string & `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
13108
13112
  }>>;
@@ -13218,6 +13222,8 @@ export declare const HzztPageSize: import("hzzt-plus/es/utils").SFCWithInstall<i
13218
13222
  type: StringConstructor;
13219
13223
  default: string;
13220
13224
  };
13225
+ size: (NumberConstructor | StringConstructor)[];
13226
+ color: StringConstructor;
13221
13227
  }>>, {
13222
13228
  type: string;
13223
13229
  }>;