hzzt-plus 2.0.2 → 2.0.3

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 (58) hide show
  1. package/dist/index.full.js +6 -2
  2. package/dist/index.full.min.js +5 -5
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +5 -5
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +6 -2
  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/index.mjs +2 -2
  16. package/es/components/input-range/index.mjs +2 -2
  17. package/es/components/input-range/src/input-range.mjs +26 -76
  18. package/es/components/input-range/src/input-range.mjs.map +1 -1
  19. package/es/components/input-range/src/input-range2.mjs +76 -26
  20. package/es/components/input-range/src/input-range2.mjs.map +1 -1
  21. package/es/components/scroll/index.mjs +2 -2
  22. package/es/components/scroll/src/scroll.mjs +90 -0
  23. package/es/components/scroll/src/scroll.mjs.map +1 -1
  24. package/es/components/scroll/src/scroll.vue.d.ts +1 -0
  25. package/es/components/scroll/src/scroll2.mjs +0 -86
  26. package/es/components/scroll/src/scroll2.mjs.map +1 -1
  27. package/es/components/select-input/index.mjs +2 -2
  28. package/es/components/select-input/src/select-input.mjs +124 -45
  29. package/es/components/select-input/src/select-input.mjs.map +1 -1
  30. package/es/components/select-input/src/select-input2.mjs +45 -124
  31. package/es/components/select-input/src/select-input2.mjs.map +1 -1
  32. package/es/index.mjs +2 -2
  33. package/es/version.d.ts +1 -1
  34. package/es/version.mjs +1 -1
  35. package/es/version.mjs.map +1 -1
  36. package/lib/components/index.js +2 -2
  37. package/lib/components/input-range/index.js +2 -2
  38. package/lib/components/input-range/src/input-range.js +27 -76
  39. package/lib/components/input-range/src/input-range.js.map +1 -1
  40. package/lib/components/input-range/src/input-range2.js +76 -27
  41. package/lib/components/input-range/src/input-range2.js.map +1 -1
  42. package/lib/components/scroll/index.js +2 -2
  43. package/lib/components/scroll/src/scroll.js +93 -0
  44. package/lib/components/scroll/src/scroll.js.map +1 -1
  45. package/lib/components/scroll/src/scroll.vue.d.ts +1 -0
  46. package/lib/components/scroll/src/scroll2.js +0 -89
  47. package/lib/components/scroll/src/scroll2.js.map +1 -1
  48. package/lib/components/select-input/index.js +2 -2
  49. package/lib/components/select-input/src/select-input.js +124 -46
  50. package/lib/components/select-input/src/select-input.js.map +1 -1
  51. package/lib/components/select-input/src/select-input2.js +46 -124
  52. package/lib/components/select-input/src/select-input2.js.map +1 -1
  53. package/lib/index.js +2 -2
  54. package/lib/version.d.ts +1 -1
  55. package/lib/version.js +1 -1
  56. package/lib/version.js.map +1 -1
  57. package/package.json +1 -1
  58. package/web-types.json +1 -1
@@ -2,35 +2,84 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('../../../utils/index.js');
5
+ var vue = require('vue');
6
+ var inputRange = require('./input-range.js');
7
+ var elementPlus = require('element-plus');
6
8
  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');
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 inputRangeProps = runtime.buildProps({
14
- modelValue: {
15
- type: Array,
16
- default: () => []
17
- },
18
- size: index.useSizeProp,
19
- disabled: Boolean,
20
- clearable: {
21
- type: Boolean,
22
- default: false
23
- },
24
- startPlaceholder: String,
25
- endPlaceholder: String,
26
- startProps: Object,
27
- endProps: Object
13
+ const _hoisted_1 = /* @__PURE__ */ vue.createElementVNode("span", { class: "margin-h-1" }, "\u2014\u2014", -1);
14
+ const __default__ = vue.defineComponent({
15
+ name: "HzztInputRange"
28
16
  });
29
- const inputRangeEmits = {
30
- [event.UPDATE_MODEL_EVENT]: (val) => shared.isArray(val),
31
- [event.CHANGE_EVENT]: (val) => shared.isArray(val)
32
- };
17
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
18
+ ...__default__,
19
+ props: inputRange.inputRangeProps,
20
+ emits: inputRange.inputRangeEmits,
21
+ setup(__props, { emit }) {
22
+ const props = __props;
23
+ const startValue = vue.ref(props.modelValue[0]);
24
+ const endValue = vue.ref(props.modelValue[1]);
25
+ const nsInput = index.useNamespace("input-range");
26
+ const formSize = elementPlus.useFormSize();
27
+ const formDisabled = elementPlus.useFormDisabled();
28
+ const trueSize = vue.computed(() => props.size || formSize.value || index$1.useGlobalSize().value);
29
+ const trueDisabled = vue.computed(() => props.disabled || formDisabled.value);
30
+ const containerCls = vue.computed(() => [
31
+ nsInput.b(),
32
+ nsInput.m(trueSize.value)
33
+ ]);
34
+ vue.watch(() => props.modelValue, (v) => {
35
+ startValue.value = v[0];
36
+ endValue.value = v[1];
37
+ }, {
38
+ deep: true
39
+ });
40
+ function change() {
41
+ if (startValue.value || endValue.value) {
42
+ const modelValue = [startValue.value, endValue.value];
43
+ emit("update:modelValue", modelValue);
44
+ emit("change", modelValue);
45
+ } else if (!startValue.value && !endValue.value) {
46
+ emit("update:modelValue", []);
47
+ emit("change", []);
48
+ }
49
+ }
50
+ return (_ctx, _cache) => {
51
+ const _component_el_input = vue.resolveComponent("el-input");
52
+ return vue.openBlock(), vue.createElementBlock("div", {
53
+ class: vue.normalizeClass(["flex align-items-center", vue.unref(containerCls)])
54
+ }, [
55
+ vue.createVNode(_component_el_input, vue.mergeProps({
56
+ modelValue: startValue.value,
57
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => startValue.value = $event)
58
+ }, _ctx.startProps, {
59
+ clearable: _ctx.clearable,
60
+ placeholder: _ctx.startPlaceholder,
61
+ size: vue.unref(trueSize),
62
+ disabled: vue.unref(trueDisabled),
63
+ class: "flex-1",
64
+ onChange: change
65
+ }), null, 16, ["modelValue", "clearable", "placeholder", "size", "disabled"]),
66
+ _hoisted_1,
67
+ vue.createVNode(_component_el_input, vue.mergeProps({
68
+ modelValue: endValue.value,
69
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => endValue.value = $event)
70
+ }, _ctx.endProps, {
71
+ clearable: _ctx.clearable,
72
+ placeholder: _ctx.endPlaceholder,
73
+ size: vue.unref(trueSize),
74
+ disabled: vue.unref(trueDisabled),
75
+ class: "flex-1",
76
+ onChange: change
77
+ }), null, 16, ["modelValue", "clearable", "placeholder", "size", "disabled"])
78
+ ], 2);
79
+ };
80
+ }
81
+ });
82
+ var InputRange = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "input-range.vue"]]);
33
83
 
