@panpanzhao/component-ui 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -82,7 +82,7 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 72);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 73);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
@@ -94,18 +94,19 @@ module.exports = require("@vue/babel-helper-vue-jsx-merge-props");
94
94
 
95
95
  /***/ }),
96
96
 
97
- /***/ 19:
97
+ /***/ 20:
98
98
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
99
99
 
100
100
  "use strict";
101
101
 
102
102
  // EXPORTS
103
- __webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ uuid; });
104
- __webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ findTree; });
105
- __webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ findTreeIndex; });
106
- __webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ spliceTreeSelf; });
103
+ __webpack_require__.d(__webpack_exports__, "e", function() { return /* reexport */ uuid; });
104
+ __webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ eachTree; });
105
+ __webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ findTree; });
106
+ __webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ findTreeIndex; });
107
+ __webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ spliceTreeSelf; });
107
108
 
108
- // UNUSED EXPORTS: mapTree, eachTree, getTree, filterTree, everyTree, someTree, spliceTree, getTreeDepth, getTreeAncestors, getTreeParent
109
+ // UNUSED EXPORTS: mapTree, getTree, filterTree, everyTree, someTree, spliceTree, getTreeDepth, getTreeAncestors, getTreeParent
109
110
 
110
111
  // CONCATENATED MODULE: ./src/utils/helper.js
111
112
  // 参考 https://github.com/streamich/v4-uuid
@@ -441,77 +442,77 @@ function spliceTreeSelf(tree, idx, deleteCount) {
441
442
 
442
443
  /***/ }),
443
444
 
444
- /***/ 20:
445
+ /***/ 22:
445
446
  /***/ (function(module, exports) {
446
447
 
447
448
  module.exports = require("element-ui/lib/input");
448
449
 
449
450
  /***/ }),
450
451
 
451
- /***/ 29:
452
+ /***/ 3:
452
453
  /***/ (function(module, exports) {
453
454
 
454
- module.exports = require("codemirror");
455
+ module.exports = require("@panpanzhao/component-ui/lib/utils/formula");
455
456
 
456
457
  /***/ }),
457
458
 
458
- /***/ 5:
459
+ /***/ 33:
459
460
  /***/ (function(module, exports) {
460
461
 
461
- module.exports = require("element-ui/lib/tabs");
462
+ module.exports = require("codemirror");
462
463
 
463
464
  /***/ }),
464
465
 
465
- /***/ 59:
466
+ /***/ 6:
466
467
  /***/ (function(module, exports) {
467
468
 
468
- module.exports = require("element-ui/lib/tree");
469
+ module.exports = require("element-ui/lib/tabs");
469
470
 
470
471
  /***/ }),
471
472
 
472
- /***/ 6:
473
+ /***/ 62:
473
474
  /***/ (function(module, exports) {
474
475
 
475
- module.exports = require("element-ui/lib/tab-pane");
476
+ module.exports = require("element-ui/lib/tree");
476
477
 
477
478
  /***/ }),
478
479
 
479
- /***/ 60:
480
+ /***/ 63:
480
481
  /***/ (function(module, exports) {
481
482
 
482
483
  module.exports = require("element-ui/lib/badge");
483
484
 
484
485
  /***/ }),
485
486
 
486
- /***/ 61:
487
+ /***/ 64:
487
488
  /***/ (function(module, exports) {
488
489
 
489
490
  module.exports = require("element-ui/lib/message");
490
491
 
491
492
  /***/ }),
492
493
 
493
- /***/ 65:
494
+ /***/ 66:
494
495
  /***/ (function(module, exports) {
495
496
 
496
497
  module.exports = require("codemirror/mode/javascript/javascript");
497
498
 
498
499
  /***/ }),
499
500
 
500
- /***/ 66:
501
+ /***/ 67:
501
502
  /***/ (function(module, exports) {
502
503
 
503
504
  module.exports = require("codemirror/mode/htmlmixed/htmlmixed");
504
505
 
505
506
  /***/ }),
506
507
 
507
- /***/ 67:
508
+ /***/ 68:
508
509
  /***/ (function(module, exports) {
509
510
 
510
511
  module.exports = require("codemirror/addon/mode/simple");
511
512
 
512
513
  /***/ }),
513
514
 
