ng-form-element
Version:
ng-form-element
1,552 lines (1,339 loc) • 2.39 MB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("vue"));
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["ng-form-element"] = factory(require("vue"));
else
root["ng-form-element"] = factory(root["Vue"]);
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__8bbf__) {
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 = "6d48");
/******/ })
/************************************************************************/
/******/ ({
/***/ "0028":
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
// backported and transplited with Babel, with backwards-compat fixes
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// resolves . and .. elements in a path array with directory names there
// must be no slashes, empty elements, or device names (c:\) in the array
// (so also no leading and trailing slashes - it does not distinguish
// relative and absolute paths)
function normalizeArray(parts, allowAboveRoot) {
// if the path tries to go above the root, `up` ends up > 0
var up = 0;
for (var i = parts.length - 1; i >= 0; i--) {
var last = parts[i];
if (last === '.') {
parts.splice(i, 1);
} else if (last === '..') {
parts.splice(i, 1);
up++;
} else if (up) {
parts.splice(i, 1);
up--;
}
}
// if the path is allowed to go above the root, restore leading ..s
if (allowAboveRoot) {
for (; up--; up) {
parts.unshift('..');
}
}
return parts;
}
// path.resolve([from ...], to)
// posix version
exports.resolve = function() {
var resolvedPath = '',
resolvedAbsolute = false;
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path = (i >= 0) ? arguments[i] : process.cwd();
// Skip empty and invalid entries
if (typeof path !== 'string') {
throw new TypeError('Arguments to path.resolve must be strings');
} else if (!path) {
continue;
}
resolvedPath = path + '/' + resolvedPath;
resolvedAbsolute = path.charAt(0) === '/';
}
// At this point the path should be resolved to a full absolute path, but
// handle relative paths to be safe (might happen when process.cwd() fails)
// Normalize the path
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
return !!p;
}), !resolvedAbsolute).join('/');
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
};
// path.normalize(path)
// posix version
exports.normalize = function(path) {
var isAbsolute = exports.isAbsolute(path),
trailingSlash = substr(path, -1) === '/';
// Normalize the path
path = normalizeArray(filter(path.split('/'), function(p) {
return !!p;
}), !isAbsolute).join('/');
if (!path && !isAbsolute) {
path = '.';
}
if (path && trailingSlash) {
path += '/';
}
return (isAbsolute ? '/' : '') + path;
};
// posix version
exports.isAbsolute = function(path) {
return path.charAt(0) === '/';
};
// posix version
exports.join = function() {
var paths = Array.prototype.slice.call(arguments, 0);
return exports.normalize(filter(paths, function(p, index) {
if (typeof p !== 'string') {
throw new TypeError('Arguments to path.join must be strings');
}
return p;
}).join('/'));
};
// path.relative(from, to)
// posix version
exports.relative = function(from, to) {
from = exports.resolve(from).substr(1);
to = exports.resolve(to).substr(1);
function trim(arr) {
var start = 0;
for (; start < arr.length; start++) {
if (arr[start] !== '') break;
}
var end = arr.length - 1;
for (; end >= 0; end--) {
if (arr[end] !== '') break;
}
if (start > end) return [];
return arr.slice(start, end - start + 1);
}
var fromParts = trim(from.split('/'));
var toParts = trim(to.split('/'));
var length = Math.min(fromParts.length, toParts.length);
var samePartsLength = length;
for (var i = 0; i < length; i++) {
if (fromParts[i] !== toParts[i]) {
samePartsLength = i;
break;
}
}
var outputParts = [];
for (var i = samePartsLength; i < fromParts.length; i++) {
outputParts.push('..');
}
outputParts = outputParts.concat(toParts.slice(samePartsLength));
return outputParts.join('/');
};
exports.sep = '/';
exports.delimiter = ':';
exports.dirname = function (path) {
if (typeof path !== 'string') path = path + '';
if (path.length === 0) return '.';
var code = path.charCodeAt(0);
var hasRoot = code === 47 /*/*/;
var end = -1;
var matchedSlash = true;
for (var i = path.length - 1; i >= 1; --i) {
code = path.charCodeAt(i);
if (code === 47 /*/*/) {
if (!matchedSlash) {
end = i;
break;
}
} else {
// We saw the first non-path separator
matchedSlash = false;
}
}
if (end === -1) return hasRoot ? '/' : '.';
if (hasRoot && end === 1) {
// return '//';
// Backwards-compat fix:
return '/';
}
return path.slice(0, end);
};
function basename(path) {
if (typeof path !== 'string') path = path + '';
var start = 0;
var end = -1;
var matchedSlash = true;
var i;
for (i = path.length - 1; i >= 0; --i) {
if (path.charCodeAt(i) === 47 /*/*/) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
start = i + 1;
break;
}
} else if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// path component
matchedSlash = false;
end = i + 1;
}
}
if (end === -1) return '';
return path.slice(start, end);
}
// Uses a mixed approach for backwards-compatibility, as ext behavior changed
// in new Node.js versions, so only basename() above is backported here
exports.basename = function (path, ext) {
var f = basename(path);
if (ext && f.substr(-1 * ext.length) === ext) {
f = f.substr(0, f.length - ext.length);
}
return f;
};
exports.extname = function (path) {
if (typeof path !== 'string') path = path + '';
var startDot = -1;
var startPart = 0;
var end = -1;
var matchedSlash = true;
// Track the state of characters (if any) we see before our first dot and
// after any path separator we find
var preDotState = 0;
for (var i = path.length - 1; i >= 0; --i) {
var code = path.charCodeAt(i);
if (code === 47 /*/*/) {
// If we reached a path separator that was not part of a set of path
// separators at the end of the string, stop now
if (!matchedSlash) {
startPart = i + 1;
break;
}
continue;
}
if (end === -1) {
// We saw the first non-path separator, mark this as the end of our
// extension
matchedSlash = false;
end = i + 1;
}
if (code === 46 /*.*/) {
// If this is our first dot, mark it as the start of our extension
if (startDot === -1)
startDot = i;
else if (preDotState !== 1)
preDotState = 1;
} else if (startDot !== -1) {
// We saw a non-dot and non-path separator before our dot, so we should
// have a good chance at having a non-empty extension
preDotState = -1;
}
}
if (startDot === -1 || end === -1 ||
// We saw a non-dot character immediately before the dot
preDotState === 0 ||
// The (right-most) trimmed path component is exactly '..'
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
return '';
}
return path.slice(startDot, end);
};
function filter (xs, f) {
if (xs.filter) return xs.filter(f);
var res = [];
for (var i = 0; i < xs.length; i++) {
if (f(xs[i], i, xs)) res.push(xs[i]);
}
return res;
}
// String.prototype.substr - negative index don't work in IE8
var substr = 'ab'.substr(-1) === 'b'
? function (str, start, len) { return str.substr(start, len) }
: function (str, start, len) {
if (start < 0) start = str.length + start;
return str.substr(start, len);
}
;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("0743")))
/***/ }),
/***/ "026a":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var ObjectRenderer = function () {
function ObjectRenderer(object, encodings, options) {
_classCallCheck(this, ObjectRenderer);
this.object = object;
this.encodings = encodings;
this.options = options;
}
_createClass(ObjectRenderer, [{
key: "render",
value: function render() {
this.object.encodings = this.encodings;
}
}]);
return ObjectRenderer;
}();
exports.default = ObjectRenderer;
/***/ }),
/***/ "0277":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.pharmacode = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _Barcode2 = __webpack_require__("b085");
var _Barcode3 = _interopRequireDefault(_Barcode2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Encoding documentation
// http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf
var pharmacode = function (_Barcode) {
_inherits(pharmacode, _Barcode);
function pharmacode(data, options) {
_classCallCheck(this, pharmacode);
var _this = _possibleConstructorReturn(this, (pharmacode.__proto__ || Object.getPrototypeOf(pharmacode)).call(this, data, options));
_this.number = parseInt(data, 10);
return _this;
}
_createClass(pharmacode, [{
key: "encode",
value: function encode() {
var z = this.number;
var result = "";
// http://i.imgur.com/RMm4UDJ.png
// (source: http://www.gomaro.ch/ftproot/Laetus_PHARMA-CODE.pdf, page: 34)
while (!isNaN(z) && z != 0) {
if (z % 2 === 0) {
// Even
result = "11100" + result;
z = (z - 2) / 2;
} else {
// Odd
result = "100" + result;
z = (z - 1) / 2;
}
}
// Remove the two last zeroes
result = result.slice(0, -2);
return {
data: result,
text: this.text
};
}
}, {
key: "valid",
value: function valid() {
return this.number >= 3 && this.number <= 131070;
}
}]);
return pharmacode;
}(_Barcode3.default);
exports.pharmacode = pharmacode;
/***/ }),
/***/ "02a7":
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory){
'use strict';
/*istanbul ignore next:cant test*/
if ( true && typeof module.exports === 'object') {
module.exports = factory();
} else if (true) {
// AMD. Register as an anonymous module.
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
})(this, function(){
'use strict';
var toStr = Object.prototype.toString;
function hasOwnProperty(obj, prop) {
if(obj == null) {
return false
}
//to handle objects with null prototypes (too edge case?)
return Object.prototype.hasOwnProperty.call(obj, prop)
}
function isEmpty(value){
if (!value) {
return true;
}
if (isArray(value) && value.length === 0) {
return true;
} else if (typeof value !== 'string') {
for (var i in value) {
if (hasOwnProperty(value, i)) {
return false;
}
}
return true;
}
return false;
}
function toString(type){
return toStr.call(type);
}
function isObject(obj){
return typeof obj === 'object' && toString(obj) === "[object Object]";
}
var isArray = Array.isArray || function(obj){
/*istanbul ignore next:cant test*/
return toStr.call(obj) === '[object Array]';
}
function isBoolean(obj){
return typeof obj === 'boolean' || toString(obj) === '[object Boolean]';
}
function getKey(key){
var intKey = parseInt(key);
if (intKey.toString() === key) {
return intKey;
}
return key;
}
function factory(options) {
options = options || {}
var objectPath = function(obj) {
return Object.keys(objectPath).reduce(function(proxy, prop) {
if(prop === 'create') {
return proxy;
}
/*istanbul ignore else*/
if (typeof objectPath[prop] === 'function') {
proxy[prop] = objectPath[prop].bind(objectPath, obj);
}
return proxy;
}, {});
};
var hasShallowProperty
if (options.includeInheritedProps) {
hasShallowProperty = function () {
return true
}
} else {
hasShallowProperty = function (obj, prop) {
return (typeof prop === 'number' && Array.isArray(obj)) || hasOwnProperty(obj, prop)
}
}
function getShallowProperty(obj, prop) {
if (hasShallowProperty(obj, prop)) {
return obj[prop];
}
}
function set(obj, path, value, doNotReplace){
if (typeof path === 'number') {
path = [path];
}
if (!path || path.length === 0) {
return obj;
}
if (typeof path === 'string') {
return set(obj, path.split('.').map(getKey), value, doNotReplace);
}
var currentPath = path[0];
var currentValue = getShallowProperty(obj, currentPath);
if (options.includeInheritedProps && (currentPath === '__proto__' ||
(currentPath === 'constructor' && typeof currentValue === 'function'))) {
throw new Error('For security reasons, object\'s magic properties cannot be set')
}
if (path.length === 1) {
if (currentValue === void 0 || !doNotReplace) {
obj[currentPath] = value;
}
return currentValue;
}
if (currentValue === void 0) {
//check if we assume an array
if(typeof path[1] === 'number') {
obj[currentPath] = [];
} else {
obj[currentPath] = {};
}
}
return set(obj[currentPath], path.slice(1), value, doNotReplace);
}
objectPath.has = function (obj, path) {
if (typeof path === 'number') {
path = [path];
} else if (typeof path === 'string') {
path = path.split('.');
}
if (!path || path.length === 0) {
return !!obj;
}
for (var i = 0; i < path.length; i++) {
var j = getKey(path[i]);
if((typeof j === 'number' && isArray(obj) && j < obj.length) ||
(options.includeInheritedProps ? (j in Object(obj)) : hasOwnProperty(obj, j))) {
obj = obj[j];
} else {
return false;
}
}
return true;
};
objectPath.ensureExists = function (obj, path, value){
return set(obj, path, value, true);
};
objectPath.set = function (obj, path, value, doNotReplace){
return set(obj, path, value, doNotReplace);
};
objectPath.insert = function (obj, path, value, at){
var arr = objectPath.get(obj, path);
at = ~~at;
if (!isArray(arr)) {
arr = [];
objectPath.set(obj, path, arr);
}
arr.splice(at, 0, value);
};
objectPath.empty = function(obj, path) {
if (isEmpty(path)) {
return void 0;
}
if (obj == null) {
return void 0;
}
var value, i;
if (!(value = objectPath.get(obj, path))) {
return void 0;
}
if (typeof value === 'string') {
return objectPath.set(obj, path, '');
} else if (isBoolean(value)) {
return objectPath.set(obj, path, false);
} else if (typeof value === 'number') {
return objectPath.set(obj, path, 0);
} else if (isArray(value)) {
value.length = 0;
} else if (isObject(value)) {
for (i in value) {
if (hasShallowProperty(value, i)) {
delete value[i];
}
}
} else {
return objectPath.set(obj, path, null);
}
};
objectPath.push = function (obj, path /*, values */){
var arr = objectPath.get(obj, path);
if (!isArray(arr)) {
arr = [];
objectPath.set(obj, path, arr);
}
arr.push.apply(arr, Array.prototype.slice.call(arguments, 2));
};
objectPath.coalesce = function (obj, paths, defaultValue) {
var value;
for (var i = 0, len = paths.length; i < len; i++) {
if ((value = objectPath.get(obj, paths[i])) !== void 0) {
return value;
}
}
return defaultValue;
};
objectPath.get = function (obj, path, defaultValue){
if (typeof path === 'number') {
path = [path];
}
if (!path || path.length === 0) {
return obj;
}
if (obj == null) {
return defaultValue;
}
if (typeof path === 'string') {
return objectPath.get(obj, path.split('.'), defaultValue);
}
var currentPath = getKey(path[0]);
var nextObj = getShallowProperty(obj, currentPath)
if (nextObj === void 0) {
return defaultValue;
}
if (path.length === 1) {
return nextObj;
}
return objectPath.get(obj[currentPath], path.slice(1), defaultValue);
};
objectPath.del = function del(obj, path) {
if (typeof path === 'number') {
path = [path];
}
if (obj == null) {
return obj;
}
if (isEmpty(path)) {
return obj;
}
if(typeof path === 'string') {
return objectPath.del(obj, path.split('.'));
}
var currentPath = getKey(path[0]);
if (!hasShallowProperty(obj, currentPath)) {
return obj;
}
if(path.length === 1) {
if (isArray(obj)) {
obj.splice(currentPath, 1);
} else {
delete obj[currentPath];
}
} else {
return objectPath.del(obj[currentPath], path.slice(1));
}
return obj;
}
return objectPath;
}
var mod = factory();
mod.create = factory;
mod.withInheritedProps = factory({includeInheritedProps: true})
return mod;
});
/***/ }),
/***/ "0412":
/***/ (function(module, exports) {
/**
* A specialized version of `_.filter` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
module.exports = arrayFilter;
/***/ }),
/***/ "043c":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1d81f631-vue-loader-template"}!./node_modules/.store/vue-loader@15.11.1/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/.store/vue-loader@15.11.1/node_modules/vue-loader/lib??vue-loader-options!./packages/form-design/items/base/batch/index.vue?vue&type=template&id=c49c7154
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:[
'ng-base-batch',
_vm.record.options.customClass ? _vm.record.options.customClass : ''
],style:(_vm.record.options.customStyle)},[(_vm.isDragPanel)?[_c('el-row',{attrs:{"gutter":20}},[_c('draggable',_vm._b({staticClass:"draggable-box",attrs:{"tag":"div"},on:{"add":function($event){return _vm.dragEnd($event, _vm.record.list)}},model:{value:(_vm.record.list),callback:function ($$v) {_vm.$set(_vm.record, "list", $$v)},expression:"record.list"}},'draggable',{
group: 'form-draggable' ,
ghostClass: 'moving',
animation: 180,
handle: '.drag-move'
},false),_vm._l((_vm.record.list),function(item){return _c('ng-form-node',{key:item.key,staticClass:"drag-move",attrs:{"selectItem":_vm.selectItem,"record":item},on:{"handleSelectItem":_vm.handleSelectItem,"handleCopy":function($event){return _vm.handleCopy(item)},"handleDetele":function($event){return _vm.handleDetele(item)}}})}),1)],1)]:[_c('TableBuild',{attrs:{"record":_vm.record,"models":_vm.models,"prop-prepend":_vm.propPrepend,"preview":_vm.preview}})]],2)}
var staticRenderFns = []
// CONCATENATED MODULE: ./packages/form-design/items/base/batch/index.vue?vue&type=template&id=c49c7154
// CONCATENATED MODULE: ./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1d81f631-vue-loader-template"}!./node_modules/.store/vue-loader@15.11.1/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/.store/vue-loader@15.11.1/node_modules/vue-loader/lib??vue-loader-options!./packages/form-design/items/base/batch/build/index.vue?vue&type=template&id=46b38874
var buildvue_type_template_id_46b38874_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"form-table-index",attrs:{"id":_vm.record.model,"name":_vm.record.model}},[_c('el-table',{class:[
'form-table',
_vm.record.options.customClass ? _vm.record.options.customClass : ''
],style:(_vm.record.options.customStyle),attrs:{"size":_vm.config.size,"data":_vm.models[_vm.record.model],"empty-text":_vm.getLabel(_vm.record.options.noDataText) || _vm.t('ngform.item.batch.no_data'),"border":_vm.record.options.showBorder,"scroll":{
x:
_vm.record.list.length * 190 +
80 +
(!_vm.record.options.hideSequence ? 60 : 0),
y: _vm.record.options.scrollY
}}},[(_vm.isVisible)?[(!_vm.record.options.hideSequence)?_c('el-table-column',{attrs:{"label":_vm.t('ngform.item.batch.seq'),"align":"center","type":"index","width":"50"}}):_vm._e(),_vm._l((_vm.record.list),function(item,index){return [(_vm.record.options.addType != 'dialog' || (!_vm.record.options.showItem || _vm.record.options.showItem.length == 0 || _vm.record.options.showItem.includes(item.model) ))?_c('el-table-column',{key:index,attrs:{"label":item.label,"width":_vm.record.options.colWidth && _vm.record.options.colWidth[item.model] ? _vm.record.options.colWidth[item.model] : undefined,"align":"center"},scopedSlots:_vm._u([{key:"default",fn:function(scope){return [_c('TableItem',{attrs:{"record":item,"index":scope.$index,"models":_vm.models,"parent-model":_vm.propPrepend + _vm.record.model,"preview":_vm.preview || _vm.record.options.addType == 'dialog',"domains":_vm.models[_vm.record.model][scope.$index]}})]}}],null,true)}):_vm._e()]}),(!_vm.preview || _vm.record.options.addType == 'dialog')?_c('el-table-column',{attrs:{"label":_vm.t('ngform.item.batch.operate'),"align":"center","fixed":_vm.record.options.fixedBtn ? 'right' : undefined,"width":_vm.controlWidth},scopedSlots:_vm._u([{key:"default",fn:function(scope){return [(_vm.preview && _vm.record.options.addType == 'dialog')?_c('el-button',{attrs:{"type":"success","size":_vm.config.size},on:{"click":function($event){return _vm.updateDomain(scope.row)}}},[_c('i',{staticClass:"el-icon-eye"}),_vm._v(" "+_vm._s(_vm.t('ngform.item.view'))+" ")]):_vm._e(),(!_vm.preview && _vm.record.options.addType == 'dialog')?_c('el-button',{attrs:{"type":"primary","size":_vm.config.size},on:{"click":function($event){return _vm.updateDomain(scope.row)}}},[_c('i',{staticClass:"el-icon-edit"}),_vm._v(" "+_vm._s(_vm.t('ngform.item.edit'))+" ")]):_vm._e(),(!_vm.preview && _vm.record.options.copyRow)?_c('el-button',{attrs:{"type":"primary","size":_vm.config.size},on:{"click":function($event){return _vm.copyDomain(scope.row , scope.$index)}}},[_c('i',{staticClass:"el-icon-copy-document"}),_vm._v(_vm._s(_vm.t('ngform.item.copy'))+" ")]):_vm._e(),(!_vm.preview)?_c('el-button',{attrs:{"type":"danger","size":_vm.config.size},on:{"click":function($event){return _vm.removeDomain(scope.$index)}}},[_c('i',{staticClass:"el-icon-delete"}),_vm._v(_vm._s(_vm.t('ngform.item.delete'))+" ")]):_vm._e()]}}],null,false,3974457320)}):_vm._e()]:_vm._e()],2),(!_vm.preview)?_c('el-button',{attrs:{"size":_vm.config.size,"type":"dashed","disabled":_vm.curDisabled},on:{"click":_vm.addDomain}},[_c('i',{staticClass:"el-icon-circle-plus-outline"}),_vm._v(_vm._s(_vm.t('ngform.item.add'))+" ")]):_vm._e(),(_vm.addOrUpdateVisible)?_c('AddOrUpdate',{ref:"addOrUpdate",attrs:{"formTemplate":_vm.templateData,"preview":_vm.preview},on:{"formAdd":_vm.formAdd,"formUpdate":_vm.formUpdate}}):_vm._e()],1)}
var buildvue_type_template_id_46b38874_staticRenderFns = []
// CONCATENATED MODULE: ./packages/form-design/items/base/batch/build/index.vue?vue&type=template&id=46b38874
// CONCATENATED MODULE: ./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1d81f631-vue-loader-template"}!./node_modules/.store/vue-loader@15.11.1/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/.store/vue-loader@15.11.1/node_modules/vue-loader/lib??vue-loader-options!./packages/form-design/items/base/batch/build/table-item.vue?vue&type=template&id=06238e04
var table_itemvue_type_template_id_06238e04_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('ng-form-item',{attrs:{"disabled":_vm.disabled,"preview":_vm.preview,"models":_vm.domains,"record":_vm.record,"show-label":false,"prop-prepend":_vm.parentModel + '.' + _vm.index + '.'},on:{"focus":function($event){return _vm.$emit('focus')},"blur":function($event){return _vm.$emit('blur')}}})],1)}
var table_itemvue_type_template_id_06238e04_staticRenderFns = []
// CONCATENATED MODULE: ./packages/form-design/items/base/batch/build/table-item.vue?vue&type=template&id=06238e04
// CONCATENATED MODULE: ./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/.store/vue-loader@15.11.1/node_modules/vue-loader/lib??vue-loader-options!./packages/form-design/items/base/batch/build/table-item.vue?vue&type=script&lang=js
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var table_itemvue_type_script_lang_js = ({
name: "TableItem",
props: {
record: {
type: Object,
required : true
},
// 是否预览结果表单
preview: {
type: Boolean ,
default: false
},
index: {
type: Number
},
models: {
type: Object
},
domains: {
type: Object
},
disabled: {
type: Boolean,
default: false
},
parentModel: {
type: String,
required : true
}
},
computed: {
customList() {
if (this.$GSFORM && this.$GSFORM.customComponents) {
const customComponents_ = this.$GSFORM.customComponents
return customComponents_.map(item => item.type);
} else {
return [];
}
},
recordRules() {
// 2020-07-29 如果是预览 不需要规则验证
if(this.preview || !this.record.rules || this.record.rules.length == 0) {
return []
}
let rules =this.record.rules
// 2020-09-12 判断是否必填 ,非必填得没有值得时候不校验
const isRequire = rules[0].required
// 循环判断
for(var i = 0 ; i < rules.length ; i++){
const t = rules[i]
t.required = isRequire
// 2021-08-12 lyf 针对必填而且是文本输入的组件增加纯空格校验
if(t.required && (this.record.type == 'input' || this.record.type == 'textarea') ){
t.whitespace = true
}
if(t.vtype == 1 || t.vtype == 2){
t.validator = this.validatorFiled
}
// 判断trigger
if(!t.trigger) {
t.trigger = ['change','blur']
}
}
return rules
}
},
methods: {
}
});
// CONCATENATED MODULE: ./packages/form-design/items/base/batch/build/table-item.vue?vue&type=script&lang=js
/* harmony default export */ var build_table_itemvue_type_script_lang_js = (table_itemvue_type_script_lang_js);
// EXTERNAL MODULE: ./node_modules/.store/vue-loader@15.11.1/node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__("1805");
// CONCATENATED MODULE: ./packages/form-design/items/base/batch/build/table-item.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
build_table_itemvue_type_script_lang_js,
table_itemvue_type_template_id_06238e04_render,
table_itemvue_type_template_id_06238e04_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var table_item = (component.exports);
// CONCATENATED MODULE: ./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1d81f631-vue-loader-template"}!./node_modules/.store/vue-loader@15.11.1/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/.store/vue-loader@15.11.1/node_modules/vue-loader/lib??vue-loader-options!./packages/form-design/items/base/batch/build/add-or-update.vue?vue&type=template&id=2201eef0
var add_or_updatevue_type_template_id_2201eef0_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-dialog',{attrs:{"title":!_vm.dataForm._id ? _vm.t('ngform.item.add') : _vm.t('ngform.item.edit'),"close-on-click-modal":false,"append-to-body":true,"lock-scroll":false,"visible":_vm.visible,"id":_vm.randomId},on:{"update:visible":function($event){_vm.visible=$event}}},[(typeof _vm.formTemplate.list !== 'undefined')?_c('el-form',{key:_vm.dataForm._id,ref:"dataForm",staticClass:"form-build form-design",attrs:{"label-position":_vm.config.labelPosition,"hide-required-asterisk":_vm.config.hideRequiredMark,"label-width":_vm.config.labelWidth + 'px',"model":_vm.dataForm,"size":"mini"}},[_c('el-row',{attrs:{"gutter":20}},[_vm._l((_vm.formTemplate.list),function(item){return [_c('el-col',{attrs:{"span":item.span || 24}},[_c('ng-form-item',{key:item.key,attrs:{"disabled":_vm.disabled,"preview":_vm.preview,"models":_vm.dataForm,"record":item},on:{"update:models":function($event){_vm.dataForm=$event},"focus":_vm.handleFocus,"blur":_vm.handleBlur}})],1)]})],2),_c('el-form-item',{attrs:{"label":_vm.t('ngform.item.batch.seq_label'),"prop":"seq"}},[(_vm.preview)?[_vm._v(" "+_vm._s(_vm.dataForm.seq)+" ")]:[_c('el-input-number',{attrs:{"controls-position":"right","min":0,"placeholder":_vm.t('ngform.item.batch.seq_label'),"disabled":_vm.preview},model:{value:(_vm.dataForm.seq),callback:function ($$v) {_vm.$set(_vm.dataForm, "seq", $$v)},expression:"dataForm.seq"}})]],2)],1):_vm._e(),_c('div',{staticClass:"mod-footer"},[_c('el-button',{attrs:{"size":"mini"},on:{"click":function($event){_vm.visible = false}}},[_vm._v(_vm._s(_vm.t("ngform.cancel")))]),(!_vm.preview)?_c('el-button',{attrs:{"size":"mini","disabled":_vm.loading,"type":"primary"},on:{"click":function($event){return _vm.dataFormSubmit()}}},[_vm._v(_vm._s(_vm.t("ngform.confirm")))]):_vm._e()],1)],1)}
var add_or_updatevue_type_template_id_2201eef0_staticRenderFns = []
// CONCATENATED MODULE: ./packages/form-design/items/base/batch/build/add-or-update.vue?vue&type=template&id=2201eef0
// EXTERNAL MODULE: ./packages/locale/mixin.js
var mixin = __webpack_require__("b5ee");
// EXTERNAL MODULE: ./node_modules/.store/lodash@4.17.21/node_modules/lodash/cloneDeep.js
var cloneDeep = __webpack_require__("45e6");
var cloneDeep_default = /*#__PURE__*/__webpack_require__.n(cloneDeep);
// EXTERNAL MODULE: ./packages/utils/index.js
var utils = __webpack_require__("e74d");
// CONCATENATED MODULE: ./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/.store/vue-loader@15.11.1/node_modules/vue-loader/lib??vue-loader-options!./packages/form-design/items/base/batch/build/add-or-update.vue?vue&type=script&lang=js
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var add_or_updatevue_type_script_lang_js = ({
name: "table-add-or-update",
mixins: [mixin["a" /* default */]],
data() {
return {
randomId: "",
loading: false,
visible: false,
dataForm: {
_id: "",
seq: 0
},
dataRule: {}
}
},
computed: {
customList() {
if (this.customComponents) {
return this.customComponents.map((item) => item.type)
} else {
return []
}
},
config() {
if(this.configInject && this.configInject != null && this.configInject != undefined) {
return this.configInject() || {}
}
return {}
}
},
props: {
// 表格内部的配置
formTemplate: {
type: Object,
default: () => ({})
},
// 是否预览结果表单
preview: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
}
},
inject: {
// 表单全局config配置
configInject: {
from: "configC"
},
customComponents: {
from: "customC",
default: () => []
}
},
methods: {
recordRules(record) {
// 2020-07-29 如果是预览 不需要规则验证
if (this.preview) {
return []
}
const rules = record.rules
// 循环判断
for (var i = 0; i < rules.length; i++) {
const t = rules[i]
if (t.vtype == 1 || t.vtype == 2) {
t.validator = this.validatorFiled
}
if (t.required && (record.type == "input" || record.type == "textarea")) {
t.whitespace = true
}
// 判断trigger
if (!t.trigger) {
t.trigger = ["change", "blur"]
}
}
return rules
},
dynamicVisibleItem(record) {
if (!record.options || !record.options.dynamicVisible) {
return true
}
if (!record.options.dynamicVisibleValue) {
return true
}
let fstr = record.options.dynamicVisibleValue
// 打开了开关 这里获取函数内容
const func = Object(utils["dynamicFun"])(fstr, this.dataForm)
return func
},
// 2021-03-12 清理没有显示的组件的数据
clearHiddenValue() {
// 根据组件ID 是否隐藏为准
// 根据 formTemplate.config.outputHidden 来判断是否要输出隐藏
if (!this.config || !this.config.outputHidden) {
const formdesign = document.getElementById(this.randomId)
// 循环当前数据 非P 开头的统一不深入第二层
for (let key in this.dataForm) {
if (key.indexOf("_label") > 0 || key == "_id" || key == "seq") continue
// 判断key的id是否还在
const key_div = formdesign.querySelector("#" + key)
if (!key_div) {
// 删除
delete this.dataForm[key]
delete this.dataForm[key + "_label"]
}
}
}
},
validatorFiled(rule, value, callback) {
// 判断rule类型
if (rule.vtype == 1) {
// 正则
if (!rule.pattern) {
callback()
return
}
// 正则匹配
var patt1 = new RegExp(rule.pattern)
//document.write(patt1.test("free"));
if (patt1.test(value)) {
callback()
} else {
callback(new Error(rule.message))
}
return
} else if (rule.vtype == 2) {
// 表达式
const script = rule.script
// 打开了开关 这里获取函数内容
const fvalue = Object(utils["dynamicFun"])(script, this.dataForm)
if (!fvalue) {
callback(new Error(rule.message))
} else {
callback()
}
}
},
init(data) {
this.randomId = "ng_table_dialog" + new Date().getTime()
this.visible = true
this.dataForm._id = null
if (data) {
//this.dataForm = data
for (var i in data) {
//this.dataForm[i] = data[i]
this.$set(this.dataForm, i, data[i])
}
} else {
// 初始化数据
//const d = {}
this.dataForm.seq = 0
this.formTemplate.list.forEach((item) => {
if (item.options.defaultValue) this.$set(this.dataForm, item.model, item.options.defaultValue)
//this.dataForm[item.model] = item.options.defaultValue;
//this.dataForm[item.model] = undefined
else this.$set(this.dataForm, item.model, undefined)
// 删除对应的label
delete this.dataForm[item.model + "label"]
})
console.log("this.dataForm", this.dataForm)
this.$nextTick(() => {
this.$refs["dataForm"] && this.$refs["dataForm"].resetFields()
})
}
},
// 表单提交
dataFormSubmit() {
this.$refs["dataForm"] &&
this.$refs["dataForm"].validate((valid) => {
if (valid) {
this.loading = true
this.clearHiddenValue()
if (!this.dataForm._id) {
// 回填一个ID
const id = new Date().getTime() * 10 + parseInt(Math.random() * 100)
this.dataForm._id = id
this.$emit("formAdd", cloneDeep_default()(this.dataForm))
} else {
this.$emit("formUpdate", cloneDeep_default()(this.dataForm))
}
this.loading = false
this.visible = false
}
})
}
}
});
// CONCATENATED MODULE: ./packages/form-design/items/base/batch/build/add-or-update.vue?vue&type=script&lang=js
/* harmony default export */ var build_add_or_updatevue_type_script_lang_js = (add_or_updatevue_type_script_lang_js);
// EXTERNAL MODULE: ./packages/form-design/items/base/batch/build/add-or-update.vue?vue&type=style&index=0&id=2201eef0&prod&lang=css
var add_or_updatevue_type_style_index_0_id_2201eef0_prod_lang_css = __webpack_require__("06f2");
// CONCATENATED MODULE: ./packages/form-design/items/base/batch/build/add-or-update.vue
/* normalize component */
var add_or_update_component = Object(componentNormalizer["a" /* default */])(
build_add_or_updatevue_type_script_lang_js,
add_or_updatevue_type_template_id_2201eef0_render,
add_or_updatevue_type_template_id_2201eef0_staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var add_or_update = (add_or_update_component.exports);
// EXTERNAL MODULE: ./packages/form-design/items/mixin.js
var items_mixin = __webpack_require__("93f0");
// CONCATENATED MODULE: ./node_modules/.store/cache-loader@4.1.0/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/.store/vue-loader@15.11.1/node_modules/vue-loader/lib??vue-loader-options!./packages/form-design/items/base/batch/build/index.vue?vue&type=script&lang=js
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//import TableFormItem from "./table-form-item";
/* harmony default export */ var buildvue_type_script_lang_js = ({
name: "ng-form-base-batch",
mixins: [items_mixin["a" /* default */]] ,
components: {
TableItem: table_item,AddOrUpdate: add_or_update
},
data() {
return {
addOrUpdateVisible: false,
isVisible: true
};
},
props:{
record: {
type: Object,
required : true
},
models: {
type: Object,
required : true
},
parentDisabled: {
type: Boolean,
default: false
},
// 是否预览结果表单
preview: {
type: Boolean ,
default: false
},
propPrepend:{
type: String,
default: ''
}
},
computed: {
curDisabled() {
return this.record.options.disabled || this.disabled || this.parentDisabled;
},
templateData() {
return {list: this.record.list, config: this.config }
},
controlWidth() {
let w = 100
if(this.preview) {
return w
}
if(this.record.options.copyRow) {
w += 80
}
if(this.record.options.addType == 'dialog') {
w += 80
}
return w
},
config() {
if(this.configInject && this.configInject != null && this.configInject != undefined) {
return this.configInject() || {}
}
return {}
},
},
inject: {
// 表单全局config配置
configInject: {
from: 'configC'
}
},
mounted(){
// 2021-05-10 lyf 只要没有默认值都先给回填一个 这个可以处理初始化么有值,导致后面很多联动没法做,必须要通过v-if刷新
if(!Object.prototype.hasOwnProperty.call(this.models, this.record.model) ) {
this.$set(this.models , this.record.model , [])
}
this.$ngform_bus.$on('reset', () => {
this.$set(this.models , this.record.model , [])
});
},
methods: {
validationSubform() {
return true ;
},
resetForm() {
this.$refs.dynamicValidateForm.resetFields();
},
removeDomain(index) {
const this_ = this
this.$confirm(this.t('ngform.item.batch.delete_prompt'), this.t('ngform.header.prompt'), {
confirmButtonText: this.t('ngform.confirm'),
cancelButtonText: this.t('ngform.cancel'),
type: 'warning'
}).then(() => {
let domains = this.models[this.record.model]
if(domains) {
if (index !== -1) {
domains.splice(index, 1);
this.$message({
message: this_.t('ngform.item.batch.operation_success'),
type: 'success',
duration: 1000
})