34
- exports.inputRangeEmits = inputRangeEmits;
35
- exports.inputRangeProps = inputRangeProps;
84
+ exports["default"] = InputRange;
36
85
  //# sourceMappingURL=input-range2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-range2.js","sources":["../../../../../../packages/components/input-range/src/input-range.ts"],"sourcesContent":["import {buildProps, isArray} from '@hzzt-plus/utils'\n\nimport type { ExtractPropTypes } from 'vue'\nimport type InputRange from './input-range.vue'\nimport {useSizeProp} from \"@hzzt-plus/hooks\";\nimport {CHANGE_EVENT, UPDATE_MODEL_EVENT} from \"@hzzt-plus/constants\";\n\nexport const inputRangeProps = buildProps({\n modelValue: {\n type: Array,\n default: () => [],\n },\n size: useSizeProp,\n disabled: Boolean,\n clearable: {\n type: Boolean,\n default: false,\n },\n startPlaceholder: String,\n endPlaceholder: String,\n startProps: Object,\n endProps: Object,\n})\n\nexport type InputRangeProps = ExtractPropTypes<typeof inputRangeProps>\n\nexport const inputRangeEmits = {\n [UPDATE_MODEL_EVENT]: (val: Array<string>) => isArray(val),\n [CHANGE_EVENT]: (val: Array<string>) => isArray(val),\n}\nexport type InputRangeEmits = typeof inputRangeEmits\n\nexport type InputRangeInstance = InstanceType<typeof InputRange>\n"],"names":["buildProps","useSizeProp","UPDATE_MODEL_EVENT","isArray","CHANGE_EVENT"],"mappings":";;;;;;;;;;;;AAGY,MAAC,eAAe,GAAGA,kBAAU,CAAC;AAC1C,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,KAAK;AACf,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,IAAI,EAAEC,iBAAW;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,gBAAgB,EAAE,MAAM;AAC1B,EAAE,cAAc,EAAE,MAAM;AACxB,EAAE,UAAU,EAAE,MAAM;AACpB,EAAE,QAAQ,EAAE,MAAM;AAClB,CAAC,EAAE;AACS,MAAC,eAAe,GAAG;AAC/B,EAAE,CAACC,wBAAkB,GAAG,CAAC,GAAG,KAAKC,cAAO,CAAC,GAAG,CAAC;AAC7C,EAAE,CAACC,kBAAY,GAAG,CAAC,GAAG,KAAKD,cAAO,CAAC,GAAG,CAAC;AACvC;;;;;"}