514
- /***/ 68:
515
+ /***/ 69:
515
516
  /***/ (function(module, exports) {
516
517
 
517
518
  module.exports = require("codemirror/addon/mode/multiplex");
@@ -521,11 +522,11 @@ module.exports = require("codemirror/addon/mode/multiplex");
521
522
  /***/ 7:
522
523
  /***/ (function(module, exports) {
523
524
 
524
- module.exports = require("element-ui/lib/collapse");
525
+ module.exports = require("element-ui/lib/tab-pane");
525
526
 
526
527
  /***/ }),
527
528
 
528
- /***/ 72:
529
+ /***/ 73:
529
530
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
530
531
 
531
532
  "use strict";
@@ -537,20 +538,20 @@ var babel_helper_vue_jsx_merge_props_ = __webpack_require__(0);
537
538
  var babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(babel_helper_vue_jsx_merge_props_);
538
539
 
539
540
  // EXTERNAL MODULE: external "codemirror"
540
- var external_codemirror_ = __webpack_require__(29);
541
+ var external_codemirror_ = __webpack_require__(33);
541
542
  var external_codemirror_default = /*#__PURE__*/__webpack_require__.n(external_codemirror_);
542
543
 
543
544
  // EXTERNAL MODULE: external "codemirror/mode/javascript/javascript"
544
- var javascript_ = __webpack_require__(65);
545
+ var javascript_ = __webpack_require__(66);
545
546
 
546
547
  // EXTERNAL MODULE: external "codemirror/mode/htmlmixed/htmlmixed"
547
- var htmlmixed_ = __webpack_require__(66);
548
+ var htmlmixed_ = __webpack_require__(67);
548
549
 
549
550
  // EXTERNAL MODULE: external "codemirror/addon/mode/simple"
550
- var simple_ = __webpack_require__(67);
551
+ var simple_ = __webpack_require__(68);
551
552
 
552
553
  // EXTERNAL MODULE: external "codemirror/addon/mode/multiplex"
553
- var multiplex_ = __webpack_require__(68);
554
+ var multiplex_ = __webpack_require__(69);
554
555
 
555
556
  // CONCATENATED MODULE: ./src/components/formula/src/codeMirror.js
556
557
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
@@ -651,15 +652,15 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
651
652
  }
652
653
  });
653
654
  // EXTERNAL MODULE: external "element-ui/lib/input"
654
- var input_ = __webpack_require__(20);
655
+ var input_ = __webpack_require__(22);
655
656
  var input_default = /*#__PURE__*/__webpack_require__.n(input_);
656
657
 
657
658
  // EXTERNAL MODULE: external "element-ui/lib/collapse"
658
- var collapse_ = __webpack_require__(7);
659
+ var collapse_ = __webpack_require__(8);
659
660
  var collapse_default = /*#__PURE__*/__webpack_require__.n(collapse_);
660
661
 
661
662
  // EXTERNAL MODULE: external "element-ui/lib/collapse-item"
662
- var collapse_item_ = __webpack_require__(8);
663
+ var collapse_item_ = __webpack_require__(9);
663
664
  var collapse_item_default = /*#__PURE__*/__webpack_require__.n(collapse_item_);
664
665
 
665
666
  // CONCATENATED MODULE: ./src/components/formula/src/funcList.js
@@ -781,23 +782,23 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
781
782
  }
782
783
  });
783
784
  // EXTERNAL MODULE: external "element-ui/lib/tabs"
784
- var tabs_ = __webpack_require__(5);
785
+ var tabs_ = __webpack_require__(6);
785
786
  var tabs_default = /*#__PURE__*/__webpack_require__.n(tabs_);
786
787
 
787
788
  // EXTERNAL MODULE: external "element-ui/lib/tab-pane"
788
- var tab_pane_ = __webpack_require__(6);
789
+ var tab_pane_ = __webpack_require__(7);
789
790
  var tab_pane_default = /*#__PURE__*/__webpack_require__.n(tab_pane_);
790
791
 
791
792
  // EXTERNAL MODULE: external "element-ui/lib/tree"
792
- var tree_ = __webpack_require__(59);
793
+ var tree_ = __webpack_require__(62);
793
794
  var tree_default = /*#__PURE__*/__webpack_require__.n(tree_);
794
795
 
795
796
  // EXTERNAL MODULE: external "element-ui/lib/badge"
796
- var badge_ = __webpack_require__(60);
797
+ var badge_ = __webpack_require__(63);
797
798
  var badge_default = /*#__PURE__*/__webpack_require__.n(badge_);
798
799
 
799
800
  // EXTERNAL MODULE: ./src/utils/index.js + 2 modules
800
- var utils = __webpack_require__(19);
801
+ var utils = __webpack_require__(20);
801
802
 
802
803
  // CONCATENATED MODULE: ./src/components/formula/src/variableList.js
