ku4web-components 6.7.2 → 6.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,7 +32,13 @@ const Ku4Form = class {
32
32
  this.valid = this.isValid;
33
33
  this.invalid = !this.isValid;
34
34
  await index$2.Y(100)
35
- .then(() => this.host.querySelectorAll('ku4-validation[invalid]'))
35
+ .then(() => {
36
+ const children = [].slice.call(this.form.querySelectorAll('ku4-validation[invalid]'));
37
+ const attributed = [].slice.call(document.querySelectorAll(`[form="${this.form.id}"]`));
38
+ const formValidations = attributed.map(a => document.querySelector(`ku4-validation[invalid][for="${a.id}"]`));
39
+ const externalValidations = [].slice.call(document.querySelectorAll(`ku4-validation[invalid][form="${this.form.id}"]`));
40
+ return index$2.o(children.concat(formValidations).concat(externalValidations).filter(v => index$2.t.exists(v)));
41
+ })
36
42
  .then(invalid => this.didValidate.emit({ invalid }));
37
43
  return this.isValid;
38
44
  }
@@ -97,7 +103,11 @@ const Ku4Form = class {
97
103
  return this.host.querySelector('form');
98
104
  }
99
105
  get fields() {
100
- return [].slice.call(this.form.querySelectorAll('ku4-validation'));
106
+ const children = [].slice.call(this.form.querySelectorAll('ku4-validation'));
107
+ const attributed = [].slice.call(document.querySelectorAll(`[form="${this.form.id}"]`));
108
+ const formValidations = attributed.map(a => document.querySelector(`ku4-validation[for="${a.id}"]`));
109
+ const externalValidations = [].slice.call(document.querySelectorAll(`ku4-validation[form="${this.form.id}"]`));
110
+ return index$2.o(children.concat(formValidations).concat(externalValidations).filter(v => index$2.t.exists(v)));
101
111
  }