1
+ {"version":3,"file":"input-range2.js","sources":["../../../../../../packages/components/input-range/src/input-range.vue"],"sourcesContent":["<template>\n <div class=\"flex align-items-center\" :class=\"containerCls\">\n <el-input\n v-model=\"startValue\"\n v-bind=\"startProps\"\n :clearable=\"clearable\"\n :placeholder=\"startPlaceholder\"\n :size=\"trueSize\"\n :disabled=\"trueDisabled\"\n class=\"flex-1\"\n @change=\"change\"\n />\n <span class=\"margin-h-1\">——</span>\n <el-input\n v-model=\"endValue\"\n v-bind=\"endProps\"\n :clearable=\"clearable\"\n :placeholder=\"endPlaceholder\"\n :size=\"trueSize\"\n :disabled=\"trueDisabled\"\n class=\"flex-1\"\n @change=\"change\"\n />\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {inputRangeEmits, inputRangeProps} from './input-range'\n import {useFormDisabled, useFormSize} from \"element-plus\";\n import {computed, ref, watch} from \"vue\";\n import {useGlobalSize, useNamespace} from \"@hzzt-plus/hooks\";\n\n defineOptions({\n name: 'HzztInputRange',\n })\n\n const props = defineProps(inputRangeProps)\n const emit = defineEmits(inputRangeEmits)\n\n const startValue = ref(props.modelValue[0])\n const endValue = ref(props.modelValue[1])\n\n const nsInput = useNamespace('input-range')\n\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 containerCls = computed(() => [\n nsInput.b(),\n nsInput.m(trueSize.value),\n ])\n\n watch(() => props.modelValue, (v) => {\n startValue.value = v[0];\n endValue.value = v[1];\n }, {\n deep: true,\n })\n\n function change() {\n if (startValue.value || endValue.value) {\n const modelValue = [startValue.value, endValue.value] as Array<string>;\n emit('update:modelValue', modelValue);\n emit('change', modelValue);\n } else if (!startValue.value && !endValue.value) {\n emit('update:modelValue', []);\n emit('change', []);\n }\n }\n\n</script>\n"],"names":["_defineComponent","computed","watch","_resolveComponent","_openBlock","_createElementBlock","_unref","_createVNode","_mergeProps"],"mappings":";;;;;;;;;;;;;;AA2BE,EAAA,IAAA,EAAA;AACA,CAAA,CAAA,CAAA;AACA,MAAQ,SAAA,mBAA2BA,mBAAA,CAAA;AACnC,EAAA,GAAA;;mCAEc;AAAA,EACZ,KAAM,CAAA,OAAA,EAAA,EAAA,IAAA,EAAA,EAAA;AACR,IAAA,MAAA,KAAA,GAAA,OAAA,CAAA;;;;;;;AAKA,IAAA,MAAM,YAAa,GAAAC,YAAU,CAAA,MAAA,KAAY,CAAC,QAAA,IAAA,YAAA,CAAA,KAAA,CAAA,CAAA;AAC1C,IAAA,MAAM,YAAW,GAA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nB,UAAA,EAAA,UAAA,CAAA,KAAA;AAAA,UACF,qBAAA,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAA,UAAA,CAAA,KAAA,GAAA,MAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('../../utils/index.js');
6
- var scroll = require('./src/scroll2.js');
7
- require('./src/scroll.js');
6
+ var scroll = require('./src/scroll.js');
7
+ require('./src/scroll2.js');
8
8
  var install = require('../../utils/vue/install.js');
9
9
 
10
10
  const HzztScroll = install.withInstall(scroll["default"]);
@@ -1,3 +1,96 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var vue = require('vue');
6
+ var core = require('@vueuse/core');
7
+ var index = require('../../icon/src/index.js');
8
+ var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
9
+
10
+ const __default__ = vue.defineComponent({
11
+ name: "HzztScroll"
12
+ });
13
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
14
+ ...__default__,
15
+ setup(__props) {
16
+ const navTranslateX = vue.ref(0);
17
+ const scrollMainRef = vue.ref(null);
18
+ const scrollRef = vue.ref(null);
19
+ const scrollContentRef = vue.ref(null);
20
+ const scrollable = vue.ref(false);
21
+ function update() {
22
+ if (!scrollRef.value || !scrollContentRef.value)
23
+ return;
24
+ const scrollWidth = scrollRef.value ? scrollRef.value.offsetWidth : 0;
25
+ const contentWidth = scrollContentRef.value ? scrollContentRef.value.offsetWidth : 0;
26
+ if (scrollWidth >= contentWidth) {
27
+ scrollable.value = false;
28
+ navTranslateX.value = 0;
29
+ return;
30
+ }
31
+ scrollable.value = true;
32
+ }
33
+ core.useResizeObserver(scrollMainRef, update);
34
+ core.useResizeObserver(scrollContentRef, update);
35
+ vue.onUpdated(() => update());
36
+ function btnNavPrev() {
37
+ var _a;
38
+ const containerSize = ((_a = scrollRef.value) == null ? void 0 : _a.offsetWidth) || 0;
39
+ const currentOffset = navTranslateX.value;
40
+ if (!currentOffset)
41
+ return;
42
+ const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
43
+ navTranslateX.value = newOffset;
44
+ }
45
+ function btnNavNext() {
46
+ var _a, _b;
47
+ const navSize = ((_a = scrollContentRef.value) == null ? void 0 : _a.offsetWidth) || 0;
48
+ const currentOffset = navTranslateX.value;
49
+ const containerSize = ((_b = scrollRef.value) == null ? void 0 : _b.offsetWidth) || 0;
50
+ if (navSize - currentOffset < containerSize)
51
+ return;
52
+ const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
53
+ navTranslateX.value = newOffset;
54
+ }
55
+ return (_ctx, _cache) => {
56
+ return vue.openBlock(), vue.createElementBlock("div", {
57
+ ref_key: "scrollMainRef",
58
+ ref: scrollMainRef,
59
+ class: vue.normalizeClass([{ "is-scrollable": scrollable.value }, "relative hzzt-scroll"])
60
+ }, [
61
+ scrollable.value ? (vue.openBlock(), vue.createElementBlock("div", {
62
+ key: 0,
63
+ class: "hzzt-scroll__nav-prev",
64
+ onClick: btnNavPrev
65
+ }, [
66
+ vue.createVNode(index["default"], { name: "arrow-left" })
67
+ ])) : vue.createCommentVNode("v-if", true),
68
+ scrollable.value ? (vue.openBlock(), vue.createElementBlock("div", {
69
+ key: 1,
70
+ class: "hzzt-scroll__nav-next",
71
+ onClick: btnNavNext
72
+ }, [
73
+ vue.createVNode(index["default"], { name: "arrow-right" })
74
+ ])) : vue.createCommentVNode("v-if", true),
75
+ vue.createElementVNode("div", {
76
+ ref_key: "scrollRef",
77
+ ref: scrollRef,
78
+ class: "overflow-hidden"
79
+ }, [
80
+ vue.createElementVNode("div", {
81
+ ref_key: "scrollContentRef",
82
+ ref: scrollContentRef,
83
+ style: vue.normalizeStyle({ transform: `translateX(${-navTranslateX.value}px)` }),
84
+ class: "hzzt-scroll__content"
85
+ }, [
86
+ vue.renderSlot(_ctx.$slots, "default")
87
+ ], 4)
88
+ ], 512)
89
+ ], 2);
90
+ };
91
+ }
92
+ });
93
+ var Scroll = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "scroll.vue"]]);
94
+
95
+ exports["default"] = Scroll;
3
96
  //# sourceMappingURL=scroll.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"scroll.js","sources":["../../../../../../packages/components/scroll/src/scroll.vue"],"sourcesContent":["<template>\n <div ref=\"scrollMainRef\" :class=\"{'is-scrollable':scrollable}\" class=\"relative hzzt-scroll\">\n <div v-if=\"scrollable\" class=\"hzzt-scroll__nav-prev\" @click=\"btnNavPrev\">\n <hzzt-icon name=\"arrow-left\" />\n </div>\n <div v-if=\"scrollable\" class=\"hzzt-scroll__nav-next\" @click=\"btnNavNext\">\n <hzzt-icon name=\"arrow-right\" />\n </div>\n <div ref=\"scrollRef\" class=\"overflow-hidden\">\n <div ref=\"scrollContentRef\" :style=\"{transform: `translateX(${-navTranslateX}px)`}\" class=\"hzzt-scroll__content\">\n <slot />\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {onUpdated, ref} from 'vue';\n import {useResizeObserver} from '@vueuse/core';\n import HzztIcon from \"@hzzt-plus/components/icon/src/index.vue\";\n\n defineOptions({\n name: 'HzztScroll',\n })\n\n const navTranslateX = ref(0);\n const scrollMainRef = ref<HTMLElement | null>(null);\n const scrollRef = ref<HTMLElement | null>(null);\n const scrollContentRef = ref<HTMLElement | null>(null);\n const scrollable = ref(false);\n\n function update() {\n if (!scrollRef.value || !scrollContentRef.value) return;\n const scrollWidth = scrollRef.value ? scrollRef.value.offsetWidth : 0;\n const contentWidth = scrollContentRef.value ? scrollContentRef.value.offsetWidth : 0;\n if (scrollWidth >= contentWidth) {\n scrollable.value = false;\n navTranslateX.value = 0;\n return;\n }\n scrollable.value = true;\n }\n\n useResizeObserver(scrollMainRef, update);\n useResizeObserver(scrollContentRef, update);\n\n onUpdated(() => update());\n\n function btnNavPrev() {\n const containerSize = scrollRef.value?.offsetWidth || 0;\n const currentOffset = navTranslateX.value;\n if (!currentOffset) return;\n const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;\n navTranslateX.value = newOffset;\n }\n\n function btnNavNext() {\n const navSize = scrollContentRef.value?.offsetWidth || 0;\n const currentOffset = navTranslateX.value;\n const containerSize = scrollRef.value?.offsetWidth || 0;\n if (navSize - currentOffset < containerSize) return;\n const newOffset = navSize - currentOffset > containerSize * 2 ?\n currentOffset + containerSize :\n navSize - containerSize;\n navTranslateX.value = newOffset;\n }\n</script>\n"],"names":["ref","useResizeObserver","onUpdated"],"mappings":";;;;;;;;;uCAqBgB,CAAA;AAAA,EACZ,IAAM,EAAA,YAAA;AACR,CAAA,CAAA,CAAA;;;;AAEA,IAAM,MAAA,aAAA,GAAgBA,QAAI,CAAC,CAAA,CAAA;AAC3B,IAAM,MAAA,aAAA,GAAgBA,QAAwB,IAAI,CAAA,CAAA;AAClD,IAAM,MAAA,SAAA,GAAYA,QAAwB,IAAI,CAAA,CAAA;AAC9C,IAAM,MAAA,gBAAA,GAAmBA,QAAwB,IAAI,CAAA,CAAA;AACrD,IAAM,MAAA,UAAA,GAAaA,QAAI,KAAK,CAAA,CAAA;AAE5B,IAAA,SAAS,MAAS,GAAA;AAChB,MAAA,IAAI,CAAC,SAAA,CAAU,KAAS,IAAA,CAAC,gBAAiB,CAAA,KAAA;AAAO,QAAA,OAAA;AACjD,MAAA,MAAM,WAAc,GAAA,SAAA,CAAU,KAAQ,GAAA,SAAA,CAAU,MAAM,WAAc,GAAA,CAAA,CAAA;AACpE,MAAA,MAAM,YAAe,GAAA,gBAAA,CAAiB,KAAQ,GAAA,gBAAA,CAAiB,MAAM,WAAc,GAAA,CAAA,CAAA;AACnF,MAAA,IAAI,eAAe,YAAc,EAAA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AAA;AAG5B,QAAA,OAAA;AAAsB,MACxB,MAAA,SAAA,GAAA,OAAA,GAAA,aAAA,GAAA,aAAA,GAAA,CAAA,GAAA,aAAA,GAAA,aAAA,GAAA,OAAA,GAAA,aAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,6 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {
