UNPKG

@ncform/ncform

Version:

ncform, a very nice configuration generation way to develop form ( vue, json-schema, form, generator )

1,780 lines (1,433 loc) 420 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("@ncform/ncform-common")); else if(typeof define === 'function' && define.amd) define("vueNcform", ["ncformCommon"], factory); else if(typeof exports === 'object') exports["vueNcform"] = factory(require("@ncform/ncform-common")); else root["vueNcform"] = factory(root["ncformCommon"]); })(window, function(__WEBPACK_EXTERNAL_MODULE__0__) { 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, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // 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 = 103); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__0__; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * 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; exports.default = isArray; /***/ }), /* 2 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; }); /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules). // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. function normalizeComponent ( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, /* server only */ shadowMode /* vue-cli only */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + 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 = shadowMode ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) } : injectStyles } if (hook) { if (options.functional) { // 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 var originalRender = options.render options.render = function renderWithStyleInjection (h, context) { hook.call(context) return originalRender(h, context) } } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } } return { exports: scriptExports, options: options } } /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _freeGlobal = __webpack_require__(71); var _freeGlobal2 = _interopRequireDefault(_freeGlobal); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** Detect free variable `self`. */ var freeSelf = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = _freeGlobal2.default || freeSelf || Function('return this')(); exports.default = root; /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value === 'undefined' ? 'undefined' : _typeof(value); return value != null && (type == 'object' || type == 'function'); } exports.default = isObject; /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _baseIsNative = __webpack_require__(117); var _baseIsNative2 = _interopRequireDefault(_baseIsNative); var _getValue = __webpack_require__(123); var _getValue2 = _interopRequireDefault(_getValue); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * 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 = (0, _getValue2.default)(object, key); return (0, _baseIsNative2.default)(value) ? value : undefined; } exports.default = getNative; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /** * 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 === 'undefined' ? 'undefined' : _typeof(value)) == 'object'; } exports.default = isObjectLike; /***/ }), /* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _Symbol2 = __webpack_require__(8); var _Symbol3 = _interopRequireDefault(_Symbol2); var _getRawTag = __webpack_require__(119); var _getRawTag2 = _interopRequireDefault(_getRawTag); var _objectToString = __webpack_require__(120); var _objectToString2 = _interopRequireDefault(_objectToString); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** `Object#toString` result references. */ var nullTag = '[object Null]', undefinedTag = '[object Undefined]'; /** Built-in value references. */ var symToStringTag = _Symbol3.default ? _Symbol3.default.toStringTag : undefined; /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return symToStringTag && symToStringTag in Object(value) ? (0, _getRawTag2.default)(value) : (0, _objectToString2.default)(value); } exports.default = baseGetTag; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _root = __webpack_require__(3); var _root2 = _interopRequireDefault(_root); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** Built-in value references. */ var _Symbol = _root2.default.Symbol; exports.default = _Symbol; /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _isFunction = __webpack_require__(46); var _isFunction2 = _interopRequireDefault(_isFunction); var _isLength = __webpack_require__(53); var _isLength2 = _interopRequireDefault(_isLength); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && (0, _isLength2.default)(value.length) && !(0, _isFunction2.default)(value); } exports.default = isArrayLike; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _assignValue = __webpack_require__(89); var _assignValue2 = _interopRequireDefault(_assignValue); var _baseAssignValue = __webpack_require__(61); var _baseAssignValue2 = _interopRequireDefault(_baseAssignValue); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { var isNew = !object; object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index]; var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; if (newValue === undefined) { newValue = source[key]; } if (isNew) { (0, _baseAssignValue2.default)(object, key, newValue); } else { (0, _assignValue2.default)(object, key, newValue); } } return object; } exports.default = copyObject; /***/ }), /* 11 */ /***/ (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() { var list = []; // return the list of modules as css string list.toString = function toString() { var result = []; for(var i = 0; i < this.length; i++) { var item = this[i]; if(item[2]) { result.push("@media " + item[2] + "{" + item[1] + "}"); } else { result.push(item[1]); } } return result.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; }; /***/ }), /* 12 */ /***/ (function(module, exports) { /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ var stylesInDom = {}, memoize = function(fn) { var memo; return function () { if (typeof memo === "undefined") memo = fn.apply(this, arguments); return memo; }; }, isOldIE = memoize(function() { return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase()); }), getHeadElement = memoize(function () { return document.head || document.getElementsByTagName("head")[0]; }), singletonElement = null, singletonCounter = 0, styleElementsInsertedAtTop = []; module.exports = function(list, options) { if(typeof DEBUG !== "undefined" && DEBUG) { if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); } options = options || {}; // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> // tags it will allow on a page if (typeof options.singleton === "undefined") options.singleton = isOldIE(); // By default, add <style> tags to the bottom of <head>. if (typeof options.insertAt === "undefined") options.insertAt = "bottom"; var styles = listToStyles(list); addStylesToDom(styles, options); 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) { var newStyles = listToStyles(newList); addStylesToDom(newStyles, options); } 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, options) { 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], options)); } } else { var parts = []; for(var j = 0; j < item.parts.length; j++) { parts.push(addStyle(item.parts[j], options)); } stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; } } } function listToStyles(list) { var styles = []; var newStyles = {}; for(var i = 0; i < list.length; i++) { var item = list[i]; var id = item[0]; var css = item[1]; var media = item[2]; var sourceMap = item[3]; var part = {css: css, media: media, sourceMap: sourceMap}; if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]}); else newStyles[id].parts.push(part); } return styles; } function insertStyleElement(options, styleElement) { var head = getHeadElement(); var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1]; if (options.insertAt === "top") { if(!lastStyleElementInsertedAtTop) { head.insertBefore(styleElement, head.firstChild); } else if(lastStyleElementInsertedAtTop.nextSibling) { head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling); } else { head.appendChild(styleElement); } styleElementsInsertedAtTop.push(styleElement); } else if (options.insertAt === "bottom") { head.appendChild(styleElement); } else { throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'."); } } function removeStyleElement(styleElement) { styleElement.parentNode.removeChild(styleElement); var idx = styleElementsInsertedAtTop.indexOf(styleElement); if(idx >= 0) { styleElementsInsertedAtTop.splice(idx, 1); } } function createStyleElement(options) { var styleElement = document.createElement("style"); styleElement.type = "text/css"; insertStyleElement(options, styleElement); return styleElement; } function addStyle(obj, options) { var styleElement, update, remove; if (options.singleton) { var styleIndex = singletonCounter++; styleElement = singletonElement || (singletonElement = createStyleElement(options)); update = applyToSingletonTag.bind(null, styleElement, styleIndex, false); remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true); } else { styleElement = createStyleElement(options); update = applyToTag.bind(null, styleElement); remove = function() { removeStyleElement(styleElement); }; } update(obj); return function updateStyle(newObj) { 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 (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)); } } /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || value !== value && other !== other; } exports.default = eq; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _arrayLikeKeys = __webpack_require__(81); var _arrayLikeKeys2 = _interopRequireDefault(_arrayLikeKeys); var _baseKeys = __webpack_require__(151); var _baseKeys2 = _interopRequireDefault(_baseKeys); var _isArrayLike = __webpack_require__(9); var _isArrayLike2 = _interopRequireDefault(_isArrayLike); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { return (0, _isArrayLike2.default)(object) ? (0, _arrayLikeKeys2.default)(object) : (0, _baseKeys2.default)(object); } exports.default = keys; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _baseGet = __webpack_require__(55); var _baseGet2 = _interopRequireDefault(_baseGet); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Gets the value at `path` of `object`. If the resolved value is * `undefined`, the `defaultValue` is returned in its place. * * @static * @memberOf _ * @since 3.7.0 * @category Object * @param {Object} object The object to query. * @param {Array|string} path The path of the property to get. * @param {*} [defaultValue] The value returned for `undefined` resolved values. * @returns {*} Returns the resolved value. * @example * * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * * _.get(object, 'a[0].b.c'); * // => 3 * * _.get(object, ['a', '0', 'b', 'c']); * // => 3 * * _.get(object, 'a.b.c', 'default'); * // => 'default' */ function get(object, path, defaultValue) { var result = object == null ? undefined : (0, _baseGet2.default)(object, path); return result === undefined ? defaultValue : result; } exports.default = get; /***/ }), /* 16 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _isSymbol = __webpack_require__(57); var _isSymbol2 = _interopRequireDefault(_isSymbol); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** * Converts `value` to a string key if it's not a string or symbol. * * @private * @param {*} value The value to inspect. * @returns {string|symbol} Returns the key. */ function toKey(value) { if (typeof value == 'string' || (0, _isSymbol2.default)(value)) { return value; } var result = value + ''; return result == '0' && 1 / value == -INFINITY ? '-0' : result; } exports.default = toKey; /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _ListCache = __webpack_require__(18); var _ListCache2 = _interopRequireDefault(_ListCache); var _stackClear = __webpack_require__(112); var _stackClear2 = _interopRequireDefault(_stackClear); var _stackDelete = __webpack_require__(113); var _stackDelete2 = _interopRequireDefault(_stackDelete); var _stackGet = __webpack_require__(114); var _stackGet2 = _interopRequireDefault(_stackGet); var _stackHas = __webpack_require__(115); var _stackHas2 = _interopRequireDefault(_stackHas); var _stackSet = __webpack_require__(116); var _stackSet2 = _interopRequireDefault(_stackSet); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Creates a stack cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { var data = this.__data__ = new _ListCache2.default(entries); this.size = data.size; } // Add methods to `Stack`. Stack.prototype.clear = _stackClear2.default; Stack.prototype['delete'] = _stackDelete2.default; Stack.prototype.get = _stackGet2.default; Stack.prototype.has = _stackHas2.default; Stack.prototype.set = _stackSet2.default; exports.default = Stack; /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _listCacheClear = __webpack_require__(107); var _listCacheClear2 = _interopRequireDefault(_listCacheClear); var _listCacheDelete = __webpack_require__(108); var _listCacheDelete2 = _interopRequireDefault(_listCacheDelete); var _listCacheGet = __webpack_require__(109); var _listCacheGet2 = _interopRequireDefault(_listCacheGet); var _listCacheHas = __webpack_require__(110); var _listCacheHas2 = _interopRequireDefault(_listCacheHas); var _listCacheSet = __webpack_require__(111); var _listCacheSet2 = _interopRequireDefault(_listCacheSet); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } // Add methods to `ListCache`. ListCache.prototype.clear = _listCacheClear2.default; ListCache.prototype['delete'] = _listCacheDelete2.default; ListCache.prototype.get = _listCacheGet2.default; ListCache.prototype.has = _listCacheHas2.default; ListCache.prototype.set = _listCacheSet2.default; exports.default = ListCache; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _eq = __webpack_require__(13); var _eq2 = _interopRequireDefault(_eq); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if ((0, _eq2.default)(array[length][0], key)) { return length; } } return -1; } exports.default = assocIndexOf; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _getNative = __webpack_require__(5); var _getNative2 = _interopRequireDefault(_getNative); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /* Built-in method references that are verified to be native. */ var nativeCreate = (0, _getNative2.default)(Object, 'create'); exports.default = nativeCreate; /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _isKeyable = __webpack_require__(132); var _isKeyable2 = _interopRequireDefault(_isKeyable); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return (0, _isKeyable2.default)(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } exports.default = getMapData; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _baseIsArguments = __webpack_require__(146); var _baseIsArguments2 = _interopRequireDefault(_baseIsArguments); var _isObjectLike = __webpack_require__(6); var _isObjectLike2 = _interopRequireDefault(_isObjectLike); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Built-in value references. */ var propertyIsEnumerable = objectProto.propertyIsEnumerable; /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ var isArguments = (0, _baseIsArguments2.default)(function () { return arguments; }()) ? _baseIsArguments2.default : function (value) { return (0, _isObjectLike2.default)(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }; exports.default = isArguments; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(module) { Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _root = __webpack_require__(3); var _root2 = _interopRequireDefault(_root); var _stubFalse = __webpack_require__(147); var _stubFalse2 = _interopRequireDefault(_stubFalse); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** Detect free variable `exports`. */ var freeExports = ( false ? undefined : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && ( false ? undefined : _typeof(module)) == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Built-in value references. */ var Buffer = moduleExports ? _root2.default.Buffer : undefined; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; /** * Checks if `value` is a buffer. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * _.isBuffer(new Buffer(2)); * // => true * * _.isBuffer(new Uint8Array(2)); * // => false */ var isBuffer = nativeIsBuffer || _stubFalse2.default; exports.default = isBuffer; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(50)(module))) /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _isArray = __webpack_require__(1); var _isArray2 = _interopRequireDefault(_isArray); var _isKey = __webpack_require__(56); var _isKey2 = _interopRequireDefault(_isKey); var _stringToPath = __webpack_require__(159); var _stringToPath2 = _interopRequireDefault(_stringToPath); var _toString = __webpack_require__(58); var _toString2 = _interopRequireDefault(_toString); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Casts `value` to a path array if it's not one. * * @private * @param {*} value The value to inspect. * @param {Object} [object] The object to query keys on. * @returns {Array} Returns the cast property path array. */ function castPath(value, object) { if ((0, _isArray2.default)(value)) { return value; } return (0, _isKey2.default)(value, object) ? [value] : (0, _stringToPath2.default)((0, _toString2.default)(value)); } exports.default = castPath; /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _arrayLikeKeys = __webpack_require__(81); var _arrayLikeKeys2 = _interopRequireDefault(_arrayLikeKeys); var _baseKeysIn = __webpack_require__(188); var _baseKeysIn2 = _interopRequireDefault(_baseKeysIn); var _isArrayLike = __webpack_require__(9); var _isArrayLike2 = _interopRequireDefault(_isArrayLike); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { return (0, _isArrayLike2.default)(object) ? (0, _arrayLikeKeys2.default)(object, true) : (0, _baseKeysIn2.default)(object); } exports.default = keysIn; /***/ }), /* 26 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_ncform_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27); /* harmony import */ var _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_ncform_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_ncform_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__); /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_ncform_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_ncform_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_node_modules_vue_loader_lib_index_js_vue_loader_options_ncform_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0___default.a); /***/ }), /* 27 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _get2 = __webpack_require__(15); var _get3 = _interopRequireDefault(_get2); var _cloneDeep2 = __webpack_require__(87); var _cloneDeep3 = _interopRequireDefault(_cloneDeep2); var _omit2 = __webpack_require__(202); var _omit3 = _interopRequireDefault(_omit2); var _ncformCommon = __webpack_require__(0); var _ncformCommon2 = _interopRequireDefault(_ncformCommon); var _formItem = __webpack_require__(216); var _formItem2 = _interopRequireDefault(_formItem); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var ncformUtils = _ncformCommon2.default.ncformUtils; // // // // // // // // // // // // // // // exports.default = { /* ====================== 生命周期 ====================== */ created: function created() { var _this = this; // 在这里做一些跟DOM无关的初始化, 比如获取初始化数据 var vm = this; // 在进行Form操作前的原始值,用于reset操作 vm.$nextTick(function () { vm.$options.originFormVal = ncformUtils.getModelFromSchema(vm.$data.dataFormSchema) || {}; }); // 用于识别value的变化是内部触发还是外部主动更改 vm.$options.isValueUpdateFromInner = false; function handleSchema() { var dataFormSchema = ncformUtils.perfectFormSchema(vm.formSchema); vm.$data.dataFormSchema = dataFormSchema; vm.$data.formData = ncformUtils.getModelFromSchema(dataFormSchema); // 初始赋值 ncformUtils.setValueToSchema(vm.value || dataFormSchema.value, dataFormSchema, true); dataFormSchema.value = {}; // 清空最顶层的value,以防止更新的值被其覆盖 // 在这里强行把最外层的对象布局(根布局永远都是对象)的边框置空(对象的布局样式必须是v-layout和h-layout) vm.$nextTick(function () { var rootBorderElement = vm.$el.querySelector('[class$=-layout]'); if (rootBorderElement) rootBorderElement.style.border = 'none'; }); } this.$watch('formSchema', function (newVal, oldVal) { if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) { _this.$data.isSchemaChanging = true; _this.$nextTick(function () { _this.$data.isSchemaChanging = false; handleSchema(); }); } }); this.$watch('value', function (newVal, oldVal) { if (JSON.stringify(newVal) !== JSON.stringify(oldVal)) { if (!_this.$options.isValueUpdateFromInner) { // 外部更新值 _this.$data.isSchemaChanging = true; _this.$nextTick(function () { _this.$data.isSchemaChanging = false; handleSchema(); _this.$options.originFormVal = ncformUtils.getModelFromSchema(_this.$data.dataFormSchema) || {}; // 每次外部赋值都要更新原始值,作为reset有依据 _this.$emit('update:isDirty', false); }); } else { if (_this.$options.originFormVal) { // 通知表单值dirty,配合 is-dirty.sync _this.$emit('update:isDirty', JSON.stringify(_this.$options.originFormVal) !== JSON.stringify(_this.$data.formData)); } } } _this.$options.isValueUpdateFromInner = false; // reset }); handleSchema(); }, mounted: function mounted() { // 在这里做一些跟DOM有关的初始化 var vm = this; if (window.__$ncform.__ncFormsGlobalList[this.$data.name]) { console.warn('\u8868\u5355\u547D\u540D\u91CD\u590D'); var newName = this.$data.name + '_' + Math.random().toString(36).substring(2) + ')'; window.__$ncform.__ncFormsGlobalList[newName] = vm; this.$data.name = newName; } else { window.__$ncform.__ncFormsGlobalList[this.$data.name] = vm; } }, destroyed: function destroyed() { // 在这里销毁无用的资源,比如setTimeout返回的值 delete window.__$ncform.__ncFormsGlobalList[this.$data.name]; }, /* ====================== 引用组件 ====================== */ components: { formItem: _formItem2.default }, /* ====================== 数据绑定 ====================== */ props: { formSchema: { type: Object }, formName: { type: String, default: '_ncformDefaultName' }, value: { type: Object }, isDirty: { type: Boolean, default: false } }, data: function data() { return { name: this.formName, dataFormSchema: {}, formData: {}, tempData: {}, isSchemaChanging: false // 利用该属性,当schema变化时,整个form表单重建,这样确保组件的生命周期跟预想的一致 }; }, /* ====================== 事件处理 ====================== */ methods: { ncformValidate: function ncformValidate() { var _this2 = this; // 清空验证数组,数组内为promise对象。 this.$data.validateArray = []; this.checkValidation(this.$data.dataFormSchema, 'dataFormSchema', 'data'); return new Promise(function (resolve, reject) { Promise.all(_this2.$data.validateArray).then(function (data) { data.forEach(function (item) { _this2.$set((0, _get3.default)(_this2.$data, item.__path), '__validationResult', JSON.parse(JSON.stringify(item.result))); }); resolve({ result: !data.some(function (item) { return item.result.result === false; }), detail: data.map(function (item) { delete item.__path; return item; }) }); }); }); }, // 根据schema,递归检索出所有的验证规则,并push进验证数组validateArray。 // __path参数:控件在schema中的路径。 验证结束后,将验证结果放到对应的控件中展示时需要使用。 // __dataPath: 数据在value中的路径。 最终返回给用户。 checkValidation: function checkValidation(schema, __path, __dataPath, __idxChain) { var _this3 = this; __idxChain = __idxChain === undefined ? '' : __idxChain; // 不在参数命名的时候给默认值是因为会传了undifine进来导致错误 if ((0, _get3.default)(this.dataFormSchema, 'globalConfig.ignoreRulesWhenHidden', true)) { // 如果开启了忽略隐藏字段规则 var isHidden = ncformUtils.smartAnalyzeVal(schema.ui.hidden, { idxChain: __idxChain, data: { rootData: this.$data.formData, constData: this.dataFormSchema.globalConfig.constants } }); // 如果是隐藏,则忽略校验规则 if (isHidden) return Promise.resolve({ result: true, __path: __path, __dataPath: __dataPath }); } if (schema.__validationResult) { // 存在验证结果,直接取验证结果。 this.$data.validateArray.push(Promise.resolve({ result: schema.__validationResult, __path: __path, __dataPath: __dataPath })); } else if (schema.rules && Object.keys(schema.rules) !== 0) { // 不存在验证结果,则进行验证 this.$data.validateArray.push(window.__$ncform.__ncformRegularValidation.validate(schema.value, schema.rules, { formData: this.$data.formData, idxChain: __idxChain, globalConfig: this.dataFormSchema.globalConfig }).then(function (result) { return Promise.resolve({ result: result, __path: __path, __dataPath: __dataPath }); })); } // 递归 switch (schema.type) { case 'object': for (var key in schema.properties) { if (schema.properties[key]) { this.checkValidation(schema.properties[key], __path + '.properties.' + key, __dataPath + '.' + key, __idxChain); } } break; case 'array': if (schema.items) { schema.value.forEach(function (item, index) { if (item.__dataSchema) { _this3.checkValidation(item.__dataSchema, __path + '.value[' + index + '].__dataSchema', __dataPath + '[' + index + ']', !__idxChain && __idxChain !== 0 ? [index].join(',') : [__idxChain, index].join(',')); } }); } break; default: break; } }, getValue: function getValue(ignoreHiddenField) { if (ignoreHiddenField) { // 开启了忽略隐藏字段值,需要递归忽略掉隐藏的字段值 var ignoreFieldPaths = this._getValueIgnoreHiddenFields(this.$data.dataFormSchema, 'data'); var tempData = (0, _omit3.default)({ data: (0, _cloneDeep3.default)(this.$data.formData) }, ignoreFieldPaths); return tempData.data; } else { return (0, _cloneDeep3.default)(this.$data.formData); } }, _getValueIgnoreHiddenFields: function _getValueIgnoreHiddenFields(schema, __dataPath) { var _this4 = this; var __idxChain = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; var allIgnoreFieldPaths = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; var isHidden = ncformUtils.smartAnalyzeVal(schema.ui.hidden, { idxChain: __idxChain, data: { rootData: this.$data.formData, constData: this.dataFormSchema.globalConfig.constants } }); // 如果是隐藏,则忽略校验规则 if (isHidden) { allIgnoreFieldPaths.push(__dataPath); } else { // 递归 switch (schema.type) { case 'object': for (var key in schema.properties) { if (schema.properties[key]) { this._getValueIgnoreHiddenFields(schema.properties[key], __dataPath + '.' + key, __idxChain, allIgnoreFieldPaths); } } break; case 'array': if (schema.items) { schem