@fkui/logic 5.45.1 → 6.0.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/lib/cjs/index.js +23 -75
- package/lib/esm/index.js +24 -68
- package/lib/types/index.d.ts +6 -68
- package/lib/types/tsdoc-metadata.json +1 -1
- package/package.json +2 -2
- package/lib/polyfills.js +0 -3
package/lib/cjs/index.js
CHANGED
|
@@ -41,19 +41,6 @@ function isString(value) {
|
|
|
41
41
|
return typeof value === "string" || value instanceof String;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
/**
|
|
45
|
-
* Matches a single whitespace globally.
|
|
46
|
-
*
|
|
47
|
-
* @public
|
|
48
|
-
* @deprecated Use {@link stripWhitespace} instead
|
|
49
|
-
*/
|
|
50
|
-
const WHITESPACE_PATTERN = /\s/g;
|
|
51
|
-
/**
|
|
52
|
-
* @public
|
|
53
|
-
* @deprecated Use {@link formatNumber} instead.
|
|
54
|
-
*/
|
|
55
|
-
const FORMAT_3_DIGITS_GROUPS = /\B(?=(\d{3})+(?!\d))/g;
|
|
56
|
-
|
|
57
44
|
/**
|
|
58
45
|
* Implementation of Object.fromEntries() until we run a recent enough version
|
|
59
46
|
* of NodeJS.
|
|
@@ -140,10 +127,6 @@ class DecoratedError extends Error {
|
|
|
140
127
|
}
|
|
141
128
|
}
|
|
142
129
|
|
|
143
|
-
/**
|
|
144
|
-
* @public
|
|
145
|
-
* @deprecated Use `FDate` instead.
|
|
146
|
-
*/
|
|
147
130
|
const DATE_REGEXP_WITH_DASH = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
|
|
148
131
|
/**
|
|
149
132
|
* @public
|
|
@@ -2143,16 +2126,13 @@ const TWELVE_HOURS = 12 * 60 * 60;
|
|
|
2143
2126
|
* @public
|
|
2144
2127
|
*/
|
|
2145
2128
|
function setCookie(options) {
|
|
2146
|
-
const
|
|
2129
|
+
const { name, value, keepAnyExistingCookie, timeLimitSeconds } = options;
|
|
2130
|
+
const shouldKeepTheExistingCookie = keepAnyExistingCookie && findCookie(name);
|
|
2147
2131
|
if (shouldKeepTheExistingCookie) {
|
|
2148
2132
|
return;
|
|
2149
2133
|
}
|
|
2150
|
-
let cookieString = `${options.name}=${encodeURIComponent(options.value)}; path=/;`;
|
|
2151
|
-
const timeLimitSeconds = options.timeLimitMillis
|
|
2152
|
-
? Math.round(options.timeLimitMillis / 1000)
|
|
2153
|
-
: options.timeLimitSeconds;
|
|
2154
2134
|
const timeout = timeLimitSeconds ?? TWELVE_HOURS;
|
|
2155
|
-
cookieString
|
|
2135
|
+
const cookieString = `${name}=${encodeURIComponent(value)}; path=/; max-age=${timeout};`;
|
|
2156
2136
|
document.cookie = cookieString;
|
|
2157
2137
|
}
|
|
2158
2138
|
/**
|
|
@@ -2254,7 +2234,7 @@ function requireDayjs_min () {
|
|
|
2254
2234
|
if (hasRequiredDayjs_min) return dayjs_min$1.exports;
|
|
2255
2235
|
hasRequiredDayjs_min = 1;
|
|
2256
2236
|
(function (module, exports) {
|
|
2257
|
-
!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return
|
|
2237
|
+
!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return undefined===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,true),this.parse(t),this.$x=this.$x||t.x||{},this[p]=true;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,false)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case "YY":return String(e.$y).slice(-2);case "YYYY":return b.s(e.$y,4,"0");case "M":return a+1;case "MM":return b.s(a+1,2,"0");case "MMM":return h(n.monthsShort,a,c,3);case "MMMM":return h(c,a);case "D":return e.$D;case "DD":return b.s(e.$D,2,"0");case "d":return String(e.$W);case "dd":return h(n.weekdaysMin,e.$W,o,2);case "ddd":return h(n.weekdaysShort,e.$W,o,3);case "dddd":return o[e.$W];case "H":return String(s);case "HH":return b.s(s,2,"0");case "h":return d(1);case "hh":return d(2);case "a":return $(s,u,true);case "A":return $(s,u,false);case "m":return String(u);case "mm":return b.s(u,2,"0");case "s":return String(e.$s);case "ss":return b.s(e.$s,2,"0");case "SSS":return b.s(e.$ms,3,"0");case "Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,true);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=true),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
2258
2238
|
} (dayjs_min$1));
|
|
2259
2239
|
return dayjs_min$1.exports;
|
|
2260
2240
|
}
|
|
@@ -2272,7 +2252,7 @@ function requireSv () {
|
|
|
2272
2252
|
if (hasRequiredSv) return sv$1.exports;
|
|
2273
2253
|
hasRequiredSv = 1;
|
|
2274
2254
|
(function (module, exports) {
|
|
2275
|
-
!function(e,t){module.exports=t(requireDayjs_min());}(sv,(function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=t(e),d={name:"sv",weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekStart:1,yearStart:4,ordinal:function(e){var t=e%10;return "["+e+(1===t||2===t?"a":"e")+"]"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"}};return a.default.locale(d,null
|
|
2255
|
+
!function(e,t){module.exports=t(requireDayjs_min());}(sv,(function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=t(e),d={name:"sv",weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekStart:1,yearStart:4,ordinal:function(e){var t=e%10;return "["+e+(1===t||2===t?"a":"e")+"]"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"}};return a.default.locale(d,null,true),d}));
|
|
2276
2256
|
} (sv$1));
|
|
2277
2257
|
return sv$1.exports;
|
|
2278
2258
|
}
|
|
@@ -2289,7 +2269,7 @@ function requireWeekOfYear () {
|
|
|
2289
2269
|
if (hasRequiredWeekOfYear) return weekOfYear$2.exports;
|
|
2290
2270
|
hasRequiredWeekOfYear = 1;
|
|
2291
2271
|
(function (module, exports) {
|
|
2292
|
-
!function(e,t){module.exports=t();}(weekOfYear$1,(function(){var e="week",t="year";return function(i,n,r){var f=n.prototype;f.week=function(i){if(
|
|
2272
|
+
!function(e,t){module.exports=t();}(weekOfYear$1,(function(){var e="week",t="year";return function(i,n,r){var f=n.prototype;f.week=function(i){if(undefined===i&&(i=null),null!==i)return this.add(7*(i-this.week()),"day");var n=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var f=r(this).startOf(t).add(1,t).date(n),s=r(this).endOf(e);if(f.isBefore(s))return 1}var a=r(this).startOf(t).date(n).startOf(e).subtract(1,"millisecond"),o=this.diff(a,e,true);return o<0?r(this).startOf("week").week():Math.ceil(o)},f.weeks=function(e){return undefined===e&&(e=null),this.week(e)};}}));
|
|
2293
2273
|
} (weekOfYear$2));
|
|
2294
2274
|
return weekOfYear$2.exports;
|
|
2295
2275
|
}
|
|
@@ -3523,7 +3503,7 @@ function handleTab(event, container) {
|
|
|
3523
3503
|
/**
|
|
3524
3504
|
* Check if element is of type radiobutton or checkbox
|
|
3525
3505
|
*
|
|
3526
|
-
* @
|
|
3506
|
+
* @internal
|
|
3527
3507
|
*/
|
|
3528
3508
|
function isRadiobuttonOrCheckbox(element) {
|
|
3529
3509
|
return (element instanceof HTMLInputElement &&
|
|
@@ -3892,17 +3872,14 @@ function getElementType(element) {
|
|
|
3892
3872
|
* @param element - Element to test
|
|
3893
3873
|
*/
|
|
3894
3874
|
function isValidatableHTMLElement(element) {
|
|
3875
|
+
if (element.classList.contains("card")) {
|
|
3876
|
+
return true;
|
|
3877
|
+
}
|
|
3895
3878
|
return (element instanceof HTMLInputElement ||
|
|
3896
3879
|
element instanceof HTMLTextAreaElement ||
|
|
3897
3880
|
element instanceof HTMLSelectElement ||
|
|
3898
3881
|
element instanceof HTMLFieldSetElement);
|
|
3899
3882
|
}
|
|
3900
|
-
/**
|
|
3901
|
-
* @internal
|
|
3902
|
-
*/
|
|
3903
|
-
function isFieldset(element) {
|
|
3904
|
-
return element instanceof HTMLFieldSetElement;
|
|
3905
|
-
}
|
|
3906
3883
|
function hasValidators(element) {
|
|
3907
3884
|
return typeof element.dataset.validation === "string";
|
|
3908
3885
|
}
|
|
@@ -3978,14 +3955,6 @@ class ValidationServiceImpl {
|
|
|
3978
3955
|
createFieldsetValidator(element, this);
|
|
3979
3956
|
}
|
|
3980
3957
|
this.setRequiredAttribute(element, validatorConfigs);
|
|
3981
|
-
// Deprecated: SFKUI-4412 personnummerValidator is deprecated. Replace with personnummerFormat and personnummerLuhn
|
|
3982
|
-
// Legacy compability tests cant be found here: @fkui/vue:src\components\FTextField\FTextField.cy.ts
|
|
3983
|
-
if (validatorConfigs["personnummer"] !== undefined) {
|
|
3984
|
-
const oldConfig = validatorConfigs["personnummer"];
|
|
3985
|
-
validatorConfigs["personnummerFormat"] = oldConfig;
|
|
3986
|
-
validatorConfigs["personnummerLuhn"] = oldConfig;
|
|
3987
|
-
delete validatorConfigs.personnummer;
|
|
3988
|
-
}
|
|
3989
3958
|
const foundValidators = this.getValidators(validatorConfigs);
|
|
3990
3959
|
// set data-validation attribute to indicate that validation is activated on the element
|
|
3991
3960
|
if (foundValidators.length > 0) {
|
|
@@ -4318,14 +4287,20 @@ class ValidationServiceImpl {
|
|
|
4318
4287
|
return this.hasValue(fieldsetInputElement);
|
|
4319
4288
|
});
|
|
4320
4289
|
}
|
|
4290
|
+
if (element instanceof HTMLDivElement) {
|
|
4291
|
+
return false;
|
|
4292
|
+
}
|
|
4321
4293
|
return Boolean(isRadiobuttonOrCheckbox(element)
|
|
4322
4294
|
? element.checked
|
|
4323
4295
|
: element.value);
|
|
4324
4296
|
}
|
|
4325
4297
|
getValue(element) {
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4298
|
+
if ("value" in element) {
|
|
4299
|
+
return element.value.trim();
|
|
4300
|
+
}
|
|
4301
|
+
else {
|
|
4302
|
+
return "";
|
|
4303
|
+
}
|
|
4329
4304
|
}
|
|
4330
4305
|
validateAll(element, validationState, validators, validatorConfigs) {
|
|
4331
4306
|
if (validationState.serverError) {
|
|
@@ -4335,7 +4310,7 @@ class ValidationServiceImpl {
|
|
|
4335
4310
|
};
|
|
4336
4311
|
}
|
|
4337
4312
|
/* if the element is disabled we always consider it to be valid */
|
|
4338
|
-
if (element.disabled) {
|
|
4313
|
+
if ("disabled" in element && element.disabled) {
|
|
4339
4314
|
return {
|
|
4340
4315
|
isValid: true,
|
|
4341
4316
|
validationMessage: "",
|
|
@@ -4396,7 +4371,9 @@ class ValidationServiceImpl {
|
|
|
4396
4371
|
detail: validityEvent,
|
|
4397
4372
|
});
|
|
4398
4373
|
for (const affectedElement of affectedElements) {
|
|
4399
|
-
affectedElement
|
|
4374
|
+
if ("setCustomValidity" in affectedElement) {
|
|
4375
|
+
affectedElement.setCustomValidity(validityEvent.validationMessage);
|
|
4376
|
+
}
|
|
4400
4377
|
affectedElement.setAttribute("aria-invalid", validField.toString());
|
|
4401
4378
|
}
|
|
4402
4379
|
element.dispatchEvent(event);
|
|
@@ -4885,16 +4862,6 @@ ValidationService.registerValidator(postalCodeValidator);
|
|
|
4885
4862
|
ValidationService.registerValidator(requiredValidator);
|
|
4886
4863
|
ValidationService.registerValidator(whitelistValidator);
|
|
4887
4864
|
|
|
4888
|
-
/**
|
|
4889
|
-
* This function does nothing and should not be used.
|
|
4890
|
-
*
|
|
4891
|
-
* @public
|
|
4892
|
-
* @deprecated This function does nothing.
|
|
4893
|
-
*/
|
|
4894
|
-
function applyValidationMessages() {
|
|
4895
|
-
/* do nothing */
|
|
4896
|
-
}
|
|
4897
|
-
|
|
4898
4865
|
class ElementIdServiceImpl {
|
|
4899
4866
|
elementIdMap = new Map();
|
|
4900
4867
|
generateElementId(prefix = "fkui") {
|
|
@@ -5037,17 +5004,6 @@ class SimplePersistenceService {
|
|
|
5037
5004
|
}
|
|
5038
5005
|
}
|
|
5039
5006
|
|
|
5040
|
-
/**
|
|
5041
|
-
* @public
|
|
5042
|
-
*/
|
|
5043
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- technical debt
|
|
5044
|
-
class Reference {
|
|
5045
|
-
ref = {};
|
|
5046
|
-
constructor(ref) {
|
|
5047
|
-
Object.assign(this.ref, ref);
|
|
5048
|
-
}
|
|
5049
|
-
}
|
|
5050
|
-
|
|
5051
5007
|
/**
|
|
5052
5008
|
* Default delay in milliseconds for {@link waitForScreenReader}
|
|
5053
5009
|
*
|
|
@@ -5153,24 +5109,18 @@ if (typeof document !== "undefined") {
|
|
|
5153
5109
|
createScreenReaderWrapper({ assertive: false });
|
|
5154
5110
|
}
|
|
5155
5111
|
|
|
5156
|
-
exports.DATE_REGEXP_WITH_DASH = DATE_REGEXP_WITH_DASH;
|
|
5157
5112
|
exports.DecoratedError = DecoratedError;
|
|
5158
5113
|
exports.DomUtils = index;
|
|
5159
5114
|
exports.ElementIdService = ElementIdService;
|
|
5160
|
-
exports.FORMAT_3_DIGITS_GROUPS = FORMAT_3_DIGITS_GROUPS;
|
|
5161
5115
|
exports.MissingValueError = MissingValueError;
|
|
5162
|
-
exports.POSTAL_CODE_REGEXP = POSTAL_CODE_REGEXP;
|
|
5163
5116
|
exports.PersistenceService = PersistenceService;
|
|
5164
|
-
exports.Reference = Reference;
|
|
5165
5117
|
exports.SCREEN_READER_DELAY = SCREEN_READER_DELAY;
|
|
5166
5118
|
exports.SimplePersistenceService = SimplePersistenceService;
|
|
5167
5119
|
exports.TranslationService = TranslationService;
|
|
5168
5120
|
exports.ValidationErrorMessageBuilder = ValidationErrorMessageBuilder;
|
|
5169
5121
|
exports.ValidationService = ValidationService;
|
|
5170
|
-
exports.WHITESPACE_PATTERN = WHITESPACE_PATTERN;
|
|
5171
5122
|
exports.addFocusListener = addFocusListener;
|
|
5172
5123
|
exports.alertScreenReader = alertScreenReader;
|
|
5173
|
-
exports.applyValidationMessages = applyValidationMessages;
|
|
5174
5124
|
exports.configLogic = configLogic;
|
|
5175
5125
|
exports.debounce = debounce;
|
|
5176
5126
|
exports.deepClone = deepClone;
|
|
@@ -5192,7 +5142,6 @@ exports.formatPostalCode = formatPostalCode;
|
|
|
5192
5142
|
exports.getErrorMessages = getErrorMessages;
|
|
5193
5143
|
exports.handleTab = handleTab;
|
|
5194
5144
|
exports.isEmpty = isEmpty;
|
|
5195
|
-
exports.isFieldset = isFieldset;
|
|
5196
5145
|
exports.isFocusable = isFocusable;
|
|
5197
5146
|
exports.isInvalidDatesConfig = isInvalidDatesConfig;
|
|
5198
5147
|
exports.isInvalidWeekdaysConfig = isInvalidWeekdaysConfig;
|
|
@@ -5200,7 +5149,6 @@ exports.isRadiobuttonOrCheckbox = isRadiobuttonOrCheckbox;
|
|
|
5200
5149
|
exports.isSet = isSet;
|
|
5201
5150
|
exports.isString = isString;
|
|
5202
5151
|
exports.isTabbable = isTabbable;
|
|
5203
|
-
exports.isValidDate = isValidDate;
|
|
5204
5152
|
exports.isValidatableFormElement = isValidatableFormElement;
|
|
5205
5153
|
exports.isValidatableHTMLElement = isValidatableHTMLElement;
|
|
5206
5154
|
exports.isVisible = isVisible;
|
package/lib/esm/index.js
CHANGED
|
@@ -39,19 +39,6 @@ function isString(value) {
|
|
|
39
39
|
return typeof value === "string" || value instanceof String;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
* Matches a single whitespace globally.
|
|
44
|
-
*
|
|
45
|
-
* @public
|
|
46
|
-
* @deprecated Use {@link stripWhitespace} instead
|
|
47
|
-
*/
|
|
48
|
-
const WHITESPACE_PATTERN = /\s/g;
|
|
49
|
-
/**
|
|
50
|
-
* @public
|
|
51
|
-
* @deprecated Use {@link formatNumber} instead.
|
|
52
|
-
*/
|
|
53
|
-
const FORMAT_3_DIGITS_GROUPS = /\B(?=(\d{3})+(?!\d))/g;
|
|
54
|
-
|
|
55
42
|
/**
|
|
56
43
|
* Implementation of Object.fromEntries() until we run a recent enough version
|
|
57
44
|
* of NodeJS.
|
|
@@ -138,10 +125,6 @@ class DecoratedError extends Error {
|
|
|
138
125
|
}
|
|
139
126
|
}
|
|
140
127
|
|
|
141
|
-
/**
|
|
142
|
-
* @public
|
|
143
|
-
* @deprecated Use `FDate` instead.
|
|
144
|
-
*/
|
|
145
128
|
const DATE_REGEXP_WITH_DASH = /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
|
|
146
129
|
/**
|
|
147
130
|
* @public
|
|
@@ -2141,16 +2124,13 @@ const TWELVE_HOURS = 12 * 60 * 60;
|
|
|
2141
2124
|
* @public
|
|
2142
2125
|
*/
|
|
2143
2126
|
function setCookie(options) {
|
|
2144
|
-
const
|
|
2127
|
+
const { name, value, keepAnyExistingCookie, timeLimitSeconds } = options;
|
|
2128
|
+
const shouldKeepTheExistingCookie = keepAnyExistingCookie && findCookie(name);
|
|
2145
2129
|
if (shouldKeepTheExistingCookie) {
|
|
2146
2130
|
return;
|
|
2147
2131
|
}
|
|
2148
|
-
let cookieString = `${options.name}=${encodeURIComponent(options.value)}; path=/;`;
|
|
2149
|
-
const timeLimitSeconds = options.timeLimitMillis
|
|
2150
|
-
? Math.round(options.timeLimitMillis / 1000)
|
|
2151
|
-
: options.timeLimitSeconds;
|
|
2152
2132
|
const timeout = timeLimitSeconds ?? TWELVE_HOURS;
|
|
2153
|
-
cookieString
|
|
2133
|
+
const cookieString = `${name}=${encodeURIComponent(value)}; path=/; max-age=${timeout};`;
|
|
2154
2134
|
document.cookie = cookieString;
|
|
2155
2135
|
}
|
|
2156
2136
|
/**
|
|
@@ -2252,7 +2232,7 @@ function requireDayjs_min () {
|
|
|
2252
2232
|
if (hasRequiredDayjs_min) return dayjs_min$1.exports;
|
|
2253
2233
|
hasRequiredDayjs_min = 1;
|
|
2254
2234
|
(function (module, exports) {
|
|
2255
|
-
!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return
|
|
2235
|
+
!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return undefined===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,true),this.parse(t),this.$x=this.$x||t.x||{},this[p]=true;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,false)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case "YY":return String(e.$y).slice(-2);case "YYYY":return b.s(e.$y,4,"0");case "M":return a+1;case "MM":return b.s(a+1,2,"0");case "MMM":return h(n.monthsShort,a,c,3);case "MMMM":return h(c,a);case "D":return e.$D;case "DD":return b.s(e.$D,2,"0");case "d":return String(e.$W);case "dd":return h(n.weekdaysMin,e.$W,o,2);case "ddd":return h(n.weekdaysShort,e.$W,o,3);case "dddd":return o[e.$W];case "H":return String(s);case "HH":return b.s(s,2,"0");case "h":return d(1);case "hh":return d(2);case "a":return $(s,u,true);case "A":return $(s,u,false);case "m":return String(u);case "mm":return b.s(u,2,"0");case "s":return String(e.$s);case "ss":return b.s(e.$s,2,"0");case "SSS":return b.s(e.$ms,3,"0");case "Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,true);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=true),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
2256
2236
|
} (dayjs_min$1));
|
|
2257
2237
|
return dayjs_min$1.exports;
|
|
2258
2238
|
}
|
|
@@ -2270,7 +2250,7 @@ function requireSv () {
|
|
|
2270
2250
|
if (hasRequiredSv) return sv$1.exports;
|
|
2271
2251
|
hasRequiredSv = 1;
|
|
2272
2252
|
(function (module, exports) {
|
|
2273
|
-
!function(e,t){module.exports=t(requireDayjs_min());}(sv,(function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=t(e),d={name:"sv",weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekStart:1,yearStart:4,ordinal:function(e){var t=e%10;return "["+e+(1===t||2===t?"a":"e")+"]"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"}};return a.default.locale(d,null
|
|
2253
|
+
!function(e,t){module.exports=t(requireDayjs_min());}(sv,(function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=t(e),d={name:"sv",weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekStart:1,yearStart:4,ordinal:function(e){var t=e%10;return "["+e+(1===t||2===t?"a":"e")+"]"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"}};return a.default.locale(d,null,true),d}));
|
|
2274
2254
|
} (sv$1));
|
|
2275
2255
|
return sv$1.exports;
|
|
2276
2256
|
}
|
|
@@ -2287,7 +2267,7 @@ function requireWeekOfYear () {
|
|
|
2287
2267
|
if (hasRequiredWeekOfYear) return weekOfYear$2.exports;
|
|
2288
2268
|
hasRequiredWeekOfYear = 1;
|
|
2289
2269
|
(function (module, exports) {
|
|
2290
|
-
!function(e,t){module.exports=t();}(weekOfYear$1,(function(){var e="week",t="year";return function(i,n,r){var f=n.prototype;f.week=function(i){if(
|
|
2270
|
+
!function(e,t){module.exports=t();}(weekOfYear$1,(function(){var e="week",t="year";return function(i,n,r){var f=n.prototype;f.week=function(i){if(undefined===i&&(i=null),null!==i)return this.add(7*(i-this.week()),"day");var n=this.$locale().yearStart||1;if(11===this.month()&&this.date()>25){var f=r(this).startOf(t).add(1,t).date(n),s=r(this).endOf(e);if(f.isBefore(s))return 1}var a=r(this).startOf(t).date(n).startOf(e).subtract(1,"millisecond"),o=this.diff(a,e,true);return o<0?r(this).startOf("week").week():Math.ceil(o)},f.weeks=function(e){return undefined===e&&(e=null),this.week(e)};}}));
|
|
2291
2271
|
} (weekOfYear$2));
|
|
2292
2272
|
return weekOfYear$2.exports;
|
|
2293
2273
|
}
|
|
@@ -3521,7 +3501,7 @@ function handleTab(event, container) {
|
|
|
3521
3501
|
/**
|
|
3522
3502
|
* Check if element is of type radiobutton or checkbox
|
|
3523
3503
|
*
|
|
3524
|
-
* @
|
|
3504
|
+
* @internal
|
|
3525
3505
|
*/
|
|
3526
3506
|
function isRadiobuttonOrCheckbox(element) {
|
|
3527
3507
|
return (element instanceof HTMLInputElement &&
|
|
@@ -3890,17 +3870,14 @@ function getElementType(element) {
|
|
|
3890
3870
|
* @param element - Element to test
|
|
3891
3871
|
*/
|
|
3892
3872
|
function isValidatableHTMLElement(element) {
|
|
3873
|
+
if (element.classList.contains("card")) {
|
|
3874
|
+
return true;
|
|
3875
|
+
}
|
|
3893
3876
|
return (element instanceof HTMLInputElement ||
|
|
3894
3877
|
element instanceof HTMLTextAreaElement ||
|
|
3895
3878
|
element instanceof HTMLSelectElement ||
|
|
3896
3879
|
element instanceof HTMLFieldSetElement);
|
|
3897
3880
|
}
|
|
3898
|
-
/**
|
|
3899
|
-
* @internal
|
|
3900
|
-
*/
|
|
3901
|
-
function isFieldset(element) {
|
|
3902
|
-
return element instanceof HTMLFieldSetElement;
|
|
3903
|
-
}
|
|
3904
3881
|
function hasValidators(element) {
|
|
3905
3882
|
return typeof element.dataset.validation === "string";
|
|
3906
3883
|
}
|
|
@@ -3976,14 +3953,6 @@ class ValidationServiceImpl {
|
|
|
3976
3953
|
createFieldsetValidator(element, this);
|
|
3977
3954
|
}
|
|
3978
3955
|
this.setRequiredAttribute(element, validatorConfigs);
|
|
3979
|
-
// Deprecated: SFKUI-4412 personnummerValidator is deprecated. Replace with personnummerFormat and personnummerLuhn
|
|
3980
|
-
// Legacy compability tests cant be found here: @fkui/vue:src\components\FTextField\FTextField.cy.ts
|
|
3981
|
-
if (validatorConfigs["personnummer"] !== undefined) {
|
|
3982
|
-
const oldConfig = validatorConfigs["personnummer"];
|
|
3983
|
-
validatorConfigs["personnummerFormat"] = oldConfig;
|
|
3984
|
-
validatorConfigs["personnummerLuhn"] = oldConfig;
|
|
3985
|
-
delete validatorConfigs.personnummer;
|
|
3986
|
-
}
|
|
3987
3956
|
const foundValidators = this.getValidators(validatorConfigs);
|
|
3988
3957
|
// set data-validation attribute to indicate that validation is activated on the element
|
|
3989
3958
|
if (foundValidators.length > 0) {
|
|
@@ -4316,14 +4285,20 @@ class ValidationServiceImpl {
|
|
|
4316
4285
|
return this.hasValue(fieldsetInputElement);
|
|
4317
4286
|
});
|
|
4318
4287
|
}
|
|
4288
|
+
if (element instanceof HTMLDivElement) {
|
|
4289
|
+
return false;
|
|
4290
|
+
}
|
|
4319
4291
|
return Boolean(isRadiobuttonOrCheckbox(element)
|
|
4320
4292
|
? element.checked
|
|
4321
4293
|
: element.value);
|
|
4322
4294
|
}
|
|
4323
4295
|
getValue(element) {
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4296
|
+
if ("value" in element) {
|
|
4297
|
+
return element.value.trim();
|
|
4298
|
+
}
|
|
4299
|
+
else {
|
|
4300
|
+
return "";
|
|
4301
|
+
}
|
|
4327
4302
|
}
|
|
4328
4303
|
validateAll(element, validationState, validators, validatorConfigs) {
|
|
4329
4304
|
if (validationState.serverError) {
|
|
@@ -4333,7 +4308,7 @@ class ValidationServiceImpl {
|
|
|
4333
4308
|
};
|
|
4334
4309
|
}
|
|
4335
4310
|
/* if the element is disabled we always consider it to be valid */
|
|
4336
|
-
if (element.disabled) {
|
|
4311
|
+
if ("disabled" in element && element.disabled) {
|
|
4337
4312
|
return {
|
|
4338
4313
|
isValid: true,
|
|
4339
4314
|
validationMessage: "",
|
|
@@ -4394,7 +4369,9 @@ class ValidationServiceImpl {
|
|
|
4394
4369
|
detail: validityEvent,
|
|
4395
4370
|
});
|
|
4396
4371
|
for (const affectedElement of affectedElements) {
|
|
4397
|
-
affectedElement
|
|
4372
|
+
if ("setCustomValidity" in affectedElement) {
|
|
4373
|
+
affectedElement.setCustomValidity(validityEvent.validationMessage);
|
|
4374
|
+
}
|
|
4398
4375
|
affectedElement.setAttribute("aria-invalid", validField.toString());
|
|
4399
4376
|
}
|
|
4400
4377
|
element.dispatchEvent(event);
|
|
@@ -4883,16 +4860,6 @@ ValidationService.registerValidator(postalCodeValidator);
|
|
|
4883
4860
|
ValidationService.registerValidator(requiredValidator);
|
|
4884
4861
|
ValidationService.registerValidator(whitelistValidator);
|
|
4885
4862
|
|
|
4886
|
-
/**
|
|
4887
|
-
* This function does nothing and should not be used.
|
|
4888
|
-
*
|
|
4889
|
-
* @public
|
|
4890
|
-
* @deprecated This function does nothing.
|
|
4891
|
-
*/
|
|
4892
|
-
function applyValidationMessages() {
|
|
4893
|
-
/* do nothing */
|
|
4894
|
-
}
|
|
4895
|
-
|
|
4896
4863
|
class ElementIdServiceImpl {
|
|
4897
4864
|
elementIdMap = new Map();
|
|
4898
4865
|
generateElementId(prefix = "fkui") {
|
|
@@ -5035,17 +5002,6 @@ class SimplePersistenceService {
|
|
|
5035
5002
|
}
|
|
5036
5003
|
}
|
|
5037
5004
|
|
|
5038
|
-
/**
|
|
5039
|
-
* @public
|
|
5040
|
-
*/
|
|
5041
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- technical debt
|
|
5042
|
-
class Reference {
|
|
5043
|
-
ref = {};
|
|
5044
|
-
constructor(ref) {
|
|
5045
|
-
Object.assign(this.ref, ref);
|
|
5046
|
-
}
|
|
5047
|
-
}
|
|
5048
|
-
|
|
5049
5005
|
/**
|
|
5050
5006
|
* Default delay in milliseconds for {@link waitForScreenReader}
|
|
5051
5007
|
*
|
|
@@ -5151,5 +5107,5 @@ if (typeof document !== "undefined") {
|
|
|
5151
5107
|
createScreenReaderWrapper({ assertive: false });
|
|
5152
5108
|
}
|
|
5153
5109
|
|
|
5154
|
-
export {
|
|
5110
|
+
export { DecoratedError, index as DomUtils, ElementIdService, MissingValueError, PersistenceService, SCREEN_READER_DELAY, SimplePersistenceService, TranslationService, ValidationErrorMessageBuilder, ValidationService, addFocusListener, alertScreenReader, configLogic, debounce, deepClone, deleteCookie, documentOrderComparator, ensureSet, findCookie, findTabbableElements, flatten, focus, focusFirst, focusLast, formatClearingNumberForBackend, formatNumber, formatPercent, formatPersonnummer, formatPersonnummerToDate, formatPostalCode, getErrorMessages, handleTab, isEmpty, isFocusable, isInvalidDatesConfig, isInvalidWeekdaysConfig, isRadiobuttonOrCheckbox, isSet, isString, isTabbable, isValidatableFormElement, isValidatableHTMLElement, isVisible, isVisibleInViewport, normalizeDateFormat, parseBankAccountNumber, parseBankgiro, parseClearingNumber, parseDate, parseNumber, parseOrganisationsnummer, parsePercent, parsePersonnummer, parsePersonnummerLuhn, parsePlusgiro, parsePostalCode, popFocus, pushFocus, removeFocusListener, restoreFocus, saveFocus, scrollTo, setCookie, stripNull, stripWhitespace, testLuhnChecksum, validChecksum, validLimit, waitForScreenReader };
|
|
5155
5111
|
//# sourceMappingURL=index.js.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -35,14 +35,6 @@ export declare interface AllowListValidatorConfig extends ValidatorOptions {
|
|
|
35
35
|
list: string[];
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/**
|
|
39
|
-
* This function does nothing and should not be used.
|
|
40
|
-
*
|
|
41
|
-
* @public
|
|
42
|
-
* @deprecated This function does nothing.
|
|
43
|
-
*/
|
|
44
|
-
export declare function applyValidationMessages(): void;
|
|
45
|
-
|
|
46
38
|
/**
|
|
47
39
|
* A string with 3-16 digits, for example "0123456789"
|
|
48
40
|
*
|
|
@@ -80,33 +72,13 @@ export declare const configLogic: FKUIConfigLogic;
|
|
|
80
72
|
/**
|
|
81
73
|
* @public
|
|
82
74
|
*/
|
|
83
|
-
export declare
|
|
84
|
-
/**
|
|
85
|
-
* @deprecated Use timeLimitSeconds instead. Will be rounded to nearest second.
|
|
86
|
-
*/
|
|
87
|
-
timeLimitMillis?: number;
|
|
88
|
-
timeLimitSeconds?: never;
|
|
89
|
-
} | {
|
|
90
|
-
timeLimitMillis?: never;
|
|
91
|
-
timeLimitSeconds?: number;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @public
|
|
96
|
-
*/
|
|
97
|
-
export declare type CookieOptions = {
|
|
75
|
+
export declare interface CookieOptions {
|
|
98
76
|
name: string;
|
|
99
77
|
value: string;
|
|
100
78
|
keepAnyExistingCookie?: boolean;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
* @public
|
|
105
|
-
* @deprecated Use `FDate` instead.
|
|
106
|
-
*/
|
|
107
|
-
export declare const DATE_REGEXP_WITH_DASH: RegExp;
|
|
108
|
-
|
|
109
|
-
/* Excluded from this release type: DateFormat */
|
|
79
|
+
/** `max-age` parameter, default: 12h */
|
|
80
|
+
timeLimitSeconds?: number;
|
|
81
|
+
}
|
|
110
82
|
|
|
111
83
|
/**
|
|
112
84
|
* A string in format YYYY-MM-DD, for example 2021-02-03
|
|
@@ -242,7 +214,6 @@ declare namespace DomUtils {
|
|
|
242
214
|
pushFocus,
|
|
243
215
|
StackHandle,
|
|
244
216
|
handleTab,
|
|
245
|
-
isRadiobuttonOrCheckbox,
|
|
246
217
|
isValidatableFormElement,
|
|
247
218
|
isVisible,
|
|
248
219
|
isVisibleInViewport,
|
|
@@ -414,12 +385,6 @@ export declare interface EmailValidatorConfig extends ValidatorOptions {
|
|
|
414
385
|
}
|
|
415
386
|
export { FocusOptions_2 as FocusOptions }
|
|
416
387
|
|
|
417
|
-
/**
|
|
418
|
-
* @public
|
|
419
|
-
* @deprecated Use {@link formatNumber} instead.
|
|
420
|
-
*/
|
|
421
|
-
export declare const FORMAT_3_DIGITS_GROUPS: RegExp;
|
|
422
|
-
|
|
423
388
|
/**
|
|
424
389
|
* @public
|
|
425
390
|
*/
|
|
@@ -498,8 +463,6 @@ export declare interface EmailValidatorConfig extends ValidatorOptions {
|
|
|
498
463
|
*/
|
|
499
464
|
export declare function isEmpty(value: string | undefined | null): value is "" | undefined | null;
|
|
500
465
|
|
|
501
|
-
/* Excluded from this release type: isFieldset */
|
|
502
|
-
|
|
503
466
|
/**
|
|
504
467
|
* Check if an element is focusable (visible and either interactive or with
|
|
505
468
|
* tabindex). This includes programatically focusable elements.
|
|
@@ -520,12 +483,7 @@ export declare interface EmailValidatorConfig extends ValidatorOptions {
|
|
|
520
483
|
*/
|
|
521
484
|
export declare function isInvalidWeekdaysConfig(value: Partial<InvalidWeekdaysValidatorConfig>): value is InvalidWeekdaysValidatorConfig;
|
|
522
485
|
|
|
523
|
-
|
|
524
|
-
* Check if element is of type radiobutton or checkbox
|
|
525
|
-
*
|
|
526
|
-
* @public
|
|
527
|
-
*/
|
|
528
|
-
export declare function isRadiobuttonOrCheckbox(element: Element): element is HTMLInputElement;
|
|
486
|
+
/* Excluded from this release type: isRadiobuttonOrCheckbox */
|
|
529
487
|
|
|
530
488
|
/**
|
|
531
489
|
* Determine if a value is set. If it is undefined or null, this function
|
|
@@ -574,8 +532,6 @@ export declare interface EmailValidatorConfig extends ValidatorOptions {
|
|
|
574
532
|
*/
|
|
575
533
|
export declare function isValidatableHTMLElement(element: Element): element is ValidatableHTMLElement;
|
|
576
534
|
|
|
577
|
-
/* Excluded from this release type: isValidDate */
|
|
578
|
-
|
|
579
535
|
/**
|
|
580
536
|
* Check if an element is visible in the dom
|
|
581
537
|
*
|
|
@@ -774,8 +730,6 @@ export declare interface EmailValidatorConfig extends ValidatorOptions {
|
|
|
774
730
|
*/
|
|
775
731
|
export declare function popFocus(handle: StackHandle): void;
|
|
776
732
|
|
|
777
|
-
/* Excluded from this release type: POSTAL_CODE_REGEXP */
|
|
778
|
-
|
|
779
733
|
/**
|
|
780
734
|
* A 5-digit string with space separator, for example "932 22"
|
|
781
735
|
*
|
|
@@ -791,14 +745,6 @@ export declare interface EmailValidatorConfig extends ValidatorOptions {
|
|
|
791
745
|
*/
|
|
792
746
|
export declare function pushFocus(element?: Element | null): StackHandle;
|
|
793
747
|
|
|
794
|
-
/**
|
|
795
|
-
* @public
|
|
796
|
-
*/
|
|
797
|
-
export declare class Reference<T extends Record<string, any>> {
|
|
798
|
-
readonly ref: T;
|
|
799
|
-
constructor(ref: T);
|
|
800
|
-
}
|
|
801
|
-
|
|
802
748
|
/**
|
|
803
749
|
* Remove listener for each item in the list of elements
|
|
804
750
|
*
|
|
@@ -965,7 +911,7 @@ export declare interface EmailValidatorConfig extends ValidatorOptions {
|
|
|
965
911
|
/**
|
|
966
912
|
* @public
|
|
967
913
|
*/
|
|
968
|
-
export declare type ValidatableHTMLElement = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLFieldSetElement;
|
|
914
|
+
export declare type ValidatableHTMLElement = HTMLDivElement | HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLFieldSetElement;
|
|
969
915
|
|
|
970
916
|
/**
|
|
971
917
|
* Event used to trigger validation.
|
|
@@ -1333,12 +1279,4 @@ export declare interface EmailValidatorConfig extends ValidatorOptions {
|
|
|
1333
1279
|
*/
|
|
1334
1280
|
export declare function waitForScreenReader<TReturn = void>(callback: () => TReturn, delay?: number): Promise<TReturn>;
|
|
1335
1281
|
|
|
1336
|
-
/**
|
|
1337
|
-
* Matches a single whitespace globally.
|
|
1338
|
-
*
|
|
1339
|
-
* @public
|
|
1340
|
-
* @deprecated Use {@link stripWhitespace} instead
|
|
1341
|
-
*/
|
|
1342
|
-
export declare const WHITESPACE_PATTERN: RegExp;
|
|
1343
|
-
|
|
1344
1282
|
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fkui/logic",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Logic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fkui",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"node": ">= 20",
|
|
68
68
|
"npm": ">= 7"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "490180f46c605ebe3e05fa183a2fa718adb896af"
|
|
71
71
|
}
|
package/lib/polyfills.js
DELETED