803
804
 
@@ -848,7 +849,7 @@ var utils = __webpack_require__(19);
848
849
  methods: {
849
850
  handleSearch: function handleSearch(val) {
850
851
  this.searchVal = val;
851
- var filtered = Object(utils["a" /* findTree */])(this.data, function (i) {
852
+ var filtered = Object(utils["b" /* findTree */])(this.data, function (i) {
852
853
  return ~i.label.indexOf(val);
853
854
  });
854
855
  this.filterVars = !val ? this.data : filtered ? [filtered] : [];
@@ -890,7 +891,7 @@ var utils = __webpack_require__(19);
890
891
  "attrs": {
891
892
  "value": "self"
892
893
  }
893
- }, [h("label", [data.label])]), data.label && (!this.selfVariableName || data.value !== this.selfVariableName) && h("label", [data.label]), data.tag ? h("span", {
894
+ }, [h("label", [data.label])]), data.label && (!this.selfVariableName || data.value !== this.selfVariableName) && h("label", [data.label]), data.label && data.tag ? h("span", {
894
895
  "class": this.classPrefix + "-item-tag"
895
896
  }, [data.tag]) : null]);
896
897
  },
@@ -991,30 +992,10 @@ var utils = __webpack_require__(19);
991
992
  }
992
993
  });
993
994
  // CONCATENATED MODULE: ./src/components/formula/src/plugin.js
994
- /**
995
- * @file 扩展 codemirror
996
- */
997
995
 
998
996
  /**
999
- * 遍历树
1000
- * @param tree
1001
- * @param iterator
997
+ * @file 扩展 codemirror
1002
998
  */
1003
- function eachTree(tree, iterator, level, paths) {
1004
- if (level === void 0) {
1005
- level = 1;
1006
- }
1007
- if (paths === void 0) {
1008
- paths = [];
1009
- }
1010
- tree.map(function (item, index) {
1011
- var currentPath = paths.concat(item);
1012
- iterator(item, index, level, currentPath);
1013
- if (item.children && item.children.splice) {
1014
- eachTree(item.children, iterator, level + 1, currentPath);
1015
- }
1016
- });
1017
- }
1018
999
  function replaceStrByIndex(str, idx, key, replaceKey) {
1019
1000
  var from = str.slice(0, idx);
1020
1001
  var left = str.slice(idx);
@@ -1032,20 +1013,29 @@ function plugin_editorFactory(dom, cm, props) {
1032
1013
  mode: props && props.evalMode ? 'text/formula' : 'text/formula-template'
1033
1014
  });
1034
1015
  }