2
2
  navTranslateX: import("vue").Ref<number>;
3
+ scrollMainRef: import("vue").Ref<HTMLElement | null>;
3
4
  scrollRef: import("vue").Ref<HTMLElement | null>;
4
5
  scrollContentRef: import("vue").Ref<HTMLElement | null>;
5
6
  scrollable: import("vue").Ref<boolean>;
@@ -1,92 +1,3 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var vue = require('vue');
6
- var core = require('@vueuse/core');
7
- var index = require('../../icon/src/index.js');
8
- var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
9
-
10
- const __default__ = vue.defineComponent({
11
- name: "HzztScroll"
12
- });
13
- const _sfc_main = /* @__PURE__ */ vue.defineComponent({
14
- ...__default__,
15
- setup(__props) {
16
- const navTranslateX = vue.ref(0);
17
- const scrollRef = vue.ref(null);
18
- const scrollContentRef = vue.ref(null);
19
- const scrollable = vue.ref(false);
20
- function update() {
21
- if (!scrollRef.value || !scrollContentRef.value)
22
- return;
23
- const scrollWidth = scrollRef.value ? scrollRef.value.offsetWidth : 0;
24
- const contentWidth = scrollContentRef.value ? scrollContentRef.value.offsetWidth : 0;
25
- if (scrollWidth >= contentWidth) {
26
- scrollable.value = false;
27
- navTranslateX.value = 0;
28
- return;
29
- }
30
- scrollable.value = true;
31
- }
32
- core.useResizeObserver(scrollContentRef, update);
33
- vue.onUpdated(() => update());
34
- function btnNavPrev() {
35
- var _a;
36
- const containerSize = ((_a = scrollRef.value) == null ? void 0 : _a.offsetWidth) || 0;
37
- const currentOffset = navTranslateX.value;
38
- if (!currentOffset)
39
- return;
40
- const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
41
- navTranslateX.value = newOffset;
42
- }
43
- function btnNavNext() {
44
- var _a, _b;
45
- const navSize = ((_a = scrollContentRef.value) == null ? void 0 : _a.offsetWidth) || 0;
46
- const currentOffset = navTranslateX.value;
47
- const containerSize = ((_b = scrollRef.value) == null ? void 0 : _b.offsetWidth) || 0;
48
- if (navSize - currentOffset < containerSize)
49
- return;
50
- const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
51
- navTranslateX.value = newOffset;
52
- }
53
- return (_ctx, _cache) => {
54
- return vue.openBlock(), vue.createElementBlock("div", {
55
- class: vue.normalizeClass([{ "is-scrollable": scrollable.value }, "relative hzzt-scroll"])
56
- }, [
57
- scrollable.value ? (vue.openBlock(), vue.createElementBlock("div", {
58
- key: 0,
59
- class: "hzzt-scroll__nav-prev",
60
- onClick: btnNavPrev
61
- }, [
62
- vue.createVNode(index["default"], { name: "arrow-left" })
63
- ])) : vue.createCommentVNode("v-if", true),
64
- scrollable.value ? (vue.openBlock(), vue.createElementBlock("div", {
65
- key: 1,
66
- class: "hzzt-scroll__nav-next",
67
- onClick: btnNavNext
68
- }, [
69
- vue.createVNode(index["default"], { name: "arrow-right" })
70
- ])) : vue.createCommentVNode("v-if", true),
71
- vue.createElementVNode("div", {
72
- ref_key: "scrollRef",
73
- ref: scrollRef,
74
- class: "overflow-hidden"
75
- }, [
76
- vue.createElementVNode("div", {
77
- ref_key: "scrollContentRef",
78
- ref: scrollContentRef,
79
- style: vue.normalizeStyle({ transform: `translateX(${-navTranslateX.value}px)` }),
80
- class: "hzzt-scroll__content"
81
- }, [
82
- vue.renderSlot(_ctx.$slots, "default")
83
- ], 4)
84
- ], 512)
85
- ], 2);
86
- };
87
- }
88
- });
89
- var Scroll = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "scroll.vue"]]);
90
-
91
- exports["default"] = Scroll;
92
3
  //# sourceMappingURL=scroll2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll2.js","sources":["../../../../../../packages/components/scroll/src/scroll.vue"],"sourcesContent":["<template>\n <div :class=\"{'is-scrollable':scrollable}\" class=\"relative hzzt-scroll\">\n <div v-if=\"scrollable\" class=\"hzzt-scroll__nav-prev\" @click=\"btnNavPrev\">\n <hzzt-icon name=\"arrow-left\" />\n </div>\n <div v-if=\"scrollable\" class=\"hzzt-scroll__nav-next\" @click=\"btnNavNext\">\n <hzzt-icon name=\"arrow-right\" />\n </div>\n <div ref=\"scrollRef\" class=\"overflow-hidden\">\n <div ref=\"scrollContentRef\" :style=\"{transform: `translateX(${-navTranslateX}px)`}\" class=\"hzzt-scroll__content\">\n <slot />\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {onUpdated, ref} from 'vue';\n import {useResizeObserver} from '@vueuse/core';\n import HzztIcon from \"@hzzt-plus/components/icon/src/index.vue\";\n\n defineOptions({\n name: 'HzztScroll',\n })\n\n const navTranslateX = ref(0);\n const scrollRef = ref<HTMLElement | null>(null);\n const scrollContentRef = ref<HTMLElement | null>(null);\n const scrollable = ref(false);\n\n function update() {\n if (!scrollRef.value || !scrollContentRef.value) return;\n const scrollWidth = scrollRef.value ? scrollRef.value.offsetWidth : 0;\n const contentWidth = scrollContentRef.value ? scrollContentRef.value.offsetWidth : 0;\n if (scrollWidth >= contentWidth) {\n scrollable.value = false;\n navTranslateX.value = 0;\n return;\n }\n scrollable.value = true;\n }\n\n useResizeObserver(scrollContentRef, update);\n\n onUpdated(() => update());\n\n function btnNavPrev() {\n const containerSize = scrollRef.value?.offsetWidth || 0;\n const currentOffset = navTranslateX.value;\n if (!currentOffset) return;\n const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;\n navTranslateX.value = newOffset;\n }\n\n function btnNavNext() {\n const navSize = scrollContentRef.value?.offsetWidth || 0;\n const currentOffset = navTranslateX.value;\n const containerSize = scrollRef.value?.offsetWidth || 0;\n if (navSize - currentOffset < containerSize) return;\n const newOffset = navSize - currentOffset > containerSize * 2 ?\n currentOffset + containerSize :\n navSize - containerSize;\n navTranslateX.value = newOffset;\n }\n</script>\n"],"names":["ref","useResizeObserver","onUpdated"],"mappings":";;;;;;;;;uCAqBgB,CAAA;AAAA,EACZ,IAAM,EAAA,YAAA;AACR,CAAA,CAAA,CAAA;;;;AAEA,IAAM,MAAA,aAAA,GAAgBA,QAAI,CAAC,CAAA,CAAA;AAC3B,IAAM,MAAA,SAAA,GAAYA,QAAwB,IAAI,CAAA,CAAA;AAC9C,IAAM,MAAA,gBAAA,GAAmBA,QAAwB,IAAI,CAAA,CAAA;AACrD,IAAM,MAAA,UAAA,GAAaA,QAAI,KAAK,CAAA,CAAA;AAE5B,IAAA,SAAS,MAAS,GAAA;AAChB,MAAA,IAAI,CAAC,SAAA,CAAU,KAAS,IAAA,CAAC,gBAAiB,CAAA,KAAA;AAAO,QAAA,OAAA;AACjD,MAAA,MAAM,WAAc,GAAA,SAAA,CAAU,KAAQ,GAAA,SAAA,CAAU,MAAM,WAAc,GAAA,CAAA,CAAA;AACpE,MAAA,MAAM,YAAe,GAAA,gBAAA,CAAiB,KAAQ,GAAA,gBAAA,CAAiB,MAAM,WAAc,GAAA,CAAA,CAAA;AACnF,MAAA,IAAI,eAAe,YAAc,EAAA;AAC/B,QAAA,UAAA,CAAW,KAAQ,GAAA,KAAA,CAAA;AACnB,QAAA,aAAA,CAAc,KAAQ,GAAA,CAAA,CAAA;AACtB,QAAA,OAAA;AAAA,OACF;AACA,MAAA,UAAA,CAAW,KAAQ,GAAA,IAAA,CAAA;AAAA,KACrB;AAEA,IAAAC,sBAAA,CAAkB,kBAAkB,MAAM,CAAA,CAAA;AAE1C,IAAUC,aAAA,CAAA,MAAM,QAAQ,CAAA,CAAA;AAExB,IAAA,SAAS,UAAa,GAAA;AACpB,MAAM,IAAA,EAAA,CAAA;AACN,MAAA,MAAM,gBAAgB,CAAc,CAAA,EAAA,GAAA,SAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,KAAA,CAAA,CAAA;AACpC,MAAA,MAAK,aAAA,GAAA,aAAA,CAAA,KAAA,CAAA;AAAe,MAAA,IAAA,CAAA,aAAA;AACpB,QAAA,OAAkB;AAClB,MAAA,MAAA,SAAsB,GAAA,aAAA,GAAA,aAAA,GAAA,aAAA,GAAA,aAAA,GAAA,CAAA,CAAA;AAAA,MACxB,aAAA,CAAA,KAAA,GAAA,SAAA,CAAA;AAEA,KAAA;AACE,IAAM,SAAA,UAA2B,GAAA;AACjC,MAAA,IAAA,EAAM;AACN,MAAM,MAAA,OAAA,GAAA,CAAA,CAAA,EAAA,GAA0B,gBAAO,CAAe,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,KAAA,CAAA,CAAA;AACtD,MAAA,mBAA8B,GAAA,aAAA,CAAA,KAAA,CAAA;AAAe,MAAA,MAAA,aAAA,GAAA,CAAA,CAAA,EAAA,GAAA,SAAA,CAAA,KAAA,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,WAAA,KAAA,CAAA,CAAA;AAC7C,MAAA,IAAA,uBAA4B,GAAA,aAAA;AAG5B,QAAA,OAAA;AAAsB,MACxB,MAAA,SAAA,GAAA,OAAA,GAAA,aAAA,GAAA,aAAA,GAAA,CAAA,GAAA,aAAA,GAAA,aAAA,GAAA,OAAA,GAAA,aAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"scroll2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('../../utils/index.js');
