@katlux/toolkit 0.1.0-beta.76 → 0.1.0-beta.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +2 -2
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +2 -2
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/MultiTabs/MultiTabs.global.d.vue.ts +23 -0
- package/dist/runtime/components/MultiTabs/MultiTabs.global.vue +27 -0
- package/dist/runtime/components/MultiTabs/MultiTabs.global.vue.d.ts +23 -0
- package/dist/runtime/components/MultiTabs/MultiTabs.logic.d.ts +25 -0
- package/dist/runtime/components/MultiTabs/MultiTabs.logic.js +52 -0
- package/dist/runtime/presets/default/components/KGrid/KGrid.vue +1 -0
- package/dist/runtime/presets/default/components/KPanel/KPanel.vue +3 -1
- package/dist/runtime/presets/default/components/KTabs/KTabs.vue +96 -2
- package/dist/runtime/presets/default/components/MultiTabs/MultiTabs.d.vue.ts +9 -0
- package/dist/runtime/presets/default/components/MultiTabs/MultiTabs.vue +55 -0
- package/dist/runtime/presets/default/components/MultiTabs/MultiTabs.vue.d.ts +9 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -157,19 +157,19 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
157
157
|
label: string;
|
|
158
158
|
disabled: boolean;
|
|
159
159
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
160
|
+
validationText: string;
|
|
161
|
+
modelValue: any;
|
|
160
162
|
searchbox: boolean;
|
|
161
163
|
searchPlaceholder: string;
|
|
162
164
|
isOptionsOpen: boolean;
|
|
163
165
|
placeholder: string;
|
|
164
166
|
teleportTo: string;
|
|
165
167
|
fullWidth: boolean;
|
|
166
|
-
validationText: string;
|
|
167
168
|
closeOnSelect: boolean;
|
|
168
169
|
multiSelect: boolean;
|
|
169
170
|
maxSelectedDisplay: string | number | boolean;
|
|
170
171
|
visibleFields: String[];
|
|
171
172
|
valueField: string;
|
|
172
|
-
modelValue: any;
|
|
173
173
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
174
174
|
declare const _default: typeof __VLS_export;
|
|
175
175
|
export default _default;
|
|
@@ -157,19 +157,19 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
157
157
|
label: string;
|
|
158
158
|
disabled: boolean;
|
|
159
159
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
160
|
+
validationText: string;
|
|
161
|
+
modelValue: any;
|
|
160
162
|
searchbox: boolean;
|
|
161
163
|
searchPlaceholder: string;
|
|
162
164
|
isOptionsOpen: boolean;
|
|
163
165
|
placeholder: string;
|
|
164
166
|
teleportTo: string;
|
|
165
167
|
fullWidth: boolean;
|
|
166
|
-
validationText: string;
|
|
167
168
|
closeOnSelect: boolean;
|
|
168
169
|
multiSelect: boolean;
|
|
169
170
|
maxSelectedDisplay: string | number | boolean;
|
|
170
171
|
visibleFields: String[];
|
|
171
172
|
valueField: string;
|
|
172
|
-
modelValue: any;
|
|
173
173
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
174
174
|
declare const _default: typeof __VLS_export;
|
|
175
175
|
export default _default;
|
|
@@ -191,13 +191,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
191
191
|
label: string;
|
|
192
192
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
193
193
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
194
|
+
validationText: string;
|
|
195
|
+
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
194
196
|
searchbox: boolean;
|
|
195
197
|
labelField: string;
|
|
196
198
|
placeholder: string;
|
|
197
199
|
teleportTo: string;
|
|
198
|
-
validationText: string;
|
|
199
200
|
valueField: string;
|
|
200
|
-
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
201
201
|
inputType: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
|
|
202
202
|
selectionValue: string | number | Record<string, any> | unknown[];
|
|
203
203
|
inputValue: string | number | Record<string, any> | unknown[];
|
|
@@ -191,13 +191,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
191
191
|
label: string;
|
|
192
192
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
193
193
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
194
|
+
validationText: string;
|
|
195
|
+
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
194
196
|
searchbox: boolean;
|
|
195
197
|
labelField: string;
|
|
196
198
|
placeholder: string;
|
|
197
199
|
teleportTo: string;
|
|
198
|
-
validationText: string;
|
|
199
200
|
valueField: string;
|
|
200
|
-
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
201
201
|
inputType: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
|
|
202
202
|
selectionValue: string | number | Record<string, any> | unknown[];
|
|
203
203
|
inputValue: string | number | Record<string, any> | unknown[];
|
|
@@ -124,10 +124,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
124
124
|
isOpen: boolean;
|
|
125
125
|
day: string | Date;
|
|
126
126
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
127
|
-
placeholder: string;
|
|
128
|
-
teleportTo: string;
|
|
129
127
|
validationText: string;
|
|
130
128
|
modelValue: string | Date;
|
|
129
|
+
placeholder: string;
|
|
130
|
+
teleportTo: string;
|
|
131
131
|
showClear: boolean;
|
|
132
132
|
align: "left" | "right" | undefined;
|
|
133
133
|
format: string;
|
|
@@ -124,10 +124,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
124
124
|
isOpen: boolean;
|
|
125
125
|
day: string | Date;
|
|
126
126
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
127
|
-
placeholder: string;
|
|
128
|
-
teleportTo: string;
|
|
129
127
|
validationText: string;
|
|
130
128
|
modelValue: string | Date;
|
|
129
|
+
placeholder: string;
|
|
130
|
+
teleportTo: string;
|
|
131
131
|
showClear: boolean;
|
|
132
132
|
align: "left" | "right" | undefined;
|
|
133
133
|
format: string;
|
|
@@ -130,10 +130,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
130
130
|
isOpen: boolean;
|
|
131
131
|
day: string | Date;
|
|
132
132
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
133
|
-
placeholder: string;
|
|
134
|
-
teleportTo: string;
|
|
135
133
|
validationText: string;
|
|
136
134
|
modelValue: string | Date;
|
|
135
|
+
placeholder: string;
|
|
136
|
+
teleportTo: string;
|
|
137
137
|
showClear: boolean;
|
|
138
138
|
format: string;
|
|
139
139
|
calendarDefinedDays: import("../KCalendar/types.js").IDefinedDay[];
|
|
@@ -130,10 +130,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
130
130
|
isOpen: boolean;
|
|
131
131
|
day: string | Date;
|
|
132
132
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
133
|
-
placeholder: string;
|
|
134
|
-
teleportTo: string;
|
|
135
133
|
validationText: string;
|
|
136
134
|
modelValue: string | Date;
|
|
135
|
+
placeholder: string;
|
|
136
|
+
teleportTo: string;
|
|
137
137
|
showClear: boolean;
|
|
138
138
|
format: string;
|
|
139
139
|
calendarDefinedDays: import("../KCalendar/types.js").IDefinedDay[];
|
|
@@ -110,9 +110,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
110
110
|
isOpen: boolean;
|
|
111
111
|
disabled: boolean;
|
|
112
112
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
113
|
-
placeholder: string;
|
|
114
113
|
validationText: string;
|
|
115
114
|
modelValue: string;
|
|
115
|
+
placeholder: string;
|
|
116
116
|
showClear: boolean;
|
|
117
117
|
format: string;
|
|
118
118
|
step: number;
|
|
@@ -110,9 +110,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
110
110
|
isOpen: boolean;
|
|
111
111
|
disabled: boolean;
|
|
112
112
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
113
|
-
placeholder: string;
|
|
114
113
|
validationText: string;
|
|
115
114
|
modelValue: string;
|
|
115
|
+
placeholder: string;
|
|
116
116
|
showClear: boolean;
|
|
117
117
|
format: string;
|
|
118
118
|
step: number;
|
|
@@ -66,9 +66,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
66
66
|
}>, {
|
|
67
67
|
label: string;
|
|
68
68
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
69
|
-
placeholder: string;
|
|
70
69
|
validationText: string;
|
|
71
70
|
modelValue: string;
|
|
71
|
+
placeholder: string;
|
|
72
72
|
showClear: boolean;
|
|
73
73
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
74
|
declare const _default: typeof __VLS_export;
|
|
@@ -66,9 +66,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
66
66
|
}>, {
|
|
67
67
|
label: string;
|
|
68
68
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
69
|
-
placeholder: string;
|
|
70
69
|
validationText: string;
|
|
71
70
|
modelValue: string;
|
|
71
|
+
placeholder: string;
|
|
72
72
|
showClear: boolean;
|
|
73
73
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
74
|
declare const _default: typeof __VLS_export;
|
|
@@ -59,8 +59,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
59
59
|
label: string;
|
|
60
60
|
rows: number;
|
|
61
61
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
62
|
-
placeholder: string;
|
|
63
62
|
validationText: string;
|
|
63
|
+
placeholder: string;
|
|
64
64
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
65
65
|
declare const _default: typeof __VLS_export;
|
|
66
66
|
export default _default;
|
|
@@ -59,8 +59,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
59
59
|
label: string;
|
|
60
60
|
rows: number;
|
|
61
61
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
62
|
-
placeholder: string;
|
|
63
62
|
validationText: string;
|
|
63
|
+
placeholder: string;
|
|
64
64
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
65
65
|
declare const _default: typeof __VLS_export;
|
|
66
66
|
export default _default;
|
|
@@ -69,9 +69,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
69
69
|
label: string;
|
|
70
70
|
type: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
|
|
71
71
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
72
|
-
placeholder: string;
|
|
73
72
|
validationText: string;
|
|
74
73
|
modelValue: string;
|
|
74
|
+
placeholder: string;
|
|
75
75
|
showClear: boolean;
|
|
76
76
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
77
77
|
declare const _default: typeof __VLS_export;
|
|
@@ -69,9 +69,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
69
69
|
label: string;
|
|
70
70
|
type: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
|
|
71
71
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
72
|
-
placeholder: string;
|
|
73
72
|
validationText: string;
|
|
74
73
|
modelValue: string;
|
|
74
|
+
placeholder: string;
|
|
75
75
|
showClear: boolean;
|
|
76
76
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
77
77
|
declare const _default: typeof __VLS_export;
|
|
@@ -170,16 +170,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
170
170
|
disabled: boolean;
|
|
171
171
|
loading: boolean;
|
|
172
172
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
173
|
+
validationText: string;
|
|
174
|
+
modelValue: any;
|
|
173
175
|
searchbox: boolean;
|
|
174
176
|
searchPlaceholder: string;
|
|
175
177
|
isOptionsOpen: boolean;
|
|
176
178
|
placeholder: string;
|
|
177
179
|
fullWidth: boolean;
|
|
178
|
-
validationText: string;
|
|
179
180
|
closeOnSelect: boolean;
|
|
180
181
|
multiSelect: boolean;
|
|
181
182
|
valueField: string;
|
|
182
|
-
modelValue: any;
|
|
183
183
|
iconField: string;
|
|
184
184
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
185
185
|
declare const _default: typeof __VLS_export;
|
|
@@ -170,16 +170,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
170
170
|
disabled: boolean;
|
|
171
171
|
loading: boolean;
|
|
172
172
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
173
|
+
validationText: string;
|
|
174
|
+
modelValue: any;
|
|
173
175
|
searchbox: boolean;
|
|
174
176
|
searchPlaceholder: string;
|
|
175
177
|
isOptionsOpen: boolean;
|
|
176
178
|
placeholder: string;
|
|
177
179
|
fullWidth: boolean;
|
|
178
|
-
validationText: string;
|
|
179
180
|
closeOnSelect: boolean;
|
|
180
181
|
multiSelect: boolean;
|
|
181
182
|
valueField: string;
|
|
182
|
-
modelValue: any;
|
|
183
183
|
iconField: string;
|
|
184
184
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
185
185
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
modelValue: {
|
|
3
|
+
type: import("vue").PropType<import("./MultiTabs.logic.js").MultiTabsGroup[]>;
|
|
4
|
+
default: undefined;
|
|
5
|
+
};
|
|
6
|
+
}>, {
|
|
7
|
+
addTab: (tab: import("./MultiTabs.logic.js").MultiTabsTab, groupId?: string) => void;
|
|
8
|
+
splitScreen: (initialTab?: import("./MultiTabs.logic.js").MultiTabsTab) => string;
|
|
9
|
+
closeSplit: (groupId: string) => void;
|
|
10
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:modelValue": (...args: any[]) => void;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
modelValue: {
|
|
14
|
+
type: import("vue").PropType<import("./MultiTabs.logic.js").MultiTabsGroup[]>;
|
|
15
|
+
default: undefined;
|
|
16
|
+
};
|
|
17
|
+
}>> & Readonly<{
|
|
18
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
modelValue: import("./MultiTabs.logic.js").MultiTabsGroup[];
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useMultiTabsLogic, MultiTabsDefaultProps } from "./MultiTabs.logic";
|
|
3
|
+
import { usePresetComponent } from "../../composables/usePresetComponent";
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
import MultiTabsDefault from "../../presets/default/components/MultiTabs/MultiTabs.vue";
|
|
6
|
+
const props = defineProps(MultiTabsDefaultProps);
|
|
7
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
8
|
+
const { groups, addTab, splitScreen, closeSplit } = useMultiTabsLogic(props, emit);
|
|
9
|
+
const presetComponent = usePresetComponent("MultiTabs", MultiTabsDefault);
|
|
10
|
+
const templateProps = computed(() => ({
|
|
11
|
+
groups: groups.value,
|
|
12
|
+
addTab,
|
|
13
|
+
splitScreen,
|
|
14
|
+
closeSplit
|
|
15
|
+
}));
|
|
16
|
+
defineExpose({
|
|
17
|
+
addTab,
|
|
18
|
+
splitScreen,
|
|
19
|
+
closeSplit
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template lang="pug">
|
|
24
|
+
component(:is="presetComponent" v-bind="templateProps")
|
|
25
|
+
template(v-for="(_, slot) in $slots" #[slot]="scope")
|
|
26
|
+
slot(:name="slot" v-bind="scope")
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
modelValue: {
|
|
3
|
+
type: import("vue").PropType<import("./MultiTabs.logic.js").MultiTabsGroup[]>;
|
|
4
|
+
default: undefined;
|
|
5
|
+
};
|
|
6
|
+
}>, {
|
|
7
|
+
addTab: (tab: import("./MultiTabs.logic.js").MultiTabsTab, groupId?: string) => void;
|
|
8
|
+
splitScreen: (initialTab?: import("./MultiTabs.logic.js").MultiTabsTab) => string;
|
|
9
|
+
closeSplit: (groupId: string) => void;
|
|
10
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:modelValue": (...args: any[]) => void;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
modelValue: {
|
|
14
|
+
type: import("vue").PropType<import("./MultiTabs.logic.js").MultiTabsGroup[]>;
|
|
15
|
+
default: undefined;
|
|
16
|
+
};
|
|
17
|
+
}>> & Readonly<{
|
|
18
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
modelValue: import("./MultiTabs.logic.js").MultiTabsGroup[];
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
export interface MultiTabsTab {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
slotName?: string;
|
|
6
|
+
component?: any;
|
|
7
|
+
props?: Record<string, any>;
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface MultiTabsGroup {
|
|
11
|
+
id: string;
|
|
12
|
+
tabs: MultiTabsTab[];
|
|
13
|
+
}
|
|
14
|
+
export declare const MultiTabsDefaultProps: {
|
|
15
|
+
modelValue: {
|
|
16
|
+
type: PropType<MultiTabsGroup[]>;
|
|
17
|
+
default: undefined;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare function useMultiTabsLogic(props: any, emit: any): {
|
|
21
|
+
groups: import("vue").WritableComputedRef<any, any>;
|
|
22
|
+
addTab: (tab: MultiTabsTab, groupId?: string) => void;
|
|
23
|
+
splitScreen: (initialTab?: MultiTabsTab) => string;
|
|
24
|
+
closeSplit: (groupId: string) => void;
|
|
25
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
export const MultiTabsDefaultProps = {
|
|
3
|
+
modelValue: {
|
|
4
|
+
type: Array,
|
|
5
|
+
default: void 0
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
export function useMultiTabsLogic(props, emit) {
|
|
9
|
+
const internalGroups = ref([{ id: "default", tabs: [] }]);
|
|
10
|
+
const groups = computed({
|
|
11
|
+
get: () => props.modelValue || internalGroups.value,
|
|
12
|
+
set: (val) => {
|
|
13
|
+
emit("update:modelValue", val);
|
|
14
|
+
if (props.modelValue === void 0) {
|
|
15
|
+
internalGroups.value = val;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const addTab = (tab, groupId) => {
|
|
20
|
+
const gs = [...groups.value];
|
|
21
|
+
const targetGroupId = groupId || gs[0]?.id;
|
|
22
|
+
const group = gs.find((g) => g.id === targetGroupId);
|
|
23
|
+
if (group) {
|
|
24
|
+
group.tabs.forEach((t) => t.isOpen = false);
|
|
25
|
+
const existingTabIndex = group.tabs.findIndex((t) => t.id === tab.id);
|
|
26
|
+
if (existingTabIndex >= 0) {
|
|
27
|
+
group.tabs[existingTabIndex].isOpen = true;
|
|
28
|
+
} else {
|
|
29
|
+
group.tabs.push({ ...tab, isOpen: true });
|
|
30
|
+
}
|
|
31
|
+
groups.value = gs;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const splitScreen = (initialTab) => {
|
|
35
|
+
const gs = [...groups.value];
|
|
36
|
+
const newId = `group-${Date.now()}`;
|
|
37
|
+
const tabs = initialTab ? [{ ...initialTab, isOpen: true }] : [];
|
|
38
|
+
gs.push({ id: newId, tabs });
|
|
39
|
+
groups.value = gs;
|
|
40
|
+
return newId;
|
|
41
|
+
};
|
|
42
|
+
const closeSplit = (groupId) => {
|
|
43
|
+
const gs = groups.value.filter((g) => g.id !== groupId);
|
|
44
|
+
groups.value = gs.length > 0 ? gs : [{ id: "default", tabs: [] }];
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
groups,
|
|
48
|
+
addTab,
|
|
49
|
+
splitScreen,
|
|
50
|
+
closeSplit
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -36,10 +36,12 @@ const props = withDefaults(defineProps<{
|
|
|
36
36
|
background-color: color-mix(in srgb, var(--current-panel-bg), transparent calc((1 - var(--panel-bg-opacity)) * 100%));
|
|
37
37
|
backdrop-filter: blur(var(--panel-blur));
|
|
38
38
|
width: 100%;
|
|
39
|
+
min-width: 0;
|
|
39
40
|
display: flex;
|
|
40
41
|
flex-direction: column;
|
|
41
42
|
overflow: hidden;
|
|
42
43
|
transition: transform var(--transition-normal), box-shadow var(--transition-normal);
|
|
44
|
+
box-sizing: border-box;
|
|
43
45
|
|
|
44
46
|
&.type-primary {
|
|
45
47
|
--current-panel-bg: var(--panel-bg-primary);
|
|
@@ -68,7 +70,7 @@ const props = withDefaults(defineProps<{
|
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
&:hover {
|
|
71
|
-
transform: translateY(-2px);
|
|
73
|
+
//transform: translateY(-2px);
|
|
72
74
|
box-shadow: var(--shadow-lg);
|
|
73
75
|
}
|
|
74
76
|
|
|
@@ -2,18 +2,112 @@
|
|
|
2
2
|
.KTab
|
|
3
3
|
KPanel
|
|
4
4
|
template(#header)
|
|
5
|
-
|
|
6
|
-
KButton(v-
|
|
5
|
+
.k-tabs-nav
|
|
6
|
+
KButton.k-tabs-nav-btn(v-if="hasOverflow" @click="scroll(-1)" size="small") <
|
|
7
|
+
.k-tabs-scroll-area(ref="scrollArea")
|
|
8
|
+
KGrid(direction="row" wrap="nowrap")
|
|
9
|
+
KButton.k-tab-btn(
|
|
10
|
+
v-for="(item, index) of items"
|
|
11
|
+
:key="index"
|
|
12
|
+
@click="toggleItem(index)"
|
|
13
|
+
size="small"
|
|
14
|
+
:disabled="isOpen(index)"
|
|
15
|
+
) {{item.title}}
|
|
16
|
+
KButton.k-tabs-nav-btn(v-if="hasOverflow" @click="scroll(1)" size="small") >
|
|
7
17
|
slot
|
|
8
18
|
</template>
|
|
9
19
|
|
|
10
20
|
<script lang="ts" setup>
|
|
21
|
+
import { ref, onMounted, onUnmounted, watch, nextTick } from 'vue'
|
|
22
|
+
|
|
11
23
|
const props = defineProps<{
|
|
12
24
|
items: any[]
|
|
13
25
|
toggleItem: (index: number) => void
|
|
14
26
|
isOpen: (index: number) => boolean
|
|
15
27
|
}>()
|
|
28
|
+
|
|
29
|
+
const scrollArea = ref<HTMLElement | null>(null)
|
|
30
|
+
const hasOverflow = ref(false)
|
|
31
|
+
let resizeObserver: ResizeObserver | null = null
|
|
32
|
+
|
|
33
|
+
const checkOverflow = () => {
|
|
34
|
+
if (!scrollArea.value) return
|
|
35
|
+
const el = scrollArea.value
|
|
36
|
+
// Compare the inner KGrid's natural width vs the scroll area's offset width.
|
|
37
|
+
// Using offsetWidth (not clientWidth) avoids being affected by the scroll area itself.
|
|
38
|
+
const inner = el.firstElementChild as HTMLElement | null
|
|
39
|
+
if (inner) {
|
|
40
|
+
hasOverflow.value = inner.scrollWidth > el.offsetWidth + 1
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
onMounted(() => {
|
|
45
|
+
nextTick(() => checkOverflow())
|
|
46
|
+
resizeObserver = new ResizeObserver(() => checkOverflow())
|
|
47
|
+
if (scrollArea.value) {
|
|
48
|
+
// Only observe the scroll area container — NOT the inner KGrid.
|
|
49
|
+
// Observing the inner KGrid would cause a feedback loop when nav buttons
|
|
50
|
+
// appear/disappear, since that changes the scroll area's clientWidth,
|
|
51
|
+
// which triggers another resize event, which flips hasOverflow again.
|
|
52
|
+
resizeObserver.observe(scrollArea.value)
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
onUnmounted(() => {
|
|
57
|
+
resizeObserver?.disconnect()
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
watch(() => props.items.length, async () => {
|
|
61
|
+
await nextTick()
|
|
62
|
+
checkOverflow()
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const scroll = (direction: number) => {
|
|
66
|
+
scrollArea.value?.scrollBy({ left: 200 * direction, behavior: 'smooth' })
|
|
67
|
+
}
|
|
16
68
|
</script>
|
|
17
69
|
|
|
18
70
|
<style lang="scss" scoped>
|
|
71
|
+
.KTab {
|
|
72
|
+
max-width: 100%;
|
|
73
|
+
min-width: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:deep(.KPanel--header) {
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
min-width: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.k-tabs-nav {
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
min-width: 0;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.k-tabs-scroll-area {
|
|
89
|
+
flex: 1 1 0px;
|
|
90
|
+
overflow-x: auto;
|
|
91
|
+
min-width: 0;
|
|
92
|
+
max-width: 100%;
|
|
93
|
+
scroll-snap-type: x mandatory;
|
|
94
|
+
scroll-behavior: smooth;
|
|
95
|
+
|
|
96
|
+
/* Hide scrollbar */
|
|
97
|
+
-ms-overflow-style: none;
|
|
98
|
+
scrollbar-width: none;
|
|
99
|
+
&::-webkit-scrollbar {
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.k-tab-btn {
|
|
105
|
+
scroll-snap-align: center;
|
|
106
|
+
flex-shrink: 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.k-tabs-nav-btn {
|
|
110
|
+
flex-shrink: 0;
|
|
111
|
+
margin: 0 8px;
|
|
112
|
+
}
|
|
19
113
|
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
groups: any[];
|
|
3
|
+
addTab: (tab: any, groupId?: string) => void;
|
|
4
|
+
splitScreen: (initialTab?: any) => string;
|
|
5
|
+
closeSplit: (groupId: string) => void;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template lang="pug">
|
|
2
|
+
KGrid.multi-tabs(direction="row" align="stretch" flexChild)
|
|
3
|
+
template(v-for="(group, groupIndex) in groups" :key="group.id || groupIndex")
|
|
4
|
+
KTabs.multi-tabs-tabs(v-if="group.tabs && group.tabs.length > 0")
|
|
5
|
+
KTabItem(v-for="tab in group.tabs" :key="tab.id" :title="tab.title" :isOpen="tab.isOpen")
|
|
6
|
+
.multi-tabs-tab-content
|
|
7
|
+
slot(:name="tab.slotName || tab.id" :tab="tab")
|
|
8
|
+
component(v-if="tab.component" :is="tab.component" v-bind="tab.props")
|
|
9
|
+
.multi-tabs-empty(v-else)
|
|
10
|
+
slot(name="empty" :group="group")
|
|
11
|
+
span No tabs open
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts" setup>
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
groups: any[]
|
|
17
|
+
addTab: (tab: any, groupId?: string) => void
|
|
18
|
+
splitScreen: (initialTab?: any) => string
|
|
19
|
+
closeSplit: (groupId: string) => void
|
|
20
|
+
}>()
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<style lang="scss" scoped>
|
|
24
|
+
.multi-tabs {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.multi-tabs-empty {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
height: 100%;
|
|
35
|
+
flex: 1 1 0%;
|
|
36
|
+
min-width: 0;
|
|
37
|
+
}
|
|
38
|
+
.multi-tabs-tabs {
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
|
|
41
|
+
flex: 1 1 0%;
|
|
42
|
+
min-width: 0;
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
> * {
|
|
46
|
+
height: 100%;
|
|
47
|
+
min-width: 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
.multi-tabs-tab-content {
|
|
51
|
+
padding: 1rem;
|
|
52
|
+
height: 100%;
|
|
53
|
+
overflow: auto;
|
|
54
|
+
}
|
|
55
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
groups: any[];
|
|
3
|
+
addTab: (tab: any, groupId?: string) => void;
|
|
4
|
+
splitScreen: (initialTab?: any) => string;
|
|
5
|
+
closeSplit: (groupId: string) => void;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|