cja-phoenix 0.3.2 → 0.3.3
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/cja-phoenix.es.js
CHANGED
|
@@ -5790,11 +5790,10 @@ const A_ = async (e) => {
|
|
|
5790
5790
|
)
|
|
5791
5791
|
}), F_ = (e, t) => {
|
|
5792
5792
|
const n = new URL(window.location.href);
|
|
5793
|
-
|
|
5794
|
-
const r = n.searchParams.get(e);
|
|
5793
|
+
return n.searchParams.has(e) ? (() => {
|
|
5794
|
+
const r = decodeURIComponent(n.searchParams.get(e));
|
|
5795
5795
|
return t && (n.searchParams.delete(e), history.replaceState(history.state, "", n.toString())), r;
|
|
5796
|
-
}
|
|
5797
|
-
return;
|
|
5796
|
+
})() : void 0;
|
|
5798
5797
|
}, P_ = (e) => {
|
|
5799
5798
|
const t = new FormData();
|
|
5800
5799
|
return t.append(
|
|
@@ -7538,11 +7537,11 @@ const Ep = (e) => Gt().typeError(e.required).required(e.required), Cp = (e) => G
|
|
|
7538
7537
|
file: bp(() => fo().required(e.required))
|
|
7539
7538
|
}), Ip = (e, t) => {
|
|
7540
7539
|
const n = (t == null ? void 0 : t.format) == "mm/yyyy" ? 2 : 3, r = (t == null ? void 0 : t.format) == "mm/yyyy" ? 1 : 2;
|
|
7541
|
-
let i = Mi().
|
|
7542
|
-
"
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
);
|
|
7540
|
+
let i = Mi().transform(
|
|
7541
|
+
(a, s) => !(s instanceof Date) && s.split("/").length == 3 && s.split("/")[2].length == 4 ? new Date(s.split("/").reverse().join("-")) : a
|
|
7542
|
+
).typeError(e.invalid).required(e.required).test("dateTest", e.invalid, (a, s) => (console.log(
|
|
7543
|
+
s.originalValue.split("/").length == n && s.originalValue.split("/")[r].length == 4
|
|
7544
|
+
), s.originalValue.split("/").length == n && s.originalValue.split("/")[r].length == 4));
|
|
7546
7545
|
return t != null && t.minDate && (i = i.min(t.minDate, e.min)), t != null && t.maxDate && (i = i.max(t.maxDate, e.max)), i;
|
|
7547
7546
|
}, Lp = (e) => Gt().typeError(e.required).required(e.required).min(9, e.invalid).test("nifTest", e.invalid, (t) => {
|
|
7548
7547
|
if (!t)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getFromUrl: (param: string, removeFromUrl?: boolean) => string |
|
|
1
|
+
export declare const getFromUrl: (param: string, removeFromUrl?: boolean) => string | undefined;
|
package/package.json
CHANGED
|
@@ -68,15 +68,26 @@ export const dateRequired = (
|
|
|
68
68
|
|
|
69
69
|
let validation = yup
|
|
70
70
|
.date()
|
|
71
|
+
.transform((v, ogV) =>
|
|
72
|
+
!(ogV instanceof Date) &&
|
|
73
|
+
ogV.split("/").length == 3 &&
|
|
74
|
+
ogV.split("/")[2].length == 4
|
|
75
|
+
? new Date(ogV.split("/").reverse().join("-"))
|
|
76
|
+
: v
|
|
77
|
+
)
|
|
71
78
|
.typeError(messages.invalid)
|
|
72
79
|
.required(messages.required)
|
|
73
|
-
.test(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
.test("dateTest", messages.invalid, (v, context) => {
|
|
81
|
+
console.log(
|
|
82
|
+
context.originalValue.split("/").length == totalSplitLength &&
|
|
83
|
+
context.originalValue.split("/")[yearPosition].length == 4
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
return (
|
|
77
87
|
context.originalValue.split("/").length == totalSplitLength &&
|
|
78
88
|
context.originalValue.split("/")[yearPosition].length == 4
|
|
79
|
-
|
|
89
|
+
);
|
|
90
|
+
});
|
|
80
91
|
|
|
81
92
|
if (options?.minDate) {
|
|
82
93
|
validation = validation.min(options.minDate, messages.min);
|
package/src/utils/getFromUrl.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
export const getFromUrl = (param: string, removeFromUrl?: boolean) => {
|
|
2
2
|
const url = new URL(window.location.href);
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
return url.searchParams.has(param)
|
|
5
|
+
? (() => {
|
|
6
|
+
//@ts-ignore
|
|
7
|
+
const returnParam = decodeURIComponent(url.searchParams.get(param));
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
if (removeFromUrl) {
|
|
10
|
+
url.searchParams.delete(param);
|
|
11
|
+
history.replaceState(history.state, "", url.toString());
|
|
12
|
+
}
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
14
|
+
return returnParam;
|
|
15
|
+
})()
|
|
16
|
+
: undefined;
|
|
16
17
|
};
|