6
- var selectInput$1 = require('./src/select-input2.js');
7
- var selectInput = require('./src/select-input.js');
6
+ var selectInput$1 = require('./src/select-input.js');
7
+ var selectInput = require('./src/select-input2.js');
8
8
  var install = require('../../utils/vue/install.js');
9
9
 
10
10
  const HzztSelectInput = install.withInstall(selectInput$1["default"]);
@@ -2,54 +2,132 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('../../../utils/index.js');
5
+ var vue = require('vue');
6
+ var selectInput = require('./select-input2.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 title = require('../../title/src/title2.js');
10
+ var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
11
+ var index = require('../../../hooks/use-namespace/index.js');
12
+ var index$1 = require('../../../hooks/use-size/index.js');
13
+ var index$2 = require('../../../hooks/use-letter/index.js');
12
14
 
13
- const selectInputProps = runtime.buildProps({
14
- modelValue: {
15
- type: runtime.definePropType([
16
- String,
17
- Number
18
- ]),
19
- default: ""
20
- },
21
- indexType: {
22
- type: String,
23
- default: "number"
24
- },
25
- disabled: Boolean,
26
- replace: Boolean,
27
- label: String,
28
- options: {
29
- type: runtime.definePropType(Array),
30
- default: () => []
31
- },
32
- inputProps: Object,
33
- customProps: Object,
34
- position: {
35
- type: String,
36
- default: "left"
37
- },
38
- formatLabel: {
39
- type: Function
40
- },
41
- split: {
42
- type: String,
43
- default: ""
44
- },
45
- size: index.useSizeProp
15
+ const _hoisted_1 = { slot: "append" };
16
+ const _hoisted_2 = { key: 0 };
17
+ const __default__ = vue.defineComponent({
18
+ name: "HzztSelectInput"
46
19
  });
47
- const selectInputEmits = {
48
- [event.UPDATE_MODEL_EVENT]: (value) => shared.isString(value),
49
- input: (value) => shared.isString(value),
50
- change: (value) => shared.isString(value)
51
- };
20
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
21
+ ...__default__,
22
+ props: selectInput.selectInputProps,
23
+ emits: selectInput.selectInputEmits,
24
+ setup(__props, { emit }) {
25
+ const props = __props;
26
+ const inputVal = vue.ref(props.modelValue);
27
+ const nsInput = index.useNamespace("select-input");
28
+ const formSize = elementPlus.useFormSize();
29
+ const formDisabled = elementPlus.useFormDisabled();
30
+ const trueSize = vue.computed(() => props.size || formSize.value || index$1.useGlobalSize().value);
31
+ const trueDisabled = vue.computed(() => props.disabled || formDisabled.value);
32
+ const containerCls = vue.computed(() => [
33
+ nsInput.b(),
34
+ nsInput.m(trueSize.value)
35
+ ]);
36
+ const inputContainerCls = vue.computed(() => [
37
+ "flex",
38
+ props.position === "top" ? "column" : "row align-items-center"
39
+ ]);
40
+ const inputCls = vue.computed(() => [
41
+ "flex-1",
42
+ props.label ? props.position === "top" ? "margin-b-1" : "margin-l-1" : ""
43
+ ]);
44
+ const _inputProps = vue.computed(() => ({
45
+ disabled: trueDisabled.value,
46
+ clearable: true,
47
+ ...props.inputProps
48
+ }));
49
+ vue.watch(() => props.modelValue, (v) => {
50
+ inputVal.value = v;
51
+ });
52
+ function input(val) {
53
+ emit("update:modelValue", val);
54
+ emit("input", val);
55
+ }
56
+ function change(val) {
57
+ emit("change", val);
58
+ }
59
+ function getLinkName(item, index) {
60
+ let prefix = "";
61
+ if (props.indexType == "number") {
62
+ prefix = `\uFF08${index + 1}\uFF09`;
63
+ } else if (props.indexType == "letter") {
64
+ prefix = `\uFF08${index$2.numberToLetter(index)}\uFF09`;
65
+ }
66
+ return prefix + (item.label || item.value);
67
+ }
68
+ function select(item) {
69
+ const value = item.value || item.label;
70
+ let content = "";
71
+ if (!inputVal.value)
72
+ inputVal.value = "";
73
+ if (props.formatLabel) {
74
+ content = props.formatLabel(value);
75
+ } else if (props.replace) {
76
+ content = value;
77
+ } else {
78
+ content = inputVal.value ? `${inputVal.value}${props.split}${value}` : value;
79
+ }
80
+ inputVal.value = content;
81
+ input(content);
82
+ change(content);
83
+ }
84
+ return (_ctx, _cache) => {
85
+ return vue.openBlock(), vue.createElementBlock("div", {
86
+ class: vue.normalizeClass(vue.unref(containerCls))
87
+ }, [
88
+ vue.createElementVNode("div", {
89
+ class: vue.normalizeClass(vue.unref(inputContainerCls))
90
+ }, [
91
+ vue.renderSlot(_ctx.$slots, "title", {}, () => [
92
+ vue.createVNode(title["default"], { label: _ctx.label }, null, 8, ["label"])
93
+ ]),
94
+ vue.createVNode(vue.unref(elementPlus.ElInput), vue.mergeProps({
95
+ ref: "inputRef",
96
+ class: vue.unref(inputCls),
97
+ modelValue: inputVal.value,
98
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputVal.value = $event)
99
+ }, vue.unref(_inputProps), {
100
+ onInput: input,
101
+ onChange: change
102
+ }), {
103
+ default: vue.withCtx(() => [
104
+ vue.createElementVNode("template", _hoisted_1, [
105
+ vue.renderSlot(_ctx.$slots, "append")
106
+ ])
107
+ ]),
108
+ _: 3
109
+ }, 16, ["class", "modelValue"])
110
+ ], 2),
111
+ _ctx.options.length && !vue.unref(trueDisabled) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
112
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
113
+ return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElLink), vue.mergeProps({
114
+ key: index,
115
+ class: "margin-r-4"
116
+ }, _ctx.customProps, {
117
+ onClick: ($event) => select(item)
118
+ }), {
119
+ default: vue.withCtx(() => [
120
+ vue.createTextVNode(vue.toDisplayString(getLinkName(item, index)), 1)
121
+ ]),
122
+ _: 2
123
+ }, 1040, ["onClick"]);
124
+ }), 128))
125
+ ])) : vue.createCommentVNode("v-if", true)
126
+ ], 2);
127
+ };
128
+ }
129
+ });
130
+ var SelectInput = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "select-input.vue"]]);
52
131
 
