hzzt-plus 2.0.6 → 2.0.7

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 (78) hide show
  1. package/dist/index.full.js +66 -64
  2. package/dist/index.full.min.js +10 -10
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +10 -10
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +66 -64
  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/click-input/index.mjs +2 -2
  16. package/es/components/click-input/src/click-input.mjs +84 -21
  17. package/es/components/click-input/src/click-input.mjs.map +1 -1
  18. package/es/components/click-input/src/click-input2.mjs +21 -84
  19. package/es/components/click-input/src/click-input2.mjs.map +1 -1
  20. package/es/components/collapse/index.mjs +2 -2
  21. package/es/components/collapse/src/collapse.mjs +0 -88
  22. package/es/components/collapse/src/collapse.mjs.map +1 -1
  23. package/es/components/collapse/src/collapse2.mjs +88 -0
  24. package/es/components/collapse/src/collapse2.mjs.map +1 -1
  25. package/es/components/icon/index.d.ts +432 -3
  26. package/es/components/icon/index.mjs +12 -11
  27. package/es/components/icon/index.mjs.map +1 -1
  28. package/es/components/icon/src/index.mjs +4 -1
  29. package/es/components/icon/src/index.mjs.map +1 -1
  30. package/es/components/index.mjs +3 -3
  31. package/es/components/select-input/index.mjs +2 -2
  32. package/es/components/select-input/src/select-input.mjs +45 -124
  33. package/es/components/select-input/src/select-input.mjs.map +1 -1
  34. package/es/components/select-input/src/select-input2.mjs +124 -45
  35. package/es/components/select-input/src/select-input2.mjs.map +1 -1
  36. package/es/components/select-textarea/src/select-textarea2.mjs +1 -1
  37. package/es/components/title/index.mjs +2 -2
  38. package/es/components/title/src/title.mjs +11 -54
  39. package/es/components/title/src/title.mjs.map +1 -1
  40. package/es/components/title/src/title2.mjs +54 -11
  41. package/es/components/title/src/title2.mjs.map +1 -1
  42. package/es/index.mjs +3 -3
  43. package/es/version.d.ts +1 -1
  44. package/es/version.mjs +1 -1
  45. package/es/version.mjs.map +1 -1
  46. package/lib/components/click-input/index.js +2 -2
  47. package/lib/components/click-input/src/click-input.js +84 -22
  48. package/lib/components/click-input/src/click-input.js.map +1 -1
  49. package/lib/components/click-input/src/click-input2.js +22 -84
  50. package/lib/components/click-input/src/click-input2.js.map +1 -1
  51. package/lib/components/collapse/index.js +2 -2
  52. package/lib/components/collapse/src/collapse.js +0 -91
  53. package/lib/components/collapse/src/collapse.js.map +1 -1
  54. package/lib/components/collapse/src/collapse2.js +91 -0
  55. package/lib/components/collapse/src/collapse2.js.map +1 -1
  56. package/lib/components/icon/index.d.ts +432 -3
  57. package/lib/components/icon/index.js +14 -13
  58. package/lib/components/icon/index.js.map +1 -1
  59. package/lib/components/icon/src/index.js +4 -1
  60. package/lib/components/icon/src/index.js.map +1 -1
  61. package/lib/components/index.js +3 -3
  62. package/lib/components/select-input/index.js +2 -2
  63. package/lib/components/select-input/src/select-input.js +46 -124
  64. package/lib/components/select-input/src/select-input.js.map +1 -1
  65. package/lib/components/select-input/src/select-input2.js +124 -46
  66. package/lib/components/select-input/src/select-input2.js.map +1 -1
  67. package/lib/components/select-textarea/src/select-textarea2.js +1 -1
  68. package/lib/components/title/index.js +2 -2
  69. package/lib/components/title/src/title.js +11 -54
  70. package/lib/components/title/src/title.js.map +1 -1
  71. package/lib/components/title/src/title2.js +54 -11
  72. package/lib/components/title/src/title2.js.map +1 -1
  73. package/lib/index.js +3 -3
  74. package/lib/version.d.ts +1 -1
  75. package/lib/version.js +1 -1
  76. package/lib/version.js.map +1 -1
  77. package/package.json +1 -1
  78. package/web-types.json +1 -1
@@ -1,89 +1,26 @@
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';
1
+ import '../../../utils/index.mjs';
3
2
  import '../../../hooks/index.mjs';
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';
3
+ import '../../../constants/index.mjs';
4
+ import { buildProps } from '../../../utils/vue/props/runtime.mjs';
5
+ import { useSizeProp } from '../../../hooks/use-size/index.mjs';
6
+ import { UPDATE_MODEL_EVENT } from '../../../constants/event.mjs';
7
+ import { isString } from '@vue/shared';
8
8
 
9
- const __default__ = defineComponent({
10
- name: "HzztClickInput"
9
+ const clickInputProps = buildProps({
10
+ modelValue: {
11
+ type: String,
12
+ default: ""
13
+ },
14
+ disabled: Boolean,
15
+ readonly: Boolean,
16
+ inputProps: Object,
17
+ size: useSizeProp
11
18
  });
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"]]);
19
+ const clickInputEmits = {
20
+ [UPDATE_MODEL_EVENT]: (value) => isString(value),
21
+ input: (value) => isString(value),
22
+ change: (value) => isString(value)
23
+ };
87
24
 
88
- export { ClickInput as default };
25
+ export { clickInputEmits, clickInputProps };
89
26
  //# sourceMappingURL=click-input2.mjs.map
@@ -1 +1 @@
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;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"click-input2.mjs","sources":["../../../../../../packages/components/click-input/src/click-input.ts"],"sourcesContent":["import {buildProps, isString} from '@hzzt-plus/utils'\nimport {useSizeProp} from \"@hzzt-plus/hooks\";\n\nimport type { ExtractPropTypes } from 'vue'\nimport type ClickInput from './click-input.vue'\nimport {UPDATE_MODEL_EVENT} from \"@hzzt-plus/constants\";\n\nexport const clickInputProps = buildProps({\n modelValue: {\n type: String,\n default: '',\n },\n disabled: Boolean,\n readonly: Boolean,\n inputProps: Object,\n size: useSizeProp,\n})\n\nexport type ClickInputProps = ExtractPropTypes<typeof clickInputProps>\n\nexport const clickInputEmits = {\n [UPDATE_MODEL_EVENT]: (value: string) => isString(value),\n input: (value: string) => isString(value),\n change: (value: string) => isString(value),\n}\nexport type ClickInputEmits = typeof clickInputEmits\n\nexport type ClickInputInstance = InstanceType<typeof ClickInput>\n"],"names":[],"mappings":";;;;;;;;AAGY,MAAC,eAAe,GAAG,UAAU,CAAC;AAC1C,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,UAAU,EAAE,MAAM;AACpB,EAAE,IAAI,EAAE,WAAW;AACnB,CAAC,EAAE;AACS,MAAC,eAAe,GAAG;AAC/B,EAAE,CAAC,kBAAkB,GAAG,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AAClD,EAAE,KAAK,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACnC,EAAE,MAAM,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACpC;;;;"}
@@ -1,6 +1,6 @@
1
1
  import '../../utils/index.mjs';
2
- import Collapse from './src/collapse.mjs';
3
- import './src/collapse2.mjs';
2
+ import Collapse from './src/collapse2.mjs';
3
+ import './src/collapse.mjs';
4
4
  import { withInstall } from '../../utils/vue/install.mjs';
5
5
 
6
6
  const HzztCollapse = withInstall(Collapse);
@@ -1,90 +1,2 @@
1
- import { defineComponent, ref, watch, openBlock, createElementBlock, createElementVNode, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createVNode, unref, withDirectives, vShow } from 'vue';
2
- import '../../../hooks/index.mjs';
3
- import HzztIcon from '../../icon/src/index.mjs';
4
- import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
- import { useLocale } from '../../../hooks/use-locale/index.mjs';
6
1
 
7
- const _hoisted_1 = { class: "hzzt-collapse flex column" };
8
- const _hoisted_2 = { class: "hzzt-collapse__top" };
9
- const _hoisted_3 = { class: "hzzt-collapse__title" };
10
- const _hoisted_4 = {
11
- key: 0,
12
- class: "hzzt-collapse__line"
13
- };
14
- const _hoisted_5 = { class: "hzzt-collapse__content flex-1" };
15
- const __default__ = defineComponent({
16
- name: "HzztCollapse"
17
- });
18
- const _sfc_main = /* @__PURE__ */ defineComponent({
19
- ...__default__,
20
- props: {
21
- defaultActive: {
22
- type: Boolean,
23
- default: true
24
- },
25
- title: {
26
- type: String,
27
- default: ""
28
- },
29
- showLine: {
30
- type: Boolean,
31
- default: true
32
- },
33
- modelValue: {
34
- type: Boolean,
35
- default: true
36
- }
37
- },
38
- emits: ["update:modelValue"],
39
- setup(__props, { emit }) {
40
- const props = __props;
41
- const { t } = useLocale();
42
- const expand = ref(props.modelValue);
43
- if (!props.defaultActive) {
44
- emit("update:modelValue", false);
45
- expand.value = false;
46
- }
47
- watch(() => props.modelValue, (v) => {
48
- expand.value = v;
49
- });
50
- function toggle() {
51
- expand.value = !expand.value;
52
- emit("update:modelValue", expand.value);
53
- }
54
- return (_ctx, _cache) => {
55
- return openBlock(), createElementBlock("div", _hoisted_1, [
56
- createElementVNode("div", _hoisted_2, [
57
- createElementVNode("div", _hoisted_3, [
58
- renderSlot(_ctx.$slots, "title", {}, () => [
59
- createTextVNode(toDisplayString(__props.title), 1)
60
- ])
61
- ]),
62
- __props.showLine ? (openBlock(), createElementBlock("div", _hoisted_4)) : createCommentVNode("v-if", true),
63
- renderSlot(_ctx.$slots, "toggle-btn", {}, () => [
64
- createElementVNode("div", {
65
- class: "hzzt-collapse__btn",
66
- onClick: toggle
67
- }, [
68
- createVNode(HzztIcon, {
69
- name: !expand.value ? "hzzt-plus-square-outline" : "hzzt-minus-square-outline",
70
- class: "hzzt-collapse__icon",
71
- size: "14"
72
- }, null, 8, ["name"]),
73
- createElementVNode("span", null, toDisplayString(expand.value ? unref(t)("hzzt.collapse.retract") : unref(t)("hzzt.collapse.expand")), 1)
74
- ])
75
- ])
76
- ]),
77
- withDirectives(createElementVNode("div", _hoisted_5, [
78
- renderSlot(_ctx.$slots, "default")
79
- ], 512), [
80
- [vShow, expand.value]
81
- ]),
82
- renderSlot(_ctx.$slots, "active", { active: expand.value })
83
- ]);
84
- };
85
- }
86
- });
87
- var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "collapse.vue"]]);
88
-
89
- export { Collapse as default };
90
2
  //# sourceMappingURL=collapse.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"collapse.mjs","sources":["../../../../../../packages/components/collapse/src/collapse.vue"],"sourcesContent":["<template>\n <div class=\"hzzt-collapse flex column\">\n <div class=\"hzzt-collapse__top\">\n <div class=\"hzzt-collapse__title\">\n <slot name=\"title\">\n {{ title }}\n </slot>\n </div>\n <div v-if=\"showLine\" class=\"hzzt-collapse__line\" />\n <slot name=\"toggle-btn\">\n <div class=\"hzzt-collapse__btn\" @click=\"toggle\">\n <hzzt-icon :name=\"!expand ? 'hzzt-plus-square-outline' : 'hzzt-minus-square-outline'\"\n class=\"hzzt-collapse__icon\" size=\"14\" />\n <span>{{ expand ? t('hzzt.collapse.retract') : t('hzzt.collapse.expand') }}</span>\n </div>\n </slot>\n </div>\n <div v-show=\"expand\" class=\"hzzt-collapse__content flex-1\">\n <slot />\n </div>\n\n <slot :active=\"expand\" name=\"active\" />\n </div>\n</template>\n\n<script setup lang=\"ts\">\n import {useLocale} from '@hzzt-plus/hooks'\n import HzztIcon from '@hzzt-plus/components/icon/src/index.vue'\n import {ref, watch} from 'vue'\n\n defineOptions({\n name: 'HzztCollapse',\n })\n const {t} = useLocale()\n const props = defineProps({\n defaultActive: {\n type: Boolean,\n default: true,\n },\n title: {\n type: String,\n default: '',\n },\n showLine: {\n type: Boolean,\n default: true,\n },\n modelValue: {\n type: Boolean,\n default: true,\n },\n })\n const emit = defineEmits(['update:modelValue'])\n\n const expand = ref(props.modelValue)\n\n if (!props.defaultActive) {\n emit('update:modelValue', false);\n expand.value = false;\n }\n\n watch(() => props.modelValue, (v) => {\n expand.value = v;\n })\n\n function toggle() {\n expand.value = !expand.value;\n emit('update:modelValue', expand.value);\n }\n\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;mCA8BgB,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAM,MAAA,EAAC,CAAC,EAAA,GAAI,SAAU,EAAA,CAAA;AAqBtB,IAAM,MAAA,MAAA,GAAS,GAAI,CAAA,KAAA,CAAM,UAAU,CAAA,CAAA;AAEnC,IAAI,IAAA,CAAC,MAAM,aAAe,EAAA;AACxB,MAAA,IAAA,CAAK,qBAAqB,KAAK,CAAA,CAAA;AAC/B,MAAA,MAAA,CAAO,KAAQ,GAAA,KAAA,CAAA;AAAA,KACjB;AAEA,IAAA,KAAA,CAAM,MAAM,KAAA,CAAM,UAAY,EAAA,CAAC,CAAM,KAAA;AACnC,MAAA,MAAA,CAAO,KAAQ,GAAA,CAAA,CAAA;AAAA,KAChB,CAAA,CAAA;AAED,IAAA,SAAS,MAAS,GAAA;AAChB,MAAO,MAAA,CAAA,KAAA,GAAQ,CAAC,MAAO,CAAA,KAAA,CAAA;AACvB,MAAK,IAAA,CAAA,mBAAA,EAAqB,OAAO,KAAK,CAAA,CAAA;AAAA,KACxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"collapse.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,90 @@
