@dynamicforms/vue-forms 0.6.1 → 0.11.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/dist/dynamicforms-vue-forms.js +1807 -781
- package/dist/dynamicforms-vue-forms.js.map +1 -1
- package/dist/dynamicforms-vue-forms.umd.cjs +2 -2
- package/dist/dynamicforms-vue-forms.umd.cjs.map +1 -1
- package/dist/index.d.cts +797 -78
- package/dist/index.d.ts +797 -78
- package/package.json +1 -1
- package/readme.md +52 -14
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`)}const At=Symbol("Validator"),Et=()=>y("Validation could not be completed");class b extends V{constructor(t){super((i,r,a,u)=>{var Q;const d=((Q=this.runs.get(i))!=null?Q:0)+1;this.runs.set(i,d);const p=i.validationEpoch,S=()=>this.runs.get(i)===d&&i.validationEpoch===p,w=t(a,u,i)||[],B=C=>{var pt;const j=(pt=C==null?void 0:C.map(T=>this.claim(T)))!=null?pt:[];for(let T=i.errors.length-1;T>=0;T--){const mt=i.errors[T];if(mt.source===this.source){const bt=j.findIndex(zt=>c.isEqual(zt,mt));bt>=0?j.splice(bt,1):i.errors.splice(T,1)}}j.length>0&&i.errors.push(...j),i.validate()};return w instanceof Promise?(i.beginValidating(),w.then(C=>{S()&&B(C)},C=>{S()&&(B([new m(Et())]),console.error("Validation failed",C))}).finally(()=>i.endValidating()).catch(C=>console.error("Validation failed",C))):B(w),r(i,a,u)});h(this,"source");h(this,"runs",new WeakMap);this.source=Symbol(this.constructor.name)}claim(t){const e=t.source;if(e===this.source)return t;const i={value:this.source,enumerable:!1,configurable:!1};if(e===void 0)return Object.defineProperty(t,"source",i),t;const r=Object.getOwnPropertyDescriptors(t);return Object.create(Object.getPrototypeOf(t),U(A({},r),{source:i}))}static get classIdentifier(){return At}get eager(){return!0}replacePlaceholdersFunction(t,e){return()=>{let i=o.unref(t);for(;N(i);)i=o.unref(this.replacePlaceholders(i(),e));return i}}replacePlaceholders(t,e){if(N(t))return this.replacePlaceholdersFunction(t,e);if(D(t))return t;if(o.isRef(t))return this.replacePlaceholdersFunction(()=>o.unref(t),e);let i=o.unref(t);return Object.keys(e).forEach(r=>{i=i.replaceAll(`{${r}}`,e[r])}),t instanceof x?new x(i.toString(),t.options,t.plugins):i}}class P extends Map{constructor(){super(...arguments);h(this,"eagerActions",new Set);h(this,"registeredActions",[])}register(t){if(!(t instanceof v))throw new Error("Invalid action type");this.registeredActions.push(t);const e=t.classIdentifier,i=this.get(e)||(()=>null);function r(a,...u){return t.execute(a,i,...u)}this.set(e,r),t.eager&&this.eagerActions.add(t.classIdentifier)}trigger(t,e,...i){const r=t.classIdentifier;r===st&&this.triggerEager(e,...i);const a=this.get(r);try{if(a)return a(e,...i)}catch(u){if(!(u instanceof M))throw u}return null}triggerEager(t,...e){for(const i of this.eagerActions){const r=this.get(i);try{r&&r(t,...e)}catch(a){if(!(a instanceof M))throw a}}}clone(){const t=new P;return this.registeredActions.forEach(e=>t.register(e)),t}cloneWithoutValidators(){const t=new P;return this.registeredActions.forEach(e=>{e instanceof b?e.unregister():t.register(e)}),t}}const It=Symbol("ConditionalStatementAction");class O extends V{constructor(t,e){const i=(r,a,u,d)=>{const p=t.evaluate();if(p!==this.lastResult){for(const S of this.boundFields)e(S,p,this.lastResult);this.lastResult=p}return a(r,u,d)};super(i);h(this,"lastResult");h(this,"boundFields",new Set);t.collectFields().forEach(r=>r.registerAction(new V(i)))}static get classIdentifier(){return It}get eager(){return!0}boundToField(t){this.boundFields.add(t)}}class ot extends O{constructor(n){super(n,(t,e)=>{t.visibility=e?I.FULL:I.SUPPRESS})}}class ut extends O{constructor(n){super(n,(t,e)=>{t.enabled=e})}}class ct extends O{constructor(n,t){super(n,(e,i)=>{i&&(e.value=t)})}}var L=(s=>(s[s.NOT=0]="NOT",s[s.OR=1]="OR",s[s.AND=2]="AND",s[s.XOR=3]="XOR",s[s.NAND=4]="NAND",s[s.NOR=5]="NOR",s[s.EQUALS=-1]="EQUALS",s[s.NOT_EQUALS=-2]="NOT_EQUALS",s[s.GT=-3]="GT",s[s.LT=-4]="LT",s[s.GE=-5]="GE",s[s.LE=-6]="LE",s[s.IN=-7]="IN",s[s.NOT_IN=-8]="NOT_IN",s[s.INCLUDES=-9]="INCLUDES",s[s.NOT_INCLUDES=-10]="NOT_INCLUDES",s))(L||{});(s=>{function n(r){const a=r.toLowerCase();if(a==="not")return 0;if(a==="or")return 1;if(a==="and")return 2;if(a==="xor")return 3;if(a==="nand")return 4;if(a==="nor")return 5;if(a==="equals")return-1;if(["not_equals","not-equals","not equals"].includes(a))return-2;if(a==="gt")return-3;if(a==="lt")return-4;if(a==="ge")return-5;if(a==="le")return-6;if(a==="in")return-7;if(["not_in","not-in","not in"].includes(a))return-8;if(a==="includes")return-9;if(["not_includes","not-includes","not includes"].includes(a))return-10;throw new Error(`Unrecognised operator ${a}`)}s.fromString=n;function t(r){const a=typeof r=="number"?r:s.fromString(r);if(Object.values(s).includes(a))return a;throw new Error(`Unrecognised operator ${r}`)}s.fromAny=t;function e(r){const a=typeof r=="number"?r:s.fromString(r);return Object.values(s).includes(a)}s.isDefined=e;function i(r){return r>=0}s.isLogicOperator=i})(L||(L={})),Object.freeze(L);const g=L,St=Symbol("EnabledChangingAction");class z extends v{constructor(n){super(n)}static get classIdentifier(){return St}execute(n,t,e,i){return super.execute(n,t,e,i)}}const xt=Symbol("EnabledChangedAction");class G extends v{constructor(n){super(n)}static get classIdentifier(){return xt}execute(n,t,e,i){return super.execute(n,t,e,i)}}const Pt=Symbol("ValidChangedAction");class X extends v{constructor(n){super(n)}static get classIdentifier(){return Pt}execute(n,t,e,i){return super.execute(n,t,e,i)}}const Ft=Symbol("VisibilityChangingAction");class Y extends v{constructor(n){super(n)}static get classIdentifier(){return Ft}execute(n,t,e,i){return super.execute(n,t,e,i)}}const wt=Symbol("VisibilityChangedAction");class J extends v{constructor(n){super(n)}static get classIdentifier(){return wt}execute(n,t,e,i){return super.execute(n,t,e,i)}}class _{constructor(){h(this,"validatingCount",0);h(this,"_valid",!0);h(this,"errors",[]);h(this,"actions",new P);h(this,"_visibility",I.FULL);h(this,"_enabled",!0);h(this,"suppressValidation",!1);h(this,"suppressParentValidityClimb",!1);h(this,"parentValidityClimbPending",!1);h(this,"_validationEpoch",0);return o.reactive(this)}get validating(){return this.validatingCount>0}beginValidating(){this.validatingCount++}endValidating(){this.validatingCount=Math.max(0,this.validatingCount-1)}get visibility(){return this._visibility}set visibility(n){const t=this._visibility,e=this.actions.trigger(Y,this,n,t);if(!I.isDefined(e!=null?e:n))throw new Error("visibility must be a DisplayMode constant");this._visibility=I.fromAny(e!=null?e:n),this.actions.trigger(J,this,this._visibility,t)}get enabled(){return this._enabled}set enabled(n){const t=this._enabled,e=this.actions.trigger(z,this,n,t);if(!c.isBoolean(e!=null?e:n))throw new Error("Enabled value must be boolean");this._enabled=e!=null?e:n,this.actions.trigger(G,this,this._enabled,t)}flushParentValidityClimb(){var n;this.parentValidityClimbPending&&(this.parentValidityClimbPending=!1,(n=this.parent)==null||n.validate())}validate(n=!1){var e;if(this.suppressValidation)return;n&&this.actions.triggerEager(this,this.value,this.value);const t=this._valid;this._valid=this.valid,this._valid!==t&&(this.actions.trigger(X,this,this.valid,t),this.suppressParentValidityClimb?this.parentValidityClimbPending=!0:(e=this.parent)==null||e.validate())}get valid(){return this.errors.length===0}get fullValue(){return this.value}get isChanged(){return!c.isEqual(this.value,this.originalValue)}registerInitialActions(n){n.forEach(t=>{this.actions.register(t),t.boundToField(this)})}registerAction(n){return this.actions.register(n),n.boundToField(this),n.eager&&this.actions.trigger(Object.getPrototypeOf(n).constructor,this,this.value,this.originalValue),this}triggerAction(n,...t){return this.actions.trigger(n,this,...t)}get validationEpoch(){return this._validationEpoch}clearValidators(){this._validationEpoch++,this.actions=this.actions.cloneWithoutValidators(),this.errors=[],this.validate()}}function jt(s,n){return s?!n:n}class F{constructor(n,t,e){h(this,"operand1");h(this,"operator");h(this,"operand2");this.operand1=n,this.operator=t,this.operand2=e}get operand1Value(){return this.operand1 instanceof F?this.operand1.evaluate():this.operand1 instanceof _?o.unref(this.operand1.value):this.operand1}get operand2Value(){return this.operand2 instanceof F?this.operand2.evaluate():this.operand2 instanceof _?o.unref(this.operand2.value):this.operand2}evaluate(){var e,i;const n=this.operand1Value,t=this.operand2Value;switch(this.operator){case g.AND:return!!(n&&t);case g.OR:return!!(n||t);case g.NAND:return!(n&&t);case g.NOR:return!(n||t);case g.XOR:return jt(!!n,!!t);case g.NOT:return!n;case g.EQUALS:return n==t;case g.NOT_EQUALS:return n!=t;case g.LT:return n<t;case g.LE:return n<=t;case g.GE:return n>=t;case g.GT:return n>t;case g.IN:return!!((e=t==null?void 0:t.includes)!=null&&e.call(t,n));case g.NOT_IN:return!((i=t==null?void 0:t.includes)!=null&&i.call(t,n));case g.INCLUDES:return c.isString(n)&&c.isString(t)&&n.indexOf(t)>=0;case g.NOT_INCLUDES:return!(c.isString(n)&&c.isString(t)&&n.indexOf(t)>=0);default:throw new Error(`Operator not implemented ${this.operator}`)}}collectFields(){const n=new Set;function t(e){e instanceof _?n.add(e):e instanceof F&&e.collectFields().forEach(r=>n.add(r))}return t(this.operand1),t(this.operand2),n}}const Tt=Symbol("ExecuteAction");class K extends v{constructor(n){super(n)}static get classIdentifier(){return Tt}execute(n,t,e){return super.execute(n,t,e)}}const Nt=Symbol("ListItemAddedAction");class $ extends v{constructor(n){super(n)}static get classIdentifier(){return Nt}execute(n,t,e,i){return super.execute(n,t,e,i)}}const Ot=Symbol("ListItemRemovedAction");class Z extends v{constructor(n){super(n)}static get classIdentifier(){return Ot}execute(n,t,e,i){return super.execute(n,t,e,i)}}class R extends _{constructor(t){super();h(this,"_value");h(this,"_touched",!1);this.init(t)}init(t){if(t){const e=t,{value:i,validators:r,actions:a}=e,u=k(e,["value","validators","actions"]);this.registerInitialActions([...r||[],...a||[]]),Object.assign(this,u),this._value=i!==void 0?i:this.originalValue,this.originalValue===void 0&&(this.originalValue=this._value)}this.actions.triggerEager(this,this.value,this.originalValue),this.validate()}get value(){return this._value}set value(t){const e=this._value;if(!this.enabled||e===t)return;this._value=t;const i=this.suppressParentValidityClimb;this.suppressParentValidityClimb=!0;try{this.actions.trigger(V,this,this._value,e),this.parent&&this.parent.notifyValueChanged()}finally{this.suppressParentValidityClimb=i,this.validate(),this.flushParentValidityClimb()}}get touched(){return this._touched}set touched(t){this._touched=t}clone(t){var r,a;const e=this.constructor,i=new e(U(A({value:(t==null?void 0:t.value)!==void 0?t.value:this.value},t&&"originalValue"in t?{originalValue:t.originalValue}:{}),{enabled:(r=t==null?void 0:t.enabled)!=null?r:this.enabled,visibility:(a=t==null?void 0:t.visibility)!=null?a:this.visibility}));return i.actions=this.actions.clone(),i.actions.triggerEager(i,i.value,i.originalValue),i}}const ht=new R({value:"EmptyField"}).registerAction(new V(()=>{console.warn("Working with EmptyField! This should not happen")}));function tt(s,n){return(s==null?void 0:s.label)==null&&(s==null?void 0:s.icon)==null?n:s}class dt extends R{init(n){if(this._value={label:void 0,icon:void 0},n){const t=n,{value:e,originalValue:i,validators:r,actions:a}=t,u=k(t,["value","originalValue","validators","actions"]);this.registerInitialActions([...r||[],...a||[]]),Object.assign(this,u);const d=tt(e,this._value),p=Object.freeze({label:i==null?void 0:i.label,icon:i==null?void 0:i.icon});this._value=tt(d,A({},p)),this.originalValue=tt(p,d)}this.actions.triggerEager(this,this.value,this.originalValue),this.validate()}get icon(){return this.value.icon}set icon(n){this.value.icon=n}get label(){return this.value.label}set label(n){this.value.label=n}execute(n){this.actions.trigger(K,this,n)}}const gt=o.defineComponent({__name:"messages-widget",props:{message:{},classes:{}},setup(s){const n=s,t=o.resolveComponent("vue-markdown"),e=new Set(["div","span","p","h1","h2","h3","h4","h5","h6","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","em","strong","small","mark","del","ins","sub","sup","i","b","u","s","a","img","button","input","textarea","select","option","label","form","table","tr","td","th","thead","tbody","tfoot","ul","ol","li","dl","dt","dd"]),i=()=>{if(typeof n.message=="string")return o.h("span",{class:n.classes},n.message);const r=[];return n.message.forEach(a=>{switch(a.componentName){case"template":r.push(o.h("div",{class:[n.classes,a.extraClasses]},a.componentBody));break;case"vue-markdown":if(typeof t=="string")console.warn("You are using markdown for messages-widget, but you haven't registered a vue-markdown component"),r.push(o.h("div",{class:[n.classes,a.extraClasses]},a.componentBindings.source));else{const u=a.componentBindings;r.push(o.h(t,{class:[n.classes,a.extraClasses,"df-messages-widget-markdown"],source:u.source,options:u.options,plugins:u.plugins}))}break;default:r.push(o.h(e.has(a.componentName.toLowerCase())?a.componentName:o.resolveComponent(a.componentName),A(A({class:[n.classes,a.extraClasses]},a.componentBindings),a.componentBody?{innerHTML:a.componentBody}:{})));break}}),r};return(r,a)=>(o.openBlock(),o.createBlock(i))}});class E extends _{constructor(t,e){super();h(this,"_fields");h(this,"_value",null);h(this,"suppressNotifyValueChanged",!1);if(!E.isValidFields(t))throw new Error("Invalid fields object provided");if(this._fields=Object.create(null),Object.entries(t).forEach(([r,a])=>this.addField(r,a)),e){const i=e,{value:r,validators:a,actions:u}=i,d=k(i,["value","validators","actions"]);this.registerInitialActions([...a||[],...u||[]]),Object.assign(this,d),r!==void 0?this.assignMembers(r):this.originalValue!==void 0&&this.assignMembers(this.originalValue)}this.originalValue===void 0&&(this.originalValue=this.value),this._value=this.value,this.actions.triggerEager(this,this.value,this.originalValue),this.validate()}addField(t,e){if(Object.hasOwn(this._fields,t))throw new Error(`Field ${t} is already in this form`);Object.defineProperty(e,"parent",{get:()=>this,configurable:!1,enumerable:!1}),Object.defineProperty(e,"fieldName",{get:()=>t,configurable:!1,enumerable:!1}),Object.defineProperty(this._fields,t,{get:()=>e,configurable:!1,enumerable:!0})}static isValidFields(t){function e(i){return i instanceof _}return typeof t=="object"&&t!==null&&Object.entries(t).every(([,i])=>e(i))}static createFromFormData(t){if(t instanceof _)throw new Error("data is already a Form structure, should be a simple object");return new E(t==null?{}:Object.fromEntries(Object.entries(t).map(([e,i])=>[e,new R({value:i})])))}field(t){var e;return(e=this._fields[t])!=null?e:null}get fields(){return this._fields}get value(){const t=Object.create(null);return Object.entries(this._fields).forEach(([e,i])=>{const r=i.value;(i.enabled||i instanceof E&&!c.isEmpty(r))&&(t[e]=r)}),c.isEmpty(t)?null:A({},t)}assignMembers(t){const e=this.suppressNotifyValueChanged,i=this.suppressValidation;this.suppressNotifyValueChanged=!0,this.suppressValidation=!0;try{Object.entries(this._fields).forEach(([r,a])=>{(t==null||Object.hasOwn(t,r))&&(a.value=t==null?null:t[r])})}finally{this.suppressNotifyValueChanged=e,this.suppressValidation=i}}set value(t){this.assignMembers(t),this.notifyValueChanged(),this.validate()}get touched(){return Object.values(this._fields).some(t=>t.touched)}set touched(t){Object.values(this._fields).forEach(e=>{e.touched=t})}get fullValue(){const t=Object.create(null);return Object.entries(this._fields).forEach(([e,i])=>{t[e]=i.fullValue}),A({},t)}notifyValueChanged(){if(this.suppressNotifyValueChanged)return;const t=this.value;if(!c.isEqual(t,this._value)){const e=this._value;this._value=t;const i=this.suppressParentValidityClimb;this.suppressParentValidityClimb=!0;try{this.actions.trigger(V,this,t,e),this.parent&&this.parent.notifyValueChanged()}finally{this.suppressParentValidityClimb=i,this.validate(),this.flushParentValidityClimb()}}}get valid(){return super.valid&&Object.values(this._fields).every(t=>t.valid)}validate(t=!1){if(t){const e=this.suppressValidation;this.suppressValidation=!0;try{Object.values(this._fields).forEach(i=>i.validate(!0))}finally{this.suppressValidation=e}}super.validate(t)}clone(t){var r,a;const e=Object.create(null);Object.entries(this._fields).forEach(([u,d])=>{e[u]=d.clone()});const i=new E(e,U(A({value:(t==null?void 0:t.value)!==void 0?t.value:this.value},t&&"originalValue"in t?{originalValue:t.originalValue}:{}),{enabled:(r=t==null?void 0:t.enabled)!=null?r:this.enabled,visibility:(a=t==null?void 0:t.visibility)!=null?a:this.visibility}));return i.actions=this.actions.clone(),i.actions.triggerEager(i,i.value,i.originalValue),i}}class H extends _{constructor(t,e){super();h(this,"_value",null);h(this,"_itemTemplate");h(this,"_previousValue");if(this._itemTemplate=t,e){const i=e,{value:r,validators:a,actions:u}=i,d=k(i,["value","validators","actions"]);this.registerInitialActions([...a||[],...u||[]]),Object.assign(this,d),r!=null&&this.setValueInternal(r)}this.originalValue===void 0&&(this.originalValue=this.value),this._previousValue=this.value,this.actions.triggerEager(this,this.value,this.originalValue),this.validate()}processSetValueItem(t){let e;return t instanceof E?e=t:this._itemTemplate?e=this._itemTemplate.clone({value:t}):e=E.createFromFormData(t),Object.defineProperty(e,"parent",{get:()=>this,configurable:!1,enumerable:!1}),e}createPaddingItem(){return this.processSetValueItem(this._itemTemplate?this._itemTemplate.clone():null)}setValueInternal(t){t==null?this._value=null:Array.isArray(t)&&(this._value=t.map(e=>this.processSetValueItem(e)))}get value(){var e;const t=(e=this._value)==null?void 0:e.map(i=>i.value);return c.isEmpty(t)?null:t}set value(t){const e=this._previousValue;this.setValueInternal(t);const i=this.value;this._previousValue=i;const r=this.suppressParentValidityClimb;this.suppressParentValidityClimb=!0;try{this.actions.trigger(V,this,i,e),this.parent&&this.parent.notifyValueChanged()}finally{this.suppressParentValidityClimb=r,this.validate(),this.flushParentValidityClimb()}}get touched(){var t;return((t=this._value)==null?void 0:t.some(e=>e.touched))||!1}set touched(t){var e;(e=this._value)==null||e.forEach(i=>{i.touched=t})}clone(t){var i,r,a,u;const e=new H((i=this._itemTemplate)==null?void 0:i.clone(),U(A({value:[...(r=(t==null?void 0:t.value)!==void 0?t.value:this.value)!=null?r:[]]},t&&"originalValue"in t?{originalValue:t.originalValue}:{}),{enabled:(a=t==null?void 0:t.enabled)!=null?a:this.enabled,visibility:(u=t==null?void 0:t.visibility)!=null?u:this.visibility}));return e.actions=this.actions.clone(),e.actions.triggerEager(e,e.value,e.originalValue),e}notifyValueChanged(){const t=this.value;if(!c.isEqual(t,this._previousValue)){const e=this._previousValue;this._previousValue=t;const i=this.suppressParentValidityClimb;this.suppressParentValidityClimb=!0;try{this.actions.trigger(V,this,t,e),this.parent&&this.parent.notifyValueChanged()}finally{this.suppressParentValidityClimb=i,this.validate(),this.flushParentValidityClimb()}}}get valid(){var t,e;return super.valid&&((e=(t=this._value)==null?void 0:t.every(i=>i.valid))!=null?e:!0)}validate(t=!1){var e;if(t){const i=this.suppressValidation;this.suppressValidation=!0;try{(e=this._value)==null||e.forEach(r=>r.validate(!0))}finally{this.suppressValidation=i}}super.validate(t)}get(t){return this._value!=null?this._value[t]:void 0}push(t){var e,i;return this.insert(t,(i=(e=this._value)==null?void 0:e.length)!=null?i:0)+1}pop(){var t,e;return this.remove(((e=(t=this._value)==null?void 0:t.length)!=null?e:0)-1)}remove(t){var i;if(this._value==null||t<0||this._value.length<=t)return;let e=(i=this._value.splice(t,1))==null?void 0:i[0];return e&&(e=e.clone(),this.actions.trigger(Z,this,e,t),this.notifyValueChanged()),e}insert(t,e){this._value==null&&(this._value=[]);const i=e<0?Math.max(this._value.length+e,0):e;for(;this._value.length<i;){const a=this.createPaddingItem(),u=this._value.push(a)-1;this.actions.trigger($,this,a,u)}const r=this.processSetValueItem(t);return this._value.splice(i,0,r),this.actions.trigger($,this,r,i),this.notifyValueChanged(),i}clear(){this._value=null,this.notifyValueChanged()}}class Lt extends b{constructor(t,e,i){let r=!1,a,u;super((p,S,w)=>(a=p,u=S,r||(r=!0,this.otherField.registerAction(new V((B,Q,C,j)=>{Q(B,C,j),this.unregistered||this.execute(w,()=>null,a,u)}))),this.isValidComparison(o.unref(p),o.unref(this.otherField.value))?null:[new m(this.replacePlaceholders(i,{newValue:p,oldValue:S,field:w,otherField:this.otherField}))]));h(this,"otherField");h(this,"isValidComparison");h(this,"unregistered",!1);this.otherField=t,this.isValidComparison=e}unregister(){this.unregistered=!0}}class Rt extends b{constructor(n,t){const e=t||y("Must be one of [**{allowedAsText}**]");let i=n.join(", ");i.length>60&&(i=c.truncate(i,{length:40,separator:", ",omission:`... (${n.length} items total)`}));const r=(a,u,d)=>n.includes(o.unref(a))?null:[new m(this.replacePlaceholders(e,{newValue:a,oldValue:u,field:d,allowedValues:n,allowedAsText:i}))];super(r)}}function Bt(s){return s==null?0:c.isArray(s)||c.isString(s)?s.length:c.isObject(s)&&Object.getPrototypeOf(s)===Object.prototype?Object.keys(s).length:String(s).length}class Ut extends b{constructor(n){const t=n||y("Please enter a value"),e=(i,r,a)=>Bt(o.unref(i))===0?[new m(this.replacePlaceholders(t,{newValue:i,oldValue:r,field:a}))]:null;super(e)}}class kt extends b{constructor(n,t){const e=t||y("Value must be larger or equal to **{minValue}**"),i=(r,a,u)=>r<n||r===void 0?[new m(this.replacePlaceholders(e,{newValue:r,oldValue:a,field:u,minValue:n}))]:null;super(i)}}class Mt extends b{constructor(n,t){const e=t||y("Value must be less than or equal to **{maxValue}**"),i=(r,a,u)=>r>n||r===void 0?[new m(this.replacePlaceholders(e,{newValue:r,oldValue:a,field:u,maxValue:n}))]:null;super(i)}}class Dt extends b{constructor(n,t,e){const i=e||y("Value must be between **{minValue}** and **{maxValue}**"),r=(a,u,d)=>a<n||a>t||a===void 0?[new m(this.replacePlaceholders(i,{newValue:a,oldValue:u,field:d,minValue:n,maxValue:t}))]:null;super(r)}}function et(s){return s==null?0:c.isArray(s)||c.isString(s)?s.length:c.isObject(s)&&Object.getPrototypeOf(s)===Object.prototype?Object.keys(s).length:String(s).length}class qt extends b{constructor(n,t){const e=t||y("Length must be larger or equal to **{minLength}**"),i=(r,a,u)=>et(r)<n?[new m(this.replacePlaceholders(e,{newValue:r,oldValue:a,field:u,minLength:n}))]:null;super(i)}}class $t extends b{constructor(n,t){const e=t||y("Length must be less than or equal to **{maxLength}**"),i=(r,a,u)=>et(r)>n?[new m(this.replacePlaceholders(e,{newValue:r,oldValue:a,field:u,maxLength:n}))]:null;super(i)}}class Ht extends b{constructor(n,t,e){const i=e||y("Length must be between **{minLength}** and **{maxLength}**"),r=(a,u,d)=>{const p=et(a);return p<n||p>t?[new m(this.replacePlaceholders(i,{newValue:a,oldValue:u,field:d,minLength:n,maxLength:t}))]:null};super(r)}}class Qt extends b{constructor(n,t){const e=t||y('Value must match pattern "**{pattern}**"'),i=(r,a,u)=>n.test(String(o.unref(r)))?null:[new m(this.replacePlaceholders(e,{newValue:r,oldValue:a,field:u,pattern:n}))];super(i)}}const ft=Object.freeze(Object.defineProperty({__proto__:null,CompareTo:Lt,InAllowedValues:Rt,LengthInRange:Ht,MaxLength:$t,MaxValue:Mt,MinLength:qt,MinValue:kt,Pattern:Qt,Required:Ut,Validator:b,ValueInRange:Dt},Symbol.toStringTag,{value:"Module"})),Wt=Object.freeze(Object.defineProperty({__proto__:null,AbortEventHandlingException:M,Action:dt,ActionsMap:P,ConditionalEnabledAction:ut,ConditionalStatementAction:O,ConditionalValueAction:ct,ConditionalVisibilityAction:ot,DisplayMode:I,EmptyField:ht,EnabledChangedAction:G,EnabledChangingAction:z,ExecuteAction:K,Field:R,FieldActionBase:v,FieldBase:_,Group:E,List:H,ListItemAddedAction:$,ListItemRemovedAction:Z,MdString:x,MessagesWidget:gt,Operator:g,RenderableValue:lt,Statement:F,ValidChangedAction:X,ValidationError:q,ValidationErrorRenderContent:m,ValidationErrorText:at,Validator:b,Validators:ft,ValueChangedAction:V,VisibilityChangedAction:J,VisibilityChangingAction:Y,buildErrorMessage:y,isCallableFunction:N,isSimpleComponentDef:D},Symbol.toStringTag,{value:"Module"}));l.AbortEventHandlingException=M,l.Action=dt,l.ActionsMap=P,l.ConditionalEnabledAction=ut,l.ConditionalStatementAction=O,l.ConditionalValueAction=ct,l.ConditionalVisibilityAction=ot,l.DisplayMode=I,l.EmptyField=ht,l.EnabledChangedAction=G,l.EnabledChangingAction=z,l.ExecuteAction=K,l.Field=R,l.FieldActionBase=v,l.FieldBase=_,l.Group=E,l.List=H,l.ListItemAddedAction=$,l.ListItemRemovedAction=Z,l.MdString=x,l.MessagesWidget=gt,l.Operator=g,l.RenderableValue=lt,l.Statement=F,l.ValidChangedAction=X,l.ValidationError=q,l.ValidationErrorRenderContent=m,l.ValidationErrorText=at,l.Validator=b,l.Validators=ft,l.ValueChangedAction=V,l.VisibilityChangedAction=J,l.VisibilityChangingAction=Y,l.buildErrorMessage=y,l.default=Wt,l.forms=_t,l.isCallableFunction=N,l.isSimpleComponentDef=D,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(o,u){typeof exports=="object"&&typeof module!="undefined"?u(exports,require("lodash"),require("vue")):typeof define=="function"&&define.amd?define(["exports","lodash","vue"],u):(o=typeof globalThis!="undefined"?globalThis:o||self,u(o.DynamicFormsVueForms={},o._,o.Vue))})(this,(function(o,u,c){"use strict";var Fe=Object.defineProperty,Pe=Object.defineProperties;var Ne=Object.getOwnPropertyDescriptors;var tt=Object.getOwnPropertySymbols;var Ht=Object.prototype.hasOwnProperty,Qt=Object.prototype.propertyIsEnumerable;var Xt=o=>{throw TypeError(o)};var mt=(o,u,c)=>u in o?Fe(o,u,{enumerable:!0,configurable:!0,writable:!0,value:c}):o[u]=c,V=(o,u)=>{for(var c in u||(u={}))Ht.call(u,c)&&mt(o,c,u[c]);if(tt)for(var c of tt(u))Qt.call(u,c)&&mt(o,c,u[c]);return o},_=(o,u)=>Pe(o,Ne(u));var H=(o,u)=>{var c={};for(var v in o)Ht.call(o,v)&&u.indexOf(v)<0&&(c[v]=o[v]);if(o!=null&&tt)for(var v of tt(o))u.indexOf(v)<0&&Qt.call(o,v)&&(c[v]=o[v]);return c};var p=(o,u,c)=>mt(o,typeof u!="symbol"?u+"":u,c),Gt=(o,u,c)=>u.has(o)||Xt("Cannot "+c);var h=(o,u,c)=>(Gt(o,u,"read from private field"),c?c.call(o):u.get(o)),bt=(o,u,c)=>u.has(o)?Xt("Cannot add the same private member more than once"):u instanceof WeakSet?u.add(o):u.set(o,c),vt=(o,u,c,v)=>(Gt(o,u,"write to private field"),v?v.call(o,c):u.set(o,c),c);var Yt=(o,u,c)=>new Promise((v,U)=>{var Q=S=>{try{y(c.next(S))}catch(x){U(x)}},T=S=>{try{y(c.throw(S))}catch(x){U(x)}},y=S=>S.done?v(S.value):Promise.resolve(S.value).then(Q,T);y((c=c.apply(o,u)).next())});var g,b;var v=(r=>(r[r.SUPPRESS=1]="SUPPRESS",r[r.HIDDEN=5]="HIDDEN",r[r.INVISIBLE=8]="INVISIBLE",r[r.FULL=10]="FULL",r))(v||{});const U=10,Q=new Set(Object.values(v).filter(r=>typeof r=="number"));(r=>{function i(s){return s.toUpperCase()==="SUPPRESS"?1:s.toUpperCase()==="HIDDEN"?5:s.toUpperCase()==="INVISIBLE"?8:U}r.fromString=i;function t(s){const n=typeof s=="number"?s:r.fromString(s);return Q.has(n)?n:U}r.fromAny=t;function e(s){const n=typeof s=="number"?s:r.fromString(s);return Q.has(n)}r.isDefined=e})(v||(v={})),Object.freeze(v);const T=v;class y{constructor(i){p(this,"executorFn");p(this,"states",new WeakMap);this.executorFn=i}static get classIdentifier(){throw new Error("classIdentifier must be declared")}get classIdentifier(){return this.constructor.classIdentifier}state(i,t){return this.states.has(i)||this.states.set(i,t()),this.states.get(i)}execute(i,t,...e){return this.executorFn(i,t,...e)}get eager(){return!1}boundToBinding(i){}unregisterFrom(i){}}class S extends Error{}const x=Symbol("ValueChangedAction");class N extends y{constructor(i){super(i)}static get classIdentifier(){return x}execute(i,t,e,s){return super.execute(i,t,e,s)}}const X=Symbol("Transaction.capture"),Vt=Symbol("Transaction.restore"),wt=Symbol("Transaction.announceValue"),yt=Symbol("Transaction.settleValidity");function ke(r){return r}function Ct(r){let i=0,t=r.parent;for(;t;)i++,t=t.parent;return i}class Jt{constructor(){p(this,"participants",new Map);p(this,"deferred",[]);p(this,"undo",[]);p(this,"unwound",!1);p(this,"passDepth",-1);p(this,"restartPass",!1)}get rolledBack(){return this.unwound}participant(i){let t=this.participants.get(i);return t||(t={element:i,valueDirty:!1,forceValue:!1,validityDirty:!1},this.participants.set(i,t)),t}touch(i){const t=this.participant(i);t.snapshot||(t.snapshot=i[X]())}markValueChanged(i,t){const e=this.participant(i);e.valueDirty=!0,t&&(e.forceValue=!0),this.noteDepth(i)}markValidityDirty(i){this.participant(i).validityDirty=!0,this.noteDepth(i)}recordStructural(i,t){var s;const e=this.participant(i);((s=e.structural)!=null?s:e.structural=[]).push(t),this.noteDepth(i)}willAnnounceValue(i){var t,e;return(e=(t=this.participants.get(i))==null?void 0:t.valueDirty)!=null?e:!1}whenCommitted(i){this.deferred.push(i)}whenRolledBack(i){this.undo.push(i)}noteDepth(i){this.passDepth<0||Ct(i)>=this.passDepth&&(this.restartPass=!0)}rollback(){this.unwound=!0,[...this.participants.values()].reverse().forEach(t=>{t.snapshot&&t.element[Vt](t.snapshot)}),this.participants.clear();for(let t=this.undo.length-1;t>=0;t--)this.undo[t]();this.undo.length=0,this.deferred.length=0}commit(){for(;!(!this.announceValues()&&!this.settleValidity()););this.deferred.splice(0).forEach(t=>t())}buckets(i){const t=[];return this.participants.forEach(e=>{var n;if(!i(e))return;const s=Ct(e.element);((n=t[s])!=null?n:t[s]=[]).push(e)}),t}pass(i,t){const e=this.buckets(i);if(!e.length)return!1;for(let s=e.length-1;s>=0;s--){const n=e[s];if(n){this.passDepth=s,this.restartPass=!1;try{for(let a=0;a<n.length;a++){if(this.restartPass)return!0;const l=n[a];i(l)&&t(l)}}finally{this.passDepth=-1}if(this.restartPass)return!0}}return!0}announceValues(){return this.pass(i=>i.valueDirty||i.structural!==void 0,i=>{const{structural:t}=i,e=i.valueDirty,s=i.forceValue;i.structural=void 0,i.valueDirty=!1,i.forceValue=!1,i.element[wt](this,e,s,t)})}settleValidity(){return this.pass(i=>i.validityDirty,i=>{i.validityDirty=!1,i.element[yt](this)})}}let k,et;function Et(){return k}class St{}class Kt{constructor(){p(this,"open",!0)}rollback(){throw this.open?new St:new TypeError("this transaction handle is spent: the transaction that handed it out has closed. A handle is only usable inside the call that received it.")}close(){this.open=!1}}function At(r){if(r!=null&&typeof r.then=="function")throw new TypeError("a transaction may not be asynchronous: the callback returned a thenable. Do the awaiting outside and open a transaction for each synchronous part.")}function G(r){if(k){const e=r(et);return At(e),e}const i=new Jt,t=new Kt;k=i,et=t;try{const e=r(t);return At(e),i.commit(),e}catch(e){if(i.rollback(),e instanceof St)return;throw e}finally{k=void 0,et=void 0,t.close()}}function m(r){return k?r(k):G(()=>r(k))}const It={useMarkdownInValidators:!0};function Zt(){return It}function te(r){Object.assign(It,r)}const ee={install(r,i){i&&te(i)}};class D extends String{constructor(t,e,s){super(t);p(this,"plugins");p(this,"options");this.plugins=s,this.options=e}}function Y(r){const i=c.unref(r);return typeof i=="object"&&"componentName"in i}function q(r){return typeof c.unref(r)=="function"}class J{get componentName(){return"Comment"}get componentBindings(){return{}}get componentBody(){return""}get extraClasses(){return""}}class _t extends J{constructor(t,e=""){super();p(this,"text");p(this,"classes");this.text=t,this.classes=e}get componentName(){return"template"}get componentBody(){return this.text}get extraClasses(){return this.classes}}class E extends J{constructor(t,e=""){super();p(this,"classes");p(this,"text");p(this,"textType");this.classes=e,this.text=t,this.textType=c.computed(()=>this.getTextType)}get resolvedText(){const t=c.unref(this.text);return q(t)?t():t}get getTextType(){const t=this.resolvedText;return t?t instanceof D?"md":Y(t)?"component":"string":"string"}get componentName(){switch(c.unref(this.textType)){case"string":return"template";case"md":return"vue-markdown";case"component":return this.resolvedText.componentName;default:return"template"}}get componentBindings(){switch(c.unref(this.textType)){case"string":return{};case"md":{const t=this.resolvedText;return{source:t.toString(),options:t.options,plugins:t.plugins}}case"component":return this.resolvedText.componentProps||{};default:return{}}}get componentBody(){switch(c.unref(this.textType)){case"string":return this.resolvedText;case"component":return this.resolvedText.componentVHtml||"";default:return""}}get extraClasses(){return this.classes}}class Tt extends E{}function A(r){return Zt().useMarkdownInValidators?new D(r):r.replace(/[*_~`]/g,"").replace(/!\[(.*?)\]\(.*?\)/g,"$1").replace(/\[(.*?)\]\((.*?)\)/g,"$1").replace(/#+\s?/g,"").replace(/>\s?/g,"").replace(/(\*|-|\d+\.)\s+/g,"").replace(/`{3}[\s\S]*?`{3}/g,"").replace(/`([^`]+)`/g,"$1").replace(/\n{2,}/g,`
|
|
2
|
+
`)}const ie=Symbol("Validator"),se=()=>A("Validation could not be completed");class C extends N{constructor(t){super((s,n,a,l)=>{const d=this.bindingState(s),f=++d.run,F=s.validationEpoch,gt=Et(),qt=()=>d.run===f&&s.validationEpoch===F&&!(gt!=null&>.rolledBack),ft=t(a,l,s)||[],pt=P=>G(()=>{var Wt;const Z=(Wt=P==null?void 0:P.map(M=>this.claim(M)))!=null?Wt:[];for(let M=s.errors.length-1;M>=0;M--){const $t=s.errors[M];if($t.source===this.source){const zt=Z.findIndex(je=>u.isEqual(je,$t));zt>=0?Z.splice(zt,1):s.errors.splice(M,1)}}Z.length>0&&s.errors.push(...Z),s.validate()});return ft instanceof Promise?(s.beginValidating(),ft.then(P=>{qt()&&pt(P)},P=>{qt()&&(pt([new E(se())]),console.error("Validation failed",P))}).finally(()=>s.endValidating()).catch(P=>console.error("Validation failed",P))):pt(ft),n(s,a,l)});p(this,"source");this.source=Symbol(this.constructor.name)}claim(t){const e=t.source;if(e===this.source)return t;const s={value:this.source,enumerable:!1,configurable:!1};if(e===void 0)return Object.defineProperty(t,"source",s),t;const n=Object.getOwnPropertyDescriptors(t);return Object.create(Object.getPrototypeOf(t),_(V({},n),{source:s}))}static get classIdentifier(){return ie}get eager(){return!0}bindingState(t){return this.state(t,()=>this.newBindingState())}newBindingState(){return{run:0}}replacePlaceholdersFunction(t,e){return()=>{let s=c.unref(t);for(;q(s);)s=c.unref(this.replacePlaceholders(s(),e));return s}}replacePlaceholders(t,e){if(q(t))return this.replacePlaceholdersFunction(t,e);if(Y(t))return t;if(c.isRef(t))return this.replacePlaceholdersFunction(()=>c.unref(t),e);let s=c.unref(t);return Object.keys(e).forEach(n=>{s=s.replaceAll(`{${n}}`,e[n])}),t instanceof D?new D(s.toString(),t.options,t.plugins):s}}class L extends Map{constructor(){super(...arguments);p(this,"eagerActions",new Set);p(this,"registeredActions",[])}register(t){if(!(t instanceof y))throw new Error("Invalid action type");this.registeredActions.push(t);const e=t.classIdentifier,s=this.get(e)||(()=>null);function n(a,...l){return t.execute(a,s,...l)}this.set(e,n),t.eager&&this.eagerActions.add(t.classIdentifier)}willTrigger(t){return this.has(t)?!0:t===x&&this.eagerActions.size>0}trigger(t,e,...s){const n=t.classIdentifier;return n===x&&this.triggerEager(e,...s),this.triggerChain(n,e,...s)}triggerChain(t,e,...s){const n=this.get(t);try{if(n)return n(e,...s)}catch(a){if(!(a instanceof S))throw a}return null}triggerEager(t,...e){for(const s of this.eagerActions){const n=this.get(s);try{n&&n(t,...e)}catch(a){if(!(a instanceof S))throw a}}}get validators(){return this.registeredActions.filter(t=>t instanceof C)}clone(){const t=new L;return this.registeredActions.forEach(e=>t.register(e)),t}bindTo(t){this.registeredActions.forEach(e=>e.boundToBinding(t))}cloneWithoutValidators(){const t=new L;return this.registeredActions.forEach(e=>{e instanceof C||t.register(e)}),t}}function R(r){let i=r;for(;i.fieldName!==void 0&&i.parent;)i=i.parent;return i}function ne(r){const i=[];let t=r;for(;t.fieldName!==void 0&&t.parent;)i.unshift(t.fieldName),t=t.parent;return i}function it(r,i){var e,s;let t=i;for(const n of ne(r))if(t=(s=(e=t.field)==null?void 0:e.call(t,n))!=null?s:void 0,!t)break;return(t==null?void 0:t.declaration)===r?t:R(r)===R(i.declaration)?void 0:r}function xt(r,i){const t=it(r,i);if(!t)return[];if(t!==r)return[t];const e=i.bindingsOf(r);return e.length>0?e:[r]}function re(r,i){var e;let t=i.parent;for(;t;){const s=(e=t.field)==null?void 0:e.call(t,r);if(s)return s;t=t.parent}}const ae=Symbol("ConditionalStatementAction");class W extends N{constructor(t,e){super((n,a,l,d)=>(this.applyIn(R(n))||n.markRecordIncomplete(),a(n,l,d)));p(this,"statement");p(this,"conditionalExecutor");p(this,"declarations",new Set);p(this,"registrations",new WeakSet);this.statement=t,this.conditionalExecutor=e;const s=new N((n,a,...l)=>(this.applyFrom(n),a(n,...l)));t.collectFields().forEach(n=>n.registerAction(s))}static get classIdentifier(){return ae}get eager(){return!0}boundToBinding(t){this.declarations.add(t.declaration),this.registrations.add(t)}targetsIn(t){const e=[];return this.declarations.forEach(s=>xt(s,t).forEach(n=>{this.registrations.has(n)&&e.push(n)})),e}applyIn(t){const e=this.targetsIn(t);if(e.length===0)return!1;const s=this.state(t,()=>({lastResult:void 0})),n=this.statement.evaluate(t);if(n===s.lastResult)return!0;const a=s.lastResult;return s.lastResult=n,e.forEach(l=>this.conditionalExecutor(l,n,a)),!0}applyFrom(t){const e=new Set;this.targetsIn(R(t)).forEach(s=>e.add(R(s))),e.forEach(s=>this.applyIn(s))}}class Ot extends W{constructor(i){super(i,(t,e)=>{t.visibility=e?T.FULL:T.SUPPRESS})}}class jt extends W{constructor(i){super(i,(t,e)=>{t.enabled=e})}}class Ft extends W{constructor(i,t){super(i,(e,s)=>{s&&(e.value=t)})}}var $=(r=>(r[r.NOT=0]="NOT",r[r.OR=1]="OR",r[r.AND=2]="AND",r[r.XOR=3]="XOR",r[r.NAND=4]="NAND",r[r.NOR=5]="NOR",r[r.EQUALS=-1]="EQUALS",r[r.NOT_EQUALS=-2]="NOT_EQUALS",r[r.GT=-3]="GT",r[r.LT=-4]="LT",r[r.GE=-5]="GE",r[r.LE=-6]="LE",r[r.IN=-7]="IN",r[r.NOT_IN=-8]="NOT_IN",r[r.INCLUDES=-9]="INCLUDES",r[r.NOT_INCLUDES=-10]="NOT_INCLUDES",r))($||{});(r=>{function i(n){const a=n.toLowerCase();if(a==="not")return 0;if(a==="or")return 1;if(a==="and")return 2;if(a==="xor")return 3;if(a==="nand")return 4;if(a==="nor")return 5;if(a==="equals")return-1;if(["not_equals","not-equals","not equals"].includes(a))return-2;if(a==="gt")return-3;if(a==="lt")return-4;if(a==="ge")return-5;if(a==="le")return-6;if(a==="in")return-7;if(["not_in","not-in","not in"].includes(a))return-8;if(a==="includes")return-9;if(["not_includes","not-includes","not includes"].includes(a))return-10;throw new Error(`Unrecognised operator ${a}`)}r.fromString=i;function t(n){const a=typeof n=="number"?n:r.fromString(n);if(Object.values(r).includes(a))return a;throw new Error(`Unrecognised operator ${n}`)}r.fromAny=t;function e(n){const a=typeof n=="number"?n:r.fromString(n);return Object.values(r).includes(a)}r.isDefined=e;function s(n){return n>=0}r.isLogicOperator=s})($||($={})),Object.freeze($);const w=$,oe=Symbol("EnabledChangingAction");class st extends y{constructor(i){super(i)}static get classIdentifier(){return oe}execute(i,t,e,s){return super.execute(i,t,e,s)}}const le=Symbol("EnabledChangedAction");class nt extends y{constructor(i){super(i)}static get classIdentifier(){return le}execute(i,t,e,s){return super.execute(i,t,e,s)}}const ce=Symbol("ValidChangedAction");class rt extends y{constructor(i){super(i)}static get classIdentifier(){return ce}execute(i,t,e,s){return super.execute(i,t,e,s)}}const ue=Symbol("VisibilityChangingAction");class at extends y{constructor(i){super(i)}static get classIdentifier(){return ue}execute(i,t,e,s){return super.execute(i,t,e,s)}}const he=Symbol("VisibilityChangedAction");class ot extends y{constructor(i){super(i)}static get classIdentifier(){return he}execute(i,t,e,s){return super.execute(i,t,e,s)}}const Pt=new WeakMap,Nt=new Set(["validators","actions"]);let lt=0;class O{constructor(i){bt(this,g);bt(this,b);vt(this,b,i),vt(this,g,c.reactive(i))}get __v_skip(){return!0}get __v_isReactive(){return!0}get state(){return h(this,g)}get raw(){return h(this,b)}rebind(i){return m(t=>{t.touch(this);const e=t.willAnnounceValue(this),s=h(this,b).announcedValue;this.resetTo(this.declaration,i),h(this,b).announcedValue=e?s:this.value}),this}get originalValue(){return h(this,g).originalValue}set originalValue(i){this.touchState(),h(this,g).originalValue=i}get extra(){return h(this,g).extra}setExtendedValues(i){this.touchState(),h(this,g).extra=Object.freeze(V(V({},h(this,b).extra),i))}extendedOf(i){const t=Object.create(null);return Object.entries(i).forEach(([e,s])=>{Nt.has(e)||(!(e in this)||Object.hasOwn(Object.prototype,e))&&(t[e]=s)}),t}assignParams(i){const t=this.extendedOf(i);Object.entries(i).forEach(([e,s])=>{Object.hasOwn(t,e)||Nt.has(e)||(this[e]=s)}),u.isEmpty(t)||this.setExtendedValues(t)}touchState(){var i;(i=Et())==null||i.touch(this)}[X](){return _(V({},h(this,b)),{errors:[...h(this,b).errors]})}[Vt](i){const t=h(this,b).validatingCount;Object.assign(h(this,g),i),h(this,g).validatingCount=t}get validating(){return h(this,g).validatingCount>0}beginValidating(){h(this,g).validatingCount++}endValidating(){h(this,g).validatingCount=Math.max(0,h(this,g).validatingCount-1)}get errors(){return this.touchState(),h(this,g).errors}set errors(i){this.touchState(),h(this,g).errors=i}get parent(){return h(this,g).parent}get fieldName(){return h(this,g).fieldName}get declaration(){var i;return(i=h(this,b).declaration)!=null?i:this}get members(){return[]}bindingsOf(i){const t=i.declaration,e=[],s=n=>{n.declaration===t&&e.push(n),n.members.forEach(s)};return s(this),e}markRecordIncomplete(){this._recordPending||(this._recordPending=!0,lt++)}completeRecords(i=this){lt!==0&&m(()=>{const t=e=>{e._recordPending&&(e._recordPending=!1,lt--,e.rerunEagerActions()),e.members.forEach(t)};t(i)})}rerunEagerActions(){m(i=>{var t;(t=this._actions)==null||t.triggerEager(this,this.value,this.value),i.markValidityDirty(this)})}get actions(){return this._actions||(this._actions=new L),this._actions}set actions(i){this._actions=i}get valueVersion(){return h(this,g).valueVersion}bumpValueVersion(){m(i=>{i.touch(this),h(this,g).valueVersion++;let t=this.parent;for(;t;)i.touch(t),h(t,g).valueVersion++,t=t.parent})}propagateValueChanged(i=!1){m(t=>{var e;t.markValueChanged(this,i),t.markValidityDirty(this),(e=this.parent)==null||e.notifyValueChanged()})}refreshPreviousValue(){}get countedValid(){return h(this,b).errors.length===0&&h(this,b).invalidChildren===0}takeChild(i,t){m(e=>{if(i.parent)throw new TypeError("This element already belongs to a container - pass a bind() of it");e.touch(i),h(i,g).fieldName=t,h(i,g).parent=this,this.adoptChild(i)})}adoptChild(i){m(t=>{t.touch(this),h(i,b).valid||h(this,b).invalidChildren++,t.markValidityDirty(this)})}releaseChild(i){m(t=>{t.touch(this),t.touch(i),h(i,b).valid||h(this,b).invalidChildren--,h(i,g).parent=void 0,t.markValidityDirty(this)})}resetTo(i,t){m(()=>{const e=t===void 0?i.value:t,s=this.errors.length>0;s&&(this.errors=[]),this.touched=!1;const n=this.enabled&&this.value!==e;this.value=e,this.originalValue=this.value,this.validate(!n&&s)})}resetChild(i,t,e){i.resetTo(t,e)}childValidityChanged(i){h(this,b).invalidChildren+=i?-1:1}get validRead(){let i=Pt.get(this);return i||(i=c.computed(()=>this.composeValid()),Pt.set(this,i)),i.value}composeValid(){return h(this,g).errors.length===0}get visibility(){return h(this,g).visibility}set visibility(i){m(t=>{var n,a;const e=h(this,g).visibility,s=(n=this._actions)==null?void 0:n.trigger(at,this,i,e);if(!T.isDefined(s!=null?s:i))throw new Error("visibility must be a DisplayMode constant");t.touch(this),h(this,g).visibility=T.fromAny(s!=null?s:i),(a=this._actions)==null||a.trigger(ot,this,h(this,g).visibility,e)})}get enabled(){return h(this,g).enabled}set enabled(i){m(t=>{var n,a;const e=h(this,g).enabled,s=(n=this._actions)==null?void 0:n.trigger(st,this,i,e);if(!u.isBoolean(s!=null?s:i))throw new Error("Enabled value must be boolean");t.touch(this),h(this,g).enabled=s!=null?s:i,h(this,g).enabled!==e&&this.bumpValueVersion(),(a=this._actions)==null||a.trigger(nt,this,h(this,g).enabled,e)})}get composesValue(){return!1}[wt](i,t,e,s){if(s==null||s.forEach(d=>{var f;return(f=this._actions)==null?void 0:f.trigger(d.actionClass,this,d.item,d.index)}),!t)return;const n=this._actions;if(this.composesValue&&!(n!=null&&n.willTrigger(x)))return;const a=this.value,l=h(this,b).announcedValue;!e&&(this.composesValue?u.isEqual(a,l):a===l)||(i.touch(this),h(this,b).announcedValue=a,this.composesValue?n==null||n.trigger(N,this,a,l):n==null||n.triggerChain(x,this,a,l))}[yt](i){var n;const t=h(this,b).valid,e=this.countedValid;if(e===t)return;i.touch(this),h(this,b).valid=e;const s=this.parent;s&&(i.touch(s),s.childValidityChanged(e),i.markValidityDirty(s)),(n=this._actions)==null||n.trigger(rt,this,e,t)}validate(i=!1){m(t=>{var e;i&&((e=this._actions)==null||e.triggerEager(this,this.value,this.value)),t.markValidityDirty(this)})}get valid(){return h(this,g).errors.length===0}get fullValue(){return this.value}get isChanged(){return!u.isEqual(this.value,this.originalValue)}boundFrom(i,t,e,s){h(this,b).declaration=i.declaration;const n=V(V({},i.extra),s&&this.extendedOf(s));u.isEmpty(n)||this.setExtendedValues(n);const a=i._actions;a&&(this._actions=a.clone(),this._actions.bindTo(this),this._actions.triggerEager(this,t,e))}registerInitialActions(i){i.forEach(t=>{this.actions.register(t),t.boundToBinding(this)})}registerAction(i){return m(t=>{t.willAnnounceValue(this)||this.refreshPreviousValue(),this.actions.register(i),i.boundToBinding(this),i.eager&&this.actions.trigger(Object.getPrototypeOf(i).constructor,this,this.value,this.originalValue)}),this}triggerAction(i,...t){return this._actions?this._actions.trigger(i,this,...t):null}get validationEpoch(){return h(this,g).validationEpoch}clearValidators(){m(i=>{if(i.touch(this),h(this,g).validationEpoch++,this._actions){const t=this._actions,e=t.validators;i.whenRolledBack(()=>{this._actions=t}),this.actions=t.cloneWithoutValidators(),i.whenCommitted(()=>e.forEach(s=>s.unregisterFrom(this)))}this.errors=[],this.validate()})}}g=new WeakMap,b=new WeakMap;function de(r,i){return r?!i:i}class j{constructor(i,t,e){p(this,"operand1");p(this,"operator");p(this,"operand2");this.operand1=i,this.operator=t,this.operand2=e}static valueOf(i,t){if(i instanceof j)return i.evaluate(t);if(i instanceof O){const e=t?it(i,t):i;return e?c.unref(e.value):void 0}return i}get operand1Value(){return j.valueOf(this.operand1)}get operand2Value(){return j.valueOf(this.operand2)}evaluate(i){var s,n;const t=j.valueOf(this.operand1,i),e=j.valueOf(this.operand2,i);switch(this.operator){case w.AND:return!!(t&&e);case w.OR:return!!(t||e);case w.NAND:return!(t&&e);case w.NOR:return!(t||e);case w.XOR:return de(!!t,!!e);case w.NOT:return!t;case w.EQUALS:return t==e;case w.NOT_EQUALS:return t!=e;case w.LT:return t<e;case w.LE:return t<=e;case w.GE:return t>=e;case w.GT:return t>e;case w.IN:return!!((s=e==null?void 0:e.includes)!=null&&s.call(e,t));case w.NOT_IN:return!((n=e==null?void 0:e.includes)!=null&&n.call(e,t));case w.INCLUDES:return u.isString(t)&&u.isString(e)&&t.indexOf(e)>=0;case w.NOT_INCLUDES:return!(u.isString(t)&&u.isString(e)&&t.indexOf(e)>=0);default:throw new Error(`Operator not implemented ${this.operator}`)}}collectFields(){const i=new Set;function t(e){e instanceof O?i.add(e):e instanceof j&&e.collectFields().forEach(n=>i.add(n))}return t(this.operand1),t(this.operand2),i}}const ge=Symbol("ExecuteAction");class ct extends y{constructor(i){super(i)}static get classIdentifier(){return ge}execute(i,t,e){return super.execute(i,t,e)}}const fe=Symbol("ListItemAddedAction");class K extends y{constructor(i){super(i)}static get classIdentifier(){return fe}execute(i,t,e,s){return super.execute(i,t,e,s)}}const pe=Symbol("ListItemRemovedAction");class ut extends y{constructor(i){super(i)}static get classIdentifier(){return pe}execute(i,t,e,s){return super.execute(i,t,e,s)}}const me=Object.freeze({});function kt(){return{originalValue:void 0,announcedValue:void 0,errors:[],visibility:T.FULL,enabled:!0,valueVersion:0,validatingCount:0,parent:void 0,fieldName:void 0,validationEpoch:0,declaration:void 0,extra:me,valid:!0,invalidChildren:0}}function be(){return _(V({},kt()),{value:void 0,touched:!1})}function Rt(){return _(V({},kt()),{announcedValue:null,cachedValue:null,cachedValueVersion:-1})}function ve(){return _(V({},Rt()),{rows:null})}class z extends O{get state(){return super.state}get raw(){return super.raw}get _value(){return this.state.value}set _value(i){this.state.value=i}constructor(i){super(be()),this.init(i)}init(i){m(()=>{var e;if(i){const t=i,{value:s,validators:n,actions:a}=t,l=H(t,["value","validators","actions"]);this.registerInitialActions([...n||[],...a||[]]),this.assignParams(l),this._value=s!==void 0?s:this.originalValue,this.originalValue===void 0&&(this.originalValue=this._value)}this.raw.announcedValue=this._value,(e=this._actions)==null||e.triggerEager(this,this.value,this.originalValue),this.validate()})}get value(){return this._value}set value(i){const t=this._value;!this.enabled||t===i||m(e=>{var s;e.touch(this),this._value=i,this.bumpValueVersion(),(s=this._actions)==null||s.triggerEager(this,i,t),this.propagateValueChanged()})}get touched(){return this.state.touched}set touched(i){this.touchState(),this.state.touched=i}bind(i,t){var n,a;const e=this.constructor,s=new e(_(V({value:i!==void 0?i:this.value},t&&"originalValue"in t?{originalValue:t.originalValue}:{}),{enabled:(n=t==null?void 0:t.enabled)!=null?n:this.enabled,visibility:(a=t==null?void 0:t.visibility)!=null?a:this.visibility}));return s.boundFrom(this,s.value,s.originalValue,t),s}}const Dt=new z({value:"EmptyField"}).registerAction(new N(()=>{console.warn("Working with EmptyField! This should not happen")})),Lt=new WeakMap;function ht(r,i){return(r==null?void 0:r.label)==null&&(r==null?void 0:r.icon)==null?i:r}class Bt extends z{init(i){m(()=>{var e;if(this._value={label:void 0,icon:void 0},i){const t=i,{value:s,originalValue:n,validators:a,actions:l}=t,d=H(t,["value","originalValue","validators","actions"]);this.registerInitialActions([...a||[],...l||[]]),this.assignParams(d);const f=ht(s,this._value),F=Object.freeze({label:n==null?void 0:n.label,icon:n==null?void 0:n.icon});this._value=ht(f,V({},F)),this.originalValue=ht(F,f)}this.raw.announcedValue=this._value,(e=this._actions)==null||e.triggerEager(this,this.value,this.originalValue),this.validate()})}valueWith(i,t){const e=V({},this.value);return t===void 0?delete e[i]:e[i]=t,e}get icon(){return this.value.icon}set icon(i){this.value.icon!==i&&(this.value=this.valueWith("icon",i))}get label(){return this.value.label}set label(i){this.value.label!==i&&(this.value=this.valueWith("label",i))}get busyRuns(){let i=Lt.get(this);return i||(i=c.ref(0),Lt.set(this,i)),i}get busy(){return this.busyRuns.value>0}execute(i){return Yt(this,null,function*(){const t=this.busyRuns;t.value++;try{return yield this.triggerAction(ct,i)}finally{t.value--}})}}const Mt=c.defineComponent({__name:"messages-widget",props:{message:{},classes:{}},setup(r){const i=r,t=c.resolveComponent("vue-markdown"),e=new Set(["div","span","p","h1","h2","h3","h4","h5","h6","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","em","strong","small","mark","del","ins","sub","sup","i","b","u","s","a","img","button","input","textarea","select","option","label","form","table","tr","td","th","thead","tbody","tfoot","ul","ol","li","dl","dt","dd"]),s=()=>{if(typeof i.message=="string")return c.h("span",{class:i.classes},i.message);const n=[];return i.message.forEach(a=>{switch(a.componentName){case"template":n.push(c.h("div",{class:[i.classes,a.extraClasses]},a.componentBody));break;case"vue-markdown":if(typeof t=="string")console.warn("You are using markdown for messages-widget, but you haven't registered a vue-markdown component"),n.push(c.h("div",{class:[i.classes,a.extraClasses]},a.componentBindings.source));else{const l=a.componentBindings;n.push(c.h(t,{class:[i.classes,a.extraClasses,"df-messages-widget-markdown"],source:l.source,options:l.options,plugins:l.plugins}))}break;default:n.push(c.h(e.has(a.componentName.toLowerCase())?a.componentName:c.resolveComponent(a.componentName),V(V({class:[i.classes,a.extraClasses]},a.componentBindings),a.componentBody?{innerHTML:a.componentBody}:{})));break}}),n};return(n,a)=>(c.openBlock(),c.createBlock(s))}});class I extends O{constructor(t,e){super(Rt());p(this,"_fields");if(!I.isValidFields(t))throw new Error("Invalid fields object provided");this._fields=Object.create(null),m(()=>{var a;if(Object.entries(t).forEach(([l,d])=>this.addField(l,d)),e){const n=e,{value:l,validators:d,actions:f}=n,F=H(n,["value","validators","actions"]);this.registerInitialActions([...d||[],...f||[]]),this.assignParams(F),l!==void 0?this.assignMembers(l):this.originalValue!==void 0&&this.assignMembers(this.originalValue)}this.completeRecords();const s=this.value;this.originalValue===void 0&&(this.originalValue=I.baseline(s)),this.raw.announcedValue=s,(a=this._actions)==null||a.triggerEager(this,s,this.originalValue),this.validate()})}get state(){return super.state}get raw(){return super.raw}static baseline(t){return t==null?t:V({},t)}addField(t,e){if(Object.hasOwn(this._fields,t))throw new Error(`Field ${t} is already in this form`);this.takeChild(e,t),Object.defineProperty(this._fields,t,{get:()=>e,configurable:!1,enumerable:!0})}static isValidFields(t){function e(s){return s instanceof O}return typeof t=="object"&&t!==null&&Object.entries(t).every(([,s])=>e(s))}static createFromFormData(t){if(t instanceof O)throw new Error("data is already a Form structure, should be a simple object");return new I(t==null?{}:Object.fromEntries(Object.entries(t).map(([e,s])=>[e,new z({value:s})])))}field(t){var e;return(e=this._fields[t])!=null?e:null}get fields(){return this._fields}get members(){return Object.values(this._fields)}get value(){const t=this.valueVersion;if(this.raw.cachedValueVersion===t)return this.raw.cachedValue;const e=Object.create(null);Object.entries(this._fields).forEach(([n,a])=>{const l=a.value;(a.enabled||a instanceof I&&!u.isEmpty(l))&&(e[n]=l)});const s=u.isEmpty(e)?null:Object.freeze(V({},e));return this.raw.cachedValue=s,this.raw.cachedValueVersion=t,s}assignMembers(t){m(()=>{Object.entries(this._fields).forEach(([e,s])=>{(t==null||Object.hasOwn(t,e))&&(s.value=t==null?null:t[e])})})}set value(t){m(e=>{this.assignMembers(t),e.markValidityDirty(this)})}resetTo(t,e){const s=t;m(n=>{n.touch(this),this.errors.length&&(this.errors=[]),Object.entries(this._fields).forEach(([l,d])=>{var F;let f;e===null?f=null:e!==void 0&&Object.hasOwn(e,l)&&(f=e[l]),this.resetChild(d,(F=s.field(l))!=null?F:d,f)});const a=this.value;this.raw.announcedValue=a,this.originalValue=I.baseline(a),super.validate(!0)})}get touched(){return Object.values(this._fields).some(t=>t.touched)}set touched(t){m(()=>{Object.values(this._fields).forEach(e=>{e.touched=t})})}get fullValue(){const t=Object.create(null);return Object.entries(this._fields).forEach(([e,s])=>{t[e]=s.fullValue}),V({},t)}notifyValueChanged(){this.propagateValueChanged()}get composesValue(){return!0}refreshPreviousValue(){this.raw.announcedValue=this.value}get valid(){return this.validRead}composeValid(){return this.state.errors.length===0&&Object.values(this._fields).every(t=>t.valid)}validate(t=!1){m(()=>{t&&Object.values(this._fields).forEach(e=>e.validate(!0)),super.validate(t)})}bind(t,e){var a,l;const s=Object.create(null);Object.entries(this._fields).forEach(([d,f])=>{s[d]=f.bind()});const n=new I(s,_(V({value:t!==void 0?t:this.value},e&&"originalValue"in e?{originalValue:e.originalValue}:{}),{enabled:(a=e==null?void 0:e.enabled)!=null?a:this.enabled,visibility:(l=e==null?void 0:e.visibility)!=null?l:this.visibility}));return n.boundFrom(this,n.raw.announcedValue,n.originalValue,e),n}rebind(t){return super.rebind(t)}}class B extends O{constructor(t,e){super(ve());p(this,"_itemTemplate");this._itemTemplate=t,m(()=>{var n;if(e){const s=e,{value:a,validators:l,actions:d}=s,f=H(s,["value","validators","actions"]);this.registerInitialActions([...l||[],...d||[]]),this.assignParams(f),a!=null&&this.setValueInternal(a)}this.originalValue===void 0&&(this.originalValue=B.baseline(this.value)),this.raw.announcedValue=this.value,(n=this._actions)==null||n.triggerEager(this,this.value,this.originalValue),this.validate()})}get state(){return super.state}get raw(){return super.raw}[X](){const t=super[X]();return t.rows=this.raw.rows?[...this.raw.rows]:this.raw.rows,t}static baseline(t){return t==null?t:[...t]}processSetValueItem(t){let e;return t instanceof I?e=t:this._itemTemplate?e=this._itemTemplate.bind(t):e=I.createFromFormData(t),this.takeChild(e),this.completeRecords(e),e}createPaddingItem(){return this.processSetValueItem(this._itemTemplate?this._itemTemplate.bind():null)}setValueInternal(t){m(e=>{var s;if(e.touch(this),t==null)this.releaseRows(),this.state.rows=null;else if(Array.isArray(t)){const n=(s=this.state.rows)!=null?s:[],a=new Array(t.length);for(let l=0;l<t.length;l++){const d=t[l],f=n[l];f&&this._itemTemplate&&!(d instanceof I)?(this.resetChild(f,this._itemTemplate,d),a[l]=f):(f&&this.releaseChild(f),a[l]=this.processSetValueItem(d))}for(let l=t.length;l<n.length;l++)this.releaseChild(n[l]);this.state.rows=a}this.bumpValueVersion()})}get value(){var n;const t=this.valueVersion;if(this.raw.cachedValueVersion===t)return this.raw.cachedValue;const e=(n=this.state.rows)==null?void 0:n.map(a=>a.value),s=u.isEmpty(e)?null:Object.freeze(e);return this.raw.cachedValue=s,this.raw.cachedValueVersion=t,s}set value(t){m(()=>{this.setValueInternal(t),this.propagateValueChanged(!0)})}resetTo(t,e){m(s=>{s.touch(this),this.errors.length&&(this.errors=[]),this.setValueInternal(e===void 0?t.value:e);const n=this.value;this.raw.announcedValue=n,this.originalValue=B.baseline(n),super.validate(!0)})}get touched(){var t;return((t=this.state.rows)==null?void 0:t.some(e=>e.touched))||!1}set touched(t){m(()=>{var e;(e=this.state.rows)==null||e.forEach(s=>{s.touched=t})})}bind(t,e){var n,a,l,d;const s=new B((n=this._itemTemplate)==null?void 0:n.bind(),_(V({value:[...(a=t!==void 0?t:this.value)!=null?a:[]]},e&&"originalValue"in e?{originalValue:e.originalValue}:{}),{enabled:(l=e==null?void 0:e.enabled)!=null?l:this.enabled,visibility:(d=e==null?void 0:e.visibility)!=null?d:this.visibility}));return s.boundFrom(this,s.value,s.originalValue,e),s}notifyValueChanged(){this.propagateValueChanged()}get composesValue(){return!0}refreshPreviousValue(){this.raw.announcedValue=this.value}get valid(){return this.validRead}composeValid(){var t,e;return this.state.errors.length===0&&((e=(t=this.state.rows)==null?void 0:t.every(s=>s.valid))!=null?e:!0)}validate(t=!1){m(()=>{var e;t&&((e=this.state.rows)==null||e.forEach(s=>s.validate(!0))),super.validate(t)})}get members(){var t;return(t=this.raw.rows)!=null?t:[]}get(t){return this.state.rows!=null?this.state.rows[t]:void 0}push(t){var e,s;return this.insert(t,(s=(e=this.state.rows)==null?void 0:e.length)!=null?s:0)+1}pop(){var t,e;return this.remove(((e=(t=this.state.rows)==null?void 0:t.length)!=null?e:0)-1)}remove(t){let e;return m(s=>{var a;if(this.state.rows==null||t<0||this.state.rows.length<=t)return;s.touch(this);const n=(a=this.state.rows.splice(t,1))==null?void 0:a[0];n&&(this.releaseChild(n),this.bumpValueVersion(),e=n,s.recordStructural(this,{actionClass:ut,item:e,index:t}),this.propagateValueChanged(!0))}),e}insert(t,e){let s=0;return m(n=>{for(n.touch(this),this.state.rows==null&&(this.state.rows=[]),s=e<0?Math.max(this.state.rows.length+e,0):e;this.state.rows.length<s;){const l=this.createPaddingItem(),d=this.state.rows.push(l)-1;this.bumpValueVersion(),n.recordStructural(this,{actionClass:K,item:l,index:d})}const a=this.processSetValueItem(t);this.state.rows.splice(s,0,a),n.recordStructural(this,{actionClass:K,item:a,index:s}),this.bumpValueVersion(),this.propagateValueChanged(!0)}),s}releaseRows(){var t;(t=this.state.rows)==null||t.forEach(e=>this.releaseChild(e))}clear(){m(t=>{var s,n;const e=((n=(s=this.state.rows)==null?void 0:s.length)!=null?n:0)>0;t.touch(this),this.releaseRows(),this.state.rows=null,this.bumpValueVersion(),this.propagateValueChanged(e)})}}class Ve extends C{constructor(t,e,s){super((a,l,d)=>{this.comparisonState(d).oldValue=l;const f=this.resolve(d);return f?(this.listenOn(f),this.isValidComparison(c.unref(a),c.unref(f.value))?null:[new E(this.replacePlaceholders(s,{newValue:a,oldValue:l,field:d,otherField:f}))]):(d.markRecordIncomplete(),null)});p(this,"isValidComparison");p(this,"otherField");p(this,"registrations",new WeakSet);p(this,"listening",new WeakSet);p(this,"declarations",new Set);this.isValidComparison=e,this.otherField=t}resolve(t){var s;const e=this.otherField;return typeof e=="function"?(s=e(t))!=null?s:void 0:typeof e=="string"?re(e,t):it(e,R(t))}listenOn(t){this.listening.has(t)||this.listening.has(t.declaration)||(this.listening.add(t),t.registerAction(new N((e,s,n,a)=>{s(e,n,a);const l=R(e);this.declarations.forEach(d=>xt(d,l).forEach(f=>{this.registrations.has(f)&&this.execute(f,()=>null,f.value,this.comparisonState(f).oldValue)}))})))}boundToBinding(t){this.declarations.add(t.declaration),this.registrations.add(t)}comparisonState(t){return this.bindingState(t)}newBindingState(){return _(V({},super.newBindingState()),{oldValue:void 0})}unregisterFrom(t){this.registrations.delete(t)}}class we extends C{constructor(i,t){const e=t||A("Must be one of [**{allowedAsText}**]");let s=i.join(", ");s.length>60&&(s=u.truncate(s,{length:40,separator:", ",omission:`... (${i.length} items total)`}));const n=(a,l,d)=>i.includes(c.unref(a))?null:[new E(this.replacePlaceholders(e,{newValue:a,oldValue:l,field:d,allowedValues:i,allowedAsText:s}))];super(n)}}function ye(r){return r==null?0:u.isArray(r)||u.isString(r)?r.length:u.isObject(r)&&Object.getPrototypeOf(r)===Object.prototype?Object.keys(r).length:String(r).length}class Ce extends C{constructor(i){const t=i||A("Please enter a value"),e=(s,n,a)=>ye(c.unref(s))===0?[new E(this.replacePlaceholders(t,{newValue:s,oldValue:n,field:a}))]:null;super(e)}}class Ee extends C{constructor(i,t){const e=t||A("Value must be larger or equal to **{minValue}**"),s=(n,a,l)=>n<i||n===void 0?[new E(this.replacePlaceholders(e,{newValue:n,oldValue:a,field:l,minValue:i}))]:null;super(s)}}class Se extends C{constructor(i,t){const e=t||A("Value must be less than or equal to **{maxValue}**"),s=(n,a,l)=>n>i||n===void 0?[new E(this.replacePlaceholders(e,{newValue:n,oldValue:a,field:l,maxValue:i}))]:null;super(s)}}class Ae extends C{constructor(i,t,e){const s=e||A("Value must be between **{minValue}** and **{maxValue}**"),n=(a,l,d)=>a<i||a>t||a===void 0?[new E(this.replacePlaceholders(s,{newValue:a,oldValue:l,field:d,minValue:i,maxValue:t}))]:null;super(n)}}function dt(r){return r==null?0:u.isArray(r)||u.isString(r)?r.length:u.isObject(r)&&Object.getPrototypeOf(r)===Object.prototype?Object.keys(r).length:String(r).length}class Ie extends C{constructor(i,t){const e=t||A("Length must be larger or equal to **{minLength}**"),s=(n,a,l)=>dt(n)<i?[new E(this.replacePlaceholders(e,{newValue:n,oldValue:a,field:l,minLength:i}))]:null;super(s)}}class _e extends C{constructor(i,t){const e=t||A("Length must be less than or equal to **{maxLength}**"),s=(n,a,l)=>dt(n)>i?[new E(this.replacePlaceholders(e,{newValue:n,oldValue:a,field:l,maxLength:i}))]:null;super(s)}}class Te extends C{constructor(i,t,e){const s=e||A("Length must be between **{minLength}** and **{maxLength}**"),n=(a,l,d)=>{const f=dt(a);return f<i||f>t?[new E(this.replacePlaceholders(s,{newValue:a,oldValue:l,field:d,minLength:i,maxLength:t}))]:null};super(n)}}class xe extends C{constructor(i,t){const e=t||A('Value must match pattern "**{pattern}**"'),s=(n,a,l)=>i.test(String(c.unref(n)))?null:[new E(this.replacePlaceholders(e,{newValue:n,oldValue:a,field:l,pattern:i}))];super(s)}}const Ut=Object.freeze(Object.defineProperty({__proto__:null,CompareTo:Ve,InAllowedValues:we,LengthInRange:Te,MaxLength:_e,MaxValue:Se,MinLength:Ie,MinValue:Ee,Pattern:xe,Required:Ce,Validator:C,ValueInRange:Ae},Symbol.toStringTag,{value:"Module"})),Oe=Object.freeze(Object.defineProperty({__proto__:null,AbortEventHandlingException:S,Action:Bt,ActionsMap:L,ConditionalEnabledAction:jt,ConditionalStatementAction:W,ConditionalValueAction:Ft,ConditionalVisibilityAction:Ot,DisplayMode:T,EmptyField:Dt,EnabledChangedAction:nt,EnabledChangingAction:st,ExecuteAction:ct,Field:z,FieldActionBase:y,FieldBase:O,Group:I,List:B,ListItemAddedAction:K,ListItemRemovedAction:ut,MdString:D,MessagesWidget:Mt,Operator:w,RenderableValue:Tt,Statement:j,ValidChangedAction:rt,ValidationError:J,ValidationErrorRenderContent:E,ValidationErrorText:_t,Validator:C,Validators:Ut,ValueChangedAction:N,VisibilityChangedAction:ot,VisibilityChangingAction:at,buildErrorMessage:A,isCallableFunction:q,isSimpleComponentDef:Y,transaction:G},Symbol.toStringTag,{value:"Module"}));o.AbortEventHandlingException=S,o.Action=Bt,o.ActionsMap=L,o.ConditionalEnabledAction=jt,o.ConditionalStatementAction=W,o.ConditionalValueAction=Ft,o.ConditionalVisibilityAction=Ot,o.DisplayMode=T,o.EmptyField=Dt,o.EnabledChangedAction=nt,o.EnabledChangingAction=st,o.ExecuteAction=ct,o.Field=z,o.FieldActionBase=y,o.FieldBase=O,o.Group=I,o.List=B,o.ListItemAddedAction=K,o.ListItemRemovedAction=ut,o.MdString=D,o.MessagesWidget=Mt,o.Operator=w,o.RenderableValue=Tt,o.Statement=j,o.ValidChangedAction=rt,o.ValidationError=J,o.ValidationErrorRenderContent=E,o.ValidationErrorText=_t,o.Validator=C,o.Validators=Ut,o.ValueChangedAction=N,o.VisibilityChangedAction=ot,o.VisibilityChangingAction=at,o.buildErrorMessage=A,o.default=Oe,o.forms=ee,o.isCallableFunction=q,o.isSimpleComponentDef=Y,o.transaction=G,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
3
3
|
//# sourceMappingURL=dynamicforms-vue-forms.umd.cjs.map
|