53
- exports.selectInputEmits = selectInputEmits;
54
- exports.selectInputProps = selectInputProps;
132
+ exports["default"] = SelectInput;
55
133
  //# sourceMappingURL=select-input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-input.js","sources":["../../../../../../packages/components/select-input/src/select-input.ts"],"sourcesContent":["import {buildProps, definePropType, isString} from '@hzzt-plus/utils'\nimport {useSizeProp} from \"@hzzt-plus/hooks\";\n\nimport type { ExtractPropTypes } from 'vue'\nimport type SelectInput from './select-input.vue'\nimport {UPDATE_MODEL_EVENT} from \"@hzzt-plus/constants\";\nimport {OptionType} from \"@hzzt-plus/components/select/src/select\";\n\nexport const selectInputProps = buildProps({\n modelValue: {\n type: definePropType<string | number | null | undefined>([\n String,\n Number,\n ]),\n default: '',\n },\n indexType: {\n type: String,\n default: 'number',\n },\n disabled: Boolean,\n replace: Boolean,\n label: String,\n options: {\n type: definePropType<OptionType[]>(Array),\n default: () => [],\n },\n inputProps: Object,\n customProps: Object,\n position: {\n type: String,\n default: 'left',\n },\n formatLabel: {\n type: Function,\n },\n split: {\n type: String,\n default: '',\n },\n size: useSizeProp,\n})\n\nexport type SelectInputProps = ExtractPropTypes<typeof selectInputProps>\n\nexport const selectInputEmits = {\n [UPDATE_MODEL_EVENT]: (value: string | undefined) => isString(value),\n input: (value: string | undefined) => isString(value),\n change: (value: string | undefined) => isString(value),\n}\nexport type SelectInputEmits = typeof selectInputEmits\n\nexport type SelectInputInstance = InstanceType<typeof SelectInput>\n"],"names":["buildProps","definePropType","useSizeProp","UPDATE_MODEL_EVENT","isString"],"mappings":";;;;;;;;;;;;AAGY,MAAC,gBAAgB,GAAGA,kBAAU,CAAC;AAC3C,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAEC,sBAAc,CAAC;AACzB,MAAM,MAAM;AACZ,MAAM,MAAM;AACZ,KAAK,CAAC;AACN,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,OAAO,EAAE,OAAO;AAClB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAEA,sBAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,UAAU,EAAE,MAAM;AACpB,EAAE,WAAW,EAAE,MAAM;AACrB,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,QAAQ;AAClB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAEC,iBAAW;AACnB,CAAC,EAAE;AACS,MAAC,gBAAgB,GAAG;AAChC,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":"select-input.js","sources":["../../../../../../packages/components/select-input/src/select-input.vue"],"sourcesContent":["<template>\n <div :class=\"containerCls\">\n <div :class=\"inputContainerCls\">\n <slot name=\"title\">\n <hzzt-title :label=\"label\"></hzzt-title>\n </slot>\n <el-input ref=\"inputRef\"\n :class=\"inputCls\"\n v-model=\"inputVal\"\n v-bind=\"_inputProps\"\n @input=\"input\"\n @change=\"change\"\n >\n <template slot=\"append\">\n <slot name=\"append\"></slot>\n </template>\n </el-input>\n </div>\n <div v-if=\"options.length&&!trueDisabled\">\n <el-link v-for=\"(item, index) in options\" :key=\"index\" class=\"margin-r-4\" v-bind=\"customProps\" @click=\"select(item)\">\n {{ getLinkName(item, index) }}\n </el-link>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {computed, ref, watch} from 'vue'\n import {selectInputEmits, selectInputProps} from './select-input'\n import {useGlobalSize, useNamespace, numberToLetter} from \"@hzzt-plus/hooks\";\n import {useFormDisabled, useFormSize} from \"element-plus\";\n import HzztTitle from \"@hzzt-plus/components/title/src/title.vue\";\n import {ElInput, ElLink} from 'element-plus'\n import {OptionType} from \"@hzzt-plus/components/select/src/select\";\n\n defineOptions({\n name: 'HzztSelectInput',\n })\n\n const props = defineProps(selectInputProps)\n const emit = defineEmits(selectInputEmits)\n\n const inputVal = ref(props.modelValue);\n\n const nsInput = useNamespace('select-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 containerCls = computed(() => [\n nsInput.b(),\n nsInput.m(trueSize.value),\n ])\n\n const inputContainerCls = computed(() => [\n 'flex',\n props.position === 'top' ? 'column' : 'row align-items-center'\n ])\n\n const inputCls = computed(() => [\n 'flex-1',\n props.label ? props.position === 'top' ? 'margin-b-1' : 'margin-l-1' : ''\n ])\n\n const _inputProps = computed(() => ({\n disabled: trueDisabled.value,\n clearable: true,\n ...props.inputProps,\n }))\n\n watch(() => props.modelValue, (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(val: string) {\n emit('change', val);\n }\n\n function getLinkName(item: OptionType, index: number) {\n let prefix = '';\n if (props.indexType == 'number') {\n prefix = `(${index + 1})`\n } else if (props.indexType == 'letter') {\n prefix = `(${numberToLetter(index)})`\n }\n return prefix + (item.label || item.value);\n }\n\n function select(item: OptionType) {\n const value = item.value||item.label;\n let content = '';\n if (!inputVal.value) inputVal.value = '';\n if (props.formatLabel) {\n content = props.formatLabel(value);\n } else if (props.replace) {\n content = value;\n } else {\n content = inputVal.value ? `${inputVal.value}${props.split}${value}` : value;\n }\n inputVal.value = content;\n input(content);\n change(content);\n }\n\n</script>\n"],"names":["ref","useNamespace","useFormSize","useFormDisabled","computed","useGlobalSize","watch","numberToLetter","_openBlock","_createElementBlock"],"mappings":";;;;;;;;;;;;;;;;uCAmCgB,CAAA;AAAA,EACZ,IAAM,EAAA,iBAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAM,MAAA,QAAA,GAAWA,OAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AAErC,IAAM,MAAA,OAAA,GAAUC,mBAAa,cAAc,CAAA,CAAA;AAC3C,IAAA,MAAM,WAAWC,uBAAY,EAAA,CAAA;AAC7B,IAAA,MAAM,eAAeC,2BAAgB,EAAA,CAAA;AAErC,IAAA,MAAM,QAAW,GAAAC,YAAA,CAAA,MAAA,KAAA,CAAA,IAAA,IAAA,QAAA,CAAA,KAAA,IAAAC,qBAAA,EAAA,CAAA,KAAA,CAAA,CAAA;AAAA,IAAA,kBACH,GAAAD,YAAiB,CAAA,MAAA,kBAAuB,YAAE,CAAA,KAAA,CAAA,CAAA;AAAA,IACxD,MAAA,YAAA,GAAAA,YAAA,CAAA,MAAA;AAEA,MAAA;AAEA,MAAM,OAAA,CAAA,CAAA,CAAA,QAAA,CAAe;AAAe,KAAA,CAClC;AAAU,IACV,MAAA,iBAAwB,GAAAA,YAAA,CAAA,MAAA;AAAA,MACzB,MAAA;AAED,MAAM,KAAA,CAAA,QAAA,KAAA,KAAoB,WAAe,GAAA,wBAAA;AAAA,KACvC,CAAA,CAAA;AAAA,IACA,MAAA,QAAmB,GAAAA,YAAA,CAAA,MAAmB;AAAA,MACvC,QAAA;AAED,MAAM,KAAA,CAAA,KAAA,GAAA,cAA0B,KAAA,KAAA,GAAA,YAAA,GAAA,YAAA,GAAA,EAAA;AAAA,KAC9B,CAAA,CAAA;AAAA,IAAA,iBACc,GAAAA,YAAmB,CAAA,OAAA;AAAsC,MACxE,QAAA,EAAA,YAAA,CAAA,KAAA;AAED,MAAM,SAAA,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