hzzt-plus 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20537,6 +20537,34 @@ var Collapse = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__file", "collapse.
20537
20537
 
20538
20538
  const HzztCollapse = withInstall$1(Collapse);
20539
20539
 
20540
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
20541
+ __name: "index",
20542
+ props: {
20543
+ name: {
20544
+ type: String,
20545
+ required: true
20546
+ },
20547
+ type: {
20548
+ type: String,
20549
+ default: "el"
20550
+ }
20551
+ },
20552
+ setup(__props) {
20553
+ const props = __props;
20554
+ const attrs = useAttrs$1();
20555
+ const componentName = computed(() => `hzzt-${props.type}-${props.name}`);
20556
+ return (_ctx, _cache) => {
20557
+ return openBlock(), createBlock(unref(ElIcon), normalizeProps(guardReactiveProps(unref(attrs))), {
20558
+ default: withCtx(() => [
20559
+ (openBlock(), createBlock(resolveDynamicComponent(unref(componentName))))
20560
+ ]),
20561
+ _: 1
20562
+ }, 16);
20563
+ };
20564
+ }
20565
+ });
20566
+ var HzztIcon$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__file", "index.vue"]]);
20567
+
20540
20568
  const _hoisted_1$5 = { class: "hzzt-tab flex align-items-center justify-content-between wrap" };
20541
20569
  const _hoisted_2$4 = { class: "flex align-items-center" };
20542
20570
  const _hoisted_3$4 = { class: "flex" };
@@ -20550,7 +20578,7 @@ const _hoisted_7$1 = { class: "flex wrap" };
20550
20578
  const __default__$6 = defineComponent({
20551
20579
  name: "HzztTab"
20552
20580
  });
20553
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
20581
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
20554
20582
  ...__default__$6,
20555
20583
  props: {
20556
20584
  tabList: {
@@ -20559,9 +20587,13 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
20559
20587
  },
20560
20588
  modelValue: {
20561
20589
  type: [Number, String, Array]
20590
+ },
20591
+ closable: {
20592
+ type: Boolean,
20593
+ default: () => false
20562
20594
  }
20563
20595
  },
20564
- emits: ["update:modelValue", "tab-click"],
20596
+ emits: ["update:modelValue", "tab-click", "tab-close"],
20565
20597
  setup(__props, { emit }) {
20566
20598
  const props = __props;
20567
20599
  const customTabList = computed(() => props.tabList.map((value) => {
@@ -20579,11 +20611,15 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
20579
20611
  emit("update:modelValue", tab.name);
20580
20612
  emit("tab-click", tab, event);
20581
20613
  }
20614
+ function close(index, event) {
20615
+ event.stopPropagation();
20616
+ emit("tab-close", index);
20617
+ }
20582
20618
  return (_ctx, _cache) => {
20583
20619
  return openBlock(), createElementBlock("div", _hoisted_1$5, [
20584
20620
  createElementVNode("div", _hoisted_2$4, [
20585
20621
  createElementVNode("div", _hoisted_3$4, [
20586
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(customTabList), (tab) => {
20622
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(customTabList), (tab, index) => {
20587
20623
  return openBlock(), createElementBlock("div", {
20588
20624
  key: tab.key,
20589
20625
  class: "hzzt-tab-pane",
@@ -20593,7 +20629,13 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
20593
20629
  createElementVNode("p", {
20594
20630
  class: normalizeClass([{ active: __props.modelValue === tab.name }, "hzzt-tab-badge-text"])
20595
20631
  }, toDisplayString(tab.label), 3),
20596
- tab.number && tab.number !== 0 ? (openBlock(), createElementBlock("p", _hoisted_6$1, toDisplayString(tab.number > 999 ? "999+" : tab.number), 1)) : createCommentVNode("v-if", true)
20632
+ tab.number && tab.number !== 0 ? (openBlock(), createElementBlock("p", _hoisted_6$1, toDisplayString(tab.number > 999 ? "999+" : tab.number), 1)) : createCommentVNode("v-if", true),
20633
+ __props.closable ? (openBlock(), createBlock(HzztIcon$1, {
20634
+ key: 1,
20635
+ class: "is-icon-close",
20636
+ name: "close",
20637
+ onClick: ($event) => close(index, $event)
20638
+ }, null, 8, ["onClick"])) : createCommentVNode("v-if", true)
20597
20639
  ])
20598
20640
  ], 8, _hoisted_4$3);
20599
20641
  }), 128))
@@ -20608,38 +20650,10 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
20608
20650
  };
20609
20651
  }
20610
20652
  });
20611
- var Tab = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["__file", "index.vue"]]);
20653
+ var Tab = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["__file", "index.vue"]]);
20612
20654
 
