eco-vue-js 0.8.42 → 0.9.0
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/components/Form/WFormValidator.vue.d.ts.map +1 -1
- package/dist/components/Form/WFormValidator.vue.js +21 -9
- package/dist/components/Modal/WModalStepper.vue.d.ts +272 -30
- package/dist/components/Modal/WModalStepper.vue.d.ts.map +1 -1
- package/dist/components/Modal/WModalStepper.vue.js +17 -13
- package/dist/components/Tabs/WTabs.vue.d.ts +132 -14
- package/dist/components/Tabs/WTabs.vue.d.ts.map +1 -1
- package/dist/components/Tabs/WTabs.vue.js +120 -105
- package/dist/components/Tabs/WTabsItem.vue.d.ts +33 -0
- package/dist/components/Tabs/WTabsItem.vue.d.ts.map +1 -0
- package/dist/components/Tabs/WTabsItem.vue.js +17 -0
- package/dist/components/Tabs/WTabsItem.vue2.js +5 -0
- package/dist/components/Tabs/components/TabItem.vue.d.ts +4 -2
- package/dist/components/Tabs/components/TabItem.vue.d.ts.map +1 -1
- package/dist/components/Tabs/components/TabItem.vue.js +6 -5
- package/dist/components/Tabs/components/TabTitleButton.vue.d.ts +58 -0
- package/dist/components/Tabs/components/TabTitleButton.vue.d.ts.map +1 -0
- package/dist/components/Tabs/components/TabTitleButton.vue.js +123 -0
- package/dist/components/Tabs/components/TabTitleButton.vue2.js +5 -0
- package/dist/imports/componentsPlugin.d.ts +2 -1
- package/dist/imports/componentsPlugin.d.ts.map +1 -1
- package/dist/main.js +1 -0
- package/package.json +4 -1
@@ -1,15 +1,15 @@
|
|
1
|
-
import { VNode, nextTick } from 'vue';
|
1
|
+
import { CSSProperties, VNode, nextTick } from 'vue';
|
2
2
|
import { default as WForm } from '../Form/WForm.vue';
|
3
3
|
declare const _default: import('vue').DefineComponent<{
|
4
|
-
names?: string[] | Record<number, string>;
|
5
|
-
namesForm?: string[] | Record<number, string>;
|
6
|
-
icons?: SVGComponent[] | Record<number, SVGComponent>;
|
7
4
|
customSlots?: VNode[];
|
8
5
|
lessTransitions?: boolean;
|
9
6
|
initTab?: number;
|
10
7
|
side?: boolean;
|
11
8
|
disableMinHeight?: boolean;
|
9
|
+
noHeader?: boolean;
|
10
|
+
switchToNew?: boolean;
|
12
11
|
}, {
|
12
|
+
updateCurrent: (value: string) => void;
|
13
13
|
updateIndex: (value: number) => void;
|
14
14
|
next: () => void;
|
15
15
|
previous: () => void;
|
@@ -20,28 +20,143 @@ declare const _default: import('vue').DefineComponent<{
|
|
20
20
|
initModel: (index: number) => ReturnType<ComponentInstance<typeof WForm>["initModel"]>;
|
21
21
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
22
22
|
"update:has-changes": (value: boolean) => any;
|
23
|
-
"update:current": (value:
|
23
|
+
"update:current": (value: string) => any;
|
24
|
+
"update:current-index": (value: number) => any;
|
25
|
+
"update:current-title": (value: string) => any;
|
26
|
+
"update:tabs-length": (value: number) => any;
|
24
27
|
}, string, import('vue').PublicProps, Readonly<{
|
25
|
-
names?: string[] | Record<number, string>;
|
26
|
-
namesForm?: string[] | Record<number, string>;
|
27
|
-
icons?: SVGComponent[] | Record<number, SVGComponent>;
|
28
28
|
customSlots?: VNode[];
|
29
29
|
lessTransitions?: boolean;
|
30
30
|
initTab?: number;
|
31
31
|
side?: boolean;
|
32
32
|
disableMinHeight?: boolean;
|
33
|
+
noHeader?: boolean;
|
34
|
+
switchToNew?: boolean;
|
33
35
|
}> & Readonly<{
|
34
36
|
"onUpdate:has-changes"?: ((value: boolean) => any) | undefined;
|
35
|
-
"onUpdate:current"?: ((value:
|
37
|
+
"onUpdate:current"?: ((value: string) => any) | undefined;
|
38
|
+
"onUpdate:current-index"?: ((value: number) => any) | undefined;
|
39
|
+
"onUpdate:current-title"?: ((value: string) => any) | undefined;
|
40
|
+
"onUpdate:tabs-length"?: ((value: number) => any) | undefined;
|
36
41
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
37
42
|
buttonContainer: HTMLDivElement;
|
38
|
-
button:
|
43
|
+
button: (({
|
44
|
+
$: import('vue').ComponentInternalInstance;
|
45
|
+
$data: {};
|
46
|
+
$props: {
|
47
|
+
readonly active: boolean;
|
48
|
+
readonly index: number;
|
49
|
+
readonly hasError: boolean;
|
50
|
+
readonly hasChanges: boolean;
|
51
|
+
readonly title: string;
|
52
|
+
readonly icon: SVGComponent | undefined;
|
53
|
+
readonly side?: boolean | undefined;
|
54
|
+
readonly onClick?: ((value: MouseEvent) => any) | undefined;
|
55
|
+
readonly "onUpdate:indicator-style"?: ((value: CSSProperties) => any) | undefined;
|
56
|
+
readonly "onUpdate:scroll-position"?: ((value: {
|
57
|
+
left: number;
|
58
|
+
} | {
|
59
|
+
top: number;
|
60
|
+
}) => any) | undefined;
|
61
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
|
62
|
+
$attrs: {
|
63
|
+
[x: string]: unknown;
|
64
|
+
};
|
65
|
+
$refs: {
|
66
|
+
[x: string]: unknown;
|
67
|
+
} & {
|
68
|
+
button: HTMLButtonElement;
|
69
|
+
};
|
70
|
+
$slots: Readonly<{
|
71
|
+
[name: string]: import('vue').Slot<any> | undefined;
|
72
|
+
}>;
|
73
|
+
$root: import('vue').ComponentPublicInstance | null;
|
74
|
+
$parent: import('vue').ComponentPublicInstance | null;
|
75
|
+
$host: Element | null;
|
76
|
+
$emit: ((event: "click", value: MouseEvent) => void) & ((event: "update:indicator-style", value: CSSProperties) => void) & ((event: "update:scroll-position", value: {
|
77
|
+
left: number;
|
78
|
+
} | {
|
79
|
+
top: number;
|
80
|
+
}) => void);
|
81
|
+
$el: any;
|
82
|
+
$options: import('vue').ComponentOptionsBase<Readonly<{
|
83
|
+
active: boolean;
|
84
|
+
index: number;
|
85
|
+
hasError: boolean;
|
86
|
+
hasChanges: boolean;
|
87
|
+
title: string;
|
88
|
+
icon: SVGComponent | undefined;
|
89
|
+
side?: boolean;
|
90
|
+
}> & Readonly<{
|
91
|
+
onClick?: ((value: MouseEvent) => any) | undefined;
|
92
|
+
"onUpdate:indicator-style"?: ((value: CSSProperties) => any) | undefined;
|
93
|
+
"onUpdate:scroll-position"?: ((value: {
|
94
|
+
left: number;
|
95
|
+
} | {
|
96
|
+
top: number;
|
97
|
+
}) => any) | undefined;
|
98
|
+
}>, {
|
99
|
+
update: () => void;
|
100
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
101
|
+
click: (value: MouseEvent) => any;
|
102
|
+
"update:indicator-style": (value: CSSProperties) => any;
|
103
|
+
"update:scroll-position": (value: {
|
104
|
+
left: number;
|
105
|
+
} | {
|
106
|
+
top: number;
|
107
|
+
}) => any;
|
108
|
+
}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
|
109
|
+
beforeCreate?: (() => void) | (() => void)[];
|
110
|
+
created?: (() => void) | (() => void)[];
|
111
|
+
beforeMount?: (() => void) | (() => void)[];
|
112
|
+
mounted?: (() => void) | (() => void)[];
|
113
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
114
|
+
updated?: (() => void) | (() => void)[];
|
115
|
+
activated?: (() => void) | (() => void)[];
|
116
|
+
deactivated?: (() => void) | (() => void)[];
|
117
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
118
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
119
|
+
destroyed?: (() => void) | (() => void)[];
|
120
|
+
unmounted?: (() => void) | (() => void)[];
|
121
|
+
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
|
122
|
+
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
|
123
|
+
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
|
124
|
+
};
|
125
|
+
$forceUpdate: () => void;
|
126
|
+
$nextTick: typeof nextTick;
|
127
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
128
|
+
} & Readonly<{}> & Omit<Readonly<{
|
129
|
+
active: boolean;
|
130
|
+
index: number;
|
131
|
+
hasError: boolean;
|
132
|
+
hasChanges: boolean;
|
133
|
+
title: string;
|
134
|
+
icon: SVGComponent | undefined;
|
135
|
+
side?: boolean;
|
136
|
+
}> & Readonly<{
|
137
|
+
onClick?: ((value: MouseEvent) => any) | undefined;
|
138
|
+
"onUpdate:indicator-style"?: ((value: CSSProperties) => any) | undefined;
|
139
|
+
"onUpdate:scroll-position"?: ((value: {
|
140
|
+
left: number;
|
141
|
+
} | {
|
142
|
+
top: number;
|
143
|
+
}) => any) | undefined;
|
144
|
+
}>, "update"> & import('vue').ShallowUnwrapRef<{
|
145
|
+
update: () => void;
|
146
|
+
}> & {} & import('vue').ComponentCustomProperties & {} & {
|
147
|
+
$slots: {
|
148
|
+
title?(_: {}): any;
|
149
|
+
suffix?(_: {}): any;
|
150
|
+
right?(_: {}): any;
|
151
|
+
};
|
152
|
+
}) | null)[];
|
39
153
|
tabItem: (({
|
40
154
|
$: import('vue').ComponentInternalInstance;
|
41
155
|
$data: {};
|
42
156
|
$props: {
|
43
|
-
readonly
|
157
|
+
readonly active: boolean;
|
44
158
|
readonly "onUpdate:height"?: ((value: number) => any) | undefined;
|
159
|
+
readonly "onUpdate:active"?: (() => any) | undefined;
|
45
160
|
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
|
46
161
|
$attrs: {
|
47
162
|
[x: string]: unknown;
|
@@ -57,16 +172,18 @@ declare const _default: import('vue').DefineComponent<{
|
|
57
172
|
$root: import('vue').ComponentPublicInstance | null;
|
58
173
|
$parent: import('vue').ComponentPublicInstance | null;
|
59
174
|
$host: Element | null;
|
60
|
-
$emit: (event: "update:height", value: number) => void;
|
175
|
+
$emit: ((event: "update:height", value: number) => void) & ((event: "update:active") => void);
|
61
176
|
$el: any;
|
62
177
|
$options: import('vue').ComponentOptionsBase<Readonly<{
|
63
|
-
|
178
|
+
active: boolean;
|
64
179
|
}> & Readonly<{
|
65
180
|
"onUpdate:height"?: ((value: number) => any) | undefined;
|
181
|
+
"onUpdate:active"?: (() => any) | undefined;
|
66
182
|
}>, {
|
67
183
|
emitHeight: () => void;
|
68
184
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
69
185
|
"update:height": (value: number) => any;
|
186
|
+
"update:active": () => any;
|
70
187
|
}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
|
71
188
|
beforeCreate?: (() => void) | (() => void)[];
|
72
189
|
created?: (() => void) | (() => void)[];
|
@@ -88,9 +205,10 @@ declare const _default: import('vue').DefineComponent<{
|
|
88
205
|
$nextTick: typeof nextTick;
|
89
206
|
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
90
207
|
} & Readonly<{}> & Omit<Readonly<{
|
91
|
-
|
208
|
+
active: boolean;
|
92
209
|
}> & Readonly<{
|
93
210
|
"onUpdate:height"?: ((value: number) => any) | undefined;
|
211
|
+
"onUpdate:active"?: (() => any) | undefined;
|
94
212
|
}>, "emitHeight"> & import('vue').ShallowUnwrapRef<{
|
95
213
|
emitHeight: () => void;
|
96
214
|
}> & {} & import('vue').ComponentCustomProperties & {} & {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WTabs.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/WTabs.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WTabs.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/WTabs.vue"],"names":[],"mappings":"AAsSA,OAAO,EAAC,KAAK,aAAa,EAAkB,KAAK,KAAK,EAAoB,QAAQ,EAAyE,MAAM,KAAK,CAAA;AAEtK,OAAO,KAAK,MAAM,6BAA6B,CAAA;;kBAW/B,KAAK,EAAE;sBACH,OAAO;cACf,MAAM;WACT,OAAO;uBACK,OAAO;eACf,OAAO;kBACJ,OAAO;;2BA6DO,MAAM;yBAMR,MAAM;gBAcjB,IAAI;oBAIA,IAAI;sBAUA,MAAM,6GAAqE,UAAU,CAAC,iBAAiB,CAAC,OAAO,KAAK,CAAC,CAAC,UAAU,CAAC,CAAC;wBAIhI,MAAM;;UAAuE,UAAU,CAAC,iBAAiB,CAAC,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC;uBAIvI,MAAM,KAAsE,UAAU,CAAC,iBAAiB,CAAC,OAAO,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC;;;;;;;;kBA7G9I,KAAK,EAAE;sBACH,OAAO;cACf,MAAM;WACT,OAAO;uBACK,OAAO;eACf,OAAO;kBACJ,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAsW4B,GAAG,8CAErB,GAAG,yBACnB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAHP,GAAG,8CAErB,GAAG,yBACnB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAHP,GAAG,8CAErB,GAAG,yBACnB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;;;;AAqJ1D,wBAeG"}
|
@@ -1,84 +1,77 @@
|
|
1
|
-
import { defineComponent, useSlots, computed, ref,
|
2
|
-
import _sfc_main$
|
1
|
+
import { defineComponent, useSlots, useTemplateRef, computed, ref, reactive, inject, watch, onMounted, onUnmounted, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createBlock, unref, createSlots, withCtx, resolveDynamicComponent, createElementVNode, normalizeStyle, createCommentVNode, createVNode, TransitionGroup, nextTick } from 'vue';
|
2
|
+
import _sfc_main$3 from '../Form/WForm.vue.js';
|
3
3
|
import { throttle, debounce } from '../../utils/utils.js';
|
4
|
-
import _sfc_main$
|
4
|
+
import _sfc_main$2 from './components/TabItem.vue.js';
|
5
|
+
import _sfc_main$1 from './components/TabTitleButton.vue.js';
|
5
6
|
import { wTabItemListener, wTabItemUnlistener } from './models/injection.js';
|
6
7
|
|
7
|
-
const _hoisted_1 = ["onClick"];
|
8
|
-
const _hoisted_2 = { class: "relative whitespace-nowrap px-4" };
|
9
8
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
10
9
|
__name: "WTabs",
|
11
10
|
props: {
|
12
|
-
names: {},
|
13
|
-
namesForm: {},
|
14
|
-
icons: {},
|
15
11
|
customSlots: {},
|
16
12
|
lessTransitions: { type: Boolean },
|
17
13
|
initTab: {},
|
18
14
|
side: { type: Boolean },
|
19
|
-
disableMinHeight: { type: Boolean }
|
15
|
+
disableMinHeight: { type: Boolean },
|
16
|
+
noHeader: { type: Boolean },
|
17
|
+
switchToNew: { type: Boolean }
|
20
18
|
},
|
21
|
-
emits: ["update:current", "update:has-changes"],
|
19
|
+
emits: ["update:current", "update:current-index", "update:has-changes", "update:current-title", "update:tabs-length"],
|
22
20
|
setup(__props, { expose: __expose, emit: __emit }) {
|
23
21
|
const props = __props;
|
24
22
|
const emit = __emit;
|
25
23
|
const slots = useSlots();
|
26
|
-
const
|
27
|
-
const
|
24
|
+
const buttonContainerRef = useTemplateRef("buttonContainer");
|
25
|
+
const defaultSlots = computed(() => {
|
26
|
+
const result = [];
|
27
|
+
(props.customSlots ?? slots.default?.() ?? []).forEach((item) => {
|
28
|
+
if (Array.isArray(item.children)) result.push(...item.children);
|
29
|
+
if (typeof item.type === "symbol") return;
|
30
|
+
result.push(item);
|
31
|
+
});
|
32
|
+
return result;
|
33
|
+
});
|
34
|
+
const defaultSlotsKeys = computed(() => defaultSlots.value.map((item) => item.props?.name));
|
35
|
+
const current = ref(defaultSlotsKeys.value[props.initTab ?? 0]);
|
36
|
+
const currentIndex = computed(() => defaultSlotsKeys.value.indexOf(current.value));
|
28
37
|
const isDirect = ref(true);
|
29
38
|
const buttonRef = useTemplateRef("button");
|
30
39
|
const indicatorStyle = ref(void 0);
|
31
40
|
const minHeight = ref(0);
|
32
41
|
const tabItemRef = useTemplateRef("tabItem");
|
33
42
|
const formRef = useTemplateRef("form");
|
34
|
-
const buttonContainerRef = useTemplateRef("buttonContainer");
|
35
43
|
const isValidMap = reactive({});
|
36
44
|
const hasChangesMap = reactive({});
|
37
45
|
const hasChanges = computed(() => Object.values(hasChangesMap).includes(true));
|
38
|
-
const updateIsValidMap = (
|
39
|
-
isValidMap[
|
46
|
+
const updateIsValidMap = (key, value) => {
|
47
|
+
isValidMap[key] = value;
|
40
48
|
nextTick().then(() => {
|
41
|
-
if (value === false && isValidMap[current.value] !== false) switchTab(
|
49
|
+
if (value === false && isValidMap[current.value] !== false) switchTab(key);
|
42
50
|
});
|
43
51
|
};
|
44
|
-
const switchTab = throttle((
|
45
|
-
if (current.value ===
|
46
|
-
|
52
|
+
const switchTab = throttle((key) => {
|
53
|
+
if (current.value === key) return;
|
54
|
+
updateCurrent(key);
|
47
55
|
}, 200);
|
56
|
+
const updateCurrent = (value) => {
|
57
|
+
tabItemRef.value?.[currentIndex.value]?.emitHeight?.();
|
58
|
+
setCurrentDebounced(value);
|
59
|
+
};
|
48
60
|
const updateIndex = (value) => {
|
49
|
-
tabItemRef.value?.[
|
50
|
-
|
61
|
+
tabItemRef.value?.[currentIndex.value]?.emitHeight?.();
|
62
|
+
setCurrentDebounced(defaultSlotsKeys.value[value]);
|
51
63
|
};
|
52
|
-
const
|
53
|
-
if (current.value === value || value
|
54
|
-
|
64
|
+
const setCurrentDebounced = debounce((value) => {
|
65
|
+
if (current.value === value || !defaultSlotsKeys.value.includes(value)) return;
|
66
|
+
if (!defaultSlots.value[defaultSlotsKeys.value.indexOf(value)].children?.default) return;
|
67
|
+
isDirect.value = defaultSlotsKeys.value.indexOf(current.value) < defaultSlotsKeys.value.indexOf(value);
|
55
68
|
current.value = value;
|
56
69
|
}, 100);
|
57
70
|
const next = () => {
|
58
|
-
switchTab(
|
71
|
+
switchTab(defaultSlotsKeys.value[currentIndex.value + 1]);
|
59
72
|
};
|
60
73
|
const previous = () => {
|
61
|
-
switchTab(
|
62
|
-
};
|
63
|
-
const updateIndicator = () => {
|
64
|
-
if (!props.names) return;
|
65
|
-
const element = buttonRef.value?.[current.value];
|
66
|
-
if (!element || !element.offsetWidth) return;
|
67
|
-
if (props.side) {
|
68
|
-
indicatorStyle.value = {
|
69
|
-
height: element.offsetHeight + "px",
|
70
|
-
top: element.offsetTop + "px",
|
71
|
-
left: "0",
|
72
|
-
width: "0.25rem"
|
73
|
-
};
|
74
|
-
} else {
|
75
|
-
indicatorStyle.value = {
|
76
|
-
width: element.offsetWidth + "px",
|
77
|
-
left: element.offsetLeft + "px",
|
78
|
-
bottom: "0",
|
79
|
-
height: "0.25rem"
|
80
|
-
};
|
81
|
-
}
|
74
|
+
switchTab(defaultSlotsKeys.value[currentIndex.value - 1]);
|
82
75
|
};
|
83
76
|
const updateHeight = (value) => {
|
84
77
|
if (minHeight.value >= value) return;
|
@@ -93,30 +86,52 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
93
86
|
const initModel = (index, ...args) => {
|
94
87
|
return formRef.value?.[index]?.initModel(...args);
|
95
88
|
};
|
89
|
+
const updateIndicator = () => {
|
90
|
+
buttonRef.value?.forEach((item) => item?.update());
|
91
|
+
};
|
92
|
+
const updateScrollPosition = (value) => {
|
93
|
+
if (!buttonContainerRef.value) return;
|
94
|
+
if (props.side) {
|
95
|
+
if (buttonContainerRef.value.scrollHeight <= buttonContainerRef.value.offsetHeight) return;
|
96
|
+
buttonContainerRef.value.scrollTo({ top: ((value.top ?? 0) - buttonContainerRef.value.offsetTop) / 2, behavior: "smooth" });
|
97
|
+
} else {
|
98
|
+
if (buttonContainerRef.value.scrollWidth <= buttonContainerRef.value.offsetWidth) return;
|
99
|
+
buttonContainerRef.value.scrollTo({ left: ((value.left ?? 0) - buttonContainerRef.value.offsetLeft) / 2, behavior: "smooth" });
|
100
|
+
}
|
101
|
+
};
|
96
102
|
const tabItemListenerInjected = inject(wTabItemListener, null);
|
97
103
|
const tabItemUnlistenerInjected = inject(wTabItemUnlistener, null);
|
98
104
|
watch(current, (value) => {
|
99
105
|
emit("update:current", value);
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
buttonContainerRef.value.scrollTo({ top: (buttonRef.value[value].offsetTop - buttonContainerRef.value.offsetTop) / 2, behavior: "smooth" });
|
104
|
-
} else {
|
105
|
-
buttonContainerRef.value.scrollTo({ left: (buttonRef.value[value].offsetLeft - buttonContainerRef.value.offsetLeft) / 2, behavior: "smooth" });
|
106
|
-
}
|
107
|
-
}
|
106
|
+
}, { immediate: true });
|
107
|
+
watch(currentIndex, (value) => {
|
108
|
+
emit("update:current-index", value);
|
108
109
|
}, { immediate: true });
|
109
110
|
watch(hasChanges, (value) => {
|
110
111
|
emit("update:has-changes", value);
|
111
112
|
}, { immediate: true });
|
113
|
+
watch(defaultSlotsKeys, (newValue, oldValue) => {
|
114
|
+
const newIndex = newValue.findIndex((item) => !oldValue.includes(item));
|
115
|
+
if (props.switchToNew && newIndex !== -1) {
|
116
|
+
switchTab(newValue[newIndex]);
|
117
|
+
return;
|
118
|
+
}
|
119
|
+
if (!newValue.includes(current.value)) {
|
120
|
+
switchTab(newValue[oldValue.indexOf(current.value) - 1]);
|
121
|
+
return;
|
122
|
+
}
|
123
|
+
});
|
124
|
+
watch(defaultSlotsKeys, (value) => {
|
125
|
+
emit("update:tabs-length", value.length);
|
126
|
+
}, { immediate: true });
|
112
127
|
onMounted(() => {
|
113
|
-
updateIndicator();
|
114
128
|
tabItemListenerInjected?.(updateIndicator);
|
115
129
|
});
|
116
130
|
onUnmounted(() => {
|
117
131
|
tabItemUnlistenerInjected?.(updateIndicator);
|
118
132
|
});
|
119
133
|
__expose({
|
134
|
+
updateCurrent,
|
120
135
|
updateIndex,
|
121
136
|
next,
|
122
137
|
previous,
|
@@ -131,52 +146,51 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
131
146
|
"grid grid-cols-[auto,1fr] items-start": _ctx.side
|
132
147
|
}])
|
133
148
|
}, [
|
134
|
-
_ctx.
|
149
|
+
!_ctx.noHeader ? (openBlock(), createElementBlock("div", {
|
135
150
|
key: 0,
|
136
151
|
ref: "buttonContainer",
|
137
152
|
class: normalizeClass(["no-scrollbar relative flex snap-x snap-mandatory snap-always overflow-x-auto overscroll-x-contain", {
|
138
153
|
"flex-col": _ctx.side
|
139
154
|
}])
|
140
155
|
}, [
|
141
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(defaultSlots.value, (
|
142
|
-
return openBlock(),
|
156
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(defaultSlots.value, (slot, index) => {
|
157
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
158
|
+
key: slot.props?.name,
|
143
159
|
ref_for: true,
|
144
160
|
ref: "button",
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
])
|
179
|
-
], 10, _hoisted_1);
|
161
|
+
active: current.value === slot.props?.name,
|
162
|
+
index,
|
163
|
+
title: slot.props?.title,
|
164
|
+
icon: slot.props?.icon,
|
165
|
+
"has-changes": hasChangesMap[slot.props?.name] === true,
|
166
|
+
"has-error": isValidMap[slot.props?.name] === false,
|
167
|
+
side: _ctx.side,
|
168
|
+
"onUpdate:indicatorStyle": _cache[0] || (_cache[0] = ($event) => indicatorStyle.value = $event),
|
169
|
+
"onUpdate:scrollPosition": updateScrollPosition,
|
170
|
+
onClick: ($event) => unref(switchTab)(slot.props?.name)
|
171
|
+
}, createSlots({ _: 2 }, [
|
172
|
+
slot.children?.title ? {
|
173
|
+
name: "title",
|
174
|
+
fn: withCtx(() => [
|
175
|
+
(openBlock(), createBlock(resolveDynamicComponent(slot.children?.title)))
|
176
|
+
]),
|
177
|
+
key: "0"
|
178
|
+
} : void 0,
|
179
|
+
slot.children?.suffix ? {
|
180
|
+
name: "suffix",
|
181
|
+
fn: withCtx(() => [
|
182
|
+
(openBlock(), createBlock(resolveDynamicComponent(slot.children?.suffix)))
|
183
|
+
]),
|
184
|
+
key: "1"
|
185
|
+
} : void 0,
|
186
|
+
slot.children?.right ? {
|
187
|
+
name: "right",
|
188
|
+
fn: withCtx(() => [
|
189
|
+
(openBlock(), createBlock(resolveDynamicComponent(slot.children?.right)))
|
190
|
+
]),
|
191
|
+
key: "2"
|
192
|
+
} : void 0
|
193
|
+
]), 1032, ["active", "index", "title", "icon", "has-changes", "has-error", "side", "onClick"]);
|
180
194
|
}), 128)),
|
181
195
|
createElementVNode("div", {
|
182
196
|
class: normalizeClass(["absolute rounded-sm duration-500", {
|
@@ -199,32 +213,33 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
199
213
|
"leave-to-class": _ctx.lessTransitions || _ctx.side ? "opacity-0" : "translate-x-[calc((100%+var(--inner-margin))*var(--direction-factor)*-1)]"
|
200
214
|
}, {
|
201
215
|
default: withCtx(() => [
|
202
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(defaultSlots.value, (slot
|
203
|
-
return openBlock(), createBlock(_sfc_main$
|
216
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(defaultSlots.value, (slot) => {
|
217
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
204
218
|
ref_for: true,
|
205
219
|
ref: "tabItem",
|
206
|
-
key:
|
207
|
-
|
220
|
+
key: slot.props?.name,
|
221
|
+
active: slot.props?.name === current.value,
|
208
222
|
class: "width-full",
|
209
|
-
"onUpdate:height": _cache[
|
223
|
+
"onUpdate:height": _cache[1] || (_cache[1] = ($event) => !_ctx.disableMinHeight && updateHeight($event)),
|
224
|
+
"onUpdate:active": ($event) => _ctx.$emit("update:current-title", slot.props?.title)
|
210
225
|
}, {
|
211
226
|
default: withCtx(() => [
|
212
|
-
createVNode(_sfc_main$
|
227
|
+
createVNode(_sfc_main$3, {
|
213
228
|
ref_for: true,
|
214
229
|
ref: "form",
|
215
|
-
name:
|
216
|
-
title:
|
217
|
-
"onUpdate:isValid": ($event) => updateIsValidMap(
|
218
|
-
"onUpdate:hasChanges": ($event) => hasChangesMap[
|
230
|
+
name: slot.props?.name,
|
231
|
+
title: slot.props?.title,
|
232
|
+
"onUpdate:isValid": ($event) => updateIsValidMap(slot.props?.name, $event),
|
233
|
+
"onUpdate:hasChanges": ($event) => hasChangesMap[slot.props?.name] = $event
|
219
234
|
}, {
|
220
235
|
default: withCtx(() => [
|
221
|
-
(openBlock(), createBlock(resolveDynamicComponent(slot)))
|
236
|
+
(openBlock(), createBlock(resolveDynamicComponent(slot.children?.default)))
|
222
237
|
]),
|
223
238
|
_: 2
|
224
239
|
}, 1032, ["name", "title", "onUpdate:isValid", "onUpdate:hasChanges"])
|
225
240
|
]),
|
226
241
|
_: 2
|
227
|
-
}, 1032, ["
|
242
|
+
}, 1032, ["active", "onUpdate:active"]);
|
228
243
|
}), 128))
|
229
244
|
]),
|
230
245
|
_: 1
|
@@ -0,0 +1,33 @@
|
|
1
|
+
declare function __VLS_template(): {
|
2
|
+
slots: Readonly<{
|
3
|
+
default?: () => void;
|
4
|
+
title?: () => void;
|
5
|
+
suffix?: () => void;
|
6
|
+
right?: () => void;
|
7
|
+
}> & {
|
8
|
+
default?: () => void;
|
9
|
+
title?: () => void;
|
10
|
+
suffix?: () => void;
|
11
|
+
right?: () => void;
|
12
|
+
};
|
13
|
+
refs: {};
|
14
|
+
attrs: Partial<{}>;
|
15
|
+
};
|
16
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
17
|
+
declare const __VLS_component: import('vue').DefineComponent<{
|
18
|
+
title: string;
|
19
|
+
name: string;
|
20
|
+
icon?: SVGComponent;
|
21
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
22
|
+
title: string;
|
23
|
+
name: string;
|
24
|
+
icon?: SVGComponent;
|
25
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
26
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
27
|
+
export default _default;
|
28
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
29
|
+
new (): {
|
30
|
+
$slots: S;
|
31
|
+
};
|
32
|
+
};
|
33
|
+
//# sourceMappingURL=WTabsItem.vue.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"WTabsItem.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/WTabsItem.vue"],"names":[],"mappings":"AAuCA,iBAAS,cAAc;;kBAVX,MAAM,IAAI;gBACZ,MAAM,IAAI;iBACT,MAAM,IAAI;gBACX,MAAM,IAAI;;kBAHR,MAAM,IAAI;gBACZ,MAAM,IAAI;iBACT,MAAM,IAAI;gBACX,MAAM,IAAI;;;WAsCN,OAAO,IAA6B;EAEjD;AAQD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;WA3DZ,MAAM;UACP,MAAM;WACL,YAAY;;WAFZ,MAAM;UACP,MAAM;WACL,YAAY;iGA+DnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { defineComponent, renderSlot } from 'vue';
|
2
|
+
|
3
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
4
|
+
__name: "WTabsItem",
|
5
|
+
props: {
|
6
|
+
title: {},
|
7
|
+
name: {},
|
8
|
+
icon: {}
|
9
|
+
},
|
10
|
+
setup(__props) {
|
11
|
+
return (_ctx, _cache) => {
|
12
|
+
return renderSlot(_ctx.$slots, "default");
|
13
|
+
};
|
14
|
+
}
|
15
|
+
});
|
16
|
+
|
17
|
+
export { _sfc_main as default };
|
@@ -9,15 +9,17 @@ declare function __VLS_template(): {
|
|
9
9
|
};
|
10
10
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
11
11
|
declare const __VLS_component: import('vue').DefineComponent<{
|
12
|
-
|
12
|
+
active: boolean;
|
13
13
|
}, {
|
14
14
|
emitHeight: () => void;
|
15
15
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
16
16
|
"update:height": (value: number) => any;
|
17
|
+
"update:active": () => any;
|
17
18
|
}, string, import('vue').PublicProps, Readonly<{
|
18
|
-
|
19
|
+
active: boolean;
|
19
20
|
}> & Readonly<{
|
20
21
|
"onUpdate:height"?: ((value: number) => any) | undefined;
|
22
|
+
"onUpdate:active"?: (() => any) | undefined;
|
21
23
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
22
24
|
element: HTMLDivElement;
|
23
25
|
}, any>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TabItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Tabs/components/TabItem.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"TabItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Tabs/components/TabItem.vue"],"names":[],"mappings":"AAmGA,iBAAS,cAAc;;yBA6BM,GAAG;;;;;WAUlB,OAAO,IAA6B;EAEjD;AAYD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;YAlGX,OAAO;;sBAaM,IAAI;;;;;YAbjB,OAAO;;;;;;OA8Gf,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|