eco-vue-js 0.8.35 → 0.8.37
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/FormAsync/WFormAsyncSelect.vue.js +1 -0
- package/dist/components/FormAsync/WFormAsyncSelectSingle.vue.js +1 -0
- package/dist/components/FormAsync/WFormAsyncSelectStringified.vue.js +1 -0
- package/dist/components/Modal/WModalStepper.vue.d.ts +4 -0
- package/dist/components/Modal/WModalStepper.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelect.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelect.vue.js +12 -4
- package/dist/components/Select/WSelectAsync.vue.d.ts +6 -1
- package/dist/components/Select/WSelectAsync.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectAsync.vue.js +19 -6
- package/dist/components/Select/WSelectAsyncSingle.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectAsyncSingle.vue.js +6 -8
- package/dist/components/Select/WSelectSingle.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectSingle.vue.js +2 -0
- package/dist/components/Select/WSelectStringified.vue.js +1 -0
- package/dist/components/Select/components/SelectAsyncPrefixPage.vue.d.ts.map +1 -1
- package/dist/components/Select/components/SelectAsyncPrefixPage.vue.js +9 -2
- package/dist/components/Select/types.d.ts +3 -2
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/Tabs/WTabs.vue.d.ts +4 -0
- package/dist/components/Tabs/WTabs.vue.d.ts.map +1 -1
- package/dist/components/Tabs/WTabs.vue.js +50 -29
- package/package.json +1 -1
@@ -17,6 +17,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
17
|
confimGetter: { type: Function },
|
18
18
|
allowClear: { type: Boolean },
|
19
19
|
searchModel: { type: Boolean },
|
20
|
+
createdData: {},
|
20
21
|
valueGetter: { type: Function },
|
21
22
|
searchFn: { type: Function },
|
22
23
|
useQueryFnDefault: {},
|
@@ -10,6 +10,8 @@ declare function __VLS_template(): {
|
|
10
10
|
slots?: import('vue').VNode[];
|
11
11
|
lessTransitions?: boolean;
|
12
12
|
initTab?: number;
|
13
|
+
side?: boolean;
|
14
|
+
disableMinHeight?: boolean;
|
13
15
|
}> & Readonly<{
|
14
16
|
"onUpdate:has-changes"?: ((value: boolean) => any) | undefined;
|
15
17
|
"onUpdate:current"?: ((value: number) => any) | undefined;
|
@@ -39,6 +41,8 @@ declare function __VLS_template(): {
|
|
39
41
|
slots?: import('vue').VNode[];
|
40
42
|
lessTransitions?: boolean;
|
41
43
|
initTab?: number;
|
44
|
+
side?: boolean;
|
45
|
+
disableMinHeight?: boolean;
|
42
46
|
}> & Readonly<{
|
43
47
|
"onUpdate:has-changes"?: ((value: boolean) => any) | undefined;
|
44
48
|
"onUpdate:current"?: ((value: number) => any) | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WModalStepper.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/WModalStepper.vue"],"names":[],"mappings":"AAuNA,iBAAS,cAAc;;uBA6MI,GAAG
|
1
|
+
{"version":3,"file":"WModalStepper.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/WModalStepper.vue"],"names":[],"mappings":"AAuNA,iBAAS,cAAc;;uBA6MI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAUhB,OAAO,IAA6B;EAEjD;AAyBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;YAzTX,MAAM,EAAE;cACN,OAAO;eACN,OAAO;mBACH,OAAO;;gBA2BP,IAAI;oBANA,IAAI;;;;;;;;;YAxBf,MAAM,EAAE;cACN,OAAO;eACN,OAAO;mBACH,OAAO;;;;;;;;kFAqUtB,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"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelect.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelect.vue"],"names":[],"mappings":"AA6ZA,OAAO,KAAK,EAAC,WAAW,EAAE,qBAAqB,EAA6B,MAAM,SAAS,CAAA;yBAI1E,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,kBAAkB,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,eACnI,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAwqBxD,mBAAmB,CAAC;;;;;;;wRAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB;;;2BApevB,MAAM,KAAG,IAAI;MAoegC,GAAG,IAAI;WACpE,GAAG;;gBAxbH,MAAM,IAAI;mBACP,MAAM,IAAI;iBACZ,CAAC,KAAK,EAAE;YACf,MAAM,EAAE,IAAI,GAAG,IAAI,CAAA;YACnB,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,QAAQ,EAAE,OAAO,CAAA;YACjB,KAAK,EAAE,OAAO,CAAA;YACd,MAAM,CAAC,EAAE,MAAM,CAAA;SAChB,KAAK,IAAI;gBACF,MAAM,IAAI;;gBATV,MAAM,IAAI;mBACP,MAAM,IAAI;iBACZ,CAAC,KAAK,EAAE;YACf,MAAM,EAAE,IAAI,GAAG,IAAI,CAAA;YACnB,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,QAAQ,EAAE,OAAO,CAAA;YACjB,KAAK,EAAE,OAAO,CAAA;YACd,MAAM,CAAC,EAAE,MAAM,CAAA;SAChB,KAAK,IAAI;gBACF,MAAM,IAAI;;;YAlPd,QAAQ,QAAQ,KAAK,GAAG,IAAI;YAC5B,UAAU,QAAQ,KAAK,GAAG,IAAI;YAC9B,OAAO,SAAS,UAAU,GAAG,IAAI;YACjC,MAAM,SAAS,UAAU,GAAG,IAAI;YAChC,4BAA4B,SAAS,MAAM,GAAG,SAAS,GAAG,IAAI;YAC9D,YAAY,GAAG,IAAI;;;;;YAiqBmB,OAAO,CAAC,OAAO,WAAW,CAAC;;AAlrBvE,wBAkrB4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -25,6 +25,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
25
25
|
createOption: { type: Function },
|
26
26
|
filterOptions: { type: Function },
|
27
27
|
hideOptionIcon: { type: Boolean },
|
28
|
+
createdData: {},
|
28
29
|
mobileTitle: {},
|
29
30
|
persist: { type: Boolean },
|
30
31
|
type: {},
|
@@ -86,10 +87,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
86
87
|
};
|
87
88
|
const createdOptions = ref([]);
|
88
89
|
const optionsPrepared = computed(() => !data.value ? [] : props.filterOptions ? data.value.filter((option) => props.filterOptions?.(option) ?? true) : data.value);
|
89
|
-
const optionsWithCreated = computed(() =>
|
90
|
-
|
91
|
-
|
92
|
-
|
90
|
+
const optionsWithCreated = computed(() => {
|
91
|
+
if (!props.createdData) {
|
92
|
+
if (createdOptions.value.length) return [...optionsPrepared.value, ...createdOptions.value];
|
93
|
+
else return optionsPrepared.value;
|
94
|
+
}
|
95
|
+
return [
|
96
|
+
...optionsPrepared.value,
|
97
|
+
...props.createdData ?? [],
|
98
|
+
...createdOptions.value
|
99
|
+
].filter((option, index, array) => array.findIndex((item) => props.valueGetter(item) === props.valueGetter(option)) === index);
|
100
|
+
});
|
93
101
|
const optionsFiltered = computed(() => searchPrepared.value === "" ? optionsWithCreated.value : optionsWithCreated.value.filter((option) => props.searchFn(option, searchPrepared.value)));
|
94
102
|
const lastIndex = computed(() => props.createOption ? optionsFiltered.value.length : optionsFiltered.value.length - 1);
|
95
103
|
const isMobile = getIsMobile();
|
@@ -2,13 +2,16 @@ import { SelectAsyncProps, SelectOptionComponent } from './types';
|
|
2
2
|
declare const _default: <Model extends number | string, Data extends DefaultData, QueryParams, OptionComponent extends SelectOptionComponent<Data>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
4
4
|
readonly onSelect?: ((item: Model) => any) | undefined;
|
5
|
+
readonly onBlur?: ((value: FocusEvent) => any) | undefined;
|
6
|
+
readonly onFocus?: ((value: FocusEvent) => any) | undefined;
|
5
7
|
readonly "onUpdate:modelValue"?: ((value: Model[]) => any) | undefined;
|
6
8
|
readonly onUnselect?: ((item: Model) => any) | undefined;
|
7
9
|
readonly "onInit-model"?: (() => any) | undefined;
|
8
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onSelect" | "onUpdate:modelValue" | "onUnselect" | "onInit-model"> & SelectAsyncProps<Model, Data, QueryParams, OptionComponent>> & import('vue').PublicProps;
|
10
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onFocus" | "onBlur" | "onSelect" | "onUpdate:modelValue" | "onUnselect" | "onInit-model"> & SelectAsyncProps<Model, Data, QueryParams, OptionComponent>> & import('vue').PublicProps;
|
9
11
|
expose(exposed: import('vue').ShallowUnwrapRef<{
|
10
12
|
focus: () => void;
|
11
13
|
blur: () => void;
|
14
|
+
setSearch: (value: string) => void;
|
12
15
|
}>): void;
|
13
16
|
attrs: any;
|
14
17
|
slots: Readonly<{
|
@@ -41,6 +44,8 @@ declare const _default: <Model extends number | string, Data extends DefaultData
|
|
41
44
|
(e: "unselect", item: Model): void;
|
42
45
|
(e: "update:modelValue", value: Model[]): void;
|
43
46
|
(e: "init-model"): void;
|
47
|
+
(e: "focus", value: FocusEvent): void;
|
48
|
+
(e: "blur", value: FocusEvent): void;
|
44
49
|
};
|
45
50
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
46
51
|
[key: string]: any;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WSelectAsync.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectAsync.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WSelectAsync.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectAsync.vue"],"names":[],"mappings":"AAwRA,OAAO,KAAK,EAAC,gBAAgB,EAAE,qBAAqB,EAA6B,MAAM,SAAS,CAAA;yBAG/E,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,eAC5H,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA6iBxD,mBAAmB,CA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AAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -13,7 +13,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
13
13
|
queryParamsOptions: {},
|
14
14
|
searchField: {},
|
15
15
|
previewData: {},
|
16
|
-
createdData: {},
|
17
16
|
valueQueryKey: { default: "id__in" },
|
18
17
|
modelValue: {},
|
19
18
|
valueGetter: { type: Function, default: (data) => data.id },
|
@@ -23,6 +22,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
23
22
|
hidePrefix: { type: Boolean },
|
24
23
|
createOption: {},
|
25
24
|
hideOptionIcon: { type: Boolean },
|
25
|
+
createdData: {},
|
26
26
|
mobileTitle: {},
|
27
27
|
persist: { type: Boolean },
|
28
28
|
type: {},
|
@@ -63,7 +63,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
63
63
|
optionComponent: {},
|
64
64
|
optionComponentProps: {}
|
65
65
|
},
|
66
|
-
emits: ["select", "unselect", "update:modelValue", "init-model"],
|
66
|
+
emits: ["select", "unselect", "update:modelValue", "init-model", "focus", "blur"],
|
67
67
|
setup(__props, { expose: __expose, emit: __emit }) {
|
68
68
|
const props = __props;
|
69
69
|
const emit = __emit;
|
@@ -80,7 +80,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
80
80
|
const queryParams = computed(() => ({ ...props.queryParamsOptions, [props.searchField ?? "search"]: search.value }));
|
81
81
|
const queryParamsFirstPage = computed(() => ({ ...queryParams.value, page: 1 }));
|
82
82
|
const { data: firstPageData } = props.useQueryFnOptions(queryParamsFirstPage, { enabled: false });
|
83
|
-
const hasSearchOption = computed(() =>
|
83
|
+
const hasSearchOption = computed(() => {
|
84
|
+
if (props.createdData?.some((option) => props.valueGetter(option) === search.value)) return true;
|
85
|
+
return firstPageData.value?.results.some((option) => props.valueGetter(option) === search.value);
|
86
|
+
});
|
84
87
|
const close = () => {
|
85
88
|
isOpen.value = false;
|
86
89
|
focused.value = false;
|
@@ -134,6 +137,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
134
137
|
await nextTick();
|
135
138
|
input.value?.updateDropdown();
|
136
139
|
};
|
140
|
+
const setSearch = (value) => {
|
141
|
+
search.value = value;
|
142
|
+
};
|
137
143
|
if (props.useQueryFnDefault) {
|
138
144
|
const { data: defaultData } = props.useQueryFnDefault({ enabled });
|
139
145
|
watch(defaultData, (value) => {
|
@@ -145,7 +151,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
145
151
|
}
|
146
152
|
__expose({
|
147
153
|
focus,
|
148
|
-
blur
|
154
|
+
blur,
|
155
|
+
setSearch
|
149
156
|
});
|
150
157
|
return (_ctx, _cache) => {
|
151
158
|
return openBlock(), createBlock(_sfc_main$1, mergeProps({
|
@@ -168,8 +175,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
168
175
|
close();
|
169
176
|
search.value = "";
|
170
177
|
}),
|
171
|
-
onFocus: _cache[7] || (_cache[7] = ($event) =>
|
172
|
-
|
178
|
+
onFocus: _cache[7] || (_cache[7] = ($event) => {
|
179
|
+
focused.value = true;
|
180
|
+
_ctx.$emit("focus", $event);
|
181
|
+
}),
|
182
|
+
onBlur: _cache[8] || (_cache[8] = ($event) => {
|
183
|
+
focused.value = false;
|
184
|
+
_ctx.$emit("blur", $event);
|
185
|
+
})
|
173
186
|
}), createSlots({
|
174
187
|
prefix: withCtx(({ unclickable }) => [
|
175
188
|
(_ctx.hidePrefix ? unref(isMobile) ? unclickable || !focused.value : !isOpen.value : true) ? (openBlock(), createBlock(_sfc_main$2, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WSelectAsyncSingle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectAsyncSingle.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WSelectAsyncSingle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectAsyncSingle.vue"],"names":[],"mappings":"AAyFA,OAAO,KAAK,EAAC,sBAAsB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;yBAGzD,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,EAAE,UAAU,SAAS,OAAO,uBACxJ,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAuNxD,mBAAmB,CAAC;;;4OAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB;;MAAsB,GAAG,IAAI;WACpE,GAAG;;uBAlCe,GAAG;0BACA,GAAG;;;;;;YACL,GAAG;uBACJ,GAAG;;;YA/KzB,mBAAmB,0DAAoB,IAAI;YAC3C,YAAY,GAAG,IAAI;;;;;YAkNmB,OAAO,CAAC,OAAO,WAAW,CAAC;;AAjOvE,wBAiO4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineComponent,
|
1
|
+
import { defineComponent, useTemplateRef, computed, watch, toRef, openBlock, createBlock, mergeProps, unref, createSlots, withCtx, renderSlot } from 'vue';
|
2
2
|
import _sfc_main$1 from './WSelectAsync.vue.js';
|
3
3
|
|
4
4
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
@@ -65,23 +65,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
65
65
|
setup(__props, { expose: __expose, emit: __emit }) {
|
66
66
|
const props = __props;
|
67
67
|
const emit = __emit;
|
68
|
-
const
|
68
|
+
const selectComponentRef = useTemplateRef("selectComponent");
|
69
69
|
const arrayValue = computed(() => props.modelValue ? [props.modelValue] : []);
|
70
70
|
const updateModelValue = (value) => {
|
71
71
|
emit("update:modelValue", value);
|
72
72
|
};
|
73
73
|
const blur = () => {
|
74
|
-
|
74
|
+
selectComponentRef.value?.blur();
|
75
75
|
};
|
76
76
|
watch(toRef(props, "modelValue"), blur);
|
77
77
|
__expose({
|
78
78
|
blur
|
79
79
|
});
|
80
80
|
return (_ctx, _cache) => {
|
81
|
-
return openBlock(), createBlock(_sfc_main$1, mergeProps({
|
82
|
-
ref_key: "selectComponent",
|
83
|
-
ref: selectComponent
|
84
|
-
}, {
|
81
|
+
return openBlock(), createBlock(_sfc_main$1, mergeProps({ ref: "selectComponent" }, {
|
85
82
|
...props,
|
86
83
|
modelValue: arrayValue.value,
|
87
84
|
disableClear: !_ctx.allowClear,
|
@@ -92,7 +89,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
92
89
|
class: _ctx.$attrs.class,
|
93
90
|
onSelect: _cache[0] || (_cache[0] = ($event) => updateModelValue($event)),
|
94
91
|
onUnselect: _cache[1] || (_cache[1] = ($event) => _ctx.allowClear && updateModelValue(null)),
|
95
|
-
|
92
|
+
onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.searchModel && typeof _ctx.modelValue === "string" ? unref(selectComponentRef)?.setSearch(_ctx.modelValue) : void 0),
|
93
|
+
onInitModel: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("init-model"))
|
96
94
|
}), createSlots({
|
97
95
|
option: withCtx(({ option, selected, model, search }) => [
|
98
96
|
renderSlot(_ctx.$slots, "option", {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WSelectSingle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectSingle.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WSelectSingle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelectSingle.vue"],"names":[],"mappings":"AA4FA,OAAO,KAAK,EAAC,iBAAiB,EAAE,qBAAqB,EAAC,MAAM,SAAS,CAAA;yBAGpD,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,kBAAkB,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,EAAE,UAAU,SAAS,OAAO,uBAC/J,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA6OxD,mBAAmB,CAAC;;;;gRAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB;;MAAsB,GAAG,IAAI;WACpE,GAAG;;uBApCe,GAAG;0BACA,GAAG;;;;;;YACL,GAAG;uBACJ,GAAG;;;YAnMzB,oBAAoB,0DAAoB,IAAI;YAC5C,4BAA4B,SAAS,MAAM,GAAG,SAAS,GAAG,IAAI;YAC9D,YAAY,GAAG,IAAI;;;;;YAuOmB,OAAO,CAAC,OAAO,WAAW,CAAC;;AAvPvE,wBAuP4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -8,6 +8,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
8
|
modelValue: {},
|
9
9
|
allowClear: { type: Boolean },
|
10
10
|
searchModel: { type: Boolean },
|
11
|
+
createdData: {},
|
11
12
|
valueGetter: { type: Function },
|
12
13
|
searchFn: { type: Function },
|
13
14
|
useQueryFnDefault: {},
|
@@ -84,6 +85,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
84
85
|
...props,
|
85
86
|
modelValue: arrayValue.value,
|
86
87
|
disableClear: !_ctx.allowClear,
|
88
|
+
createdData: _ctx.createdData ? [_ctx.createdData] : void 0,
|
87
89
|
hidePrefix: true
|
88
90
|
}, {
|
89
91
|
class: _ctx.$attrs.class,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SelectAsyncPrefixPage.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/components/SelectAsyncPrefixPage.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"SelectAsyncPrefixPage.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/components/SelectAsyncPrefixPage.vue"],"names":[],"mappings":"AAqHA,OAAO,KAAK,EAAC,0BAA0B,EAAE,qBAAqB,EAA6B,MAAM,UAAU,CAAA;yBAG1F,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,IAAI,SAAS,WAAW,EAAE,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,eAC5H,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAiMxD,mBAAmB,CAAC;;;;yPAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;kBAlJD,CAAC,KAAK,EAAE;YAAC,MAAM,EAAE,IAAI,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC,KAAK,IAAI;;kBAAjE,CAAC,KAAK,EAAE;YAAC,MAAM,EAAE,IAAI,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC,KAAK,IAAI;;;YA1CvE,UAAU,SAAS,KAAK,GAAG,IAAI;YAC/B,oBAAoB,SAAS,MAAM,GAAG,IAAI;YAC1C,iBAAiB,SAAS,OAAO,GAAG,IAAI;;;;;YA+LF,OAAO,CAAC,OAAO,WAAW,CAAC;;AA3MvE,wBA2M4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineComponent, computed, toRef, watch, onBeforeUnmount, openBlock, createElementBlock, Fragment, renderList,
|
1
|
+
import { defineComponent, computed, toRef, watch, onBeforeUnmount, openBlock, createElementBlock, Fragment, renderList, normalizeClass, renderSlot, createBlock, resolveDynamicComponent, mergeProps, createSlots, withCtx, createElementVNode, withModifiers, createVNode, unref, createCommentVNode } from 'vue';
|
2
2
|
import IconCancel from '../../../assets/icons/default/IconCancel.svg.js';
|
3
3
|
|
4
4
|
const _hoisted_1 = ["onClick"];
|
@@ -31,6 +31,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
31
31
|
refetchOnWindowFocus: false
|
32
32
|
});
|
33
33
|
const pagesCount = computed(() => data.value?.pages_count);
|
34
|
+
const options = computed(() => {
|
35
|
+
if (!props.createdData) return props.previewData ?? data.value?.results ?? [];
|
36
|
+
return [
|
37
|
+
...props.createdData ?? [],
|
38
|
+
...props.previewData ?? data.value?.results ?? []
|
39
|
+
].filter((option, index, array) => array.findIndex((item) => props.valueGetter(item) === props.valueGetter(option)) === index);
|
40
|
+
});
|
34
41
|
watch(pagesCount, (value) => {
|
35
42
|
if (value === void 0) return;
|
36
43
|
emit("update:pages-count", value);
|
@@ -42,7 +49,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
42
49
|
emit("update:fetching", false);
|
43
50
|
});
|
44
51
|
return (_ctx, _cache) => {
|
45
|
-
return openBlock(true), createElementBlock(Fragment, null, renderList(
|
52
|
+
return openBlock(true), createElementBlock(Fragment, null, renderList(options.value, (option, index) => {
|
46
53
|
return openBlock(), createElementBlock("div", {
|
47
54
|
key: _ctx.valueGetter(option),
|
48
55
|
class: normalizeClass(["relative flex overflow-hidden items-center text-description", {
|
@@ -38,6 +38,7 @@ export interface SelectProps<Model extends number | string, Data extends Default
|
|
38
38
|
createOption?: (search: string) => (Data | undefined) | Promise<Data | undefined>;
|
39
39
|
filterOptions?: (option: Data) => boolean;
|
40
40
|
hideOptionIcon?: boolean;
|
41
|
+
createdData?: Data[];
|
41
42
|
}
|
42
43
|
export interface SelectPrefixProps<Data extends DefaultData, OptionComponent extends SelectOptionComponent<Data>> extends SelectOptionComponentProps<Data, OptionComponent> {
|
43
44
|
option: Data;
|
@@ -46,10 +47,11 @@ export interface SelectPrefixProps<Data extends DefaultData, OptionComponent ext
|
|
46
47
|
loading?: boolean;
|
47
48
|
disableClear?: boolean;
|
48
49
|
}
|
49
|
-
export interface SelectSingleProps<Model extends number | string, Data extends DefaultData, QueryParams, OptionComponent extends SelectOptionComponent<Data>, AllowClear extends boolean> extends Omit<SelectProps<Model, Data, QueryParams, OptionComponent>, 'modelValue' | 'disableClear'> {
|
50
|
+
export interface SelectSingleProps<Model extends number | string, Data extends DefaultData, QueryParams, OptionComponent extends SelectOptionComponent<Data>, AllowClear extends boolean> extends Omit<SelectProps<Model, Data, QueryParams, OptionComponent>, 'modelValue' | 'disableClear' | 'createdData'> {
|
50
51
|
modelValue: Model | null;
|
51
52
|
allowClear?: boolean & AllowClear;
|
52
53
|
searchModel?: boolean;
|
54
|
+
createdData?: Data;
|
53
55
|
}
|
54
56
|
export interface SelectStringifiedProps<Model extends string, Data extends DefaultData, QueryParams, OptionComponent extends SelectOptionComponent<Data>> extends Omit<SelectProps<Model, Data, QueryParams, OptionComponent>, 'modelValue'> {
|
55
57
|
modelValue: Model | null;
|
@@ -61,7 +63,6 @@ export interface SelectAsyncProps<Model extends number | string, Data extends De
|
|
61
63
|
queryParamsOptions: QueryParams;
|
62
64
|
searchField?: keyof QueryParams;
|
63
65
|
previewData?: Data[];
|
64
|
-
createdData?: Data[];
|
65
66
|
valueQueryKey?: string;
|
66
67
|
}
|
67
68
|
export interface SelectAsyncPrefixProps<Model extends number | string, Data extends DefaultData, QueryParams, OptionComponent extends SelectOptionComponent<Data>> extends SelectOptionComponentProps<Data, OptionComponent> {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Select/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,KAAK,CAAA;AAElC,MAAM,MAAM,iBAAiB,CAAC,MAAM,IAAI;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,CAAA;AAE7G,MAAM,MAAM,qBAAqB,CAAC,MAAM,IAAI,SAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAA;AAEhF,MAAM,WAAW,0BAA0B,CAAC,MAAM,EAAE,eAAe,SAAS,qBAAqB,CAAC,MAAM,CAAC;IACvG,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,oBAAoB,CAAC,EAAE,eAAe,SAAS,SAAS,CAAC,MAAM,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAA;CACtI;AAED,UAAU,mBAAmB,CAAC,IAAI,SAAS,WAAW;IACpD,iBAAiB,EAAE,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AA;IACjC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,IAAI,CAAA;IAClB,WAAW,CAAC,EAAE,IAAI,CAAA;CACnB"}
|
@@ -7,6 +7,8 @@ declare const _default: import('vue').DefineComponent<{
|
|
7
7
|
slots?: VNode[];
|
8
8
|
lessTransitions?: boolean;
|
9
9
|
initTab?: number;
|
10
|
+
side?: boolean;
|
11
|
+
disableMinHeight?: boolean;
|
10
12
|
}, {
|
11
13
|
updateIndex: (value: number) => void;
|
12
14
|
next: () => void;
|
@@ -26,6 +28,8 @@ declare const _default: import('vue').DefineComponent<{
|
|
26
28
|
slots?: VNode[];
|
27
29
|
lessTransitions?: boolean;
|
28
30
|
initTab?: number;
|
31
|
+
side?: boolean;
|
32
|
+
disableMinHeight?: boolean;
|
29
33
|
}> & Readonly<{
|
30
34
|
"onUpdate:has-changes"?: ((value: boolean) => any) | undefined;
|
31
35
|
"onUpdate:current"?: ((value: number) => any) | undefined;
|
@@ -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":"AAqQA,OAAO,EAAkC,KAAK,KAAK,EAAoD,MAAM,KAAK,CAAA;AAElH,OAAO,KAAK,MAAM,6BAA6B,CAAA;;YAOrC,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;gBAC7B,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;YACrC,YAAY,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;YAC7C,KAAK,EAAE;sBACG,OAAO;cACf,MAAM;WACT,OAAO;uBACK,OAAO;;yBAyCA,MAAM;gBAajB,IAAI;oBAIA,IAAI;sBAkCA,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;;;;;YA3GpJ,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;gBAC7B,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;YACrC,YAAY,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;YAC7C,KAAK,EAAE;sBACG,OAAO;cACf,MAAM;WACT,OAAO;uBACK,OAAO;;;;;AAmb5B,wBAWG"}
|
@@ -1,16 +1,11 @@
|
|
1
|
-
import { defineComponent, useSlots, computed, ref, reactive, inject, watch, onMounted, onUnmounted, openBlock, createElementBlock, Fragment, renderList,
|
1
|
+
import { defineComponent, useSlots, computed, ref, reactive, inject, watch, onMounted, onUnmounted, openBlock, createElementBlock, normalizeClass, Fragment, renderList, unref, createElementVNode, createBlock, resolveDynamicComponent, createCommentVNode, createTextVNode, toDisplayString, createVNode, Transition, withCtx, normalizeStyle, TransitionGroup, nextTick } from 'vue';
|
2
2
|
import _sfc_main$1 from './components/TabItem.vue.js';
|
3
3
|
import _sfc_main$2 from '../Form/WForm.vue.js';
|
4
4
|
import { throttle, debounce } from '../../utils/utils.js';
|
5
5
|
import { wTabItemListener, wTabItemUnlistener } from './models/injection.js';
|
6
6
|
|
7
|
-
const _hoisted_1 =
|
8
|
-
const _hoisted_2 = {
|
9
|
-
key: 0,
|
10
|
-
class: "relative flex mb-4 overflow-x-auto overscroll-x-contain no-scrollbar snap-x snap-always snap-mandatory"
|
11
|
-
};
|
12
|
-
const _hoisted_3 = ["onClick"];
|
13
|
-
const _hoisted_4 = { class: "relative whitespace-nowrap px-4" };
|
7
|
+
const _hoisted_1 = ["onClick"];
|
8
|
+
const _hoisted_2 = { class: "relative whitespace-nowrap px-4" };
|
14
9
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
15
10
|
__name: "WTabs",
|
16
11
|
props: {
|
@@ -19,7 +14,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
19
14
|
icons: {},
|
20
15
|
slots: {},
|
21
16
|
lessTransitions: { type: Boolean },
|
22
|
-
initTab: {}
|
17
|
+
initTab: {},
|
18
|
+
side: { type: Boolean },
|
19
|
+
disableMinHeight: { type: Boolean }
|
23
20
|
},
|
24
21
|
emits: ["update:current", "update:has-changes"],
|
25
22
|
setup(__props, { expose: __expose, emit: __emit }) {
|
@@ -66,10 +63,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
66
63
|
if (!props.names) return;
|
67
64
|
const element = button.value[current.value];
|
68
65
|
if (!element || !element.offsetWidth) return;
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
66
|
+
if (props.side) {
|
67
|
+
indicatorStyle.value = {
|
68
|
+
height: element.offsetHeight + "px",
|
69
|
+
top: element.offsetTop + "px",
|
70
|
+
left: "0",
|
71
|
+
width: "0.25rem"
|
72
|
+
};
|
73
|
+
} else {
|
74
|
+
indicatorStyle.value = {
|
75
|
+
width: element.offsetWidth + "px",
|
76
|
+
left: element.offsetLeft + "px",
|
77
|
+
bottom: "0",
|
78
|
+
height: "0.25rem"
|
79
|
+
};
|
80
|
+
}
|
73
81
|
};
|
74
82
|
const updateHeight = (value) => {
|
75
83
|
if (minHeight.value >= value) return;
|
@@ -111,22 +119,34 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
111
119
|
initModel
|
112
120
|
});
|
113
121
|
return (_ctx, _cache) => {
|
114
|
-
return openBlock(), createElementBlock("div",
|
115
|
-
|
122
|
+
return openBlock(), createElementBlock("div", {
|
123
|
+
class: normalizeClass(["mb-8 grid gap-4", {
|
124
|
+
"grid grid-cols-1": !_ctx.side,
|
125
|
+
"grid grid-cols-[auto,1fr] items-start": _ctx.side
|
126
|
+
}])
|
127
|
+
}, [
|
128
|
+
_ctx.names ? (openBlock(), createElementBlock("div", {
|
129
|
+
key: 0,
|
130
|
+
class: normalizeClass(["relative flex overflow-x-auto overscroll-x-contain no-scrollbar snap-x snap-always snap-mandatory", {
|
131
|
+
"flex-col": _ctx.side
|
132
|
+
}])
|
133
|
+
}, [
|
116
134
|
(openBlock(true), createElementBlock(Fragment, null, renderList(defaultSlots.value, (_, index) => {
|
117
135
|
return openBlock(), createElementBlock("button", {
|
118
136
|
ref_for: true,
|
119
137
|
ref_key: "button",
|
120
138
|
ref: button,
|
121
139
|
key: index,
|
122
|
-
class: normalizeClass(["flex-1 font-semibold flex items-center
|
140
|
+
class: normalizeClass(["flex-1 font-semibold flex items-center cursor-pointer snap-center relative w-ripple w-ripple-hover select-none transition-colors duration-500 outline-none", {
|
123
141
|
"text-description": current.value !== index && isValidMap[index] !== false,
|
124
142
|
"text-primary-default dark:text-primary-dark": current.value === index && isValidMap[index] !== false,
|
125
|
-
"text-negative dark:text-negative-dark": isValidMap[index] === false
|
143
|
+
"text-negative dark:text-negative-dark": isValidMap[index] === false,
|
144
|
+
"h-10 text-center justify-center": !_ctx.side,
|
145
|
+
"py-3 text-start pr-4": _ctx.side
|
126
146
|
}]),
|
127
147
|
onClick: ($event) => unref(switchTab)(index)
|
128
148
|
}, [
|
129
|
-
createElementVNode("div",
|
149
|
+
createElementVNode("div", _hoisted_2, [
|
130
150
|
_ctx.icons?.[index] ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icons?.[index]), {
|
131
151
|
key: 0,
|
132
152
|
class: "inline -mt-1"
|
@@ -141,7 +161,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
141
161
|
default: withCtx(() => [
|
142
162
|
hasChangesMap[index] ? (openBlock(), createElementBlock("div", {
|
143
163
|
key: 0,
|
144
|
-
class: normalizeClass(["absolute top-0
|
164
|
+
class: normalizeClass(["absolute top-0 right-0 square-2 rounded-full transition-colors duration-500", {
|
145
165
|
"bg-info dark:bg-info-dark": isValidMap[index] !== false,
|
146
166
|
"bg-negative dark:bg-negative-dark": isValidMap[index] === false
|
147
167
|
}])
|
@@ -150,26 +170,27 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
150
170
|
_: 2
|
151
171
|
}, 1024)
|
152
172
|
])
|
153
|
-
], 10,
|
173
|
+
], 10, _hoisted_1);
|
154
174
|
}), 128)),
|
155
175
|
createElementVNode("div", {
|
156
|
-
class: normalizeClass(["absolute
|
176
|
+
class: normalizeClass(["absolute rounded-sm duration-500", {
|
157
177
|
"bg-primary-default dark:bg-primary-dark": isValidMap[current.value] !== false,
|
158
178
|
"bg-negative dark:bg-negative-dark": isValidMap[current.value] === false,
|
159
|
-
"transition-[left,width,background-color]": indicatorStyle.value !== void 0
|
179
|
+
"transition-[left,width,background-color]": !_ctx.side && indicatorStyle.value !== void 0,
|
180
|
+
"transition-[top,height,background-color]": _ctx.side && indicatorStyle.value !== void 0
|
160
181
|
}]),
|
161
182
|
style: normalizeStyle(indicatorStyle.value)
|
162
183
|
}, null, 6)
|
163
|
-
])) : createCommentVNode("", true),
|
184
|
+
], 2)) : createCommentVNode("", true),
|
164
185
|
createElementVNode("div", {
|
165
186
|
class: "relative transition-[min-height] h-full duration-300",
|
166
187
|
style: normalizeStyle({ minHeight: minHeight.value ? minHeight.value + "px" : "auto", "--direction-factor": isDirect.value ? "1" : "-1" })
|
167
188
|
}, [
|
168
189
|
createVNode(TransitionGroup, {
|
169
|
-
"enter-active-class": "transition-transform duration-[250ms] w-full",
|
170
|
-
"leave-active-class": "transition-transform duration-[250ms] w-full absolute top-0",
|
171
|
-
"enter-from-class": _ctx.lessTransitions ? "opacity-0" : "translate-x-[calc((100%+var(--inner-margin))*var(--direction-factor))]",
|
172
|
-
"leave-to-class": _ctx.lessTransitions ? "opacity-0" : "translate-x-[calc((100%+var(--inner-margin))*var(--direction-factor)*-1)]"
|
190
|
+
"enter-active-class": "transition-[transform,opacity] duration-[250ms] w-full",
|
191
|
+
"leave-active-class": "transition-[transform,opacity] duration-[250ms] w-full absolute top-0",
|
192
|
+
"enter-from-class": _ctx.lessTransitions || _ctx.side ? "opacity-0" : "translate-x-[calc((100%+var(--inner-margin))*var(--direction-factor))]",
|
193
|
+
"leave-to-class": _ctx.lessTransitions || _ctx.side ? "opacity-0" : "translate-x-[calc((100%+var(--inner-margin))*var(--direction-factor)*-1)]"
|
173
194
|
}, {
|
174
195
|
default: withCtx(() => [
|
175
196
|
(openBlock(true), createElementBlock(Fragment, null, renderList(defaultSlots.value, (slot, index) => {
|
@@ -180,7 +201,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
180
201
|
key: index,
|
181
202
|
"is-active": index === current.value,
|
182
203
|
class: "width-full",
|
183
|
-
"onUpdate:height": updateHeight
|
204
|
+
"onUpdate:height": _cache[0] || (_cache[0] = ($event) => !_ctx.disableMinHeight && updateHeight($event))
|
184
205
|
}, {
|
185
206
|
default: withCtx(() => [
|
186
207
|
createVNode(_sfc_main$2, {
|
@@ -205,7 +226,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
205
226
|
_: 1
|
206
227
|
}, 8, ["enter-from-class", "leave-to-class"])
|
207
228
|
], 4)
|
208
|
-
]);
|
229
|
+
], 2);
|
209
230
|
};
|
210
231
|
}
|
211
232
|
});
|