20613
20655
  const HzztTab = withInstall$1(Tab);
20614
20656
 
20615
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
20616
- __name: "index",
20617
- props: {
20618
- name: {
20619
- type: String,
20620
- required: true
20621
- },
20622
- type: {
20623
- type: String,
20624
- default: "el"
20625
- }
20626
- },
20627
- setup(__props) {
20628
- const props = __props;
20629
- const attrs = useAttrs$1();
20630
- const componentName = computed(() => `hzzt-${props.type}-${props.name}`);
20631
- return (_ctx, _cache) => {
20632
- return openBlock(), createBlock(unref(ElIcon), normalizeProps(guardReactiveProps(unref(attrs))), {
20633
- default: withCtx(() => [
20634
- (openBlock(), createBlock(resolveDynamicComponent(unref(componentName))))
20635
- ]),
20636
- _: 1
20637
- }, 16);
20638
- };
20639
- }
20640
- });
20641
- var HzztIcon$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["__file", "index.vue"]]);
20642
-
20643
20657
  const HzztIcon = {
20644
20658
  install(app) {
20645
20659
  app.component("HzztIcon", HzztIcon$1);
@@ -6,6 +6,10 @@ export declare const HzztTab: import("hzzt-plus/es/utils").SFCWithInstall<import
6
6
  modelValue: {
7
7
  type: (ArrayConstructor | NumberConstructor | StringConstructor)[];
8
8
  };
9
+ closable: {
10
+ type: BooleanConstructor;
11
+ default: () => boolean;
12
+ };
9
13
  }, {
10
14
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
11
15
  tabList: {
@@ -15,11 +19,16 @@ export declare const HzztTab: import("hzzt-plus/es/utils").SFCWithInstall<import
15
19
  modelValue: {
16
20
  type: (ArrayConstructor | NumberConstructor | StringConstructor)[];
17
21
  };
22
+ closable: {
23
+ type: BooleanConstructor;
24
+ default: () => boolean;
25
+ };
18
26
  }>> & {
19
27
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
20
28
  "onTab-click"?: ((...args: any[]) => any) | undefined;
29
+ "onTab-close"?: ((...args: any[]) => any) | undefined;
21
30
  }>>;
22
- emit: (event: "update:modelValue" | "tab-click", ...args: any[]) => void;
31
+ emit: (event: "update:modelValue" | "tab-click" | "tab-close", ...args: any[]) => void;
23
32
  customTabList: import("vue").ComputedRef<{
24
33
  number: number;
25
34
  hide: boolean;
@@ -27,8 +36,151 @@ export declare const HzztTab: import("hzzt-plus/es/utils").SFCWithInstall<import
27
36
  label: string;
28
37
  key: string;
29
38
  }[]>;
30
- tabClick: (tab: any, event: any) => void;
31
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "tab-click")[], "update:modelValue" | "tab-click", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
39
+ tabClick: (tab: {
40
+ name: string;
41
+ label: string;
42
+ number: number;
43
+ hide: boolean;
44
+ }, event: Event) => void;
45
+ close: (index: number, event: Event) => void;
46
+ HzztIcon: import("vue").DefineComponent<{
47
+ name: {
48
+ type: StringConstructor;
49
+ required: true;
50
+ };
51
+ type: {
52
+ type: StringConstructor;
53
+ default: string;
54
+ };
55
+ }, {
56
+ props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
57
+ name: {
58
+ type: StringConstructor;
59
+ required: true;
60
+ };
61
+ type: {
62
+ type: StringConstructor;
63
+ default: string;
64
+ };
65
+ }>> & {
66
+ [x: string & `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
67
+ }>>;
68
+ attrs: {
69
+ [x: string]: unknown;
70
+ };
71
+ componentName: import("vue").ComputedRef<string>;
72
+ ElIcon: import("element-plus/es/utils").SFCWithInstall<{
73
+ new (...args: any[]): {
74
+ $: import("vue").ComponentInternalInstance;
75
+ $data: {};
76
+ $props: Partial<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{
77
+ readonly size: {
78
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown>>;
79
+ readonly required: false;
80
+ readonly validator: ((val: unknown) => boolean) | undefined;
81
+ __epPropKey: true;
82
+ };
83
+ readonly color: {
84
+ readonly type: import("vue").PropType<string>;
85
+ readonly required: false;
86
+ readonly validator: ((val: unknown) => boolean) | undefined;
87
+ __epPropKey: true;
88
+ };
89
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>;
90
+ $attrs: {
91
+ [x: string]: unknown;
92
+ };
93
+ $refs: {
94
+ [x: string]: unknown;
95
+ };
96
+ $slots: Readonly<{
97
+ [name: string]: import("vue").Slot | undefined;
98
+ }>;
99
+ $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
100
+ $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
101
+ $emit: (event: string, ...args: any[]) => void;
102
+ $el: any;
103
+ $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
104
+ readonly size: {
105
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown>>;
106
+ readonly required: false;
107
+ readonly validator: ((val: unknown) => boolean) | undefined;
108
+ __epPropKey: true;
109
+ };
110
+ readonly color: {
111
+ readonly type: import("vue").PropType<string>;
112
+ readonly required: false;
113
+ readonly validator: ((val: unknown) => boolean) | undefined;
114
+ __epPropKey: true;
115
+ };
116
+ }>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, {}> & {
117
+ beforeCreate?: ((() => void) | (() => void)[]) | undefined;
118
+ created?: ((() => void) | (() => void)[]) | undefined;
119
+ beforeMount?: ((() => void) | (() => void)[]) | undefined;
120
+ mounted?: ((() => void) | (() => void)[]) | undefined;
121
+ beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
122
+ updated?: ((() => void) | (() => void)[]) | undefined;
123
+ activated?: ((() => void) | (() => void)[]) | undefined;
124
+ deactivated?: ((() => void) | (() => void)[]) | undefined;
125
+ beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
126
+ beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
127
+ destroyed?: ((() => void) | (() => void)[]) | undefined;
128
+ unmounted?: ((() => void) | (() => void)[]) | undefined;
129
+ renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
130
+ renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
131
+ errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
132
+ };
133
+ $forceUpdate: () => void;
134
+ $nextTick: typeof import("vue").nextTick;
135
+ $watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
136
+ } & Readonly<import("vue").ExtractPropTypes<{
137
+ readonly size: {
138
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown>>;
139
+ readonly required: false;
140
+ readonly validator: ((val: unknown) => boolean) | undefined;
141
+ __epPropKey: true;
142
+ };
143
+ readonly color: {
144
+ readonly type: import("vue").PropType<string>;
145
+ readonly required: false;
146
+ readonly validator: ((val: unknown) => boolean) | undefined;
147
+ __epPropKey: true;
148
+ };
149
+ }>> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties;
150
+ __isFragment?: undefined;
151
+ __isTeleport?: undefined;
152
+ __isSuspense?: undefined;
153
+ } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
154
+ readonly size: {
155
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown>>;
156
+ readonly required: false;
157
+ readonly validator: ((val: unknown) => boolean) | undefined;
158
+ __epPropKey: true;
159
+ };
160
+ readonly color: {
161
+ readonly type: import("vue").PropType<string>;
162
+ readonly required: false;
163
+ readonly validator: ((val: unknown) => boolean) | undefined;
164
+ __epPropKey: true;
165
+ };
166
+ }>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
167
+ $slots: {
168
+ default?(_: {}): any;
169
+ };
170
+ })>;
171
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
172
+ name: {
173
+ type: StringConstructor;
174
+ required: true;
175
+ };
176
+ type: {
177
+ type: StringConstructor;
178
+ default: string;
179
+ };
180
+ }>>, {
181
+ type: string;
182
+ }>;
183
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "tab-click" | "tab-close")[], "update:modelValue" | "tab-click" | "tab-close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
32
184
  tabList: {
33
185
  type: ArrayConstructor;
34
186
  default: () => never[];
@@ -36,10 +188,16 @@ export declare const HzztTab: import("hzzt-plus/es/utils").SFCWithInstall<import
36
188
  modelValue: {
37
189
  type: (ArrayConstructor | NumberConstructor | StringConstructor)[];
38
190
  };
191
+ closable: {
192
+ type: BooleanConstructor;
193
+ default: () => boolean;
194
+ };
39
195
  }>> & {
40
196
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
41
197
  "onTab-click"?: ((...args: any[]) => any) | undefined;
198
+ "onTab-close"?: ((...args: any[]) => any) | undefined;
42
199
  }, {
43
200
  tabList: unknown[];
201
+ closable: boolean;
44
202
  }>> & Record<string, any>;
45
203
  export default HzztTab;
@@ -1,4 +1,5 @@
1
- import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, Fragment, renderList, unref, normalizeClass, toDisplayString, createCommentVNode, renderSlot } from 'vue';
1
+ import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, Fragment, renderList, unref, normalizeClass, toDisplayString, createCommentVNode, createBlock, renderSlot } from 'vue';
2
+ import HzztIcon from '../../icon/src/index.mjs';
2
3
  import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
3
4
 
4
5
  const _hoisted_1 = { class: "hzzt-tab flex align-items-center justify-content-between wrap" };
@@ -23,9 +24,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23
24
  },
24
25
  modelValue: {
25
26
  type: [Number, String, Array]
27
+ },
28
+ closable: {
29
+ type: Boolean,
30
+ default: () => false
26
31
  }
27
32
  },
28
- emits: ["update:modelValue", "tab-click"],
33
+ emits: ["update:modelValue", "tab-click", "tab-close"],
29
34
  setup(__props, { emit }) {
30
35
  const props = __props;
31
36
  const customTabList = computed(() => props.tabList.map((value) => {
@@ -43,11 +48,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43
48
  emit("update:modelValue", tab.name);
44
49
  emit("tab-click", tab, event);
45
50
  }
51
+ function close(index, event) {
52
+ event.stopPropagation();
53
+ emit("tab-close", index);
54
+ }
46
55
  return (_ctx, _cache) => {
47
56
  return openBlock(), createElementBlock("div", _hoisted_1, [
48
57
  createElementVNode("div", _hoisted_2, [
49
58
  createElementVNode("div", _hoisted_3, [
50
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(customTabList), (tab) => {
59
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(customTabList), (tab, index) => {
51
60
  return openBlock(), createElementBlock("div", {
52
61
  key: tab.key,
53
62
  class: "hzzt-tab-pane",
@@ -57,7 +66,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
57
66
  createElementVNode("p", {
58
67
  class: normalizeClass([{ active: __props.modelValue === tab.name }, "hzzt-tab-badge-text"])
59
68
  }, toDisplayString(tab.label), 3),
60
- tab.number && tab.number !== 0 ? (openBlock(), createElementBlock("p", _hoisted_6, toDisplayString(tab.number > 999 ? "999+" : tab.number), 1)) : createCommentVNode("v-if", true)
69
+ tab.number && tab.number !== 0 ? (openBlock(), createElementBlock("p", _hoisted_6, toDisplayString(tab.number > 999 ? "999+" : tab.number), 1)) : createCommentVNode("v-if", true),
70
+ __props.closable ? (openBlock(), createBlock(HzztIcon, {
71
+ key: 1,
72
+ class: "is-icon-close",
73
+ name: "close",
74
+ onClick: ($event) => close(index, $event)
75
+ }, null, 8, ["onClick"])) : createCommentVNode("v-if", true)
61
76
  ])
62
77
  ], 8, _hoisted_4);
63
78
  }), 128))
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/tab/src/index.vue"],"sourcesContent":["<template>\n <div class=\"hzzt-tab flex align-items-center justify-content-between wrap\">\n <div class=\"flex align-items-center\">\n <div class=\"flex\">\n <div\n v-for=\"tab in customTabList\"\n :key=\"tab.key\"\n class=\"hzzt-tab-pane\"\n @click=\"tabClick(tab, $event)\"\n >\n <div class=\"hzzt-tab-badge\">\n <p\n :class=\"{ active: modelValue === tab.name }\"\n class=\"hzzt-tab-badge-text\"\n >\n {{ tab.label }}\n </p>\n <p\n v-if=\"tab.number && tab.number !== 0\"\n class=\"hzzt-tab-badge-count\"\n >\n {{ tab.number > 999 ? '999+' : tab.number }}\n </p>\n </div>\n </div>\n </div>\n <slot name=\"filter\" />\n <slot name=\"extra\" />\n </div>\n <div class=\"flex wrap\">\n <slot name=\"right\" />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\n\ndefineOptions({\n name: 'HzztTab',\n})\n\ndeclare type Tab = {\n name: string\n label: string\n number: number\n hide: boolean\n}\n\nconst props = defineProps({\n tabList: {\n type: Array,\n default: () => [],\n },\n modelValue: {\n type: [Number, String, Array],\n },\n})\n\nconst emit = defineEmits(['update:modelValue', 'tab-click'])\n\nconst customTabList = computed(() =>\n props.tabList\n .map((value) => {\n const tab = value as Tab\n return {\n key: `${tab.name}-${tab.number}` as string,\n ...tab,\n number: Number(tab.number || 0),\n hide: tab.hide,\n }\n })\n .filter((tab) => !tab.hide)\n)\n\nfunction tabClick(tab, event) {\n if (tab.name === props.modelValue) return\n emit('update:modelValue', tab.name)\n emit('tab-click', tab, event)\n}\n</script>\n"],"names":["_openBlock","_createElementBlock"],"mappings":";;;;;;;;;;;;;mCAsCc,CAAA;AAAA,EACZ,IAAM,EAAA,SAAA;AACR,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;AAqBA,IAAA,MAAM,aAAgB,GAAA,QAAA,CAAA,MAAA,KAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,KAAA,KAAA;AAAA,MAAS,MAC7B,GAAA,GAAM,KACH,CAAA;AACC,MAAA,OAAA;AACA,QAAO,GAAA,EAAA,CAAA,EAAA,GAAA,CAAA,IAAA,CAAA,CAAA,EAAA,GAAA,CAAA,MAAA,CAAA,CAAA;AAAA,QAAA;AACyB,QAAA,MAC3B,EAAA,MAAA,CAAA,GAAA,CAAA,MAAA,IAAA,CAAA,CAAA;AAAA,QAAA,IACK,EAAA,GAAA,CAAA,IAAA;AAAsB,OAAA,CAAA;AACpB,KACZ,CAAA,CAAA,MAAA,CAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AAAA,IAAA,SAED,QAAgB,CAAA,GAAA,OAAS,EAAA;AAAA,MAC9B,IAAA,GAAA,CAAA,IAAA,KAAA,KAAA,CAAA,UAAA;AAEA,QAAS,OAAA;AACP,MAAI,IAAA,CAAA,mBAAmB,EAAA,GAAA,CAAA,IAAA,CAAA,CAAA;AAAY,MAAA,IAAA,CAAA,WAAA,EAAA,GAAA,EAAA,KAAA,CAAA,CAAA;AACnC,KAAK;AACL,IAAK,OAAA,CAAA,IAAA,EAAA,MAAa,KAAK;AAAK,MAC9B,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAAA,KAAA,EAAA,UAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/tab/src/index.vue"],"sourcesContent":["<template>\n <div class=\"hzzt-tab flex align-items-center justify-content-between wrap\">\n <div class=\"flex align-items-center\">\n <div class=\"flex\">\n <div\n v-for=\"(tab, index) in customTabList\"\n :key=\"tab.key\"\n class=\"hzzt-tab-pane\"\n @click=\"tabClick(tab, $event)\"\n >\n <div class=\"hzzt-tab-badge\">\n <p\n :class=\"{ active: modelValue === tab.name }\"\n class=\"hzzt-tab-badge-text\"\n >\n {{ tab.label }}\n </p>\n <p\n v-if=\"tab.number && tab.number !== 0\"\n class=\"hzzt-tab-badge-count\"\n >\n {{ tab.number > 999 ? '999+' : tab.number }}\n </p>\n <hzzt-icon\n v-if=\"closable\"\n class=\"is-icon-close\"\n name=\"close\"\n @click=\"close(index, $event)\"\n />\n </div>\n </div>\n </div>\n <slot name=\"filter\" />\n <slot name=\"extra\" />\n </div>\n <div class=\"flex wrap\">\n <slot name=\"right\" />\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed } from 'vue'\nimport HzztIcon from '@hzzt-plus/components/icon/src/index.vue'\n\ndefineOptions({\n name: 'HzztTab',\n})\n\ndeclare type Tab = {\n name: string\n label: string\n number: number\n hide: boolean\n}\n\nconst props = defineProps({\n tabList: {\n type: Array,\n default: () => [],\n },\n modelValue: {\n type: [Number, String, Array],\n },\n closable: {\n type: Boolean,\n default: () => false,\n },\n})\n\nconst emit = defineEmits(['update:modelValue', 'tab-click', 'tab-close'])\n\nconst customTabList = computed(() =>\n props.tabList\n .map((value) => {\n const tab = value as Tab\n return {\n key: `${tab.name}-${tab.number}` as string,\n ...tab,\n number: Number(tab.number || 0),\n hide: tab.hide,\n }\n })\n .filter((tab) => !tab.hide)\n)\n\nfunction tabClick(tab: Tab, event: Event) {\n if (tab.name === props.modelValue) return\n emit('update:modelValue', tab.name)\n emit('tab-click', tab, event)\n}\n\nfunction close(index: number, event: Event) {\n event.stopPropagation()\n emit('tab-close', index)\n}\n</script>\n"],"names":["_openBlock","_createElementBlock"],"mappings":";;;;;;;;;;;;;;mCA6Cc,CAAA;AAAA,EACZ,IAAM,EAAA,SAAA;AACR,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;AAyBA,IAAA,MAAM,aAAgB,GAAA,QAAA,CAAA,MAAA,KAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,KAAA,KAAA;AAAA,MAAS,MAC7B,GAAA,GAAM,KACH,CAAA;AACC,MAAA,OAAA;AACA,QAAO,GAAA,EAAA,CAAA,EAAA,GAAA,CAAA,IAAA,CAAA,CAAA,EAAA,GAAA,CAAA,MAAA,CAAA,CAAA;AAAA,QAAA;AACyB,QAAA,MAC3B,EAAA,MAAA,CAAA,GAAA,CAAA,MAAA,IAAA,CAAA,CAAA;AAAA,QAAA,IACK,EAAA,GAAA,CAAA,IAAA;AAAsB,OAAA,CAAA;AACpB,KACZ,CAAA,CAAA,MAAA,CAAA,CAAA,GAAA,KAAA,CAAA,GAAA,CAAA,IAAA,CAAA,CAAA,CAAA;AAAA,IAAA,SAED,QAAgB,CAAA,GAAA,OAAS,EAAA;AAAA,MAC9B,IAAA,GAAA,CAAA,IAAA,KAAA,KAAA,CAAA,UAAA;AAEA,QAAS,OAAA;AACP,MAAI,IAAA,CAAA,mBAAmB,EAAA,GAAA,CAAA,IAAA,CAAA,CAAA;AAAY,MAAA,IAAA,CAAA,WAAA,EAAA,GAAA,EAAA,KAAA,CAAA,CAAA;AACnC,KAAK;AACL,IAAK,SAAA,KAAA,CAAA,KAAa,OAAU,EAAA;AAAA,MAC9B,KAAA,CAAA,eAAA,EAAA,CAAA;AAEA,MAAS,IAAA,CAAA,kBAAmC,CAAA,CAAA;AAC1C,KAAA;AACA,IAAA,OAAK,aAAa,KAAK;AAAA,MACzB,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAAA,KAAA,EAAA,UAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,3 +1,9 @@
1
+ declare type Tab = {
2
+ name: string;
3
+ label: string;
4
+ number: number;
5
+ hide: boolean;
6
+ };
1
7
  declare const _default: import("vue").DefineComponent<{
2
8
  tabList: {
3
9
  type: ArrayConstructor;
@@ -6,6 +12,10 @@ declare const _default: import("vue").DefineComponent<{
6
12
  modelValue: {
7
13
  type: (ArrayConstructor | NumberConstructor | StringConstructor)[];
8
14
  };
15
+ closable: {
16
+ type: BooleanConstructor;
17
+ default: () => boolean;
18
+ };
9
19
  }, {
10
20
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
11
21
  tabList: {
@@ -15,11 +25,16 @@ declare const _default: import("vue").DefineComponent<{
15
25
  modelValue: {
16
26
  type: (ArrayConstructor | NumberConstructor | StringConstructor)[];
17
27
  };
28
+ closable: {
29
+ type: BooleanConstructor;
30
+ default: () => boolean;
31
+ };
18
32
  }>> & {
19
33
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
20
34
  "onTab-click"?: ((...args: any[]) => any) | undefined;
35
+ "onTab-close"?: ((...args: any[]) => any) | undefined;
21
36
  }>>;
22
- emit: (event: "update:modelValue" | "tab-click", ...args: any[]) => void;
37
+ emit: (event: "update:modelValue" | "tab-click" | "tab-close", ...args: any[]) => void;
23
38
  customTabList: import("vue").ComputedRef<{
24
39
  number: number;
25
40
  hide: boolean;
@@ -27,8 +42,146 @@ declare const _default: import("vue").DefineComponent<{
27
42
  label: string;
28
43
  key: string;
29
44
  }[]>;
30
- tabClick: (tab: any, event: any) => void;
31
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "tab-click")[], "update:modelValue" | "tab-click", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
45
+ tabClick: (tab: Tab, event: Event) => void;
46
+ close: (index: number, event: Event) => void;
47
+ HzztIcon: import("vue").DefineComponent<{
48
+ name: {
49
+ type: StringConstructor;
50
+ required: true;
51
+ };
52
+ type: {
53
+ type: StringConstructor;
54
+ default: string;
55
+ };
56
+ }, {
57
+ props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
58
+ name: {
59
+ type: StringConstructor;
60
+ required: true;
61
+ };
62
+ type: {
63
+ type: StringConstructor;
64
+ default: string;
65
+ };
66
+ }>> & {
67
+ [x: string & `on${string}`]: ((...args: any[]) => any) | ((...args: unknown[]) => any) | undefined;
68
+ }>>;
69
+ attrs: {
70
+ [x: string]: unknown;
71
+ };
72
+ componentName: import("vue").ComputedRef<string>;
73
+ ElIcon: import("element-plus/es/utils").SFCWithInstall<{
74
+ new (...args: any[]): {
75
+ $: import("vue").ComponentInternalInstance;
76
+ $data: {};
77
+ $props: Partial<{}> & Omit<Readonly<import("vue").ExtractPropTypes<{
78
+ readonly size: {
79
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown>>;
80
+ readonly required: false;
81
+ readonly validator: ((val: unknown) => boolean) | undefined;
82
+ __epPropKey: true;
83
+ };
84
+ readonly color: {
85
+ readonly type: import("vue").PropType<string>;
86
+ readonly required: false;
87
+ readonly validator: ((val: unknown) => boolean) | undefined;
88
+ __epPropKey: true;
89
+ };
90
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>;
91
+ $attrs: {
92
+ [x: string]: unknown;
93
+ };
94
+ $refs: {
95
+ [x: string]: unknown;
96
+ };
97
+ $slots: Readonly<{
98
+ [name: string]: import("vue").Slot | undefined;
99
+ }>;
100
+ $root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
101
+ $parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null;
102
+ $emit: (event: string, ...args: any[]) => void;
103
+ $el: any;
104
+ $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
105
+ readonly size: {
106
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown>>;
107
+ readonly required: false;
108
+ readonly validator: ((val: unknown) => boolean) | undefined;
109
+ __epPropKey: true;
110
+ };
111
+ readonly color: {
112
+ readonly type: import("vue").PropType<string>;
113
+ readonly required: false;
114
+ readonly validator: ((val: unknown) => boolean) | undefined;
115
+ __epPropKey: true;
116
+ };
117
+ }>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, {}> & {
118
+ beforeCreate?: ((() => void) | (() => void)[]) | undefined;
119
+ created?: ((() => void) | (() => void)[]) | undefined;
120
+ beforeMount?: ((() => void) | (() => void)[]) | undefined;
121
+ mounted?: ((() => void) | (() => void)[]) | undefined;
122
+ beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
123
+ updated?: ((() => void) | (() => void)[]) | undefined;
124
+ activated?: ((() => void) | (() => void)[]) | undefined;
125
+ deactivated?: ((() => void) | (() => void)[]) | undefined;
126
+ beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
127
+ beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
128
+ destroyed?: ((() => void) | (() => void)[]) | undefined;
129
+ unmounted?: ((() => void) | (() => void)[]) | undefined;
130
+ renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
131
+ renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
132
+ errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null, info: string) => boolean | void)[]) | undefined;
133
+ };
134
+ $forceUpdate: () => void;
135
+ $nextTick: typeof import("vue").nextTick;
136
+ $watch(source: string | Function, cb: Function, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
137
+ } & Readonly<import("vue").ExtractPropTypes<{
138
+ readonly size: {
139
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown>>;
140
+ readonly required: false;
141
+ readonly validator: ((val: unknown) => boolean) | undefined;
142
+ __epPropKey: true;
143
+ };
144
+ readonly color: {
145
+ readonly type: import("vue").PropType<string>;
146
+ readonly required: false;
147
+ readonly validator: ((val: unknown) => boolean) | undefined;
148
+ __epPropKey: true;
149
+ };
150
+ }>> & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties;
151
+ __isFragment?: undefined;
152
+ __isTeleport?: undefined;
153
+ __isSuspense?: undefined;
154
+ } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
155
+ readonly size: {
156
+ readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | number) & {}) | (() => string | number) | ((new (...args: any[]) => (string | number) & {}) | (() => string | number))[], unknown, unknown>>;
157
+ readonly required: false;
158
+ readonly validator: ((val: unknown) => boolean) | undefined;
159
+ __epPropKey: true;
160
+ };
161
+ readonly color: {
162
+ readonly type: import("vue").PropType<string>;
163
+ readonly required: false;
164
+ readonly validator: ((val: unknown) => boolean) | undefined;
165
+ __epPropKey: true;
166
+ };
167
+ }>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, {}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
168
+ $slots: {
169
+ default?(_: {}): any;
170
+ };
171
+ })>;
172
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
173
+ name: {
174
+ type: StringConstructor;
175
+ required: true;
176
+ };
177
+ type: {
178
+ type: StringConstructor;
179
+ default: string;
180
+ };
181
+ }>>, {
182
+ type: string;
183
+ }>;
184
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "tab-click" | "tab-close")[], "update:modelValue" | "tab-click" | "tab-close", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
32
185
  tabList: {
33
186
  type: ArrayConstructor;
34
187
  default: () => never[];
@@ -36,10 +189,16 @@ declare const _default: import("vue").DefineComponent<{
36
189
  modelValue: {
37
190
  type: (ArrayConstructor | NumberConstructor | StringConstructor)[];
38
191
  };
192
+ closable: {
193
+ type: BooleanConstructor;
194
+ default: () => boolean;
195
+ };
39
196
  }>> & {
40
197
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
41
198
  "onTab-click"?: ((...args: any[]) => any) | undefined;
199
+ "onTab-close"?: ((...args: any[]) => any) | undefined;
42
200
  }, {
43
201
  tabList: unknown[];
202
+ closable: boolean;
44
203
  }>;
45
204
  export default _default;