UNPKG

vue-form10

Version:

A Vue.js project

1,383 lines (1,202 loc) 410 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("vue"), require("vuex"), require("@blackmiaool/tv4")); else if(typeof define === 'function' && define.amd) define(["vue", "vuex", "@blackmiaool/tv4"], factory); else if(typeof exports === 'object') exports["vue-form10"] = factory(require("vue"), require("vuex"), require("@blackmiaool/tv4")); else root["vue-form10"] = factory(root["vue"], root["vuex"], root["@blackmiaool/tv4"]); })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_43__, __WEBPACK_EXTERNAL_MODULE_62__, __WEBPACK_EXTERNAL_MODULE_65__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 304); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self // eslint-disable-next-line no-new-func : Function('return this')(); if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef /***/ }), /* 1 */ /***/ (function(module, exports) { var core = module.exports = { version: '2.5.5' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { var store = __webpack_require__(51)('wks'); var uid = __webpack_require__(33); var Symbol = __webpack_require__(0).Symbol; var USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function (name) { return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); }; $exports.store = store; /***/ }), /* 3 */ /***/ (function(module, exports) { /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file. // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. module.exports = function normalizeComponent ( rawScriptExports, compiledTemplate, functionalTemplate, injectStyles, scopeId, moduleIdentifier /* server only */ ) { var esModule var scriptExports = rawScriptExports = rawScriptExports || {} // ES6 modules interop var type = typeof rawScriptExports.default if (type === 'object' || type === 'function') { esModule = rawScriptExports scriptExports = rawScriptExports.default } // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (compiledTemplate) { options.render = compiledTemplate.render options.staticRenderFns = compiledTemplate.staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = injectStyles } if (hook) { var functional = options.functional var existing = functional ? options.render : options.beforeCreate if (!functional) { // inject component registration as beforeCreate hook options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } else { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functioal component in vue file options.render = function renderWithStyleInjection (h, context) { hook.call(context) return existing(h, context) } } } return { esModule: esModule, exports: scriptExports, options: options } } /***/ }), /* 4 */ /***/ (function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function(useSourceMap) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = cssWithMappingToString(item, useSourceMap); if(item[2]) { return "@media " + item[2] + "{" + content + "}"; } else { return content; } }).join(""); }; // import a list of modules into the list list.i = function(modules, mediaQuery) { if(typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for(var i = 0; i < this.length; i++) { var id = this[i][0]; if(typeof id === "number") alreadyImportedModules[id] = true; } for(i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { if(mediaQuery && !item[2]) { item[2] = mediaQuery; } else if(mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; function cssWithMappingToString(item, useSourceMap) { var content = item[1] || ''; var cssMapping = item[3]; if (!cssMapping) { return content; } if (useSourceMap && typeof btoa === 'function') { var sourceMapping = toComment(cssMapping); var sourceURLs = cssMapping.sources.map(function (source) { return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' }); return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); } return [content].join('\n'); } // Adapted from convert-source-map (MIT) function toComment(sourceMap) { // eslint-disable-next-line no-undef var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; return '/*# ' + data + ' */'; } /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra Modified by Evan You @yyx990803 */ var hasDocument = typeof document !== 'undefined' if (typeof DEBUG !== 'undefined' && DEBUG) { if (!hasDocument) { throw new Error( 'vue-style-loader cannot be used in a non-browser environment. ' + "Use { target: 'node' } in your Webpack config to indicate a server-rendering environment." ) } } var listToStyles = __webpack_require__(168) /* type StyleObject = { id: number; parts: Array<StyleObjectPart> } type StyleObjectPart = { css: string; media: string; sourceMap: ?string } */ var stylesInDom = {/* [id: number]: { id: number, refs: number, parts: Array<(obj?: StyleObjectPart) => void> } */} var head = hasDocument && (document.head || document.getElementsByTagName('head')[0]) var singletonElement = null var singletonCounter = 0 var isProduction = false var noop = function () {} var options = null var ssrIdKey = 'data-vue-ssr-id' // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> // tags it will allow on a page var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase()) module.exports = function (parentId, list, _isProduction, _options) { isProduction = _isProduction options = _options || {} var styles = listToStyles(parentId, list) addStylesToDom(styles) return function update (newList) { var mayRemove = [] for (var i = 0; i < styles.length; i++) { var item = styles[i] var domStyle = stylesInDom[item.id] domStyle.refs-- mayRemove.push(domStyle) } if (newList) { styles = listToStyles(parentId, newList) addStylesToDom(styles) } else { styles = [] } for (var i = 0; i < mayRemove.length; i++) { var domStyle = mayRemove[i] if (domStyle.refs === 0) { for (var j = 0; j < domStyle.parts.length; j++) { domStyle.parts[j]() } delete stylesInDom[domStyle.id] } } } } function addStylesToDom (styles /* Array<StyleObject> */) { for (var i = 0; i < styles.length; i++) { var item = styles[i] var domStyle = stylesInDom[item.id] if (domStyle) { domStyle.refs++ for (var j = 0; j < domStyle.parts.length; j++) { domStyle.parts[j](item.parts[j]) } for (; j < item.parts.length; j++) { domStyle.parts.push(addStyle(item.parts[j])) } if (domStyle.parts.length > item.parts.length) { domStyle.parts.length = item.parts.length } } else { var parts = [] for (var j = 0; j < item.parts.length; j++) { parts.push(addStyle(item.parts[j])) } stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts } } } } function createStyleElement () { var styleElement = document.createElement('style') styleElement.type = 'text/css' head.appendChild(styleElement) return styleElement } function addStyle (obj /* StyleObjectPart */) { var update, remove var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]') if (styleElement) { if (isProduction) { // has SSR styles and in production mode. // simply do nothing. return noop } else { // has SSR styles but in dev mode. // for some reason Chrome can't handle source map in server-rendered // style tags - source maps in <style> only works if the style tag is // created and inserted dynamically. So we remove the server rendered // styles and inject new ones. styleElement.parentNode.removeChild(styleElement) } } if (isOldIE) { // use singleton mode for IE9. var styleIndex = singletonCounter++ styleElement = singletonElement || (singletonElement = createStyleElement()) update = applyToSingletonTag.bind(null, styleElement, styleIndex, false) remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true) } else { // use multi-style-tag mode in all other cases styleElement = createStyleElement() update = applyToTag.bind(null, styleElement) remove = function () { styleElement.parentNode.removeChild(styleElement) } } update(obj) return function updateStyle (newObj /* StyleObjectPart */) { if (newObj) { if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) { return } update(obj = newObj) } else { remove() } } } var replaceText = (function () { var textStore = [] return function (index, replacement) { textStore[index] = replacement return textStore.filter(Boolean).join('\n') } })() function applyToSingletonTag (styleElement, index, remove, obj) { var css = remove ? '' : obj.css if (styleElement.styleSheet) { styleElement.styleSheet.cssText = replaceText(index, css) } else { var cssNode = document.createTextNode(css) var childNodes = styleElement.childNodes if (childNodes[index]) styleElement.removeChild(childNodes[index]) if (childNodes.length) { styleElement.insertBefore(cssNode, childNodes[index]) } else { styleElement.appendChild(cssNode) } } } function applyToTag (styleElement, obj) { var css = obj.css var media = obj.media var sourceMap = obj.sourceMap if (media) { styleElement.setAttribute('media', media) } if (options.ssrId) { styleElement.setAttribute(ssrIdKey, obj.id) } if (sourceMap) { // https://developer.chrome.com/devtools/docs/javascript-debugging // this makes source maps inside style tags work properly in Chrome css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */' // http://stackoverflow.com/a/26603875 css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */' } if (styleElement.styleSheet) { styleElement.styleSheet.cssText = css } else { while (styleElement.firstChild) { styleElement.removeChild(styleElement.firstChild) } styleElement.appendChild(document.createTextNode(css)) } } /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { var freeGlobal = __webpack_require__(76); /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); module.exports = root; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(0); var core = __webpack_require__(1); var ctx = __webpack_require__(23); var hide = __webpack_require__(11); var has = __webpack_require__(14); var PROTOTYPE = 'prototype'; var $export = function (type, name, source) { var IS_FORCED = type & $export.F; var IS_GLOBAL = type & $export.G; var IS_STATIC = type & $export.S; var IS_PROTO = type & $export.P; var IS_BIND = type & $export.B; var IS_WRAP = type & $export.W; var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); var expProto = exports[PROTOTYPE]; var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]; var key, own, out; if (IS_GLOBAL) source = name; for (key in source) { // contains in native own = !IS_FORCED && target && target[key] !== undefined; if (own && has(exports, key)) continue; // export native or passed out = own ? target[key] : source[key]; // prevent global pollution for namespaces exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] // bind timers to global for call from export context : IS_BIND && own ? ctx(out, global) // wrap global constructors for prevent change them in library : IS_WRAP && target[key] == out ? (function (C) { var F = function (a, b, c) { if (this instanceof C) { switch (arguments.length) { case 0: return new C(); case 1: return new C(a); case 2: return new C(a, b); } return new C(a, b, c); } return C.apply(this, arguments); }; F[PROTOTYPE] = C[PROTOTYPE]; return F; // make static versions for prototype methods })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% if (IS_PROTO) { (exports.virtual || (exports.virtual = {}))[key] = out; // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); } } }; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap $export.U = 64; // safe $export.R = 128; // real proto method for `library` module.exports = $export; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(9); var IE8_DOM_DEFINE = __webpack_require__(67); var toPrimitive = __webpack_require__(48); var dP = Object.defineProperty; exports.f = __webpack_require__(13) ? Object.defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return dP(O, P, Attributes); } catch (e) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(12); module.exports = function (it) { if (!isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; /***/ }), /* 10 */ /***/ (function(module, exports) { /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; module.exports = isArray; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(8); var createDesc = __webpack_require__(24); module.exports = __webpack_require__(13) ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }), /* 12 */ /***/ (function(module, exports) { module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty module.exports = !__webpack_require__(18)(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), /* 14 */ /***/ (function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { var baseIsNative = __webpack_require__(149), getValue = __webpack_require__(152); /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } module.exports = getNative; /***/ }), /* 16 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends__ = __webpack_require__(61); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator__ = __webpack_require__(63); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_typeof__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_typeof___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_typeof__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify__ = __webpack_require__(42); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_assign__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_assign__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_helpers_asyncToGenerator__ = __webpack_require__(64); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_helpers_asyncToGenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_helpers_asyncToGenerator__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_helpers_toConsumableArray__ = __webpack_require__(228); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_helpers_toConsumableArray___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_babel_runtime_helpers_toConsumableArray__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_keys__ = __webpack_require__(22); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_keys___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_keys__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_lodash_get__ = __webpack_require__(56); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_lodash_get___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_lodash_get__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_lodash_toPath__ = __webpack_require__(233); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_lodash_toPath___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9_lodash_toPath__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_vuex__ = __webpack_require__(62); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_vuex___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10_vuex__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_tv4__ = __webpack_require__(65); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_tv4___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_11_tv4__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__components_TypeWrapper__ = __webpack_require__(235); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__components_AnyType__ = __webpack_require__(109); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__util__ = __webpack_require__(17); function execWith(expression, context) { var keys = __WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_keys___default()(context); // eslint-disable-next-line var func = new (Function.prototype.bind.apply(Function, [null].concat(__WEBPACK_IMPORTED_MODULE_6_babel_runtime_helpers_toConsumableArray___default()(keys), [expression])))(); func.apply(undefined, __WEBPACK_IMPORTED_MODULE_6_babel_runtime_helpers_toConsumableArray___default()(keys.map(function (key) { return context[key]; }))); } /* harmony default export */ __webpack_exports__["a"] = ({ inject: ["options"], methods: { interpolate: function interpolate(str, context) { if (typeof str === 'function') { return str(context); } // or it must be string if (!str) { return ''; } return str.replace(/{{([\s\S]*?)}}/g, function (full, key) { return '' + __WEBPACK_IMPORTED_MODULE_8_lodash_get___default()(context, key); }); } }, watch: { model: { immediate: true, handler: function handler(value, prev) { var _this = this; return __WEBPACK_IMPORTED_MODULE_5_babel_runtime_helpers_asyncToGenerator___default()( /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator___default.a.mark(function _callee() { var onChange, schema, valid, tv4ValidateResult, isEmpty, error; return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator___default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: if (!(value === prev)) { _context.next = 2; break; } return _context.abrupt('return'); case 2: if (_this.form.onChange) { onChange = _this.form.onChange; if (typeof onChange === 'function') { onChange(value, _this.form); } else if (typeof onChange === 'string') { execWith(onChange, __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_assign___default()(_this.options.$rootParent, { modelValue: _this.modelValue, form: _this.form })); } } if (_this.form.copyValueTo) { _this.form.copyValueTo.forEach(function (path) { _this.$vuexSet(['model'].concat(__WEBPACK_IMPORTED_MODULE_6_babel_runtime_helpers_toConsumableArray___default()(__WEBPACK_IMPORTED_MODULE_9_lodash_toPath___default()(path))).slice(), value); // set(this.rootModel, path, value); }); } if (!(_this.type === 'object' || _this.type === 'array' || _this.schema.type === 'object' || _this.schema.type === 'array')) { _context.next = 6; break; } return _context.abrupt('return'); case 6: schema = JSON.parse(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify___default()(_this.schema)); if (_this.form.type) { schema.format = _this.form.type; } valid = void 0; tv4ValidateResult = void 0; isEmpty = value === undefined || value === null; if (!isEmpty) { _context.next = 15; break; } valid = true; _context.next = 19; break; case 15: _context.next = 17; return __WEBPACK_IMPORTED_MODULE_11_tv4___default.a.validateResult(value, schema); case 17: tv4ValidateResult = _context.sent; valid = tv4ValidateResult.valid; case 19: error = tv4ValidateResult && tv4ValidateResult.error; _this.$nextTick(function () { var validateState = void 0; var validateMessage = void 0; if (!valid) { validateState = 'error'; validateMessage = error.message; var keyword = error.schemaPath.slice(1); var validationMessage = _this.form.validationMessage; var errorMessage = ''; if (validationMessage) { var context = { error: error, title: _this.schema.title, value: _this.model, valueValue: _this.model, form: _this.form, schema: _this.schema }; if ((typeof validationMessage === 'undefined' ? 'undefined' : __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_typeof___default()(validationMessage)) === 'object' && validationMessage[keyword]) { errorMessage = validationMessage[keyword]; } else if (typeof validationMessage === 'function') { errorMessage = validationMessage; } if (errorMessage) { validateMessage = _this.interpolate(errorMessage, context); } } } else if (isEmpty) { validateState = null; } else if (_this.$alternativeErrorMessage) { validateState = 'error'; validateMessage = _this.$alternativeErrorMessage; } else { validateState = 'success'; validateMessage = ''; } if (_this.form.disableErrorState && validateState === 'error') { validateState = null; } if (_this.form.disableSuccessState && validateState === 'success') { validateState = null; } var typeWrapper = _this.$refs.typeWrapper; if (typeWrapper) { if (validateState === 'error') { typeWrapper.$refs.formItem.validateMessage = validateMessage; typeWrapper.$refs.formItem.validateState = 'error'; } else if (validateState === 'success') { typeWrapper.$refs.formItem.validateMessage = ''; typeWrapper.$refs.formItem.validateState = 'success'; } else { typeWrapper.$refs.formItem.validateMessage = ''; typeWrapper.$refs.formItem.validateState = ''; } } _this.$validationState = validateState; }); case 21: case 'end': return _context.stop(); } } }, _callee, _this); }))(); } } }, computed: __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_extends___default()({}, Object(__WEBPACK_IMPORTED_MODULE_10_vuex__["mapState"])({ rootModel: function rootModel(state) { return state.model; } }), { type: function type() { return this.form.type || this.schema.type; }, modelValue: function modelValue() { return this.model; }, parentModel: { set: function set(value) { this.$vuexSet(this.path.slice(0, this.path.length - 1), value); }, get: function get() { return __WEBPACK_IMPORTED_MODULE_8_lodash_get___default()(this.$store.state, this.path.slice(0, this.path.length - 1)); } }, model: { set: function set(value) { this.$vuexSet(this.path.slice(), value); }, get: function get() { return __WEBPACK_IMPORTED_MODULE_8_lodash_get___default()(this.$store.state, this.path); } }, form: function form() { var form = Object(__WEBPACK_IMPORTED_MODULE_14__util__["i" /* stdFormObj */])(this.name, this.schema); if (this.schema.form) { __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_assign___default()(form, this.schema.form); } return form; }, typeWrapperProps: function typeWrapperProps() { return { form: this.form, margin: this.margin, schema: this.schema, name: this.name }; } }), beforeMount: function beforeMount() { if (this.schema.default !== undefined && (this.model === null || this.model === undefined)) { this.model = this.schema.default; } if (this.schema.defaultJSON && (this.model === null || this.model === undefined)) { this.model = JSON.parse(this.schema.defaultJSON); } }, data: function data() { return { $alternativeErrorMessage: '', $validateState: null }; }, props: ['schema', "name", 'parent', 'is-last', 'path', 'margin'], components: { TypeWrapper: __WEBPACK_IMPORTED_MODULE_12__components_TypeWrapper__["a" /* default */], AnyType: __WEBPACK_IMPORTED_MODULE_13__components_AnyType__["a" /* default */] } }); /***/ }), /* 17 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return emptyValue; }); /* harmony export (immutable) */ __webpack_exports__["h"] = rag2schema; /* harmony export (immutable) */ __webpack_exports__["j"] = strip; /* harmony export (immutable) */ __webpack_exports__["k"] = traverseSchema; /* harmony export (immutable) */ __webpack_exports__["e"] = getPluginFromSchemaAndPlugins; /* harmony export (immutable) */ __webpack_exports__["c"] = getDefaultFromSchema; /* harmony export (immutable) */ __webpack_exports__["i"] = stdFormObj; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return pluginEmptyValues; }); /* harmony export (immutable) */ __webpack_exports__["a"] = assignDeep; /* harmony export (immutable) */ __webpack_exports__["d"] = getFormSchema; /* harmony export (immutable) */ __webpack_exports__["f"] = getSchemaForTv4; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_typeof__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_typeof___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_typeof__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign__ = __webpack_require__(21); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys__ = __webpack_require__(22); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify__ = __webpack_require__(42); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_vue__ = __webpack_require__(43); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_vue__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_lodash_get__ = __webpack_require__(56); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_lodash_get___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_lodash_get__); var emptyValue = {}; function rag2schema(rag, getFormat) { rag = JSON.parse(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify___default()(rag)); function makeChild(parent, key) { if (!getFormat) { return; } var targetFormat = getFormat(parent); var child = targetFormat.form10.format[key]; if (child) { if (typeof child === 'function') { child = child(parent); } parent[key] = child; } } if (rag.type === "array") { makeChild(rag, 'items'); if (!rag.items) { var items = void 0; if (rag.rags.length > 1) { items = rag2schema({ type: "object", rags: rag.rags }); } else if (rag.rags.length === 1) { items = rag2schema(rag.rags[0]); } rag.items = items; } } else if (rag.type === "object") { makeChild(rag, 'properties'); rag.properties = rag.properties || {}; rag.required = []; rag.rags.forEach(function (child) { var key = child.form10key || child.form10uid; rag.properties[key] = rag2schema(child); }); __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys___default()(rag.properties).forEach(function (key) { if (rag.properties[key].required) { rag.required.push(key); } }); } if (rag.type === rag.format) { delete rag.format; } if (rag.form && __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys___default()(rag.form).length === 0) { delete rag.form; } delete rag.rags; delete rag.form10uid; delete rag.form10key; return rag; } function strip(data, schema) { if (!schema) { return; } if (schema.autoRemove) { if (!data) { return undefined; } var json = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify___default()(data); if (json === "[]" || json === "{}") { return undefined; } } if (schema.type === "object" && schema.properties) { __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys___default()(schema.properties).forEach(function (key) { var result = strip(data[key], schema.properties[key]); if (result === undefined) { __WEBPACK_IMPORTED_MODULE_4_vue___default.a.delete(data, key); } }); } else if (schema.type === "array" && schema.items) { data.forEach(function (item) { return strip(item, schema.items); }); } return data; } function traverseSchema(schema, cb) { if (!schema) { return; } cb(schema); if (schema.type === "object") { traverseSchema(schema.properties, cb); } else if (schema.type === "array") { traverseSchema(schema.items, cb); } } function getPluginFromSchemaAndPlugins(schema, plugins, typeDefaultFormat) { var targetPlugin = void 0; var format = schema.format; if (!format && typeDefaultFormat) { format = typeDefaultFormat[schema.type]; } if (format) { targetPlugin = plugins.find(function (plugin) { var shouldUse = __WEBPACK_IMPORTED_MODULE_5_lodash_get___default()(plugin, "form10.format.shouldUse"); if (shouldUse && shouldUse(schema.form || {}, schema)) { return true; } return false; }); if (!targetPlugin) { targetPlugin = plugins.find(function (plugin) { return __WEBPACK_IMPORTED_MODULE_5_lodash_get___default()(plugin, "form10.format.name") === format; }); } } return targetPlugin; } function getDefaultFromSchema(schema) { var root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; if (!schema) { return schema; } if (schema.default !== undefined) { return schema.default; } if (schema.defaultJSON) { return JSON.parse(schema.defaultJSON); } if (schema.type === "object") { var ret = {}; if (!schema.properties) { return {}; } __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys___default()(schema.properties).forEach(function (key) { var value = getDefaultFromSchema(schema.properties[key], false); if (value !== emptyValue) { ret[key] = value; } }); if (__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys___default()(ret).length) { return ret; } return {}; } if (root) { return undefined; } return emptyValue; } function stdFormObj(name, schema) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; // The Object.assign used to be a angular.copy. Should work though. var f = options.global && options.global.formDefaults ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign___default()({}, options.global.formDefaults) : {}; if (!schema) { return f; } if (options.global && options.global.supressPropertyTitles === true) { f.title = schema.title; } else { f.title = schema.title || name; } f.schema = schema; return f; } var pluginEmptyValues = { object: {}, array: [], boolean: false, number: 0, string: "", integer: 0 }; function assignDeep(target) { if (target == null) { // TypeError if undefined or null throw new TypeError("Cannot convert undefined or null to object"); } var to = Object(target); for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } args.forEach(function (nextSource) { if (nextSource != null) { __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys___default()(nextSource).forEach(function (nextKey) { if (__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_typeof___default()(to[nextKey]) === "object" && to[nextKey] && __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_typeof___default()(nextSource[nextKey]) === "object" && nextSource[nextKey]) { assignDeep(to[nextKey], nextSource[nextKey]); } else { to[nextKey] = nextSource[nextKey]; } }); } }); return to; } function getFormSchema(plugin, schema) { var pluginSchema = plugin.form10.schema || plugin.form10.formSchema; if (pluginSchema) { if (typeof pluginSchema === "function") { pluginSchema = pluginSchema(schema); } } return pluginSchema; } /** * Remove some schema from condition * @param {object} schema * @param {any} data */ function getSchemaForTv4(schema0, data0) { function getSchemaForTv4One(objSchema, data, root) { if (objSchema.type === "object") { if (!objSchema.properties) { return; } __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_keys___default()(objSchema.properties).forEach(function (key) { var schema = objSchema.properties[key]; var condition = schema.condition; if (condition) { // eslint-disable-next-line no-new-func var result = new Function("model", "parentModel", "return " + condition + ";")(root, data); if (!result) { delete objSchema.properties[key]; if (objSchema.required) { var index = objSchema.required.indexOf(key); if (index > -1) { objSchema.required.splice(index, 1); } } } } getSchemaForTv4One(schema, data[key], root); }); } else if (objSchema.type === "array" && objSchema.items) { data.forEach(function (item) { getSchemaForTv4One(objSchema.items, item, root); }); } } schema0 = JSON.parse(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_json_stringify___default()(schema0)); getSchemaForTv4One(schema0, data0, data0); return schema0; } /***/ }), /* 18 */ /***/ (function(module, exports) { module.exports = function (exec) { try { return !!exec(); } catch (e) { return true; } }; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject = __webpack_require__(71); var defined = __webpack_require__(46); module.exports = function (it) { return IObject(defined(it)); }; /***/ }), /* 20 */ /***/ (function(module, exports) { /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && typeof value == 'object'; } module.exports = isObjectLike; /***/ }), /* 21 */ /***/ (function(module, exports, __webpack