@opentiny/vue-renderless 3.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/action-sheet/index.js +28 -0
- package/action-sheet/vue.js +29 -0
- package/alert/index.js +23 -0
- package/alert/vue.js +37 -0
- package/autocomplete/index.js +175 -0
- package/autocomplete/vue.js +171 -0
- package/avatar/index.js +29 -0
- package/avatar/vue.js +24 -0
- package/badge/index.js +16 -0
- package/badge/vue.js +30 -0
- package/breadcrumb/vue.js +4 -0
- package/breadcrumb-item/vue.js +24 -0
- package/bulletin-board/index.js +21 -0
- package/bulletin-board/vue.js +36 -0
- package/button/index.js +19 -0
- package/button/vue.js +43 -0
- package/button-group/index.js +25 -0
- package/button-group/vue.js +51 -0
- package/calendar/index.js +279 -0
- package/calendar/vue.js +124 -0
- package/card-template/index.js +39 -0
- package/card-template/vue.js +34 -0
- package/carousel/index.js +206 -0
- package/carousel/vue.js +222 -0
- package/carousel-item/index.js +93 -0
- package/carousel-item/vue.js +57 -0
- package/cascader/index.js +511 -0
- package/cascader/vue.js +342 -0
- package/cascader-menu/index.js +41 -0
- package/cascader-menu/vue.js +36 -0
- package/cascader-node/index.js +63 -0
- package/cascader-node/vue.js +62 -0
- package/cascader-panel/index.js +359 -0
- package/cascader-panel/node.js +199 -0
- package/cascader-panel/store.js +80 -0
- package/cascader-panel/vue.js +217 -0
- package/checkbox/index.js +145 -0
- package/checkbox/vue.js +139 -0
- package/checkbox-button/index.js +102 -0
- package/checkbox-button/vue.js +150 -0
- package/checkbox-group/index.js +12 -0
- package/checkbox-group/vue.js +33 -0
- package/col/index.js +132 -0
- package/col/vue.js +34 -0
- package/collapse/index.js +45 -0
- package/collapse/vue.js +35 -0
- package/collapse-item/index.js +38 -0
- package/collapse-item/vue.js +48 -0
- package/common/array.js +120 -0
- package/common/bigInt.js +352 -0
- package/common/browser.js +69 -0
- package/common/dataset/index.js +135 -0
- package/common/date.js +352 -0
- package/common/decimal.js +203 -0
- package/common/deps/ResizeObserver.js +474 -0
- package/common/deps/after-leave.js +25 -0
- package/common/deps/clickoutside.js +61 -0
- package/common/deps/date-util.js +262 -0
- package/common/deps/date.js +308 -0
- package/common/deps/debounce.js +4 -0
- package/common/deps/dom.js +190 -0
- package/common/deps/fullscreen/apis.js +157 -0
- package/common/deps/fullscreen/screenfull.js +106 -0
- package/common/deps/letter-only.js +15 -0
- package/common/deps/memorize.js +149 -0
- package/common/deps/number-only.js +16 -0
- package/common/deps/popper.js +713 -0
- package/common/deps/popup-manager.js +179 -0
- package/common/deps/repeat-click.js +24 -0
- package/common/deps/requestAnimationFrame.js +25 -0
- package/common/deps/resize-event.js +29 -0
- package/common/deps/scroll-into-view.js +29 -0
- package/common/deps/scrollbar-width.js +25 -0
- package/common/deps/throttle.js +34 -0
- package/common/deps/touch.js +33 -0
- package/common/deps/tree-model/node.js +586 -0
- package/common/deps/tree-model/tree-store.js +377 -0
- package/common/deps/tree-model/util.js +14 -0
- package/common/deps/upload-ajax.js +71 -0
- package/common/deps/vue-emitter.js +30 -0
- package/common/deps/vue-popper.js +291 -0
- package/common/deps/vue-popup.js +211 -0
- package/common/event.js +17 -0
- package/common/index.js +288 -0
- package/common/object.js +228 -0
- package/common/runtime.js +52 -0
- package/common/string.js +446 -0
- package/common/type.js +65 -0
- package/common/validate/index.js +6 -0
- package/common/validate/messages.js +68 -0
- package/common/validate/rules/enum.js +8 -0
- package/common/validate/rules/index.js +14 -0
- package/common/validate/rules/pattern.js +16 -0
- package/common/validate/rules/range.js +62 -0
- package/common/validate/rules/required.js +13 -0
- package/common/validate/rules/type.js +110 -0
- package/common/validate/rules/whitespace.js +6 -0
- package/common/validate/schema.js +323 -0
- package/common/validate/util.js +198 -0
- package/common/validate/validations/array.js +25 -0
- package/common/validate/validations/date.js +35 -0
- package/common/validate/validations/enum.js +24 -0
- package/common/validate/validations/float.js +24 -0
- package/common/validate/validations/index.js +42 -0
- package/common/validate/validations/integer.js +24 -0
- package/common/validate/validations/method.js +23 -0
- package/common/validate/validations/number.js +27 -0
- package/common/validate/validations/pattern.js +23 -0
- package/common/validate/validations/required.js +15 -0
- package/common/validate/validations/string.js +29 -0
- package/common/validate/validations/type.js +25 -0
- package/common/xss.js +325 -0
- package/container/index.js +110 -0
- package/container/vue.js +63 -0
- package/credit-card/index.js +107 -0
- package/credit-card/vue.js +117 -0
- package/credit-card-form/index.js +143 -0
- package/credit-card-form/vue.js +150 -0
- package/crop/index.js +297 -0
- package/crop/vue.js +191 -0
- package/date-panel/index.js +584 -0
- package/date-panel/vue.js +319 -0
- package/date-picker/index.js +301 -0
- package/date-picker/vue.js +169 -0
- package/date-range/index.js +463 -0
- package/date-range/vue.js +297 -0
- package/date-table/index.js +457 -0
- package/date-table/vue.js +151 -0
- package/detail-page/index.js +135 -0
- package/detail-page/vue.js +145 -0
- package/dialog-box/index.js +268 -0
- package/dialog-box/vue.js +226 -0
- package/drop-times/index.js +23 -0
- package/drop-times/vue.js +28 -0
- package/dropdown/index.js +259 -0
- package/dropdown/vue.js +107 -0
- package/dropdown-item/index.js +155 -0
- package/dropdown-item/vue.js +124 -0
- package/dropdown-menu/index.js +148 -0
- package/dropdown-menu/vue.js +44 -0
- package/exception/index.js +13 -0
- package/exception/vue.js +25 -0
- package/fall-menu/index.js +121 -0
- package/fall-menu/vue.js +90 -0
- package/file-upload/index.js +1940 -0
- package/file-upload/vue.js +458 -0
- package/floatbar/index.js +10 -0
- package/floatbar/vue.js +17 -0
- package/form/index.js +186 -0
- package/form/vue.js +69 -0
- package/form-item/index.js +364 -0
- package/form-item/vue.js +210 -0
- package/fullscreen/index.js +138 -0
- package/fullscreen/vue.js +77 -0
- package/grid/core/index.js +3 -0
- package/grid/core/interceptor.js +38 -0
- package/grid/core/storeMap.js +19 -0
- package/grid/plugins/export.js +169 -0
- package/grid/plugins/exportExcel.js +749 -0
- package/grid/plugins/header.js +58 -0
- package/grid/plugins/resize.js +82 -0
- package/grid/static/array/arrayEach.js +12 -0
- package/grid/static/array/arrayIndexOf.js +11 -0
- package/grid/static/array/eachTree.js +32 -0
- package/grid/static/array/every.js +2 -0
- package/grid/static/array/filterTree.js +16 -0
- package/grid/static/array/find.js +3 -0
- package/grid/static/array/findTree.js +46 -0
- package/grid/static/array/helperCreateIterateHandle.js +59 -0
- package/grid/static/array/helperCreateTreeFunc.js +18 -0
- package/grid/static/array/includes.js +5 -0
- package/grid/static/array/lastArrayEach.js +6 -0
- package/grid/static/array/map.js +23 -0
- package/grid/static/array/mapTree.js +33 -0
- package/grid/static/array/slice.js +10 -0
- package/grid/static/array/sortBy.js +69 -0
- package/grid/static/array/sum.js +28 -0
- package/grid/static/array/toArray.js +7 -0
- package/grid/static/array/toTreeArray.js +24 -0
- package/grid/static/base/clear.js +44 -0
- package/grid/static/base/clone.js +18 -0
- package/grid/static/base/destructuring.js +18 -0
- package/grid/static/base/each.js +9 -0
- package/grid/static/base/eqNull.js +6 -0
- package/grid/static/base/findIndexOf.js +10 -0
- package/grid/static/base/get.js +42 -0
- package/grid/static/base/has.js +60 -0
- package/grid/static/base/hasOwnProp.js +4 -0
- package/grid/static/base/helperCreateGetObjects.js +26 -0
- package/grid/static/base/helperCreateInInObjectString.js +7 -0
- package/grid/static/base/helperCreateInTypeof.js +6 -0
- package/grid/static/base/helperCreateIndexOf.js +21 -0
- package/grid/static/base/helperCreateiterateIndexOf.js +21 -0
- package/grid/static/base/helperDefaultCompare.js +4 -0
- package/grid/static/base/helperDeleteProperty.js +8 -0
- package/grid/static/base/helperEqualCompare.js +60 -0
- package/grid/static/base/helperGetHGSKeys.js +4 -0
- package/grid/static/base/indexOf.js +3 -0
- package/grid/static/base/isArray.js +3 -0
- package/grid/static/base/isBoolean.js +4 -0
- package/grid/static/base/isDate.js +3 -0
- package/grid/static/base/isEmpty.js +8 -0
- package/grid/static/base/isEqual.js +11 -0
- package/grid/static/base/isFunction.js +4 -0
- package/grid/static/base/isNaN.js +5 -0
- package/grid/static/base/isNull.js +4 -0
- package/grid/static/base/isNumber.js +4 -0
- package/grid/static/base/isObject.js +5 -0
- package/grid/static/base/isPlainObject.js +2 -0
- package/grid/static/base/isRegExp.js +3 -0
- package/grid/static/base/isSet.js +5 -0
- package/grid/static/base/isString.js +4 -0
- package/grid/static/base/isUndefined.js +4 -0
- package/grid/static/base/keys.js +3 -0
- package/grid/static/base/lastEach.js +9 -0
- package/grid/static/base/remove.js +44 -0
- package/grid/static/base/set.js +43 -0
- package/grid/static/base/toJSONString.js +4 -0
- package/grid/static/base/toStringJSON.js +13 -0
- package/grid/static/base/uniqueId.js +5 -0
- package/grid/static/browse/browse.js +54 -0
- package/grid/static/function/property.js +7 -0
- package/grid/static/function/throttle.js +43 -0
- package/grid/static/index.js +55 -0
- package/grid/static/number/helperCreateToNumber.js +12 -0
- package/grid/static/number/toNumber.js +3 -0
- package/grid/static/object/assign.js +41 -0
- package/grid/static/object/extend.js +3 -0
- package/grid/static/object/lastObjectEach.js +8 -0
- package/grid/static/object/objectEach.js +11 -0
- package/grid/static/object/objectMap.js +20 -0
- package/grid/static/object/values.js +9 -0
- package/grid/static/static/staticDocument.js +4 -0
- package/grid/static/static/staticHGKeyRE.js +2 -0
- package/grid/static/static/staticParseInt.js +2 -0
- package/grid/static/static/staticStrUndefined.js +2 -0
- package/grid/static/static/staticWindow.js +4 -0
- package/grid/static/string/template.js +12 -0
- package/grid/static/string/toString.js +12 -0
- package/grid/utils/column.js +72 -0
- package/grid/utils/common.js +155 -0
- package/grid/utils/dom.js +213 -0
- package/grid/utils/event.js +40 -0
- package/grid/utils/index.js +5 -0
- package/image/index.js +187 -0
- package/image/vue.js +142 -0
- package/image-viewer/index.js +469 -0
- package/image-viewer/vue.js +243 -0
- package/input/index.js +319 -0
- package/input/vue.js +319 -0
- package/ip-address/index.js +370 -0
- package/ip-address/vue.js +185 -0
- package/layout/vue.js +4 -0
- package/link/index.js +10 -0
- package/link/vue.js +26 -0
- package/link-menu/index.js +146 -0
- package/link-menu/vue.js +138 -0
- package/list/index.js +13 -0
- package/list/vue.js +17 -0
- package/loading/index.js +29 -0
- package/loading/vue.js +28 -0
- package/milestone/index.js +92 -0
- package/milestone/vue.js +31 -0
- package/mini-picker/index.js +227 -0
- package/mini-picker/vue.js +142 -0
- package/modal/index.js +866 -0
- package/modal/vue.js +130 -0
- package/month-range/index.js +169 -0
- package/month-range/vue.js +104 -0
- package/month-table/index.js +232 -0
- package/month-table/vue.js +72 -0
- package/nav-menu/index.js +457 -0
- package/nav-menu/vue.js +187 -0
- package/notify/index.js +91 -0
- package/notify/vue.js +67 -0
- package/numeric/index.js +419 -0
- package/numeric/vue.js +218 -0
- package/option/index.js +79 -0
- package/option/vue.js +219 -0
- package/option-group/index.js +18 -0
- package/option-group/vue.js +37 -0
- package/package.json +179 -0
- package/pager-item/index.js +122 -0
- package/pager-item/vue.js +52 -0
- package/panel/index.js +30 -0
- package/panel/vue.js +26 -0
- package/picker/index.js +1039 -0
- package/picker/timezone.js +974 -0
- package/picker/vue.js +415 -0
- package/picker-column/index.js +261 -0
- package/picker-column/vue.js +163 -0
- package/pop-upload/index.js +324 -0
- package/pop-upload/vue.js +292 -0
- package/popeditor/index.js +884 -0
- package/popeditor/vue.js +368 -0
- package/popover/index.js +203 -0
- package/popover/vue.js +174 -0
- package/popup/index.js +139 -0
- package/popup/vue.js +129 -0
- package/progress/index.js +174 -0
- package/progress/vue.js +118 -0
- package/pull-refresh/index.js +104 -0
- package/pull-refresh/vue.js +64 -0
- package/radio/index.js +83 -0
- package/radio/vue.js +99 -0
- package/radio-button/index.js +58 -0
- package/radio-button/vue.js +70 -0
- package/radio-group/index.js +51 -0
- package/radio-group/vue.js +34 -0
- package/rate/index.js +254 -0
- package/rate/vue.js +158 -0
- package/row/index.js +19 -0
- package/row/vue.js +24 -0
- package/scroll-text/index.js +24 -0
- package/scroll-text/vue.js +31 -0
- package/scrollbar/index.js +127 -0
- package/scrollbar/vue-bar.js +49 -0
- package/scrollbar/vue.js +43 -0
- package/search/index.js +110 -0
- package/search/vue.js +110 -0
- package/select/index.js +1766 -0
- package/select/vue.js +693 -0
- package/select-dropdown/index.js +23 -0
- package/select-dropdown/vue.js +122 -0
- package/slide-bar/index.js +94 -0
- package/slide-bar/vue.js +58 -0
- package/slider/index.js +434 -0
- package/slider/vue.js +172 -0
- package/split/index.js +122 -0
- package/split/vue.js +131 -0
- package/steps/vue.js +4 -0
- package/switch/index.js +45 -0
- package/switch/vue.js +62 -0
- package/tab-bar/index.js +51 -0
- package/tab-bar/vue.js +16 -0
- package/tab-dropdown/index.js +11 -0
- package/tab-dropdown/vue.js +17 -0
- package/tab-item/index.js +37 -0
- package/tab-item/vue.js +49 -0
- package/tab-nav/index.js +247 -0
- package/tab-nav/vue.js +106 -0
- package/tabbar/index.js +32 -0
- package/tabbar/vue.js +54 -0
- package/tabbar-item/index.js +55 -0
- package/tabbar-item/vue.js +53 -0
- package/table/index.js +111 -0
- package/table/vue.js +66 -0
- package/tabs/index.js +174 -0
- package/tabs/vue.js +141 -0
- package/tag/index.js +14 -0
- package/tag/vue.js +13 -0
- package/tall-storage/index.js +161 -0
- package/tall-storage/vue-storage-box.js +25 -0
- package/tall-storage/vue.js +38 -0
- package/text-popup/index.js +75 -0
- package/text-popup/vue.js +64 -0
- package/time/index.js +121 -0
- package/time/vue.js +124 -0
- package/time-line/index.js +60 -0
- package/time-line/vue.js +49 -0
- package/time-panel/index.js +189 -0
- package/time-panel/scrollIntoView.js +23 -0
- package/time-panel/vue.js +110 -0
- package/time-range/index.js +199 -0
- package/time-range/vue.js +129 -0
- package/time-spinner/index.js +175 -0
- package/time-spinner/vue.js +122 -0
- package/toggle-menu/index.js +104 -0
- package/toggle-menu/vue.js +74 -0
- package/tooltip/index.js +171 -0
- package/tooltip/vue.js +133 -0
- package/top-box/index.js +81 -0
- package/top-box/vue.js +77 -0
- package/transfer/index.js +296 -0
- package/transfer/vue.js +138 -0
- package/transfer-panel/index.js +364 -0
- package/transfer-panel/vue.js +258 -0
- package/tree/index.js +642 -0
- package/tree/vue.js +268 -0
- package/tree-menu/index.js +124 -0
- package/tree-menu/vue.js +60 -0
- package/tree-node/index.js +271 -0
- package/tree-node/vue.js +211 -0
- package/upload/index.js +324 -0
- package/upload/vue.js +93 -0
- package/upload-dragger/index.js +50 -0
- package/upload-dragger/vue.js +27 -0
- package/upload-list/index.js +55 -0
- package/upload-list/vue.js +48 -0
- package/user-contact/index.js +13 -0
- package/user-contact/vue.js +20 -0
- package/user-head/index.js +71 -0
- package/user-head/vue.js +47 -0
- package/wizard/index.js +123 -0
- package/wizard/vue.js +45 -0
- package/year-table/index.js +40 -0
- package/year-table/vue.js +23 -0
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import { isEmptyObject, isObject } from '@opentiny/vue-renderless/common/type';
|
|
5
|
+
import PopupManager from '@opentiny/vue-renderless/common/deps/popup-manager';
|
|
6
|
+
import { mapTree } from '@opentiny/vue-renderless/grid/static';
|
|
7
|
+
import { transformTreeData } from '@opentiny/vue-renderless/common/array';
|
|
8
|
+
import { on, off } from '@opentiny/vue-renderless/common/deps/dom';
|
|
9
|
+
import { xss } from '@opentiny/vue-renderless/common/xss.js';
|
|
10
|
+
var nextZIndex = PopupManager.nextZIndex;
|
|
11
|
+
export var computedIsShowMore = function computedIsShowMore(_ref) {
|
|
12
|
+
var props = _ref.props,
|
|
13
|
+
state = _ref.state;
|
|
14
|
+
return function () {
|
|
15
|
+
return !/^(retract|fixed|hidden)$/.test(props.overflow) && state.more && state.more.length;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export var computedPopClass = function computedPopClass(state) {
|
|
19
|
+
return function () {
|
|
20
|
+
return !state.showMore && state.subMenus && state.subMenus.length === 1 ? 'single' : '';
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export var computedSubMenus = function computedSubMenus(state) {
|
|
24
|
+
return function () {
|
|
25
|
+
var arr = state.subMenu;
|
|
26
|
+
if (state.subMenu && !isEmptyObject(state.subMenu)) {
|
|
27
|
+
if (!state.subMenu.map(function (item) {
|
|
28
|
+
return item.children && !isEmptyObject(item.children);
|
|
29
|
+
}).reduce(function (pre, cur) {
|
|
30
|
+
return pre || cur;
|
|
31
|
+
})) {
|
|
32
|
+
arr = [{
|
|
33
|
+
children: state.subMenu
|
|
34
|
+
}];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return arr;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export var computedMenuStyle = function computedMenuStyle(_ref2) {
|
|
41
|
+
var props = _ref2.props,
|
|
42
|
+
state = _ref2.state;
|
|
43
|
+
return function () {
|
|
44
|
+
var result = {
|
|
45
|
+
maxWidth: "".concat(state.width, "px")
|
|
46
|
+
};
|
|
47
|
+
if (props.overflow === 'retract') {
|
|
48
|
+
result.width = '0px';
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export var computedPopStyle = function computedPopStyle(state) {
|
|
54
|
+
return function () {
|
|
55
|
+
return {
|
|
56
|
+
top: "".concat(state.popMenuTop, "px")
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export var watchWidth = function watchWidth(_ref3) {
|
|
61
|
+
var api = _ref3.api,
|
|
62
|
+
nextTick = _ref3.nextTick;
|
|
63
|
+
return function () {
|
|
64
|
+
return nextTick(function () {
|
|
65
|
+
return api.classify();
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
var CloneObject = function () {
|
|
70
|
+
function CloneObject(json, props) {
|
|
71
|
+
_classCallCheck(this, CloneObject);
|
|
72
|
+
this.props = props;
|
|
73
|
+
if (json) {
|
|
74
|
+
this.data = this.getType(json);
|
|
75
|
+
this.traverse(json, this.data);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
_createClass(CloneObject, [{
|
|
79
|
+
key: "traverse",
|
|
80
|
+
value: function traverse(node, newObject) {
|
|
81
|
+
if (/^(string|undefined)$/.test(_typeof(node)) || node === null) {
|
|
82
|
+
newObject = node;
|
|
83
|
+
} else if (Array.isArray(node)) {
|
|
84
|
+
this.traverseArray(node, newObject);
|
|
85
|
+
} else if (_typeof(node) === 'object') {
|
|
86
|
+
this.traverseObject(node, newObject);
|
|
87
|
+
}
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "traverseArray",
|
|
92
|
+
value: function traverseArray(node, newObject) {
|
|
93
|
+
for (var i = 0; i < node.length; i++) {
|
|
94
|
+
newObject.push(this.getType(node[i]));
|
|
95
|
+
if (node[i] && _typeof(node[i]) === 'object') {
|
|
96
|
+
this.traverse(node[i], newObject[i]);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "traverseObject",
|
|
102
|
+
value: function traverseObject(node, newObject) {
|
|
103
|
+
var _this = this;
|
|
104
|
+
Object.keys(node).forEach(function (key) {
|
|
105
|
+
if (/^(name|url|route|title|name|children)$/.test(key)) {
|
|
106
|
+
var alias = key;
|
|
107
|
+
if (key === 'url') {
|
|
108
|
+
if (!(_this.props.prevent || _this.props.allowFullUrl)) {
|
|
109
|
+
alias = 'route';
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (key === 'name') {
|
|
113
|
+
alias = 'title';
|
|
114
|
+
}
|
|
115
|
+
newObject[alias] = _this.getType(node[key]);
|
|
116
|
+
if (newObject[alias] && _typeof(newObject[alias]) === 'object') {
|
|
117
|
+
_this.traverse(node[key], newObject[alias]);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
key: "getType",
|
|
124
|
+
value: function getType(object) {
|
|
125
|
+
var result;
|
|
126
|
+
if (/^(string|undefined)$/.test(_typeof(object)) || object === null) {
|
|
127
|
+
result = object;
|
|
128
|
+
} else if (Array.isArray(object)) {
|
|
129
|
+
result = [];
|
|
130
|
+
} else if (_typeof(object) === 'object') {
|
|
131
|
+
result = {};
|
|
132
|
+
}
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
}]);
|
|
136
|
+
return CloneObject;
|
|
137
|
+
}();
|
|
138
|
+
export var initData = function initData(_ref4) {
|
|
139
|
+
var fetchMenuData = _ref4.fetchMenuData,
|
|
140
|
+
fields = _ref4.fields,
|
|
141
|
+
props = _ref4.props,
|
|
142
|
+
state = _ref4.state;
|
|
143
|
+
return function () {
|
|
144
|
+
var _ref5 = fields || {},
|
|
145
|
+
_ref5$textField = _ref5.textField,
|
|
146
|
+
textField = _ref5$textField === void 0 ? 'title' : _ref5$textField,
|
|
147
|
+
_ref5$urlField = _ref5.urlField,
|
|
148
|
+
urlField = _ref5$urlField === void 0 ? 'url' : _ref5$urlField,
|
|
149
|
+
_ref5$key = _ref5.key,
|
|
150
|
+
key = _ref5$key === void 0 ? 'id' : _ref5$key;
|
|
151
|
+
var parentKey = props.parentKey,
|
|
152
|
+
data = props.data;
|
|
153
|
+
var isFullUrl = function isFullUrl(url) {
|
|
154
|
+
return /^(https?:\/\/|\/\/)[\s\S]+$/.test(url);
|
|
155
|
+
};
|
|
156
|
+
var buildData = function buildData(item) {
|
|
157
|
+
var router = item[urlField] || item['route'];
|
|
158
|
+
return {
|
|
159
|
+
title: item[textField],
|
|
160
|
+
route: router ? router.replace(/^#\/?/, '') : null,
|
|
161
|
+
url: item.url,
|
|
162
|
+
id: item.id,
|
|
163
|
+
pid: item.pid,
|
|
164
|
+
isFullUrl: props.allowFullUrl && isFullUrl(router),
|
|
165
|
+
target: item.target
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
if (data) {
|
|
169
|
+
state.data = mapTree(parentKey ? transformTreeData(data, key, parentKey) : data, buildData);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
var menuData = props.fetchMenuData && fetchMenuData();
|
|
173
|
+
if (isObject(menuData) && menuData.then) {
|
|
174
|
+
menuData.then(function (data) {
|
|
175
|
+
state.data = mapTree(props.parentKey ? transformTreeData(data, key, props.parentKey) : data, buildData);
|
|
176
|
+
});
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (!menuData) {
|
|
180
|
+
state.data = [];
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
var arr = [];
|
|
184
|
+
if (menuData && menuData.length) {
|
|
185
|
+
var getMenuData = new CloneObject(menuData, props).data;
|
|
186
|
+
arr = _typeof(getMenuData) === 'object' && Array.isArray(getMenuData) ? getMenuData : [getMenuData];
|
|
187
|
+
}
|
|
188
|
+
state.data = mapTree(parentKey ? transformTreeData(arr, key, parentKey) : arr, buildData);
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
export var mounted = function mounted(_ref6) {
|
|
192
|
+
var api = _ref6.api,
|
|
193
|
+
props = _ref6.props,
|
|
194
|
+
router = _ref6.router,
|
|
195
|
+
route = _ref6.route,
|
|
196
|
+
state = _ref6.state;
|
|
197
|
+
return function () {
|
|
198
|
+
api.calcWidth();
|
|
199
|
+
on(window, 'resize', api.calcWidth);
|
|
200
|
+
if (router) {
|
|
201
|
+
state.afterEach = function () {
|
|
202
|
+
api.setActiveMenu(api.getSelectedIndex(route.path));
|
|
203
|
+
};
|
|
204
|
+
router.afterEach(state.afterEach);
|
|
205
|
+
}
|
|
206
|
+
props.data && props.data.length && route && api.setActiveMenu(api.getSelectedIndex(route.path));
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
export var unMounted = function unMounted(_ref7) {
|
|
210
|
+
var api = _ref7.api,
|
|
211
|
+
state = _ref7.state,
|
|
212
|
+
router = _ref7.router;
|
|
213
|
+
return function () {
|
|
214
|
+
if (router && router.afterHooks) {
|
|
215
|
+
var index = router.afterHooks.indexOf(state.afterEach);
|
|
216
|
+
router.afterHooks.splice(index, 1);
|
|
217
|
+
}
|
|
218
|
+
state.afterEach = null;
|
|
219
|
+
off(window, 'resize', api.calcWidth);
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
export var getSelectedIndex = function getSelectedIndex(state) {
|
|
223
|
+
return function (path) {
|
|
224
|
+
var length = state.data.length;
|
|
225
|
+
var index = -1;
|
|
226
|
+
if (path !== '/') {
|
|
227
|
+
path = path.replace(/^#?\//, '');
|
|
228
|
+
var exp = new RegExp('("url":"#/?' + path + '"|"url":"/?' + path + '"|"route":"/?' + path + '")', 'i');
|
|
229
|
+
for (var i = 0; i < length; i++) {
|
|
230
|
+
if (exp.test(JSON.stringify(state.data[i]))) {
|
|
231
|
+
index = i;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return index;
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
export var showSetting = function showSetting(_ref8) {
|
|
240
|
+
var parent = _ref8.parent,
|
|
241
|
+
state = _ref8.state;
|
|
242
|
+
return function () {
|
|
243
|
+
state.isShowSetting = true;
|
|
244
|
+
var setting = parent.$el.querySelector('.more-setting');
|
|
245
|
+
setting.style.zIndex = nextZIndex();
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
export var willHideSetting = function willHideSetting(state) {
|
|
249
|
+
return function () {
|
|
250
|
+
return state.isShowSetting = false;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
export var showSubMenu = function showSubMenu(_ref9) {
|
|
254
|
+
var api = _ref9.api,
|
|
255
|
+
nextTick = _ref9.nextTick,
|
|
256
|
+
parent = _ref9.parent,
|
|
257
|
+
state = _ref9.state;
|
|
258
|
+
return function (list, _ref10, event) {
|
|
259
|
+
var more = _ref10.more,
|
|
260
|
+
index = _ref10.index;
|
|
261
|
+
if (list || more) {
|
|
262
|
+
state.subMenu !== list ? api.hideSubMenu() : api.stopHideSubMenu();
|
|
263
|
+
state.showMore = !!more;
|
|
264
|
+
state.subMenu = list;
|
|
265
|
+
state.showPopmenu = true;
|
|
266
|
+
nextTick(function () {
|
|
267
|
+
var popmenu = parent.$el.querySelector('.popmenu');
|
|
268
|
+
if (popmenu) {
|
|
269
|
+
popmenu.style.zIndex = nextZIndex();
|
|
270
|
+
if (popmenu.classList.contains('single') && event) {
|
|
271
|
+
popmenu.style.left = "".concat(event.target.offsetLeft, "px");
|
|
272
|
+
} else {
|
|
273
|
+
popmenu.style.left = 0;
|
|
274
|
+
}
|
|
275
|
+
popmenu.style.height = 'auto';
|
|
276
|
+
popmenu.style.display = 'block';
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
if (index !== undefined) {
|
|
280
|
+
state.activeIndex = index;
|
|
281
|
+
}
|
|
282
|
+
if (more && list && list.length && state.subActiveIndex === -1) {
|
|
283
|
+
state.subActiveIndex = 0;
|
|
284
|
+
}
|
|
285
|
+
} else {
|
|
286
|
+
api.hideSubMenu();
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
export var hideSubMenu = function hideSubMenu(_ref11) {
|
|
291
|
+
var api = _ref11.api,
|
|
292
|
+
parent = _ref11.parent,
|
|
293
|
+
state = _ref11.state;
|
|
294
|
+
return function () {
|
|
295
|
+
api.stopHideSubMenu();
|
|
296
|
+
state.showMore = false;
|
|
297
|
+
state.showPopmenu = false;
|
|
298
|
+
state.activeIndex = -1;
|
|
299
|
+
state.subActiveIndex = -1;
|
|
300
|
+
var popmenu = parent.$el.querySelector('.popmenu');
|
|
301
|
+
popmenu.style.height = 'auto';
|
|
302
|
+
popmenu.style.display = 'none';
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
export var willHideSubMenu = function willHideSubMenu(_ref12) {
|
|
306
|
+
var api = _ref12.api,
|
|
307
|
+
state = _ref12.state;
|
|
308
|
+
return function () {
|
|
309
|
+
api.stopHideSubMenu();
|
|
310
|
+
state.timer = setTimeout(function () {
|
|
311
|
+
api.hideSubMenu();
|
|
312
|
+
}, 20);
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
export var stopHideSubMenu = function stopHideSubMenu(state) {
|
|
316
|
+
return function () {
|
|
317
|
+
clearTimeout(state.timer);
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
export var setSubMenu = function setSubMenu(state) {
|
|
321
|
+
return function (value, index) {
|
|
322
|
+
state.subActiveIndex = index;
|
|
323
|
+
state.subMenu = value;
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
export var isHide = function isHide(_ref13) {
|
|
327
|
+
var parent = _ref13.parent,
|
|
328
|
+
state = _ref13.state;
|
|
329
|
+
return function (event) {
|
|
330
|
+
return !state.width || event.offsetTop >= parent.$el.offsetHeight;
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
export var hidePopmenu = function hidePopmenu(api) {
|
|
334
|
+
return function (item) {
|
|
335
|
+
if (item.url || item.route) {
|
|
336
|
+
api.setActiveMenu(api.getSelectedIndex(item.url || item.route));
|
|
337
|
+
api.hideSubMenu();
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
export var clickMenu = function clickMenu(_ref14) {
|
|
342
|
+
var api = _ref14.api,
|
|
343
|
+
props = _ref14.props;
|
|
344
|
+
return function (item, index) {
|
|
345
|
+
if (item.url || item.route) {
|
|
346
|
+
if (props.beforeSkip) {
|
|
347
|
+
props.beforeSkip(item) && api.skip(item, true);
|
|
348
|
+
} else {
|
|
349
|
+
api.skip(item);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
index !== undefined && api.setActiveMenu(index);
|
|
353
|
+
api.hidePopmenu(item);
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
export var skip = function skip(_ref15) {
|
|
357
|
+
var api = _ref15.api,
|
|
358
|
+
router = _ref15.router,
|
|
359
|
+
fields = _ref15.fields;
|
|
360
|
+
return function (item) {
|
|
361
|
+
var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
362
|
+
if (item.isFullUrl) {
|
|
363
|
+
var _ref16 = fields || {},
|
|
364
|
+
_ref16$urlField = _ref16.urlField,
|
|
365
|
+
urlField = _ref16$urlField === void 0 ? 'url' : _ref16$urlField;
|
|
366
|
+
var _router = item[urlField] || item['route'];
|
|
367
|
+
return window.open(xss.filterUrl(_router)).opener = null;
|
|
368
|
+
}
|
|
369
|
+
var address = !item.route || !flag ? api.getUrl(item).replace(/^#/, '') : item.route.replace(/^\/+/, '/').replace('#/', '');
|
|
370
|
+
if (address) {
|
|
371
|
+
return router.push(address);
|
|
372
|
+
} else {
|
|
373
|
+
return '';
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
export var getPoint = function getPoint(_ref17) {
|
|
378
|
+
var api = _ref17.api,
|
|
379
|
+
parent = _ref17.parent;
|
|
380
|
+
return function () {
|
|
381
|
+
var items = parent.$el.querySelectorAll('.menu>li');
|
|
382
|
+
var index = 0;
|
|
383
|
+
if (items) {
|
|
384
|
+
index = items.length;
|
|
385
|
+
for (var i = 0; i < items.length; i++) {
|
|
386
|
+
if (api.isHide(items[i])) {
|
|
387
|
+
index = index - (items.length - i);
|
|
388
|
+
break;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return index;
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
export var classify = function classify(_ref18) {
|
|
396
|
+
var api = _ref18.api,
|
|
397
|
+
props = _ref18.props,
|
|
398
|
+
state = _ref18.state;
|
|
399
|
+
return function () {
|
|
400
|
+
var isRetractOrFixed = /^(retract|fixed)$/.test(props.overflow);
|
|
401
|
+
var menuCount = isRetractOrFixed ? 0 : props.overflow === 'hidden' ? props.data.length : api.getPoint();
|
|
402
|
+
state.more = state.data.slice(menuCount);
|
|
403
|
+
};
|
|
404
|
+
};
|
|
405
|
+
export var calcWidth = function calcWidth(_ref19) {
|
|
406
|
+
var parent = _ref19.parent,
|
|
407
|
+
props = _ref19.props,
|
|
408
|
+
state = _ref19.state;
|
|
409
|
+
return function () {
|
|
410
|
+
var el = parent.$el;
|
|
411
|
+
var logoWidth = parent.$slots.logo ? el.querySelector('.slot-logo').offsetWidth : 0;
|
|
412
|
+
var toolbarWidth = parent.$slots.toolbar ? el.querySelector('.slot-toolbar').offsetWidth : 0;
|
|
413
|
+
var menuWidth = el.offsetWidth;
|
|
414
|
+
var width = props.overflow === 'retract' ? 0 : menuWidth - toolbarWidth - logoWidth;
|
|
415
|
+
width = width - 120 - (toolbarWidth ? 50 : 10) - (logoWidth ? 100 : 0);
|
|
416
|
+
state.width = width < 200 ? 0 : width;
|
|
417
|
+
state.popMenuTop = el.offsetHeight;
|
|
418
|
+
};
|
|
419
|
+
};
|
|
420
|
+
export var getTag = function getTag(props) {
|
|
421
|
+
return function (item) {
|
|
422
|
+
return item.url && 'a' || item.route && (!props.beforeSkip ? 'router-link' : 'a') || 'span';
|
|
423
|
+
};
|
|
424
|
+
};
|
|
425
|
+
export var getUrl = function getUrl() {
|
|
426
|
+
return function (item) {
|
|
427
|
+
return item.url || '';
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
export var getRoute = function getRoute(props) {
|
|
431
|
+
return function (item) {
|
|
432
|
+
return !props.beforeSkip ? "/".concat(item.route || '').replace(/^\/+/, '/').replace('#/', '') : '';
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
export var setActiveMenu = function setActiveMenu(state) {
|
|
436
|
+
return function (index) {
|
|
437
|
+
return state.selectedIndex = typeof index !== 'undefined' ? index : -1;
|
|
438
|
+
};
|
|
439
|
+
};
|
|
440
|
+
export var initService = function initService(_ref20) {
|
|
441
|
+
var props = _ref20.props,
|
|
442
|
+
service = _ref20.service;
|
|
443
|
+
var fetchMenuData = function fetchMenuData() {
|
|
444
|
+
return Promise.reject(new Error('[TINY Error][NavMenu] Prop fetchMenuData is not configured'));
|
|
445
|
+
};
|
|
446
|
+
var _ref21 = service || {},
|
|
447
|
+
_ref21$base = _ref21.base,
|
|
448
|
+
base = _ref21$base === void 0 ? {} : _ref21$base,
|
|
449
|
+
_ref21$setting = _ref21.setting,
|
|
450
|
+
setting = _ref21$setting === void 0 ? {} : _ref21$setting;
|
|
451
|
+
var _setting$options = setting.options,
|
|
452
|
+
options = _setting$options === void 0 ? {} : _setting$options;
|
|
453
|
+
return {
|
|
454
|
+
fetchMenuData: props.fetchMenuData || base.getMenuDataSync || fetchMenuData,
|
|
455
|
+
fields: props.fields || options.NavMenu
|
|
456
|
+
};
|
|
457
|
+
};
|
package/nav-menu/vue.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { computedIsShowMore, computedPopClass, computedSubMenus, computedMenuStyle, computedPopStyle, watchWidth, initData, mounted, unMounted, getSelectedIndex, showSetting, willHideSetting, showSubMenu, hideSubMenu, willHideSubMenu, stopHideSubMenu, setSubMenu, isHide, hidePopmenu, clickMenu, skip, getPoint, classify, calcWidth, getTag, getUrl, getRoute, setActiveMenu, initService } from './index';
|
|
2
|
+
export var api = ['state', 'getSelectedIndex', 'showSetting', 'willHideSetting', 'showSubMenu', 'hideSubMenu', 'willHideSubMenu', 'stopHideSubMenu', 'setSubMenu', 'isHide', 'hidePopmenu', 'clickMenu', 'skip', 'getPoint', 'classify', 'calcWidth', 'getTag', 'getUrl', 'getRoute', 'setActiveMenu'];
|
|
3
|
+
var initState = function initState(_ref) {
|
|
4
|
+
var reactive = _ref.reactive,
|
|
5
|
+
api = _ref.api,
|
|
6
|
+
computed = _ref.computed;
|
|
7
|
+
return reactive({
|
|
8
|
+
data: [],
|
|
9
|
+
more: [],
|
|
10
|
+
width: -1,
|
|
11
|
+
popMenuTop: 0,
|
|
12
|
+
subMenu: [],
|
|
13
|
+
showMore: false,
|
|
14
|
+
showPopmenu: false,
|
|
15
|
+
timer: null,
|
|
16
|
+
activeIndex: -1,
|
|
17
|
+
subActiveIndex: -1,
|
|
18
|
+
selectedIndex: -1,
|
|
19
|
+
isShowSetting: false,
|
|
20
|
+
marginLeft: 0,
|
|
21
|
+
isShowMore: computed(function () {
|
|
22
|
+
return api.computedIsShowMore();
|
|
23
|
+
}),
|
|
24
|
+
popClass: computed(function () {
|
|
25
|
+
return api.computedPopClass();
|
|
26
|
+
}),
|
|
27
|
+
subMenus: computed(function () {
|
|
28
|
+
return api.computedSubMenus();
|
|
29
|
+
}),
|
|
30
|
+
menuStyle: computed(function () {
|
|
31
|
+
return api.computedMenuStyle();
|
|
32
|
+
}),
|
|
33
|
+
popStyle: computed(function () {
|
|
34
|
+
return api.computedPopStyle();
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
var initApi = function initApi(_ref2) {
|
|
39
|
+
var api = _ref2.api,
|
|
40
|
+
state = _ref2.state,
|
|
41
|
+
props = _ref2.props,
|
|
42
|
+
parent = _ref2.parent,
|
|
43
|
+
fetchMenuData = _ref2.fetchMenuData,
|
|
44
|
+
fields = _ref2.fields,
|
|
45
|
+
router = _ref2.router,
|
|
46
|
+
route = _ref2.route,
|
|
47
|
+
nextTick = _ref2.nextTick;
|
|
48
|
+
Object.assign(api, {
|
|
49
|
+
state: state,
|
|
50
|
+
getUrl: getUrl(),
|
|
51
|
+
getTag: getTag(props),
|
|
52
|
+
getRoute: getRoute(props),
|
|
53
|
+
setSubMenu: setSubMenu(state),
|
|
54
|
+
isHide: isHide({
|
|
55
|
+
parent: parent,
|
|
56
|
+
state: state
|
|
57
|
+
}),
|
|
58
|
+
setActiveMenu: setActiveMenu(state),
|
|
59
|
+
willHideSetting: willHideSetting(state),
|
|
60
|
+
stopHideSubMenu: stopHideSubMenu(state),
|
|
61
|
+
calcWidth: calcWidth({
|
|
62
|
+
parent: parent,
|
|
63
|
+
props: props,
|
|
64
|
+
state: state
|
|
65
|
+
}),
|
|
66
|
+
getSelectedIndex: getSelectedIndex(state),
|
|
67
|
+
showSetting: showSetting({
|
|
68
|
+
parent: parent,
|
|
69
|
+
state: state
|
|
70
|
+
}),
|
|
71
|
+
initData: initData({
|
|
72
|
+
fetchMenuData: fetchMenuData,
|
|
73
|
+
fields: fields,
|
|
74
|
+
props: props,
|
|
75
|
+
state: state
|
|
76
|
+
}),
|
|
77
|
+
computedIsShowMore: computedIsShowMore({
|
|
78
|
+
props: props,
|
|
79
|
+
state: state
|
|
80
|
+
}),
|
|
81
|
+
computedPopClass: computedPopClass(state),
|
|
82
|
+
computedSubMenus: computedSubMenus(state),
|
|
83
|
+
computedMenuStyle: computedMenuStyle({
|
|
84
|
+
props: props,
|
|
85
|
+
state: state
|
|
86
|
+
}),
|
|
87
|
+
computedPopStyle: computedPopStyle(state),
|
|
88
|
+
skip: skip({
|
|
89
|
+
api: api,
|
|
90
|
+
router: router,
|
|
91
|
+
fields: fields
|
|
92
|
+
}),
|
|
93
|
+
hidePopmenu: hidePopmenu(api),
|
|
94
|
+
getPoint: getPoint({
|
|
95
|
+
api: api,
|
|
96
|
+
parent: parent
|
|
97
|
+
}),
|
|
98
|
+
clickMenu: clickMenu({
|
|
99
|
+
api: api,
|
|
100
|
+
props: props
|
|
101
|
+
}),
|
|
102
|
+
unMounted: unMounted({
|
|
103
|
+
api: api,
|
|
104
|
+
state: state,
|
|
105
|
+
router: router
|
|
106
|
+
}),
|
|
107
|
+
mounted: mounted({
|
|
108
|
+
api: api,
|
|
109
|
+
props: props,
|
|
110
|
+
router: router,
|
|
111
|
+
route: route,
|
|
112
|
+
state: state
|
|
113
|
+
}),
|
|
114
|
+
classify: classify({
|
|
115
|
+
api: api,
|
|
116
|
+
props: props,
|
|
117
|
+
state: state
|
|
118
|
+
}),
|
|
119
|
+
watchWidth: watchWidth({
|
|
120
|
+
api: api,
|
|
121
|
+
nextTick: nextTick
|
|
122
|
+
}),
|
|
123
|
+
willHideSubMenu: willHideSubMenu({
|
|
124
|
+
api: api,
|
|
125
|
+
state: state
|
|
126
|
+
}),
|
|
127
|
+
hideSubMenu: hideSubMenu({
|
|
128
|
+
api: api,
|
|
129
|
+
parent: parent,
|
|
130
|
+
state: state
|
|
131
|
+
}),
|
|
132
|
+
showSubMenu: showSubMenu({
|
|
133
|
+
api: api,
|
|
134
|
+
nextTick: nextTick,
|
|
135
|
+
parent: parent,
|
|
136
|
+
state: state
|
|
137
|
+
})
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
export var renderless = function renderless(props, _ref3, _ref4) {
|
|
141
|
+
var computed = _ref3.computed,
|
|
142
|
+
onMounted = _ref3.onMounted,
|
|
143
|
+
onUnmounted = _ref3.onUnmounted,
|
|
144
|
+
reactive = _ref3.reactive,
|
|
145
|
+
watch = _ref3.watch;
|
|
146
|
+
var parent = _ref4.parent,
|
|
147
|
+
nextTick = _ref4.nextTick,
|
|
148
|
+
service = _ref4.service,
|
|
149
|
+
router = _ref4.router,
|
|
150
|
+
route = _ref4.route;
|
|
151
|
+
var api = {};
|
|
152
|
+
var _initService = initService({
|
|
153
|
+
props: props,
|
|
154
|
+
service: service
|
|
155
|
+
}),
|
|
156
|
+
fetchMenuData = _initService.fetchMenuData,
|
|
157
|
+
fields = _initService.fields;
|
|
158
|
+
var state = initState({
|
|
159
|
+
reactive: reactive,
|
|
160
|
+
api: api,
|
|
161
|
+
computed: computed
|
|
162
|
+
});
|
|
163
|
+
initApi({
|
|
164
|
+
api: api,
|
|
165
|
+
state: state,
|
|
166
|
+
props: props,
|
|
167
|
+
parent: parent,
|
|
168
|
+
fetchMenuData: fetchMenuData,
|
|
169
|
+
fields: fields,
|
|
170
|
+
router: router,
|
|
171
|
+
route: route,
|
|
172
|
+
nextTick: nextTick
|
|
173
|
+
});
|
|
174
|
+
api.initData();
|
|
175
|
+
watch(function () {
|
|
176
|
+
return state.width;
|
|
177
|
+
}, api.watchWidth, {
|
|
178
|
+
deep: true,
|
|
179
|
+
immediate: true
|
|
180
|
+
});
|
|
181
|
+
watch(function () {
|
|
182
|
+
return state.data;
|
|
183
|
+
}, api.watchWidth);
|
|
184
|
+
onMounted(api.mounted);
|
|
185
|
+
onUnmounted(api.unMounted);
|
|
186
|
+
return api;
|
|
187
|
+
};
|