formvuelatte
Advanced tools
Comparing version 2.0.0-beta.1 to 2.0.0-beta.2
@@ -90,2 +90,13 @@ module.exports = | ||
/***/ "2b09": | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_dist_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_dist_index_js_ref_0_1_SchemaForm_vue_vue_type_style_index_0_lang_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("dc65"); | ||
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_dist_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_dist_index_js_ref_0_1_SchemaForm_vue_vue_type_style_index_0_lang_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_dist_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_dist_index_js_ref_0_1_SchemaForm_vue_vue_type_style_index_0_lang_css__WEBPACK_IMPORTED_MODULE_0__); | ||
/* unused harmony reexport * */ | ||
/***/ }), | ||
/***/ "8875": | ||
@@ -176,2 +187,9 @@ /***/ (function(module, exports, __webpack_require__) { | ||
/***/ "dc65": | ||
/***/ (function(module, exports, __webpack_require__) { | ||
// extracted by mini-css-extract-plugin | ||
/***/ }), | ||
/***/ "fb15": | ||
@@ -210,3 +228,3 @@ /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
// 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=a5ed3b42 | ||
// 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=744918aa | ||
@@ -218,14 +236,21 @@ function render(_ctx, _cache) { | ||
key: 0 | ||
}) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.parsedSchema, function (field) { | ||
return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDynamicComponent"])(field.component), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["mergeProps"])({ | ||
key: field.model | ||
}, _ctx.binds(field), { | ||
modelValue: _ctx.val(field), | ||
"onUpdate:modelValue": function onUpdateModelValue($event) { | ||
return _ctx.update(field.model, $event); | ||
}, | ||
"onUpdate-batch": function onUpdateBatch($event) { | ||
return _ctx.updateBatch(field.model, $event); | ||
} | ||
}), null, 16, ["modelValue", "onUpdate:modelValue", "onUpdate-batch"]); | ||
}) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.parsedSchema, function (fields, index) { | ||
return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("div", { | ||
class: "schema-row", | ||
key: index | ||
}, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(fields, function (field) { | ||
return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDynamicComponent"])(field.component), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["mergeProps"])(_ctx.binds(field), { | ||
key: field.model, | ||
modelValue: _ctx.val(field), | ||
"onUpdate:modelValue": function onUpdateModelValue($event) { | ||
return _ctx.update(field.model, $event); | ||
}, | ||
"onUpdate-batch": function onUpdateBatch($event) { | ||
return _ctx.updateBatch(field.model, $event); | ||
}, | ||
class: "schema-col" | ||
}), null, 16, ["modelValue", "onUpdate:modelValue", "onUpdate-batch"]); | ||
}), 128 | ||
/* KEYED_FRAGMENT */ | ||
))]); | ||
}), 128 | ||
@@ -240,3 +265,3 @@ /* KEYED_FRAGMENT */ | ||
} | ||
// CONCATENATED MODULE: ./src/SchemaForm.vue?vue&type=template&id=a5ed3b42 | ||
// CONCATENATED MODULE: ./src/SchemaForm.vue?vue&type=template&id=744918aa | ||
@@ -264,2 +289,36 @@ // CONCATENATED MODULE: ./src/features/UniqueID.js | ||
} | ||
// CONCATENATED MODULE: ./src/features/ParsedSchema.js | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function useParsedSchema(props) { | ||
var _useUniqueID = useUniqueID(), | ||
getID = _useUniqueID.getID; | ||
var parsedSchema = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { | ||
var arraySchema = Array.isArray(props.schema) ? props.schema : Object.keys(props.schema).map(function (model) { | ||
return _objectSpread(_objectSpread({}, props.schema[model]), {}, { | ||
model: model | ||
}); | ||
}); | ||
var normalizedSchema = arraySchema.map(function (field) { | ||
return Array.isArray(field) ? field : [field]; | ||
}); | ||
return normalizedSchema.map(function (fieldGroup) { | ||
return fieldGroup.map(function (field) { | ||
return _objectSpread(_objectSpread({}, field), {}, { | ||
uuid: getID(field.model) | ||
}); | ||
}); | ||
}); | ||
}); | ||
return { | ||
parsedSchema: parsedSchema | ||
}; | ||
} | ||
// 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 | ||
@@ -272,7 +331,7 @@ 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; } } }; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function SchemaFormvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function SchemaFormvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { SchemaFormvue_type_script_lang_js_ownKeys(Object(source), true).forEach(function (key) { SchemaFormvue_type_script_lang_js_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { SchemaFormvue_type_script_lang_js_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function SchemaFormvue_type_script_lang_js_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -289,3 +348,3 @@ | ||
return schema.filter(function (field) { | ||
return !field.model && !field.schema; | ||
return !Array.isArray(field) && !field.model && !field.schema; | ||
}).length === 0; | ||
@@ -318,25 +377,17 @@ } | ||
var _useUniqueID = useUniqueID(), | ||
getID = _useUniqueID.getID; | ||
var _useParsedSchema = useParsedSchema(props), | ||
parsedSchema = _useParsedSchema.parsedSchema; | ||
var parsedSchema = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { | ||
var arraySchema = Array.isArray(props.schema) ? props.schema : Object.keys(props.schema).map(function (model) { | ||
return _objectSpread(_objectSpread({}, props.schema[model]), {}, { | ||
model: model | ||
}); | ||
}); | ||
return arraySchema.map(function (field) { | ||
return _objectSpread(_objectSpread({}, field), {}, { | ||
uuid: getID(field.model) | ||
}); | ||
}); | ||
}); | ||
Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(parsedSchema, function (schema, oldSchema) { | ||
var cleanupModelChanges = function cleanupModelChanges(schema, oldSchema) { | ||
if (props.preventModelCleanupOnSchemaChange) return; | ||
var newKeys = schema.map(function (i) { | ||
return i.model; | ||
}); | ||
var diff = oldSchema.map(function (i) { | ||
return i.model; | ||
}).filter(function (i) { | ||
var reducer = function reducer(acc, val) { | ||
return acc.concat(val.map(function (i) { | ||
return i.model; | ||
})); | ||
}; | ||
var newKeys = schema.reduce(reducer, []); | ||
var oldKeys = oldSchema.reduce(reducer, []); | ||
var diff = oldKeys.filter(function (i) { | ||
return !newKeys.includes(i); | ||
@@ -346,3 +397,3 @@ }); | ||
var val = _objectSpread({}, props.modelValue); | ||
var val = SchemaFormvue_type_script_lang_js_objectSpread({}, props.modelValue); | ||
@@ -364,10 +415,12 @@ var _iterator = _createForOfIteratorHelper(diff), | ||
emit('update:modelValue', val); | ||
}); | ||
}; | ||
Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(parsedSchema, cleanupModelChanges); | ||
var update = function update(property, value) { | ||
emit('update:modelValue', _objectSpread(_objectSpread({}, props.modelValue), {}, _defineProperty({}, property, value))); | ||
emit('update:modelValue', SchemaFormvue_type_script_lang_js_objectSpread(SchemaFormvue_type_script_lang_js_objectSpread({}, props.modelValue), {}, SchemaFormvue_type_script_lang_js_defineProperty({}, property, value))); | ||
}; | ||
var updateBatch = function updateBatch(property, values) { | ||
emit('update:modelValue', _objectSpread(_objectSpread({}, props.modelValue), values)); | ||
emit('update:modelValue', SchemaFormvue_type_script_lang_js_objectSpread(SchemaFormvue_type_script_lang_js_objectSpread({}, props.modelValue), values)); | ||
}; | ||
@@ -378,3 +431,3 @@ | ||
schema: field.schema | ||
} : _objectSpread(_objectSpread({}, props.sharedConfig), field); | ||
} : SchemaFormvue_type_script_lang_js_objectSpread(SchemaFormvue_type_script_lang_js_objectSpread({}, props.sharedConfig), field); | ||
}; | ||
@@ -412,2 +465,5 @@ | ||
// EXTERNAL MODULE: ./src/SchemaForm.vue?vue&type=style&index=0&lang=css | ||
var SchemaFormvue_type_style_index_0_lang_css = __webpack_require__("2b09"); | ||
// CONCATENATED MODULE: ./src/SchemaForm.vue | ||
@@ -417,2 +473,4 @@ | ||
SchemaFormvue_type_script_lang_js.render = render | ||
@@ -419,0 +477,0 @@ |
@@ -99,2 +99,13 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/***/ "2b09": | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_dist_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_dist_index_js_ref_0_1_SchemaForm_vue_vue_type_style_index_0_lang_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("dc65"); | ||
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_dist_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_dist_index_js_ref_0_1_SchemaForm_vue_vue_type_style_index_0_lang_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_dist_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_dist_index_js_ref_0_1_SchemaForm_vue_vue_type_style_index_0_lang_css__WEBPACK_IMPORTED_MODULE_0__); | ||
/* unused harmony reexport * */ | ||
/***/ }), | ||
/***/ "8875": | ||
@@ -185,2 +196,9 @@ /***/ (function(module, exports, __webpack_require__) { | ||
/***/ "dc65": | ||
/***/ (function(module, exports, __webpack_require__) { | ||
// extracted by mini-css-extract-plugin | ||
/***/ }), | ||
/***/ "fb15": | ||
@@ -219,3 +237,3 @@ /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
// 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=a5ed3b42 | ||
// 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=744918aa | ||
@@ -227,14 +245,21 @@ function render(_ctx, _cache) { | ||
key: 0 | ||
}) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.parsedSchema, function (field) { | ||
return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDynamicComponent"])(field.component), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["mergeProps"])({ | ||
key: field.model | ||
}, _ctx.binds(field), { | ||
modelValue: _ctx.val(field), | ||
"onUpdate:modelValue": function onUpdateModelValue($event) { | ||
return _ctx.update(field.model, $event); | ||
}, | ||
"onUpdate-batch": function onUpdateBatch($event) { | ||
return _ctx.updateBatch(field.model, $event); | ||
} | ||
}), null, 16, ["modelValue", "onUpdate:modelValue", "onUpdate-batch"]); | ||
}) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.parsedSchema, function (fields, index) { | ||
return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("div", { | ||
class: "schema-row", | ||
key: index | ||
}, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(fields, function (field) { | ||
return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDynamicComponent"])(field.component), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["mergeProps"])(_ctx.binds(field), { | ||
key: field.model, | ||
modelValue: _ctx.val(field), | ||
"onUpdate:modelValue": function onUpdateModelValue($event) { | ||
return _ctx.update(field.model, $event); | ||
}, | ||
"onUpdate-batch": function onUpdateBatch($event) { | ||
return _ctx.updateBatch(field.model, $event); | ||
}, | ||
class: "schema-col" | ||
}), null, 16, ["modelValue", "onUpdate:modelValue", "onUpdate-batch"]); | ||
}), 128 | ||
/* KEYED_FRAGMENT */ | ||
))]); | ||
}), 128 | ||
@@ -249,3 +274,3 @@ /* KEYED_FRAGMENT */ | ||
} | ||
// CONCATENATED MODULE: ./src/SchemaForm.vue?vue&type=template&id=a5ed3b42 | ||
// CONCATENATED MODULE: ./src/SchemaForm.vue?vue&type=template&id=744918aa | ||
@@ -273,2 +298,36 @@ // CONCATENATED MODULE: ./src/features/UniqueID.js | ||
} | ||
// CONCATENATED MODULE: ./src/features/ParsedSchema.js | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function useParsedSchema(props) { | ||
var _useUniqueID = useUniqueID(), | ||
getID = _useUniqueID.getID; | ||
var parsedSchema = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { | ||
var arraySchema = Array.isArray(props.schema) ? props.schema : Object.keys(props.schema).map(function (model) { | ||
return _objectSpread(_objectSpread({}, props.schema[model]), {}, { | ||
model: model | ||
}); | ||
}); | ||
var normalizedSchema = arraySchema.map(function (field) { | ||
return Array.isArray(field) ? field : [field]; | ||
}); | ||
return normalizedSchema.map(function (fieldGroup) { | ||
return fieldGroup.map(function (field) { | ||
return _objectSpread(_objectSpread({}, field), {}, { | ||
uuid: getID(field.model) | ||
}); | ||
}); | ||
}); | ||
}); | ||
return { | ||
parsedSchema: parsedSchema | ||
}; | ||
} | ||
// 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 | ||
@@ -281,7 +340,7 @@ 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; } } }; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function SchemaFormvue_type_script_lang_js_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function SchemaFormvue_type_script_lang_js_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { SchemaFormvue_type_script_lang_js_ownKeys(Object(source), true).forEach(function (key) { SchemaFormvue_type_script_lang_js_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { SchemaFormvue_type_script_lang_js_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function SchemaFormvue_type_script_lang_js_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -298,3 +357,3 @@ | ||
return schema.filter(function (field) { | ||
return !field.model && !field.schema; | ||
return !Array.isArray(field) && !field.model && !field.schema; | ||
}).length === 0; | ||
@@ -327,25 +386,17 @@ } | ||
var _useUniqueID = useUniqueID(), | ||
getID = _useUniqueID.getID; | ||
var _useParsedSchema = useParsedSchema(props), | ||
parsedSchema = _useParsedSchema.parsedSchema; | ||
var parsedSchema = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { | ||
var arraySchema = Array.isArray(props.schema) ? props.schema : Object.keys(props.schema).map(function (model) { | ||
return _objectSpread(_objectSpread({}, props.schema[model]), {}, { | ||
model: model | ||
}); | ||
}); | ||
return arraySchema.map(function (field) { | ||
return _objectSpread(_objectSpread({}, field), {}, { | ||
uuid: getID(field.model) | ||
}); | ||
}); | ||
}); | ||
Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(parsedSchema, function (schema, oldSchema) { | ||
var cleanupModelChanges = function cleanupModelChanges(schema, oldSchema) { | ||
if (props.preventModelCleanupOnSchemaChange) return; | ||
var newKeys = schema.map(function (i) { | ||
return i.model; | ||
}); | ||
var diff = oldSchema.map(function (i) { | ||
return i.model; | ||
}).filter(function (i) { | ||
var reducer = function reducer(acc, val) { | ||
return acc.concat(val.map(function (i) { | ||
return i.model; | ||
})); | ||
}; | ||
var newKeys = schema.reduce(reducer, []); | ||
var oldKeys = oldSchema.reduce(reducer, []); | ||
var diff = oldKeys.filter(function (i) { | ||
return !newKeys.includes(i); | ||
@@ -355,3 +406,3 @@ }); | ||
var val = _objectSpread({}, props.modelValue); | ||
var val = SchemaFormvue_type_script_lang_js_objectSpread({}, props.modelValue); | ||
@@ -373,10 +424,12 @@ var _iterator = _createForOfIteratorHelper(diff), | ||
emit('update:modelValue', val); | ||
}); | ||
}; | ||
Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(parsedSchema, cleanupModelChanges); | ||
var update = function update(property, value) { | ||
emit('update:modelValue', _objectSpread(_objectSpread({}, props.modelValue), {}, _defineProperty({}, property, value))); | ||
emit('update:modelValue', SchemaFormvue_type_script_lang_js_objectSpread(SchemaFormvue_type_script_lang_js_objectSpread({}, props.modelValue), {}, SchemaFormvue_type_script_lang_js_defineProperty({}, property, value))); | ||
}; | ||
var updateBatch = function updateBatch(property, values) { | ||
emit('update:modelValue', _objectSpread(_objectSpread({}, props.modelValue), values)); | ||
emit('update:modelValue', SchemaFormvue_type_script_lang_js_objectSpread(SchemaFormvue_type_script_lang_js_objectSpread({}, props.modelValue), values)); | ||
}; | ||
@@ -387,3 +440,3 @@ | ||
schema: field.schema | ||
} : _objectSpread(_objectSpread({}, props.sharedConfig), field); | ||
} : SchemaFormvue_type_script_lang_js_objectSpread(SchemaFormvue_type_script_lang_js_objectSpread({}, props.sharedConfig), field); | ||
}; | ||
@@ -421,2 +474,5 @@ | ||
// EXTERNAL MODULE: ./src/SchemaForm.vue?vue&type=style&index=0&lang=css | ||
var SchemaFormvue_type_style_index_0_lang_css = __webpack_require__("2b09"); | ||
// CONCATENATED MODULE: ./src/SchemaForm.vue | ||
@@ -426,2 +482,4 @@ | ||
SchemaFormvue_type_script_lang_js.render = render | ||
@@ -428,0 +486,0 @@ |
@@ -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(){var e=Math.floor(1e9*Math.random()),t=new Map;function r(r){return t.has(r)?t.get(r):(e++,t.set(r,e),e)}return{UUID:e,UUIDBindings:t,getID:r}}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 m(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?m(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(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={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}},emits:["submit","update:modelValue"],setup:function(e,t){var r=t.emit,n=Object(u["inject"])("parentSchemaExists",!1);n||Object(u["provide"])("parentSchemaExists",!0);var o=i(),c=o.getID,a=Object(u["computed"])((function(){var t=Array.isArray(e.schema)?e.schema:Object.keys(e.schema).map((function(t){return p(p({},e.schema[t]),{},{model:t})}));return t.map((function(e){return p(p({},e),{},{uuid:c(e.model)})}))}));Object(u["watch"])(a,(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),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 f=function(t,n){r("update:modelValue",p(p({},e.modelValue),{},s({},t,n)))},d=function(t,n){r("update:modelValue",p(p({},e.modelValue),n))},m=function(t){return t.schema?{schema:t.schema}:p(p({},e.sharedConfig),t)},b=function(t){return t.schema&&!e.modelValue[t.model]?{}:e.modelValue[t.model]},y=Object(u["computed"])((function(){return n?{}:{onSubmit:function(e){e.preventDefault(),r("submit",e)}}}));return{parsedSchema:a,val:b,binds:m,update:f,updateBatch:d,hasParentSchema:n,formBinds:y}}};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,modelValue:e.modelValue[e.step]||{},"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.update(t)})},null,8,["schema","modelValue"]),Object(u["renderSlot"])(e.$slots,"afterForm")],32)}function O(e){return S(e)||g(e)||v(e)||j()}function j(){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 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 k(){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 B=y;r.d(t,"SchemaForm",(function(){return y})),r.d(t,"SchemaWizard",(function(){return V})),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")}({"2b09":function(e,t,r){"use strict";r("dc65")},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(p){var e,t,r,n=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,o=/@([^@]*):(\d+):(\d+)\s*$/gi,c=n.exec(p.stack)||o.exec(p.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},dc65:function(e,t,r){},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,r){return Object(u["openBlock"])(),Object(u["createBlock"])("div",{class:"schema-row",key:r},[(Object(u["openBlock"])(!0),Object(u["createBlock"])(u["Fragment"],null,Object(u["renderList"])(t,(function(t){return Object(u["openBlock"])(),Object(u["createBlock"])(Object(u["resolveDynamicComponent"])(t.component),Object(u["mergeProps"])(e.binds(t),{key:t.model,modelValue:e.val(t),"onUpdate:modelValue":function(r){return e.update(t.model,r)},"onUpdate-batch":function(r){return e.updateBatch(t.model,r)},class:"schema-col"}),null,16,["modelValue","onUpdate:modelValue","onUpdate-batch"])})),128))])})),128)),e.hasParentSchema?Object(u["createCommentVNode"])("",!0):Object(u["renderSlot"])(e.$slots,"afterForm",{key:0})]})),_:1},16)}function i(){var e=Math.floor(1e9*Math.random()),t=new Map;function r(r){return t.has(r)?t.get(r):(e++,t.set(r,e),e)}return{UUID:e,UUIDBindings:t,getID:r}}function l(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 f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){var t=i(),r=t.getID,n=Object(u["computed"])((function(){var t=Array.isArray(e.schema)?e.schema:Object.keys(e.schema).map((function(t){return f(f({},e.schema[t]),{},{model:t})})),n=t.map((function(e){return Array.isArray(e)?e:[e]}));return n.map((function(e){return e.map((function(e){return f(f({},e),{},{uuid:r(e.model)})}))}))}));return{parsedSchema:n}}function s(e){if("undefined"===typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=m(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 m(e,t){if(e){if("string"===typeof e)return b(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)?b(e,t):void 0}}function b(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 y(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 O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){j(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function j(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var h={props:{schema:{type:[Object,Array],required:!0,validator:function(e){return!Array.isArray(e)||0===e.filter((function(e){return!Array.isArray(e)&&!e.model&&!e.schema})).length}},modelValue:{type:Object,required:!0},sharedConfig:{type:Object,default:function(){return{}}},preventModelCleanupOnSchemaChange:{type:Boolean,default:!1}},emits:["submit","update:modelValue"],setup:function(e,t){var r=t.emit,n=Object(u["inject"])("parentSchemaExists",!1);n||Object(u["provide"])("parentSchemaExists",!0);var o=d(e),c=o.parsedSchema,a=function(t,n){if(!e.preventModelCleanupOnSchemaChange){var o=function(e,t){return e.concat(t.map((function(e){return e.model})))},c=t.reduce(o,[]),u=n.reduce(o,[]),a=u.filter((function(e){return!c.includes(e)}));if(a.length){var i,l=O({},e.modelValue),f=s(a);try{for(f.s();!(i=f.n()).done;){var p=i.value;delete l[p]}}catch(d){f.e(d)}finally{f.f()}r("update:modelValue",l)}}};Object(u["watch"])(c,a);var i=function(t,n){r("update:modelValue",O(O({},e.modelValue),{},j({},t,n)))},l=function(t,n){r("update:modelValue",O(O({},e.modelValue),n))},f=function(t){return t.schema?{schema:t.schema}:O(O({},e.sharedConfig),t)},p=function(t){return t.schema&&!e.modelValue[t.model]?{}:e.modelValue[t.model]},m=Object(u["computed"])((function(){return n?{}:{onSubmit:function(e){e.preventDefault(),r("submit",e)}}}));return{parsedSchema:c,val:p,binds:f,update:i,updateBatch:l,hasParentSchema:n,formBinds:m}}};r("2b09");h.render=a;var v=h;function g(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,modelValue:e.modelValue[e.step]||{},"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.update(t)})},null,8,["schema","modelValue"]),Object(u["renderSlot"])(e.$slots,"afterForm")],32)}function S(e){return A(e)||V(e)||P(e)||w()}function w(){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 P(e,t){if(e){if("string"===typeof e)return k(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)?k(e,t):void 0}}function V(e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function A(e){if(Array.isArray(e))return k(e)}function k(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 D={components:{SchemaForm:v},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=S(e.modelValue);n[e.step]=r,t.emit("update:modelValue",n)};return{currentSchema:r,update:n}}};D.render=g;var x=D;function B(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 E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?B(Object(r),!0).forEach((function(t){M(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B(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}function C(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=v.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 E(E({},v),{},{setup:r})}var F=v;r.d(t,"SchemaForm",(function(){return v})),r.d(t,"SchemaWizard",(function(){return x})),r.d(t,"SchemaFormFactory",(function(){return C}));t["default"]=F}})})); | ||
//# sourceMappingURL=formvuelatte.umd.min.js.map |
{ | ||
"name": "formvuelatte", | ||
"version": "v2.0.0-beta.1", | ||
"version": "v2.0.0-beta.2", | ||
"description": "Schema Form Generator", | ||
@@ -21,7 +21,5 @@ "author": "Marina Mosti <marina@mosti.com.mx>", | ||
"scripts": { | ||
"serve": "vue-cli-service serve", | ||
"build": "vue-cli-service build --target lib --name formvuelatte src/index.js", | ||
"test:unit": "vue-cli-service test:unit --coverage", | ||
"test:unit:watch": "yarn test:unit --watch", | ||
"test:e2e": "vue-cli-service test:e2e", | ||
"lint": "vue-cli-service lint", | ||
@@ -55,3 +53,3 @@ "docs:build": "vitepress build", | ||
"@vue/eslint-config-standard": "^5.1.0", | ||
"@vue/test-utils": "^2.0.0-alpha.1", | ||
"@vue/test-utils": "^2.0.0-alpha.7", | ||
"babel-core": "7.0.0-bridge.0", | ||
@@ -58,0 +56,0 @@ "babel-eslint": "^10.0.3", |
# FormVueLatte 2.x | ||
![https://www.npmjs.com/package/formvuelatte](https://img.shields.io/npm/v/formvuelatte?color=42b883) | ||
Visit [FormVueLatte 2.0's full documentation](https://formvuelatte-next.netlify.app/#getting-started) for more detailed information and examples. | ||
@@ -4,0 +6,0 @@ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
158662
17
1150
141