openapi-gui
Version:
GUI / visual editor for creating and editing OpenApi / Swagger definitions
1 lines • 9.31 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.vuelidate=e():t.vuelidate=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="/",e(0)}({0:function(t,e,n){"use strict";function r(t){return("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}function i(t,e){var n=new t({data:{p:!0,v:!1}});return e.then(function(t){n.p=!1,n.v=t},function(t){throw n.p=!1,n.v=!1,t}),n[h]=!0,n}function o(t){this.dirty=t;var e=this.proxy,n=t?"$touch":"$reset";this.nestedKeys.forEach(function(t){e[t][n]()})}function u(t){if(b)return b;for(var e=t.constructor;e.super;)e=e.super;return b=e,e}function a(t){t.mixin(M)}Object.defineProperty(e,"__esModule",{value:!0}),e.withParams=e.validationMixin=e.Vuelidate=void 0;var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},l=n(17),c=n(2),f=function(t,e,n){return t.reduce(function(t,r){return t[n?n(r):r]=e(r),t},{})},d=function(t,e,n,r){if("function"==typeof n)return n.call(t,e,r);n=Array.isArray(n)?n:n.split(".");for(var i=0;i<n.length;i++){if(!e||"object"!=typeof e)return r;e=e[n[i]]}return"undefined"==typeof e?r:e},h="__isVuelidateAsyncVm",v={$invalid:function(){var t=this.proxy;return this.nestedKeys.some(function(e){return t[e].$invalid})||this.ruleKeys.some(function(e){return!t[e]})},$dirty:function(){if(this.dirty)return!0;if(0===this.nestedKeys.length)return!1;var t=this.proxy;return this.nestedKeys.every(function(e){return t[e].$dirty})},$error:function(){return this.$dirty&&!this.$pending&&this.$invalid},$pending:function(){var t=this,e=this.proxy;return this.nestedKeys.some(function(t){return e[t].$pending})||this.ruleKeys.some(function(e){return t.getRef(e).$pending})},$params:function(){var t=this,e=this.validations;return s({},f(this.nestedKeys,function(t){return e[t]&&e[t].$params||null}),f(this.ruleKeys,function(e){return t.getRef(e).$params}))}},p={$touch:function(){o.call(this,!0)},$reset:function(){o.call(this,!1)},$flattenParams:function(){var t=this.proxy,e=[];for(var n in this.$params)if(this.isNested(n)){for(var r=t[n].$flattenParams(),i=0;i<r.length;i++)r[i].path.unshift(n);e=e.concat(r)}else e.push({path:[],name:n,params:this.$params[n]});return e}},y=Object.keys(v),m=Object.keys(p),g=null,$=function(t){if(g)return g;var e=t.extend({beforeCreate:function(){this._vval=null},beforeDestroy:function(){this._vval&&(0,l.patchChildren)(this._vval)},computed:{refs:function t(){var e=this._vval;this._vval=this.children,(0,l.patchChildren)(e,this._vval);var t={};return this._vval.forEach(function(e){t[e.key]=e.vm}),t}}}),n=e.extend({data:function(){return{rule:null,model:null,parentModel:null,rootModel:null}},methods:{runRule:function(e){(0,c.pushParams)();var n=this.rule.call(this.rootModel,this.model,e),o=r(n)?i(t,n):n,u=(0,c.popParams)(),a=u&&u.$sub?u.$sub.length>1?u:u.$sub[0]:null;return{output:o,params:a}}},computed:{run:function(){var t=this,e=this.parentModel,n=Array.isArray(e)&&e.__ob__;if(n){var r=e.__ob__.dep;r.depend();var i=r.constructor.target;if(!this._indirectWatcher){var o=i.constructor;this._indirectWatcher=new o(this.rootModel,function(){return t.runRule(e)},null,{lazy:!0})}if(!this._indirectWatcher.dirty&&this._lastModel===this.model)return this._indirectWatcher.depend(),i.value;this._lastModel=this.model,this._indirectWatcher.evaluate(),this._indirectWatcher.depend()}return this._indirectWatcher?this._indirectWatcher.value:this.runRule(e)},$params:function(){return this.run.params},proxy:function(){var t=this.run.output;return t[h]?!!t.v:!!t},$pending:function(){var t=this.run.output;return!!t[h]&&t.p}}}),o=e.extend({data:function(){return{dirty:!1,validations:null,model:null,prop:null,parentModel:null,rootModel:null}},methods:s({},p,{getRef:function(t){return this.refs[t]},isNested:function(t){return"function"!=typeof this.validations[t]}}),computed:s({},v,{nestedKeys:function(){return this.keys.filter(this.isNested)},ruleKeys:function(){var t=this;return this.keys.filter(function(e){return!t.isNested(e)})},keys:function(){return Object.keys(this.validations).filter(function(t){return"$params"!==t})},proxy:function(){var t=this,e=f(this.keys,function(e){return{enumerable:!0,configurable:!1,get:function(){return t.getRef(e).proxy}}}),n=f(y,function(e){return{enumerable:!0,configurable:!1,get:function(){return t[e]}}}),r=f(m,function(e){return{enumerable:!1,configurable:!1,get:function(){return t[e]}}});return Object.defineProperties({},s({},e,n,r))},children:function(){var t=this;return[].concat(this.nestedKeys.map(function(e){return $(t,e)}),this.ruleKeys.map(function(e){return b(t,e)})).filter(Boolean)}})}),u=o.extend({methods:{isNested:function(t){return"undefined"!=typeof this.validations[t]()},getRef:function(t){var e=this;return{get proxy(){return e.validations[t]()||!1}}}}}),a=o.extend({computed:{keys:function(){return Object.keys(this.model)},tracker:function(){var t=this,e=this.validations.$trackBy;return e?function(n){return""+d(t.rootModel,t.model[n],e)}:function(t){return""+t}},children:function(){var t=this,e=this.validations,n=s({},e);delete n.$trackBy;var r={};return this.keys.map(function(e){var i=t.tracker(e);return r.hasOwnProperty(i)?null:(r[i]=!0,(0,l.h)(o,i,{validations:n,prop:e,parentModel:t.model,model:t.model[e],rootModel:t.rootModel}))}).filter(Boolean)}},methods:{isNested:function(){return!0},getRef:function(t){return this.refs[this.tracker(t)]}}}),$=function(t,e){if("$each"===e)return(0,l.h)(a,e,{validations:t.validations[e],parentModel:t.parentModel,prop:e,model:t.model,rootModel:t.rootModel});var n=t.validations[e];if(Array.isArray(n)){var r=t.rootModel,i=f(n,function(t){return function(){return d(r,r.$v,t)}},function(t){return Array.isArray(t)?t.join("."):t});return(0,l.h)(u,e,{validations:i,parentModel:null,prop:e,model:null,rootModel:r})}return(0,l.h)(o,e,{validations:n,parentModel:t.model,prop:e,model:t.model[e],rootModel:t.rootModel})},b=function(t,e){return(0,l.h)(n,e,{rule:t.validations[e],parentModel:t.parentModel,model:t.model,rootModel:t.rootModel})};return g={VBase:e,Validation:o}},b=null,_=function(t,e){var n=u(t),r=$(n),i=r.Validation,o=r.VBase,a=new o({computed:{children:function(){var n="function"==typeof e?e.call(t):e;return[(0,l.h)(i,"$v",{validations:n,parentModel:null,prop:"$v",model:t,rootModel:t})]}}});return a},M={data:function(){var t=this.$options.validations;return t&&(this._vuelidate=_(this,t)),{}},beforeCreate:function(){var t=this,e=this.$options,n=e.validations;n&&(e.computed||(e.computed={}),e.computed.$v=function(){return t._vuelidate.refs.$v.proxy})},beforeDestroy:function(){this._vuelidate&&(this._vuelidate.$destroy(),this._vuelidate=null)}};e.Vuelidate=a,e.validationMixin=M,e.withParams=c.withParams,e.default=a},2:function(t,e){"use strict";function n(){null!==c&&l.push(c),e.target=c={}}function r(){var t=c,n=e.target=c=l.pop()||null;return n&&(Array.isArray(n.$sub)||(n.$sub=[]),n.$sub.push(t)),t}function i(t){if("object"!=typeof t||Array.isArray(t))throw new Error("params must be an object");e.target=c=s({},c,t)}function o(t,e){return u(function(n){return function(){n(t);for(var r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];return e.apply(this,i)}})}function u(t){var e=t(i);return function(){n();try{for(var t=arguments.length,i=Array(t),o=0;o<t;o++)i[o]=arguments[o];return e.apply(this,i)}finally{r()}}}function a(t,e){return"object"==typeof t&&void 0!==e?o(t,e):u(t)}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.pushParams=n,e.popParams=r,e.withParams=a;var l=[],c=e.target=null;e._setTarget=function(t){e.target=c=t}},17:function(t,e){"use strict";function n(t){return null===t||void 0===t}function r(t){return null!==t&&void 0!==t}function i(t,e){return e.tag===t.tag&&e.key===t.key}function o(t){var e=t.tag;t.vm=new e({data:t.args})}function u(t){for(var e=Object.keys(t.args),n=0;n<e.length;n++)e.forEach(function(e){t.vm[e]=t.args[e]})}function a(t,e,n){var i=void 0,o=void 0,u={};for(i=e;i<=n;++i)o=t[i].key,r(o)&&(u[o]=i);return u}function s(t,e){for(var u=0,s=0,d=t.length-1,h=t[0],v=t[d],p=e.length-1,y=e[0],m=e[p],g=void 0,$=void 0,b=void 0;u<=d&&s<=p;)n(h)?h=t[++u]:n(v)?v=t[--d]:i(h,y)?(f(h,y),h=t[++u],y=e[++s]):i(v,m)?(f(v,m),v=t[--d],m=e[--p]):i(h,m)?(f(h,m),h=t[++u],m=e[--p]):i(v,y)?(f(v,y),v=t[--d],y=e[++s]):(n(g)&&(g=a(t,u,d)),$=r(y.key)?g[y.key]:null,n($)?(o(y),y=e[++s]):(b=t[$],i(b,y)?(f(b,y),t[$]=void 0,y=e[++s]):(o(y),y=e[++s])));u>d?l(e,s,p):s>p&&c(t,u,d)}function l(t,e,n){for(;e<=n;++e)o(t[e])}function c(t,e,n){for(;e<=n;++e){var i=t[e];r(i)&&(i.vm.$destroy(),i.vm=null)}}function f(t,e){t!==e&&(e.vm=t.vm,u(e))}function d(t,e){r(t)&&r(e)?t!==e&&s(t,e):r(e)?l(e,0,e.length-1):r(t)&&c(t,0,t.length-1)}function h(t,e,n){return{tag:t,key:e,args:n}}Object.defineProperty(e,"__esModule",{value:!0}),e.patchChildren=d,e.h=h}})});