mhz-helpers 1.0.14 → 1.0.16
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/composables/usePage.d.ts +10 -1
- package/dist/helpers/rules.d.ts +0 -5
- package/dist/index.js +40 -35
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
1
2
|
export interface ISortOption {
|
|
2
3
|
value?: string;
|
|
3
4
|
isAsc: boolean;
|
|
@@ -7,8 +8,16 @@ export interface IPageQuery {
|
|
|
7
8
|
sort: ISortOption;
|
|
8
9
|
filter: object;
|
|
9
10
|
}
|
|
11
|
+
export declare function convertParams(params: Ref<IPageQuery | number>, initiator?: string): {
|
|
12
|
+
page: number;
|
|
13
|
+
} | {
|
|
14
|
+
initiator: string | undefined;
|
|
15
|
+
page: number;
|
|
16
|
+
sort: string | undefined;
|
|
17
|
+
dir: string;
|
|
18
|
+
};
|
|
10
19
|
export declare function usePage(filter?: object): {
|
|
11
|
-
query:
|
|
20
|
+
query: Ref<{
|
|
12
21
|
page: number;
|
|
13
22
|
sort: {
|
|
14
23
|
value?: string | undefined;
|
package/dist/helpers/rules.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -7,7 +7,16 @@ function Hi(r) {
|
|
|
7
7
|
}
|
|
8
8
|
return { data: e, total: t, setPage: n };
|
|
9
9
|
}
|
|
10
|
-
function Vi(r) {
|
|
10
|
+
function Vi(r, e) {
|
|
11
|
+
return typeof r.value == "number" ? { page: r.value } : {
|
|
12
|
+
initiator: e,
|
|
13
|
+
page: r.value.page || 1,
|
|
14
|
+
sort: r.value.sort.value,
|
|
15
|
+
dir: r.value.sort.isAsc === !1 ? "desc" : "asc",
|
|
16
|
+
...r.value.filter
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function Ki(r) {
|
|
11
20
|
const e = er(), t = Wr(), n = z({
|
|
12
21
|
page: Number(t.query.page || 1),
|
|
13
22
|
sort: {
|
|
@@ -43,7 +52,7 @@ function Vi(r) {
|
|
|
43
52
|
}
|
|
44
53
|
), { query: n, resetQuery: s, setQueryPage: i, setQueryFilter: o };
|
|
45
54
|
}
|
|
46
|
-
function
|
|
55
|
+
function zi() {
|
|
47
56
|
const r = z(1), e = z([]);
|
|
48
57
|
function t(s) {
|
|
49
58
|
e.value = [...e.value, ...s];
|
|
@@ -864,7 +873,7 @@ function Tn(r, e, t = {}) {
|
|
|
864
873
|
}
|
|
865
874
|
};
|
|
866
875
|
}
|
|
867
|
-
function
|
|
876
|
+
function Ji(r, e) {
|
|
868
877
|
const { errorFields: t, isFinished: n, pass: s } = Tn(r, e, {
|
|
869
878
|
validateOption: { suppressWarning: !0 }
|
|
870
879
|
}), i = z(0);
|
|
@@ -881,24 +890,24 @@ function zi(r, e) {
|
|
|
881
890
|
isValid: o
|
|
882
891
|
};
|
|
883
892
|
}
|
|
884
|
-
const nr = z(!1),
|
|
893
|
+
const nr = z(!1), Wi = xe(nr);
|
|
885
894
|
function Dn(r) {
|
|
886
895
|
nr.value = r;
|
|
887
896
|
}
|
|
888
|
-
function
|
|
897
|
+
function $i(r, e, t) {
|
|
889
898
|
Nn(t), e(), window.location.href = r;
|
|
890
899
|
}
|
|
891
900
|
function Un(r, e) {
|
|
892
901
|
document.cookie = `${e}=${r};Secure;samesite=strict;`;
|
|
893
902
|
}
|
|
894
|
-
function
|
|
903
|
+
function Gi(r) {
|
|
895
904
|
const { [r]: e } = Object.fromEntries(document.cookie.split("; ").map((t) => t.split("=")));
|
|
896
905
|
return e;
|
|
897
906
|
}
|
|
898
907
|
function Nn(r) {
|
|
899
908
|
document.cookie = `${r}=;expires=${(/* @__PURE__ */ new Date(0)).toUTCString()}`;
|
|
900
909
|
}
|
|
901
|
-
function
|
|
910
|
+
function Yi() {
|
|
902
911
|
const r = er();
|
|
903
912
|
function e(t, n, s, i) {
|
|
904
913
|
Un(t, i), s(t), Dn(!0), r.push(n);
|
|
@@ -907,13 +916,13 @@ function Gi() {
|
|
|
907
916
|
auth: e
|
|
908
917
|
};
|
|
909
918
|
}
|
|
910
|
-
function
|
|
919
|
+
function Xi(r) {
|
|
911
920
|
return structuredClone(Kr(r));
|
|
912
921
|
}
|
|
913
|
-
function
|
|
922
|
+
function Zi(r) {
|
|
914
923
|
return r ? new Intl.DateTimeFormat().format(new Date(r)) : "-";
|
|
915
924
|
}
|
|
916
|
-
function
|
|
925
|
+
function eo(r) {
|
|
917
926
|
return r ? new Intl.DateTimeFormat(void 0, {
|
|
918
927
|
year: "numeric",
|
|
919
928
|
month: "numeric",
|
|
@@ -922,25 +931,21 @@ function Zi(r) {
|
|
|
922
931
|
minute: "numeric"
|
|
923
932
|
}).format(new Date(r)) : "-";
|
|
924
933
|
}
|
|
925
|
-
function
|
|
934
|
+
function to() {
|
|
926
935
|
return `temp-${crypto.randomUUID()}`;
|
|
927
936
|
}
|
|
928
|
-
function
|
|
937
|
+
function ro(r) {
|
|
929
938
|
return r.map((e) => (e._id?.includes("temp") && delete e._id, e));
|
|
930
939
|
}
|
|
931
|
-
function
|
|
940
|
+
function no(r) {
|
|
932
941
|
return r.map((e) => (delete e._id, e));
|
|
933
942
|
}
|
|
934
|
-
const
|
|
943
|
+
const so = {
|
|
935
944
|
required: !0,
|
|
936
945
|
message: "This field is required"
|
|
937
|
-
},
|
|
946
|
+
}, io = {
|
|
938
947
|
type: "email",
|
|
939
948
|
message: "This is not correct email"
|
|
940
|
-
}, io = {
|
|
941
|
-
type: "string",
|
|
942
|
-
len: 18,
|
|
943
|
-
message: "This is not correct phone"
|
|
944
949
|
};
|
|
945
950
|
function sr(r, e) {
|
|
946
951
|
return function() {
|
|
@@ -5050,32 +5055,32 @@ function mo(r) {
|
|
|
5050
5055
|
export {
|
|
5051
5056
|
ho as VueQueryPlugin,
|
|
5052
5057
|
Ar as api,
|
|
5053
|
-
|
|
5054
|
-
|
|
5058
|
+
Xi as clone,
|
|
5059
|
+
Vi as convertParams,
|
|
5060
|
+
to as createTempId,
|
|
5055
5061
|
uo as deleteAuthHeader,
|
|
5056
5062
|
Nn as deleteCookieToken,
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
+
no as deleteId,
|
|
5064
|
+
ro as deleteTempId,
|
|
5065
|
+
io as email,
|
|
5066
|
+
Zi as formatDate,
|
|
5067
|
+
eo as formatDateTime,
|
|
5068
|
+
Gi as getCookieToken,
|
|
5063
5069
|
_t as handleError,
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
no as required,
|
|
5070
|
+
Wi as isAuth,
|
|
5071
|
+
$i as logout,
|
|
5072
|
+
so as required,
|
|
5068
5073
|
Dn as setAuth,
|
|
5069
5074
|
ao as setAuthHeader,
|
|
5070
5075
|
oo as setBaseURL,
|
|
5071
5076
|
Un as setCookieToken,
|
|
5072
|
-
|
|
5073
|
-
|
|
5077
|
+
Yi as useAuth,
|
|
5078
|
+
zi as useInfiniteScroll,
|
|
5074
5079
|
yo as useMutation,
|
|
5075
|
-
|
|
5080
|
+
Ki as usePage,
|
|
5076
5081
|
Hi as usePagination,
|
|
5077
5082
|
po as useQuery,
|
|
5078
5083
|
Qr as useQueryClient,
|
|
5079
|
-
|
|
5084
|
+
Ji as useValidator,
|
|
5080
5085
|
mo as vueQueryOptions
|
|
5081
5086
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mhz-helpers",
|
|
3
3
|
"description": "mhz-helpers",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.16",
|
|
5
5
|
"author": "Alexandr Dergunov <dergunovs@mail.ru> (https://github.com/dergunovs)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "20.6.2",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "6.7.
|
|
36
|
-
"@typescript-eslint/parser": "6.7.
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "6.7.2",
|
|
36
|
+
"@typescript-eslint/parser": "6.7.2",
|
|
37
37
|
"@vitejs/plugin-vue": "4.3.4",
|
|
38
38
|
"eslint": "8.49.0",
|
|
39
39
|
"eslint-config-prettier": "9.0.0",
|