1
+ import { defineComponent, ref, watch, openBlock, createElementBlock, createElementVNode, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createVNode, unref, withDirectives, vShow } from 'vue';
2
+ import '../../../hooks/index.mjs';
3
+ import HzztIcon from '../../icon/src/index.mjs';
4
+ import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
5
+ import { useLocale } from '../../../hooks/use-locale/index.mjs';
1
6
 
7
+ const _hoisted_1 = { class: "hzzt-collapse flex column" };
8
+ const _hoisted_2 = { class: "hzzt-collapse__top" };
9
+ const _hoisted_3 = { class: "hzzt-collapse__title" };
10
+ const _hoisted_4 = {
11
+ key: 0,
12
+ class: "hzzt-collapse__line"
13
+ };
14
+ const _hoisted_5 = { class: "hzzt-collapse__content flex-1" };
15
+ const __default__ = defineComponent({
16
+ name: "HzztCollapse"
17
+ });
18
+ const _sfc_main = /* @__PURE__ */ defineComponent({
19
+ ...__default__,
20
+ props: {
21
+ defaultActive: {
22
+ type: Boolean,
23
+ default: true
24
+ },
25
+ title: {
26
+ type: String,
27
+ default: ""
28
+ },
29
+ showLine: {
30
+ type: Boolean,
31
+ default: true
32
+ },
33
+ modelValue: {
34
+ type: Boolean,
35
+ default: true
36
+ }
37
+ },
38
+ emits: ["update:modelValue"],
39
+ setup(__props, { emit }) {
40
+ const props = __props;
41
+ const { t } = useLocale();
42
+ const expand = ref(props.modelValue);
43
+ if (!props.defaultActive) {
44
+ emit("update:modelValue", false);
45
+ expand.value = false;
46
+ }
47
+ watch(() => props.modelValue, (v) => {
48
+ expand.value = v;
49
+ });
50
+ function toggle() {
51
+ expand.value = !expand.value;
52
+ emit("update:modelValue", expand.value);
53
+ }
54
+ return (_ctx, _cache) => {
55
+ return openBlock(), createElementBlock("div", _hoisted_1, [
56
+ createElementVNode("div", _hoisted_2, [
57
+ createElementVNode("div", _hoisted_3, [
58
+ renderSlot(_ctx.$slots, "title", {}, () => [
59
+ createTextVNode(toDisplayString(__props.title), 1)
60
+ ])
61
+ ]),
62
+ __props.showLine ? (openBlock(), createElementBlock("div", _hoisted_4)) : createCommentVNode("v-if", true),
63
+ renderSlot(_ctx.$slots, "toggle-btn", {}, () => [
64
+ createElementVNode("div", {
65
+ class: "hzzt-collapse__btn",
66
+ onClick: toggle
67
+ }, [
68
+ createVNode(HzztIcon, {
69
+ name: !expand.value ? "hzzt-plus-square-outline" : "hzzt-minus-square-outline",
70
+ class: "hzzt-collapse__icon",
71
+ size: "14"
72
+ }, null, 8, ["name"]),
73
+ createElementVNode("span", null, toDisplayString(expand.value ? unref(t)("hzzt.collapse.retract") : unref(t)("hzzt.collapse.expand")), 1)
74
+ ])
75
+ ])
76
+ ]),
77
+ withDirectives(createElementVNode("div", _hoisted_5, [
78
+ renderSlot(_ctx.$slots, "default")
79
+ ], 512), [
80
+ [vShow, expand.value]
81
+ ]),
82
+ renderSlot(_ctx.$slots, "active", { active: expand.value })
83
+ ]);
84
+ };
85
+ }
86
+ });
87
+ var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "collapse.vue"]]);
88
+
89
+ export { Collapse as default };
2
90
  //# sourceMappingURL=collapse2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"collapse2.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}