eco-vue-js 0.10.52 → 0.10.54
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/Button/WButtonTab.vue.js +2 -2
- package/dist/components/Nav/WNavItem.vue.d.ts +2 -0
- package/dist/components/Nav/WNavItem.vue.d.ts.map +1 -1
- package/dist/components/Nav/WNavItem.vue.js +25 -17
- package/dist/components/Nav/WNavItemExpand.vue.d.ts +1 -0
- package/dist/components/Nav/WNavItemExpand.vue.d.ts.map +1 -1
- package/dist/components/Nav/WNavItemExpand.vue.js +84 -30
- package/dist/components/Select/WSelect.vue.js +1 -1
- package/dist/components/Select/components/SelectAsyncList.vue.js +1 -1
- package/dist/components/Status/WStatusIcon.vue.js +1 -1
- package/dist/utils/api.d.ts +2 -2
- package/dist/utils/api.d.ts.map +1 -1
- package/dist/utils/api.js +18 -7
- package/package.json +1 -1
@@ -95,7 +95,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
95
95
|
key: 0,
|
96
96
|
"has-value": _ctx.hasValue,
|
97
97
|
"has-error": _ctx.hasError,
|
98
|
-
class: "sm-not:-mr--inner-margin ml-auto mr-4"
|
98
|
+
class: "sm-not:-mr--inner-margin square-4 ml-auto mr-4"
|
99
99
|
}, null, 8, ["has-value", "has-error"])) : createCommentVNode("", true),
|
100
100
|
renderSlot(_ctx.$slots, "suffix", normalizeProps(guardReactiveProps({ hasChanges: _ctx.hasChanges, hasError: _ctx.hasError, hasValue: _ctx.hasValue })))
|
101
101
|
], 2)),
|
@@ -108,7 +108,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
108
108
|
default: withCtx(() => [
|
109
109
|
_ctx.hasChanges ? (openBlock(), createElementBlock("div", {
|
110
110
|
key: 0,
|
111
|
-
class: normalizeClass(["square-2 absolute right-
|
111
|
+
class: normalizeClass(["square-2 absolute right-1 top-1 rounded-full transition-colors duration-500", {
|
112
112
|
"bg-info dark:bg-info-dark": !_ctx.hasError,
|
113
113
|
"bg-negative dark:bg-negative-dark": _ctx.hasError
|
114
114
|
}])
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WNavItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Nav/WNavItem.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WNavItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Nav/WNavItem.vue"],"names":[],"mappings":"AAyFA;AAkJA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,eAAe,CAAA;AAY5C,UAAU,KAAM,SAAQ,SAAS;IAC/B,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAiCD,iBAAS,cAAc;WAuKT,OAAO,IAA6B;;sBAXvB,GAAG;uBACF,GAAG;;;;EAe9B;AAiBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;kFAQnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAQpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
@@ -13,13 +13,12 @@ const _hoisted_2 = {
|
|
13
13
|
class: "absolute left-7 top-0 flex h-full items-center"
|
14
14
|
};
|
15
15
|
const _hoisted_3 = { class: "[overflow:inherit]" };
|
16
|
-
const _hoisted_4 = { class: "
|
17
|
-
const _hoisted_5 = { class: "
|
18
|
-
const _hoisted_6 = { class: "
|
19
|
-
const _hoisted_7 = { class: "
|
20
|
-
const _hoisted_8 = { class: "
|
21
|
-
const _hoisted_9 = {
|
22
|
-
const _hoisted_10 = { key: 0 };
|
16
|
+
const _hoisted_4 = { class: "flex items-center" };
|
17
|
+
const _hoisted_5 = { class: "last-not:pr-1 whitespace-nowrap font-normal" };
|
18
|
+
const _hoisted_6 = { class: "relative" };
|
19
|
+
const _hoisted_7 = { class: "tracking-wide" };
|
20
|
+
const _hoisted_8 = { class: "leading-loose" };
|
21
|
+
const _hoisted_9 = { key: 0 };
|
23
22
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
24
23
|
__name: "WNavItem",
|
25
24
|
props: {
|
@@ -32,6 +31,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
32
31
|
expand: { type: Boolean },
|
33
32
|
indent: { type: Boolean },
|
34
33
|
queryFields: {},
|
34
|
+
hovered: { type: Boolean },
|
35
|
+
even: { type: Boolean },
|
35
36
|
to: {}
|
36
37
|
},
|
37
38
|
emits: ["update:isActive"],
|
@@ -55,10 +56,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
55
56
|
return (_ctx, _cache) => {
|
56
57
|
return openBlock(), createBlock(unref(RouterLink), {
|
57
58
|
to: _ctx.to,
|
58
|
-
class: normalizeClass(["w-ripple
|
59
|
+
class: normalizeClass(["w-ripple-trigger relative block py-1 no-underline", {
|
59
60
|
"text-primary dark:text-primary-dark": isTextColor.value,
|
60
61
|
"text-accent": !isTextColor.value,
|
61
|
-
"
|
62
|
+
"px-1": _ctx.even,
|
63
|
+
"xl-not:pr-1 pl-2": !_ctx.even
|
62
64
|
}])
|
63
65
|
}, {
|
64
66
|
default: withCtx(() => [
|
@@ -87,19 +89,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
87
89
|
_: 1
|
88
90
|
}),
|
89
91
|
createElementVNode("div", _hoisted_3, [
|
90
|
-
createElementVNode("div",
|
91
|
-
|
92
|
+
createElementVNode("div", {
|
93
|
+
class: normalizeClass(["w-ripple w-ripple-hover relative grid grid-cols-[1.5rem,1fr,auto] items-center rounded-lg pr-2", {
|
94
|
+
"before:opacity-10": _ctx.hovered,
|
95
|
+
"pl-4": _ctx.indent,
|
96
|
+
"pl-2": !_ctx.indent
|
97
|
+
}])
|
98
|
+
}, [
|
99
|
+
createElementVNode("div", _hoisted_4, [
|
92
100
|
_ctx.icon ?? routeTo.value.meta.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon ?? routeTo.value.meta.icon), {
|
93
101
|
key: 0,
|
94
102
|
class: "square-[1.25em]"
|
95
103
|
})) : renderSlot(_ctx.$slots, "icon", { key: 1 })
|
96
104
|
]),
|
97
|
-
createElementVNode("div",
|
98
|
-
createElementVNode("span",
|
99
|
-
createElementVNode("span",
|
100
|
-
createElementVNode("span",
|
105
|
+
createElementVNode("div", _hoisted_5, [
|
106
|
+
createElementVNode("span", _hoisted_6, [
|
107
|
+
createElementVNode("span", _hoisted_7, [
|
108
|
+
createElementVNode("span", _hoisted_8, toDisplayString(titleLocal.value), 1),
|
101
109
|
_cache[1] || (_cache[1] = createTextVNode(" ")),
|
102
|
-
!_ctx.skeleton ? (openBlock(), createElementBlock("span",
|
110
|
+
!_ctx.skeleton ? (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(typeof _ctx.count === "number" ? `(${unref(numberCompactFormatter).format(_ctx.count)})` : ""), 1)) : (openBlock(), createBlock(WSkeleton, {
|
103
111
|
key: 1,
|
104
112
|
class: "inline-flex max-w-10"
|
105
113
|
}))
|
@@ -113,7 +121,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
113
121
|
])
|
114
122
|
]),
|
115
123
|
renderSlot(_ctx.$slots, "right")
|
116
|
-
])
|
124
|
+
], 2)
|
117
125
|
])
|
118
126
|
]),
|
119
127
|
_: 3
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WNavItemExpand.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Nav/WNavItemExpand.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WNavItemExpand.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Nav/WNavItemExpand.vue"],"names":[],"mappings":"AA2FA;AAuKA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,eAAe,CAAA;AAE5C,OAAO,EAAC,KAAK,KAAK,EAA4D,MAAM,KAAK,CAAA;AAczF,UAAU,KAAM,SAAQ,OAAO,CAAC,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,YAAY,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAmDD,iBAAS,cAAc;WAkMT,OAAO,IAA6B;;kBAxMtC,MAAM,KAAK,EAAE;eAChB,MAAM,KAAK,EAAE;;kBADV,MAAM,KAAK,EAAE;eAChB,MAAM,KAAK,EAAE;;;;EA4MrB;AAuBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;6FAQnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAQpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
@@ -1,10 +1,14 @@
|
|
1
|
-
import { defineComponent, useSlots, computed, ref, reactive, watch, onBeforeUnmount, createElementBlock, openBlock, createVNode,
|
2
|
-
import _sfc_main$
|
1
|
+
import { defineComponent, useSlots, computed, ref, reactive, watch, onBeforeUnmount, createElementBlock, openBlock, createVNode, unref, withCtx, createElementVNode, Fragment, renderList, createBlock, resolveDynamicComponent, mergeProps, normalizeClass, renderSlot } from 'vue';
|
2
|
+
import _sfc_main$1 from '../DropdownMenu/WDropdownMenu.vue.js';
|
3
|
+
import _sfc_main$3 from '../Expansion/WExpansion.vue.js';
|
3
4
|
import IconArrow from '../../assets/icons/default/IconArrow.svg.js';
|
5
|
+
import { HorizontalAlign } from '../../utils/HorizontalAlign.js';
|
6
|
+
import { useIsMobile } from '../../utils/mobile.js';
|
4
7
|
import { unwrapSlots, debounce } from '../../utils/utils.js';
|
5
|
-
import _sfc_main$
|
8
|
+
import _sfc_main$2 from './WNavItem.vue.js';
|
6
9
|
import WNavItemTransition from './WNavItemTransition.vue.js';
|
7
10
|
|
11
|
+
const _hoisted_1 = { class: "bg-default dark:bg-default-dark w-nav-bar-width overflow-hidden rounded-xl border border-solid border-gray-200 text-start font-normal shadow dark:border-gray-800" };
|
8
12
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
9
13
|
__name: "WNavItemExpand",
|
10
14
|
props: {
|
@@ -15,66 +19,116 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
15
19
|
skeleton: { type: Boolean },
|
16
20
|
indent: { type: Boolean },
|
17
21
|
queryFields: {},
|
22
|
+
even: { type: Boolean },
|
18
23
|
to: {}
|
19
24
|
},
|
20
25
|
emits: ["update:isActive"],
|
21
26
|
setup(__props, { emit: __emit }) {
|
22
27
|
const props = __props;
|
23
28
|
const slots = useSlots();
|
29
|
+
const { isMobile } = useIsMobile();
|
24
30
|
const slotsDefault = computed(() => unwrapSlots(slots.default?.() ?? []));
|
25
31
|
const emit = __emit;
|
26
32
|
const isOpen = ref(false);
|
27
33
|
const hasActiveCached = ref(false);
|
34
|
+
const isDropdownOpen = ref(false);
|
28
35
|
const isActiveChildrenMap = reactive({});
|
29
36
|
const hasActive = computed(() => isOpen.value || Object.values(isActiveChildrenMap).includes(true));
|
30
37
|
const updateHasActiveCache = debounce((value) => {
|
31
38
|
hasActiveCached.value = value;
|
39
|
+
isDropdownOpen.value = false;
|
32
40
|
emit("update:isActive", [props.title, value]);
|
33
41
|
}, 10);
|
42
|
+
const showDropdown = () => {
|
43
|
+
isDropdownOpen.value = true;
|
44
|
+
};
|
45
|
+
const hideDropdown = () => {
|
46
|
+
isDropdownOpen.value = false;
|
47
|
+
};
|
34
48
|
watch(hasActive, updateHasActiveCache, { immediate: true });
|
35
49
|
onBeforeUnmount(() => {
|
50
|
+
isDropdownOpen.value = false;
|
36
51
|
emit("update:isActive", [props.title, false]);
|
37
52
|
});
|
38
53
|
return (_ctx, _cache) => {
|
39
54
|
return openBlock(), createElementBlock("div", null, [
|
40
55
|
createVNode(_sfc_main$1, {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
count: _ctx.count,
|
46
|
-
counter: _ctx.counter,
|
47
|
-
"has-active": hasActiveCached.value,
|
48
|
-
indent: _ctx.indent,
|
49
|
-
expand: !_ctx.to,
|
50
|
-
"query-fields": _ctx.queryFields,
|
51
|
-
"onUpdate:isActive": _cache[0] || (_cache[0] = ($event) => {
|
52
|
-
isOpen.value = $event[1];
|
53
|
-
$event[1] && _ctx.$emit("update:isActive", [_ctx.title, $event[1]]);
|
54
|
-
})
|
56
|
+
"is-open": isDropdownOpen.value && !hasActiveCached.value,
|
57
|
+
"max-width": 320,
|
58
|
+
"max-height": 320,
|
59
|
+
"horizontal-align": unref(HorizontalAlign).RIGHT_OUTER
|
55
60
|
}, {
|
56
|
-
|
57
|
-
|
61
|
+
toggle: withCtx(() => [
|
62
|
+
createVNode(_sfc_main$2, mergeProps(unref(isMobile) || hasActiveCached.value || _ctx.even ? void 0 : {
|
63
|
+
onmouseenter: showDropdown,
|
64
|
+
onmouseleave: hideDropdown
|
65
|
+
}, {
|
66
|
+
to: _ctx.to ?? slotsDefault.value?.[0]?.props?.to,
|
67
|
+
title: _ctx.title,
|
68
|
+
icon: _ctx.icon,
|
69
|
+
skeleton: _ctx.skeleton,
|
70
|
+
count: _ctx.count,
|
71
|
+
counter: _ctx.counter,
|
72
|
+
"has-active": hasActiveCached.value,
|
73
|
+
indent: _ctx.indent,
|
74
|
+
even: _ctx.even,
|
75
|
+
expand: !_ctx.to,
|
76
|
+
"query-fields": _ctx.queryFields,
|
77
|
+
hovered: isDropdownOpen.value && !hasActiveCached.value,
|
78
|
+
"onUpdate:isActive": _cache[0] || (_cache[0] = ($event) => {
|
79
|
+
isOpen.value = $event[1];
|
80
|
+
$event[1] && _ctx.$emit("update:isActive", [_ctx.title, $event[1]]);
|
81
|
+
$event[1] && hideDropdown();
|
82
|
+
})
|
83
|
+
}), {
|
84
|
+
icon: withCtx(() => [
|
85
|
+
renderSlot(_ctx.$slots, "icon")
|
86
|
+
]),
|
87
|
+
right: withCtx(() => [
|
88
|
+
createVNode(unref(IconArrow), {
|
89
|
+
class: normalizeClass(["square-3 transition-transform", {
|
90
|
+
"-rotate-90": !hasActiveCached.value && !_ctx.even
|
91
|
+
}])
|
92
|
+
}, null, 8, ["class"])
|
93
|
+
]),
|
94
|
+
_: 3
|
95
|
+
}, 16, ["to", "title", "icon", "skeleton", "count", "counter", "has-active", "indent", "even", "expand", "query-fields", "hovered"])
|
58
96
|
]),
|
59
|
-
|
60
|
-
|
61
|
-
class:
|
62
|
-
|
63
|
-
|
64
|
-
},
|
97
|
+
content: withCtx(() => [
|
98
|
+
createElementVNode("div", {
|
99
|
+
class: "px-1",
|
100
|
+
onMouseenter: showDropdown,
|
101
|
+
onMouseleave: hideDropdown
|
102
|
+
}, [
|
103
|
+
createElementVNode("div", _hoisted_1, [
|
104
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(slotsDefault.value, (slot, index) => {
|
105
|
+
return openBlock(), createBlock(resolveDynamicComponent(slot), {
|
106
|
+
key: index,
|
107
|
+
even: "",
|
108
|
+
"onUpdate:isActive": _cache[1] || (_cache[1] = ($event) => $event[1] && hideDropdown())
|
109
|
+
}, null, 32);
|
110
|
+
}), 128))
|
111
|
+
])
|
112
|
+
], 32)
|
65
113
|
]),
|
66
114
|
_: 3
|
67
|
-
}, 8, ["
|
68
|
-
createVNode(_sfc_main$
|
115
|
+
}, 8, ["is-open", "horizontal-align"]),
|
116
|
+
createVNode(_sfc_main$3, {
|
117
|
+
"is-shown": hasActiveCached.value || _ctx.even
|
118
|
+
}, {
|
69
119
|
default: withCtx(() => [
|
70
120
|
createVNode(WNavItemTransition, null, {
|
71
121
|
default: withCtx(() => [
|
72
122
|
(openBlock(true), createElementBlock(Fragment, null, renderList(slotsDefault.value, (slot, index) => {
|
73
123
|
return openBlock(), createBlock(resolveDynamicComponent(slot), {
|
74
124
|
key: index,
|
75
|
-
|
76
|
-
|
77
|
-
|
125
|
+
even: _ctx.even,
|
126
|
+
indent: !_ctx.even,
|
127
|
+
"onUpdate:isActive": _cache[2] || (_cache[2] = ($event) => {
|
128
|
+
isActiveChildrenMap[$event[0]] = $event[1];
|
129
|
+
$event[1] && hideDropdown();
|
130
|
+
})
|
131
|
+
}, null, 40, ["even", "indent"]);
|
78
132
|
}), 128))
|
79
133
|
]),
|
80
134
|
_: 1
|
@@ -348,7 +348,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
348
348
|
_: 3
|
349
349
|
}, 8, ["is-cursor", "loading", "scroll", "hide-option-icon", "disabled"])) : createCommentVNode("", true),
|
350
350
|
!optionsFiltered.value.length && !isModelValueSearch.value && (!_ctx.createOption || optionsWithCreated.value.length) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
351
|
-
createElementVNode("div", _hoisted_3, toDisplayString(!search.value && _ctx.emptyStub ? _ctx.emptyStub : "No match"), 1)
|
351
|
+
createElementVNode("div", _hoisted_3, toDisplayString(!search.value && _ctx.emptyStub ? _ctx.emptyStub : search.value ? "No match" : "Nothing to show"), 1)
|
352
352
|
])) : createCommentVNode("", true),
|
353
353
|
(openBlock(true), createElementBlock(Fragment, null, renderList(optionsFiltered.value, (option, index) => {
|
354
354
|
return openBlock(), createBlock(_sfc_main$2, {
|
@@ -209,7 +209,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
209
209
|
"-pt--w-select-option-padding": !_ctx.noPadding && !_ctx.allowCreate
|
210
210
|
}])
|
211
211
|
}, [
|
212
|
-
createElementVNode("div", _hoisted_2, toDisplayString(!_ctx.search && _ctx.emptyStub ? _ctx.emptyStub : "No match"), 1)
|
212
|
+
createElementVNode("div", _hoisted_2, toDisplayString(!_ctx.search && _ctx.emptyStub ? _ctx.emptyStub : _ctx.search ? "No match" : "Nothing to show"), 1)
|
213
213
|
], 2)
|
214
214
|
]),
|
215
215
|
_: 3
|
package/dist/utils/api.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Reactive } from 'vue';
|
1
|
+
import { Reactive, Ref } from 'vue';
|
2
2
|
import { default as WForm } from '../components/Form/WForm.vue';
|
3
3
|
import { default as WFormValidator } from '../components/Form/WFormValidator.vue';
|
4
4
|
type ErrorResponse<Response> = {
|
@@ -22,7 +22,7 @@ export declare const encodeRouteParams: <T>(params: T) => Partial<EncodeQueryPar
|
|
22
22
|
export declare const createUseQueryParams: <QueryParams extends Record<string, unknown>>(config: { [Key in keyof QueryParams]: ParseFn<QueryParams[Key]>; }) => {
|
23
23
|
(route: {
|
24
24
|
query: EncodeQueryParams<Partial<QueryParams>>;
|
25
|
-
}): {
|
25
|
+
}, enabled?: Ref<boolean>): {
|
26
26
|
queryParams: Reactive<Partial<QueryParams>>;
|
27
27
|
updateQueryParams: (value: Partial<QueryParams>) => void;
|
28
28
|
};
|
package/dist/utils/api.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/utils/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,QAAQ,EAAkB,MAAM,KAAK,CAAA;
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/utils/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,QAAQ,EAAE,KAAK,GAAG,EAAkB,MAAM,KAAK,CAAA;AAG5D,OAAO,KAAK,KAAK,MAAM,6BAA6B,CAAA;AACpD,OAAO,KAAK,cAAc,MAAM,sCAAsC,CAAA;AAMtE,KAAK,aAAa,CAAC,QAAQ,IAAI;KAC5B,GAAG,IAAI,QAAQ,GAAG,kBAAkB,GAAG,MAAM,QAAQ,CAAC,CAAC,EAAE,GAAG,SAAS,QAAQ,GAAG,MAAM,GAAG,MAAM,EAAE;CACnG,CAAA;AAED,qBAAa,QAAQ,CAAC,IAAI,SAAS,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,CAAE,SAAQ,KAAK;aACvF,QAAQ,EAAE,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC;gBAA1C,QAAQ,EAAE,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC;CAGvE;AAED,qBAAa,cAAc,CAAC,IAAI,SAAS,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,CAAE,SAAQ,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;gBAChG,QAAQ,EAAE,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC;CAGvD;AAED,eAAO,MAAM,cAAc,GAAI,KAAK,EAClC,OAAO,KAAK,EACZ,OAAO;IAAC,UAAU,EAAE,iBAAiB,CAAC,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC,CAAA;CAAC,GAAG,IAAI,EACzE,QAAQ,MAAM,EACd,gBAAgB;IAAC,UAAU,EAAE,iBAAiB,CAAC,OAAO,cAAc,CAAC,CAAC,YAAY,CAAC,CAAA;CAAC,GAAG,IAAI,KAC1F,OAAO,CAAC,KAAK,CAgBf,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAAE,OAAO,CAAC,KAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,SAYpE,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,QAAQ,CAAC,KAAG,iBAAiB,CAAC,CAAC,CAYnE,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,QAAQ,CAAC,KAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAc5E,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAE,GAAG,IAAI,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAC,KAqDlI;YA7BM;QAAC,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAA;KAAC,YAAY,GAAG,CAAC,OAAO,CAAC;;mCAGvD,OAAO,CAAC,WAAW,CAAC;;eA3BkC,GAAG;yBAGjE,OAAO,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,SAAS,iBAAiB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAkDxG;IAAC,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;CAC5D,CAAA"}
|
package/dist/utils/api.js
CHANGED
@@ -60,24 +60,35 @@ const encodeRouteParams = (params) => {
|
|
60
60
|
};
|
61
61
|
const createUseQueryParams = (config) => {
|
62
62
|
const keyList = Object.keys(config);
|
63
|
-
const parse = (
|
63
|
+
const parse = (queryParams2, value) => {
|
64
64
|
for (const key of keyList) {
|
65
65
|
const resultValue = config[key](value[key]);
|
66
|
-
if (
|
66
|
+
if (queryParams2[key] === resultValue) continue;
|
67
67
|
if (resultValue === void 0 || Number.isNaN(resultValue) || Array.isArray(resultValue) && resultValue.length === 0) {
|
68
|
-
delete
|
68
|
+
delete queryParams2[key];
|
69
69
|
} else {
|
70
|
-
|
70
|
+
queryParams2[key] = resultValue;
|
71
71
|
}
|
72
72
|
}
|
73
73
|
};
|
74
|
-
const
|
74
|
+
const queryParams = reactive({});
|
75
|
+
let lastQuery = null;
|
76
|
+
const fn = (route, enabled) => {
|
75
77
|
const router = useRouter();
|
76
|
-
const queryParams = reactive({});
|
77
78
|
const updateQueryParams = (value) => {
|
78
79
|
router.replace({ query: { ...route.query, ...encodeRouteParams(value) } });
|
79
80
|
};
|
80
|
-
watch(() => route.query, (value) =>
|
81
|
+
const handle = watch(() => route.query, (value) => {
|
82
|
+
if (lastQuery === value) return;
|
83
|
+
parse(queryParams, value);
|
84
|
+
lastQuery = value;
|
85
|
+
}, { immediate: enabled ? enabled.value : true });
|
86
|
+
if (enabled) {
|
87
|
+
watch(enabled, (value) => {
|
88
|
+
if (value) handle.resume();
|
89
|
+
else handle.pause();
|
90
|
+
}, { immediate: true });
|
91
|
+
}
|
81
92
|
return {
|
82
93
|
queryParams,
|
83
94
|
updateQueryParams
|
package/package.json
CHANGED