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.
- package/dist/index.css +1 -1
- package/dist/index.full.js +55 -8
- package/dist/index.full.min.js +14 -14
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +15 -15
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +55 -8
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/es/components/cascader/src/cascader.d.ts +1 -0
- package/es/components/cascader/src/cascader.mjs +4 -0
- package/es/components/cascader/src/cascader.mjs.map +1 -1
- package/es/components/cascader/src/cascader.vue.d.ts +7 -0
- package/es/components/cascader/src/cascader2.mjs +37 -3
- package/es/components/cascader/src/cascader2.mjs.map +1 -1
- package/es/components/click-input/index.mjs +2 -2
- package/es/components/click-input/src/click-input.mjs +21 -84
- package/es/components/click-input/src/click-input.mjs.map +1 -1
- package/es/components/click-input/src/click-input2.mjs +84 -21
- package/es/components/click-input/src/click-input2.mjs.map +1 -1
- package/es/components/collapse/index.d.ts +6 -0
- package/es/components/collapse/src/collapse.vue.d.ts +6 -0
- package/es/components/collapse/src/collapse2.mjs +4 -0
- package/es/components/collapse/src/collapse2.mjs.map +1 -1
- package/es/components/icon/index.d.ts +6 -0
- package/es/components/icon/src/index.mjs +9 -4
- package/es/components/icon/src/index.mjs.map +1 -1
- package/es/components/icon/src/index.vue.d.ts +6 -0
- package/es/components/index.mjs +2 -2
- package/es/components/lazy-list/index.mjs +2 -2
- package/es/components/lazy-list/src/lazy-list.mjs +80 -22
- package/es/components/lazy-list/src/lazy-list.mjs.map +1 -1
- package/es/components/lazy-list/src/lazy-list2.mjs +22 -80
- package/es/components/lazy-list/src/lazy-list2.mjs.map +1 -1
- package/es/components/page-size/index.d.ts +6 -0
- package/es/components/page-size/src/index.vue.d.ts +6 -0
- package/es/components/pagination/index.d.ts +6 -0
- package/es/components/pagination/src/index.vue.d.ts +6 -0
- package/es/components/quarter-picker/index.d.ts +6 -0
- package/es/components/quarter-picker/src/index.vue.d.ts +6 -0
- package/es/components/scroll/src/scroll.vue.d.ts +6 -0
- package/es/components/select/src/select.vue.d.ts +6 -0
- package/es/components/tab/index.d.ts +6 -0
- package/es/components/tab/src/index.vue.d.ts +6 -0
- package/es/index.mjs +2 -2
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/cascader/src/cascader.d.ts +1 -0
- package/lib/components/cascader/src/cascader.js +4 -0
- package/lib/components/cascader/src/cascader.js.map +1 -1
- package/lib/components/cascader/src/cascader.vue.d.ts +7 -0
- package/lib/components/cascader/src/cascader2.js +37 -3
- package/lib/components/cascader/src/cascader2.js.map +1 -1
- package/lib/components/click-input/index.js +2 -2
- package/lib/components/click-input/src/click-input.js +22 -84
- package/lib/components/click-input/src/click-input.js.map +1 -1
- package/lib/components/click-input/src/click-input2.js +84 -22
- package/lib/components/click-input/src/click-input2.js.map +1 -1
- package/lib/components/collapse/index.d.ts +6 -0
- package/lib/components/collapse/src/collapse.vue.d.ts +6 -0
- package/lib/components/collapse/src/collapse2.js +4 -0
- package/lib/components/collapse/src/collapse2.js.map +1 -1
- package/lib/components/icon/index.d.ts +6 -0
- package/lib/components/icon/src/index.js +8 -3
- package/lib/components/icon/src/index.js.map +1 -1
- package/lib/components/icon/src/index.vue.d.ts +6 -0
- package/lib/components/index.js +2 -2
- package/lib/components/lazy-list/index.js +2 -2
- package/lib/components/lazy-list/src/lazy-list.js +80 -23
- package/lib/components/lazy-list/src/lazy-list.js.map +1 -1
- package/lib/components/lazy-list/src/lazy-list2.js +23 -80
- package/lib/components/lazy-list/src/lazy-list2.js.map +1 -1
- package/lib/components/page-size/index.d.ts +6 -0
- package/lib/components/page-size/src/index.vue.d.ts +6 -0
- package/lib/components/pagination/index.d.ts +6 -0
- package/lib/components/pagination/src/index.vue.d.ts +6 -0
- package/lib/components/quarter-picker/index.d.ts +6 -0
- package/lib/components/quarter-picker/src/index.vue.d.ts +6 -0
- package/lib/components/scroll/src/scroll.vue.d.ts +6 -0
- package/lib/components/select/src/select.vue.d.ts +6 -0
- package/lib/components/tab/index.d.ts +6 -0
- package/lib/components/tab/src/index.vue.d.ts +6 -0
- package/lib/index.js +2 -2
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
- package/theme/hzzt-cascader.css +1 -1
- package/theme/index.css +1 -1
- package/theme/src/cascader.scss +3 -0
- package/web-types.json +1 -1
|
@@ -1,26 +1,89 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import { defineComponent, ref, computed, watch, nextTick, openBlock, createElementBlock, normalizeClass, unref, createBlock, mergeProps, withKeys, toDisplayString } from 'vue';
|
|
2
|
+
import { clickInputProps, clickInputEmits } from './click-input.mjs';
|
|
2
3
|
import '../../../hooks/index.mjs';
|
|
3
|
-
import '
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { isString } from '@vue/shared';
|
|
4
|
+
import { useFormSize, useFormDisabled, ElInput } from 'element-plus';
|
|
5
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
6
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
7
|
+
import { useGlobalSize } from '../../../hooks/use-size/index.mjs';
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
type: String,
|
|
12
|
-
default: ""
|
|
13
|
-
},
|
|
14
|
-
disabled: Boolean,
|
|
15
|
-
readonly: Boolean,
|
|
16
|
-
inputProps: Object,
|
|
17
|
-
size: useSizeProp
|
|
9
|
+
const __default__ = defineComponent({
|
|
10
|
+
name: "HzztClickInput"
|
|
18
11
|
});
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
12
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
|
+
...__default__,
|
|
14
|
+
props: clickInputProps,
|
|
15
|
+
emits: clickInputEmits,
|
|
16
|
+
setup(__props, { emit }) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
const _inputVal = ref(props.modelValue || "");
|
|
19
|
+
const inputVal = ref(props.modelValue || "");
|
|
20
|
+
const inputRef = ref();
|
|
21
|
+
const editable = ref(false);
|
|
22
|
+
const nsInput = useNamespace("click-input");
|
|
23
|
+
const formSize = useFormSize();
|
|
24
|
+
const formDisabled = useFormDisabled();
|
|
25
|
+
const trueSize = computed(() => props.size || formSize.value || useGlobalSize().value);
|
|
26
|
+
const trueDisabled = computed(() => props.disabled || formDisabled.value);
|
|
27
|
+
const trueReadonly = computed(() => trueDisabled.value || props.readonly || !editable.value);
|
|
28
|
+
const containerCls = computed(() => [
|
|
29
|
+
nsInput.b(),
|
|
30
|
+
nsInput.m(trueSize.value),
|
|
31
|
+
"flex width-100% align-items-center"
|
|
32
|
+
]);
|
|
33
|
+
const spanClass = computed(() => [
|
|
34
|
+
nsInput.e("span"),
|
|
35
|
+
"flex width-100% align-items-center"
|
|
36
|
+
]);
|
|
37
|
+
watch(() => props.modelValue, (v) => {
|
|
38
|
+
inputVal.value = v || "";
|
|
39
|
+
_inputVal.value = v || "";
|
|
40
|
+
});
|
|
41
|
+
function input(val) {
|
|
42
|
+
emit("update:modelValue", val);
|
|
43
|
+
emit("input", val);
|
|
44
|
+
}
|
|
45
|
+
function change() {
|
|
46
|
+
editable.value = false;
|
|
47
|
+
if (_inputVal.value === inputVal.value) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
input(inputVal.value);
|
|
51
|
+
emit("change", inputVal.value);
|
|
52
|
+
}
|
|
53
|
+
function edit() {
|
|
54
|
+
if (trueDisabled.value || props.readonly) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
editable.value = true;
|
|
58
|
+
nextTick(() => {
|
|
59
|
+
inputRef.value.focus();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return (_ctx, _cache) => {
|
|
63
|
+
return openBlock(), createElementBlock("div", {
|
|
64
|
+
class: normalizeClass(unref(containerCls))
|
|
65
|
+
}, [
|
|
66
|
+
!unref(trueReadonly) ? (openBlock(), createBlock(unref(ElInput), mergeProps({
|
|
67
|
+
key: 0,
|
|
68
|
+
ref_key: "inputRef",
|
|
69
|
+
ref: inputRef,
|
|
70
|
+
modelValue: inputVal.value,
|
|
71
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputVal.value = $event)
|
|
72
|
+
}, _ctx.inputProps, {
|
|
73
|
+
clearable: "",
|
|
74
|
+
size: unref(trueSize),
|
|
75
|
+
onKeyup: withKeys(change, ["enter"]),
|
|
76
|
+
onBlur: change
|
|
77
|
+
}), null, 16, ["modelValue", "size", "onKeyup"])) : (openBlock(), createElementBlock("div", {
|
|
78
|
+
key: 1,
|
|
79
|
+
class: normalizeClass(["width-100%", unref(spanClass)]),
|
|
80
|
+
onClick: edit
|
|
81
|
+
}, toDisplayString(inputVal.value || " "), 3))
|
|
82
|
+
], 2);
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
var ClickInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "click-input.vue"]]);
|
|
24
87
|
|
|
25
|
-
export {
|
|
88
|
+
export { ClickInput as default };
|
|
26
89
|
//# sourceMappingURL=click-input2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"click-input2.mjs","sources":["../../../../../../packages/components/click-input/src/click-input.
|
|
1
|
+
{"version":3,"file":"click-input2.mjs","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":["_openBlock","_createElementBlock"],"mappings":";;;;;;;;mCAyBgB,CAAA;AAAA,EACZ,IAAM,EAAA,gBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAA,MAAM,SAAY,GAAA,GAAA,CAAI,KAAM,CAAA,UAAA,IAAc,EAAE,CAAA,CAAA;AAC5C,IAAA,MAAM,QAAW,GAAA,GAAA,CAAI,KAAM,CAAA,UAAA,IAAc,EAAE,CAAA,CAAA;AAC3C,IAAA,MAAM,WAAW,GAAI,EAAA,CAAA;AACrB,IAAM,MAAA,QAAA,GAAW,IAAI,KAAK,CAAA,CAAA;AAE1B,IAAM,MAAA,OAAA,GAAU,aAAa,aAAa,CAAA,CAAA;AAC1C,IAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAC7B,IAAA,MAAM,eAAe,eAAgB,EAAA,CAAA;AAErC,IAAA,MAAM,QAAW,GAAA,QAAA,CAAA,MAAA,KAAA,CAAA,IAAA,IAAA,QAAA,CAAA,KAAA,IAAA,aAAA,EAAA,CAAA,KAAA,CAAA,CAAA;AAAA,IAAA,kBACH,GAAA,QAAiB,CAAA,MAAA,kBAAuB,YAAE,CAAA,KAAA,CAAA,CAAA;AAAA,IACxD,MAAA,YAAA,GAAA,QAAA,CAAA,MAAA,YAAA,CAAA,KAAA,IAAA,KAAA,CAAA,QAAA,IAAA,CAAA,QAAA,CAAA,KAAA,CAAA,CAAA;AAEA,IAAA,MAAM,eAAe,QAAS,CAAA,MAAM;AAEpC,MAAM,OAAA,CAAA,CAAA,EAAA;AAEN,MAAM,OAAA,CAAA,CAAA,CAAA,QAAA,CAAe;AAAe,MAClC,oCAAU;AAAA,KACV,CAAA,CAAA;AAAwB,IACxB,MAAA,SAAA,GAAA,QAAA,CAAA,MAAA;AAAA,MACD,OAAA,CAAA,CAAA,CAAA,MAAA,CAAA;AAED,MAAM,oCAA2B;AAAA,KAC/B,CAAA,CAAA;AAAgB,IAChB,KAAA,CAAA,MAAA,KAAA,CAAA,UAAA,EAAA,CAAA,CAAA,KAAA;AAAA,MACD,QAAA,CAAA,KAAA,GAAA,CAAA,IAAA,EAAA,CAAA;AAED,MAAA,SAAY,CAAA,KAAA,GAAkB,CAAA,IAAA,EAAA,CAAA;AAC5B,KAAA,CAAA,CAAA;AACA,IAAA,SAAA,WAAkB;AAAK,MACxB,IAAA,CAAA,mBAAA,EAAA,GAAA,CAAA,CAAA;AAED,MAAA,IAAA,CAAA,SAA4B,GAAA,CAAA,CAAA;AAC1B,KAAA;AACA,IAAA,kBAAiB;AAAA,MACnB,QAAA,CAAA,KAAA,GAAA,KAAA,CAAA;AAEA,MAAA,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,MACF,QAAA,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,OAAAA,SAAA,EAAA,EAAAC,kBAAA,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
|
}>;
|
|
@@ -44,6 +44,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
44
44
|
emit("update:modelValue", false);
|
|
45
45
|
expand.value = false;
|
|
46
46
|
}
|
|
47
|
+
watch(() => props.defaultActive, (v) => {
|
|
48
|
+
emit("update:modelValue", v);
|
|
49
|
+
expand.value = v;
|
|
50
|
+
});
|
|
47
51
|
watch(() => props.modelValue, (v) => {
|
|
48
52
|
expand.value = v;
|
|
49
53
|
});
|
|
@@ -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":["../../../../../../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":[],"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,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,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -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
|
}>> & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useAttrs, computed, openBlock, createBlock, unref,
|
|
1
|
+
import { defineComponent, useAttrs, computed, openBlock, createBlock, unref, mergeProps, withCtx, resolveDynamicComponent } from 'vue';
|
|
2
2
|
import { ElIcon } from 'element-plus';
|
|
3
3
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
4
4
|
|
|
@@ -15,19 +15,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15
15
|
type: {
|
|
16
16
|
type: String,
|
|
17
17
|
default: "el"
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
|
+
size: [String, Number],
|
|
20
|
+
color: String
|
|
19
21
|
},
|
|
20
22
|
setup(__props) {
|
|
21
23
|
const props = __props;
|
|
22
24
|
const attrs = useAttrs();
|
|
23
25
|
const componentName = computed(() => `hzzt-${props.type}-${props.name}`);
|
|
24
26
|
return (_ctx, _cache) => {
|
|
25
|
-
return openBlock(), createBlock(unref(ElIcon),
|
|
27
|
+
return openBlock(), createBlock(unref(ElIcon), mergeProps(unref(attrs), {
|
|
28
|
+
size: __props.size,
|
|
29
|
+
color: __props.color
|
|
30
|
+
}), {
|
|
26
31
|
default: withCtx(() => [
|
|
27
32
|
(openBlock(), createBlock(resolveDynamicComponent(unref(componentName))))
|
|
28
33
|
]),
|
|
29
34
|
_: 1
|
|
30
|
-
}, 16);
|
|
35
|
+
}, 16, ["size", "color"]);
|
|
31
36
|
};
|
|
32
37
|
}
|
|
33
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","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":[],"mappings":";;;;mCAUc,CAAA;AAAA,EACZ,IAAM,EAAA,UAAA;AACR,CAAA,CAAA,CAAA
|
|
1
|
+
{"version":3,"file":"index.mjs","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":[],"mappings":";;;;mCAUc,CAAA;AAAA,EACZ,IAAM,EAAA,UAAA;AACR,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;AAeA,IAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AAEvB,IAAM,MAAA,aAAA,GAAgB,SAAS,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
|
}>;
|
package/es/components/index.mjs
CHANGED
|
@@ -29,6 +29,6 @@ export { selectTextareaEmits, selectTextareaProps } from './select-textarea/src/
|
|
|
29
29
|
export { inputRangeEmits, inputRangeProps } from './input-range/src/input-range.mjs';
|
|
30
30
|
export { cascaderEmits, cascaderProps } from './cascader/src/cascader.mjs';
|
|
31
31
|
export { selectEmits, selectProps } from './select/src/select.mjs';
|
|
32
|
-
export { clickInputEmits, clickInputProps } from './click-input/src/click-
|
|
33
|
-
export { lazyListEmits, lazyListProps } from './lazy-list/src/lazy-
|
|
32
|
+
export { clickInputEmits, clickInputProps } from './click-input/src/click-input.mjs';
|
|
33
|
+
export { lazyListEmits, lazyListProps } from './lazy-list/src/lazy-list2.mjs';
|
|
34
34
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
|
-
import LazyList from './src/lazy-
|
|
3
|
-
export { lazyListEmits, lazyListProps } from './src/lazy-
|
|
2
|
+
import LazyList from './src/lazy-list.mjs';
|
|
3
|
+
export { lazyListEmits, lazyListProps } from './src/lazy-list2.mjs';
|
|
4
4
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
5
5
|
|
|
6
6
|
const HzztLazyList = withInstall(LazyList);
|
|
@@ -1,27 +1,85 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import {
|
|
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';
|
|
3
6
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
23
|
-
"row-click": (row) => row
|
|
24
|
-
};
|
|
82
|
+
var LazyList = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "lazy-list.vue"]]);
|
|
25
83
|
|
|
26
|
-
export {
|
|
84
|
+
export { LazyList as default };
|
|
27
85
|
//# sourceMappingURL=lazy-list.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-list.mjs","sources":["../../../../../../packages/components/lazy-list/src/lazy-list.
|
|
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,85 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
22
|
+
const lazyListEmits = {
|
|
23
|
+
"row-click": (row) => row
|
|
24
|
+
};
|
|
83
25
|
|
|
84
|
-
export {
|
|
26
|
+
export { lazyListEmits, lazyListProps };
|
|
85
27
|
//# sourceMappingURL=lazy-list2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-list2.mjs","sources":["../../../../../../packages/components/lazy-list/src/lazy-list.
|
|
1
|
+
{"version":3,"file":"lazy-list2.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;;;;"}
|
|
@@ -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
|
}>;
|