1035
- var FormulaPlugin = /*#__PURE__*/function () {
1016
+ var plugin_FormulaPlugin = /*#__PURE__*/function () {
1036
1017
  function FormulaPlugin(editor, cm, getProps) {
1018
+ var _this = this;
1037
1019
  this.editor = editor;
1038
1020
  this.cm = cm;
1039
1021
  this.getProps = getProps;
1040
- // editor.on('change', this.autoMarkText);
1022
+ editor.on('change', function (editorDom) {
1023
+ //处理第一次初始化
1024
+ var val = editorDom.getDoc().getValue();
1025
+ var _this$getProps = _this.getProps(),
1026
+ value = _this$getProps.value;
1027
+ if (val == value) {
1028
+ _this.autoMarkText();
1029
+ }
1030
+ });
1041
1031
  this.autoMarkText();
1042
1032
  }
1043
1033
  var _proto = FormulaPlugin.prototype;
1044
1034
  _proto.autoMarkText = function autoMarkText() {
1045
- var _this$getProps = this.getProps(),
1046
- functions = _this$getProps.functions,
1047
- variables = _this$getProps.variables,
1048
- value = _this$getProps.value;
1035
+ var _this$getProps2 = this.getProps(),
1036
+ functions = _this$getProps2.functions,
1037
+ variables = _this$getProps2.variables,
1038
+ value = _this$getProps2.value;
1049
1039
  if (value) {
1050
1040
  // todo functions 也需要自动替换
1051
1041
  this.autoMark(variables);
@@ -1115,8 +1105,8 @@ var FormulaPlugin = /*#__PURE__*/function () {
1115
1105
  };
1116
1106
  _proto.insertContent = function insertContent(value, type) {
1117
1107
  var from = this.editor.getCursor();
1118
- var _this$getProps2 = this.getProps(),
1119
- evalMode = _this$getProps2.evalMode;
1108
+ var _this$getProps3 = this.getProps(),
1109
+ evalMode = _this$getProps3.evalMode;
1120
1110
  if (type === 'variable') {
1121
1111
  this.editor.replaceSelection(value.key);
1122
1112
  var to = this.editor.getCursor();
@@ -1158,12 +1148,12 @@ var FormulaPlugin = /*#__PURE__*/function () {
1158
1148
  });
1159
1149
  };
1160
1150
  _proto.autoMark = function autoMark(variables) {
1161
- var _this = this;
1151
+ var _this2 = this;
1162
1152
  if (!Array.isArray(variables) || !variables.length) {
1163
1153
  return;
1164
1154
  }
1165
1155
  var varMap = {};
1166
- eachTree(variables, function (item) {
1156
+ Object(utils["a" /* eachTree */])(variables, function (item) {
1167
1157
  if (item.value) {
1168
1158
  varMap[item.value] = item.label;
1169
1159
  }
@@ -1173,14 +1163,14 @@ var FormulaPlugin = /*#__PURE__*/function () {
1173
1163
  });
1174
1164
  var editor = this.editor;
1175
1165
  var lines = editor.lineCount();
1176
- var _this$getProps3 = this.getProps(),
1177
- _this$getProps3$evalM = _this$getProps3.evalMode,
1178
- evalMode = _this$getProps3$evalM === void 0 ? true : _this$getProps3$evalM;
1166
+ var _this$getProps4 = this.getProps(),
1167
+ _this$getProps4$evalM = _this$getProps4.evalMode,
1168
+ evalMode = _this$getProps4$evalM === void 0 ? true : _this$getProps4$evalM;
1179
1169
  var _loop = function _loop(line) {
1180
1170
  var content = editor.getLine(line);
1181
1171
  // 标记方法调用
1182
1172
  content.replace(/([A-Z]+)\s*\(/g, function (_, func, pos) {
1183
- _this.markText({
1173
+ _this2.markText({
1184
1174
  line: line,
1185
1175
  ch: pos
1186
1176
  }, {
@@ -1198,7 +1188,7 @@ var FormulaPlugin = /*#__PURE__*/function () {
1198
1188
  var encode = replaceStrByIndex(content, idx, v, REPLACE_KEY);
1199
1189
  var reg = getRegExpByMode(evalMode, REPLACE_KEY);
1200
1190
  if (reg.test(encode)) {
1201
- _this.markText({
1191
+ _this2.markText({
1202
1192
  line: line,
1203
1193
  ch: idx
1204
1194
  }, {
@@ -1236,7 +1226,6 @@ function registerLaunguageMode(cm) {
1236
1226
  cm.defineMode('formula', function (config, parserConfig) {
1237
1227
  var formula = cm.getMode(config, 'javascript');
1238
1228
  if (!parserConfig || !parserConfig.base) return formula;
1239
- debugger;
1240
1229
  return cm.multiplexingMode(cm.getMode(config, parserConfig.base), {
1241
1230
  open: '${',
1242
1231
  close: '}',
@@ -2795,9 +2784,12 @@ function registerLaunguageMode(cm) {
2795
2784
  namespace: "其他"
2796
2785
  }]);
2797
2786
  // EXTERNAL MODULE: external "element-ui/lib/message"
2798
- var message_ = __webpack_require__(61);
2787
+ var message_ = __webpack_require__(64);
2799
2788
  var message_default = /*#__PURE__*/__webpack_require__.n(message_);
2800
2789
 
2790
+ // EXTERNAL MODULE: external "@panpanzhao/component-ui/lib/utils/formula"
2791
+ var formula_ = __webpack_require__(3);
2792
+
2801
2793
  // CONCATENATED MODULE: ./src/components/formula/src/index.js
2802
2794
 
2803
2795
 
@@ -2808,6 +2800,8 @@ var message_default = /*#__PURE__*/__webpack_require__.n(message_);
2808
2800
 
2809
2801
 
2810
2802
 
2803
+
2804
+
2811
2805
  /* harmony default export */ var src = ({
2812
2806
  name: "Formula",
2813
2807
  componentName: "Formula",
@@ -2873,7 +2867,7 @@ var message_default = /*#__PURE__*/__webpack_require__.n(message_);
2873
2867
  },
2874
2868
  handleEditorMounted: function handleEditorMounted(cm, editor) {
2875
2869
  var _this = this;
2876
- this.editorPlugin = new FormulaPlugin(editor, cm, function () {
2870
+ this.editorPlugin = new plugin_FormulaPlugin(editor, cm, function () {
2877
2871
  return _this.$props;
2878
2872
  });
2879
2873
  },
@@ -2907,6 +2901,7 @@ var message_default = /*#__PURE__*/__webpack_require__.n(message_);
2907
2901
  }, 'variable');
2908
2902
  },
2909
2903
  handleChange: function handleChange(value) {
2904
+ this.$emit("input", value);
2910
2905
  this.$emit("change", value);
2911
2906
  },
2912
2907
  handleFocus: function handleFocus() {
@@ -2920,6 +2915,74 @@ var message_default = /*#__PURE__*/__webpack_require__.n(message_);
2920
2915
  value: "name",
2921
2916
  label: "名称"
2922
2917
  });
2918
+ },
2919
+ validate: function validate() {
2920
+ var value = this.value;
2921
+ try {
2922
+ value ? Object(formula_["parse"])(value, {
2923
+ evalMode: this.evalMode
2924
+ }) : null;
2925
+ } catch (e) {
2926
+ return "\u516C\u5F0F\u503C\u6821\u9A8C\u9519\u8BEF\uFF0C\u9519\u8BEF\u7684\u4F4D\u7F6E/\u539F\u56E0\u662F " + e.message;
2927
+ }
2928
+ return;
2929
+ },
2930
+ replaceStrByIndex: function replaceStrByIndex(str, idx, key, replaceKey) {
2931
+ var from = str.slice(0, idx);
2932
+ var left = str.slice(idx);
2933
+ return from + left.replace(key, replaceKey);
2934
+ },
2935
+ getRegExpByMode: function getRegExpByMode(evalMode, key) {
2936
+ var reg = evalMode ? "\\b" + key + "\\b" : "\\$\\{[^\\{\\}]*\\b" + key + "\\b[^\\{\\}]*\\}";
2937
+ return new RegExp(reg);
2938
+ },
2939
+ highlightValue: function highlightValue(value, variables, evalMode) {
2940
+ var _this2 = this;
2941
+ if (evalMode === void 0) {
2942
+ evalMode = true;
2943
+ }
2944
+ if (!Array.isArray(variables) || !variables.length || !value) {
2945
+ return;
2946
+ }
2947
+ var varMap = {};
2948
+ Object(utils["a" /* eachTree */])(variables, function (item) {
2949
+ if (item.value) {
2950
+ var key = item.value;
2951
+ varMap[key] = item.label;
2952
+ }
2953
+ });
2954
+ var vars = Object.keys(varMap).filter(function (item) {
2955
+ return item;
2956
+ }).sort(function (a, b) {
2957
+ return b.length - a.length;
2958
+ });
2959
+ var content = value || '';
2960
+ var html = '';
2961
+
2962
+ // 标记方法调用
2963
+ html = content.replace(/([A-Z]+)\s*\(/g, function (_, func, pos) {
2964
+ return _ && _.replace(func, "<span class=\"c-func\">" + func + "</span>");
2965
+ });
2966
+ var REPLACE_KEY = 'AMIS_FORMULA_REPLACE_KEY';
2967
+ vars.forEach(function (v) {
2968
+ var from = 0;
2969
+ var idx = -1;
2970
+ while (~(idx = content.indexOf(v, from))) {
2971
+ var encodeHtml = _this2.replaceStrByIndex(html, idx, v, REPLACE_KEY);
2972
+ var reg = _this2.getRegExpByMode(evalMode, REPLACE_KEY);
2973
+
2974
+ // 如果匹配到则高亮,没有匹配到替换成原值
2975
+ if (reg.test(encodeHtml)) {
2976
+ html = encodeHtml.replace(REPLACE_KEY, "<span class=\"c-field\">" + varMap[v] + "</span>");
2977
+ } else {
2978
+ html = encodeHtml.replace(REPLACE_KEY, v);
2979
+ }
2980
+ from = idx + v.length;
2981
+ }
2982
+ });
2983
+ return {
2984
+ html: html
2985
+ };
2923
2986
  }
2924
2987
  },
2925
2988
  beforeDestroy: function beforeDestroy() {
@@ -2994,6 +3057,13 @@ src.install = function (Vue) {
2994
3057
  /***/ 8:
2995
3058
  /***/ (function(module, exports) {
2996
3059
 
3060
+ module.exports = require("element-ui/lib/collapse");
3061
+
3062
+ /***/ }),
3063
+
3064
+ /***/ 9:
3065
+ /***/ (function(module, exports) {
3066
+
2997
3067
  module.exports = require("element-ui/lib/collapse-item");
2998
3068
 
2999
3069
  /***/ })