diff --git a/src/main/java/com/tptj/tool/hg/fineui/swing/FineUIEngine.java b/src/main/java/com/tptj/tool/hg/fineui/swing/FineUIEngine.java index 69b6de9..a86a7df 100644 --- a/src/main/java/com/tptj/tool/hg/fineui/swing/FineUIEngine.java +++ b/src/main/java/com/tptj/tool/hg/fineui/swing/FineUIEngine.java @@ -64,6 +64,8 @@ public class FineUIEngine { "com/fr/fineui/core/constant/events.js", "com/fr/fineui/core/constant/var.js", + "com/fr/fineui/core/controller/0.controller.js", + "com/fr/fineui/core/func/alias.js", "com/fr/fineui/core/func/array.js", "com/fr/fineui/core/func/date.js", @@ -109,8 +111,17 @@ public class FineUIEngine { "com/fr/fineui/core/wrapper/layout/flex/flex.vertical.center.js", "com/fr/fineui/core/wrapper/layout/flex/flex.leftrightvertical.center.js", + // fix代码 + "com/fr/fineui/dist/fix/fix.proxy.js", + "com/fr/fineui/dist/fix/fix.compact.js", + + // 通用组价 + "com/fr/fineui/base/combination/group.button.js", + + //com/tptj/tool/hg/fineui/swing 下的都是适配swing的js代码 // 自定义布局 + "com/tptj/tool/hg/fineui/swing/core/wrapper/layout.service.js", "com/tptj/tool/hg/fineui/swing/core/wrapper/layout.static.js", "com/tptj/tool/hg/fineui/swing/core/wrapper/layout.horizontal.js", "com/tptj/tool/hg/fineui/swing/core/wrapper/layout.vertical.js", @@ -129,6 +140,8 @@ public class FineUIEngine { //自定义的基础控件,最基本的控件需要由swing实现后,映射到fineui中,高级的组件就可以 //由开发者按照fineui的组件继承方式进行组合创建新的组件了 "com/tptj/tool/hg/fineui/swing/base/single/label.js", + "com/tptj/tool/hg/fineui/swing/base/single/button.js", + "com/tptj/tool/hg/fineui/swing/base/single/group.button.js", "com/tptj/tool/hg/fineui/swing/widget/editor/editor.text.js" ); @@ -228,7 +241,8 @@ public class FineUIEngine { // .importJs("com/tptj/tool/hg/fineui/swing/demo/layout.tape.js"); // .importJs("com/tptj/tool/hg/fineui/swing/demo/layout.grid.js"); // .importJs("com/tptj/tool/hg/fineui/swing/demo/layout.window.js"); - .importJs("com/tptj/tool/hg/fineui/swing/demo/layout.horizontal.js"); +// .importJs("com/tptj/tool/hg/fineui/swing/demo/layout.horizontal.js"); + .importJs("com/tptj/tool/hg/fineui/swing/demo/group.button.js"); return null; }).run(); diff --git a/src/main/java/com/tptj/tool/hg/fineui/swing/element/AbstractElement.java b/src/main/java/com/tptj/tool/hg/fineui/swing/element/AbstractElement.java index 27ff3f8..44e04ff 100644 --- a/src/main/java/com/tptj/tool/hg/fineui/swing/element/AbstractElement.java +++ b/src/main/java/com/tptj/tool/hg/fineui/swing/element/AbstractElement.java @@ -1,5 +1,6 @@ package com.tptj.tool.hg.fineui.swing.element; +import com.eclipsesource.v8.V8Array; import com.eclipsesource.v8.V8Object; import com.fr.general.GeneralUtils; import com.fr.log.FineLoggerFactory; @@ -20,7 +21,7 @@ import java.util.List; **/ public abstract class AbstractElement implements Element { - private T component; + protected T component; private JComponent wrapper; private V8Object ref; private String type; @@ -152,7 +153,8 @@ public abstract class AbstractElement implements Element implements Element implements Element extends AbstractElement { + protected AbstractSingleElement(T component) { + super(component); + } + + @Override + public void css(String name, String val) { + super.css(name, val); + Dimension dim = getComponent().getPreferredSize(); + if ("width".equals(name)) { + if (val.length() > 0) { + dim.width = Integer.parseInt(val); + getComponent().setPreferredSize(dim); + } + } + if ("height".equals(name)) { + if (val.length() > 0) { + dim.height = Integer.parseInt(val); + getComponent().setPreferredSize(dim); + } + } + } +} diff --git a/src/main/java/com/tptj/tool/hg/fineui/swing/element/ButtonElement.java b/src/main/java/com/tptj/tool/hg/fineui/swing/element/ButtonElement.java new file mode 100644 index 0000000..4597ae0 --- /dev/null +++ b/src/main/java/com/tptj/tool/hg/fineui/swing/element/ButtonElement.java @@ -0,0 +1,52 @@ +package com.tptj.tool.hg.fineui.swing.element; + +import com.fr.general.GeneralUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * @author 秃破天际 + * @version 10.0 + * Created by 秃破天际 on 2021/10/29 + **/ +public class ButtonElement extends AbstractSingleElement { + + public ButtonElement() { + super(new JButton()); + getComponent().addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + callJsMethod("fireEvent", "EVENT_CHANGE", getComponent().getText()); + } + }); + } + + @Override + public Object getVal() { + return getComponent().getText(); + } + + @Override + public void setVal(Object val) { + super.setVal(val); + getComponent().setText(GeneralUtils.objectToString(val)); + } + + @Override + public void css(String name, String val) { + super.css(name, val); + val = val.toUpperCase(); + if ("text-align".equals(name)) { + if ("LEFT".equals(val)) { + getComponent().setHorizontalAlignment(SwingConstants.LEFT); + } else if ("CENTER".equals(val)) { + getComponent().setHorizontalAlignment(SwingConstants.CENTER); + } else if ("RIGHT".equals(val)) { + getComponent().setHorizontalAlignment(SwingConstants.RIGHT); + } + } + } +} diff --git a/src/main/java/com/tptj/tool/hg/fineui/swing/element/Element.java b/src/main/java/com/tptj/tool/hg/fineui/swing/element/Element.java index 96505b8..598188f 100644 --- a/src/main/java/com/tptj/tool/hg/fineui/swing/element/Element.java +++ b/src/main/java/com/tptj/tool/hg/fineui/swing/element/Element.java @@ -1,5 +1,6 @@ package com.tptj.tool.hg.fineui.swing.element; +import com.eclipsesource.v8.V8Array; import com.eclipsesource.v8.V8Object; import javax.swing.*; @@ -60,4 +61,6 @@ public interface Element { void setVal(Object val); Object getVal(); + + void populate(V8Array items); } diff --git a/src/main/java/com/tptj/tool/hg/fineui/swing/element/LabelElement.java b/src/main/java/com/tptj/tool/hg/fineui/swing/element/LabelElement.java index ed6c4c4..c62b7e6 100644 --- a/src/main/java/com/tptj/tool/hg/fineui/swing/element/LabelElement.java +++ b/src/main/java/com/tptj/tool/hg/fineui/swing/element/LabelElement.java @@ -11,7 +11,7 @@ import java.awt.*; * @version 10.0 * Created by 秃破天际 on 2021/10/29 **/ -public class LabelElement extends AbstractElement { +public class LabelElement extends AbstractSingleElement { public LabelElement() { super(new UILabel()); @@ -41,18 +41,5 @@ public class LabelElement extends AbstractElement { getComponent().setHorizontalAlignment(SwingConstants.RIGHT); } } - Dimension dim = getComponent().getPreferredSize(); - if ("width".equals(name)) { - if (val.length() > 0) { - dim.width = Integer.parseInt(val); - getComponent().setPreferredSize(dim); - } - } - if ("height".equals(name)) { - if (val.length() > 0) { - dim.height = Integer.parseInt(val); - getComponent().setPreferredSize(dim); - } - } } } diff --git a/src/main/java/com/tptj/tool/hg/fineui/swing/element/ListElement.java b/src/main/java/com/tptj/tool/hg/fineui/swing/element/ListElement.java new file mode 100644 index 0000000..d3bb7c0 --- /dev/null +++ b/src/main/java/com/tptj/tool/hg/fineui/swing/element/ListElement.java @@ -0,0 +1,38 @@ +package com.tptj.tool.hg.fineui.swing.element; + + +import com.eclipsesource.v8.V8Array; + +import javax.swing.*; +import java.util.Vector; + +/** + * @author 秃破天际 + * @version 10.0 + * Created by 秃破天际 on 2021/10/29 + **/ +public class ListElement extends AbstractSingleElement { + + public ListElement() { + super(new JList()); + } + + @Override + public void populate(V8Array items) { + Vector vector = new Vector<>(); + for (int i = 0, len = items.length(); i < len; i++) { + vector.add(items.getString(i)); + } + component.setModel(new DefaultComboBoxModel<>(vector)); + } + + @Override + public void setVal(Object val) { + super.setVal(val); + } + + @Override + public void css(String name, String val) { + super.css(name, val); + } +} diff --git a/src/main/java/com/tptj/tool/hg/fineui/swing/element/TextElement.java b/src/main/java/com/tptj/tool/hg/fineui/swing/element/TextElement.java index 7aaf049..e75afea 100644 --- a/src/main/java/com/tptj/tool/hg/fineui/swing/element/TextElement.java +++ b/src/main/java/com/tptj/tool/hg/fineui/swing/element/TextElement.java @@ -19,7 +19,7 @@ import java.awt.event.KeyListener; * @version 10.0 * Created by 秃破天际 on 2021/11/2 **/ -public class TextElement extends AbstractElement{ +public class TextElement extends AbstractSingleElement{ public TextElement() { super(new UITextField()); init(); @@ -138,7 +138,6 @@ public class TextElement extends AbstractElement{ @Override public void css(String name, String val){ super.css(name, val); - } @Override diff --git a/src/main/java/com/tptj/tool/hg/fineui/swing/element/layout/CenterAdaptType.java b/src/main/java/com/tptj/tool/hg/fineui/swing/element/layout/CenterAdaptType.java index 9111424..d14bbc9 100644 --- a/src/main/java/com/tptj/tool/hg/fineui/swing/element/layout/CenterAdaptType.java +++ b/src/main/java/com/tptj/tool/hg/fineui/swing/element/layout/CenterAdaptType.java @@ -2,7 +2,6 @@ package com.tptj.tool.hg.fineui.swing.element.layout; import com.tptj.tool.hg.fineui.swing.element.Element; import com.tptj.tool.hg.fineui.swing.element.VerticalFlowLayout; -import com.tptj.tool.hg.fineui.swing.element.layout.impl.HorizontalLayout; import com.tptj.tool.hg.fineui.swing.element.layout.impl.VerticalLayout; import javax.swing.*; @@ -20,7 +19,7 @@ public class CenterAdaptType extends AbstractLayoutType { public LayoutManager init() { wrapComponent = new JPanel(); wrapComponent.setOpaque(false); - wrapComponent.setLayout(new HorizontalLayout(element, FlowLayout.CENTER, 0, 0)); + wrapComponent.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); element.getComponent().add(wrapComponent); return new VerticalLayout(element, VerticalFlowLayout.CENTER, 0, 0, true); } diff --git a/src/main/java/com/tptj/tool/hg/fineui/swing/element/layout/HorizontalAdaptType.java b/src/main/java/com/tptj/tool/hg/fineui/swing/element/layout/HorizontalAdaptType.java index a657dd2..555d499 100644 --- a/src/main/java/com/tptj/tool/hg/fineui/swing/element/layout/HorizontalAdaptType.java +++ b/src/main/java/com/tptj/tool/hg/fineui/swing/element/layout/HorizontalAdaptType.java @@ -27,7 +27,7 @@ public class HorizontalAdaptType extends AbstractLayoutType { if (w > 0) { JComponent wrapComponent = new JPanel(); wrapComponent.setOpaque(false); - wrapComponent.setLayout(new HorizontalLayout(element, FlowLayout.CENTER, 0, 0)); + wrapComponent.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); wrapComponent.add(child.getWrapper()); element.getComponent().add(wrapComponent); } else { diff --git a/src/main/java/com/tptj/tool/hg/fineui/swing/element/layout/VerticalAdaptType.java b/src/main/java/com/tptj/tool/hg/fineui/swing/element/layout/VerticalAdaptType.java index 2c569c4..c6b4a5c 100644 --- a/src/main/java/com/tptj/tool/hg/fineui/swing/element/layout/VerticalAdaptType.java +++ b/src/main/java/com/tptj/tool/hg/fineui/swing/element/layout/VerticalAdaptType.java @@ -17,7 +17,7 @@ public class VerticalAdaptType extends CenterAdaptType { public LayoutManager init() { wrapComponent = new JPanel(); wrapComponent.setOpaque(false); - wrapComponent.setLayout(new HorizontalLayout(element, FlowLayout.LEFT, 0, 0)); + wrapComponent.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); element.getComponent().add(wrapComponent); return new VerticalLayout(element, VerticalFlowLayout.CENTER, 0, 0, true); } diff --git a/src/main/resources/com/fr/fineui/dist/README.md b/src/main/resources/com/fr/fineui/dist/README.md new file mode 100644 index 0000000..f6a3a9e --- /dev/null +++ b/src/main/resources/com/fr/fineui/dist/README.md @@ -0,0 +1,31 @@ +#### fineui.js + +整个fineui打包文件,不包括配置文件 + +#### fineui.css + +整个fineui打包文件,不包括资源文件 + +#### config.js + +配置文件,这只是一个案例,集成进系统的时候需要进行配置 + +#### resource.css + +app.css background.css icon.css font.css的合并文件,集成进系统的时候需要进行配置 + +#### router.js + +#### 路由文件,使用fineui路由的时候才需要引入 + +#### bundle.js bundle.css + +所有文件的合并文件, 主要给在线demo和文档用的 + +#### core_without_normalize.css + +不带标准化的core.css文件,只引入通用css样式的时候才需要 + +#### chart.js + +封装好的一层图表api diff --git a/src/main/resources/com/fr/fineui/dist/fix/fix.compact.js b/src/main/resources/com/fr/fineui/dist/fix/fix.compact.js new file mode 100644 index 0000000..69a0a31 --- /dev/null +++ b/src/main/resources/com/fr/fineui/dist/fix/fix.compact.js @@ -0,0 +1,199 @@ +;(function () { + function initWatch (vm, watch) { + vm._watchers || (vm._watchers = []); + for (var key in watch) { + var handler = watch[key]; + if (BI.isArray(handler)) { + for (var i = 0; i < handler.length; i++) { + vm._watchers.push(createWatcher(vm, key, handler[i])); + } + } else { + vm._watchers.push(createWatcher(vm, key, handler)); + } + } + BI.each(vm.$watchDelayCallbacks, function (i, watchDelayCallback) { + var innerWatch = watchDelayCallback[0]; + var innerHandler = watchDelayCallback[1]; + if (BI.isKey(innerWatch)) { + var key = innerWatch; + innerWatch = {}; + innerWatch[key] = innerHandler; + } + for (var key in innerWatch) { + var handler = innerWatch[key]; + if (BI.isArray(handler)) { + for (var i = 0; i < handler.length; i++) { + vm._watchers.push(createWatcher(vm, key, handler[i])); + } + } else { + vm._watchers.push(createWatcher(vm, key, handler)); + } + } + }); + } + + function createWatcher (vm, keyOrFn, cb, options) { + if (BI.isPlainObject(cb)) { + options = cb; + cb = cb.handler; + } + options = options || {}; + return Fix.watch(vm.model, keyOrFn, _.bind(cb, vm), BI.extend(options, { + store: vm.store + })); + } + + var target = null; + var targetStack = []; + + function pushTarget (_target) { + if (target) targetStack.push(target); + Fix.Model.target = target = _target; + } + + function popTarget () { + Fix.Model.target = target = targetStack.pop(); + } + + var oldWatch = Fix.watch; + Fix.watch = function (model, expOrFn, cb, options) { + if (BI.isPlainObject(cb)) { + options = cb; + cb = cb.handler; + } + if (typeof cb === "string") { + cb = model[cb]; + } + return oldWatch.call(this, model, expOrFn, function () { + options && options.store && pushTarget(options.store); + try { + var res = cb.apply(this, arguments); + } catch (e) { + console.error(e); + } + options && options.store && popTarget(); + return res; + }, options); + }; + + function findStore (widget) { + if (target != null) { + return target; + } + widget = widget || BI.Widget.context; + var p = widget; + while (p) { + if (p instanceof Fix.Model || p.store || p.__cacheStore) { + break; + } + p = p._parent || (p.options && p.options.element) || p._context; + } + if (p) { + if (p instanceof Fix.Model) { + return widget.__cacheStore = p; + } + widget.__cacheStore = p.store || p.__cacheStore; + return p.__cacheStore || p.store; + } + } + + // _.each(["populate", "addItems", "prependItems"], function (name) { + // var old = BI.Loader.prototype[name]; + // BI.Loader.prototype[name] = function () { + // BI.Widget.pushContext(this); + // try { + // var result = old.apply(this, arguments); + // } catch (e) { + // console.error(e); + // } + // BI.Widget.popContext(); + // return result; + // }; + // }); + + function createStore () { + var needPop = false; + if (_global.Fix && this._store) { + var store = findStore(this.options.context || this._parent || this.options.element || this._context); + if (store) { + pushTarget(store); + needPop = true; + } + this.store = this._store(); + this.store && (this.store._widget = this); + needPop && popTarget(); + needPop = false; + pushTarget(this.store); + if (this.store instanceof Fix.Model) { + this.model = this.store.model; + } else { + this.model = this.store; + } + needPop = true; + } + return needPop; + } + + var _init = BI.Widget.prototype._init; + BI.Widget.prototype._init = function () { + var self = this; + var needPop = createStore.call(this); + try { + _init.apply(this, arguments); + } catch (e) { + console.error(e); + } + needPop && popTarget(); + }; + + var _render = BI.Widget.prototype._render; + BI.Widget.prototype._render = function () { + var needPop = false; + if (_global.Fix && this._store) { + needPop = true; + pushTarget(this.store); + } + _render.apply(this, arguments); + if (_global.Fix && this._store) { + initWatch(this, this.watch); + } + needPop && popTarget(); + }; + + var unMount = BI.Widget.prototype.__d; + BI.Widget.prototype.__d = function () { + try { + unMount.apply(this, arguments); + } catch (e) { + console.error(e); + } + this.store && BI.isFunction(this.store.destroy) && this.store.destroy(); + BI.each(this._watchers, function (i, unwatches) { + unwatches = BI.isArray(unwatches) ? unwatches : [unwatches]; + BI.each(unwatches, function (j, unwatch) { + unwatch(); + }); + }); + this._watchers && (this._watchers = []); + if (this.store) { + this.store._parent && (this.store._parent = null); + this.store._widget && (this.store._widget = null); + this.store = null; + } + delete this.__cacheStore; + }; + + _.each(["__afterRender", "_mount", "__afterMount"], function (name) { + var old = BI.Widget.prototype[name]; + old && (BI.Widget.prototype[name] = function () { + this.store && pushTarget(this.store); + try { + var res = old.apply(this, arguments); + } catch (e) { + console.error(e); + } + this.store && popTarget(); + return res; + }); + }); +}()); diff --git a/src/main/resources/com/fr/fineui/dist/fix/fix.js b/src/main/resources/com/fr/fineui/dist/fix/fix.js new file mode 100644 index 0000000..3e93f16 --- /dev/null +++ b/src/main/resources/com/fr/fineui/dist/fix/fix.js @@ -0,0 +1,1526 @@ +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : factory(global.Fix = global.Fix || {}); +})(this, function (exports) { + 'use strict'; + + function noop(a, b, c) {} + + function isNative(Ctor) { + return typeof Ctor === 'function' && /native code/.test(Ctor.toString()); + } + + var rhashcode = /\d\.\d{4}/; + + //生成UUID http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript + function makeHashCode(prefix) { + /* istanbul ignore next*/ + prefix = prefix || 'bi'; + /* istanbul ignore next*/ + return String(Math.random() + Math.random()).replace(rhashcode, prefix); + } + + var hasProto = '__proto__' in {}; + + var isIE = function isIE() { + if (typeof navigator === "undefined") { + return false; + } + return (/(msie|trident)/i.test(navigator.userAgent.toLowerCase()) + ); + }; + + var getIEVersion = function getIEVersion() { + var version = 0; + if (typeof navigator === "undefined") { + return false; + } + var agent = navigator.userAgent.toLowerCase(); + var v1 = agent.match(/(?:msie\s([\w.]+))/); + var v2 = agent.match(/(?:trident.*rv:([\w.]+))/); + if (v1 && v2 && v1[1] && v2[1]) { + version = Math.max(v1[1] * 1, v2[1] * 1); + } else if (v1 && v1[1]) { + version = v1[1] * 1; + } else if (v2 && v2[1]) { + version = v2[1] * 1; + } else { + version = 0; + } + return version; + }; + var isIE9Below = isIE() && getIEVersion() < 9; + + var _toString = Object.prototype.toString; + + function isPlainObject(obj) { + return _toString.call(obj) === '[object Object]'; + } + + function isConfigurable(obj, key) { + var configurable = true; + var property = Object.getOwnPropertyDescriptor && Object.getOwnPropertyDescriptor(obj, key); + if (property && property.configurable === false) { + configurable = false; + } + return configurable; + } + + function isExtensible(obj) { + if (Object.isExtensible) { + return Object.isExtensible(obj); + } + var name = ''; + while (obj.hasOwnProperty(name)) { + name += '?'; + } + obj[name] = true; + var returnValue = obj.hasOwnProperty(name); + delete obj[name]; + return returnValue; + } + + function remove(arr, item) { + if (arr && arr.length) { + var _index = arr.indexOf(item); + if (_index > -1) { + return arr.splice(_index, 1); + } + } + } + + var bailRE = /[^\w.$]/; + + function parsePath(path) { + if (bailRE.test(path)) { + return; + } + var segments = path.split('.'); + return function (obj) { + for (var i = 0; i < segments.length; i++) { + if (!obj) return; + obj = obj[segments[i]]; + } + return obj; + }; + } + + var nextTick = function () { + var callbacks = []; + var pending = false; + var timerFunc = void 0; + + function nextTickHandler() { + pending = false; + var copies = callbacks.slice(0); + callbacks.length = 0; + for (var i = 0; i < copies.length; i++) { + copies[i](); + } + } + + // An asynchronous deferring mechanism. + // In pre 2.4, we used to use microtasks (Promise/MutationObserver) + // but microtasks actually has too high a priority and fires in between + // supposedly sequential events (e.g. #4521, #6690) or even between + // bubbling of the same event (#6566). Technically setImmediate should be + // the ideal choice, but it's not available everywhere; and the only polyfill + // that consistently queues the callback after all DOM events triggered in the + // same loop is by using MessageChannel. + /* istanbul ignore if */ + if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) { + timerFunc = function timerFunc() { + setImmediate(nextTickHandler); + }; + } else if (typeof MessageChannel !== 'undefined' && (isNative(MessageChannel) || + // PhantomJS + MessageChannel.toString() === '[object MessageChannelConstructor]')) { + var channel = new MessageChannel(); + var port = channel.port2; + channel.port1.onmessage = nextTickHandler; + timerFunc = function timerFunc() { + port.postMessage(1); + }; + } else + /* istanbul ignore next */ + if (typeof Promise !== 'undefined' && isNative(Promise)) { + // use microtask in non-DOM environments, e.g. Weex + var p = Promise.resolve(); + timerFunc = function timerFunc() { + p.then(nextTickHandler); + }; + } else { + // fallback to setTimeout + timerFunc = function timerFunc() { + setTimeout(nextTickHandler, 0); + }; + } + + return function queueNextTick(cb, ctx) { + var _resolve = void 0; + callbacks.push(function () { + if (cb) { + try { + cb.call(ctx); + } catch (e) { + console.error(e); + } + } else if (_resolve) { + _resolve(ctx); + } + }); + if (!pending) { + pending = true; + timerFunc(); + } + // $flow-disable-line + if (!cb && typeof Promise !== 'undefined') { + return new Promise(function (resolve, reject) { + _resolve = resolve; + }); + } + }; + }(); + + var falsy; + var $$skipArray = { + __ob__: falsy, + $accessors: falsy, + $vbthis: falsy, + $vbsetter: falsy + }; + + var uid = 0; + + /** + * A dep is an observable that can have multiple + * directives subscribing to it. + */ + + var Dep = function () { + function Dep() { + _classCallCheck(this, Dep); + + this.id = uid++; + this.subs = []; + } + + Dep.prototype.addSub = function addSub(sub) { + this.subs.push(sub); + }; + + Dep.prototype.removeSub = function removeSub(sub) { + remove(this.subs, sub); + }; + + Dep.prototype.depend = function depend() { + if (Dep.target) { + Dep.target.addDep(this); + } + }; + + Dep.prototype.notify = function notify(options) { + // stabilize the subscriber list first + var subs = this.subs.slice(); + for (var i = 0, l = subs.length; i < l; i++) { + subs[i].update(options); + } + }; + + return Dep; + }(); + + // the current target watcher being evaluated. + // this is globally unique because there could be only one + // watcher being evaluated at any time. + + + Dep.target = null; + var targetStack = []; + + function pushTarget(_target) { + if (Dep.target) targetStack.push(Dep.target); + Dep.target = _target; + } + + function popTarget() { + Dep.target = targetStack.pop(); + } + + //如果浏览器不支持ecma262v5的Object.defineProperties或者存在BUG,比如IE8 + //标准浏览器使用__defineGetter__, __defineSetter__实现 + var canHideProperty = true; + try { + Object.defineProperty({}, '_', { + value: 'x' + }); + delete $$skipArray.$vbsetter; + delete $$skipArray.$vbthis; + } catch (e) { + /* istanbul ignore next*/ + canHideProperty = false; + } + + var createViewModel = Object.defineProperties; + var defineProperty = void 0; + + var timeBucket = new Date() - 0; + /* istanbul ignore if*/ + if (!canHideProperty) { + if ('__defineGetter__' in {}) { + defineProperty = function defineProperty(obj, prop, desc) { + if ('value' in desc) { + obj[prop] = desc.value; + } + if ('get' in desc) { + obj.__defineGetter__(prop, desc.get); + } + if ('set' in desc) { + obj.__defineSetter__(prop, desc.set); + } + return obj; + }; + createViewModel = function createViewModel(obj, descs) { + for (var prop in descs) { + if (descs.hasOwnProperty(prop)) { + defineProperty(obj, prop, descs[prop]); + } + } + return obj; + }; + } + /* istanbul ignore if*/ + if (isIE9Below) { + var VBClassPool = {}; + window.execScript([// jshint ignore:line + 'Function parseVB(code)', '\tExecuteGlobal(code)', 'End Function' //转换一段文本为VB代码 + ].join('\n'), 'VBScript'); + + var VBMediator = function VBMediator(instance, accessors, name, value) { + // jshint ignore:line + var accessor = accessors[name]; + if (arguments.length === 4) { + accessor.set.call(instance, value); + } else { + return accessor.get.call(instance); + } + }; + createViewModel = function createViewModel(name, accessors, properties) { + // jshint ignore:line + var buffer = []; + buffer.push('\tPrivate [$vbsetter]', '\tPublic [$accessors]', '\tPublic Default Function [$vbthis](ac' + timeBucket + ', s' + timeBucket + ')', '\t\tSet [$accessors] = ac' + timeBucket + ': set [$vbsetter] = s' + timeBucket, '\t\tSet [$vbthis] = Me', //链式调用 + '\tEnd Function'); + //添加普通属性,因为VBScript对象不能像JS那样随意增删属性,必须在这里预先定义好 + var uniq = { + $vbthis: true, + $vbsetter: true, + $accessors: true + }; + for (name in $$skipArray) { + if (!uniq[name]) { + buffer.push('\tPublic [' + name + ']'); + uniq[name] = true; + } + } + //添加访问器属性 + for (name in accessors) { + if (uniq[name]) { + continue; + } + uniq[name] = true; + buffer.push( + //由于不知对方会传入什么,因此set, let都用上 + '\tPublic Property Let [' + name + '](val' + timeBucket + ')', //setter + '\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Set [' + name + '](val' + timeBucket + ')', //setter + '\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Get [' + name + ']', //getter + '\tOn Error Resume Next', //必须优先使用set语句,否则它会误将数组当字符串返回 + '\t\tSet[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tIf Err.Number <> 0 Then', '\t\t[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tEnd If', '\tOn Error Goto 0', '\tEnd Property'); + } + + for (name in properties) { + if (!uniq[name]) { + uniq[name] = true; + buffer.push('\tPublic [' + name + ']'); + } + } + + buffer.push('\tPublic [hasOwnProperty]'); + buffer.push('End Class'); + var body = buffer.join('\r\n'); + var className = VBClassPool[body]; + if (!className) { + className = makeHashCode('VBClass'); + window.parseVB('Class ' + className + body); + window.parseVB(['Function ' + className + 'Factory(acc, vbm)', //创建实例并传入两个关键的参数 + '\tDim o', '\tSet o = (New ' + className + ')(acc, vbm)', '\tSet ' + className + 'Factory = o', 'End Function'].join('\r\n')); + VBClassPool[body] = className; + } + var ret = window[className + 'Factory'](accessors, VBMediator); //得到其产品 + return ret; //得到其产品 + }; + } + } + + var createViewModel$1 = createViewModel; + + var queue = []; + var activatedChildren = []; + var has = {}; + var waiting = false; + var flushing = false; + var index = 0; + + function resetSchedulerState() { + index = queue.length = activatedChildren.length = 0; + has = {}; + waiting = flushing = false; + } + + function flushSchedulerQueue() { + flushing = true; + var watcher = void 0, + id = void 0, + options = void 0; + + // Sort queue before flush. + // This ensures that: + // 1. Components are updated from parent to child. (because parent is always + // created before the child) + // 2. A component's user watchers are run before its render watcher (because + // user watchers are created before the render watcher) + // 3. If a component is destroyed during a parent component's watcher run, + // its watchers can be skipped. + queue.sort(function (a, b) { + return a.id - b.id; + }); + + // do not cache length because more watchers might be pushed + // as we run existing watchers + for (index = 0; index < queue.length; index++) { + watcher = queue[index].watcher; + options = queue[index].options; + id = watcher.id; + has[id] = null; + watcher.run(options); + } + + resetSchedulerState(); + } + + function queueWatcher(watcher, options) { + var id = watcher.id; + if (has[id] == null) { + has[id] = true; + if (!flushing) { + queue.push({ watcher: watcher, options: options }); + } else { + // if already flushing, splice the watcher based on its id + // if already past its id, it will be run next immediately. + var i = queue.length - 1; + while (i > index && queue[i].watcher.id > watcher.id) { + i--; + } + queue.splice(i + 1, 0, { watcher: watcher, options: options }); + } + // queue the flush + if (!waiting) { + waiting = true; + nextTick(flushSchedulerQueue); + } + } + } + + var uid$1 = 0; + + var Watcher = function () { + function Watcher(vm, expOrFn, cb, options) { + _classCallCheck(this, Watcher); + + this.vm = vm; + // vm._watchers || (vm._watchers = []) + // vm._watchers.push(this) + // options + if (options) { + this.deep = !!options.deep; + this.user = !!options.user; + this.lazy = !!options.lazy; + this.sync = !!options.sync; + } else { + this.deep = this.user = this.lazy = this.sync = false; + } + this.cb = cb; + this.id = ++uid$1; // uid for batching + this.active = true; + this.dirty = this.lazy; // for lazy watchers + this.deps = []; + this.newDeps = []; + this.depIds = new Set(); + this.newDepIds = new Set(); + this.expression = ''; + // parse expression for getter + if (typeof expOrFn === 'function') { + this.getter = expOrFn; + } else { + this.getter = parsePath(expOrFn); + if (!this.getter) { + this.getter = function () {}; + } + } + this.value = this.lazy ? undefined : this.get(); + } + + Watcher.prototype.get = function get() { + pushTarget(this); + var value = void 0; + var vm = this.vm; + try { + value = this.getter.call(vm, vm); + } catch (e) { + // if (this.user) { + // } else { + // console.error(e) + // } + } finally { + // "touch" every property so they are all tracked as + // dependencies for deep watching + if (this.deep) { + traverse(value); + } + popTarget(); + this.cleanupDeps(); + } + return value; + }; + + Watcher.prototype.addDep = function addDep(dep) { + var id = dep.id; + if (!this.newDepIds.has(id)) { + this.newDepIds.add(id); + this.newDeps.push(dep); + if (!this.depIds.has(id)) { + dep.addSub(this); + } + } + }; + + Watcher.prototype.cleanupDeps = function cleanupDeps() { + var i = this.deps.length; + while (i--) { + var dep = this.deps[i]; + if (!this.newDepIds.has(dep.id)) { + dep.removeSub(this); + } + } + var tmp = this.depIds; + this.depIds = this.newDepIds; + this.newDepIds = tmp; + this.newDepIds.clear(); + tmp = this.deps; + this.deps = this.newDeps; + this.newDeps = tmp; + this.newDeps.length = 0; + }; + + Watcher.prototype.update = function update(options) { + /* istanbul ignore else */ + if (this.lazy) { + this.dirty = true; + } else if (this.sync) { + this.run(options); + } else { + queueWatcher(this, options); + } + }; + + Watcher.prototype.run = function run(options) { + if (this.active) { + var value = this.get(); + if (value !== this.value || + // Deep watchers and watchers on Object/Arrays should fire even + // when the value is the same, because the value may + // have mutated. + _.isObject(value) && options && options.refresh || this.deep) { + // set new value + var oldValue = this.value; + this.value = value; + if (this.user) { + try { + this.cb.call(this.vm, value, oldValue, options); + } catch (e) { + console.error(e); + } + } else { + try { + this.cb.call(this.vm, value, oldValue, options); + } catch (e) { + console.error(e); + } + } + } + } + }; + + Watcher.prototype.evaluate = function evaluate() { + this.value = this.get(); + this.dirty = false; + }; + + Watcher.prototype.depend = function depend() { + var i = this.deps.length; + while (i--) { + this.deps[i].depend(); + } + }; + + Watcher.prototype.teardown = function teardown() { + if (this.active) { + // remove self from vm's watcher list + // this is a somewhat expensive operation so we skip it + // if the vm is being destroyed. + remove(this.vm._watchers, this); + var i = this.deps.length; + while (i--) { + this.deps[i].removeSub(this); + } + this.active = false; + } + }; + + return Watcher; + }(); + + var seenObjects = new Set(); + + function traverse(val) { + seenObjects.clear(); + _traverse(val, seenObjects); + } + + function _traverse(val, seen) { + var i = void 0, + keys = void 0; + var isA = _.isArray(val); + if (!isA && !_.isObject(val)) { + return; + } + if (val.__ob__) { + var depId = val.__ob__.dep.id; + if (seen.has(depId)) { + return; + } + seen.add(depId); + } + if (isA) { + i = val.length; + while (i--) { + _traverse(val[i], seen); + } + } else { + keys = _.keys(val); + i = keys.length; + while (i--) { + _traverse(val[keys[i]], seen); + } + } + } + + var arrayProto = Array.prototype; + var arrayMethods = []; + _.each(['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'], function (method) { + var original = arrayProto[method]; + arrayMethods[method] = function mutator() { + for (var _len = arguments.length, args = Array(_len), _key2 = 0; _key2 < _len; _key2++) { + args[_key2] = arguments[_key2]; + } + + var ob = this.__ob__; + var inserted = void 0; + switch (method) { + case 'push': + case 'unshift': + inserted = args; + break; + case 'splice': + inserted = args.slice(2); + break; + } + if (inserted) inserted = ob.observeArray(inserted); + switch (method) { + case 'push': + case 'unshift': + args = inserted; + break; + case 'splice': + if (args.length > 2) { + args = [args[0], args[1]].concat(inserted ? inserted : []); + } + break; + } + var result = original.apply(this, args); + notify(ob.parent, ob.parentKey, ob.dep, true); + return result; + }; + }); + + var arrayKeys = _.keys(arrayMethods); + + var observerState = { + shouldConvert: true + }; + + function def(obj, key, val, enumerable) { + Object.defineProperty(obj, key, { + value: val, + enumerable: !!enumerable, + writable: true, + configurable: true + }); + } + + /** + * Observer class that are attached to each observed + * object. Once attached, the observer converts target + * object's property keys into getter/setters that + * collect dependencies and dispatches updates. + */ + + var Observer = function () { + function Observer(value) { + _classCallCheck(this, Observer); + + this.value = value; + this.dep = new Dep(); + this.vmCount = 0; + if (_.isArray(value)) { + var augment = hasProto ? protoAugment : copyAugment; + augment(value, arrayMethods, arrayKeys); + this.model = this.observeArray(value); + } else { + this.model = this.walk(value); + } + if (isIE9Below) { + this.model['__ob__'] = this; + } else { + def(this.model, "__ob__", this); + } + } + + Observer.prototype.walk = function walk(obj) { + return defineReactive(obj, this); + }; + + Observer.prototype.observeArray = function observeArray(items) { + for (var i = 0, l = items.length; i < l; i++) { + var ob = observe(items[i], this, i); + items[i] = ob ? ob.model : items[i]; + } + return items; + }; + + return Observer; + }(); + + function protoAugment(target, src, keys) { + /* eslint-disable no-proto */ + target.__proto__ = src; + /* eslint-enable no-proto */ + } + + /* istanbul ignore next */ + function copyAugment(target, src, keys) { + for (var i = 0, l = keys.length; i < l; i++) { + var key = keys[i]; + target[key] = src[key]; + } + } + + function observe(value, parentObserver, parentKey) { + if (!_.isObject(value)) { + return; + } + var ob = void 0; + if (value.__ob__ instanceof Observer) { + ob = value.__ob__; + } else if (observerState.shouldConvert && isExtensible(value) && (_.isArray(value) || isPlainObject(value))) { + ob = new Observer(value); + } + if (ob) { + ob.parent = parentObserver || ob.parent; + ob.parentKey = parentKey; + } + return ob; + } + + function notify(observer, key, dep, refresh) { + dep.notify({ observer: observer, key: key, refresh: refresh }); + if (observer) { + //触发a.*绑定的依赖 + _.each(observer._deps, function (dep) { + dep.notify({ observer: observer, key: key }); + }); + //触发a.**绑定的依赖 + var parent = observer, + root = observer, + route = key || ""; + while (parent) { + _.each(parent._scopeDeps, function (dep) { + dep.notify({ observer: observer, key: key }); + }); + if (parent.parentKey != null) { + route = parent.parentKey + '.' + route; + } + root = parent; + parent = parent.parent; + } + for (var _key in root._globalDeps) { + var reg = new RegExp(_key); + if (reg.test(route)) { + for (var i = 0; i < root._globalDeps[_key].length; i++) { + root._globalDeps[_key][i].notify({ observer: observer, key: _key }); + } + } + } + } + } + + function defineReactive(obj, observer, shallow) { + var props = {}; + var model = void 0; + // if (typeof Proxy === 'function') { + // const deps = {}, childObs = {}, cache = {} + // _.each(obj, function (val, key) { + // if (key in $$skipArray) { + // return + // } + // cache[key] = val + // const dep = deps[key] = (observer && observer['__dep' + key]) || new Dep() + // observer && (observer['__dep' + key] = dep) + // childObs[key] = !shallow && observe(val, observer, key) + // }) + // return model = new Proxy(props, { + // has: function (target, key) { + // return key in obj; + // }, + // get: function (target, key) { + // if (key in $$skipArray) { + // return target[key] + // } + // const value = cache[key] + // if (Dep.target) { + // deps[key].depend() + // if (childObs[key]) { + // childObs[key].dep.depend() + // if (_.isArray(value)) { + // dependArray(value) + // } + // } + // } + // return value + // }, + // set: function (target, key, newVal) { + // if (key in $$skipArray) { + // return target[key] = newVal + // } + // const value = cache[key], dep = deps[key] + // if (newVal === value || (newVal !== newVal && value !== value)) { + // return newVal + // } + // cache[key] = newVal + // childObs[key] = !shallow && observe(newVal, observer, key) + // obj[key] = childObs[key] ? childObs[key].model : newVal + // notify(model, key, dep) + // return obj[key] + // } + // }) + // } + _.each(obj, function (val, key) { + if (key in $$skipArray) { + return; + } + var configurable = isConfigurable(obj, key); + var dep = observer && observer['__dep' + key] || new Dep(); + observer && (observer['__dep' + key] = dep); + var childOb = configurable && !shallow && observe(val, observer, key); + props[key] = { + enumerable: true, + configurable: true, + get: function reactiveGetter() { + var value = childOb ? childOb.model : val; + if (Dep.target) { + dep.depend(); + if (childOb) { + childOb.dep.depend(); + if (_.isArray(value)) { + dependArray(value); + } + } + } + return value; + }, + set: function reactiveSetter(newVal) { + var value = childOb ? childOb.model : val; + if (newVal === value || newVal !== newVal && value !== value) { + return; + } + val = newVal; + childOb = configurable && !shallow && observe(newVal, observer, key); + if (childOb && value && value.__ob__) { + childOb._scopeDeps = value.__ob__._scopeDeps; + childOb._deps = value.__ob__._deps; + } + obj[key] = childOb ? childOb.model : newVal; + notify(model.__ob__, key, dep); + } + }; + }); + return model = createViewModel$1(obj, props); + } + + /** + * Set a property on an object. Adds the new property and + * triggers change notification if the property doesn't + * already exist. + */ + function set(target, key, val) { + if (_.isArray(target)) { + target.length = Math.max(target.length, key); + target.splice(key, 1, val); + return val; + } + if (_.has(target, key)) { + target[key] = val; + return val; + } + var ob = target.__ob__; + if (!ob) { + target[key] = val; + return val; + } + ob.value[key] = val; + target = defineReactive(ob.value, ob); + notify(ob, key, ob.dep); + return target; + } + + /** + * Delete a property and trigger change if necessary. + */ + function del(target, key) { + if (_.isArray(target)) { + target.splice(key, 1); + return; + } + var ob = target.__ob__; + if (!_.has(target, key)) { + return; + } + if (!ob) { + delete target[key]; + return target; + } + delete ob.value[key]; + target = defineReactive(ob.value, ob); + notify(ob, key, ob.dep); + return target; + } + + /** + * Collect dependencies on array elements when the array is touched, since + * we cannot intercept array element access like property getters. + */ + function dependArray(value) { + for (var e, i = 0, l = value.length; i < l; i++) { + e = value[i]; + e && e.__ob__ && e.__ob__.dep.depend(); + if (_.isArray(e)) { + dependArray(e); + } + } + } + + var falsy$1; + var operators = { + '||': falsy$1, + '&&': falsy$1, + '(': falsy$1, + ')': falsy$1 + }; + + function runBinaryFunction(binarys) { + var expr = ''; + for (var i = 0, len = binarys.length; i < len; i++) { + if (_.isBoolean(binarys[i]) || _.has(operators, binarys[i])) { + expr += binarys[i]; + } else { + expr += 'false'; + } + } + return new Function('return ' + expr)(); + } + + function routeToRegExp(route) { + route = route.replace(/\*\*/g, '[a-zA-Z0-9_]+').replace(/\*./g, '[a-zA-Z0-9_]+.'); + return '^' + route + '$'; + } + + function watch(model, expOrFn, cb, options) { + if (isPlainObject(cb)) { + options = cb; + cb = cb.handler; + } + if (typeof cb === 'string') { + cb = model[cb]; + } + options = options || {}; + options.user = true; + var exps = void 0; + if (_.isFunction(expOrFn) || !(exps = expOrFn.match(/[a-zA-Z0-9_.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && !/\*/.test(expOrFn)) { + var watcher = new Watcher(model, expOrFn, cb, options); + if (options.immediate) { + cb(watcher.value); + } + return function unwatchFn() { + watcher.teardown(); + }; + } + var watchers = []; + var fns = exps.slice(); + var complete = false, + running = false; + var callback = function callback(index, newValue, oldValue, attrs) { + if (complete === true) { + return; + } + fns[index] = true; + if (runBinaryFunction(fns)) { + complete = true; + cb(newValue, oldValue, attrs); + } + if (options && options.sync) { + complete = false; + running = false; + fns = exps.slice(); + } else { + if (!running) { + running = true; + nextTick(function () { + complete = false; + running = false; + fns = exps.slice(); + }); + } + } + }; + _.each(exps, function (exp, i) { + if (_.has(operators, exp)) { + return; + } + //a.**或a.*形式 + if (/^[1-9a-zA-Z.]+(\*\*$|\*$)/.test(exp) || exp === "**") { + var isGlobal = /\*\*$/.test(exp); + if (isGlobal) { + //a.**的形式 + exp = exp.replace(".**", ""); + } else { + //a.*的形式 + exp = exp.replace(".*", ""); + } + var getter = exp === "**" ? function (m) { + return m; + } : parsePath(exp); + var v = getter.call(model, model); + var dep = new Dep(); + if (isGlobal) { + (v.__ob__._scopeDeps || (v.__ob__._scopeDeps = [])).push(dep); + } else { + (v.__ob__._deps || (v.__ob__._deps = [])).push(dep); + } + var w = new Watcher(model, function () { + dep.depend(); + return NaN; + }, function (newValue, oldValue, attrs) { + callback(i, newValue, oldValue, _.extend({ index: i }, attrs)); + }, options); + watchers.push(function unwatchFn() { + w.teardown(); + v.__ob__._scopeDeps && remove(v.__ob__._scopeDeps, dep); + v.__ob__._deps && remove(v.__ob__._deps, dep); + }); + return; + } + // **.a.**的情况,场景:a.b.c, 如果用b.**监听, a被重新赋值b上的_scopeDes就不存在了 + if (/^(\*\*\.)+[1-9a-zA-Z]+(\.\*\*$)/.test(exp)) { + //先获取到能获取到的对象 + var paths = exp.split("."); + var currentModel = model[paths[1]]; + exp = paths[1] + ".**"; + //补全路径 + var parent = currentModel.__ob__.parent, + root = currentModel.__ob__; + while (parent) { + exp = '*.' + exp; + root = parent; + parent = parent.parent; + } + var regStr = routeToRegExp(exp); + var _dep = new Dep(); + root._globalDeps || (root._globalDeps = {}); + if (_.isArray(root._globalDeps[regStr])) { + root._globalDeps[regStr].push(_dep); + } else { + root._globalDeps[regStr] = [_dep]; + } + + var _w = new Watcher(currentModel, function () { + _dep.depend(); + return NaN; + }, function (newValue, oldValue, attrs) { + callback(i, newValue, oldValue, _.extend({ index: i }, attrs)); + }, options); + watchers.push(function unwatchFn() { + if (root._globalDeps) { + remove(root._globalDeps[regStr], _dep); + + if (root._globalDeps[regStr].length === 0) { + delete root._globalDeps[regStr]; + _w.teardown(); + } + } + }); + return; + } + if (/\*\*$|\*$/.test(exp)) { + throw new Error('not support'); + } + //其他含有*的情况,如*.a,*.*.a,a.*.a + if (/\*/.test(exp)) { + var _currentModel = model; + //先获取到能获取到的对象 + var _paths = exp.split("."); + for (var _i = 0, len = _paths.length; _i < len; _i++) { + if (_paths[_i] === "*") { + break; + } + _currentModel = model[_paths[_i]]; + } + exp = exp.substr(exp.indexOf("*")); + //补全路径 + var _parent = _currentModel.__ob__.parent, + _root = _currentModel.__ob__; + while (_parent) { + exp = '*.' + exp; + _root = _parent; + _parent = _parent.parent; + } + var _regStr = routeToRegExp(exp); + var _dep2 = new Dep(); + _root._globalDeps || (_root._globalDeps = {}); + if (_.isArray(_root._globalDeps[_regStr])) { + _root._globalDeps[_regStr].push(_dep2); + } else { + _root._globalDeps[_regStr] = [_dep2]; + } + + var _w2 = new Watcher(_currentModel, function () { + _dep2.depend(); + return NaN; + }, function (newValue, oldValue, attrs) { + callback(i, newValue, oldValue, _.extend({ index: i }, attrs)); + }, options); + watchers.push(function unwatchFn() { + if (_root._globalDeps) { + remove(_root._globalDeps[_regStr], _dep2); + + if (_root._globalDeps[_regStr].length === 0) { + delete _root._globalDeps[_regStr]; + _w2.teardown(); + } + } + }); + return; + } + var watcher = new Watcher(model, exp, function (newValue, oldValue, attrs) { + callback(i, newValue, oldValue, _.extend({ index: i }, attrs)); + }, options); + watchers.push(function unwatchFn() { + watcher.teardown(); + }); + }); + return watchers; + } + + var mixinInjection = {}; + + function getMixins(type) { + return mixinInjection[type]; + } + + function mixin(xtype, cls) { + mixinInjection[xtype] = _.cloneDeep(cls); + } + + var computedWatcherOptions = { lazy: true }; + var REACTIVE = true; + + function initState(vm, state) { + if (state) { + vm.$$state = REACTIVE ? observe(state).model : state; + } + } + + function initComputed(vm, computed) { + var watchers = vm._computedWatchers = {}; + defineComputed(vm, computed); + for (var key in computed) { + watchers[key] = defineComputedWatcher(vm, computed[key]); + } + } + + function defineComputedWatcher(vm, userDef) { + var context = vm.$$model ? vm.model : vm; + var getter = typeof userDef === "function" ? userDef : userDef.get; + + return new Watcher(context, getter || noop, noop, computedWatcherOptions); + } + + function defineOneComputedGetter(vm, key, userDef) { + var shouldCache = true; + var sharedPropertyDefinition = { + enumerable: true, + configurable: true, + get: noop, + set: noop + }; + if (typeof userDef === "function") { + sharedPropertyDefinition.get = createComputedGetter(vm, key); + sharedPropertyDefinition.set = noop; + } else { + sharedPropertyDefinition.get = userDef.get ? shouldCache && userDef.cache !== false ? createComputedGetter(vm, key) : userDef.get : noop; + sharedPropertyDefinition.set = userDef.set ? userDef.set : noop; + } + return sharedPropertyDefinition; + } + + function defineComputed(vm, computed) { + var props = {}; + for (var key in computed) { + if (!(key in vm)) { + props[key] = defineOneComputedGetter(vm, key, computed[key]); + } + } + vm.$$computed = createViewModel$1({}, props); + } + + function createComputedGetter(vm, key) { + return function computedGetter() { + var watcher = vm._computedWatchers && vm._computedWatchers[key]; + if (watcher) { + if (watcher.dirty) { + watcher.evaluate(); + } + if (REACTIVE && Dep.target) { + watcher.depend(); + } + return watcher.value; + } + }; + } + + function initWatch(vm, watch$$1) { + vm._watchers || (vm._watchers = []); + for (var key in watch$$1) { + var handler = watch$$1[key]; + if (_.isArray(handler)) { + for (var i = 0; i < handler.length; i++) { + vm._watchers.push(createWatcher(vm, key, handler[i])); + } + } else { + vm._watchers.push(createWatcher(vm, key, handler)); + } + } + } + + function createWatcher(vm, keyOrFn, cb, options) { + if (isPlainObject(cb)) { + options = cb; + cb = cb.handler; + } + if (typeof cb === 'string') { + cb = vm[cb]; + } + return watch(vm.model, keyOrFn, _.bind(cb, vm.$$model ? vm.model : vm), options); + } + + function initMethods(vm, methods) { + for (var key in methods) { + vm[key] = methods[key] == null ? noop : _.bind(methods[key], vm.$$model ? vm.model : vm); + } + } + + function initMixins(vm, mixins) { + mixins = (mixins || []).slice(0); + + _.each(mixins.reverse(), function (mixinType) { + var mixin$$1 = getMixins(mixinType); + + for (var key in mixin$$1) { + if (typeof mixin$$1[key] !== "function") continue; + + if (_.has(vm, key)) continue; + + vm[key] = _.bind(mixin$$1[key], vm.$$model ? vm.model : vm); + } + }); + } + + function defineProps(vm, keys) { + var props = {}; + // if (typeof Proxy === 'function') { + // return vm.model = new Proxy(props, { + // has: function (target, key) { + // return keys.indexOf(key) > -1; + // }, + // get: function (target, key) { + // if (key in $$skipArray) { + // return props[key] + // } + // if (vm.$$computed && key in vm.$$computed) { + // return vm.$$computed[key] + // } + // if (vm.$$state && key in vm.$$state) { + // return vm.$$state[key] + // } + // return vm.$$model[key] + // }, + // set: function (target, key, val) { + // if (key in $$skipArray) { + // return props[key] = val + // } + // if (vm.$$state && key in vm.$$state) { + // return vm.$$state[key] = val + // } + // if (vm.$$model && key in vm.$$model) { + // return vm.$$model[key] = val + // } + // } + // }) + // } + + var _loop = function _loop(i, len) { + var key = keys[i]; + if (!(key in $$skipArray)) { + props[key] = { + enumerable: true, + configurable: true, + get: function get() { + if (vm.$$computed && key in vm.$$computed) { + return vm.$$computed[key]; + } + if (vm.$$state && key in vm.$$state) { + return vm.$$state[key]; + } + if (vm.$$model && key in vm.$$model) { + return vm.$$model[key]; + } + var p = vm._parent; + while (p) { + if (p.$$context && key in p.$$context) { + return p.$$context[key]; + } + p = p._parent; + } + }, + set: function set(val) { + if (vm.$$state && key in vm.$$state) { + return vm.$$state[key] = val; + } + if (vm.$$model && key in vm.$$model) { + return vm.$$model[key] = val; + } + var p = vm._parent; + while (p) { + if (p.$$context && key in p.$$context) { + return p.$$context[key] = val; + } + p = p._parent; + } + } + }; + } + }; + + for (var i = 0, len = keys.length; i < len; i++) { + _loop(i, len); + } + vm.model = createViewModel$1({}, props); + } + + function defineContext(vm, keys) { + var props = {}; + + var _loop2 = function _loop2(i, len) { + var key = keys[i]; + if (!(key in $$skipArray)) { + props[key] = { + enumerable: true, + configurable: true, + get: function get() { + return vm.model[key]; + }, + set: function set(val) { + return vm.model[key] = val; + } + }; + } + }; + + for (var i = 0, len = keys.length; i < len; i++) { + _loop2(i, len); + } + vm.$$context = createViewModel$1({}, props); + } + + function getInjectValue(vm, key) { + var p = vm._parent; + while (p) { + if (p.$$context && key in p.$$context) { + return p.$$context[key]; + } + p = p._parent; + } + } + + function getInjectValues(vm) { + var inject = vm.inject || []; + var result = {}; + _.each(inject, function (key) { + result[key] = getInjectValue(vm, key); + }); + return result; + } + + var Model = function () { + function Model() { + _classCallCheck(this, Model); + } + + Model.prototype._constructor = function _constructor(model, destroyHandler) { + if (model instanceof Observer || model instanceof Model) { + model = model.model; + } + if (model && model.__ob__) { + this.$$model = model; + } else { + this.options = model || {}; + } + this._parent = Model.target; + var state = _.isFunction(this.state) ? this.state() : this.state; + var computed = this.computed; + var context = this.context; + var inject = this.inject; + var childContext = this.childContext; + var watch$$1 = this.watch; + var actions = this.actions; + var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(inject || []).concat(context || []); + var mixins = this.mixins; + defineProps(this, keys); + childContext && defineContext(this, childContext); + this.$$model && (this.model.__ob__ = this.$$model.__ob__); + initMixins(this, mixins); + this.init(); + initState(this, _.extend(getInjectValues(this), state)); + initComputed(this, computed); + REACTIVE && initWatch(this, watch$$1); + initMethods(this, actions); + this.created && this.created(); + this._destroyHandler = destroyHandler; + if (this.$$model) { + return this.model; + } + }; + + Model.prototype._init = function _init() {}; + + Model.prototype.init = function init() { + this._init(); + }; + + Model.prototype.destroy = function destroy() { + for (var _key3 in this._computedWatchers) { + this._computedWatchers[_key3].teardown(); + } + _.each(this._watchers, function (unwatches) { + unwatches = _.isArray(unwatches) ? unwatches : [unwatches]; + _.each(unwatches, function (unwatch) { + unwatch(); + }); + }); + this._watchers && (this._watchers = []); + this.destroyed && this.destroyed(); + this.$$model = null; + this.$$computed = null; + this.$$state = null; + this._destroyHandler && this._destroyHandler(); + }; + + return Model; + }(); + + function define(model) { + return REACTIVE ? new Observer(model).model : model; + } + + var reactive = define; + + function config(options) { + options || (options = {}); + if ("reactive" in options) { + REACTIVE = options.reactive; + } + } + + function toJSON(model) { + var result = void 0; + if (_.isArray(model)) { + result = []; + for (var i = 0, len = model.length; i < len; i++) { + result[i] = toJSON(model[i]); + } + } else if (model && isPlainObject(model)) { + result = {}; + for (var _key4 in model) { + if (!_.has($$skipArray, _key4)) { + result[_key4] = toJSON(model[_key4]); + } + } + } else { + result = model; + } + return result; + } + + var version = '2.0'; + + exports.version = version; + exports.$$skipArray = $$skipArray; + exports.mixin = mixin; + exports.Model = Model; + exports.define = define; + exports.reactive = reactive; + exports.config = config; + exports.observerState = observerState; + exports.Observer = Observer; + exports.observe = observe; + exports.notify = notify; + exports.defineReactive = defineReactive; + exports.set = set; + exports.del = del; + exports.Watcher = Watcher; + exports.pushTarget = pushTarget; + exports.popTarget = popTarget; + exports.watch = watch; + exports.toJSON = toJSON; + + exports.__esModule = true; +}); diff --git a/src/main/resources/com/fr/fineui/dist/fix/fix.proxy.js b/src/main/resources/com/fr/fineui/dist/fix/fix.proxy.js new file mode 100644 index 0000000..513db8d --- /dev/null +++ b/src/main/resources/com/fr/fineui/dist/fix/fix.proxy.js @@ -0,0 +1,2035 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Fix = {})); +}(this, (function (exports) { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function (obj) { + return typeof obj; + }; + } else { + _typeof = function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + } + + return _typeof(obj); + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a 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); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; + } + + var EMPTY_OBJ = Object.freeze({}); + Object.freeze([]); + var extend = Object.assign; + var hasOwnProperty = Object.prototype.hasOwnProperty; + + var hasOwn = function hasOwn(val, key) { + return hasOwnProperty.call(val, key); + }; + + var isArray = Array.isArray; + + var isMap$1 = function isMap(val) { + return toTypeString$1(val) === "[object Map]"; + }; + + var isFunction = function isFunction(val) { + return typeof val === "function"; + }; + + var isString = function isString(val) { + return typeof val === "string"; + }; + + var isSymbol = function isSymbol(val) { + return _typeof(val) === "symbol"; + }; + + var isObject = function isObject(val) { + return val !== null && _typeof(val) === "object"; + }; + + var objectToString$1 = Object.prototype.toString; + + var toTypeString$1 = function toTypeString(value) { + return objectToString$1.call(value); + }; + + var toRawType = function toRawType(value) { + return (// extract "RawType" from strings like "[object RawType]" + toTypeString$1(value).slice(8, -1) + ); + }; + + var isIntegerKey = function isIntegerKey(key) { + return isString(key) && key !== "NaN" && key[0] !== "-" && "".concat(parseInt(key, 10)) === key; + }; + + var cacheStringFunction = function cacheStringFunction(fn) { + var cache = Object.create(null); + return function (str) { + var hit = cache[str]; + return hit || (cache[str] = fn(str)); + }; + }; + /** + * @private + */ + + + var capitalize = cacheStringFunction(function (str) { + return str.charAt(0).toUpperCase() + str.slice(1); + }); // compare whether a value has changed, accounting for NaN. + + var hasChanged$1 = function hasChanged(value, oldValue) { + return value !== oldValue && (value === value || oldValue === oldValue); + }; + + var targetMap = new WeakMap(); + var effectStack = []; + var activeEffect; + var ITERATE_KEY = Symbol("iterate"); + var MAP_KEY_ITERATE_KEY = Symbol("Map key iterate"); + + function isEffect(fn) { + return fn && fn._isEffect === true; + } + + function effect(fn) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : EMPTY_OBJ; + + if (isEffect(fn)) { + fn = fn.raw; + } + + var effect = createReactiveEffect(fn, options); + + if (!options.lazy) { + effect(); + } + + return effect; + } + + function stop(effect) { + if (effect.active) { + cleanup(effect); + + if (effect.options.onStop) { + effect.options.onStop(); + } + + effect.active = false; + } + } + + var uid$1 = 0; + + function createReactiveEffect(fn, options) { + var effect = function reactiveEffect() { + if (!effect.active) { + return options.scheduler ? undefined : fn(); + } + + if (!effectStack.includes(effect)) { + cleanup(effect); + + try { + enableTracking(); + effectStack.push(effect); + activeEffect = effect; + return fn(); + } finally { + effectStack.pop(); + resetTracking(); + activeEffect = effectStack[effectStack.length - 1]; + } + } + }; + + effect.id = uid$1++; + effect.allowRecurse = !!options.allowRecurse; + effect._isEffect = true; + effect.active = true; + effect.raw = fn; + effect.deps = []; + effect.options = options; + return effect; + } + + function cleanup(effect) { + var deps = effect.deps; + + if (deps.length) { + for (var i = 0; i < deps.length; i++) { + deps[i].delete(effect); + } + + deps.length = 0; + } + } + + var shouldTrack = true; + var trackStack = []; + + function pauseTracking() { + trackStack.push(shouldTrack); + shouldTrack = false; + } + + function enableTracking() { + trackStack.push(shouldTrack); + shouldTrack = true; + } + + function resetTracking() { + var last = trackStack.pop(); + shouldTrack = last === undefined ? true : last; + } + + function track(target, type, key) { + if (!shouldTrack || activeEffect === undefined) { + return; + } + + var depsMap = targetMap.get(target); + + if (!depsMap) { + targetMap.set(target, depsMap = new Map()); + } + + var dep = depsMap.get(key); + + if (!dep) { + depsMap.set(key, dep = new Set()); + } + + if (!dep.has(activeEffect)) { + dep.add(activeEffect); + activeEffect.deps.push(dep); + + if (activeEffect.options.onTrack) { + activeEffect.options.onTrack({ + effect: activeEffect, + target: target, + type: type, + key: key + }); + } + } + } + + function trigger(target, type, key, newValue, oldValue, oldTarget) { + var depsMap = targetMap.get(target); + + if (!depsMap) { + // never been tracked + return; + } + + var effects = new Set(); + + var add = function add(effectsToAdd) { + if (effectsToAdd) { + effectsToAdd.forEach(function (effect) { + if (effect !== activeEffect || effect.allowRecurse) { + effects.add(effect); + } + }); + } + }; + + if (type === "clear" + /* CLEAR */ + ) { + // collection being cleared + // trigger all effects for target + depsMap.forEach(add); + } else if (key === "length" && isArray(target)) { + depsMap.forEach(function (dep, key) { + if (key === "length" || key >= newValue) { + add(dep); + } + }); + } else { + // schedule runs for SET | ADD | DELETE + if (key !== void 0) { + add(depsMap.get(key)); + } // also run for iteration key on ADD | DELETE | Map.SET + + + switch (type) { + case "add" + /* ADD */ + : + if (!isArray(target)) { + add(depsMap.get(ITERATE_KEY)); + + if (isMap$1(target)) { + add(depsMap.get(MAP_KEY_ITERATE_KEY)); + } + } else if (isIntegerKey(key)) { + // new index added to array -> length changes + add(depsMap.get("length")); + } + + break; + + case "delete" + /* DELETE */ + : + if (!isArray(target)) { + add(depsMap.get(ITERATE_KEY)); + + if (isMap$1(target)) { + add(depsMap.get(MAP_KEY_ITERATE_KEY)); + } + } + + break; + + case "set" + /* SET */ + : + if (isMap$1(target)) { + add(depsMap.get(ITERATE_KEY)); + } + + break; + } + } + + var run = function run(effect) { + if (effect.options.onTrigger) { + effect.options.onTrigger({ + effect: effect, + target: target, + key: key, + type: type, + newValue: newValue, + oldValue: oldValue, + oldTarget: oldTarget + }); + } + + if (effect.options.scheduler) { + effect.options.scheduler(effect); + } else { + effect(); + } + }; + + effects.forEach(run); + } + + var builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map(function (key) { + return Symbol[key]; + }).filter(isSymbol)); + var get = /* #__PURE__*/createGetter(); + var shallowGet = /* #__PURE__*/createGetter(false, true); + var readonlyGet = /* #__PURE__*/createGetter(true); + var shallowReadonlyGet = /* #__PURE__*/createGetter(true, true); + var arrayInstrumentations = {}; + ["includes", "indexOf", "lastIndexOf"].forEach(function (key) { + var method = Array.prototype[key]; + + arrayInstrumentations[key] = function () { + var arr = toRaw(this); + + for (var i = 0, l = this.length; i < l; i++) { + track(arr, "get" + /* GET */ + , "".concat(i)); + } // we run the method using the original args first (which may be reactive) + + + for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) { + args[_key2] = arguments[_key2]; + } + + var res = method.apply(arr, args); + + if (res === -1 || res === false) { + // if that didn't work, run it again using raw values. + return method.apply(arr, args.map(toRaw)); + } else { + return res; + } + }; + }); + ["push", "pop", "shift", "unshift", "splice"].forEach(function (key) { + var method = Array.prototype[key]; + + arrayInstrumentations[key] = function () { + pauseTracking(); + + for (var _len2 = arguments.length, args = new Array(_len2), _key3 = 0; _key3 < _len2; _key3++) { + args[_key3] = arguments[_key3]; + } + + var res = method.apply(this, args); + resetTracking(); + return res; + }; + }); + + function createGetter() { + var isReadonly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + var shallow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + return function get(target, key, receiver) { + if (key === "__v_isReactive" + /* IS_REACTIVE */ + ) { + return !isReadonly; + } else if (key === "__v_isReadonly" + /* IS_READONLY */ + ) { + return isReadonly; + } else if (key === "__v_raw" + /* RAW */ + && receiver === (isReadonly ? readonlyMap : reactiveMap).get(target)) { + return target; + } + + var targetIsArray = isArray(target); + + if (targetIsArray && hasOwn(arrayInstrumentations, key)) { + return Reflect.get(arrayInstrumentations, key, receiver); + } + + var res = Reflect.get(target, key, receiver); + + if (isSymbol(key) ? builtInSymbols.has(key) : key === "__proto__" || key === "__v_isRef") { + return res; + } + + if (!isReadonly) { + track(target, "get" + /* GET */ + , key); + } + + if (shallow) { + return res; + } + + if (isRef(res)) { + // ref unwrapping - does not apply for Array + integer key. + var shouldUnwrap = !targetIsArray || !isIntegerKey(key); + return shouldUnwrap ? res.value : res; + } + + if (isObject(res)) { + // Convert returned value into a proxy as well. we do the isObject check + // here to avoid invalid value warning. Also need to lazy access readonly + // and reactive here to avoid circular dependency. + return isReadonly ? readonly(res) : reactive(res); + } + + return res; + }; + } + + var set$1 = /* #__PURE__*/createSetter(); + var shallowSet = /* #__PURE__*/createSetter(true); + + function createSetter() { + var shallow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + return function set(target, key, value, receiver) { + var oldValue = target[key]; + + if (!shallow) { + value = toRaw(value); + + if (!isArray(target) && isRef(oldValue) && !isRef(value)) { + oldValue.value = value; + return true; + } + } + + var hadKey = isArray(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); + var result = Reflect.set(target, key, value, receiver); // don't trigger if target is something up in the prototype chain of original + + if (target === toRaw(receiver)) { + if (!hadKey) { + trigger(target, "add" + /* ADD */ + , key, value); + } else if (hasChanged$1(value, oldValue) || key === "length") { + trigger(target, "set" + /* SET */ + , key, value, oldValue); + } + } + + return result; + }; + } + + function deleteProperty(target, key) { + var hadKey = hasOwn(target, key); + var oldValue = target[key]; + var result = Reflect.deleteProperty(target, key); + + if (result && hadKey) { + trigger(target, "delete" + /* DELETE */ + , key, undefined, oldValue); + } + + return result; + } + + function has$1(target, key) { + var result = Reflect.has(target, key); + + if (!isSymbol(key) || !builtInSymbols.has(key)) { + track(target, "has" + /* HAS */ + , key); + } + + return result; + } + + function ownKeys(target) { + track(target, "iterate" + /* ITERATE */ + , isArray(target) ? "length" : ITERATE_KEY); + return Reflect.ownKeys(target); + } + + var mutableHandlers = { + get: get, + set: set$1, + deleteProperty: deleteProperty, + has: has$1, + ownKeys: ownKeys + }; + var readonlyHandlers = { + get: readonlyGet, + set: function set(target, key) { + { + console.warn("Set operation on key \"".concat(String(key), "\" failed: target is readonly."), target); + } + return true; + }, + deleteProperty: function deleteProperty(target, key) { + { + console.warn("Delete operation on key \"".concat(String(key), "\" failed: target is readonly."), target); + } + return true; + } + }; + extend({}, mutableHandlers, { + get: shallowGet, + set: shallowSet + }); // Props handlers are special in the sense that it should not unwrap top-level + // refs (in order to allow refs to be explicitly passed down), but should + // retain the reactivity of the normal readonly object. + + extend({}, readonlyHandlers, { + get: shallowReadonlyGet + }); + + var toReactive = function toReactive(value) { + return isObject(value) ? reactive(value) : value; + }; + + var toReadonly = function toReadonly(value) { + return isObject(value) ? readonly(value) : value; + }; + + var toShallow = function toShallow(value) { + return value; + }; + + var getProto = function getProto(v) { + return Reflect.getPrototypeOf(v); + }; + + function get$1(target, key) { + var isReadonly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var isShallow = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; + // #1772: readonly(reactive(Map)) should return readonly + reactive version + // of the value + target = target["__v_raw" + /* RAW */ + ]; + var rawTarget = toRaw(target); + var rawKey = toRaw(key); + + if (key !== rawKey) { + !isReadonly && track(rawTarget, "get" + /* GET */ + , key); + } + + !isReadonly && track(rawTarget, "get" + /* GET */ + , rawKey); + + var _getProto = getProto(rawTarget), + has = _getProto.has; + + var wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive; + + if (has.call(rawTarget, key)) { + return wrap(target.get(key)); + } else if (has.call(rawTarget, rawKey)) { + return wrap(target.get(rawKey)); + } + } + + function has$1$1(key) { + var isReadonly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var target = this["__v_raw" + /* RAW */ + ]; + var rawTarget = toRaw(target); + var rawKey = toRaw(key); + + if (key !== rawKey) { + !isReadonly && track(rawTarget, "has" + /* HAS */ + , key); + } + + !isReadonly && track(rawTarget, "has" + /* HAS */ + , rawKey); + return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); + } + + function size(target) { + var isReadonly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + target = target["__v_raw" + /* RAW */ + ]; + !isReadonly && track(toRaw(target), "iterate" + /* ITERATE */ + , ITERATE_KEY); + return Reflect.get(target, "size", target); + } + + function add(value) { + value = toRaw(value); + var target = toRaw(this); + var proto = getProto(target); + var hadKey = proto.has.call(target, value); + var result = target.add(value); + + if (!hadKey) { + trigger(target, "add" + /* ADD */ + , value, value); + } + + return result; + } + + function set$1$1(key, value) { + value = toRaw(value); + var target = toRaw(this); + + var _getProto2 = getProto(target), + has = _getProto2.has, + get = _getProto2.get; + + var hadKey = has.call(target, key); + + if (!hadKey) { + key = toRaw(key); + hadKey = has.call(target, key); + } else { + checkIdentityKeys(target, has, key); + } + + var oldValue = get.call(target, key); + var result = target.set(key, value); + + if (!hadKey) { + trigger(target, "add" + /* ADD */ + , key, value); + } else if (hasChanged$1(value, oldValue) || key === "length") { + trigger(target, "set" + /* SET */ + , key, value, oldValue); + } + + return result; + } + + function deleteEntry(key) { + var target = toRaw(this); + + var _getProto3 = getProto(target), + has = _getProto3.has, + get = _getProto3.get; + + var hadKey = has.call(target, key); + + if (!hadKey) { + key = toRaw(key); + hadKey = has.call(target, key); + } else { + checkIdentityKeys(target, has, key); + } + + var oldValue = get ? get.call(target, key) : undefined; // forward the operation before queueing reactions + + var result = target.delete(key); + + if (hadKey) { + trigger(target, "delete" + /* DELETE */ + , key, undefined, oldValue); + } + + return result; + } + + function clear() { + var target = toRaw(this); + var hadItems = target.size !== 0; + var oldTarget = isMap$1(target) ? new Map(target) : new Set(target); // forward the operation before queueing reactions + + var result = target.clear(); + + if (hadItems) { + trigger(target, "clear" + /* CLEAR */ + , undefined, undefined, oldTarget); + } + + return result; + } + + function createForEach(isReadonly, isShallow) { + return function forEach(callback, thisArg) { + var observed = this; + var target = observed["__v_raw" + /* RAW */ + ]; + var rawTarget = toRaw(target); + var wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive; + !isReadonly && track(rawTarget, "iterate" + /* ITERATE */ + , ITERATE_KEY); + return target.forEach(function (value, key) { + return (// important: make sure the callback is + // 1. invoked with the reactive map as `this` and 3rd arg + // 2. the value received should be a corresponding reactive/readonly. + callback.call(thisArg, wrap(value), wrap(key), observed) + ); + }); + }; + } + + function createIterableMethod(method, isReadonly, isShallow) { + return function () { + var target = this["__v_raw" + /* RAW */ + ]; + var rawTarget = toRaw(target); + var targetIsMap = isMap$1(rawTarget); + var isPair = method === "entries" || method === Symbol.iterator && targetIsMap; + var isKeyOnly = method === "keys" && targetIsMap; + var innerIterator = target[method].apply(target, arguments); + var wrap = isReadonly ? toReadonly : isShallow ? toShallow : toReactive; + !isReadonly && track(rawTarget, "iterate" + /* ITERATE */ + , isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY); // return a wrapped iterator which returns observed versions of the + // values emitted from the real iterator + + return _defineProperty({ + // iterator protocol + next: function next() { + var _innerIterator$next = innerIterator.next(), + value = _innerIterator$next.value, + done = _innerIterator$next.done; + + return done ? { + value: value, + done: done + } : { + value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), + done: done + }; + } + }, Symbol.iterator, function () { + return this; + }); + }; + } + + function createReadonlyMethod(type) { + return function () { + { + var key = (arguments.length <= 0 ? undefined : arguments[0]) ? "on key \"".concat(arguments.length <= 0 ? undefined : arguments[0], "\" ") : ""; + console.warn("".concat(capitalize(type), " operation ").concat(key, "failed: target is readonly."), toRaw(this)); + } + return type === "delete" + /* DELETE */ + ? false : this; + }; + } + + var mutableInstrumentations = { + get: function get(key) { + return get$1(this, key); + }, + + get size() { + return size(this); + }, + + has: has$1$1, + add: add, + set: set$1$1, + delete: deleteEntry, + clear: clear, + forEach: createForEach(false, false) + }; + var shallowInstrumentations = { + get: function get(key) { + return get$1(this, key, false, true); + }, + + get size() { + return size(this); + }, + + has: has$1$1, + add: add, + set: set$1$1, + delete: deleteEntry, + clear: clear, + forEach: createForEach(false, true) + }; + var readonlyInstrumentations = { + get: function get(key) { + return get$1(this, key, true); + }, + + get size() { + return size(this, true); + }, + + has: function has(key) { + return has$1$1.call(this, key, true); + }, + add: createReadonlyMethod("add" + /* ADD */ + ), + set: createReadonlyMethod("set" + /* SET */ + ), + delete: createReadonlyMethod("delete" + /* DELETE */ + ), + clear: createReadonlyMethod("clear" + /* CLEAR */ + ), + forEach: createForEach(true, false) + }; + var iteratorMethods = ["keys", "values", "entries", Symbol.iterator]; + iteratorMethods.forEach(function (method) { + mutableInstrumentations[method] = createIterableMethod(method, false, false); + readonlyInstrumentations[method] = createIterableMethod(method, true, false); + shallowInstrumentations[method] = createIterableMethod(method, false, true); + }); + + function createInstrumentationGetter(isReadonly, shallow) { + var instrumentations = shallow ? shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations; + return function (target, key, receiver) { + if (key === "__v_isReactive" + /* IS_REACTIVE */ + ) { + return !isReadonly; + } else if (key === "__v_isReadonly" + /* IS_READONLY */ + ) { + return isReadonly; + } else if (key === "__v_raw" + /* RAW */ + ) { + return target; + } + + return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver); + }; + } + + var mutableCollectionHandlers = { + get: createInstrumentationGetter(false, false) + }; + var readonlyCollectionHandlers = { + get: createInstrumentationGetter(true, false) + }; + + function checkIdentityKeys(target, has, key) { + var rawKey = toRaw(key); + + if (rawKey !== key && has.call(target, rawKey)) { + var type = toRawType(target); + console.warn("Reactive ".concat(type, " contains both the raw and reactive ") + "versions of the same object".concat(type === "Map" ? " as keys" : "", ", ") + "which can lead to inconsistencies. " + "Avoid differentiating between the raw and reactive versions " + "of an object and only use the reactive version if possible."); + } + } + + var reactiveMap = new WeakMap(); + var readonlyMap = new WeakMap(); + + function targetTypeMap(rawType) { + switch (rawType) { + case "Object": + case "Array": + return 1; + + case "Map": + case "Set": + case "WeakMap": + case "WeakSet": + return 2; + + default: + return 0; + } + } + + function getTargetType(value) { + return value["__v_skip" + /* SKIP */ + ] || !Object.isExtensible(value) ? 0 + /* INVALID */ + : targetTypeMap(toRawType(value)); + } + + function reactive(target) { + // if trying to observe a readonly proxy, return the readonly version. + if (target && target["__v_isReadonly" + /* IS_READONLY */ + ]) { + return target; + } + + return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers); + } // Return a reactive-copy of the original object, where only the root level + + function readonly(target) { + return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers); + } // Return a reactive-copy of the original object, where only the root level + + function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers) { + if (!isObject(target)) { + { + console.warn("value cannot be made reactive: ".concat(String(target))); + } + return target; + } // target is already a Proxy, return it. + // exception: calling readonly() on a reactive object + + + if (target["__v_raw" + /* RAW */ + ] && !(isReadonly && target["__v_isReactive" + /* IS_REACTIVE */ + ])) { + return target; + } // target already has corresponding Proxy + + + var proxyMap = isReadonly ? readonlyMap : reactiveMap; + var existingProxy = proxyMap.get(target); + + if (existingProxy) { + return existingProxy; + } // only a whitelist of value types can be observed. + + + var targetType = getTargetType(target); + + if (targetType === 0 + /* INVALID */ + ) { + return target; + } + + var proxy = new Proxy(target, targetType === 2 + /* COLLECTION */ + ? collectionHandlers : baseHandlers); + proxyMap.set(target, proxy); + return proxy; + } + + function isReactive(value) { + if (isReadonly(value)) { + return isReactive(value["__v_raw" + /* RAW */ + ]); + } + + return !!(value && value["__v_isReactive" + /* IS_REACTIVE */ + ]); + } + + function isReadonly(value) { + return !!(value && value["__v_isReadonly" + /* IS_READONLY */ + ]); + } + + function toRaw(observed) { + return observed && toRaw(observed["__v_raw" + /* RAW */ + ]) || observed; + } + + function isRef(r) { + return Boolean(r && r.__v_isRef === true); + } + + var ComputedRefImpl = /*#__PURE__*/function () { + function ComputedRefImpl(getter, _setter, isReadonly) { + var _this2 = this; + + _classCallCheck(this, ComputedRefImpl); + + this._setter = _setter; + this._dirty = true; + this.__v_isRef = true; + this.effect = effect(getter, { + lazy: true, + scheduler: function scheduler() { + if (!_this2._dirty) { + _this2._dirty = true; + trigger(toRaw(_this2), "set" + /* SET */ + , "value"); + } + } + }); + this["__v_isReadonly" + /* IS_READONLY */ + ] = isReadonly; + } + + _createClass(ComputedRefImpl, [{ + key: "value", + get: function get() { + if (this._dirty) { + this._value = this.effect(); + this._dirty = false; + } + + track(toRaw(this), "get" + /* GET */ + , "value"); + return this._value; + }, + set: function set(newValue) { + this._setter(newValue); + } + }]); + + return ComputedRefImpl; + }(); + + function computed(getterOrOptions) { + var getter; + var setter; + + if (isFunction(getterOrOptions)) { + getter = getterOrOptions; + + setter = function setter() { + console.warn("Write operation failed: computed value is readonly"); + }; + } else { + getter = getterOrOptions.get; + setter = getterOrOptions.set; + } + + return new ComputedRefImpl(getter, setter, isFunction(getterOrOptions) || !getterOrOptions.set); + } + + function noop() {} + function isNative(Ctor) { + return typeof Ctor === "function" && /native code/.test(Ctor.toString()); + } + var isIE = function isIE() { + if (typeof navigator === "undefined") { + return false; + } + + return /(msie|trident)/i.test(navigator.userAgent.toLowerCase()); + }; + var getIEVersion = function getIEVersion() { + var version = 0; + + if (typeof navigator === "undefined") { + return false; + } + + var agent = navigator.userAgent.toLowerCase(); + var v1 = agent.match(/(?:msie\s([\w.]+))/); + var v2 = agent.match(/(?:trident.*rv:([\w.]+))/); + + if (v1 && v2 && v1[1] && v2[1]) { + version = Math.max(v1[1] * 1, v2[1] * 1); + } else if (v1 && v1[1]) { + version = v1[1] * 1; + } else if (v2 && v2[1]) { + version = v2[1] * 1; + } else { + version = 0; + } + + return version; + }; + isIE() && getIEVersion() < 9; + var _toString = Object.prototype.toString; + function isPlainObject(obj) { + return _toString.call(obj) === "[object Object]"; + } + var bailRE = /[^\w.$]/; + function parsePath(path) { + if (bailRE.test(path)) { + return; + } + + var segments = path.split("."); + return function (obj) { + for (var i = 0; i < segments.length; i++) { + if (!obj) return; + obj = obj[segments[i]]; + } + + return obj; + }; + } + var nextTick = function () { + var callbacks = []; + var pending = false; + var timerFunc; + + function nextTickHandler() { + pending = false; + var copies = callbacks.slice(0); + callbacks.length = 0; + + for (var i = 0; i < copies.length; i++) { + copies[i](); + } + } // An asynchronous deferring mechanism. + // In pre 2.4, we used to use microtasks (Promise/MutationObserver) + // but microtasks actually has too high a priority and fires in between + // supposedly sequential events (e.g. #4521, #6690) or even between + // bubbling of the same event (#6566). Technically setImmediate should be + // the ideal choice, but it's not available everywhere; and the only polyfill + // that consistently queues the callback after all DOM events triggered in the + // same loop is by using MessageChannel. + + /* istanbul ignore if */ + + + if (typeof setImmediate !== "undefined" && isNative(setImmediate)) { + timerFunc = function timerFunc() { + setImmediate(nextTickHandler); + }; + } else if (typeof MessageChannel !== "undefined" && (isNative(MessageChannel) || // PhantomJS + MessageChannel.toString() === "[object MessageChannelConstructor]")) { + var channel = new MessageChannel(); + var port = channel.port2; + channel.port1.onmessage = nextTickHandler; + + timerFunc = function timerFunc() { + port.postMessage(1); + }; + } else if (typeof Promise !== "undefined" && isNative(Promise)) { + /* istanbul ignore next */ + // use microtask in non-DOM environments, e.g. Weex + var p = Promise.resolve(); + + timerFunc = function timerFunc() { + p.then(nextTickHandler); + }; + } else { + // fallback to setTimeout + timerFunc = function timerFunc() { + setTimeout(nextTickHandler, 0); + }; + } + + return function queueNextTick(cb, ctx) { + var _resolve; + + callbacks.push(function () { + if (cb) { + try { + cb.call(ctx); + } catch (e) { + console.error(e); + } + } else if (_resolve) { + _resolve(ctx); + } + }); + + if (!pending) { + pending = true; + timerFunc(); + } // $flow-disable-line + + + if (!cb && typeof Promise !== "undefined") { + return new Promise(function (resolve) { + _resolve = resolve; + }); + } + }; + }(); + + var mixinInjection = {}; + function getMixins(type) { + return mixinInjection[type]; + } + function mixin(xtype, cls) { + mixinInjection[xtype] = _.cloneDeep(cls); + } + + var queue = []; + var activatedChildren = []; + var has = {}; + var waiting = false; + var flushing = false; + var index = 0; + + function resetSchedulerState() { + index = queue.length = activatedChildren.length = 0; + has = {}; + waiting = flushing = false; + } + + function flushSchedulerQueue() { + flushing = true; + var watcher; + var id; + var options; // Sort queue before flush. + // This ensures that: + // 1. Components are updated from parent to child. (because parent is always + // created before the child) + // 2. A component's user watchers are run before its render watcher (because + // user watchers are created before the render watcher) + // 3. If a component is destroyed during a parent component's watcher run, + // its watchers can be skipped. + + queue.sort(function (a, b) { + return a.id - b.id; + }); // do not cache length because more watchers might be pushed + // as we run existing watchers + + for (index = 0; index < queue.length; index++) { + watcher = queue[index].watcher; + options = queue[index].options; + id = watcher.id; + has[id] = null; + watcher(options); + } + + resetSchedulerState(); + } + + function queueWatcher(watcher, options) { + var id = watcher.id; + + if (has[id] == null) { + has[id] = true; + + if (!flushing) { + queue.push({ + watcher: watcher, + options: options + }); + } else { + // if already flushing, splice the watcher based on its id + // if already past its id, it will be run next immediately. + var i = queue.length - 1; + + while (i > index && queue[i].watcher.id > watcher.id) { + i--; + } + + queue.splice(i + 1, 0, { + watcher: watcher, + options: options + }); + } // queue the flush + + + if (!waiting) { + waiting = true; + nextTick(flushSchedulerQueue); + } + } + } + + function innerWatch(source, cb, options) { + if (!_.isFunction(cb)) { + console.warn("`watch(fn, options?)` signature has been moved to a separate API. " + "Use `watchEffect(fn, options?)` instead. `watch` now only " + "supports `watch(source, cb, options?) signature."); + } + + return doWatch(source, cb, options); + } + var INITIAL_WATCHER_VALUE = {}; + var objectToString = Object.prototype.toString; + + var toTypeString = function toTypeString(value) { + return objectToString.call(value); + }; + + var isMap = function isMap(val) { + return toTypeString(val) === "[object Map]"; + }; + + var isSet = function isSet(val) { + return toTypeString(val) === "[object Set]"; + }; + + var hasChanged = function hasChanged(value, oldValue) { + return value !== oldValue && (value === value || oldValue === oldValue); + }; + + var uid = 0; + + function doWatch(source, cb, options, instance) { + options = options || {}; + var _options = options, + immediate = _options.immediate, + deep = _options.deep, + sync = _options.sync, + onTrack = _options.onTrack, + onTrigger = _options.onTrigger; + + if (!cb) { + if (immediate !== undefined) { + console.warn("watch() \"immediate\" option is only respected when using the " + "watch(source, callback, options?) signature."); + } + + if (deep !== undefined) { + console.warn("watch() \"deep\" option is only respected when using the " + "watch(source, callback, options?) signature."); + } + } + + var warnInvalidSource = function warnInvalidSource(s) { + console.warn("Invalid watch source: ", s, "A watch source can only be a getter/effect function, a ref, " + "a reactive object, or an array of these types."); + }; + + var getter; + var forceTrigger = false; + + if (isRef(source)) { + getter = function getter() { + return source.value; + }; + + forceTrigger = !!source._shallow; + } else if (isReactive(source)) { + getter = function getter() { + return source; + }; + + deep = true; + } else if (_.isArray(source)) { + getter = function getter() { + return source.map(function (s) { + if (isRef(s)) { + return s.value; + } else if (isReactive(s)) { + return traverse(s); + } else if (_.isFunction(s)) { + return s.call(instance); + } else { + warnInvalidSource(s); + } + }); + }; + } else if (_.isFunction(source)) { + if (cb) { + // getter with cb + getter = function getter() { + return source.call(instance); + }; + } else { + // no cb -> simple effect + getter = function getter() { + if (instance && instance.isUnmounted) { + return; + } + + if (cleanup) { + cleanup(); + } + + return source.call(instance, onInvalidate); + }; + } + } else { + getter = function getter() {}; + + warnInvalidSource(source); + } + + if (cb && deep) { + var baseGetter = getter; + + getter = function getter() { + return traverse(baseGetter()); + }; + } + + var cleanup; + + var onInvalidate = function onInvalidate(fn) { + cleanup = runner.options.onStop = function () { + fn.call(instance); + }; + }; + + var oldValue = _.isArray(source) ? [] : INITIAL_WATCHER_VALUE; + + var job = function job() { + if (!runner.active) { + return; + } + + if (cb) { + // watch(source, cb) + var newValue = runner(); + + if (deep || forceTrigger || hasChanged(newValue, oldValue)) { + // cleanup before running cb again + if (cleanup) { + cleanup(); + } + + cb.apply(instance, [newValue, // pass undefined as the old value when it's changed for the first time + oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue, onInvalidate]); + oldValue = newValue; + } + } else { + // watchEffect + runner(); + } + }; // important: mark the job as a watcher callback so that scheduler knows + // it is allowed to self-trigger (#1727) + + + job.allowRecurse = !!cb; + job.id = ++uid; + var scheduler; + + if (sync === true) { + scheduler = job; + } else { + scheduler = function scheduler() { + return queueWatcher(job); + }; + } + + var runner = effect(getter, { + lazy: true, + onTrack: onTrack, + onTrigger: onTrigger, + scheduler: scheduler + }); // initial run + + if (cb) { + if (immediate) { + job(); + } else { + oldValue = runner(); + } + } else { + runner(); + } + + return function () { + stop(runner); + }; + } + + function traverse(value) { + var seen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set(); + + if (!_.isObject(value) || seen.has(value)) { + return value; + } + + seen.add(value); + + if (isRef(value)) { + traverse(value.value, seen); + } else if (_.isArray(value)) { + for (var i = 0; i < value.length; i++) { + traverse(value[i], seen); + } + } else if (isSet(value) || isMap(value)) { + value.forEach(function (v) { + traverse(v, seen); + }); + } else { + for (var key in value) { + traverse(value[key], seen); + } + } + + return value; + } + + var falsy; + var operators = { + "||": falsy, + "&&": falsy, + "(": falsy, + ")": falsy + }; + + function runBinaryFunction(binarys) { + var expr = ""; + + for (var i = 0, len = binarys.length; i < len; i++) { + if (_.isBoolean(binarys[i]) || _.has(operators, binarys[i])) { + expr += binarys[i]; + } else { + expr += "false"; + } + } + + return new Function("return " + expr)(); + } + + function watchExp(model, exp) { + var getter = parsePath(exp); + var result = getter.call(model, model); + + if (_.isArray(result)) { + return result.concat(); + } + + return result; + } + + function watch(model, expOrFn, cb, options) { + if (isPlainObject(cb)) { + options = cb; + cb = cb.handler; + } + + if (typeof cb === "string") { + cb = model[cb]; + } + + options = options || {}; + options.user = true; + var exps; + + if (_.isFunction(expOrFn) || !(exps = expOrFn.match(/[a-zA-Z0-9_.*]+|[|][|]|[&][&]|[(]|[)]/g)) || exps.length === 1 && !/\*/.test(expOrFn)) { + var watcher = innerWatch(_.isFunction(expOrFn) ? expOrFn : function () { + return watchExp(model, expOrFn); + }, cb, options); + return function unwatchFn() { + watcher(); + }; + } + + var watchers = []; + var fns = exps.slice(); + var complete = false, + running = false; + + var callback = function callback(index, newValue, oldValue, attrs) { + if (complete === true) { + return; + } + + fns[index] = true; + + if (runBinaryFunction(fns)) { + complete = true; + cb(newValue, oldValue, attrs); + } + + if (options && options.sync) { + complete = false; + running = false; + fns = exps.slice(); + } else { + if (!running) { + running = true; + nextTick(function () { + complete = false; + running = false; + fns = exps.slice(); + }); + } + } + }; + + _.each(exps, function (exp, i) { + if (_.has(operators, exp)) { + return; + } //a.**形式 + + + if (/^[1-9a-zA-Z.]+\*\*$/.test(exp) || exp === "**") { + exp = exp.replace(".**", ""); + var getter = exp === "**" ? function (m) { + return m; + } : parsePath(exp); + var v = getter.call(model, model); + watchers.push(innerWatch(v, function (newValue, oldValue) { + callback(i, newValue, oldValue, _.extend({ + index: i + })); + })); + return; + } + + if (/^(\*\*\.)+[1-9a-zA-Z]+(\.\*\*$)/.test(exp)) { + throw new Error("not support"); + } //含有*的情况,如a.*,如*.a,*.*.a,a.*.a + + + if (/\*/.test(exp)) { + // eslint-disable-next-line no-inner-declarations + var travers = function travers(root, deps, parent, key, res) { + if (deps.length === paths.length) { + root !== undefined && res.push({ + parent: parent, + k: key + }); + return; + } + + if (root) { + if (paths[deps.length] === "*") { + // 遍历所有节点 + for (var k in root) { + travers(root[k], deps.concat([k]), root, k, res); + } + } else { + var nextKey = paths[deps.length]; + travers(root[nextKey], deps.concat([nextKey]), root, nextKey, res); + } + } + }; + + //先获取到能获取到的对象 + var paths = exp.split("."); + var prePaths = []; + + for (var _i = 0, len = paths.length; _i < len; _i++) { + if (paths[_i] === "*") { + break; + } + + prePaths[_i] = paths[_i]; + } + + var _v; + + if (prePaths.length > 0) { + var _getter = parsePath(prePaths.join(".")); + + _v = _getter.call(model, model); + } else { + _v = model; + } + + paths = paths.slice(prePaths.length); + var changes = []; + watchers.push(innerWatch(function () { + var routes = []; + travers(_v, [], _v, null, routes); + + for (var _i2 = 0, _len = routes.length; _i2 < _len; _i2++) { + var _routes$_i = routes[_i2], + parent = _routes$_i.parent, + k = _routes$_i.k; + + for (var j = 0, l = changes.length; j < l; j++) { + var _changes$j = changes[j], + target = _changes$j.target, + key = _changes$j.key; + + if (target === toRaw(parent) && key === k) { + return true; + } + } + } + }, function (newValue) { + changes = []; + + if (newValue === true) { + callback(i, undefined, undefined, _.extend({ + index: i + })); + } + }, { + deep: true, + onTrigger: function onTrigger(_ref) { + var target = _ref.target, + key = _ref.key; + changes.push({ + target: target, + key: key + }); + } + })); + return; + } + + watchers.push(innerWatch(function () { + return watchExp(model, exp); + }, function (newValue, oldValue) { + callback(i, newValue, oldValue, _.extend({ + index: i + })); + })); + }); + + return watchers; + } + + var REACTIVE = true; + + function initState(vm, state) { + if (state) { + vm.$$state = REACTIVE ? reactive(state) : state; + } + } + + function initComputed(vm, c) { + var $$computed = vm.$$computed = {}; + + for (var key in c) { + $$computed[key] = computed(_.bind(c[key], vm)); + } + } + + function initWatch(vm, watch) { + vm._watchers || (vm._watchers = []); + + for (var key in watch) { + var handler = watch[key]; + + if (_.isArray(handler)) { + for (var i = 0; i < handler.length; i++) { + vm._watchers.push(createWatcher(vm, key, handler[i])); + } + } else { + vm._watchers.push(createWatcher(vm, key, handler)); + } + } + } + + function createWatcher(vm, keyOrFn, cb, options) { + if (isPlainObject(cb)) { + options = cb; + cb = cb.handler; + } + + if (typeof cb === "string") { + cb = vm[cb]; + } + + return watch(vm.model, keyOrFn, _.bind(cb, vm), options); + } + + function initMethods(vm, methods) { + for (var key in methods) { + vm[key] = methods[key] == null ? noop : _.bind(methods[key], vm); + } + } + + function initMixins(vm, mixins) { + mixins = (mixins || []).slice(0); + + _.each(mixins.reverse(), function (mixinType) { + var mixin = getMixins(mixinType); + + for (var key in mixin) { + if (typeof mixin[key] !== "function") continue; + if (_.has(vm, key)) continue; + vm[key] = _.bind(mixin[key], vm); + } + }); + } + + function defineProps(vm) { + vm.model = new Proxy({}, { + get: function get(target, key) { + if (vm.$$computed && key in vm.$$computed) { + try { + return vm.$$computed[key].value; + } catch (e) {// 吞掉异常 + } + + return; + } + + if (vm.$$state && key in vm.$$state) { + return vm.$$state[key]; + } + + var p = vm._parent; + + while (p) { + if (p.$$context && key in p.$$context) { + return p.$$context[key]; + } + + p = p._parent; + } + }, + set: function set(target, key, value) { + if (vm.$$state && key in vm.$$state) { + vm.$$state[key] = value; + return true; + } + + var p = vm._parent; + + while (p) { + if (p.$$context && key in p.$$context) { + p.$$context[key] = value; + return true; + } + + p = p._parent; + } + + return true; + } + }); + } + + function defineContext(vm, keys) { + var props = {}; + + var _loop = function _loop(i, len) { + var key = keys[i]; + props[key] = { + enumerable: true, + configurable: true, + get: function get() { + return vm.model[key]; + }, + set: function set(val) { + return vm.model[key] = val; + } + }; + }; + + for (var i = 0, len = keys.length; i < len; i++) { + _loop(i); + } + + vm.$$context = Object.defineProperties({}, props); + } + + function getInjectValue(vm, key) { + var p = vm._parent; + + while (p) { + if (p.$$context && key in p.$$context) { + return p.$$context[key]; + } + + p = p._parent; + } + } + + function getInjectValues(vm) { + var inject = vm.inject || []; + var result = {}; + + _.each(inject, function (key) { + result[key] = getInjectValue(vm, key); + }); + + return result; + } + + var Model = /*#__PURE__*/function () { + function Model() { + _classCallCheck(this, Model); + } + + _createClass(Model, [{ + key: "_constructor", + value: function _constructor(options, destroyHandler) { + this.options = options || {}; + this._parent = Model.target; + var state = _.isFunction(this.state) ? this.state() : this.state; + var computed = this.computed; + var context = this.context; + var inject = this.inject; + var childContext = this.childContext; + var watch = this.watch; + var actions = this.actions; + + _.keys(state).concat(_.keys(computed)).concat(inject || []).concat(context || []); + + var mixins = this.mixins; + defineProps(this); + childContext && defineContext(this, childContext); + initMixins(this, mixins); + this.init(); + initState(this, _.extend(getInjectValues(this), state)); + initComputed(this, computed); + REACTIVE && initWatch(this, watch); + initMethods(this, actions); + this.created && this.created(); + this._destroyHandler = destroyHandler; + } + }, { + key: "_init", + value: function _init() {} + }, { + key: "init", + value: function init() { + this._init(); + } + }, { + key: "destroy", + value: function destroy() { + _.each(this._watchers, function (unwatches) { + unwatches = _.isArray(unwatches) ? unwatches : [unwatches]; + + _.each(unwatches, function (unwatch) { + unwatch(); + }); + }); + + this._watchers && (this._watchers = []); + this.destroyed && this.destroyed(); + this.$$computed = null; + this.$$state = null; + this._destroyHandler && this._destroyHandler(); + } + }]); + + return Model; + }(); + function set(target, key, val) { + if (_.isArray(target)) { + target.length = Math.max(target.length, key); + target.splice(key, 1, val); + return val; + } + + target[key] = val; + } + function del(target, key) { + if (_.isArray(target)) { + target.splice(key, 1); + return; + } + + if (!_.has(target, key)) { + return; + } + + delete target[key]; + } + function define(model) { + return REACTIVE ? reactive(model) : model; + } + function config(options) { + options || (options = {}); + + if ("reactive" in options) { + REACTIVE = options.reactive; + } + } + + function toJSON(model) { + var result; + + if (_.isArray(model)) { + result = []; + + for (var i = 0, len = model.length; i < len; i++) { + result[i] = toJSON(model[i]); + } + } else if (model && isPlainObject(model)) { + result = {}; + + for (var key in model) { + result[key] = toJSON(model[key]); + } + } else { + result = model; + } + + return result; + } + + var version = "3.0"; + + exports.Model = Model; + exports.config = config; + exports.define = define; + exports.del = del; + exports.mixin = mixin; + exports.set = set; + exports.toJSON = toJSON; + exports.version = version; + exports.watch = watch; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/src/main/resources/com/fr/fineui/dist/fix/worker.compact.js b/src/main/resources/com/fr/fineui/dist/fix/worker.compact.js new file mode 100644 index 0000000..63cfbe7 --- /dev/null +++ b/src/main/resources/com/fr/fineui/dist/fix/worker.compact.js @@ -0,0 +1,157 @@ +;(function () { + var contexts = {}; + + var WORKER; + BI.useWorker = function (wk) { + WORKER = wk; + + var _init = BI.Widget.prototype._init; + BI.Widget.prototype._init = function () { + this.$destroyWorker = createWorker.call(this); + try { + _init.apply(this, arguments); + } catch (e) { + console.error(e); + } + }; + + var _initRender = BI.Widget.prototype._initRender; + var postMessage = function (data) { + switch (data.eventType) { + case "create": + this.model = data.msg; + _initRender.call(this); + break; + case "watch": + var watchArgs = data.args; + this.watch[data.currentWatchType].apply(this, watchArgs); + break; + } + }; + BI.Widget.prototype._initRender = function () { + if (WORKER && this._worker) { + this.__asking = true; + this.__async = true; + } else { + _initRender.apply(this, arguments); + } + }; + + var unMount = BI.Widget.prototype.__d; + BI.Widget.prototype.__d = function () { + this.$destroyWorker && this.$destroyWorker(); + try { + unMount.apply(this, arguments); + } catch (e) { + console.error(e); + } + }; + + if (WORKER) { + WORKER.addEventListener("message", function (e) { + var data = e.data; + postMessage.apply(contexts[data.name], [data]); + }, false); + } + }; + + function createWorker () { + var self = this; + if (this._worker) { + var name = this.getName(); + var modelType = this._worker(); + var options; + if (BI.isArray(modelType)) { + options = modelType[1]; + modelType = modelType[0]; + } + if (WORKER) { + contexts[name] = this; + WORKER.postMessage({ + type: modelType, + name: name, + eventType: "create", + options: options, + watches: BI.map(this.watch, function (key) { + return key; + }) + }); + var store = {}; + this.store = new Proxy(store, { + get: function (target, key) { + return function () { + WORKER.postMessage({ + type: modelType, + name: name, + eventType: "action", + action: key, + args: [].slice.call(arguments) + }); + }; + }, + set: function (target, key, value) { + return Reflect.set(target, key, value); + } + }); + return function () { + delete contexts[name]; + WORKER.postMessage({ + type: modelType, + name: name, + eventType: "destroy" + }); + }; + } else { + this.store = BI.Models.getModel(modelType, options); + this.store && (this.store._widget = this); + if (this.store instanceof Fix.Model) { + this.model = this.store.model; + } else { + this.model = this.store; + } + initWatch(this, this.watch); + return function () { + this.store && BI.isFunction(this.store.destroy) && this.store.destroy(); + BI.each(this._watchers, function (i, unwatches) { + unwatches = BI.isArray(unwatches) ? unwatches : [unwatches]; + BI.each(unwatches, function (j, unwatch) { + unwatch(); + }); + }); + this._watchers && (this._watchers = []); + if (this.store) { + this.store._parent && (this.store._parent = null); + this.store._widget && (this.store._widget = null); + this.store = null; + } + }; + } + + } + } + + function initWatch (vm, watch) { + vm._watchers || (vm._watchers = []); + for (var key in watch) { + var handler = watch[key]; + if (BI.isArray(handler)) { + for (var i = 0; i < handler.length; i++) { + vm._watchers.push(createWatcher(vm, key, handler[i])); + } + } else { + vm._watchers.push(createWatcher(vm, key, handler)); + } + } + } + + function createWatcher (vm, keyOrFn, cb, options) { + if (BI.isPlainObject(cb)) { + options = cb; + cb = cb.handler; + } + options = options || {}; + return Fix.watch(vm.model, keyOrFn, _.bind(cb, vm), BI.extend(options, { + store: vm.store + })); + } +}()); diff --git a/src/main/resources/com/fr/fineui/dist/font/iconfont.eot b/src/main/resources/com/fr/fineui/dist/font/iconfont.eot new file mode 100644 index 0000000..9db0441 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/font/iconfont.eot differ diff --git a/src/main/resources/com/fr/fineui/dist/font/iconfont.svg b/src/main/resources/com/fr/fineui/dist/font/iconfont.svg new file mode 100644 index 0000000..5a40b72 --- /dev/null +++ b/src/main/resources/com/fr/fineui/dist/font/iconfont.svg @@ -0,0 +1,1275 @@ + + + + Created by iconfont + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/com/fr/fineui/dist/font/iconfont.ttf b/src/main/resources/com/fr/fineui/dist/font/iconfont.ttf new file mode 100644 index 0000000..2200c29 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/font/iconfont.ttf differ diff --git a/src/main/resources/com/fr/fineui/dist/font/iconfont.woff b/src/main/resources/com/fr/fineui/dist/font/iconfont.woff new file mode 100644 index 0000000..dfeba9b Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/font/iconfont.woff differ diff --git a/src/main/resources/com/fr/fineui/dist/font/iconfont.woff2 b/src/main/resources/com/fr/fineui/dist/font/iconfont.woff2 new file mode 100644 index 0000000..d85feab Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/font/iconfont.woff2 differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color.png new file mode 100644 index 0000000..a7bf3ce Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_disable.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_disable.png new file mode 100644 index 0000000..a15403d Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_disable.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_normal.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_normal.png new file mode 100644 index 0000000..2018e47 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_normal_disable.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_normal_disable.png new file mode 100644 index 0000000..fe1fb30 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_normal_disable.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_normal_select.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_normal_select.png new file mode 100644 index 0000000..344b849 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_normal_select.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_select.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_select.png new file mode 100644 index 0000000..11e92b7 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/auto_color_select.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/line_conn.gif b/src/main/resources/com/fr/fineui/dist/images/1x/background/line_conn.gif new file mode 100644 index 0000000..d561d36 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/line_conn.gif differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/marker.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/marker.png new file mode 100644 index 0000000..3929bbb Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/marker.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/mask.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/mask.png new file mode 100644 index 0000000..b0a4d40 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/mask.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/trans_color.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/trans_color.png new file mode 100644 index 0000000..f32144f Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/trans_color.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/trans_disable.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/trans_disable.png new file mode 100644 index 0000000..c070eb9 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/trans_disable.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/trans_normal.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/trans_normal.png new file mode 100644 index 0000000..4f63b43 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/trans_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/trans_select.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/trans_select.png new file mode 100644 index 0000000..1e3837a Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/trans_select.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/background/wheel.png b/src/main/resources/com/fr/fineui/dist/images/1x/background/wheel.png new file mode 100644 index 0000000..97b343d Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/background/wheel.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/auto_no_square_normal.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/auto_no_square_normal.png new file mode 100644 index 0000000..a2482a1 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/auto_no_square_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/auto_square_normal.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/auto_square_normal.png new file mode 100644 index 0000000..1b90b9b Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/auto_square_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_active.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_active.png new file mode 100644 index 0000000..c063dff Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_active.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_disable.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_disable.png new file mode 100644 index 0000000..bfeefc3 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_disable.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_disable2.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_disable2.png new file mode 100644 index 0000000..556ba1c Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_disable2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_hover.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_hover.png new file mode 100644 index 0000000..c452173 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_hover.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_normal.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_normal.png new file mode 100644 index 0000000..02ecc05 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/check_box_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/auto_square_normal.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/auto_square_normal.png new file mode 100644 index 0000000..e9e6405 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/auto_square_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/trans_normal.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/trans_normal.png new file mode 100644 index 0000000..5de946e Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/trans_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/trans_select.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/trans_select.png new file mode 100644 index 0000000..ce061d9 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/trans_select.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_collapse_1.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_collapse_1.png new file mode 100644 index 0000000..3b8bcf8 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_collapse_1.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_collapse_2.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_collapse_2.png new file mode 100644 index 0000000..e05a3c2 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_collapse_2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_collapse_3.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_collapse_3.png new file mode 100644 index 0000000..b9435ff Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_collapse_3.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_collapse_4.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_collapse_4.png new file mode 100644 index 0000000..c83be64 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_collapse_4.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_expand_1.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_expand_1.png new file mode 100644 index 0000000..4538bda Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_expand_1.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_expand_2.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_expand_2.png new file mode 100644 index 0000000..f6d8fe2 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_expand_2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_expand_3.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_expand_3.png new file mode 100644 index 0000000..48283b5 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_expand_3.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_expand_4.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_expand_4.png new file mode 100644 index 0000000..0e2bd0c Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_expand_4.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_1.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_1.png new file mode 100644 index 0000000..da1525d Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_1.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_2.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_2.png new file mode 100644 index 0000000..95dc947 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_3.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_3.png new file mode 100644 index 0000000..ecd99fd Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_3.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_4.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_4.png new file mode 100644 index 0000000..6584a86 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_4.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_5.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_5.png new file mode 100644 index 0000000..3125a9b Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dark/tree_vertical_line_5.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/dots.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dots.png new file mode 100644 index 0000000..55b461b Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/dots.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/half_selected.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/half_selected.png new file mode 100644 index 0000000..7ec85e3 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/half_selected.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/half_selected_disable.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/half_selected_disable.png new file mode 100644 index 0000000..5e9add3 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/half_selected_disable.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/icon_down_arrow.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/icon_down_arrow.png new file mode 100644 index 0000000..b77c330 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/icon_down_arrow.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/loading.gif b/src/main/resources/com/fr/fineui/dist/images/1x/icon/loading.gif new file mode 100644 index 0000000..d04fdd2 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/loading.gif differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/push_down.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/push_down.png new file mode 100644 index 0000000..7eb88eb Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/push_down.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/push_up.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/push_up.png new file mode 100644 index 0000000..a3042a4 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/push_up.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_active.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_active.png new file mode 100644 index 0000000..ff21dd1 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_active.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_disable.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_disable.png new file mode 100644 index 0000000..1de4dc7 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_disable.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_disable2.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_disable2.png new file mode 100644 index 0000000..3808cfb Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_disable2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_hover.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_hover.png new file mode 100644 index 0000000..c4250d5 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_hover.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_normal.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_normal.png new file mode 100644 index 0000000..d2fe037 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/radio_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/slider_active.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/slider_active.png new file mode 100644 index 0000000..a84164f Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/slider_active.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/slider_active_small.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/slider_active_small.png new file mode 100644 index 0000000..1c29cec Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/slider_active_small.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/slider_normal.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/slider_normal.png new file mode 100644 index 0000000..8a611ff Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/slider_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/slider_normal_small.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/slider_normal_small.png new file mode 100644 index 0000000..7bd6fc7 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/slider_normal_small.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/trans_normal.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/trans_normal.png new file mode 100644 index 0000000..e80ef67 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/trans_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/trans_select.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/trans_select.png new file mode 100644 index 0000000..ce061d9 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/trans_select.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_collapse_1.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_collapse_1.png new file mode 100644 index 0000000..d67ba29 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_collapse_1.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_collapse_2.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_collapse_2.png new file mode 100644 index 0000000..6d80754 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_collapse_2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_collapse_3.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_collapse_3.png new file mode 100644 index 0000000..64cac32 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_collapse_3.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_collapse_4.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_collapse_4.png new file mode 100644 index 0000000..42d2a1e Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_collapse_4.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_expand_1.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_expand_1.png new file mode 100644 index 0000000..578a496 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_expand_1.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_expand_2.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_expand_2.png new file mode 100644 index 0000000..ec715ed Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_expand_2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_expand_3.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_expand_3.png new file mode 100644 index 0000000..dc32dc7 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_expand_3.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_expand_4.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_expand_4.png new file mode 100644 index 0000000..f166471 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_expand_4.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_1.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_1.png new file mode 100644 index 0000000..1eae663 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_1.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_2.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_2.png new file mode 100644 index 0000000..9d160d9 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_3.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_3.png new file mode 100644 index 0000000..4b8c500 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_3.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_4.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_4.png new file mode 100644 index 0000000..25be9ef Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_4.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_5.png b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_5.png new file mode 100644 index 0000000..c9a5754 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/tree_vertical_line_5.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/1x/icon/wave_loading.gif b/src/main/resources/com/fr/fineui/dist/images/1x/icon/wave_loading.gif new file mode 100644 index 0000000..1434622 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/1x/icon/wave_loading.gif differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/background/auto_color_disable.png b/src/main/resources/com/fr/fineui/dist/images/2x/background/auto_color_disable.png new file mode 100644 index 0000000..b617130 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/background/auto_color_disable.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/background/auto_color_normal.png b/src/main/resources/com/fr/fineui/dist/images/2x/background/auto_color_normal.png new file mode 100644 index 0000000..2085e7c Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/background/auto_color_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/background/auto_color_select.png b/src/main/resources/com/fr/fineui/dist/images/2x/background/auto_color_select.png new file mode 100644 index 0000000..547fffc Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/background/auto_color_select.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/background/line_conn.gif b/src/main/resources/com/fr/fineui/dist/images/2x/background/line_conn.gif new file mode 100644 index 0000000..d561d36 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/background/line_conn.gif differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/background/marker.png b/src/main/resources/com/fr/fineui/dist/images/2x/background/marker.png new file mode 100644 index 0000000..3929bbb Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/background/marker.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/background/mask.png b/src/main/resources/com/fr/fineui/dist/images/2x/background/mask.png new file mode 100644 index 0000000..b0a4d40 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/background/mask.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/background/trans_normal.png b/src/main/resources/com/fr/fineui/dist/images/2x/background/trans_normal.png new file mode 100644 index 0000000..663a842 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/background/trans_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/background/wheel.png b/src/main/resources/com/fr/fineui/dist/images/2x/background/wheel.png new file mode 100644 index 0000000..97b343d Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/background/wheel.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/auto_no_square_normal.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/auto_no_square_normal.png new file mode 100644 index 0000000..a2482a1 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/auto_no_square_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/auto_normal.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/auto_normal.png new file mode 100644 index 0000000..527212c Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/auto_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/auto_select.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/auto_select.png new file mode 100644 index 0000000..49423ca Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/auto_select.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/auto_square_normal.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/auto_square_normal.png new file mode 100644 index 0000000..850bdbe Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/auto_square_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_active.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_active.png new file mode 100644 index 0000000..a23036f Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_active.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_disable.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_disable.png new file mode 100644 index 0000000..700bda3 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_disable.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_disable2.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_disable2.png new file mode 100644 index 0000000..d134520 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_disable2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_hover.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_hover.png new file mode 100644 index 0000000..ebbec3f Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_hover.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_normal.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_normal.png new file mode 100644 index 0000000..da76aef Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/check_box_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/auto_square_normal.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/auto_square_normal.png new file mode 100644 index 0000000..1df5c88 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/auto_square_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/trans_normal.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/trans_normal.png new file mode 100644 index 0000000..3e68e88 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/trans_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/trans_select.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/trans_select.png new file mode 100644 index 0000000..afaeecf Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/trans_select.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_collapse_1.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_collapse_1.png new file mode 100644 index 0000000..b3f555f Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_collapse_1.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_collapse_2.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_collapse_2.png new file mode 100644 index 0000000..4a78b93 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_collapse_2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_collapse_3.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_collapse_3.png new file mode 100644 index 0000000..3361b8a Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_collapse_3.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_collapse_4.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_collapse_4.png new file mode 100644 index 0000000..9e7af4a Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_collapse_4.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_expand_1.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_expand_1.png new file mode 100644 index 0000000..484843f Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_expand_1.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_expand_2.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_expand_2.png new file mode 100644 index 0000000..d44e15d Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_expand_2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_expand_3.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_expand_3.png new file mode 100644 index 0000000..3190b87 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_expand_3.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_expand_4.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_expand_4.png new file mode 100644 index 0000000..bf35d75 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_expand_4.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_1.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_1.png new file mode 100644 index 0000000..9ae6424 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_1.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_2.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_2.png new file mode 100644 index 0000000..0e43988 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_3.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_3.png new file mode 100644 index 0000000..54fd201 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_3.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_4.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_4.png new file mode 100644 index 0000000..60f2c0a Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_4.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_5.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_5.png new file mode 100644 index 0000000..27531a3 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dark/tree_vertical_line_5.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/dots.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dots.png new file mode 100644 index 0000000..beae59d Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/dots.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/half_selected.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/half_selected.png new file mode 100644 index 0000000..7fe3379 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/half_selected.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/half_selected_disable.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/half_selected_disable.png new file mode 100644 index 0000000..7157ac6 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/half_selected_disable.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/icon_down_arrow.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/icon_down_arrow.png new file mode 100644 index 0000000..5285f73 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/icon_down_arrow.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/loading.gif b/src/main/resources/com/fr/fineui/dist/images/2x/icon/loading.gif new file mode 100644 index 0000000..d04fdd2 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/loading.gif differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/push_down.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/push_down.png new file mode 100644 index 0000000..88ef8d5 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/push_down.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/push_up.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/push_up.png new file mode 100644 index 0000000..040d502 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/push_up.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_active.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_active.png new file mode 100644 index 0000000..60aadf2 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_active.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_disable.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_disable.png new file mode 100644 index 0000000..3cf0824 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_disable.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_disable2.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_disable2.png new file mode 100644 index 0000000..a8b773c Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_disable2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_hover.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_hover.png new file mode 100644 index 0000000..5814caa Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_hover.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_normal.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_normal.png new file mode 100644 index 0000000..f7eed28 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/radio_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/slider_active.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/slider_active.png new file mode 100644 index 0000000..cf361f7 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/slider_active.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/slider_active_small.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/slider_active_small.png new file mode 100644 index 0000000..1c29cec Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/slider_active_small.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/slider_normal.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/slider_normal.png new file mode 100644 index 0000000..a81cf03 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/slider_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/slider_normal_small.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/slider_normal_small.png new file mode 100644 index 0000000..7bd6fc7 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/slider_normal_small.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/trans_normal.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/trans_normal.png new file mode 100644 index 0000000..4dcecc5 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/trans_normal.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/trans_select.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/trans_select.png new file mode 100644 index 0000000..afaeecf Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/trans_select.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_collapse_1.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_collapse_1.png new file mode 100644 index 0000000..2041a0e Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_collapse_1.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_collapse_2.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_collapse_2.png new file mode 100644 index 0000000..f2b9893 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_collapse_2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_collapse_3.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_collapse_3.png new file mode 100644 index 0000000..24eb8e8 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_collapse_3.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_collapse_4.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_collapse_4.png new file mode 100644 index 0000000..242f034 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_collapse_4.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_expand_1.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_expand_1.png new file mode 100644 index 0000000..9f5acc5 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_expand_1.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_expand_2.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_expand_2.png new file mode 100644 index 0000000..5b630d0 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_expand_2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_expand_3.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_expand_3.png new file mode 100644 index 0000000..b995958 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_expand_3.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_expand_4.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_expand_4.png new file mode 100644 index 0000000..e8df787 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_expand_4.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_1.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_1.png new file mode 100644 index 0000000..ea9e933 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_1.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_2.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_2.png new file mode 100644 index 0000000..6b3a595 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_2.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_3.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_3.png new file mode 100644 index 0000000..878ea61 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_3.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_4.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_4.png new file mode 100644 index 0000000..7d94696 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_4.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_5.png b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_5.png new file mode 100644 index 0000000..3c3c9c8 Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/tree_vertical_line_5.png differ diff --git a/src/main/resources/com/fr/fineui/dist/images/2x/icon/wave_loading.gif b/src/main/resources/com/fr/fineui/dist/images/2x/icon/wave_loading.gif new file mode 100644 index 0000000..932045e Binary files /dev/null and b/src/main/resources/com/fr/fineui/dist/images/2x/icon/wave_loading.gif differ diff --git a/src/main/resources/com/fr/fineui/dist/router.js b/src/main/resources/com/fr/fineui/dist/router.js new file mode 100644 index 0000000..77ca04c --- /dev/null +++ b/src/main/resources/com/fr/fineui/dist/router.js @@ -0,0 +1,3200 @@ +/*! + * vue-router v3.5.2 + * (c) 2021 Evan You + * @license MIT + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory()); + }(this, (function () { 'use strict'; + + /* */ + + function assert (condition, message) { + if (!condition) { + throw new Error(("[vue-router] " + message)) + } + } + + function warn (condition, message) { + if (!condition) { + typeof console !== 'undefined' && console.warn(("[vue-router] " + message)); + } + } + + function extend (a, b) { + for (var key in b) { + a[key] = b[key]; + } + return a + } + + /* */ + + var encodeReserveRE = /[!'()*]/g; + var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); }; + var commaRE = /%2C/g; + + // fixed encodeURIComponent which is more conformant to RFC3986: + // - escapes [!'()*] + // - preserve commas + var encode = function (str) { return encodeURIComponent(str) + .replace(encodeReserveRE, encodeReserveReplacer) + .replace(commaRE, ','); }; + + function decode (str) { + try { + return decodeURIComponent(str) + } catch (err) { + { + warn(false, ("Error decoding \"" + str + "\". Leaving it intact.")); + } + } + return str + } + + function resolveQuery ( + query, + extraQuery, + _parseQuery + ) { + if ( extraQuery === void 0 ) extraQuery = {}; + + var parse = _parseQuery || parseQuery; + var parsedQuery; + try { + parsedQuery = parse(query || ''); + } catch (e) { + warn(false, e.message); + parsedQuery = {}; + } + for (var key in extraQuery) { + var value = extraQuery[key]; + parsedQuery[key] = Array.isArray(value) + ? value.map(castQueryParamValue) + : castQueryParamValue(value); + } + return parsedQuery + } + + var castQueryParamValue = function (value) { return (value == null || typeof value === 'object' ? value : String(value)); }; + + function parseQuery (query) { + var res = {}; + + query = query.trim().replace(/^(\?|#|&)/, ''); + + if (!query) { + return res + } + + query.split('&').forEach(function (param) { + var parts = param.replace(/\+/g, ' ').split('='); + var key = decode(parts.shift()); + var val = parts.length > 0 ? decode(parts.join('=')) : null; + + if (res[key] === undefined) { + res[key] = val; + } else if (Array.isArray(res[key])) { + res[key].push(val); + } else { + res[key] = [res[key], val]; + } + }); + + return res + } + + function stringifyQuery (obj) { + var res = obj + ? Object.keys(obj) + .map(function (key) { + var val = obj[key]; + + if (val === undefined) { + return '' + } + + if (val === null) { + return encode(key) + } + + if (Array.isArray(val)) { + var result = []; + val.forEach(function (val2) { + if (val2 === undefined) { + return + } + if (val2 === null) { + result.push(encode(key)); + } else { + result.push(encode(key) + '=' + encode(val2)); + } + }); + return result.join('&') + } + + return encode(key) + '=' + encode(val) + }) + .filter(function (x) { return x.length > 0; }) + .join('&') + : null; + return res ? ("?" + res) : '' + } + + /* */ + + var trailingSlashRE = /\/?$/; + + function createRoute ( + record, + location, + redirectedFrom, + router + ) { + var stringifyQuery = router && router.options.stringifyQuery; + + var query = location.query || {}; + try { + query = clone(query); + } catch (e) {} + + var route = { + name: location.name || (record && record.name), + meta: (record && record.meta) || {}, + path: location.path || '/', + hash: location.hash || '', + query: query, + params: location.params || {}, + fullPath: getFullPath(location, stringifyQuery), + matched: record ? formatMatch(record) : [] + }; + if (redirectedFrom) { + route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery); + } + return Object.freeze(route) + } + + function clone (value) { + if (Array.isArray(value)) { + return value.map(clone) + } else if (value && typeof value === 'object') { + var res = {}; + for (var key in value) { + res[key] = clone(value[key]); + } + return res + } else { + return value + } + } + + // the starting route that represents the initial state + var START = createRoute(null, { + path: '/' + }); + + function formatMatch (record) { + var res = []; + while (record) { + res.unshift(record); + record = record.parent; + } + return res + } + + function getFullPath ( + ref, + _stringifyQuery + ) { + var path = ref.path; + var query = ref.query; if ( query === void 0 ) query = {}; + var hash = ref.hash; if ( hash === void 0 ) hash = ''; + + var stringify = _stringifyQuery || stringifyQuery; + return (path || '/') + stringify(query) + hash + } + + function isSameRoute (a, b, onlyPath) { + if (b === START) { + return a === b + } else if (!b) { + return false + } else if (a.path && b.path) { + return a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') && (onlyPath || + a.hash === b.hash && + isObjectEqual(a.query, b.query)) + } else if (a.name && b.name) { + return ( + a.name === b.name && + (onlyPath || ( + a.hash === b.hash && + isObjectEqual(a.query, b.query) && + isObjectEqual(a.params, b.params)) + ) + ) + } else { + return false + } + } + + function isObjectEqual (a, b) { + if ( a === void 0 ) a = {}; + if ( b === void 0 ) b = {}; + + // handle null value #1566 + if (!a || !b) { return a === b } + var aKeys = Object.keys(a).sort(); + var bKeys = Object.keys(b).sort(); + if (aKeys.length !== bKeys.length) { + return false + } + return aKeys.every(function (key, i) { + var aVal = a[key]; + var bKey = bKeys[i]; + if (bKey !== key) { return false } + var bVal = b[key]; + // query values can be null and undefined + if (aVal == null || bVal == null) { return aVal === bVal } + // check nested equality + if (typeof aVal === 'object' && typeof bVal === 'object') { + return isObjectEqual(aVal, bVal) + } + return String(aVal) === String(bVal) + }) + } + + function isIncludedRoute (current, target) { + return ( + current.path.replace(trailingSlashRE, '/').indexOf( + target.path.replace(trailingSlashRE, '/') + ) === 0 && + (!target.hash || current.hash === target.hash) && + queryIncludes(current.query, target.query) + ) + } + + function queryIncludes (current, target) { + for (var key in target) { + if (!(key in current)) { + return false + } + } + return true + } + + function handleRouteEntered (route) { + for (var i = 0; i < route.matched.length; i++) { + var record = route.matched[i]; + for (var name in record.instances) { + var instance = record.instances[name]; + var cbs = record.enteredCbs[name]; + if (!instance || !cbs) { continue } + delete record.enteredCbs[name]; + for (var i$1 = 0; i$1 < cbs.length; i$1++) { + if (!instance._isBeingDestroyed) { cbs[i$1](instance); } + } + } + } + } + + // var View = { + // name: 'RouterView', + // functional: true, + // props: { + // name: { + // type: String, + // default: 'default' + // } + // }, + // render: function render (_, ref) { + // var props = ref.props; + // var children = ref.children; + // var parent = ref.parent; + // var data = ref.data; + + // // used by devtools to display a router-view badge + // data.routerView = true; + + // // directly use parent context's createElement() function + // // so that components rendered by router-view can resolve named slots + // var h = parent.$createElement; + // var name = props.name; + // var route = parent.$route; + // var cache = parent._routerViewCache || (parent._routerViewCache = {}); + + // // determine current view depth, also check to see if the tree + // // has been toggled inactive but kept-alive. + // var depth = 0; + // var inactive = false; + // while (parent && parent._routerRoot !== parent) { + // var vnodeData = parent.$vnode ? parent.$vnode.data : {}; + // if (vnodeData.routerView) { + // depth++; + // } + // if (vnodeData.keepAlive && parent._directInactive && parent._inactive) { + // inactive = true; + // } + // parent = parent.$parent; + // } + // data.routerViewDepth = depth; + + // // render previous view if the tree is inactive and kept-alive + // if (inactive) { + // var cachedData = cache[name]; + // var cachedComponent = cachedData && cachedData.component; + // if (cachedComponent) { + // // #2301 + // // pass props + // if (cachedData.configProps) { + // fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps); + // } + // return h(cachedComponent, data, children) + // } else { + // // render previous empty view + // return h() + // } + // } + + // var matched = route.matched[depth]; + // var component = matched && matched.components[name]; + + // // render empty node if no matched route or no config component + // if (!matched || !component) { + // cache[name] = null; + // return h() + // } + + // // cache component + // cache[name] = { component: component }; + + // // attach instance registration hook + // // this will be called in the instance's injected lifecycle hooks + // data.registerRouteInstance = function (vm, val) { + // // val could be undefined for unregistration + // var current = matched.instances[name]; + // if ( + // (val && current !== vm) || + // (!val && current === vm) + // ) { + // matched.instances[name] = val; + // } + // } + + // // also register instance in prepatch hook + // // in case the same component instance is reused across different routes + // ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) { + // matched.instances[name] = vnode.componentInstance; + // }; + + // // register instance in init hook + // // in case kept-alive component be actived when routes changed + // data.hook.init = function (vnode) { + // if (vnode.data.keepAlive && + // vnode.componentInstance && + // vnode.componentInstance !== matched.instances[name] + // ) { + // matched.instances[name] = vnode.componentInstance; + // } + + // // if the route transition has already been confirmed then we weren't + // // able to call the cbs during confirmation as the component was not + // // registered yet, so we call it here. + // handleRouteEntered(route); + // }; + + // var configProps = matched.props && matched.props[name]; + // // save route and configProps in cache + // if (configProps) { + // extend(cache[name], { + // route: route, + // configProps: configProps + // }); + // fillPropsinData(component, data, route, configProps); + // } + + // return h(component, data, children) + // } + // }; + + // function fillPropsinData (component, data, route, configProps) { + // // resolve props + // var propsToPass = data.props = resolveProps(route, configProps); + // if (propsToPass) { + // // clone to prevent mutation + // propsToPass = data.props = extend({}, propsToPass); + // // pass non-declared props as attrs + // var attrs = data.attrs = data.attrs || {}; + // for (var key in propsToPass) { + // if (!component.props || !(key in component.props)) { + // attrs[key] = propsToPass[key]; + // delete propsToPass[key]; + // } + // } + // } + // } + + // function resolveProps (route, config) { + // switch (typeof config) { + // case 'undefined': + // return + // case 'object': + // return config + // case 'function': + // return config(route) + // case 'boolean': + // return config ? route.params : undefined + // default: + // { + // warn( + // false, + // "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " + + // "expecting an object, function or boolean." + // ); + // } + // } + // } + + /* */ + + function resolvePath ( + relative, + base, + append + ) { + var firstChar = relative.charAt(0); + if (firstChar === '/') { + return relative + } + + if (firstChar === '?' || firstChar === '#') { + return base + relative + } + + var stack = base.split('/'); + + // remove trailing segment if: + // - not appending + // - appending to trailing slash (last segment is empty) + if (!append || !stack[stack.length - 1]) { + stack.pop(); + } + + // resolve relative path + var segments = relative.replace(/^\//, '').split('/'); + for (var i = 0; i < segments.length; i++) { + var segment = segments[i]; + if (segment === '..') { + stack.pop(); + } else if (segment !== '.') { + stack.push(segment); + } + } + + // ensure leading slash + if (stack[0] !== '') { + stack.unshift(''); + } + + return stack.join('/') + } + + function parsePath (path) { + var hash = ''; + var query = ''; + + var hashIndex = path.indexOf('#'); + if (hashIndex >= 0) { + hash = path.slice(hashIndex); + path = path.slice(0, hashIndex); + } + + var queryIndex = path.indexOf('?'); + if (queryIndex >= 0) { + query = path.slice(queryIndex + 1); + path = path.slice(0, queryIndex); + } + + return { + path: path, + query: query, + hash: hash + } + } + + function cleanPath (path) { + return path.replace(/\/\//g, '/') + } + + var isarray = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; + }; + + /** + * Expose `pathToRegexp`. + */ + var pathToRegexp_1 = pathToRegexp; + var parse_1 = parse; + var compile_1 = compile; + var tokensToFunction_1 = tokensToFunction; + var tokensToRegExp_1 = tokensToRegExp; + + /** + * The main path matching regexp utility. + * + * @type {RegExp} + */ + var PATH_REGEXP = new RegExp([ + // Match escaped characters that would otherwise appear in future matches. + // This allows the user to escape special characters that won't transform. + '(\\\\.)', + // Match Express-style parameters and un-named parameters with a prefix + // and optional suffixes. Matches appear as: + // + // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined] + // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined] + // "/*" => ["/", undefined, undefined, undefined, undefined, "*"] + '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))' + ].join('|'), 'g'); + + /** + * Parse a string for the raw tokens. + * + * @param {string} str + * @param {Object=} options + * @return {!Array} + */ + function parse (str, options) { + var tokens = []; + var key = 0; + var index = 0; + var path = ''; + var defaultDelimiter = options && options.delimiter || '/'; + var res; + + while ((res = PATH_REGEXP.exec(str)) != null) { + var m = res[0]; + var escaped = res[1]; + var offset = res.index; + path += str.slice(index, offset); + index = offset + m.length; + + // Ignore already escaped sequences. + if (escaped) { + path += escaped[1]; + continue + } + + var next = str[index]; + var prefix = res[2]; + var name = res[3]; + var capture = res[4]; + var group = res[5]; + var modifier = res[6]; + var asterisk = res[7]; + + // Push the current path onto the tokens. + if (path) { + tokens.push(path); + path = ''; + } + + var partial = prefix != null && next != null && next !== prefix; + var repeat = modifier === '+' || modifier === '*'; + var optional = modifier === '?' || modifier === '*'; + var delimiter = res[2] || defaultDelimiter; + var pattern = capture || group; + + tokens.push({ + name: name || key++, + prefix: prefix || '', + delimiter: delimiter, + optional: optional, + repeat: repeat, + partial: partial, + asterisk: !!asterisk, + pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?') + }); + } + + // Match any characters still remaining. + if (index < str.length) { + path += str.substr(index); + } + + // If the path exists, push it onto the end. + if (path) { + tokens.push(path); + } + + return tokens + } + + /** + * Compile a string to a template function for the path. + * + * @param {string} str + * @param {Object=} options + * @return {!function(Object=, Object=)} + */ + function compile (str, options) { + return tokensToFunction(parse(str, options), options) + } + + /** + * Prettier encoding of URI path segments. + * + * @param {string} + * @return {string} + */ + function encodeURIComponentPretty (str) { + return encodeURI(str).replace(/[\/?#]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) + } + + /** + * Encode the asterisk parameter. Similar to `pretty`, but allows slashes. + * + * @param {string} + * @return {string} + */ + function encodeAsterisk (str) { + return encodeURI(str).replace(/[?#]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) + } + + /** + * Expose a method for transforming tokens into the path function. + */ + function tokensToFunction (tokens, options) { + // Compile all the tokens into regexps. + var matches = new Array(tokens.length); + + // Compile all the patterns before compilation. + for (var i = 0; i < tokens.length; i++) { + if (typeof tokens[i] === 'object') { + matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options)); + } + } + + return function (obj, opts) { + var path = ''; + var data = obj || {}; + var options = opts || {}; + var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent; + + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + + if (typeof token === 'string') { + path += token; + + continue + } + + var value = data[token.name]; + var segment; + + if (value == null) { + if (token.optional) { + // Prepend partial segment prefixes. + if (token.partial) { + path += token.prefix; + } + + continue + } else { + throw new TypeError('Expected "' + token.name + '" to be defined') + } + } + + if (isarray(value)) { + if (!token.repeat) { + throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`') + } + + if (value.length === 0) { + if (token.optional) { + continue + } else { + throw new TypeError('Expected "' + token.name + '" to not be empty') + } + } + + for (var j = 0; j < value.length; j++) { + segment = encode(value[j]); + + if (!matches[i].test(segment)) { + throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`') + } + + path += (j === 0 ? token.prefix : token.delimiter) + segment; + } + + continue + } + + segment = token.asterisk ? encodeAsterisk(value) : encode(value); + + if (!matches[i].test(segment)) { + throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"') + } + + path += token.prefix + segment; + } + + return path + } + } + + /** + * Escape a regular expression string. + * + * @param {string} str + * @return {string} + */ + function escapeString (str) { + return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1') + } + + /** + * Escape the capturing group by escaping special characters and meaning. + * + * @param {string} group + * @return {string} + */ + function escapeGroup (group) { + return group.replace(/([=!:$\/()])/g, '\\$1') + } + + /** + * Attach the keys as a property of the regexp. + * + * @param {!RegExp} re + * @param {Array} keys + * @return {!RegExp} + */ + function attachKeys (re, keys) { + re.keys = keys; + return re + } + + /** + * Get the flags for a regexp from the options. + * + * @param {Object} options + * @return {string} + */ + function flags (options) { + return options && options.sensitive ? '' : 'i' + } + + /** + * Pull out keys from a regexp. + * + * @param {!RegExp} path + * @param {!Array} keys + * @return {!RegExp} + */ + function regexpToRegexp (path, keys) { + // Use a negative lookahead to match only capturing groups. + var groups = path.source.match(/\((?!\?)/g); + + if (groups) { + for (var i = 0; i < groups.length; i++) { + keys.push({ + name: i, + prefix: null, + delimiter: null, + optional: false, + repeat: false, + partial: false, + asterisk: false, + pattern: null + }); + } + } + + return attachKeys(path, keys) + } + + /** + * Transform an array into a regexp. + * + * @param {!Array} path + * @param {Array} keys + * @param {!Object} options + * @return {!RegExp} + */ + function arrayToRegexp (path, keys, options) { + var parts = []; + + for (var i = 0; i < path.length; i++) { + parts.push(pathToRegexp(path[i], keys, options).source); + } + + var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options)); + + return attachKeys(regexp, keys) + } + + /** + * Create a path regexp from string input. + * + * @param {string} path + * @param {!Array} keys + * @param {!Object} options + * @return {!RegExp} + */ + function stringToRegexp (path, keys, options) { + return tokensToRegExp(parse(path, options), keys, options) + } + + /** + * Expose a function for taking tokens and returning a RegExp. + * + * @param {!Array} tokens + * @param {(Array|Object)=} keys + * @param {Object=} options + * @return {!RegExp} + */ + function tokensToRegExp (tokens, keys, options) { + if (!isarray(keys)) { + options = /** @type {!Object} */ (keys || options); + keys = []; + } + + options = options || {}; + + var strict = options.strict; + var end = options.end !== false; + var route = ''; + + // Iterate over the tokens and create our regexp string. + for (var i = 0; i < tokens.length; i++) { + var token = tokens[i]; + + if (typeof token === 'string') { + route += escapeString(token); + } else { + var prefix = escapeString(token.prefix); + var capture = '(?:' + token.pattern + ')'; + + keys.push(token); + + if (token.repeat) { + capture += '(?:' + prefix + capture + ')*'; + } + + if (token.optional) { + if (!token.partial) { + capture = '(?:' + prefix + '(' + capture + '))?'; + } else { + capture = prefix + '(' + capture + ')?'; + } + } else { + capture = prefix + '(' + capture + ')'; + } + + route += capture; + } + } + + var delimiter = escapeString(options.delimiter || '/'); + var endsWithDelimiter = route.slice(-delimiter.length) === delimiter; + + // In non-strict mode we allow a slash at the end of match. If the path to + // match already ends with a slash, we remove it for consistency. The slash + // is valid at the end of a path match, not in the middle. This is important + // in non-ending mode, where "/test/" shouldn't match "/test//route". + if (!strict) { + route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?'; + } + + if (end) { + route += '$'; + } else { + // In non-ending mode, we need the capturing groups to match as much as + // possible by using a positive lookahead to the end or next path segment. + route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)'; + } + + return attachKeys(new RegExp('^' + route, flags(options)), keys) + } + + /** + * Normalize the given path string, returning a regular expression. + * + * An empty array can be passed in for the keys, which will hold the + * placeholder key descriptions. For example, using `/user/:id`, `keys` will + * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`. + * + * @param {(string|RegExp|Array)} path + * @param {(Array|Object)=} keys + * @param {Object=} options + * @return {!RegExp} + */ + function pathToRegexp (path, keys, options) { + if (!isarray(keys)) { + options = /** @type {!Object} */ (keys || options); + keys = []; + } + + options = options || {}; + + if (path instanceof RegExp) { + return regexpToRegexp(path, /** @type {!Array} */ (keys)) + } + + if (isarray(path)) { + return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options) + } + + return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options) + } + pathToRegexp_1.parse = parse_1; + pathToRegexp_1.compile = compile_1; + pathToRegexp_1.tokensToFunction = tokensToFunction_1; + pathToRegexp_1.tokensToRegExp = tokensToRegExp_1; + + /* */ + + // $flow-disable-line + var regexpCompileCache = Object.create(null); + + function fillParams ( + path, + params, + routeMsg + ) { + params = params || {}; + try { + var filler = + regexpCompileCache[path] || + (regexpCompileCache[path] = pathToRegexp_1.compile(path)); + + // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }} + // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string + if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; } + + return filler(params, { pretty: true }) + } catch (e) { + { + // Fix #3072 no warn if `pathMatch` is string + warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message))); + } + return '' + } finally { + // delete the 0 if it was added + delete params[0]; + } + } + + /* */ + + function normalizeLocation ( + raw, + current, + append, + router + ) { + var next = typeof raw === 'string' ? { path: raw } : raw; + // named target + if (next._normalized) { + return next + } else if (next.name) { + next = extend({}, raw); + var params = next.params; + if (params && typeof params === 'object') { + next.params = extend({}, params); + } + return next + } + + // relative params + if (!next.path && next.params && current) { + next = extend({}, next); + next._normalized = true; + var params$1 = extend(extend({}, current.params), next.params); + if (current.name) { + next.name = current.name; + next.params = params$1; + } else if (current.matched.length) { + var rawPath = current.matched[current.matched.length - 1].path; + next.path = fillParams(rawPath, params$1, ("path " + (current.path))); + } else { + warn(false, "relative params navigation requires a current route."); + } + return next + } + + var parsedPath = parsePath(next.path || ''); + var basePath = (current && current.path) || '/'; + var path = parsedPath.path + ? resolvePath(parsedPath.path, basePath, append || next.append) + : basePath; + + var query = resolveQuery( + parsedPath.query, + next.query, + router && router.options.parseQuery + ); + + var hash = next.hash || parsedPath.hash; + if (hash && hash.charAt(0) !== '#') { + hash = "#" + hash; + } + + return { + _normalized: true, + path: path, + query: query, + hash: hash + } + } + + // var toTypes = [String, Object]; + // var eventTypes = [String, Array]; + + // var noop = function () {}; + + // var warnedCustomSlot; + // var warnedTagProp; + // var warnedEventProp; + + // var Link = { + // name: 'RouterLink', + // props: { + // to: { + // type: toTypes, + // required: true + // }, + // tag: { + // type: String, + // default: 'a' + // }, + // custom: Boolean, + // exact: Boolean, + // exactPath: Boolean, + // append: Boolean, + // replace: Boolean, + // activeClass: String, + // exactActiveClass: String, + // ariaCurrentValue: { + // type: String, + // default: 'page' + // }, + // event: { + // type: eventTypes, + // default: 'click' + // } + // }, + // render: function render (h) { + // var this$1 = this; + + // var router = this.$router; + // var current = this.$route; + // var ref = router.resolve( + // this.to, + // current, + // this.append + // ); + // var location = ref.location; + // var route = ref.route; + // var href = ref.href; + + // var classes = {}; + // var globalActiveClass = router.options.linkActiveClass; + // var globalExactActiveClass = router.options.linkExactActiveClass; + // // Support global empty active class + // var activeClassFallback = + // globalActiveClass == null ? 'router-link-active' : globalActiveClass; + // var exactActiveClassFallback = + // globalExactActiveClass == null + // ? 'router-link-exact-active' + // : globalExactActiveClass; + // var activeClass = + // this.activeClass == null ? activeClassFallback : this.activeClass; + // var exactActiveClass = + // this.exactActiveClass == null + // ? exactActiveClassFallback + // : this.exactActiveClass; + + // var compareTarget = route.redirectedFrom + // ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router) + // : route; + + // classes[exactActiveClass] = isSameRoute(current, compareTarget, this.exactPath); + // classes[activeClass] = this.exact || this.exactPath + // ? classes[exactActiveClass] + // : isIncludedRoute(current, compareTarget); + + // var ariaCurrentValue = classes[exactActiveClass] ? this.ariaCurrentValue : null; + + // var handler = function (e) { + // if (guardEvent(e)) { + // if (this$1.replace) { + // router.replace(location, noop); + // } else { + // router.push(location, noop); + // } + // } + // }; + + // var on = { click: guardEvent }; + // if (Array.isArray(this.event)) { + // this.event.forEach(function (e) { + // on[e] = handler; + // }); + // } else { + // on[this.event] = handler; + // } + + // var data = { class: classes }; + + // var scopedSlot = + // !this.$scopedSlots.$hasNormal && + // this.$scopedSlots.default && + // this.$scopedSlots.default({ + // href: href, + // route: route, + // navigate: handler, + // isActive: classes[activeClass], + // isExactActive: classes[exactActiveClass] + // }); + + // if (scopedSlot) { + // if (!this.custom) { + // !warnedCustomSlot && warn(false, 'In Vue Router 4, the v-slot API will by default wrap its content with an element. Use the custom prop to remove this warning:\n\n'); + // warnedCustomSlot = true; + // } + // if (scopedSlot.length === 1) { + // return scopedSlot[0] + // } else if (scopedSlot.length > 1 || !scopedSlot.length) { + // { + // warn( + // false, + // (" with to=\"" + (this.to) + "\" is trying to use a scoped slot but it didn't provide exactly one child. Wrapping the content with a span element.") + // ); + // } + // return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot) + // } + // } + + // { + // if ('tag' in this.$options.propsData && !warnedTagProp) { + // warn( + // false, + // "'s tag prop is deprecated and has been removed in Vue Router 4. Use the v-slot API to remove this warning: https://next.router.vuejs.org/guide/migration/#removal-of-event-and-tag-props-in-router-link." + // ); + // warnedTagProp = true; + // } + // if ('event' in this.$options.propsData && !warnedEventProp) { + // warn( + // false, + // "'s event prop is deprecated and has been removed in Vue Router 4. Use the v-slot API to remove this warning: https://next.router.vuejs.org/guide/migration/#removal-of-event-and-tag-props-in-router-link." + // ); + // warnedEventProp = true; + // } + // } + + // if (this.tag === 'a') { + // data.on = on; + // data.attrs = { href: href, 'aria-current': ariaCurrentValue }; + // } else { + // // find the first child and apply listener and href + // var a = findAnchor(this.$slots.default); + // if (a) { + // // in case the is a static node + // a.isStatic = false; + // var aData = (a.data = extend({}, a.data)); + // aData.on = aData.on || {}; + // // transform existing events in both objects into arrays so we can push later + // for (var event in aData.on) { + // var handler$1 = aData.on[event]; + // if (event in on) { + // aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1]; + // } + // } + // // append new listeners for router-link + // for (var event$1 in on) { + // if (event$1 in aData.on) { + // // on[event] is always a function + // aData.on[event$1].push(on[event$1]); + // } else { + // aData.on[event$1] = handler; + // } + // } + + // var aAttrs = (a.data.attrs = extend({}, a.data.attrs)); + // aAttrs.href = href; + // aAttrs['aria-current'] = ariaCurrentValue; + // } else { + // // doesn't have child, apply listener to self + // data.on = on; + // } + // } + + // return h(this.tag, data, this.$slots.default) + // } + // }; + + function guardEvent (e) { + // don't redirect with control keys + if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return } + // don't redirect when preventDefault called + if (e.defaultPrevented) { return } + // don't redirect on right click + if (e.button !== undefined && e.button !== 0) { return } + // don't redirect if `target="_blank"` + if (e.currentTarget && e.currentTarget.getAttribute) { + var target = e.currentTarget.getAttribute('target'); + if (/\b_blank\b/i.test(target)) { return } + } + // this may be a Weex event which doesn't have this method + if (e.preventDefault) { + e.preventDefault(); + } + return true + } + + function findAnchor (children) { + if (children) { + var child; + for (var i = 0; i < children.length; i++) { + child = children[i]; + if (child.tag === 'a') { + return child + } + if (child.children && (child = findAnchor(child.children))) { + return child + } + } + } + } + + // var _Vue; + + // function install (Vue) { + // if (install.installed && _Vue === Vue) { return } + // install.installed = true; + + // _Vue = Vue; + + // var isDef = function (v) { return v !== undefined; }; + + // var registerInstance = function (vm, callVal) { + // var i = vm.$options._parentVnode; + // if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) { + // i(vm, callVal); + // } + // }; + + // Vue.mixin({ + // beforeCreate: function beforeCreate () { + // if (isDef(this.$options.router)) { + // this._routerRoot = this; + // this._router = this.$options.router; + // this._router.init(this); + // Vue.util.defineReactive(this, '_route', this._router.history.current); + // } else { + // this._routerRoot = (this.$parent && this.$parent._routerRoot) || this; + // } + // registerInstance(this, this); + // }, + // destroyed: function destroyed () { + // registerInstance(this); + // } + // }); + + // Object.defineProperty(Vue.prototype, '$router', { + // get: function get () { return this._routerRoot._router } + // }); + + // Object.defineProperty(Vue.prototype, '$route', { + // get: function get () { return this._routerRoot._route } + // }); + + // Vue.component('RouterView', View); + // Vue.component('RouterLink', Link); + + // var strats = Vue.config.optionMergeStrategies; + // // use the same hook merging strategy for route hooks + // strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created; + // } + + /* */ + + var inBrowser = typeof window !== 'undefined'; + + /* */ + + function createRouteMap ( + routes, + oldPathList, + oldPathMap, + oldNameMap, + parentRoute + ) { + // the path list is used to control path matching priority + var pathList = oldPathList || []; + // $flow-disable-line + var pathMap = oldPathMap || Object.create(null); + // $flow-disable-line + var nameMap = oldNameMap || Object.create(null); + + routes.forEach(function (route) { + addRouteRecord(pathList, pathMap, nameMap, route, parentRoute); + }); + + // ensure wildcard routes are always at the end + for (var i = 0, l = pathList.length; i < l; i++) { + if (pathList[i] === '*') { + pathList.push(pathList.splice(i, 1)[0]); + l--; + i--; + } + } + + { + // warn if routes do not include leading slashes + var found = pathList + // check for missing leading slash + .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; }); + + if (found.length > 0) { + var pathNames = found.map(function (path) { return ("- " + path); }).join('\n'); + warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames)); + } + } + + return { + pathList: pathList, + pathMap: pathMap, + nameMap: nameMap + } + } + + function addRouteRecord ( + pathList, + pathMap, + nameMap, + route, + parent, + matchAs + ) { + var path = route.path; + var name = route.name; + { + assert(path != null, "\"path\" is required in a route configuration."); + assert( + typeof route.component !== 'string', + "route config \"component\" for path: " + (String( + path || name + )) + " cannot be a " + "string id. Use an actual component instead." + ); + + warn( + // eslint-disable-next-line no-control-regex + !/[^\u0000-\u007F]+/.test(path), + "Route with path \"" + path + "\" contains unencoded characters, make sure " + + "your path is correctly encoded before passing it to the router. Use " + + "encodeURI to encode static segments of your path." + ); + } + + var pathToRegexpOptions = + route.pathToRegexpOptions || {}; + var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict); + + if (typeof route.caseSensitive === 'boolean') { + pathToRegexpOptions.sensitive = route.caseSensitive; + } + + var record = { + path: normalizedPath, + regex: compileRouteRegex(normalizedPath, pathToRegexpOptions), + components: route.components || { default: route.component }, + alias: route.alias + ? typeof route.alias === 'string' + ? [route.alias] + : route.alias + : [], + instances: {}, + enteredCbs: {}, + name: name, + parent: parent, + matchAs: matchAs, + redirect: route.redirect, + beforeEnter: route.beforeEnter, + meta: route.meta || {}, + props: + route.props == null + ? {} + : route.components + ? route.props + : { default: route.props } + }; + + if (route.children) { + // Warn if route is named, does not redirect and has a default child route. + // If users navigate to this route by name, the default child will + // not be rendered (GH Issue #629) + { + if ( + route.name && + !route.redirect && + route.children.some(function (child) { return /^\/?$/.test(child.path); }) + ) { + warn( + false, + "Named Route '" + (route.name) + "' has a default child route. " + + "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " + + "the default child route will not be rendered. Remove the name from " + + "this route and use the name of the default child route for named " + + "links instead." + ); + } + } + route.children.forEach(function (child) { + var childMatchAs = matchAs + ? cleanPath((matchAs + "/" + (child.path))) + : undefined; + addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs); + }); + } + + if (!pathMap[record.path]) { + pathList.push(record.path); + pathMap[record.path] = record; + } + + if (route.alias !== undefined) { + var aliases = Array.isArray(route.alias) ? route.alias : [route.alias]; + for (var i = 0; i < aliases.length; ++i) { + var alias = aliases[i]; + if (alias === path) { + warn( + false, + ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.") + ); + // skip in dev to make it work + continue + } + + var aliasRoute = { + path: alias, + children: route.children + }; + addRouteRecord( + pathList, + pathMap, + nameMap, + aliasRoute, + parent, + record.path || '/' // matchAs + ); + } + } + + if (name) { + if (!nameMap[name]) { + nameMap[name] = record; + } else if (!matchAs) { + warn( + false, + "Duplicate named routes definition: " + + "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }" + ); + } + } + } + + function compileRouteRegex ( + path, + pathToRegexpOptions + ) { + var regex = pathToRegexp_1(path, [], pathToRegexpOptions); + { + var keys = Object.create(null); + regex.keys.forEach(function (key) { + warn( + !keys[key.name], + ("Duplicate param keys in route with path: \"" + path + "\"") + ); + keys[key.name] = true; + }); + } + return regex + } + + function normalizePath ( + path, + parent, + strict + ) { + if (!strict) { path = path.replace(/\/$/, ''); } + if (path[0] === '/') { return path } + if (parent == null) { return path } + return cleanPath(((parent.path) + "/" + path)) + } + + /* */ + + + + function createMatcher ( + routes, + router + ) { + var ref = createRouteMap(routes); + var pathList = ref.pathList; + var pathMap = ref.pathMap; + var nameMap = ref.nameMap; + + function addRoutes (routes) { + createRouteMap(routes, pathList, pathMap, nameMap); + } + + function addRoute (parentOrRoute, route) { + var parent = (typeof parentOrRoute !== 'object') ? nameMap[parentOrRoute] : undefined; + // $flow-disable-line + createRouteMap([route || parentOrRoute], pathList, pathMap, nameMap, parent); + + // add aliases of parent + if (parent && parent.alias.length) { + createRouteMap( + // $flow-disable-line route is defined if parent is + parent.alias.map(function (alias) { return ({ path: alias, children: [route] }); }), + pathList, + pathMap, + nameMap, + parent + ); + } + } + + function getRoutes () { + return pathList.map(function (path) { return pathMap[path]; }) + } + + function match ( + raw, + currentRoute, + redirectedFrom + ) { + var location = normalizeLocation(raw, currentRoute, false, router); + var name = location.name; + + if (name) { + var record = nameMap[name]; + { + warn(record, ("Route with name '" + name + "' does not exist")); + } + if (!record) { return _createRoute(null, location) } + var paramNames = record.regex.keys + .filter(function (key) { return !key.optional; }) + .map(function (key) { return key.name; }); + + if (typeof location.params !== 'object') { + location.params = {}; + } + + if (currentRoute && typeof currentRoute.params === 'object') { + for (var key in currentRoute.params) { + if (!(key in location.params) && paramNames.indexOf(key) > -1) { + location.params[key] = currentRoute.params[key]; + } + } + } + + location.path = fillParams(record.path, location.params, ("named route \"" + name + "\"")); + return _createRoute(record, location, redirectedFrom) + } else if (location.path) { + location.params = {}; + for (var i = 0; i < pathList.length; i++) { + var path = pathList[i]; + var record$1 = pathMap[path]; + if (matchRoute(record$1.regex, location.path, location.params)) { + return _createRoute(record$1, location, redirectedFrom) + } + } + } + // no match + return _createRoute(null, location) + } + + function redirect ( + record, + location + ) { + var originalRedirect = record.redirect; + var redirect = typeof originalRedirect === 'function' + ? originalRedirect(createRoute(record, location, null, router)) + : originalRedirect; + + if (typeof redirect === 'string') { + redirect = { path: redirect }; + } + + if (!redirect || typeof redirect !== 'object') { + { + warn( + false, ("invalid redirect option: " + (JSON.stringify(redirect))) + ); + } + return _createRoute(null, location) + } + + var re = redirect; + var name = re.name; + var path = re.path; + var query = location.query; + var hash = location.hash; + var params = location.params; + query = re.hasOwnProperty('query') ? re.query : query; + hash = re.hasOwnProperty('hash') ? re.hash : hash; + params = re.hasOwnProperty('params') ? re.params : params; + + if (name) { + // resolved named direct + var targetRecord = nameMap[name]; + { + assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found.")); + } + return match({ + _normalized: true, + name: name, + query: query, + hash: hash, + params: params + }, undefined, location) + } else if (path) { + // 1. resolve relative redirect + var rawPath = resolveRecordPath(path, record); + // 2. resolve params + var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\"")); + // 3. rematch with existing query and hash + return match({ + _normalized: true, + path: resolvedPath, + query: query, + hash: hash + }, undefined, location) + } else { + { + warn(false, ("invalid redirect option: " + (JSON.stringify(redirect)))); + } + return _createRoute(null, location) + } + } + + function alias ( + record, + location, + matchAs + ) { + var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\"")); + var aliasedMatch = match({ + _normalized: true, + path: aliasedPath + }); + if (aliasedMatch) { + var matched = aliasedMatch.matched; + var aliasedRecord = matched[matched.length - 1]; + location.params = aliasedMatch.params; + return _createRoute(aliasedRecord, location) + } + return _createRoute(null, location) + } + + function _createRoute ( + record, + location, + redirectedFrom + ) { + if (record && record.redirect) { + return redirect(record, redirectedFrom || location) + } + if (record && record.matchAs) { + return alias(record, location, record.matchAs) + } + return createRoute(record, location, redirectedFrom, router) + } + + return { + match: match, + addRoute: addRoute, + getRoutes: getRoutes, + addRoutes: addRoutes + } + } + + function matchRoute ( + regex, + path, + params + ) { + var m = path.match(regex); + + if (!m) { + return false + } else if (!params) { + return true + } + + for (var i = 1, len = m.length; i < len; ++i) { + var key = regex.keys[i - 1]; + if (key) { + // Fix #1994: using * with props: true generates a param named 0 + params[key.name || 'pathMatch'] = typeof m[i] === 'string' ? decode(m[i]) : m[i]; + } + } + + return true + } + + function resolveRecordPath (path, record) { + return resolvePath(path, record.parent ? record.parent.path : '/', true) + } + + /* */ + + // use User Timing api (if present) for more accurate key precision + var Time = + inBrowser && window.performance && window.performance.now + ? window.performance + : Date; + + function genStateKey () { + return Time.now().toFixed(3) + } + + var _key = genStateKey(); + + function getStateKey () { + return _key + } + + function setStateKey (key) { + return (_key = key) + } + + /* */ + + var positionStore = Object.create(null); + + function setupScroll () { + // Prevent browser scroll behavior on History popstate + if ('scrollRestoration' in window.history) { + window.history.scrollRestoration = 'manual'; + } + // Fix for #1585 for Firefox + // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678 + // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with + // window.location.protocol + '//' + window.location.host + // location.host contains the port and location.hostname doesn't + var protocolAndPath = window.location.protocol + '//' + window.location.host; + var absolutePath = window.location.href.replace(protocolAndPath, ''); + // preserve existing history state as it could be overriden by the user + var stateCopy = extend({}, window.history.state); + stateCopy.key = getStateKey(); + window.history.replaceState(stateCopy, '', absolutePath); + window.addEventListener('popstate', handlePopState); + return function () { + window.removeEventListener('popstate', handlePopState); + } + } + + function handleScroll ( + router, + to, + from, + isPop + ) { + if (!router.app) { + return + } + + var behavior = router.options.scrollBehavior; + if (!behavior) { + return + } + + { + assert(typeof behavior === 'function', "scrollBehavior must be a function"); + } + + // wait until re-render finishes before scrolling + BI.nextTick(function () { + var position = getScrollPosition(); + var shouldScroll = behavior.call( + router, + to, + from, + isPop ? position : null + ); + + if (!shouldScroll) { + return + } + + if (typeof shouldScroll.then === 'function') { + shouldScroll + .then(function (shouldScroll) { + scrollToPosition((shouldScroll), position); + }) + .catch(function (err) { + { + assert(false, err.toString()); + } + }); + } else { + scrollToPosition(shouldScroll, position); + } + }); + } + + function saveScrollPosition () { + var key = getStateKey(); + if (key) { + positionStore[key] = { + x: window.pageXOffset, + y: window.pageYOffset + }; + } + } + + function handlePopState (e) { + saveScrollPosition(); + if (e.state && e.state.key) { + setStateKey(e.state.key); + } + } + + function getScrollPosition () { + var key = getStateKey(); + if (key) { + return positionStore[key] + } + } + + function getElementPosition (el, offset) { + var docEl = document.documentElement; + var docRect = docEl.getBoundingClientRect(); + var elRect = el.getBoundingClientRect(); + return { + x: elRect.left - docRect.left - offset.x, + y: elRect.top - docRect.top - offset.y + } + } + + function isValidPosition (obj) { + return isNumber(obj.x) || isNumber(obj.y) + } + + function normalizePosition (obj) { + return { + x: isNumber(obj.x) ? obj.x : window.pageXOffset, + y: isNumber(obj.y) ? obj.y : window.pageYOffset + } + } + + function normalizeOffset (obj) { + return { + x: isNumber(obj.x) ? obj.x : 0, + y: isNumber(obj.y) ? obj.y : 0 + } + } + + function isNumber (v) { + return typeof v === 'number' + } + + var hashStartsWithNumberRE = /^#\d/; + + function scrollToPosition (shouldScroll, position) { + var isObject = typeof shouldScroll === 'object'; + if (isObject && typeof shouldScroll.selector === 'string') { + // getElementById would still fail if the selector contains a more complicated query like #main[data-attr] + // but at the same time, it doesn't make much sense to select an element with an id and an extra selector + var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line + ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line + : document.querySelector(shouldScroll.selector); + + if (el) { + var offset = + shouldScroll.offset && typeof shouldScroll.offset === 'object' + ? shouldScroll.offset + : {}; + offset = normalizeOffset(offset); + position = getElementPosition(el, offset); + } else if (isValidPosition(shouldScroll)) { + position = normalizePosition(shouldScroll); + } + } else if (isObject && isValidPosition(shouldScroll)) { + position = normalizePosition(shouldScroll); + } + + if (position) { + // $flow-disable-line + if ('scrollBehavior' in document.documentElement.style) { + window.scrollTo({ + left: position.x, + top: position.y, + // $flow-disable-line + behavior: shouldScroll.behavior + }); + } else { + window.scrollTo(position.x, position.y); + } + } + } + + /* */ + + var supportsPushState = + inBrowser && + (function () { + var ua = window.navigator.userAgent; + + if ( + (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && + ua.indexOf('Mobile Safari') !== -1 && + ua.indexOf('Chrome') === -1 && + ua.indexOf('Windows Phone') === -1 + ) { + return false + } + + return window.history && typeof window.history.pushState === 'function' + })(); + + function pushState (url, replace) { + saveScrollPosition(); + // try...catch the pushState call to get around Safari + // DOM Exception 18 where it limits to 100 pushState calls + var history = window.history; + try { + if (replace) { + // preserve existing history state as it could be overriden by the user + var stateCopy = extend({}, history.state); + stateCopy.key = getStateKey(); + history.replaceState(stateCopy, '', url); + } else { + history.pushState({ key: setStateKey(genStateKey()) }, '', url); + } + } catch (e) { + window.location[replace ? 'replace' : 'assign'](url); + } + } + + function replaceState (url) { + pushState(url, true); + } + + /* */ + + function runQueue (queue, fn, cb) { + var step = function (index) { + if (index >= queue.length) { + cb(); + } else { + if (queue[index]) { + fn(queue[index], function () { + step(index + 1); + }); + } else { + step(index + 1); + } + } + }; + step(0); + } + + // When changing thing, also edit router.d.ts + var NavigationFailureType = { + redirected: 2, + aborted: 4, + cancelled: 8, + duplicated: 16 + }; + + function createNavigationRedirectedError (from, to) { + return createRouterError( + from, + to, + NavigationFailureType.redirected, + ("Redirected when going from \"" + (from.fullPath) + "\" to \"" + (stringifyRoute( + to + )) + "\" via a navigation guard.") + ) + } + + function createNavigationDuplicatedError (from, to) { + var error = createRouterError( + from, + to, + NavigationFailureType.duplicated, + ("Avoided redundant navigation to current location: \"" + (from.fullPath) + "\".") + ); + // backwards compatible with the first introduction of Errors + error.name = 'NavigationDuplicated'; + return error + } + + function createNavigationCancelledError (from, to) { + return createRouterError( + from, + to, + NavigationFailureType.cancelled, + ("Navigation cancelled from \"" + (from.fullPath) + "\" to \"" + (to.fullPath) + "\" with a new navigation.") + ) + } + + function createNavigationAbortedError (from, to) { + return createRouterError( + from, + to, + NavigationFailureType.aborted, + ("Navigation aborted from \"" + (from.fullPath) + "\" to \"" + (to.fullPath) + "\" via a navigation guard.") + ) + } + + function createRouterError (from, to, type, message) { + var error = new Error(message); + error._isRouter = true; + error.from = from; + error.to = to; + error.type = type; + + return error + } + + var propertiesToLog = ['params', 'query', 'hash']; + + function stringifyRoute (to) { + if (typeof to === 'string') { return to } + if ('path' in to) { return to.path } + var location = {}; + propertiesToLog.forEach(function (key) { + if (key in to) { location[key] = to[key]; } + }); + return JSON.stringify(location, null, 2) + } + + function isError (err) { + return Object.prototype.toString.call(err).indexOf('Error') > -1 + } + + function isNavigationFailure (err, errorType) { + return ( + isError(err) && + err._isRouter && + (errorType == null || err.type === errorType) + ) + } + + /* */ + + function resolveAsyncComponents (matched) { + return function (to, from, next) { + var hasAsync = false; + var pending = 0; + var error = null; + + flatMapComponents(matched, function (def, _, match, key) { + // if it's a function and doesn't have cid attached, + // assume it's an async component resolve function. + // we are not using Vue's default async resolving mechanism because + // we want to halt the navigation until the incoming component has been + // resolved. + if (typeof def === 'function' && def.cid === undefined) { + hasAsync = true; + pending++; + + var resolve = once(function (resolvedDef) { + if (isESModule(resolvedDef)) { + resolvedDef = resolvedDef.default; + } + // save resolved on async factory in case it's used elsewhere + def.resolved = resolvedDef; + match.components[key] = resolvedDef; + pending--; + if (pending <= 0) { + next(); + } + }); + + var reject = once(function (reason) { + var msg = "Failed to resolve async component " + key + ": " + reason; + warn(false, msg); + if (!error) { + error = isError(reason) + ? reason + : new Error(msg); + next(error); + } + }); + + var res; + try { + res = def(resolve, reject); + } catch (e) { + reject(e); + } + if (res) { + if (typeof res.then === 'function') { + res.then(resolve, reject); + } else { + // new syntax in Vue 2.3 + var comp = res.component; + if (comp && typeof comp.then === 'function') { + comp.then(resolve, reject); + } + } + } + } + }); + + if (!hasAsync) { next(); } + } + } + + function flatMapComponents ( + matched, + fn + ) { + return flatten(matched.map(function (m) { + return Object.keys(m.components).map(function (key) { return fn( + m.components[key], + m.instances[key], + m, key + ); }) + })) + } + + function flatten (arr) { + return Array.prototype.concat.apply([], arr) + } + + var hasSymbol = + typeof Symbol === 'function' && + typeof Symbol.toStringTag === 'symbol'; + + function isESModule (obj) { + return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module') + } + + // in Webpack 2, require.ensure now also returns a Promise + // so the resolve/reject functions may get called an extra time + // if the user uses an arrow function shorthand that happens to + // return that Promise. + function once (fn) { + var called = false; + return function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + if (called) { return } + called = true; + return fn.apply(this, args) + } + } + + /* */ + + var History = function History (router, base) { + this.router = router; + this.base = normalizeBase(base); + // start with a route object that stands for "nowhere" + this.current = START; + this.pending = null; + this.ready = false; + this.readyCbs = []; + this.readyErrorCbs = []; + this.errorCbs = []; + this.listeners = []; + }; + + History.prototype.listen = function listen (cb) { + this.cb = cb; + }; + + History.prototype.onReady = function onReady (cb, errorCb) { + if (this.ready) { + cb(); + } else { + this.readyCbs.push(cb); + if (errorCb) { + this.readyErrorCbs.push(errorCb); + } + } + }; + + History.prototype.onError = function onError (errorCb) { + this.errorCbs.push(errorCb); + }; + + History.prototype.transitionTo = function transitionTo ( + location, + onComplete, + onAbort + ) { + var this$1 = this; + + var route; + // catch redirect option https://github.com/vuejs/vue-router/issues/3201 + try { + route = this.router.match(location, this.current); + } catch (e) { + this.errorCbs.forEach(function (cb) { + cb(e); + }); + // Exception should still be thrown + throw e + } + var prev = this.current; + this.confirmTransition( + route, + function () { + this$1.updateRoute(route); + onComplete && onComplete(route); + this$1.ensureURL(); + this$1.router.afterHooks.forEach(function (hook) { + hook && hook(route, prev); + }); + + // fire ready cbs once + if (!this$1.ready) { + this$1.ready = true; + this$1.readyCbs.forEach(function (cb) { + cb(route); + }); + } + }, + function (err) { + if (onAbort) { + onAbort(err); + } + if (err && !this$1.ready) { + // Initial redirection should not mark the history as ready yet + // because it's triggered by the redirection instead + // https://github.com/vuejs/vue-router/issues/3225 + // https://github.com/vuejs/vue-router/issues/3331 + if (!isNavigationFailure(err, NavigationFailureType.redirected) || prev !== START) { + this$1.ready = true; + this$1.readyErrorCbs.forEach(function (cb) { + cb(err); + }); + } + } + } + ); + }; + + History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) { + var this$1 = this; + + var current = this.current; + this.pending = route; + var abort = function (err) { + // changed after adding errors with + // https://github.com/vuejs/vue-router/pull/3047 before that change, + // redirect and aborted navigation would produce an err == null + if (!isNavigationFailure(err) && isError(err)) { + if (this$1.errorCbs.length) { + this$1.errorCbs.forEach(function (cb) { + cb(err); + }); + } else { + warn(false, 'uncaught error during route navigation:'); + console.error(err); + } + } + onAbort && onAbort(err); + }; + var lastRouteIndex = route.matched.length - 1; + var lastCurrentIndex = current.matched.length - 1; + if ( + isSameRoute(route, current) && + // in the case the route map has been dynamically appended to + lastRouteIndex === lastCurrentIndex && + route.matched[lastRouteIndex] === current.matched[lastCurrentIndex] + ) { + this.ensureURL(); + return abort(createNavigationDuplicatedError(current, route)) + } + + var ref = resolveQueue( + this.current.matched, + route.matched + ); + var updated = ref.updated; + var deactivated = ref.deactivated; + var activated = ref.activated; + + var queue = [].concat( + // in-component leave guards + extractLeaveGuards(deactivated), + // global before hooks + this.router.beforeHooks, + // in-component update hooks + extractUpdateHooks(updated), + // in-config enter guards + activated.map(function (m) { return m.beforeEnter; }), + // async components + resolveAsyncComponents(activated) + ); + + var iterator = function (hook, next) { + if (this$1.pending !== route) { + return abort(createNavigationCancelledError(current, route)) + } + try { + hook(route, current, function (to) { + if (to === false) { + // next(false) -> abort navigation, ensure current URL + this$1.ensureURL(true); + abort(createNavigationAbortedError(current, route)); + } else if (isError(to)) { + this$1.ensureURL(true); + abort(to); + } else if ( + typeof to === 'string' || + (typeof to === 'object' && + (typeof to.path === 'string' || typeof to.name === 'string')) + ) { + // next('/') or next({ path: '/' }) -> redirect + abort(createNavigationRedirectedError(current, route)); + if (typeof to === 'object' && to.replace) { + this$1.replace(to); + } else { + this$1.push(to); + } + } else { + // confirm transition and pass on the value + next(to); + } + }); + } catch (e) { + abort(e); + } + }; + + runQueue(queue, iterator, function () { + // wait until async components are resolved before + // extracting in-component enter guards + var enterGuards = extractEnterGuards(activated); + var queue = enterGuards.concat(this$1.router.resolveHooks); + runQueue(queue, iterator, function () { + if (this$1.pending !== route) { + return abort(createNavigationCancelledError(current, route)) + } + this$1.pending = null; + onComplete(route); + if (this$1.router.app) { + BI.nextTick(function () { + handleRouteEntered(route); + }); + } + }); + }); + }; + + History.prototype.updateRoute = function updateRoute (route) { + this.current = route; + this.cb && this.cb(route); + }; + + History.prototype.setupListeners = function setupListeners () { + // Default implementation is empty + }; + + History.prototype.teardown = function teardown () { + // clean up event listeners + // https://github.com/vuejs/vue-router/issues/2341 + this.listeners.forEach(function (cleanupListener) { + cleanupListener(); + }); + this.listeners = []; + + // reset current history route + // https://github.com/vuejs/vue-router/issues/3294 + this.current = START; + this.pending = null; + }; + + function normalizeBase (base) { + if (!base) { + if (inBrowser) { + // respect tag + var baseEl = document.querySelector('base'); + base = (baseEl && baseEl.getAttribute('href')) || '/'; + // strip full URL origin + base = base.replace(/^https?:\/\/[^\/]+/, ''); + } else { + base = '/'; + } + } + // make sure there's the starting slash + if (base.charAt(0) !== '/') { + base = '/' + base; + } + // remove trailing slash + return base.replace(/\/$/, '') + } + + function resolveQueue ( + current, + next + ) { + var i; + var max = Math.max(current.length, next.length); + for (i = 0; i < max; i++) { + if (current[i] !== next[i]) { + break + } + } + return { + updated: next.slice(0, i), + activated: next.slice(i), + deactivated: current.slice(i) + } + } + + function extractGuards ( + records, + name, + bind, + reverse + ) { + var guards = flatMapComponents(records, function (def, instance, match, key) { + var guard = extractGuard(def, name); + if (guard) { + return Array.isArray(guard) + ? guard.map(function (guard) { return bind(guard, instance, match, key); }) + : bind(guard, instance, match, key) + } + }); + return flatten(reverse ? guards.reverse() : guards) + } + + function extractGuard ( + def, + key + ) { + if (typeof def !== 'function') { + // extend now so that global mixins are applied. + // def = _Vue.extend(def); + } + return def[key] + } + + function extractLeaveGuards (deactivated) { + return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true) + } + + function extractUpdateHooks (updated) { + return extractGuards(updated, 'beforeRouteUpdate', bindGuard) + } + + function bindGuard (guard, instance) { + if (instance) { + return function boundRouteGuard () { + return guard.apply(instance, arguments) + } + } + } + + function extractEnterGuards ( + activated + ) { + return extractGuards( + activated, + 'beforeRouteEnter', + function (guard, _, match, key) { + return bindEnterGuard(guard, match, key) + } + ) + } + + function bindEnterGuard ( + guard, + match, + key + ) { + return function routeEnterGuard (to, from, next) { + return guard(to, from, function (cb) { + if (typeof cb === 'function') { + if (!match.enteredCbs[key]) { + match.enteredCbs[key] = []; + } + match.enteredCbs[key].push(cb); + } + next(cb); + }) + } + } + + /* */ + + var HTML5History = /*@__PURE__*/(function (History) { + function HTML5History (router, base) { + History.call(this, router, base); + + this._startLocation = getLocation(this.base); + } + + if ( History ) HTML5History.__proto__ = History; + HTML5History.prototype = Object.create( History && History.prototype ); + HTML5History.prototype.constructor = HTML5History; + + HTML5History.prototype.setupListeners = function setupListeners () { + var this$1 = this; + + if (this.listeners.length > 0) { + return + } + + var router = this.router; + var expectScroll = router.options.scrollBehavior; + var supportsScroll = supportsPushState && expectScroll; + + if (supportsScroll) { + this.listeners.push(setupScroll()); + } + + var handleRoutingEvent = function () { + var current = this$1.current; + + // Avoiding first `popstate` event dispatched in some browsers but first + // history route not updated since async guard at the same time. + var location = getLocation(this$1.base); + if (this$1.current === START && location === this$1._startLocation) { + return + } + + this$1.transitionTo(location, function (route) { + if (supportsScroll) { + handleScroll(router, route, current, true); + } + }); + }; + window.addEventListener('popstate', handleRoutingEvent); + this.listeners.push(function () { + window.removeEventListener('popstate', handleRoutingEvent); + }); + }; + + HTML5History.prototype.go = function go (n) { + window.history.go(n); + }; + + HTML5History.prototype.push = function push (location, onComplete, onAbort) { + var this$1 = this; + + var ref = this; + var fromRoute = ref.current; + this.transitionTo(location, function (route) { + pushState(cleanPath(this$1.base + route.fullPath)); + handleScroll(this$1.router, route, fromRoute, false); + onComplete && onComplete(route); + }, onAbort); + }; + + HTML5History.prototype.replace = function replace (location, onComplete, onAbort) { + var this$1 = this; + + var ref = this; + var fromRoute = ref.current; + this.transitionTo(location, function (route) { + replaceState(cleanPath(this$1.base + route.fullPath)); + handleScroll(this$1.router, route, fromRoute, false); + onComplete && onComplete(route); + }, onAbort); + }; + + HTML5History.prototype.ensureURL = function ensureURL (push) { + if (getLocation(this.base) !== this.current.fullPath) { + var current = cleanPath(this.base + this.current.fullPath); + push ? pushState(current) : replaceState(current); + } + }; + + HTML5History.prototype.getCurrentLocation = function getCurrentLocation () { + return getLocation(this.base) + }; + + return HTML5History; + }(History)); + + function getLocation (base) { + var path = window.location.pathname; + var pathLowerCase = path.toLowerCase(); + var baseLowerCase = base.toLowerCase(); + // base="/a" shouldn't turn path="/app" into "/a/pp" + // https://github.com/vuejs/vue-router/issues/3555 + // so we ensure the trailing slash in the base + if (base && ((pathLowerCase === baseLowerCase) || + (pathLowerCase.indexOf(cleanPath(baseLowerCase + '/')) === 0))) { + path = path.slice(base.length); + } + return (path || '/') + window.location.search + window.location.hash + } + + /* */ + + var HashHistory = /*@__PURE__*/(function (History) { + function HashHistory (router, base, fallback) { + History.call(this, router, base); + // check history fallback deeplinking + if (fallback && checkFallback(this.base)) { + return + } + ensureSlash(); + } + + if ( History ) HashHistory.__proto__ = History; + HashHistory.prototype = Object.create( History && History.prototype ); + HashHistory.prototype.constructor = HashHistory; + + // this is delayed until the app mounts + // to avoid the hashchange listener being fired too early + HashHistory.prototype.setupListeners = function setupListeners () { + var this$1 = this; + + if (this.listeners.length > 0) { + return + } + + var router = this.router; + var expectScroll = router.options.scrollBehavior; + var supportsScroll = supportsPushState && expectScroll; + + if (supportsScroll) { + this.listeners.push(setupScroll()); + } + + var handleRoutingEvent = function () { + var current = this$1.current; + if (!ensureSlash()) { + return + } + this$1.transitionTo(getHash(), function (route) { + if (supportsScroll) { + handleScroll(this$1.router, route, current, true); + } + if (!supportsPushState) { + replaceHash(route.fullPath); + } + }); + }; + var eventType = supportsPushState ? 'popstate' : 'hashchange'; + window.addEventListener( + eventType, + handleRoutingEvent + ); + this.listeners.push(function () { + window.removeEventListener(eventType, handleRoutingEvent); + }); + }; + + HashHistory.prototype.push = function push (location, onComplete, onAbort) { + var this$1 = this; + + var ref = this; + var fromRoute = ref.current; + this.transitionTo( + location, + function (route) { + pushHash(route.fullPath); + handleScroll(this$1.router, route, fromRoute, false); + onComplete && onComplete(route); + }, + onAbort + ); + }; + + HashHistory.prototype.replace = function replace (location, onComplete, onAbort) { + var this$1 = this; + + var ref = this; + var fromRoute = ref.current; + this.transitionTo( + location, + function (route) { + replaceHash(route.fullPath); + handleScroll(this$1.router, route, fromRoute, false); + onComplete && onComplete(route); + }, + onAbort + ); + }; + + HashHistory.prototype.go = function go (n) { + window.history.go(n); + }; + + HashHistory.prototype.ensureURL = function ensureURL (push) { + var current = this.current.fullPath; + if (getHash() !== current) { + push ? pushHash(current) : replaceHash(current); + } + }; + + HashHistory.prototype.getCurrentLocation = function getCurrentLocation () { + return getHash() + }; + + return HashHistory; + }(History)); + + function checkFallback (base) { + var location = getLocation(base); + if (!/^\/#/.test(location)) { + window.location.replace(cleanPath(base + '/#' + location)); + return true + } + } + + function ensureSlash () { + var path = getHash(); + if (path.charAt(0) === '/') { + return true + } + replaceHash('/' + path); + return false + } + + function getHash () { + // We can't use window.location.hash here because it's not + // consistent across browsers - Firefox will pre-decode it! + var href = window.location.href; + var index = href.indexOf('#'); + // empty path + if (index < 0) { return '' } + + href = href.slice(index + 1); + + return href + } + + function getUrl (path) { + var href = window.location.href; + var i = href.indexOf('#'); + var base = i >= 0 ? href.slice(0, i) : href; + return (base + "#" + path) + } + + function pushHash (path) { + if (supportsPushState) { + pushState(getUrl(path)); + } else { + window.location.hash = path; + } + } + + function replaceHash (path) { + if (supportsPushState) { + replaceState(getUrl(path)); + } else { + window.location.replace(getUrl(path)); + } + } + + /* */ + + var AbstractHistory = /*@__PURE__*/(function (History) { + function AbstractHistory (router, base) { + History.call(this, router, base); + this.stack = []; + this.index = -1; + } + + if ( History ) AbstractHistory.__proto__ = History; + AbstractHistory.prototype = Object.create( History && History.prototype ); + AbstractHistory.prototype.constructor = AbstractHistory; + + AbstractHistory.prototype.push = function push (location, onComplete, onAbort) { + var this$1 = this; + + this.transitionTo( + location, + function (route) { + this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route); + this$1.index++; + onComplete && onComplete(route); + }, + onAbort + ); + }; + + AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) { + var this$1 = this; + + this.transitionTo( + location, + function (route) { + this$1.stack = this$1.stack.slice(0, this$1.index).concat(route); + onComplete && onComplete(route); + }, + onAbort + ); + }; + + AbstractHistory.prototype.go = function go (n) { + var this$1 = this; + + var targetIndex = this.index + n; + if (targetIndex < 0 || targetIndex >= this.stack.length) { + return + } + var route = this.stack[targetIndex]; + this.confirmTransition( + route, + function () { + var prev = this$1.current; + this$1.index = targetIndex; + this$1.updateRoute(route); + this$1.router.afterHooks.forEach(function (hook) { + hook && hook(route, prev); + }); + }, + function (err) { + if (isNavigationFailure(err, NavigationFailureType.duplicated)) { + this$1.index = targetIndex; + } + } + ); + }; + + AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () { + var current = this.stack[this.stack.length - 1]; + return current ? current.fullPath : '/' + }; + + AbstractHistory.prototype.ensureURL = function ensureURL () { + // noop + }; + + return AbstractHistory; + }(History)); + + /* */ + + var VueRouter = function VueRouter (options) { + if ( options === void 0 ) options = {}; + + this.app = null; + this.apps = []; + this.options = options; + this.beforeHooks = []; + this.resolveHooks = []; + this.afterHooks = []; + this.matcher = createMatcher(options.routes || [], this); + + var mode = options.mode || 'hash'; + this.fallback = + mode === 'history' && !supportsPushState && options.fallback !== false; + if (this.fallback) { + mode = 'hash'; + } + if (!inBrowser) { + mode = 'abstract'; + } + this.mode = mode; + + switch (mode) { + case 'history': + this.history = new HTML5History(this, options.base); + break + case 'hash': + this.history = new HashHistory(this, options.base, this.fallback); + break + case 'abstract': + this.history = new AbstractHistory(this, options.base); + break + default: + { + assert(false, ("invalid mode: " + mode)); + } + } + }; + + var prototypeAccessors = { currentRoute: { configurable: true } }; + + VueRouter.prototype.match = function match (raw, current, redirectedFrom) { + return this.matcher.match(raw, current, redirectedFrom) + }; + + prototypeAccessors.currentRoute.get = function () { + return this.history && this.history.current + }; + + VueRouter.prototype.init = function init (app /* Vue component instance */) { + var this$1 = this; + + this.apps.push(app); + + // set up app destroyed handler + // https://github.com/vuejs/vue-router/issues/2639 + app.once('hook:destroyed', function () { + // clean out app from this.apps array once destroyed + var index = this$1.apps.indexOf(app); + if (index > -1) { this$1.apps.splice(index, 1); } + // ensure we still have a main app or null if no apps + // we do not release the router so it can be reused + if (this$1.app === app) { this$1.app = this$1.apps[0] || null; } + + if (!this$1.app) { this$1.history.teardown(); } + }); + + // main app previously initialized + // return as we don't need to set up new history listener + if (this.app) { + return + } + + this.app = app; + + var history = this.history; + + if (history instanceof HTML5History || history instanceof HashHistory) { + var handleInitialScroll = function (routeOrError) { + var from = history.current; + var expectScroll = this$1.options.scrollBehavior; + var supportsScroll = supportsPushState && expectScroll; + + if (supportsScroll && 'fullPath' in routeOrError) { + handleScroll(this$1, routeOrError, from, false); + } + }; + var setupListeners = function (routeOrError) { + history.setupListeners(); + handleInitialScroll(routeOrError); + }; + history.transitionTo( + history.getCurrentLocation(), + setupListeners, + setupListeners + ); + } + + history.listen(function (route) { + this$1.apps.forEach(function (app) { + app._router.history.current = route; + }); + }); + }; + + VueRouter.prototype.beforeEach = function beforeEach (fn) { + return registerHook(this.beforeHooks, fn) + }; + + VueRouter.prototype.beforeResolve = function beforeResolve (fn) { + return registerHook(this.resolveHooks, fn) + }; + + VueRouter.prototype.afterEach = function afterEach (fn) { + return registerHook(this.afterHooks, fn) + }; + + VueRouter.prototype.onReady = function onReady (cb, errorCb) { + this.history.onReady(cb, errorCb); + }; + + VueRouter.prototype.onError = function onError (errorCb) { + this.history.onError(errorCb); + }; + + VueRouter.prototype.push = function push (location, onComplete, onAbort) { + var this$1 = this; + + // $flow-disable-line + if (!onComplete && !onAbort && typeof Promise !== 'undefined') { + return new Promise(function (resolve, reject) { + this$1.history.push(location, resolve, reject); + }) + } else { + this.history.push(location, onComplete, onAbort); + } + }; + + VueRouter.prototype.replace = function replace (location, onComplete, onAbort) { + var this$1 = this; + + // $flow-disable-line + if (!onComplete && !onAbort && typeof Promise !== 'undefined') { + return new Promise(function (resolve, reject) { + this$1.history.replace(location, resolve, reject); + }) + } else { + this.history.replace(location, onComplete, onAbort); + } + }; + + VueRouter.prototype.go = function go (n) { + this.history.go(n); + }; + + VueRouter.prototype.back = function back () { + this.go(-1); + }; + + VueRouter.prototype.forward = function forward () { + this.go(1); + }; + + VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) { + var route = to + ? to.matched + ? to + : this.resolve(to).route + : this.currentRoute; + if (!route) { + return [] + } + return [].concat.apply( + [], + route.matched.map(function (m) { + return Object.keys(m.components).map(function (key) { + return m.components[key] + }) + }) + ) + }; + + VueRouter.prototype.resolve = function resolve ( + to, + current, + append + ) { + current = current || this.history.current; + var location = normalizeLocation(to, current, append, this); + var route = this.match(location, current); + var fullPath = route.redirectedFrom || route.fullPath; + var base = this.history.base; + var href = createHref(base, fullPath, this.mode); + return { + location: location, + route: route, + href: href, + // for backwards compat + normalizedTo: location, + resolved: route + } + }; + + VueRouter.prototype.getRoutes = function getRoutes () { + return this.matcher.getRoutes() + }; + + VueRouter.prototype.addRoute = function addRoute (parentOrRoute, route) { + this.matcher.addRoute(parentOrRoute, route); + if (this.history.current !== START) { + this.history.transitionTo(this.history.getCurrentLocation()); + } + }; + + Object.defineProperties( VueRouter.prototype, prototypeAccessors ); + + function registerHook (list, fn) { + list.push(fn); + return function () { + var i = list.indexOf(fn); + if (i > -1) { list.splice(i, 1); } + } + } + + function createHref (base, fullPath, mode) { + var path = mode === 'hash' ? '#' + fullPath : fullPath; + return base ? cleanPath(base + '/' + path) : path + } + + // VueRouter.install = install; + VueRouter.version = '3.5.2'; + VueRouter.isNavigationFailure = isNavigationFailure; + VueRouter.NavigationFailureType = NavigationFailureType; + VueRouter.START_LOCATION = START; + + + var $router, cbs = []; + BI.RouterWidget = BI.inherit(BI.Widget, { + init: function () { + this.$router = this._router = BI.Router.$router = $router = new VueRouter({ + routes: this.options.routes + }); + this.$router.beforeEach(function (to, from, next) { + if (to.matched.length === 0) { + //如果上级也未匹配到路由则跳转主页面,如果上级能匹配到则转上级路由 + from.path ? next({ path: from.path }) : next('/'); + } else { + //如果匹配到正确跳转 + next(); + } + }); + this.$router.afterEach(function () { + cbs.forEach(function (cb) {cb();}); + }); + this.$router.init(this); + } + }); + BI.shortcut("bi.router", BI.RouterWidget); + + BI.RouterView = BI.inherit(BI.Widget, { + props: { + deps: 0, + name: 'default' + }, + created: function () { + var self = this, o = this.options; + cbs.push(this._callbackListener = function () { + var current = $router.history.current; + // 匹配的路径名(/component/:id) + var matchedPath = current.matched[o.deps] && current.matched[o.deps].path; + var component = current.matched[o.deps] && current.matched[o.deps].components[o.name]; + + if (BI.isNotNull(component)) { + if (matchedPath) { + BI.each(current.params, function (key, value) { + // 把 :id 替换成具体的值(/component/demo.td) + matchedPath = matchedPath.replace(`:${key}`, value); + }); + } + self.tab.setSelect(matchedPath || "/"); + } + }); + }, + render: function () { + var self = this, o = this.options; + return { + type: "bi.tab", + ref: function (_ref) { + self.tab = _ref; + }, + single: false, // 是不是单页面 + logic: { + dynamic: false + }, + showIndex: false, + cardCreator: function (v) { + return $router.history.current.matched[o.deps].components[o.name]; + } + }; + }, + destroyed: function () { + cbs.remove(this._callbackListener); + } + }); + BI.shortcut("bi.router_view", BI.RouterView); + + BI.Router = BI.Router || VueRouter; + BI.Router.isSameRoute = isSameRoute; + return VueRouter; + + }))); + \ No newline at end of file diff --git a/src/main/resources/com/tptj/tool/hg/fineui/swing/base/single/button.js b/src/main/resources/com/tptj/tool/hg/fineui/swing/base/single/button.js new file mode 100644 index 0000000..4da72f3 --- /dev/null +++ b/src/main/resources/com/tptj/tool/hg/fineui/swing/base/single/button.js @@ -0,0 +1,44 @@ +/** + * Created by GUY on 2015/6/26. + * 属性 + * textAlign + * whiteSpace + * textWidth + * textHeight + * highLight + * keyword + * py + * handler + * 方法 + * setText + * setStyle + * doRedMark + * unRedMark + * doHighLight + * unHighLight + */ + +!(function(){ + var Widget = BI.inherit(BI.Widget, { + render: function () { + var o = this.options; + if( o.textAlign ){ + this.element.css("text-align",o.textAlign); + } + if( o.textHeight ){ + this.element.css("line-height",o.textHeight); + } + this.element.val(this.options.text); + } + }) + BI.shortcut("swing.button", Widget); +}()) + +var Button = Java.type("com.tptj.tool.hg.fineui.swing.element.ButtonElement"); + +BI.config("bi.button", function (config) { + return BI.extend({}, config, { + type: "swing.button", + swingElement: Button + }) +}); diff --git a/src/main/resources/com/tptj/tool/hg/fineui/swing/base/single/group.button.js b/src/main/resources/com/tptj/tool/hg/fineui/swing/base/single/group.button.js new file mode 100644 index 0000000..e69d735 --- /dev/null +++ b/src/main/resources/com/tptj/tool/hg/fineui/swing/base/single/group.button.js @@ -0,0 +1,45 @@ +/** + * Created by GUY on 2015/6/26. + * 属性 + * textAlign + * whiteSpace + * textWidth + * textHeight + * highLight + * keyword + * py + * handler + * 方法 + * setText + * setStyle + * doRedMark + * unRedMark + * doHighLight + * unHighLight + */ + +!(function () { + var Widget = BI.inherit(BI.Widget, { + render: function () { + var self = this, o = this.options; + this.populate(o.items); + }, + + populate: function (items) { + var self = this, o = this.options; + this.element.populate(BI.map(items, function (i, item) { + return item.text; + })) + } + }); + BI.shortcut("swing.button_group", Widget); + + var Button = Java.type("com.tptj.tool.hg.fineui.swing.element.ListElement"); + + BI.config("bi.button_group", function (config) { + return BI.extend({}, config, { + type: "swing.button_group", + swingElement: Button + }) + }); +}()); diff --git a/src/main/resources/com/tptj/tool/hg/fineui/swing/base/single/label.js b/src/main/resources/com/tptj/tool/hg/fineui/swing/base/single/label.js index a26dc80..ced097b 100644 --- a/src/main/resources/com/tptj/tool/hg/fineui/swing/base/single/label.js +++ b/src/main/resources/com/tptj/tool/hg/fineui/swing/base/single/label.js @@ -29,6 +29,10 @@ this.element.css("line-height",o.textHeight); } this.element.val(this.options.text); + }, + + setText: function (val) { + this.element.val(val) } }) BI.shortcut("swing.label", Widget); diff --git a/src/main/resources/com/tptj/tool/hg/fineui/swing/core/element.js b/src/main/resources/com/tptj/tool/hg/fineui/swing/core/element.js index a20c595..aca146d 100644 --- a/src/main/resources/com/tptj/tool/hg/fineui/swing/core/element.js +++ b/src/main/resources/com/tptj/tool/hg/fineui/swing/core/element.js @@ -26,9 +26,9 @@ this.java_el = widget; } else { this.java_el = new ((widget.options || {}).swingElement || Element)(); - this.java_el.setType((widget.options || {}).type); } - if(BI.isWidget(widget)){ + if (BI.isWidget(widget)) { + this.widget = widget; if (!widget.mounted) { widget.mounted = []; } else if (!BI.isArray(widget.mounted)) { @@ -92,6 +92,7 @@ return this; }, empty: function () { + this._children = []; this.java_el.empty(); return this; }, @@ -150,6 +151,10 @@ } else { return this.java_el.getVal(); } + }, + + populate: function (items) { + this.java_el.populate(items); } }); })(); \ No newline at end of file diff --git a/src/main/resources/com/tptj/tool/hg/fineui/swing/core/extra.js b/src/main/resources/com/tptj/tool/hg/fineui/swing/core/extra.js index 50e705e..7e138ad 100644 --- a/src/main/resources/com/tptj/tool/hg/fineui/swing/core/extra.js +++ b/src/main/resources/com/tptj/tool/hg/fineui/swing/core/extra.js @@ -7,6 +7,12 @@ // 将单位设置成空,这样子css()的大小和位置就不带px了 BI.pixUnit = ""; + // Promise没法用,对于fix就直接callback了 + BI.nextTick = function (callback) { + callback(); + }; + + // 注册渲染引擎 BI.Widget.registerRenderEngine({ createElement: function (widget) { if (BI.isWidget(widget)) { @@ -20,17 +26,18 @@ } return $(widget); } - console.debug("不支持",widget); + console.debug("不支持", widget); return $(widget); }, createFragment: function () { return $("invented"); } }); + //hugh:ref反向把js对象注入到java中,实现双向调用和事件处理 BI.Widget.prototype._oldInitRoot = BI.Widget.prototype._initRoot; BI.Widget.prototype._initRoot = function () { - this._oldInitRoot(); + this._oldInitRoot(); this.element.ref(this); } })(); \ No newline at end of file diff --git a/src/main/resources/com/tptj/tool/hg/fineui/swing/core/wrapper/layout.horizontal.js b/src/main/resources/com/tptj/tool/hg/fineui/swing/core/wrapper/layout.horizontal.js index 2f6aca5..a1fe165 100644 --- a/src/main/resources/com/tptj/tool/hg/fineui/swing/core/wrapper/layout.horizontal.js +++ b/src/main/resources/com/tptj/tool/hg/fineui/swing/core/wrapper/layout.horizontal.js @@ -8,22 +8,14 @@ this.element.append(child.element); } } - if (o.verticalAlign === BI.VerticalAlign.Middle) { - if (o.horizontalAlign === BI.HorizontalAlign.Center) { - this.element.layout("center_adapt"); - return; - } - this.element.layout("vertical_adapt"); - return; - } - this.element.layout("horizontal"); + BI.Services.getService("swing.layout.service").layout(this); } }); BI.shortcut("swing.horizontal", BI.SwingHorizontalLayout); BI.config("bi.horizontal", function (config) { return BI.extend({}, config, { - type: "swing.horizontal", + type: "swing.horizontal" }) }); }()); diff --git a/src/main/resources/com/tptj/tool/hg/fineui/swing/core/wrapper/layout.service.js b/src/main/resources/com/tptj/tool/hg/fineui/swing/core/wrapper/layout.service.js new file mode 100644 index 0000000..ab1cb88 --- /dev/null +++ b/src/main/resources/com/tptj/tool/hg/fineui/swing/core/wrapper/layout.service.js @@ -0,0 +1,30 @@ +!(function () { + var Service = BI.inherit(BI.OB, { + layout: function (widget) { + var element = widget.element; + var o = widget.options; + if (o.verticalAlign === BI.VerticalAlign.Middle) { + if (o.horizontalAlign === BI.HorizontalAlign.Center) { + element.layout("center_adapt"); + return; + } + element.layout("vertical_adapt"); + return; + } + if (o.horizontalAlign === BI.HorizontalAlign.Center) { + element.layout("horizontal_adapt"); + return; + } + if (o.type === "swing.vertical") { + element.layout("vertical"); + return; + } + if (o.type === "swing.horizontal") { + element.layout("horizontal"); + return; + } + element.layout("absolute"); + } + }); + BI.service("swing.layout.service", Service); +}()); \ No newline at end of file diff --git a/src/main/resources/com/tptj/tool/hg/fineui/swing/core/wrapper/layout.vertical.js b/src/main/resources/com/tptj/tool/hg/fineui/swing/core/wrapper/layout.vertical.js index b1f7c8a..fcddc9e 100644 --- a/src/main/resources/com/tptj/tool/hg/fineui/swing/core/wrapper/layout.vertical.js +++ b/src/main/resources/com/tptj/tool/hg/fineui/swing/core/wrapper/layout.vertical.js @@ -8,21 +8,14 @@ this.element.append(child.element); } } - if (o.horizontalAlign === BI.HorizontalAlign.Center) { - if (o.verticalAlign === BI.VerticalAlign.Middle) { - this.element.layout("center_adapt"); - } - this.element.layout("horizontal_adapt"); - return; - } - this.element.layout("vertical"); + BI.Services.getService("swing.layout.service").layout(this); } }); BI.shortcut("swing.vertical", Widget); BI.config("bi.vertical", function (config) { return BI.extend({}, config, { - type: "swing.vertical", + type: "swing.vertical" }) }); }()); diff --git a/src/main/resources/com/tptj/tool/hg/fineui/swing/demo/group.button.js b/src/main/resources/com/tptj/tool/hg/fineui/swing/demo/group.button.js new file mode 100644 index 0000000..9e0cc79 --- /dev/null +++ b/src/main/resources/com/tptj/tool/hg/fineui/swing/demo/group.button.js @@ -0,0 +1,75 @@ +!(function () { + var Model = BI.inherit(Fix.Model, { + state: function () { + return { + items: [{ + text: "列表项1" + }, { + text: "列表项2" + }] + } + }, + actions: { + addItem: function () { + this.model.items.push({ + text: "列表项" + (this.model.items.length + 1) + }) + } + } + }); + BI.model("my.model", Model); + + var Widget = BI.inherit(BI.Widget, { + _store: function () { + return BI.Models.getModel("my.model"); + }, + props: { + width: 600, + height: 300 + }, + watch: { + items: function (items) { + this.list.populate(items); + } + }, + render: function () { + var self = this; + return { + type: "bi.vtape", + rowSize: [50, "fill"], + items: [{ + type: "bi.button", + text: "点击新增元素", + listeners: [{ + eventName: "EVENT_CHANGE", + action: function (val) { + self.store.addItem(); + } + }] + }, { + type: "bi.button_group", + ref: function (_ref) { + self.list = _ref; + }, + layouts: [{ + type: "bi.vertical_adapt", + verticalAlign: BI.VerticalAlign.Middle, + hgap: 30, + scrollable: true + }], + chooseType: BI.Selection.None, + css: { + background: "rgb(200,200,200)" + }, + items: this.model.items + }] + } + } + }); + BI.shortcut("my.app", Widget); + + BI.createWidget({ + type: "my.app", + element: body + }); +})(); \ No newline at end of file