@abgov/ui-components-common 1.2.0-alpha.1 → 1.2.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/index.cjs +1 -1
- package/index.js +76 -87
- package/lib/public-form-controller.d.ts +2 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var A=Object.defineProperty;var p=r=>{throw TypeError(r)};var
|
|
1
|
+
"use strict";var A=Object.defineProperty;var p=r=>{throw TypeError(r)};var v=(r,t,e)=>t in r?A(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var u=(r,t,e)=>v(r,typeof t!="symbol"?t+"":t,e),M=(r,t,e)=>t.has(r)||p("Cannot "+e);var y=(r,t,e)=>t.has(r)?p("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e);var g=(r,t,e)=>(M(r,t,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class S{constructor(t){u(this,"validators");this.validators=t||{}}add(t,...e){this.validators[t]=e}validate(t){const e={};return Object.entries(this.validators).forEach(([a,i])=>{const n=i.map(s=>s(t[a])).find(s=>!!s);n&&(e[a]=n)}),e}}function E(){return[f("Day is required"),h({min:1,max:31,minMsg:"Day must be between 1 and 31",maxMsg:"Day must be between 1 and 31"})]}function N(){return[f("Month is required"),h({min:0,max:11,minMsg:"Month must be between Jan and Dec",maxMsg:"Month must be between Jan and Dec"})]}function w(){const r=new Date().getFullYear();return[f("Year is required"),h({min:1900,max:r,minMsg:"Year must be greater than 1900",maxMsg:`Year must be less than ${r}`})]}function f(r){return t=>(r=r||"Required",typeof t=="number"&&!isNaN(t)||t?"":r)}function D(r){const t=new RegExp(/^\+?[\d-() ]{10,18}$/);return c(t,r||"Invalid phone number")}function _(r){const t=new RegExp(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);return c(t,r||"Invalid email address")}function R(){return r=>{if(!r)return"";const t="121212121".split("").map(i=>parseInt(i)),e=r.replace(/\D/g,"");return e.length!==9?"SIN must contain 9 numbers":e.split("").map(i=>parseInt(i)).map((i,n)=>{const s=i*t[n];return s<10?s:`${s}`.split("").map(o=>parseInt(o)).reduce((o,m)=>o+m,0)}).reduce((i,n)=>i+n,0)%10===0?"":"Invalid SIN"}}function $(){return c(/^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,"Invalid postal code")}function c(r,t){return e=>!e||e.match(r)?"":t}function x({invalidMsg:r,minMsg:t,maxMsg:e,min:a,max:i}={}){return n=>{let s=new Date(-1);return`${n||""}`.length===0?"":(typeof n=="string"&&(s=new Date(n)),typeof n=="number"&&(s=new Date(n)),n.toDateString&&(s=n),s.getDate()===-1?r||"Invalid date":a&&s<a?t||`Must be after ${a}`:i&&s>i?e||`Must be before ${i}`:"")}}function h({invalidTypeMsg:r,minMsg:t,maxMsg:e,min:a=-Number.MAX_VALUE,max:i=Number.MAX_VALUE}={}){return n=>{let s=Number.MAX_VALUE;return`${n??""}`.length===0?"":(typeof n=="string"&&(s=parseFloat(n)),typeof n=="number"&&(s=n),isNaN(s)?r||"Must be a numeric value":s>i?e||`Must be less than or equal to ${i}`:s<a?t||`Must be greater than or equal to ${a}`:"")}}function I({invalidTypeMsg:r,minMsg:t,maxMsg:e,min:a=-Number.MAX_VALUE,max:i=Number.MAX_VALUE}){return n=>`${n||""}`.length===0?"":typeof n!="string"?r||"Invalid type":n.length>i?e||`Must be less than ${i} characters`:n.length<a?t||`Must be greater than ${a} characters`:""}var d,L,V;class C{constructor(t){y(this,d);u(this,"state");u(this,"_formData");u(this,"_formRef");this.type=t}init(t){if(this._formRef){console.warn("init: form element has already been set");return}this._formRef=t.detail.el,this.state={uuid:crypto.randomUUID(),form:{},history:[],editting:"",status:"not-started"}}initList(t){this._formRef=t.detail.el,this.state=[]}initState(t,e){l(this._formRef,"external::init:state",t),e&&setTimeout(e,200)}updateListState(t){const e=t.detail;Array.isArray(e.data)&&(this.state=e.data)}updateObjectState(t){var a,i;if(Array.isArray(this.state))return;const e=t.detail;e.type==="list"?this.state={...this.state,form:{...((a=this.state)==null?void 0:a.form)||{},[e.id]:e.data}}:this.state={...this.state,form:{...((i=this.state)==null?void 0:i.form)||{},...e.data.form},history:e.data.history}}getStateList(){return this.state?Array.isArray(this.state)?this.state.length===0?[]:this.state.map(t=>Object.values(t.form).filter(e=>{var a;return((a=e==null?void 0:e.data)==null?void 0:a.type)==="details"}).map(e=>{var a;return e.data.type==="details"&&((a=e.data)==null?void 0:a.fieldsets)||{}}).reduce((e,a)=>{for(const[i,n]of Object.entries(a))e[i]=n.value;return e},{})):(console.warn("Utils:getStateList: unable to update the state of a non-multi form type",this.state),[]):[]}getStateValue(t,e){if(Array.isArray(this.state))return console.error("getStateValue: unable to update the state of a multi form type"),"";if(!this.state)return console.error("getStateValue: state has not yet been set"),"";const a=this.state.form[t].data;return a.type!=="details"?"":a.fieldsets[e].value}continueTo(t){if(!t){console.error("continueTo [name] is undefined");return}l(this._formRef,"external::continue",{next:t})}validate(t,e,a){var o;const{el:i,state:n}=e.detail,s=(o=n==null?void 0:n[t])==null?void 0:o.value;window.scrollTo({top:0,behavior:"smooth"});for(const m of a){const b=m(s);if(g(this,d,V).call(this,i,t,b),b)return[!1,""]}return[!0,s]}edit(t){l(this._formRef,"external::alter:state",{index:t,operation:"edit"})}remove(t){l(this._formRef,"external::alter:state",{index:t,operation:"remove"})}clean(t){return t.history.reduce((e,a)=>(e[a]=t.form[a],e),{})}}d=new WeakSet,L=function(t){var e;Array.isArray(t.data)&&(Array.isArray(this.state)||(this.state={...this.state,form:{...((e=this.state)==null?void 0:e.form)||{},[t.id]:t.data}}))},V=function(t,e,a){t.dispatchEvent(new CustomEvent("msg",{composed:!0,detail:{action:"external::set:error",data:{name:e,msg:a}}}))};function q(r,t,e,a){if(!r){console.error("dispatch element is null");return}r.dispatchEvent(new CustomEvent(t,{composed:!0,bubbles:a==null?void 0:a.bubbles,detail:e}))}function l(r,t,e,a){if(!r){console.error("dispatch element is null");return}r.dispatchEvent(new CustomEvent("msg",{composed:!0,bubbles:a==null?void 0:a.bubbles,detail:{action:t,data:e}}))}exports.FormValidator=S;exports.PublicFormController=C;exports.SINValidator=R;exports.birthDayValidator=E;exports.birthMonthValidator=N;exports.birthYearValidator=w;exports.dateValidator=x;exports.dispatch=q;exports.emailValidator=_;exports.lengthValidator=I;exports.numericValidator=h;exports.phoneNumberValidator=D;exports.postalCodeValidator=$;exports.regexValidator=c;exports.relay=l;exports.requiredValidator=f;
|
package/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
1
|
+
var V = Object.defineProperty;
|
|
2
2
|
var p = (r) => {
|
|
3
3
|
throw TypeError(r);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var u = (r, t, e) =>
|
|
5
|
+
var v = (r, t, e) => t in r ? V(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
6
|
+
var u = (r, t, e) => v(r, typeof t != "symbol" ? t + "" : t, e), M = (r, t, e) => t.has(r) || p("Cannot " + e);
|
|
7
7
|
var y = (r, t, e) => t.has(r) ? p("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e);
|
|
8
|
-
var g = (r, t, e) => (
|
|
9
|
-
class
|
|
8
|
+
var g = (r, t, e) => (M(r, t, "access private method"), e);
|
|
9
|
+
class w {
|
|
10
10
|
constructor(t) {
|
|
11
11
|
u(this, "validators");
|
|
12
12
|
this.validators = t || {};
|
|
@@ -16,13 +16,13 @@ class N {
|
|
|
16
16
|
}
|
|
17
17
|
validate(t) {
|
|
18
18
|
const e = {};
|
|
19
|
-
return Object.entries(this.validators).forEach(([
|
|
20
|
-
const
|
|
21
|
-
|
|
19
|
+
return Object.entries(this.validators).forEach(([a, i]) => {
|
|
20
|
+
const n = i.map((s) => s(t[a])).find((s) => !!s);
|
|
21
|
+
n && (e[a] = n);
|
|
22
22
|
}), e;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function N() {
|
|
26
26
|
return [
|
|
27
27
|
c("Day is required"),
|
|
28
28
|
m({
|
|
@@ -33,7 +33,7 @@ function R() {
|
|
|
33
33
|
})
|
|
34
34
|
];
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function _() {
|
|
37
37
|
return [
|
|
38
38
|
c("Month is required"),
|
|
39
39
|
m({
|
|
@@ -44,7 +44,7 @@ function S() {
|
|
|
44
44
|
})
|
|
45
45
|
];
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function D() {
|
|
48
48
|
const r = (/* @__PURE__ */ new Date()).getFullYear();
|
|
49
49
|
return [
|
|
50
50
|
c("Year is required"),
|
|
@@ -59,7 +59,7 @@ function w() {
|
|
|
59
59
|
function c(r) {
|
|
60
60
|
return (t) => (r = r || "Required", typeof t == "number" && !isNaN(t) || t ? "" : r);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function R(r) {
|
|
63
63
|
const t = new RegExp(/^\+?[\d-() ]{10,18}$/);
|
|
64
64
|
return h(t, r || "Invalid phone number");
|
|
65
65
|
}
|
|
@@ -73,10 +73,10 @@ function x() {
|
|
|
73
73
|
return (r) => {
|
|
74
74
|
if (!r) return "";
|
|
75
75
|
const t = "121212121".split("").map((i) => parseInt(i)), e = r.replace(/\D/g, "");
|
|
76
|
-
return e.length !== 9 ? "SIN must contain 9 numbers" : e.split("").map((i) => parseInt(i)).map((i,
|
|
77
|
-
const s = i * t[
|
|
76
|
+
return e.length !== 9 ? "SIN must contain 9 numbers" : e.split("").map((i) => parseInt(i)).map((i, n) => {
|
|
77
|
+
const s = i * t[n];
|
|
78
78
|
return s < 10 ? s : `${s}`.split("").map((o) => parseInt(o)).reduce((o, d) => o + d, 0);
|
|
79
|
-
}).reduce((i,
|
|
79
|
+
}).reduce((i, n) => i + n, 0) % 10 === 0 ? "" : "Invalid SIN";
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
function I() {
|
|
@@ -92,39 +92,39 @@ function L({
|
|
|
92
92
|
invalidMsg: r,
|
|
93
93
|
minMsg: t,
|
|
94
94
|
maxMsg: e,
|
|
95
|
-
min:
|
|
95
|
+
min: a,
|
|
96
96
|
max: i
|
|
97
97
|
} = {}) {
|
|
98
|
-
return (
|
|
98
|
+
return (n) => {
|
|
99
99
|
let s = /* @__PURE__ */ new Date(-1);
|
|
100
|
-
return `${
|
|
100
|
+
return `${n || ""}`.length === 0 ? "" : (typeof n == "string" && (s = new Date(n)), typeof n == "number" && (s = new Date(n)), n.toDateString && (s = n), s.getDate() === -1 ? r || "Invalid date" : a && s < a ? t || `Must be after ${a}` : i && s > i ? e || `Must be before ${i}` : "");
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
function m({
|
|
104
104
|
invalidTypeMsg: r,
|
|
105
105
|
minMsg: t,
|
|
106
106
|
maxMsg: e,
|
|
107
|
-
min:
|
|
107
|
+
min: a = -Number.MAX_VALUE,
|
|
108
108
|
max: i = Number.MAX_VALUE
|
|
109
109
|
} = {}) {
|
|
110
|
-
return (
|
|
110
|
+
return (n) => {
|
|
111
111
|
let s = Number.MAX_VALUE;
|
|
112
|
-
return `${
|
|
112
|
+
return `${n ?? ""}`.length === 0 ? "" : (typeof n == "string" && (s = parseFloat(n)), typeof n == "number" && (s = n), isNaN(s) ? r || "Must be a numeric value" : s > i ? e || `Must be less than or equal to ${i}` : s < a ? t || `Must be greater than or equal to ${a}` : "");
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
function C({
|
|
116
116
|
invalidTypeMsg: r,
|
|
117
117
|
minMsg: t,
|
|
118
118
|
maxMsg: e,
|
|
119
|
-
min:
|
|
119
|
+
min: a = -Number.MAX_VALUE,
|
|
120
120
|
max: i = Number.MAX_VALUE
|
|
121
121
|
}) {
|
|
122
|
-
return (
|
|
122
|
+
return (n) => `${n || ""}`.length === 0 ? "" : typeof n != "string" ? r || "Invalid type" : n.length > i ? e || `Must be less than ${i} characters` : n.length < a ? t || `Must be greater than ${a} characters` : "";
|
|
123
123
|
}
|
|
124
|
-
var
|
|
125
|
-
class
|
|
124
|
+
var l, S, A;
|
|
125
|
+
class U {
|
|
126
126
|
constructor(t) {
|
|
127
|
-
y(this,
|
|
127
|
+
y(this, l);
|
|
128
128
|
u(this, "state");
|
|
129
129
|
u(this, "_formData");
|
|
130
130
|
u(this, "_formRef");
|
|
@@ -149,40 +149,37 @@ class T {
|
|
|
149
149
|
}
|
|
150
150
|
// Public method to allow for the initialization of the state
|
|
151
151
|
initState(t, e) {
|
|
152
|
-
|
|
152
|
+
f(this._formRef, "external::init:state", t), e && setTimeout(e, 200);
|
|
153
153
|
}
|
|
154
154
|
updateListState(t) {
|
|
155
155
|
const e = t.detail;
|
|
156
156
|
Array.isArray(e.data) && (this.state = e.data);
|
|
157
157
|
}
|
|
158
158
|
updateObjectState(t) {
|
|
159
|
-
var
|
|
159
|
+
var a, i;
|
|
160
160
|
if (Array.isArray(this.state))
|
|
161
161
|
return;
|
|
162
162
|
const e = t.detail;
|
|
163
163
|
e.type === "list" ? this.state = {
|
|
164
164
|
...this.state,
|
|
165
|
-
form: { ...((
|
|
166
|
-
// currentFieldset: newState.currentFieldset,
|
|
167
|
-
// history: detail.data.,
|
|
165
|
+
form: { ...((a = this.state) == null ? void 0 : a.form) || {}, [e.id]: e.data }
|
|
168
166
|
} : this.state = {
|
|
169
167
|
...this.state,
|
|
170
168
|
form: { ...((i = this.state) == null ? void 0 : i.form) || {}, ...e.data.form },
|
|
171
|
-
// currentFieldset: newState.currentFieldset,
|
|
172
169
|
history: e.data.history
|
|
173
170
|
};
|
|
174
171
|
}
|
|
175
172
|
getStateList() {
|
|
176
173
|
return this.state ? Array.isArray(this.state) ? this.state.length === 0 ? [] : this.state.map((t) => Object.values(t.form).filter((e) => {
|
|
177
|
-
var
|
|
178
|
-
return ((
|
|
174
|
+
var a;
|
|
175
|
+
return ((a = e == null ? void 0 : e.data) == null ? void 0 : a.type) === "details";
|
|
179
176
|
}).map((e) => {
|
|
180
|
-
var
|
|
181
|
-
return e.data.type === "details" && ((
|
|
177
|
+
var a;
|
|
178
|
+
return e.data.type === "details" && ((a = e.data) == null ? void 0 : a.fieldsets) || {};
|
|
182
179
|
}).reduce(
|
|
183
|
-
(e,
|
|
184
|
-
for (const [i,
|
|
185
|
-
e[i] =
|
|
180
|
+
(e, a) => {
|
|
181
|
+
for (const [i, n] of Object.entries(a))
|
|
182
|
+
e[i] = n.value;
|
|
186
183
|
return e;
|
|
187
184
|
},
|
|
188
185
|
{}
|
|
@@ -202,63 +199,55 @@ class T {
|
|
|
202
199
|
// console.error("Utils:getStateItems: state has not yet been set");
|
|
203
200
|
// return [];
|
|
204
201
|
// }
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
//
|
|
208
|
-
//
|
|
209
|
-
// getStateValue(group: string, key: string): string {
|
|
210
|
-
// if (Array.isArray(this.state)) {
|
|
211
|
-
// console.error("getStateValue: unable to update the state of a multi form type");
|
|
212
|
-
// return "";
|
|
213
|
-
// }
|
|
214
|
-
// if (!this.state) {
|
|
215
|
-
// console.error("getStateValue: state has not yet been set");
|
|
216
|
-
// return "";
|
|
202
|
+
//
|
|
203
|
+
// const data = this.state.form[group].data;
|
|
204
|
+
// if (data.type !== "list") {
|
|
205
|
+
// return [];
|
|
217
206
|
// }
|
|
218
|
-
//
|
|
219
|
-
//
|
|
220
|
-
// return (data as Record<string, string>)[key]?.value ?? "";
|
|
207
|
+
//
|
|
208
|
+
// return data.items.;
|
|
221
209
|
// }
|
|
210
|
+
// Public method to allow for the retrieval of the state value
|
|
211
|
+
getStateValue(t, e) {
|
|
212
|
+
if (Array.isArray(this.state))
|
|
213
|
+
return console.error("getStateValue: unable to update the state of a multi form type"), "";
|
|
214
|
+
if (!this.state)
|
|
215
|
+
return console.error("getStateValue: state has not yet been set"), "";
|
|
216
|
+
const a = this.state.form[t].data;
|
|
217
|
+
return a.type !== "details" ? "" : a.fieldsets[e].value;
|
|
218
|
+
}
|
|
222
219
|
// Public method to allow for the continuing to the next page
|
|
223
220
|
continueTo(t) {
|
|
224
221
|
if (!t) {
|
|
225
222
|
console.error("continueTo [name] is undefined");
|
|
226
223
|
return;
|
|
227
224
|
}
|
|
228
|
-
|
|
229
|
-
type: this.type,
|
|
230
|
-
state: this.state,
|
|
231
|
-
formRef: this._formRef,
|
|
232
|
-
next: t
|
|
233
|
-
}), l(this._formRef, "external::continue", { next: t });
|
|
225
|
+
f(this._formRef, "external::continue", { next: t });
|
|
234
226
|
}
|
|
235
227
|
// Public method to perform validation and send the appropriate messages to the form elements
|
|
236
|
-
validate(t, e,
|
|
228
|
+
validate(t, e, a) {
|
|
237
229
|
var o;
|
|
238
|
-
const { el: i, state:
|
|
239
|
-
|
|
230
|
+
const { el: i, state: n } = e.detail, s = (o = n == null ? void 0 : n[t]) == null ? void 0 : o.value;
|
|
231
|
+
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
232
|
+
for (const d of a) {
|
|
240
233
|
const b = d(s);
|
|
241
|
-
if (g(this,
|
|
234
|
+
if (g(this, l, A).call(this, i, t, b), b)
|
|
242
235
|
return [!1, ""];
|
|
243
236
|
}
|
|
244
237
|
return [!0, s];
|
|
245
238
|
}
|
|
246
239
|
edit(t) {
|
|
247
|
-
|
|
240
|
+
f(this._formRef, "external::alter:state", { index: t, operation: "edit" });
|
|
248
241
|
}
|
|
249
242
|
remove(t) {
|
|
250
|
-
|
|
243
|
+
f(this._formRef, "external::alter:state", { index: t, operation: "remove" });
|
|
251
244
|
}
|
|
252
245
|
// removes any data collected that doesn't correspond with the final history path
|
|
253
|
-
clean() {
|
|
254
|
-
|
|
255
|
-
if (Array.isArray(this.state))
|
|
256
|
-
return;
|
|
257
|
-
const t = this.state;
|
|
258
|
-
return (e = this.state) == null ? void 0 : e.history.reduce((n, i) => (n[i] = t == null ? void 0 : t.form[i], n), {});
|
|
246
|
+
clean(t) {
|
|
247
|
+
return t.history.reduce((e, a) => (e[a] = t.form[a], e), {});
|
|
259
248
|
}
|
|
260
249
|
}
|
|
261
|
-
|
|
250
|
+
l = new WeakSet(), S = function(t) {
|
|
262
251
|
var e;
|
|
263
252
|
Array.isArray(t.data) && (Array.isArray(this.state) || (this.state = {
|
|
264
253
|
...this.state,
|
|
@@ -268,7 +257,7 @@ f = new WeakSet(), E = function(t) {
|
|
|
268
257
|
}
|
|
269
258
|
}));
|
|
270
259
|
}, // Private method to dispatch the error message to the form element
|
|
271
|
-
A = function(t, e,
|
|
260
|
+
A = function(t, e, a) {
|
|
272
261
|
t.dispatchEvent(
|
|
273
262
|
new CustomEvent("msg", {
|
|
274
263
|
composed: !0,
|
|
@@ -276,13 +265,13 @@ A = function(t, e, n) {
|
|
|
276
265
|
action: "external::set:error",
|
|
277
266
|
data: {
|
|
278
267
|
name: e,
|
|
279
|
-
msg:
|
|
268
|
+
msg: a
|
|
280
269
|
}
|
|
281
270
|
}
|
|
282
271
|
})
|
|
283
272
|
);
|
|
284
273
|
};
|
|
285
|
-
function
|
|
274
|
+
function q(r, t, e, a) {
|
|
286
275
|
if (!r) {
|
|
287
276
|
console.error("dispatch element is null");
|
|
288
277
|
return;
|
|
@@ -290,12 +279,12 @@ function U(r, t, e, n) {
|
|
|
290
279
|
r.dispatchEvent(
|
|
291
280
|
new CustomEvent(t, {
|
|
292
281
|
composed: !0,
|
|
293
|
-
bubbles:
|
|
282
|
+
bubbles: a == null ? void 0 : a.bubbles,
|
|
294
283
|
detail: e
|
|
295
284
|
})
|
|
296
285
|
);
|
|
297
286
|
}
|
|
298
|
-
function
|
|
287
|
+
function f(r, t, e, a) {
|
|
299
288
|
if (!r) {
|
|
300
289
|
console.error("dispatch element is null");
|
|
301
290
|
return;
|
|
@@ -303,7 +292,7 @@ function l(r, t, e, n) {
|
|
|
303
292
|
r.dispatchEvent(
|
|
304
293
|
new CustomEvent("msg", {
|
|
305
294
|
composed: !0,
|
|
306
|
-
bubbles:
|
|
295
|
+
bubbles: a == null ? void 0 : a.bubbles,
|
|
307
296
|
detail: {
|
|
308
297
|
action: t,
|
|
309
298
|
data: e
|
|
@@ -312,20 +301,20 @@ function l(r, t, e, n) {
|
|
|
312
301
|
);
|
|
313
302
|
}
|
|
314
303
|
export {
|
|
315
|
-
|
|
316
|
-
|
|
304
|
+
w as FormValidator,
|
|
305
|
+
U as PublicFormController,
|
|
317
306
|
x as SINValidator,
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
307
|
+
N as birthDayValidator,
|
|
308
|
+
_ as birthMonthValidator,
|
|
309
|
+
D as birthYearValidator,
|
|
321
310
|
L as dateValidator,
|
|
322
|
-
|
|
311
|
+
q as dispatch,
|
|
323
312
|
$ as emailValidator,
|
|
324
313
|
C as lengthValidator,
|
|
325
314
|
m as numericValidator,
|
|
326
|
-
|
|
315
|
+
R as phoneNumberValidator,
|
|
327
316
|
I as postalCodeValidator,
|
|
328
317
|
h as regexValidator,
|
|
329
|
-
|
|
318
|
+
f as relay,
|
|
330
319
|
c as requiredValidator
|
|
331
320
|
};
|
|
@@ -36,11 +36,12 @@ export declare class PublicFormController<T> {
|
|
|
36
36
|
updateListState(e: Event): void;
|
|
37
37
|
updateObjectState(e: Event): void;
|
|
38
38
|
getStateList(): Record<string, string>[];
|
|
39
|
+
getStateValue(group: string, key: string): string;
|
|
39
40
|
continueTo(next: T | undefined): void;
|
|
40
41
|
validate(field: string, e: Event, validators: FieldValidator[]): [boolean, string];
|
|
41
42
|
edit(index: number): void;
|
|
42
43
|
remove(index: number): void;
|
|
43
|
-
clean(): Record<string, unknown
|
|
44
|
+
clean(data: AppState<T>): Record<string, unknown>;
|
|
44
45
|
}
|
|
45
46
|
export declare function dispatch<T>(el: HTMLElement | Element | null | undefined, eventName: string, detail?: T, opts?: {
|
|
46
47
|
bubbles?: boolean;
|