Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

formvuelatte

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formvuelatte - npm Package Compare versions

Comparing version 2.0.0-alpha.2 to 2.0.0-alpha.3

src/features/UniqueID.js

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 2.0.0-alpha.3
- Add unique ID injection to form components [(#109)](https://github.com/vuelidate/formvuelatte/pull/109)
## 2.0.0-alpha.2

@@ -2,0 +6,0 @@

@@ -208,3 +208,3 @@ module.exports =

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/dist/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/dist??ref--0-1!./src/SchemaForm.vue?vue&type=template&id=458d5d8c
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/dist/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/dist??ref--0-1!./src/SchemaForm.vue?vue&type=template&id=c736429e

@@ -237,4 +237,13 @@ function render(_ctx, _cache) {

}
// CONCATENATED MODULE: ./src/SchemaForm.vue?vue&type=template&id=458d5d8c
// CONCATENATED MODULE: ./src/SchemaForm.vue?vue&type=template&id=c736429e
// CONCATENATED MODULE: ./src/features/UniqueID.js
/* harmony default export */ var UniqueID = (function () {
var UUID = Math.floor(Math.random() * 1000000000);
var UUIDBindings = new Set();
return {
UUID: UUID,
UUIDBindings: UUIDBindings
};
});
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/dist??ref--0-1!./src/SchemaForm.vue?vue&type=script&lang=js

@@ -254,2 +263,3 @@ function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }

/* harmony default export */ var SchemaFormvue_type_script_lang_js = ({

@@ -292,2 +302,6 @@ emits: ['submit'],

var _useUniqueID = UniqueID(),
UUID = _useUniqueID.UUID,
UUIDBindings = _useUniqueID.UUIDBindings;
var parsedSchema = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () {

@@ -298,4 +312,10 @@ if (Array.isArray(props.schema)) return props.schema;

for (var model in props.schema) {
if (!UUIDBindings[model]) {
UUIDBindings[model] = UUID;
UUID++;
}
arraySchema.push(_objectSpread(_objectSpread({}, props.schema[model]), {}, {
model: model
model: model,
uuid: UUIDBindings[model]
}));

@@ -302,0 +322,0 @@ }

@@ -217,3 +217,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/dist/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/dist??ref--0-1!./src/SchemaForm.vue?vue&type=template&id=458d5d8c
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader/dist/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/dist??ref--0-1!./src/SchemaForm.vue?vue&type=template&id=c736429e

@@ -246,4 +246,13 @@ function render(_ctx, _cache) {

}
// CONCATENATED MODULE: ./src/SchemaForm.vue?vue&type=template&id=458d5d8c
// CONCATENATED MODULE: ./src/SchemaForm.vue?vue&type=template&id=c736429e
// CONCATENATED MODULE: ./src/features/UniqueID.js
/* harmony default export */ var UniqueID = (function () {
var UUID = Math.floor(Math.random() * 1000000000);
var UUIDBindings = new Set();
return {
UUID: UUID,
UUIDBindings: UUIDBindings
};
});
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/dist??ref--0-1!./src/SchemaForm.vue?vue&type=script&lang=js

@@ -263,2 +272,3 @@ function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }

/* harmony default export */ var SchemaFormvue_type_script_lang_js = ({

@@ -301,2 +311,6 @@ emits: ['submit'],

var _useUniqueID = UniqueID(),
UUID = _useUniqueID.UUID,
UUIDBindings = _useUniqueID.UUIDBindings;
var parsedSchema = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () {

@@ -307,4 +321,10 @@ if (Array.isArray(props.schema)) return props.schema;

for (var model in props.schema) {
if (!UUIDBindings[model]) {
UUIDBindings[model] = UUID;
UUID++;
}
arraySchema.push(_objectSpread(_objectSpread({}, props.schema[model]), {}, {
model: model
model: model,
uuid: UUIDBindings[model]
}));

@@ -311,0 +331,0 @@ }

2

dist/formvuelatte.umd.min.js

@@ -1,2 +0,2 @@

(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["formvuelatte"]=t(require("vue")):e["formvuelatte"]=t(e["Vue"])})("undefined"!==typeof self?self:this,(function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s="fb15")}({8875:function(e,t,r){var n,o,c;(function(r,u){o=[],n=u,c="function"===typeof n?n.apply(t,o):n,void 0===c||(e.exports=c)})("undefined"!==typeof self&&self,(function(){function e(){if(document.currentScript)return document.currentScript;try{throw new Error}catch(d){var e,t,r,n=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,o=/@([^@]*):(\d+):(\d+)\s*$/gi,c=n.exec(d.stack)||o.exec(d.stack),u=c&&c[1]||!1,a=c&&c[2]||!1,i=document.location.href.replace(document.location.hash,""),l=document.getElementsByTagName("script");u===i&&(e=document.documentElement.outerHTML,t=new RegExp("(?:[^\\n]+?\\n){0,"+(a-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),r=e.replace(t,"$1").trim());for(var f=0;f<l.length;f++){if("interactive"===l[f].readyState)return l[f];if(l[f].src===u)return l[f];if(u===i&&l[f].innerHTML&&l[f].innerHTML.trim()===r)return l[f]}return null}}return e}))},"8bbf":function(t,r){t.exports=e},fb15:function(e,t,r){"use strict";if(r.r(t),"undefined"!==typeof window){var n=window.document.currentScript,o=r("8875");n=o(),"currentScript"in document||Object.defineProperty(document,"currentScript",{get:o});var c=n&&n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);c&&(r.p=c[1])}var u=r("8bbf");function a(e,t){return Object(u["openBlock"])(),Object(u["createBlock"])(Object(u["resolveDynamicComponent"])(e.hasParentSchema?"div":"form"),e.formBinds,{default:Object(u["withCtx"])((function(){return[e.hasParentSchema?Object(u["createCommentVNode"])("",!0):Object(u["renderSlot"])(e.$slots,"beforeForm",{key:0}),(Object(u["openBlock"])(!0),Object(u["createBlock"])(u["Fragment"],null,Object(u["renderList"])(e.parsedSchema,(function(t){return Object(u["openBlock"])(),Object(u["createBlock"])(Object(u["resolveDynamicComponent"])(t.component),Object(u["mergeProps"])({key:t.model},e.binds(t),{modelValue:e.val(t),"onUpdate:modelValue":function(r){return e.update(t.model,r)},"onUpdate-batch":function(r){return e.updateBatch(t.model,r)}}),null,16,["modelValue","onUpdate:modelValue","onUpdate-batch"])})),128)),e.hasParentSchema?Object(u["createCommentVNode"])("",!0):Object(u["renderSlot"])(e.$slots,"afterForm",{key:0})]})),_:1},16)}function i(e){if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=l(e))){var t=0,r=function(){};return{s:r,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o,c=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){u=!0,o=e},f:function(){try{c||null==n.return||n.return()}finally{if(u)throw o}}}}function l(e,t){if(e){if("string"===typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){m(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function m(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var s={emits:["submit"],props:{schema:{type:[Object,Array],required:!0,validator:function(e){return!Array.isArray(e)||0===e.filter((function(e){return!e.model&&!e.schema})).length}},modelValue:{type:Object,required:!0},sharedConfig:{type:Object,default:function(){return{}}},preventModelCleanupOnSchemaChange:{type:Boolean,default:!1}},setup:function(e,t){var r=t.emit,n=(t.attrs,Object(u["inject"])("parentSchemaExists",!1));n||Object(u["provide"])("parentSchemaExists",!0);var o=Object(u["computed"])((function(){if(Array.isArray(e.schema))return e.schema;var t=[];for(var r in e.schema)t.push(p(p({},e.schema[r]),{},{model:r}));return t}));Object(u["watch"])(o,(function(t,n){if(!e.preventModelCleanupOnSchemaChange){var o=t.map((function(e){return e.model})),c=n.map((function(e){return e.model})).filter((function(e){return!o.includes(e)}));if(c.length){var u,a=p({},e.modelValue),l=i(c);try{for(l.s();!(u=l.n()).done;){var f=u.value;delete a[f]}}catch(d){l.e(d)}finally{l.f()}r("update:modelValue",a)}}}));var c=function(t,n){r("update:modelValue",p(p({},e.modelValue),{},m({},t,n)))},a=function(t,n){r("update:modelValue",p(p({},e.modelValue),n))},l=function(t){return t.schema?{schema:t.schema}:p(p({},e.sharedConfig),t)},f=function(t){return t.schema&&!e.modelValue[t.model]?{}:e.modelValue[t.model]},d=Object(u["computed"])((function(){return n?{}:{onSubmit:function(e){e.preventDefault(),r("submit",e)}}}));return{parsedSchema:o,val:f,binds:l,update:c,updateBatch:a,hasParentSchema:n,formBinds:d}}};s.render=a;var b=s;function y(e,t){var r=Object(u["resolveComponent"])("SchemaForm");return Object(u["openBlock"])(),Object(u["createBlock"])("form",{onSubmit:t[2]||(t[2]=Object(u["withModifiers"])((function(t){return e.$emit("submit",t)}),["prevent"]))},[Object(u["renderSlot"])(e.$slots,"beforeForm"),Object(u["createVNode"])(r,{schema:e.currentSchema,value:e.modelValue[e.step]||{},onInput:t[1]||(t[1]=function(t){return e.update(t)})},null,8,["schema","value"]),Object(u["renderSlot"])(e.$slots,"afterForm")],32)}function h(e){return g(e)||j(e)||v(e)||O()}function O(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(e,t){if(e){if("string"===typeof e)return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?S(e,t):void 0}}function j(e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function g(e){if(Array.isArray(e))return S(e)}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var w={components:{SchemaForm:b},props:{schema:{type:Array,required:!0},step:{type:Number,required:!0,default:0},modelValue:{type:Array,required:!0}},setup:function(e,t){Object(u["provide"])("parentSchemaExists",!0);var r=Object(u["computed"])((function(){return e.schema[e.step]})),n=function(r){var n=h(e.modelValue);n[e.step]=r,t.emit("update:modelValue",n)};return{currentSchema:r,update:n}}};w.render=y;var P=w;function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function A(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach((function(t){x(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function x(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=b.setup;function r(r,n){var o=t(r,n);return e.length?e.reduce((function(e,t){return t(e,r,n)}),o):o}return A(A({},b),{},{setup:r})}var B=b;r.d(t,"SchemaForm",(function(){return b})),r.d(t,"SchemaWizard",(function(){return P})),r.d(t,"SchemaFormFactory",(function(){return k}));t["default"]=B}})}));
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["formvuelatte"]=t(require("vue")):e["formvuelatte"]=t(e["Vue"])})("undefined"!==typeof self?self:this,(function(e){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s="fb15")}({8875:function(e,t,r){var n,o,c;(function(r,u){o=[],n=u,c="function"===typeof n?n.apply(t,o):n,void 0===c||(e.exports=c)})("undefined"!==typeof self&&self,(function(){function e(){if(document.currentScript)return document.currentScript;try{throw new Error}catch(d){var e,t,r,n=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,o=/@([^@]*):(\d+):(\d+)\s*$/gi,c=n.exec(d.stack)||o.exec(d.stack),u=c&&c[1]||!1,a=c&&c[2]||!1,i=document.location.href.replace(document.location.hash,""),l=document.getElementsByTagName("script");u===i&&(e=document.documentElement.outerHTML,t=new RegExp("(?:[^\\n]+?\\n){0,"+(a-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),r=e.replace(t,"$1").trim());for(var f=0;f<l.length;f++){if("interactive"===l[f].readyState)return l[f];if(l[f].src===u)return l[f];if(u===i&&l[f].innerHTML&&l[f].innerHTML.trim()===r)return l[f]}return null}}return e}))},"8bbf":function(t,r){t.exports=e},fb15:function(e,t,r){"use strict";if(r.r(t),"undefined"!==typeof window){var n=window.document.currentScript,o=r("8875");n=o(),"currentScript"in document||Object.defineProperty(document,"currentScript",{get:o});var c=n&&n.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);c&&(r.p=c[1])}var u=r("8bbf");function a(e,t){return Object(u["openBlock"])(),Object(u["createBlock"])(Object(u["resolveDynamicComponent"])(e.hasParentSchema?"div":"form"),e.formBinds,{default:Object(u["withCtx"])((function(){return[e.hasParentSchema?Object(u["createCommentVNode"])("",!0):Object(u["renderSlot"])(e.$slots,"beforeForm",{key:0}),(Object(u["openBlock"])(!0),Object(u["createBlock"])(u["Fragment"],null,Object(u["renderList"])(e.parsedSchema,(function(t){return Object(u["openBlock"])(),Object(u["createBlock"])(Object(u["resolveDynamicComponent"])(t.component),Object(u["mergeProps"])({key:t.model},e.binds(t),{modelValue:e.val(t),"onUpdate:modelValue":function(r){return e.update(t.model,r)},"onUpdate-batch":function(r){return e.updateBatch(t.model,r)}}),null,16,["modelValue","onUpdate:modelValue","onUpdate-batch"])})),128)),e.hasParentSchema?Object(u["createCommentVNode"])("",!0):Object(u["renderSlot"])(e.$slots,"afterForm",{key:0})]})),_:1},16)}var i=function(){var e=Math.floor(1e9*Math.random()),t=new Set;return{UUID:e,UUIDBindings:t}};function l(e){if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=f(e))){var t=0,r=function(){};return{s:r,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o,c=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){u=!0,o=e},f:function(){try{c||null==n.return||n.return()}finally{if(u)throw o}}}}function f(e,t){if(e){if("string"===typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b={emits:["submit"],props:{schema:{type:[Object,Array],required:!0,validator:function(e){return!Array.isArray(e)||0===e.filter((function(e){return!e.model&&!e.schema})).length}},modelValue:{type:Object,required:!0},sharedConfig:{type:Object,default:function(){return{}}},preventModelCleanupOnSchemaChange:{type:Boolean,default:!1}},setup:function(e,t){var r=t.emit,n=(t.attrs,Object(u["inject"])("parentSchemaExists",!1));n||Object(u["provide"])("parentSchemaExists",!0);var o=i(),c=o.UUID,a=o.UUIDBindings,f=Object(u["computed"])((function(){if(Array.isArray(e.schema))return e.schema;var t=[];for(var r in e.schema)a[r]||(a[r]=c,c++),t.push(m(m({},e.schema[r]),{},{model:r,uuid:a[r]}));return t}));Object(u["watch"])(f,(function(t,n){if(!e.preventModelCleanupOnSchemaChange){var o=t.map((function(e){return e.model})),c=n.map((function(e){return e.model})).filter((function(e){return!o.includes(e)}));if(c.length){var u,a=m({},e.modelValue),i=l(c);try{for(i.s();!(u=i.n()).done;){var f=u.value;delete a[f]}}catch(d){i.e(d)}finally{i.f()}r("update:modelValue",a)}}}));var d=function(t,n){r("update:modelValue",m(m({},e.modelValue),{},s({},t,n)))},p=function(t,n){r("update:modelValue",m(m({},e.modelValue),n))},b=function(t){return t.schema?{schema:t.schema}:m(m({},e.sharedConfig),t)},y=function(t){return t.schema&&!e.modelValue[t.model]?{}:e.modelValue[t.model]},h=Object(u["computed"])((function(){return n?{}:{onSubmit:function(e){e.preventDefault(),r("submit",e)}}}));return{parsedSchema:f,val:y,binds:b,update:d,updateBatch:p,hasParentSchema:n,formBinds:h}}};b.render=a;var y=b;function h(e,t){var r=Object(u["resolveComponent"])("SchemaForm");return Object(u["openBlock"])(),Object(u["createBlock"])("form",{onSubmit:t[2]||(t[2]=Object(u["withModifiers"])((function(t){return e.$emit("submit",t)}),["prevent"]))},[Object(u["renderSlot"])(e.$slots,"beforeForm"),Object(u["createVNode"])(r,{schema:e.currentSchema,value:e.modelValue[e.step]||{},onInput:t[1]||(t[1]=function(t){return e.update(t)})},null,8,["schema","value"]),Object(u["renderSlot"])(e.$slots,"afterForm")],32)}function O(e){return S(e)||g(e)||j(e)||v()}function v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(e,t){if(e){if("string"===typeof e)return w(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(e,t):void 0}}function g(e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function S(e){if(Array.isArray(e))return w(e)}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var P={components:{SchemaForm:y},props:{schema:{type:Array,required:!0},step:{type:Number,required:!0,default:0},modelValue:{type:Array,required:!0}},setup:function(e,t){Object(u["provide"])("parentSchemaExists",!0);var r=Object(u["computed"])((function(){return e.schema[e.step]})),n=function(r){var n=O(e.modelValue);n[e.step]=r,t.emit("update:modelValue",n)};return{currentSchema:r,update:n}}};P.render=h;var V=P;function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(Object(r),!0).forEach((function(t){D(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function D(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=y.setup;function r(r,n){var o=t(r,n);return e.length?e.reduce((function(e,t){return t(e,r,n)}),o):o}return x(x({},y),{},{setup:r})}var k=y;r.d(t,"SchemaForm",(function(){return y})),r.d(t,"SchemaWizard",(function(){return V})),r.d(t,"SchemaFormFactory",(function(){return B}));t["default"]=k}})}));
//# sourceMappingURL=formvuelatte.umd.min.js.map
{
"name": "formvuelatte",
"version": "v2.0.0-alpha.2",
"version": "v2.0.0-alpha.3",
"description": "Schema Form Generator",

@@ -5,0 +5,0 @@ "author": "Marina Mosti <marina@mosti.com.mx>",

@@ -11,2 +11,8 @@ # FormVueLatte

**Important**
`FormVueLatte` is a bring-your-own-components (BYOC) library!
We do _not_ provide any base components for your to build your forms. There are numerous component libraries out there that do a great job of providing carefully constructed components for you to use, and `FormVueLatte` does a great job at allowing you to bring those external components to your forms, or even crafting your own.
### Installation

@@ -49,13 +55,13 @@

export default {
setup() {
const formData = reactive({})
const mySchema = reactive({
// some schema here
})
setup() {
const formData = reactive({})
const mySchema = reactive({
// some schema here
})
return {
formData,
mySchema
}
}
return {
formData,
mySchema
}
}
}}

@@ -70,6 +76,6 @@ </script>

<SchemaForm
:schema="mySchema"
:data="formData"
@update:modelValue="updateForm"
/>
:schema="mySchema"
:data="formData"
@update:modelValue="updateForm"
/>
</template>

@@ -80,18 +86,18 @@

export default {
setup() {
const formData = reactive({})
const mySchema = reactive({
// some schema here
})
setup() {
const formData = reactive({})
const mySchema = reactive({
// some schema here
})
const updateForm = form => {
formData = form
}
formData = form
}
return {
formData,
mySchema,
updateForm
}
}
return {
formData,
mySchema,
updateForm
}
}
}}

@@ -109,29 +115,29 @@ </script>

<template>
<SchemaForm :schema="schema" v-model="formData" />
<SchemaForm :schema="schema" v-model="formData" />
</template>
<script>
import { SchemaForm } from 'formvuelatte'
import FormText from 'path/to/FormText'
import { reactive } from 'vue'
import { SchemaForm } from 'formvuelatte'
import FormText from 'path/to/FormText'
import { reactive } from 'vue'
export default {
components: { SchemaForm },
setup() {
const schema = reactive({
name: {
component: FormText // Note that is NOT a string
},
lastName: {
component: FormText // We pass the component that we imported directly
}
})
const formData = reactive({})
export default {
components: { SchemaForm },
setup() {
const schema = reactive({
name: {
component: FormText // Note that is NOT a string
},
lastName: {
component: FormText // We pass the component that we imported directly
}
})
const formData = reactive({})
return {
schema,
formData
}
}
}
return {
schema,
formData
}
}
}
</script>

@@ -158,11 +164,11 @@ ```

props: {
modelValue: {
required: true,
type: [String, Number]
}
modelValue: {
required: true,
type: [String, Number]
}
},
setup(props, context) {
const update = event => {
context.emit('update:modelValue', event.target.value)
}
context.emit('update:modelValue', event.target.value)
}
}

@@ -191,13 +197,13 @@ }

const wizardSchema = [
// Step 1 - user's name
// Step 1 - user's name
{
firstName: { component: FormText },
lastName: { component: FormText }
firstName: { component: FormText },
lastName: { component: FormText }
},
// Step 2 - user's email and agree to terms
{
email: { component: FormEmail },
terms: { component: FormCheckbox }
}
// Step 2 - user's email and agree to terms
{
email: { component: FormEmail },
terms: { component: FormCheckbox }
}
]

@@ -227,9 +233,9 @@ ```

{
fistName: 'Jane',
lastName: 'Doe'
},
{
email: 'jane@gmail.com',
terms: true
}
fistName: 'Jane',
lastName: 'Doe'
},
{
email: 'jane@gmail.com',
terms: true
}
]

@@ -259,3 +265,3 @@ ```

const SchemaFormWithPlugins = SchemaFormFactory([
VuelidatePlugin(useVuelidate)
VuelidatePlugin(useVuelidate)
])

@@ -581,5 +587,28 @@ ```

## Contributors
- [Marina Mosti](https://twitter.com/MarinaMosti)
- [Damian Dulisz](https://twitter.com/DamianDulisz)
- [Tonina Zhelyazkova](https://twitter.com/tonina_zh)
## Core team
<table>
<tr>
<td align="center">
<a href="https://github.com/marina-mosti">
<img src="https://avatars2.githubusercontent.com/u/14843771?s=460&u=1d11d62c22d38c01d73e6c92587bd567f4e51d27&v=4" width="120px;" alt="Marina Mosti"/>
<br />
<sub><b>Marina Mosti</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/shentao">
<img src="https://avatars3.githubusercontent.com/u/3737591?s=460&u=6ef86c71bbbb74efae3c6224390ce9a8cba82272&v=4" width="120px;" alt="Damian Dulisz"/>
<br />
<sub><b>Damian Dulisz</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/tzhelyazkova">
<img src="https://avatars0.githubusercontent.com/u/24877689?s=460&u=3800bb7ec37a732fa56d47f097f8d2eaf2518f57&v=4" width="120px;" alt="Tonina Zhelyazkova"/>
<br />
<sub><b>Tonina Zhelyazkova</b></sub>
</a>
</td>
</tr>
</table>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc