hzzt-plus 2.0.9 → 2.0.10

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 (50) hide show
  1. package/dist/index.full.js +10 -10
  2. package/dist/index.full.min.js +3 -3
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +3 -3
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +10 -10
  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/lazy-list/index.mjs +2 -2
  17. package/es/components/lazy-list/src/lazy-list.mjs +22 -80
  18. package/es/components/lazy-list/src/lazy-list.mjs.map +1 -1
  19. package/es/components/lazy-list/src/lazy-list2.mjs +80 -22
  20. package/es/components/lazy-list/src/lazy-list2.mjs.map +1 -1
  21. package/es/components/select/src/select2.mjs +8 -8
  22. package/es/components/select/src/select2.mjs.map +1 -1
  23. package/es/components/select-input/index.mjs +2 -2
  24. package/es/components/select-input/src/select-input.mjs +124 -45
  25. package/es/components/select-input/src/select-input.mjs.map +1 -1
  26. package/es/components/select-input/src/select-input2.mjs +45 -124
  27. package/es/components/select-input/src/select-input2.mjs.map +1 -1
  28. package/es/index.mjs +2 -2
  29. package/es/version.d.ts +1 -1
  30. package/es/version.mjs +1 -1
  31. package/es/version.mjs.map +1 -1
  32. package/lib/components/index.js +2 -2
  33. package/lib/components/lazy-list/index.js +2 -2
  34. package/lib/components/lazy-list/src/lazy-list.js +23 -80
  35. package/lib/components/lazy-list/src/lazy-list.js.map +1 -1
  36. package/lib/components/lazy-list/src/lazy-list2.js +80 -23
  37. package/lib/components/lazy-list/src/lazy-list2.js.map +1 -1
  38. package/lib/components/select/src/select2.js +8 -8
  39. package/lib/components/select/src/select2.js.map +1 -1
  40. package/lib/components/select-input/index.js +2 -2
  41. package/lib/components/select-input/src/select-input.js +124 -46
  42. package/lib/components/select-input/src/select-input.js.map +1 -1
  43. package/lib/components/select-input/src/select-input2.js +46 -124
  44. package/lib/components/select-input/src/select-input2.js.map +1 -1
  45. package/lib/index.js +2 -2
  46. package/lib/version.d.ts +1 -1
  47. package/lib/version.js +1 -1
  48. package/lib/version.js.map +1 -1
  49. package/package.json +1 -1
  50. package/web-types.json +1 -1
@@ -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-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');
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-list2.js.map
@@ -1 +1 @@
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;;;;;"}
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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AA;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,OAAAE,aAAA,EAAA,EAAAC,sBAAA,CAAA,KAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -41,14 +41,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
41
41
  nsSelect.m(trueSize.value)
42
42
  ]);
43
43
  const containerStyle = vue.computed(() => attrs.style);