102
112
  handleReset() {
103
113
  this.isValid = true;
@@ -50,11 +50,15 @@ const Ku4Validation = class {
50
50
  * A reference to a named function or a function body that
51
51
  * define a validation criteria and return `true` when the
52
52
  * defined validation criteria are satisfied.
53
- * The function will be called with one argument, `value`,
54
- * that will contain the current value of the target field.
55
- * Example: method="return value === 'valid'", or
56
- * function validate(value) { return value === 'valid'; }
57
- * method="validate(value)"
53
+ * The function will be called with two arguments: `value`, `values`,
54
+ * that will contain the current "value" of the target field, and
55
+ * the current "values" of the entire form as an object whose
56
+ * keys are the names of each fields and whose values are the value
57
+ * of each of these fields having name "key".
58
+ * Example (html): method="return value === 'valid' && values.key === 'valid'", or
59
+ * function validate(value, values) { return value === 'valid' && values.key === 'valid'; }
60
+ * method="validate(value, values)".
61
+ * Example (Vue3): .method="validate"
58
62
  */
59
63
  this.method = '';
60
64
  const patterns = this.pattern.split(' ');
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h, g as getElement } from './index-21724a14.js';
2
- import { Y, t } from './index-4dba724d.js';
2
+ import { Y, o, t } from './index-4dba724d.js';
3
3
  import { i as index } from './index-bb8d5d62.js';
4
4
 
5
5
  const Ku4Form = class {
@@ -28,7 +28,13 @@ const Ku4Form = class {
28
28
  this.valid = this.isValid;
29
29
  this.invalid = !this.isValid;
30
30
  await Y(100)
31
- .then(() => this.host.querySelectorAll('ku4-validation[invalid]'))
31
+ .then(() => {
32
+ const children = [].slice.call(this.form.querySelectorAll('ku4-validation[invalid]'));
33
+ const attributed = [].slice.call(document.querySelectorAll(`[form="${this.form.id}"]`));
34
+ const formValidations = attributed.map(a => document.querySelector(`ku4-validation[invalid][for="${a.id}"]`));
35
+ const externalValidations = [].slice.call(document.querySelectorAll(`ku4-validation[invalid][form="${this.form.id}"]`));
36
+ return o(children.concat(formValidations).concat(externalValidations).filter(v => t.exists(v)));
37
+ })
32
38
  .then(invalid => this.didValidate.emit({ invalid }));
33
39
  return this.isValid;
34
40
  }
@@ -93,7 +99,11 @@ const Ku4Form = class {
93
99
  return this.host.querySelector('form');
94
100
  }
95
101
  get fields() {
96
- return [].slice.call(this.form.querySelectorAll('ku4-validation'));
102
+ const children = [].slice.call(this.form.querySelectorAll('ku4-validation'));
103
+ const attributed = [].slice.call(document.querySelectorAll(`[form="${this.form.id}"]`));
104
+ const formValidations = attributed.map(a => document.querySelector(`ku4-validation[for="${a.id}"]`));
105
+ const externalValidations = [].slice.call(document.querySelectorAll(`ku4-validation[form="${this.form.id}"]`));
106
+ return o(children.concat(formValidations).concat(externalValidations).filter(v => t.exists(v)));
97
107
  }
98
108
  handleReset() {
99
109
  this.isValid = true;
@@ -46,11 +46,15 @@ const Ku4Validation = class {
46
46
  * A reference to a named function or a function body that
47
47
  * define a validation criteria and return `true` when the
48
48
  * defined validation criteria are satisfied.
49
- * The function will be called with one argument, `value`,
50
- * that will contain the current value of the target field.
51
- * Example: method="return value === 'valid'", or
52
- * function validate(value) { return value === 'valid'; }
53
- * method="validate(value)"
49
+ * The function will be called with two arguments: `value`, `values`,
50
+ * that will contain the current "value" of the target field, and
51
+ * the current "values" of the entire form as an object whose
52
+ * keys are the names of each fields and whose values are the value
53
+ * of each of these fields having name "key".
54
+ * Example (html): method="return value === 'valid' && values.key === 'valid'", or
55
+ * function validate(value, values) { return value === 'valid' && values.key === 'valid'; }
56
+ * method="validate(value, values)".
57
+ * Example (Vue3): .method="validate"
54
58
  */
55
59
  this.method = '';
56
60
  const patterns = this.pattern.split(' ');
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(e){o(e)}}function s(t){try{u(n["throw"](t))}catch(e){o(e)}}function u(t){t.done?i(t.value):r(t.value).then(a,s)}u((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return u([t,e])}}function u(a){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(s){a=[6,s];r=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-21724a14.js";import{Y,t}from"./index-4dba724d.js";import{i as index}from"./index-bb8d5d62.js";var Ku4Form=function(){function e(t){registerInstance(this,t);this.didValidate=createEvent(this,"validate",7);this.validate=this.validate.bind(this);this.handleReset=this.handleReset.bind(this)}e.prototype.listFieldNames=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,index.readFieldNames(this.form)]}))}))};e.prototype.validate=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,i;var n=this;return __generator(this,(function(r){switch(r.label){case 0:t=this.fields;e=t.map((function(t){return t.validate()}));i=this;return[4,Promise.all(e).then((function(t){return!t.some((function(t){return t===false}))}))];case 1:i.isValid=r.sent();this.valid=this.isValid;this.invalid=!this.isValid;return[4,Y(100).then((function(){return n.host.querySelectorAll("ku4-validation[invalid]")})).then((function(t){return n.didValidate.emit({invalid:t})}))];case 2:r.sent();return[2,this.isValid]}}))}))};e.prototype.invalidate=function(e){return __awaiter(this,void 0,void 0,(function(){var i;var n=this;return __generator(this,(function(r){if(t.isArray(e)){e.forEach((function(t){var e=n.fields.find((function(e){return e.for===t}));if(e){e.invalid=true}}))}else{i=this.fields.find((function(t){return t.for===e}));if(i){i.invalid=true}}this.isValid=false;this.valid=this.isValid;this.invalid=!this.isValid;return[2,this]}))}))};e.prototype.read=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,index.read(this.form)]}))}))};e.prototype.write=function(t){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(i){index.write(this.form,t);Object.keys(t).forEach((function(t){try{e.form.querySelector('[name="'.concat(t,'"]')).dispatchEvent(new window.Event("change"))}catch(i){}}));return[2,this]}))}))};e.prototype.focusFirstInvalid=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){Y(100).then((function(){var e=document.querySelector("ku4-valiation[invalid]");if(t.exists(e)){e.scrollIntoView({behavior:"smooth",block:"center"})}}));return[2]}))}))};Object.defineProperty(e.prototype,"form",{get:function(){return this.host.querySelector("form")},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"fields",{get:function(){return[].slice.call(this.form.querySelectorAll("ku4-validation"))},enumerable:false,configurable:true});e.prototype.handleReset=function(){this.isValid=true;this.valid=this.isValid;this.invalid=!this.isValid};e.prototype.componentWillLoad=function(){var e=this;var i=this.form;if(t.exists(i)){var n=i.onsubmit||function(){};i.onsubmit=function(r){r.preventDefault();e.validate().then((function(t){return t&&n.call(i,r)})).then((function(e){return!t.isFalse(e)&&i.submit()}));return false};i.addEventListener("reset",this.handleReset);this.fields.forEach((function(t){return t.addEventListener("validated",e.validate)}))}};e.prototype.disconnectedCallback=function(){var e=this;var i=this.form;if(t.exists(i)){i.removeEventListener("reset",this.handleReset);this.fields.forEach((function(t){return t.removeEventListener("validated",e.validate)}))}};e.prototype.render=function(){return h("slot",null)};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();export{Ku4Form as ku4_form};
1
+ var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(e){o(e)}}function s(t){try{u(n["throw"](t))}catch(e){o(e)}}function u(t){t.done?i(t.value):r(t.value).then(a,s)}u((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return u([t,e])}}function u(a){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(s){a=[6,s];r=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-21724a14.js";import{Y,o,t}from"./index-4dba724d.js";import{i as index}from"./index-bb8d5d62.js";var Ku4Form=function(){function e(t){registerInstance(this,t);this.didValidate=createEvent(this,"validate",7);this.validate=this.validate.bind(this);this.handleReset=this.handleReset.bind(this)}e.prototype.listFieldNames=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,index.readFieldNames(this.form)]}))}))};e.prototype.validate=function(){return __awaiter(this,void 0,void 0,(function(){var e,i,n;var r=this;return __generator(this,(function(a){switch(a.label){case 0:e=this.fields;i=e.map((function(t){return t.validate()}));n=this;return[4,Promise.all(i).then((function(t){return!t.some((function(t){return t===false}))}))];case 1:n.isValid=a.sent();this.valid=this.isValid;this.invalid=!this.isValid;return[4,Y(100).then((function(){var e=[].slice.call(r.form.querySelectorAll("ku4-validation[invalid]"));var i=[].slice.call(document.querySelectorAll('[form="'.concat(r.form.id,'"]')));var n=i.map((function(t){return document.querySelector('ku4-validation[invalid][for="'.concat(t.id,'"]'))}));var a=[].slice.call(document.querySelectorAll('ku4-validation[invalid][form="'.concat(r.form.id,'"]')));return o(e.concat(n).concat(a).filter((function(e){return t.exists(e)})))})).then((function(t){return r.didValidate.emit({invalid:t})}))];case 2:a.sent();return[2,this.isValid]}}))}))};e.prototype.invalidate=function(e){return __awaiter(this,void 0,void 0,(function(){var i;var n=this;return __generator(this,(function(r){if(t.isArray(e)){e.forEach((function(t){var e=n.fields.find((function(e){return e.for===t}));if(e){e.invalid=true}}))}else{i=this.fields.find((function(t){return t.for===e}));if(i){i.invalid=true}}this.isValid=false;this.valid=this.isValid;this.invalid=!this.isValid;return[2,this]}))}))};e.prototype.read=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,index.read(this.form)]}))}))};e.prototype.write=function(t){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(i){index.write(this.form,t);Object.keys(t).forEach((function(t){try{e.form.querySelector('[name="'.concat(t,'"]')).dispatchEvent(new window.Event("change"))}catch(i){}}));return[2,this]}))}))};e.prototype.focusFirstInvalid=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){Y(100).then((function(){var e=document.querySelector("ku4-valiation[invalid]");if(t.exists(e)){e.scrollIntoView({behavior:"smooth",block:"center"})}}));return[2]}))}))};Object.defineProperty(e.prototype,"form",{get:function(){return this.host.querySelector("form")},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"fields",{get:function(){var e=[].slice.call(this.form.querySelectorAll("ku4-validation"));var i=[].slice.call(document.querySelectorAll('[form="'.concat(this.form.id,'"]')));var n=i.map((function(t){return document.querySelector('ku4-validation[for="'.concat(t.id,'"]'))}));var r=[].slice.call(document.querySelectorAll('ku4-validation[form="'.concat(this.form.id,'"]')));return o(e.concat(n).concat(r).filter((function(e){return t.exists(e)})))},enumerable:false,configurable:true});e.prototype.handleReset=function(){this.isValid=true;this.valid=this.isValid;this.invalid=!this.isValid};e.prototype.componentWillLoad=function(){var e=this;var i=this.form;if(t.exists(i)){var n=i.onsubmit||function(){};i.onsubmit=function(r){r.preventDefault();e.validate().then((function(t){return t&&n.call(i,r)})).then((function(e){return!t.isFalse(e)&&i.submit()}));return false};i.addEventListener("reset",this.handleReset);this.fields.forEach((function(t){return t.addEventListener("validated",e.validate)}))}};e.prototype.disconnectedCallback=function(){var e=this;var i=this.form;if(t.exists(i)){i.removeEventListener("reset",this.handleReset);this.fields.forEach((function(t){return t.removeEventListener("validated",e.validate)}))}};e.prototype.render=function(){return h("slot",null)};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();export{Ku4Form as ku4_form};
@@ -1 +1 @@
1
- import{d as e,N as t,w as s,p as a,b as o}from"./p-0943c493.js";(()=>{const o=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t)),l={};return"onbeforeload"in o&&!history.scrollRestoration?{then(){}}:(l.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,s.location.href)).href,a(l))})().then((e=>o([["p-5acd5997",[[1,"ku4-carousel",{swipeTolerance:[2,"swipe-tolerance"],auto:[4],noSwipe:[4,"no-swipe"],delay:[2],slideState:[32],next:[64],previous:[64],slideTo:[64],pause:[64],play:[64]}]]],["p-9d027a50",[[1,"ku4-carousel-controls",{for:[1]}]]],["p-f33f1619",[[1,"ku4-carousel-slide",{name:[1544],active:[32],classList:[32],slideIn:[64],slideOut:[64],activate:[64],deactivate:[64]}]]],["p-a4cd5761",[[1,"ku4-col",{startXs:[2,"start-xs"],startSm:[2,"start-sm"],startMd:[2,"start-md"],startLg:[2,"start-lg"],spanXs:[2,"span-xs"],spanSm:[2,"span-sm"],spanMd:[2,"span-md"],spanLg:[2,"span-lg"],orderXs:[2,"order-xs"],orderSm:[2,"order-sm"],orderMd:[2,"order-md"],orderLg:[2,"order-lg"]}]]],["p-2f4a16d7",[[1,"ku4-drawer",{bottom:[516],left:[516],right:[516],top:[516],size:[1],open:[1540],toggle:[64]}]]],["p-c305fd7d",[[1,"ku4-feature",{on:[4],policy:[1],enabled:[32]}]]],["p-3742c929",[[1,"ku4-focus-trap",{active:[1540],include:[1],exclude:[1],excludeShadow:[1,"exclude-shadow"],initial:[1],return:[1],activate:[64],deactivate:[64]}]]],["p-20a7e124",[[4,"ku4-form",{valid:[1028],invalid:[1540],listFieldNames:[64],validate:[64],invalidate:[64],read:[64],write:[64],focusFirstInvalid:[64]}]]],["p-0669a534",[[1,"ku4-grid",{columnsXs:[2,"columns-xs"],columnsSm:[2,"columns-sm"],columnsMd:[2,"columns-md"],columnsLg:[2,"columns-lg"],offsetLeftXs:[2,"offset-left-xs"],offsetLeftSm:[2,"offset-left-sm"],offsetLeftMd:[2,"offset-left-md"],offsetLeftLg:[2,"offset-left-lg"],offsetRight:[2,"offset-right"],offsetRightXs:[2,"offset-right-xs"],offsetRightSm:[2,"offset-right-sm"],offsetRightMd:[2,"offset-right-md"],offsetRightLg:[2,"offset-right-lg"],offsetXs:[2,"offset-xs"],offsetSm:[2,"offset-sm"],offsetMd:[2,"offset-md"],offsetLg:[2,"offset-lg"]}]]],["p-3d59749e",[[1,"ku4-label",{for:[1],value:[1],empty:[32]}]]],["p-d9a5870c",[[1,"ku4-mask",{for:[1],template:[1],ban:[1],pattern:[1],char:[1],hidden:[4]}]]],["p-d1b4d5dc",[[1,"ku4-modal",{visible:[1540],dismissable:[4],dismissible:[4],focusTrap:[1,"focus-trap"],display:[64],dismiss:[64]},[[8,"keyup","handleKeyUp"]]]]],["p-996461ba",[[1,"ku4-panel",{open:[1540],maxHeight:[32],toggle:[64],close:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-332a5a54",[[1,"ku4-preview",{for:[1],src:[1],altsrc:[1],orientation:[2],resolutionX:[2,"resolution-x"],resolutionY:[2,"resolution-y"],capture:[1],status:[1537],alt:[1],currentSrc:[32],read:[64]}]]],["p-bb380a04",[[1,"ku4-tab",{selected:[1540],panel:[32],select:[64],deselect:[64],connect:[64]},[[0,"click","handleClick"],[0,"keyup","handleKeyUp"]]]]],["p-5119224c",[[1,"ku4-tab-list",{open:[64]},[[0,"ku4TabClick","handleTabClick"],[0,"ku4TabKeyup","handleTabKeyUp"]]]]],["p-56f61856",[[1,"ku4-tab-panel",{selected:[1540],maxHeight:[32],tab:[32],select:[64],deselect:[64],connect:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-6f6a8c8d",[[4,"ku4-table",{stackXs:[1537,"stack-xs"],stackSm:[1537,"stack-sm"]}]]],["p-7875dc99",[[1,"ku4-tooltip",{element:[1],top:[4],left:[4],bottom:[4],right:[4],debug:[4],show:[64],hide:[64]}]]],["p-f23287da",[[1,"ku4-validation",{for:[513],element:[513],pattern:[1],flags:[1],values:[1],checked:[4],method:[1],invalid:[1540],disabled:[1540],hidden:[1540],isValid:[32],validate:[64]}]]]],e)));
1
+ import{d as e,N as t,w as s,p as a,b as o}from"./p-0943c493.js";(()=>{const o=Array.from(e.querySelectorAll("script")).find((e=>new RegExp(`/${t}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===t)),l={};return"onbeforeload"in o&&!history.scrollRestoration?{then(){}}:(l.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,s.location.href)).href,a(l))})().then((e=>o([["p-5acd5997",[[1,"ku4-carousel",{swipeTolerance:[2,"swipe-tolerance"],auto:[4],noSwipe:[4,"no-swipe"],delay:[2],slideState:[32],next:[64],previous:[64],slideTo:[64],pause:[64],play:[64]}]]],["p-9d027a50",[[1,"ku4-carousel-controls",{for:[1]}]]],["p-f33f1619",[[1,"ku4-carousel-slide",{name:[1544],active:[32],classList:[32],slideIn:[64],slideOut:[64],activate:[64],deactivate:[64]}]]],["p-a4cd5761",[[1,"ku4-col",{startXs:[2,"start-xs"],startSm:[2,"start-sm"],startMd:[2,"start-md"],startLg:[2,"start-lg"],spanXs:[2,"span-xs"],spanSm:[2,"span-sm"],spanMd:[2,"span-md"],spanLg:[2,"span-lg"],orderXs:[2,"order-xs"],orderSm:[2,"order-sm"],orderMd:[2,"order-md"],orderLg:[2,"order-lg"]}]]],["p-2f4a16d7",[[1,"ku4-drawer",{bottom:[516],left:[516],right:[516],top:[516],size:[1],open:[1540],toggle:[64]}]]],["p-c305fd7d",[[1,"ku4-feature",{on:[4],policy:[1],enabled:[32]}]]],["p-3742c929",[[1,"ku4-focus-trap",{active:[1540],include:[1],exclude:[1],excludeShadow:[1,"exclude-shadow"],initial:[1],return:[1],activate:[64],deactivate:[64]}]]],["p-9260407c",[[4,"ku4-form",{valid:[1028],invalid:[1540],listFieldNames:[64],validate:[64],invalidate:[64],read:[64],write:[64],focusFirstInvalid:[64]}]]],["p-0669a534",[[1,"ku4-grid",{columnsXs:[2,"columns-xs"],columnsSm:[2,"columns-sm"],columnsMd:[2,"columns-md"],columnsLg:[2,"columns-lg"],offsetLeftXs:[2,"offset-left-xs"],offsetLeftSm:[2,"offset-left-sm"],offsetLeftMd:[2,"offset-left-md"],offsetLeftLg:[2,"offset-left-lg"],offsetRight:[2,"offset-right"],offsetRightXs:[2,"offset-right-xs"],offsetRightSm:[2,"offset-right-sm"],offsetRightMd:[2,"offset-right-md"],offsetRightLg:[2,"offset-right-lg"],offsetXs:[2,"offset-xs"],offsetSm:[2,"offset-sm"],offsetMd:[2,"offset-md"],offsetLg:[2,"offset-lg"]}]]],["p-3d59749e",[[1,"ku4-label",{for:[1],value:[1],empty:[32]}]]],["p-d9a5870c",[[1,"ku4-mask",{for:[1],template:[1],ban:[1],pattern:[1],char:[1],hidden:[4]}]]],["p-d1b4d5dc",[[1,"ku4-modal",{visible:[1540],dismissable:[4],dismissible:[4],focusTrap:[1,"focus-trap"],display:[64],dismiss:[64]},[[8,"keyup","handleKeyUp"]]]]],["p-996461ba",[[1,"ku4-panel",{open:[1540],maxHeight:[32],toggle:[64],close:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-332a5a54",[[1,"ku4-preview",{for:[1],src:[1],altsrc:[1],orientation:[2],resolutionX:[2,"resolution-x"],resolutionY:[2,"resolution-y"],capture:[1],status:[1537],alt:[1],currentSrc:[32],read:[64]}]]],["p-bb380a04",[[1,"ku4-tab",{selected:[1540],panel:[32],select:[64],deselect:[64],connect:[64]},[[0,"click","handleClick"],[0,"keyup","handleKeyUp"]]]]],["p-5119224c",[[1,"ku4-tab-list",{open:[64]},[[0,"ku4TabClick","handleTabClick"],[0,"ku4TabKeyup","handleTabKeyUp"]]]]],["p-56f61856",[[1,"ku4-tab-panel",{selected:[1540],maxHeight:[32],tab:[32],select:[64],deselect:[64],connect:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-6f6a8c8d",[[4,"ku4-table",{stackXs:[1537,"stack-xs"],stackSm:[1537,"stack-sm"]}]]],["p-7875dc99",[[1,"ku4-tooltip",{element:[1],top:[4],left:[4],bottom:[4],right:[4],debug:[4],show:[64],hide:[64]}]]],["p-f23287da",[[1,"ku4-validation",{for:[513],element:[513],pattern:[1],flags:[1],values:[1],checked:[4],method:[1],invalid:[1540],disabled:[1540],hidden:[1540],isValid:[32],validate:[64]}]]]],e)));
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as s,g as n}from"./p-0943c493.js";import{Y as h,o as a,t as o}from"./p-0af98743.js";import{i as e}from"./p-e8b35187.js";const r=class{constructor(s){t(this,s),this.didValidate=i(this,"validate",7),this.validate=this.validate.bind(this),this.handleReset=this.handleReset.bind(this)}async listFieldNames(){return e.readFieldNames(this.form)}async validate(){const{fields:t}=this,i=t.map((t=>t.validate()));return this.isValid=await Promise.all(i).then((t=>!t.some((t=>!1===t)))),this.valid=this.isValid,this.invalid=!this.isValid,await h(100).then((()=>{const t=[].slice.call(this.form.querySelectorAll("ku4-validation[invalid]")),i=[].slice.call(document.querySelectorAll(`[form="${this.form.id}"]`)).map((t=>document.querySelector(`ku4-validation[invalid][for="${t.id}"]`))),s=[].slice.call(document.querySelectorAll(`ku4-validation[invalid][form="${this.form.id}"]`));return a(t.concat(i).concat(s).filter((t=>o.exists(t))))})).then((t=>this.didValidate.emit({invalid:t}))),this.isValid}async invalidate(t){if(o.isArray(t))t.forEach((t=>{const i=this.fields.find((i=>i.for===t));i&&(i.invalid=!0)}));else{const i=this.fields.find((i=>i.for===t));i&&(i.invalid=!0)}return this.isValid=!1,this.valid=this.isValid,this.invalid=!this.isValid,this}async read(){return e.read(this.form)}async write(t){return e.write(this.form,t),Object.keys(t).forEach((t=>{try{this.form.querySelector(`[name="${t}"]`).dispatchEvent(new window.Event("change"))}catch(i){}})),this}async focusFirstInvalid(){h(100).then((()=>{const t=document.querySelector("ku4-valiation[invalid]");o.exists(t)&&t.scrollIntoView({behavior:"smooth",block:"center"})}))}get form(){return this.host.querySelector("form")}get fields(){const t=[].slice.call(this.form.querySelectorAll("ku4-validation")),i=[].slice.call(document.querySelectorAll(`[form="${this.form.id}"]`)).map((t=>document.querySelector(`ku4-validation[for="${t.id}"]`))),s=[].slice.call(document.querySelectorAll(`ku4-validation[form="${this.form.id}"]`));return a(t.concat(i).concat(s).filter((t=>o.exists(t))))}handleReset(){this.isValid=!0,this.valid=this.isValid,this.invalid=!this.isValid}componentWillLoad(){const{form:t}=this;if(o.exists(t)){const i=t.onsubmit||(()=>{});t.onsubmit=s=>(s.preventDefault(),this.validate().then((n=>n&&i.call(t,s))).then((i=>!o.isFalse(i)&&t.submit())),!1),t.addEventListener("reset",this.handleReset),this.fields.forEach((t=>t.addEventListener("validated",this.validate)))}}disconnectedCallback(){const{form:t}=this;o.exists(t)&&(t.removeEventListener("reset",this.handleReset),this.fields.forEach((t=>t.removeEventListener("validated",this.validate))))}render(){return s("slot",null)}get host(){return n(this)}};export{r as ku4_form}
@@ -1 +1 @@
1
- System.register(["./p-55f5c91c.system.js"],(function(){"use strict";var e,t,s,a,o;return{setters:[function(r){e=r.d;t=r.N;s=r.w;a=r.p;o=r.b}],execute:function(){var r=function(){var o=Array.from(e.querySelectorAll("script")).find((function(e){return new RegExp("/".concat(t,"(\\.esm)?\\.js($|\\?|#)")).test(e.src)||e.getAttribute("data-stencil-namespace")===t}));var r={};if("onbeforeload"in o&&!history.scrollRestoration){return{then:function(){}}}{r.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,s.location.href)).href}return a(r)};r().then((function(e){return o([["p-746378d8.system",[[1,"ku4-carousel",{swipeTolerance:[2,"swipe-tolerance"],auto:[4],noSwipe:[4,"no-swipe"],delay:[2],slideState:[32],next:[64],previous:[64],slideTo:[64],pause:[64],play:[64]}]]],["p-6715c004.system",[[1,"ku4-carousel-controls",{for:[1]}]]],["p-6c7c6b42.system",[[1,"ku4-carousel-slide",{name:[1544],active:[32],classList:[32],slideIn:[64],slideOut:[64],activate:[64],deactivate:[64]}]]],["p-b2af9e06.system",[[1,"ku4-col",{startXs:[2,"start-xs"],startSm:[2,"start-sm"],startMd:[2,"start-md"],startLg:[2,"start-lg"],spanXs:[2,"span-xs"],spanSm:[2,"span-sm"],spanMd:[2,"span-md"],spanLg:[2,"span-lg"],orderXs:[2,"order-xs"],orderSm:[2,"order-sm"],orderMd:[2,"order-md"],orderLg:[2,"order-lg"]}]]],["p-2da96838.system",[[1,"ku4-drawer",{bottom:[516],left:[516],right:[516],top:[516],size:[1],open:[1540],toggle:[64]}]]],["p-d56159f9.system",[[1,"ku4-feature",{on:[4],policy:[1],enabled:[32]}]]],["p-ee51fe4d.system",[[1,"ku4-focus-trap",{active:[1540],include:[1],exclude:[1],excludeShadow:[1,"exclude-shadow"],initial:[1],return:[1],activate:[64],deactivate:[64]}]]],["p-03c61943.system",[[4,"ku4-form",{valid:[1028],invalid:[1540],listFieldNames:[64],validate:[64],invalidate:[64],read:[64],write:[64],focusFirstInvalid:[64]}]]],["p-be3b5409.system",[[1,"ku4-grid",{columnsXs:[2,"columns-xs"],columnsSm:[2,"columns-sm"],columnsMd:[2,"columns-md"],columnsLg:[2,"columns-lg"],offsetLeftXs:[2,"offset-left-xs"],offsetLeftSm:[2,"offset-left-sm"],offsetLeftMd:[2,"offset-left-md"],offsetLeftLg:[2,"offset-left-lg"],offsetRight:[2,"offset-right"],offsetRightXs:[2,"offset-right-xs"],offsetRightSm:[2,"offset-right-sm"],offsetRightMd:[2,"offset-right-md"],offsetRightLg:[2,"offset-right-lg"],offsetXs:[2,"offset-xs"],offsetSm:[2,"offset-sm"],offsetMd:[2,"offset-md"],offsetLg:[2,"offset-lg"]}]]],["p-74ef5565.system",[[1,"ku4-label",{for:[1],value:[1],empty:[32]}]]],["p-96c08f79.system",[[1,"ku4-mask",{for:[1],template:[1],ban:[1],pattern:[1],char:[1],hidden:[4]}]]],["p-36e2caf6.system",[[1,"ku4-modal",{visible:[1540],dismissable:[4],dismissible:[4],focusTrap:[1,"focus-trap"],display:[64],dismiss:[64]},[[8,"keyup","handleKeyUp"]]]]],["p-220c33c5.system",[[1,"ku4-panel",{open:[1540],maxHeight:[32],toggle:[64],close:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-4243b0a9.system",[[1,"ku4-preview",{for:[1],src:[1],altsrc:[1],orientation:[2],resolutionX:[2,"resolution-x"],resolutionY:[2,"resolution-y"],capture:[1],status:[1537],alt:[1],currentSrc:[32],read:[64]}]]],["p-9404f926.system",[[1,"ku4-tab",{selected:[1540],panel:[32],select:[64],deselect:[64],connect:[64]},[[0,"click","handleClick"],[0,"keyup","handleKeyUp"]]]]],["p-90553d69.system",[[1,"ku4-tab-list",{open:[64]},[[0,"ku4TabClick","handleTabClick"],[0,"ku4TabKeyup","handleTabKeyUp"]]]]],["p-6fc54c2b.system",[[1,"ku4-tab-panel",{selected:[1540],maxHeight:[32],tab:[32],select:[64],deselect:[64],connect:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-2df06b36.system",[[4,"ku4-table",{stackXs:[1537,"stack-xs"],stackSm:[1537,"stack-sm"]}]]],["p-22afbc6b.system",[[1,"ku4-tooltip",{element:[1],top:[4],left:[4],bottom:[4],right:[4],debug:[4],show:[64],hide:[64]}]]],["p-43d724df.system",[[1,"ku4-validation",{for:[513],element:[513],pattern:[1],flags:[1],values:[1],checked:[4],method:[1],invalid:[1540],disabled:[1540],hidden:[1540],isValid:[32],validate:[64]}]]]],e)}))}}}));
1
+ System.register(["./p-55f5c91c.system.js"],(function(){"use strict";var e,t,s,a,o;return{setters:[function(r){e=r.d;t=r.N;s=r.w;a=r.p;o=r.b}],execute:function(){var r=function(){var o=Array.from(e.querySelectorAll("script")).find((function(e){return new RegExp("/".concat(t,"(\\.esm)?\\.js($|\\?|#)")).test(e.src)||e.getAttribute("data-stencil-namespace")===t}));var r={};if("onbeforeload"in o&&!history.scrollRestoration){return{then:function(){}}}{r.resourcesUrl=new URL(".",new URL(o.getAttribute("data-resources-url")||o.src,s.location.href)).href}return a(r)};r().then((function(e){return o([["p-746378d8.system",[[1,"ku4-carousel",{swipeTolerance:[2,"swipe-tolerance"],auto:[4],noSwipe:[4,"no-swipe"],delay:[2],slideState:[32],next:[64],previous:[64],slideTo:[64],pause:[64],play:[64]}]]],["p-6715c004.system",[[1,"ku4-carousel-controls",{for:[1]}]]],["p-6c7c6b42.system",[[1,"ku4-carousel-slide",{name:[1544],active:[32],classList:[32],slideIn:[64],slideOut:[64],activate:[64],deactivate:[64]}]]],["p-b2af9e06.system",[[1,"ku4-col",{startXs:[2,"start-xs"],startSm:[2,"start-sm"],startMd:[2,"start-md"],startLg:[2,"start-lg"],spanXs:[2,"span-xs"],spanSm:[2,"span-sm"],spanMd:[2,"span-md"],spanLg:[2,"span-lg"],orderXs:[2,"order-xs"],orderSm:[2,"order-sm"],orderMd:[2,"order-md"],orderLg:[2,"order-lg"]}]]],["p-2da96838.system",[[1,"ku4-drawer",{bottom:[516],left:[516],right:[516],top:[516],size:[1],open:[1540],toggle:[64]}]]],["p-d56159f9.system",[[1,"ku4-feature",{on:[4],policy:[1],enabled:[32]}]]],["p-ee51fe4d.system",[[1,"ku4-focus-trap",{active:[1540],include:[1],exclude:[1],excludeShadow:[1,"exclude-shadow"],initial:[1],return:[1],activate:[64],deactivate:[64]}]]],["p-e2659cc2.system",[[4,"ku4-form",{valid:[1028],invalid:[1540],listFieldNames:[64],validate:[64],invalidate:[64],read:[64],write:[64],focusFirstInvalid:[64]}]]],["p-be3b5409.system",[[1,"ku4-grid",{columnsXs:[2,"columns-xs"],columnsSm:[2,"columns-sm"],columnsMd:[2,"columns-md"],columnsLg:[2,"columns-lg"],offsetLeftXs:[2,"offset-left-xs"],offsetLeftSm:[2,"offset-left-sm"],offsetLeftMd:[2,"offset-left-md"],offsetLeftLg:[2,"offset-left-lg"],offsetRight:[2,"offset-right"],offsetRightXs:[2,"offset-right-xs"],offsetRightSm:[2,"offset-right-sm"],offsetRightMd:[2,"offset-right-md"],offsetRightLg:[2,"offset-right-lg"],offsetXs:[2,"offset-xs"],offsetSm:[2,"offset-sm"],offsetMd:[2,"offset-md"],offsetLg:[2,"offset-lg"]}]]],["p-74ef5565.system",[[1,"ku4-label",{for:[1],value:[1],empty:[32]}]]],["p-96c08f79.system",[[1,"ku4-mask",{for:[1],template:[1],ban:[1],pattern:[1],char:[1],hidden:[4]}]]],["p-36e2caf6.system",[[1,"ku4-modal",{visible:[1540],dismissable:[4],dismissible:[4],focusTrap:[1,"focus-trap"],display:[64],dismiss:[64]},[[8,"keyup","handleKeyUp"]]]]],["p-220c33c5.system",[[1,"ku4-panel",{open:[1540],maxHeight:[32],toggle:[64],close:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-4243b0a9.system",[[1,"ku4-preview",{for:[1],src:[1],altsrc:[1],orientation:[2],resolutionX:[2,"resolution-x"],resolutionY:[2,"resolution-y"],capture:[1],status:[1537],alt:[1],currentSrc:[32],read:[64]}]]],["p-9404f926.system",[[1,"ku4-tab",{selected:[1540],panel:[32],select:[64],deselect:[64],connect:[64]},[[0,"click","handleClick"],[0,"keyup","handleKeyUp"]]]]],["p-90553d69.system",[[1,"ku4-tab-list",{open:[64]},[[0,"ku4TabClick","handleTabClick"],[0,"ku4TabKeyup","handleTabKeyUp"]]]]],["p-6fc54c2b.system",[[1,"ku4-tab-panel",{selected:[1540],maxHeight:[32],tab:[32],select:[64],deselect:[64],connect:[64]},[[0,"transitionend","handleTransitionEnd"]]]]],["p-2df06b36.system",[[4,"ku4-table",{stackXs:[1537,"stack-xs"],stackSm:[1537,"stack-sm"]}]]],["p-22afbc6b.system",[[1,"ku4-tooltip",{element:[1],top:[4],left:[4],bottom:[4],right:[4],debug:[4],show:[64],hide:[64]}]]],["p-43d724df.system",[[1,"ku4-validation",{for:[513],element:[513],pattern:[1],flags:[1],values:[1],checked:[4],method:[1],invalid:[1540],disabled:[1540],hidden:[1540],isValid:[32],validate:[64]}]]]],e)}))}}}));
@@ -0,0 +1 @@
1
+ var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,o){function a(t){try{s(n.next(t))}catch(e){o(e)}}function u(t){try{s(n["throw"](t))}catch(e){o(e)}}function s(t){t.done?i(t.value):r(t.value).then(a,u)}s((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(t){return function(e){return s([t,e])}}function s(a){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(u){a=[6,u];r=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-55f5c91c.system.js","./p-e11b977e.system.js","./p-eb21757a.system.js"],(function(t){"use strict";var e,i,n,r,o,a,u,s;return{setters:[function(t){e=t.r;i=t.c;n=t.h;r=t.g},function(t){o=t.Y;a=t.o;u=t.t},function(t){s=t.i}],execute:function(){var c=t("ku4_form",function(){function t(t){e(this,t);this.didValidate=i(this,"validate",7);this.validate=this.validate.bind(this);this.handleReset=this.handleReset.bind(this)}t.prototype.listFieldNames=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,s.readFieldNames(this.form)]}))}))};t.prototype.validate=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,i;var n=this;return __generator(this,(function(r){switch(r.label){case 0:t=this.fields;e=t.map((function(t){return t.validate()}));i=this;return[4,Promise.all(e).then((function(t){return!t.some((function(t){return t===false}))}))];case 1:i.isValid=r.sent();this.valid=this.isValid;this.invalid=!this.isValid;return[4,o(100).then((function(){var t=[].slice.call(n.form.querySelectorAll("ku4-validation[invalid]"));var e=[].slice.call(document.querySelectorAll('[form="'.concat(n.form.id,'"]')));var i=e.map((function(t){return document.querySelector('ku4-validation[invalid][for="'.concat(t.id,'"]'))}));var r=[].slice.call(document.querySelectorAll('ku4-validation[invalid][form="'.concat(n.form.id,'"]')));return a(t.concat(i).concat(r).filter((function(t){return u.exists(t)})))})).then((function(t){return n.didValidate.emit({invalid:t})}))];case 2:r.sent();return[2,this.isValid]}}))}))};t.prototype.invalidate=function(t){return __awaiter(this,void 0,void 0,(function(){var e;var i=this;return __generator(this,(function(n){if(u.isArray(t)){t.forEach((function(t){var e=i.fields.find((function(e){return e.for===t}));if(e){e.invalid=true}}))}else{e=this.fields.find((function(e){return e.for===t}));if(e){e.invalid=true}}this.isValid=false;this.valid=this.isValid;this.invalid=!this.isValid;return[2,this]}))}))};t.prototype.read=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,s.read(this.form)]}))}))};t.prototype.write=function(t){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(i){s.write(this.form,t);Object.keys(t).forEach((function(t){try{e.form.querySelector('[name="'.concat(t,'"]')).dispatchEvent(new window.Event("change"))}catch(i){}}));return[2,this]}))}))};t.prototype.focusFirstInvalid=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){o(100).then((function(){var t=document.querySelector("ku4-valiation[invalid]");if(u.exists(t)){t.scrollIntoView({behavior:"smooth",block:"center"})}}));return[2]}))}))};Object.defineProperty(t.prototype,"form",{get:function(){return this.host.querySelector("form")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"fields",{get:function(){var t=[].slice.call(this.form.querySelectorAll("ku4-validation"));var e=[].slice.call(document.querySelectorAll('[form="'.concat(this.form.id,'"]')));var i=e.map((function(t){return document.querySelector('ku4-validation[for="'.concat(t.id,'"]'))}));var n=[].slice.call(document.querySelectorAll('ku4-validation[form="'.concat(this.form.id,'"]')));return a(t.concat(i).concat(n).filter((function(t){return u.exists(t)})))},enumerable:false,configurable:true});t.prototype.handleReset=function(){this.isValid=true;this.valid=this.isValid;this.invalid=!this.isValid};t.prototype.componentWillLoad=function(){var t=this;var e=this.form;if(u.exists(e)){var i=e.onsubmit||function(){};e.onsubmit=function(n){n.preventDefault();t.validate().then((function(t){return t&&i.call(e,n)})).then((function(t){return!u.isFalse(t)&&e.submit()}));return false};e.addEventListener("reset",this.handleReset);this.fields.forEach((function(e){return e.addEventListener("validated",t.validate)}))}};t.prototype.disconnectedCallback=function(){var t=this;var e=this.form;if(u.exists(e)){e.removeEventListener("reset",this.handleReset);this.fields.forEach((function(e){return e.removeEventListener("validated",t.validate)}))}};t.prototype.render=function(){return n("slot",null)};Object.defineProperty(t.prototype,"host",{get:function(){return r(this)},enumerable:false,configurable:true});return t}())}}}));
@@ -65,11 +65,15 @@ export declare class Ku4Validation {
65
65
  * A reference to a named function or a function body that
66
66
  * define a validation criteria and return `true` when the
67
67
  * defined validation criteria are satisfied.
68
- * The function will be called with one argument, `value`,
69
- * that will contain the current value of the target field.
70
- * Example: method="return value === 'valid'", or
71
- * function validate(value) { return value === 'valid'; }
72
- * method="validate(value)"
68
+ * The function will be called with two arguments: `value`, `values`,
69
+ * that will contain the current "value" of the target field, and
70
+ * the current "values" of the entire form as an object whose
71
+ * keys are the names of each fields and whose values are the value
72
+ * of each of these fields having name "key".
73
+ * Example (html): method="return value === 'valid' && values.key === 'valid'", or
74
+ * function validate(value, values) { return value === 'valid' && values.key === 'valid'; }
75
+ * method="validate(value, values)".
76
+ * Example (Vue3): .method="validate"
73
77
  */
74
78
  readonly method: string;
75
79
  /**
@@ -540,7 +540,7 @@ export namespace Components {
540
540
  */
541
541
  "invalid": boolean;
542
542
  /**
543
- * A reference to a named function or a function body that define a validation criteria and return `true` when the defined validation criteria are satisfied. The function will be called with one argument, `value`, that will contain the current value of the target field. Example: method="return value === 'valid'", or function validate(value) { return value === 'valid'; } method="validate(value)"
543
+ * A reference to a named function or a function body that define a validation criteria and return `true` when the defined validation criteria are satisfied. The function will be called with two arguments: `value`, `values`, that will contain the current "value" of the target field, and the current "values" of the entire form as an object whose keys are the names of each fields and whose values are the value of each of these fields having name "key". Example (html): method="return value === 'valid' && values.key === 'valid'", or function validate(value, values) { return value === 'valid' && values.key === 'valid'; } method="validate(value, values)". Example (Vue3): .method="validate"
544
544
  */
545
545
  "method": string;
546
546
  /**
@@ -1143,7 +1143,7 @@ declare namespace LocalJSX {
1143
1143
  */
1144
1144
  "invalid"?: boolean;
1145
1145
  /**
1146
- * A reference to a named function or a function body that define a validation criteria and return `true` when the defined validation criteria are satisfied. The function will be called with one argument, `value`, that will contain the current value of the target field. Example: method="return value === 'valid'", or function validate(value) { return value === 'valid'; } method="validate(value)"
1146
+ * A reference to a named function or a function body that define a validation criteria and return `true` when the defined validation criteria are satisfied. The function will be called with two arguments: `value`, `values`, that will contain the current "value" of the target field, and the current "values" of the entire form as an object whose keys are the names of each fields and whose values are the value of each of these fields having name "key". Example (html): method="return value === 'valid' && values.key === 'valid'", or function validate(value, values) { return value === 'valid' && values.key === 'valid'; } method="validate(value, values)". Example (Vue3): .method="validate"
1147
1147
  */
1148
1148
  "method"?: string;
1149
1149
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ku4web-components",
3
- "version": "6.7.2",
3
+ "version": "6.7.3",
4
4
  "description": "kodmunki™ Web Components",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.js",
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,o){function a(t){try{u(n.next(t))}catch(e){o(e)}}function s(t){try{u(n["throw"](t))}catch(e){o(e)}}function u(t){t.done?i(t.value):r(t.value).then(a,s)}u((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return u([t,e])}}function u(a){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(s){a=[6,s];r=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-55f5c91c.system.js","./p-e11b977e.system.js","./p-eb21757a.system.js"],(function(t){"use strict";var e,i,n,r,o,a,s;return{setters:[function(t){e=t.r;i=t.c;n=t.h;r=t.g},function(t){o=t.Y;a=t.t},function(t){s=t.i}],execute:function(){var u=t("ku4_form",function(){function t(t){e(this,t);this.didValidate=i(this,"validate",7);this.validate=this.validate.bind(this);this.handleReset=this.handleReset.bind(this)}t.prototype.listFieldNames=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,s.readFieldNames(this.form)]}))}))};t.prototype.validate=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,i;var n=this;return __generator(this,(function(r){switch(r.label){case 0:t=this.fields;e=t.map((function(t){return t.validate()}));i=this;return[4,Promise.all(e).then((function(t){return!t.some((function(t){return t===false}))}))];case 1:i.isValid=r.sent();this.valid=this.isValid;this.invalid=!this.isValid;return[4,o(100).then((function(){return n.host.querySelectorAll("ku4-validation[invalid]")})).then((function(t){return n.didValidate.emit({invalid:t})}))];case 2:r.sent();return[2,this.isValid]}}))}))};t.prototype.invalidate=function(t){return __awaiter(this,void 0,void 0,(function(){var e;var i=this;return __generator(this,(function(n){if(a.isArray(t)){t.forEach((function(t){var e=i.fields.find((function(e){return e.for===t}));if(e){e.invalid=true}}))}else{e=this.fields.find((function(e){return e.for===t}));if(e){e.invalid=true}}this.isValid=false;this.valid=this.isValid;this.invalid=!this.isValid;return[2,this]}))}))};t.prototype.read=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,s.read(this.form)]}))}))};t.prototype.write=function(t){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(i){s.write(this.form,t);Object.keys(t).forEach((function(t){try{e.form.querySelector('[name="'.concat(t,'"]')).dispatchEvent(new window.Event("change"))}catch(i){}}));return[2,this]}))}))};t.prototype.focusFirstInvalid=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){o(100).then((function(){var t=document.querySelector("ku4-valiation[invalid]");if(a.exists(t)){t.scrollIntoView({behavior:"smooth",block:"center"})}}));return[2]}))}))};Object.defineProperty(t.prototype,"form",{get:function(){return this.host.querySelector("form")},enumerable:false,configurable:true});Object.defineProperty(t.prototype,"fields",{get:function(){return[].slice.call(this.form.querySelectorAll("ku4-validation"))},enumerable:false,configurable:true});t.prototype.handleReset=function(){this.isValid=true;this.valid=this.isValid;this.invalid=!this.isValid};t.prototype.componentWillLoad=function(){var t=this;var e=this.form;if(a.exists(e)){var i=e.onsubmit||function(){};e.onsubmit=function(n){n.preventDefault();t.validate().then((function(t){return t&&i.call(e,n)})).then((function(t){return!a.isFalse(t)&&e.submit()}));return false};e.addEventListener("reset",this.handleReset);this.fields.forEach((function(e){return e.addEventListener("validated",t.validate)}))}};t.prototype.disconnectedCallback=function(){var t=this;var e=this.form;if(a.exists(e)){e.removeEventListener("reset",this.handleReset);this.fields.forEach((function(e){return e.removeEventListener("validated",t.validate)}))}};t.prototype.render=function(){return n("slot",null)};Object.defineProperty(t.prototype,"host",{get:function(){return r(this)},enumerable:false,configurable:true});return t}())}}}));
@@ -1 +0,0 @@
1
- import{r as t,c as s,h as i,g as h}from"./p-0943c493.js";import{Y as e,t as a}from"./p-0af98743.js";import{i as n}from"./p-e8b35187.js";const r=class{constructor(i){t(this,i),this.didValidate=s(this,"validate",7),this.validate=this.validate.bind(this),this.handleReset=this.handleReset.bind(this)}async listFieldNames(){return n.readFieldNames(this.form)}async validate(){const{fields:t}=this,s=t.map((t=>t.validate()));return this.isValid=await Promise.all(s).then((t=>!t.some((t=>!1===t)))),this.valid=this.isValid,this.invalid=!this.isValid,await e(100).then((()=>this.host.querySelectorAll("ku4-validation[invalid]"))).then((t=>this.didValidate.emit({invalid:t}))),this.isValid}async invalidate(t){if(a.isArray(t))t.forEach((t=>{const s=this.fields.find((s=>s.for===t));s&&(s.invalid=!0)}));else{const s=this.fields.find((s=>s.for===t));s&&(s.invalid=!0)}return this.isValid=!1,this.valid=this.isValid,this.invalid=!this.isValid,this}async read(){return n.read(this.form)}async write(t){return n.write(this.form,t),Object.keys(t).forEach((t=>{try{this.form.querySelector(`[name="${t}"]`).dispatchEvent(new window.Event("change"))}catch(s){}})),this}async focusFirstInvalid(){e(100).then((()=>{const t=document.querySelector("ku4-valiation[invalid]");a.exists(t)&&t.scrollIntoView({behavior:"smooth",block:"center"})}))}get form(){return this.host.querySelector("form")}get fields(){return[].slice.call(this.form.querySelectorAll("ku4-validation"))}handleReset(){this.isValid=!0,this.valid=this.isValid,this.invalid=!this.isValid}componentWillLoad(){const{form:t}=this;if(a.exists(t)){const s=t.onsubmit||(()=>{});t.onsubmit=i=>(i.preventDefault(),this.validate().then((h=>h&&s.call(t,i))).then((s=>!a.isFalse(s)&&t.submit())),!1),t.addEventListener("reset",this.handleReset),this.fields.forEach((t=>t.addEventListener("validated",this.validate)))}}disconnectedCallback(){const{form:t}=this;a.exists(t)&&(t.removeEventListener("reset",this.handleReset),this.fields.forEach((t=>t.removeEventListener("validated",this.validate))))}render(){return i("slot",null)}get host(){return h(this)}};export{r as ku4_form}