44
- const inputCls = vue.computed(() => [
45
- nsSelect.e("input"),
46
- "width-100%"
47
- ]);
48
- const selectCls = vue.computed(() => [
49
- nsSelect.e("select"),
50
- "width-100%"
51
- ]);
44
+ const inputCls = vue.computed(() => [nsSelect.e("input"), "width-100%"]);
45
+ const selectCls = vue.computed(() => [nsSelect.e("select"), "width-100%"]);
52
46
  const _inputProps = vue.computed(() => ({
53
47
  disabled: trueDisabled.value,
54
48
  size: trueSize.value,
@@ -83,6 +77,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
83
77
  if ((_a = selectRef.value) == null ? void 0 : _a.dropdownMenuVisible) {
84
78
  selectRef.value.states.inputValue = inputVal.value;
85
79
  selectRef.value.debouncedOnInputChange();
80
+ } else {
81
+ selectRef.value.dropdownMenuVisible = true;
82
+ setTimeout(() => {
83
+ selectRef.value.states.inputValue = inputVal.value;
84
+ selectRef.value.debouncedOnInputChange();
85
+ }, 200);
86
86
  }
87
87
  emit("update:modelValue", str);
88
88
  emit("input", str);
@@ -1 +1 @@
1
- {"version":3,"file":"select2.js","sources":["../../../../../../packages/components/select/src/select.vue"],"sourcesContent":["<template>\n <div :class=\"containerCls\" :style=\"containerStyle\">\n <el-input\n :class=\"inputCls\"\n v-model=\"inputVal\"\n ref=\"inputRef\"\n v-bind=\"_inputProps\"\n @input=\"input\"\n @change=\"change\"\n @focus=\"focus\"\n @keydown=\"keydown\"\n >\n <template #suffix>\n <hzzt-icon v-if=\"!trueReadonly\" class=\"pointer\" :name=\"arrowName\"\n @click=\"showSelect\"></hzzt-icon>\n </template>\n </el-input>\n <el-select-v2 v-if=\"!trueReadonly\" :class=\"selectCls\" v-model=\"selectVal\" ref=\"selectRef\" v-bind=\"_selectProps\"\n @change=\"selectChange\" @visible-change=\"selectVisibleChange\">\n <template #default=\"{ item }\">\n <slot :item=\"item\" />\n </template>\n </el-select-v2>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\n import {selectEmits, selectProps} from './select'\n import {computed, ref, useAttrs, watch} from \"vue\";\n import {useFormDisabled, useFormSize} from \"element-plus\";\n import {useGlobalSize, useNamespace} from \"@hzzt-plus/hooks\";\n import {ElInput, ElSelectV2} from 'element-plus'\n import type {CSSProperties} from 'vue'\n import HzztIcon from \"@hzzt-plus/components/icon/src/index.vue\";\n\n\n defineOptions({\n name: 'HzztSelect',\n inheritAttrs: false,\n })\n\n const props = defineProps(selectProps)\n const emit = defineEmits(selectEmits)\n\n const attrs = useAttrs();\n\n const inputVal = ref(props.modelValue);\n const selectVal = ref();\n const inputRef = ref();\n const selectRef = ref();\n const arrowName = ref('arrow-down');\n\n const nsSelect = useNamespace('select');\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 trueReadonly = computed(() => props.readonly || trueDisabled.value)\n\n const containerCls = computed(() => [\n 'relative',\n 'line-height-1',\n attrs.class,\n nsSelect.b(),\n nsSelect.m(trueSize.value),\n ])\n\n const containerStyle = computed(() => attrs.style as CSSProperties)\n\n const inputCls = computed(() => [\n nsSelect.e('input'),\n 'width-100%'\n ])\n\n const selectCls = computed(() => [\n nsSelect.e('select'),\n 'width-100%'\n ])\n\n const _inputProps = computed(() => ({\n disabled: trueDisabled.value,\n size: trueSize.value,\n clearable: props.clearable,\n placeholder: props.placeholder,\n readonly: props.readonly,\n ...attrs,\n class: '',\n style: {\n position: trueReadonly.value ? 'static' : 'absolute',\n left: 0,\n top: 0,\n right: 0,\n zIndex: 2,\n },\n }))\n\n const _selectProps = computed(() => ({\n options: props.options,\n size: trueSize.value,\n filterable: true,\n popperClass: 'select-v2-popper-min-width-100',\n ...props.selectProps,\n }))\n\n watch(() => props.modelValue, (v) => {\n inputVal.value = v;\n })\n\n watch(() => inputVal.value, (v) => {\n selectVal.value = v;\n })\n\n function input(str: string) {\n if (selectRef.value?.dropdownMenuVisible) {\n selectRef.value.states.inputValue = inputVal.value;\n selectRef.value.debouncedOnInputChange();\n }\n emit('update:modelValue', str)\n emit('input', str)\n }\n\n function change(str: string) {\n emit('change', str)\n }\n\n function focus() {\n if (selectRef.value && props.autoPullDown) {\n setTimeout(() => {\n selectRef.value.dropdownMenuVisible = true;\n }, 200)\n }\n }\n\n function keydown(e: KeyboardEvent | Event) {\n const key = \"key\" in e && e.key;\n if (key === 'ArrowDown') {\n emit('arrow-down', e);\n selectRef.value.dropdownMenuVisible = false;\n } else if (key === 'ArrowUp') {\n emit('arrow-up', e);\n selectRef.value.dropdownMenuVisible = false;\n } else if (key === 'ArrowLeft') {\n const index = inputRef.value.input.selectionStart;\n if (index === 0) {\n emit('arrow-left', e);\n selectRef.value.dropdownMenuVisible = false;\n }\n } else if (key === 'ArrowRight') {\n const index = inputRef.value.input.selectionStart;\n if ((inputVal.value?.length ?? 0) === index) {\n emit('arrow-right', e);\n selectRef.value.dropdownMenuVisible = false;\n }\n } else if (key === 'Enter') {\n emit('enter', e);\n selectRef.value.dropdownMenuVisible = false;\n }\n }\n\n function showSelect() {\n if (selectRef.value) {\n selectRef.value.dropdownMenuVisible = !selectRef.value.dropdownMenuVisible;\n }\n }\n\n function selectChange(v: string) {\n let str = inputVal.value || '';\n if (props.replace) {\n str = v;\n } else {\n str += v;\n }\n emit('update:modelValue', str);\n emit('input', str)\n inputVal.value = str;\n setTimeout(() => {\n inputRef.value.focus();\n setTimeout(() => {\n selectRef.value.dropdownMenuVisible = false;\n }, 250)\n emit('change', str);\n });\n }\n\n function selectVisibleChange(v: boolean) {\n arrowName.value = v ? 'arrow-up' : 'arrow-down'\n }\n\n\n</script>\n"],"names":["useAttrs","ref","useNamespace","useFormSize","useFormDisabled","computed","useGlobalSize","watch"],"mappings":";;;;;;;;;;;;;uCAoCgB,CAAA;AAAA,EACZ,IAAM,EAAA,YAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAChB,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAA,MAAM,QAAQA,YAAS,EAAA,CAAA;AAEvB,IAAM,MAAA,QAAA,GAAWC,OAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AACrC,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ACjB,MAAA,UAAA,CAAW,MAAM;AACf,QAAA,QAAA,CAAS,MAAM,KAAM,EAAA,CAAA;AACrB,QAAA,UAAA,CAAW,MAAM;AACf,UAAA,SAAA,CAAU,MAAM,mBAAsB,GAAA,KAAA,CAAA;AAAA,WACrC,GAAG,CAAA,CAAA;AACN,QAAA,IAAA,CAAK,UAAU,GAAG,CAAA,CAAA;AAAA,OACnB,CAAA,CAAA;AAAA,KACH;AAEA,IAAA,SAAS,oBAAoB,CAAY,EAAA;AACvC,MAAU,SAAA,CAAA,KAAA,GAAQ,IAAI,UAAa,GAAA,YAAA,CAAA;AAAA,KACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"select2.js","sources":["../../../../../../packages/components/select/src/select.vue"],"sourcesContent":["<template>\n <div :class=\"containerCls\" :style=\"containerStyle\">\n <el-input\n :class=\"inputCls\"\n v-model=\"inputVal\"\n ref=\"inputRef\"\n v-bind=\"_inputProps\"\n @input=\"input\"\n @change=\"change\"\n @focus=\"focus\"\n @keydown=\"keydown\"\n >\n <template #suffix>\n <hzzt-icon\n v-if=\"!trueReadonly\"\n class=\"pointer\"\n :name=\"arrowName\"\n @click=\"showSelect\"\n ></hzzt-icon>\n </template>\n </el-input>\n <el-select-v2\n v-if=\"!trueReadonly\"\n :class=\"selectCls\"\n v-model=\"selectVal\"\n ref=\"selectRef\"\n v-bind=\"_selectProps\"\n @change=\"selectChange\"\n @visible-change=\"selectVisibleChange\"\n >\n <template #default=\"{ item }\">\n <slot :item=\"item\" />\n </template>\n </el-select-v2>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { selectEmits, selectProps } from './select'\nimport { computed, ref, useAttrs, watch } from 'vue'\nimport { useFormDisabled, useFormSize } from 'element-plus'\nimport { useGlobalSize, useNamespace } from '@hzzt-plus/hooks'\nimport { ElInput, ElSelectV2 } from 'element-plus'\nimport type { CSSProperties } from 'vue'\nimport HzztIcon from '@hzzt-plus/components/icon/src/index.vue'\n\ndefineOptions({\n name: 'HzztSelect',\n inheritAttrs: false,\n})\n\nconst props = defineProps(selectProps)\nconst emit = defineEmits(selectEmits)\n\nconst attrs = useAttrs()\n\nconst inputVal = ref(props.modelValue)\nconst selectVal = ref()\nconst inputRef = ref()\nconst selectRef = ref()\nconst arrowName = ref('arrow-down')\n\nconst nsSelect = useNamespace('select')\n\nconst formSize = useFormSize()\nconst formDisabled = useFormDisabled()\n\nconst trueSize = computed(\n () => props.size || formSize.value || useGlobalSize().value\n)\n\nconst trueDisabled = computed(() => props.disabled || formDisabled.value)\n\nconst trueReadonly = computed(() => props.readonly || trueDisabled.value)\n\nconst containerCls = computed(() => [\n 'relative',\n 'line-height-1',\n attrs.class,\n nsSelect.b(),\n nsSelect.m(trueSize.value),\n])\n\nconst containerStyle = computed(() => attrs.style as CSSProperties)\n\nconst inputCls = computed(() => [nsSelect.e('input'), 'width-100%'])\n\nconst selectCls = computed(() => [nsSelect.e('select'), 'width-100%'])\n\nconst _inputProps = computed(() => ({\n disabled: trueDisabled.value,\n size: trueSize.value,\n clearable: props.clearable,\n placeholder: props.placeholder,\n readonly: props.readonly,\n ...attrs,\n class: '',\n style: {\n position: trueReadonly.value ? 'static' : 'absolute',\n left: 0,\n top: 0,\n right: 0,\n zIndex: 2,\n },\n}))\n\nconst _selectProps = computed(() => ({\n options: props.options,\n size: trueSize.value,\n filterable: true,\n popperClass: 'select-v2-popper-min-width-100',\n ...props.selectProps,\n}))\n\nwatch(\n () => props.modelValue,\n (v) => {\n inputVal.value = v\n }\n)\n\nwatch(\n () => inputVal.value,\n (v) => {\n selectVal.value = v\n }\n)\n\nfunction input(str: string) {\n if (selectRef.value?.dropdownMenuVisible) {\n selectRef.value.states.inputValue = inputVal.value\n selectRef.value.debouncedOnInputChange()\n } else {\n selectRef.value.dropdownMenuVisible = true\n setTimeout(() => {\n selectRef.value.states.inputValue = inputVal.value\n selectRef.value.debouncedOnInputChange()\n }, 200)\n }\n emit('update:modelValue', str)\n emit('input', str)\n}\n\nfunction change(str: string) {\n emit('change', str)\n}\n\nfunction focus() {\n if (selectRef.value && props.autoPullDown) {\n setTimeout(() => {\n selectRef.value.dropdownMenuVisible = true\n }, 200)\n }\n}\n\nfunction keydown(e: KeyboardEvent | Event) {\n const key = 'key' in e && e.key\n if (key === 'ArrowDown') {\n emit('arrow-down', e)\n selectRef.value.dropdownMenuVisible = false\n } else if (key === 'ArrowUp') {\n emit('arrow-up', e)\n selectRef.value.dropdownMenuVisible = false\n } else if (key === 'ArrowLeft') {\n const index = inputRef.value.input.selectionStart\n if (index === 0) {\n emit('arrow-left', e)\n selectRef.value.dropdownMenuVisible = false\n }\n } else if (key === 'ArrowRight') {\n const index = inputRef.value.input.selectionStart\n if ((inputVal.value?.length ?? 0) === index) {\n emit('arrow-right', e)\n selectRef.value.dropdownMenuVisible = false\n }\n } else if (key === 'Enter') {\n emit('enter', e)\n selectRef.value.dropdownMenuVisible = false\n }\n}\n\nfunction showSelect() {\n if (selectRef.value) {\n selectRef.value.dropdownMenuVisible = !selectRef.value.dropdownMenuVisible\n }\n}\n\nfunction selectChange(v: string) {\n let str = inputVal.value || ''\n if (props.replace) {\n str = v\n } else {\n str += v\n }\n emit('update:modelValue', str)\n emit('input', str)\n inputVal.value = str\n setTimeout(() => {\n inputRef.value.focus()\n setTimeout(() => {\n selectRef.value.dropdownMenuVisible = false\n }, 250)\n emit('change', str)\n })\n}\n\nfunction selectVisibleChange(v: boolean) {\n arrowName.value = v ? 'arrow-up' : 'arrow-down'\n}\n</script>\n"],"names":["useAttrs","ref","useNamespace","useFormSize","useFormDisabled","computed","useGlobalSize","watch","_openBlock","_createElementBlock","_normalizeClass","_unref","_createVNode","ElInput","_mergeProps"],"mappings":";;;;;;;;;;;;;uCA8Cc,CAAA;AAAA,EACZ,IAAM,EAAA,YAAA;AAAA,EACN,YAAc,EAAA,KAAA;AAChB,CAAA,CAAA,CAAA;;;;;;;AAKA,IAAA,MAAM,Q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I,aAAiB,EAAA;AACnB,QAAA,GAAA,GAAA,CAAA,CAAA;AAAuD,OACzD,MAAA;AAAA,QACF,GAAA,IAAA,CAAA,CAAA;AAEA,OAAA;AACE,MAAI,IAAA,CAAA,mBAAwB,EAAA,GAAA,CAAA,CAAA;AAC5B,MAAA,IAAI,QAAe,EAAA,GAAA,CAAA,CAAA;AACjB,MAAM,QAAA,CAAA,KAAA,GAAA,GAAA,CAAA;AAAA,MACR,UAAO,CAAA,MAAA;AACL,QAAO,QAAA,CAAA,KAAA,CAAA,KAAA,EAAA,CAAA;AAAA,QACT,UAAA,CAAA,MAAA;AACA,UAAA,mCAA6B,GAAA,KAAA,CAAA;AAC7B,SAAA,EAAK;AACL,QAAA,IAAA,CAAA,QAAiB,EAAA,GAAA,CAAA,CAAA;AACjB,OAAA,CAAA,CAAA;AACE,KAAA;AACA,IAAA,SAAA,mBAAiB,CAAA,CAAA,EAAA;AACf,MAAA,SAAA,CAAA,YAAsC,UAAA,GAAA,YAAA,CAAA;AAAA,KAAA;AAExC,IAAA,OAAA,CAAA,YAAkB,KAAA;AAAA,MACpB,OAACC,aAAA,EAAA,EAAAC,sBAAA,CAAA,KAAA,EAAA;AAAA,QACH,KAAA,EAAAC,kBAAA,CAAAC,SAAA,CAAA,YAAA,CAAA,CAAA;AAEA,QAAA,KAAS,8BAAgC,CAAA,cAAA,CAAA,CAAA;AACvC,OAAU,EAAA;AAAyB,QACrCC,eAAA,CAAAD,SAAA,CAAAE,mBAAA,CAAA,EAAAC,cAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -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,EAAA,IAAA;AAA8B,MAClC,mBAAuB;AAAA,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KAAA,CAAA,CAAA;AACtC,OAAA,UAAuB,KAAA,CAAA,OAAA,EAAA;AACrB,QAAU,OAAA,GAAA,KAAA,CAAM;AAAiB,OACnC,MAAA;AACE,QAAU,OAAA,GAAA,QAAA,CAAA,KAAA,GAAA,CAAA,EAAA,QAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,KAAA,CAAA,EAAA,KAAA,CAAA,CAAA,GAAA,KAAA,CAAA;AAAA,OACL;AACL,MAAU,QAAA,CAAA,KAAA,GAAA,OAAiB,CAAA;AAA4C,MACzE,KAAA,CAAA,OAAA,CAAA,CAAA;AACA,MAAA,MAAA,CAAA,OAAiB,CAAA,CAAA;AACjB,KAAA;AACA,IAAA,OAAA,CAAA,IAAc,EAAA,MAAA,KAAA;AAAA,MAChB,OAAAC,aAAA,EAAA,EAAAC,sBAAA,CAAA,KAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,132 +2,54 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var vue = require('vue');
6
- var selectInput = require('./select-input.js');
5
+ require('../../../utils/index.js');
7
6
  require('../../../hooks/index.js');
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');
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');
14
12
 
15
- const _hoisted_1 = { slot: "append" };
16
- const _hoisted_2 = { key: 0 };
17
- const __default__ = vue.defineComponent({
18
- name: "HzztSelectInput"
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
19
46
  });
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"]]);
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
+ };
131
52
 
132
- exports["default"] = SelectInput;
53
+ exports.selectInputEmits = selectInputEmits;
54
+ exports.selectInputProps = selectInputProps;
133
55
  //# sourceMappingURL=select-input2.js.map