12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736 |
- module.exports =
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, {
- /******/ configurable: false,
- /******/ enumerable: true,
- /******/ get: getter
- /******/ });
- /******/ }
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "/dist/";
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 285);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ 0:
- /***/ (function(module, exports) {
- /* globals __VUE_SSR_CONTEXT__ */
- // IMPORTANT: Do NOT use ES2015 features in this file.
- // This module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle.
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- functionalTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier /* server only */
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- options._compiled = true
- }
- // functional template
- if (functionalTemplate) {
- options.functional = true
- }
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
- var hook
- if (moduleIdentifier) { // server build
- hook = function (context) {
- // 2.3 injection
- context =
- context || // cached call
- (this.$vnode && this.$vnode.ssrContext) || // stateful
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
- // 2.2 with runInNewContext: true
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
- context = __VUE_SSR_CONTEXT__
- }
- // inject component styles
- if (injectStyles) {
- injectStyles.call(this, context)
- }
- // register component module identifier for async chunk inferrence
- if (context && context._registeredComponents) {
- context._registeredComponents.add(moduleIdentifier)
- }
- }
- // used by ssr in case component is cached and beforeCreate
- // never gets called
- options._ssrRegister = hook
- } else if (injectStyles) {
- hook = injectStyles
- }
- if (hook) {
- var functional = options.functional
- var existing = functional
- ? options.render
- : options.beforeCreate
- if (!functional) {
- // inject component registration as beforeCreate hook
- options.beforeCreate = existing
- ? [].concat(existing, hook)
- : [hook]
- } else {
- // for template-only hot-reload because in that case the render fn doesn't
- // go through the normalizer
- options._injectStyles = hook
- // register for functioal component in vue file
- options.render = function renderWithStyleInjection (h, context) {
- hook.call(context)
- return existing(h, context)
- }
- }
- }
- return {
- esModule: esModule,
- exports: scriptExports,
- options: options
- }
- }
- /***/ }),
- /***/ 1:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/mixins/emitter");
- /***/ }),
- /***/ 14:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/locale");
- /***/ }),
- /***/ 16:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/checkbox");
- /***/ }),
- /***/ 21:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/transitions/collapse-transition");
- /***/ }),
- /***/ 285:
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(286);
- /***/ }),
- /***/ 286:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var _tree = __webpack_require__(287);
- var _tree2 = _interopRequireDefault(_tree);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- /* istanbul ignore next */
- _tree2.default.install = function (Vue) {
- Vue.component(_tree2.default.name, _tree2.default);
- };
- exports.default = _tree2.default;
- /***/ }),
- /***/ 287:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_tree_vue__ = __webpack_require__(288);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_tree_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_tree_vue__);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_bdd5d816_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_tree_vue__ = __webpack_require__(294);
- var normalizeComponent = __webpack_require__(0)
- /* script */
- /* template */
- /* template functional */
- var __vue_template_functional__ = false
- /* styles */
- var __vue_styles__ = null
- /* scopeId */
- var __vue_scopeId__ = null
- /* moduleIdentifier (server only) */
- var __vue_module_identifier__ = null
- var Component = normalizeComponent(
- __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_tree_vue___default.a,
- __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_bdd5d816_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_tree_vue__["a" /* default */],
- __vue_template_functional__,
- __vue_styles__,
- __vue_scopeId__,
- __vue_module_identifier__
- )
- /* harmony default export */ __webpack_exports__["default"] = (Component.exports);
- /***/ }),
- /***/ 288:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var _treeStore = __webpack_require__(289);
- var _treeStore2 = _interopRequireDefault(_treeStore);
- var _treeNode = __webpack_require__(291);
- var _treeNode2 = _interopRequireDefault(_treeNode);
- var _locale = __webpack_require__(14);
- var _emitter = __webpack_require__(1);
- var _emitter2 = _interopRequireDefault(_emitter);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- exports.default = {
- name: 'ElTree',
- mixins: [_emitter2.default],
- components: {
- ElTreeNode: _treeNode2.default
- },
- data: function data() {
- return {
- store: null,
- root: null,
- currentNode: null,
- treeItems: null,
- checkboxItems: []
- };
- },
- props: {
- data: {
- type: Array
- },
- emptyText: {
- type: String,
- default: function _default() {
- return (0, _locale.t)('el.tree.emptyText');
- }
- },
- nodeKey: String,
- checkStrictly: Boolean,
- defaultExpandAll: Boolean,
- expandOnClickNode: {
- type: Boolean,
- default: true
- },
- checkDescendants: {
- type: Boolean,
- default: false
- },
- autoExpandParent: {
- type: Boolean,
- default: true
- },
- defaultCheckedKeys: Array,
- defaultExpandedKeys: Array,
- renderContent: Function,
- showCheckbox: {
- type: Boolean,
- default: false
- },
- props: {
- default: function _default() {
- return {
- children: 'children',
- label: 'label',
- icon: 'icon',
- disabled: 'disabled'
- };
- }
- },
- lazy: {
- type: Boolean,
- default: false
- },
- highlightCurrent: Boolean,
- load: Function,
- filterNodeMethod: Function,
- accordion: Boolean,
- indent: {
- type: Number,
- default: 18
- }
- },
- computed: {
- children: {
- set: function set(value) {
- this.data = value;
- },
- get: function get() {
- return this.data;
- }
- },
- treeItemArray: function treeItemArray() {
- return Array.prototype.slice.call(this.treeItems);
- }
- },
- watch: {
- defaultCheckedKeys: function defaultCheckedKeys(newVal) {
- this.store.defaultCheckedKeys = newVal;
- this.store.setDefaultCheckedKey(newVal);
- },
- defaultExpandedKeys: function defaultExpandedKeys(newVal) {
- this.store.defaultExpandedKeys = newVal;
- this.store.setDefaultExpandedKeys(newVal);
- },
- data: function data(newVal) {
- this.store.setData(newVal);
- },
- checkboxItems: function checkboxItems(val) {
- Array.prototype.forEach.call(val, function (checkbox) {
- checkbox.setAttribute('tabindex', -1);
- });
- }
- },
- methods: {
- filter: function filter(value) {
- if (!this.filterNodeMethod) throw new Error('[Tree] filterNodeMethod is required when filter');
- this.store.filter(value);
- },
- getNodeKey: function getNodeKey(node, index) {
- var nodeKey = this.nodeKey;
- if (nodeKey && node) {
- return node.data[nodeKey];
- }
- return index;
- },
- getCheckedNodes: function getCheckedNodes(leafOnly) {
- return this.store.getCheckedNodes(leafOnly);
- },
- getCheckedKeys: function getCheckedKeys(leafOnly) {
- return this.store.getCheckedKeys(leafOnly);
- },
- getCurrentNode: function getCurrentNode() {
- var currentNode = this.store.getCurrentNode();
- return currentNode ? currentNode.data : null;
- },
- getCurrentKey: function getCurrentKey() {
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getCurrentKey');
- var currentNode = this.getCurrentNode();
- return currentNode ? currentNode[this.nodeKey] : null;
- },
- setCheckedNodes: function setCheckedNodes(nodes, leafOnly) {
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedNodes');
- this.store.setCheckedNodes(nodes, leafOnly);
- },
- setCheckedKeys: function setCheckedKeys(keys, leafOnly) {
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedKeys');
- this.store.setCheckedKeys(keys, leafOnly);
- },
- setChecked: function setChecked(data, checked, deep) {
- this.store.setChecked(data, checked, deep);
- },
- setCurrentNode: function setCurrentNode(node) {
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentNode');
- this.store.setUserCurrentNode(node);
- },
- setCurrentKey: function setCurrentKey(key) {
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentKey');
- this.store.setCurrentNodeKey(key);
- },
- handleNodeExpand: function handleNodeExpand(nodeData, node, instance) {
- this.broadcast('ElTreeNode', 'tree-node-expand', node);
- this.$emit('node-expand', nodeData, node, instance);
- },
- updateKeyChildren: function updateKeyChildren(key, data) {
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in updateKeyChild');
- this.store.updateChildren(key, data);
- },
- initTabindex: function initTabindex() {
- this.treeItems = this.$el.querySelectorAll('.is-focusable[role=treeitem]');
- this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
- var checkedItem = this.$el.querySelectorAll('.is-checked[role=treeitem]');
- if (checkedItem.length) {
- checkedItem[0].setAttribute('tabindex', 0);
- return;
- }
- this.treeItems[0] && this.treeItems[0].setAttribute('tabindex', 0);
- },
- handelKeydown: function handelKeydown(ev) {
- var currentItem = ev.target;
- if (currentItem.className.indexOf('el-tree-node') === -1) return;
- ev.preventDefault();
- var keyCode = ev.keyCode;
- this.treeItems = this.$el.querySelectorAll('.is-focusable[role=treeitem]');
- var currentIndex = this.treeItemArray.indexOf(currentItem);
- var nextIndex = void 0;
- if ([38, 40].indexOf(keyCode) > -1) {
- // up、down
- if (keyCode === 38) {
- // up
- nextIndex = currentIndex !== 0 ? currentIndex - 1 : 0;
- } else {
- nextIndex = currentIndex < this.treeItemArray.length - 1 ? currentIndex + 1 : 0;
- }
- this.treeItemArray[nextIndex].focus(); // 选中
- }
- var hasInput = currentItem.querySelector('[type="checkbox"]');
- if ([37, 39].indexOf(keyCode) > -1) {
- // left、right 展开
- currentItem.click(); // 选中
- }
- if ([13, 32].indexOf(keyCode) > -1) {
- // space enter选中checkbox
- if (hasInput) {
- hasInput.click();
- }
- }
- }
- },
- created: function created() {
- this.isTree = true;
- this.store = new _treeStore2.default({
- key: this.nodeKey,
- data: this.data,
- lazy: this.lazy,
- props: this.props,
- load: this.load,
- currentNodeKey: this.currentNodeKey,
- checkStrictly: this.checkStrictly,
- checkDescendants: this.checkDescendants,
- defaultCheckedKeys: this.defaultCheckedKeys,
- defaultExpandedKeys: this.defaultExpandedKeys,
- autoExpandParent: this.autoExpandParent,
- defaultExpandAll: this.defaultExpandAll,
- filterNodeMethod: this.filterNodeMethod
- });
- this.root = this.store.root;
- },
- mounted: function mounted() {
- this.initTabindex();
- this.$el.addEventListener('keydown', this.handelKeydown);
- },
- updated: function updated() {
- this.treeItems = this.$el.querySelectorAll('[role=treeitem]');
- this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
- }
- };
- /***/ }),
- /***/ 289:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
- var _node = __webpack_require__(290);
- var _node2 = _interopRequireDefault(_node);
- var _util = __webpack_require__(48);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var TreeStore = function () {
- function TreeStore(options) {
- var _this = this;
- _classCallCheck(this, TreeStore);
- this.currentNode = null;
- this.currentNodeKey = null;
- for (var option in options) {
- if (options.hasOwnProperty(option)) {
- this[option] = options[option];
- }
- }
- this.nodesMap = {};
- this.root = new _node2.default({
- data: this.data,
- store: this
- });
- if (this.lazy && this.load) {
- var loadFn = this.load;
- loadFn(this.root, function (data) {
- _this.root.doCreateChildren(data);
- _this._initDefaultCheckedNodes();
- });
- } else {
- this._initDefaultCheckedNodes();
- }
- }
- TreeStore.prototype.filter = function filter(value) {
- var filterNodeMethod = this.filterNodeMethod;
- var traverse = function traverse(node) {
- var childNodes = node.root ? node.root.childNodes : node.childNodes;
- childNodes.forEach(function (child) {
- child.visible = filterNodeMethod.call(child, value, child.data, child);
- traverse(child);
- });
- if (!node.visible && childNodes.length) {
- var allHidden = true;
- childNodes.forEach(function (child) {
- if (child.visible) allHidden = false;
- });
- if (node.root) {
- node.root.visible = allHidden === false;
- } else {
- node.visible = allHidden === false;
- }
- }
- if (!value) return;
- if (node.visible && !node.isLeaf) node.expand();
- };
- traverse(this);
- };
- TreeStore.prototype.setData = function setData(newVal) {
- var instanceChanged = newVal !== this.root.data;
- this.root.setData(newVal);
- if (instanceChanged) {
- this._initDefaultCheckedNodes();
- }
- };
- TreeStore.prototype.getNode = function getNode(data) {
- var key = (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object' ? data : (0, _util.getNodeKey)(this.key, data);
- return this.nodesMap[key];
- };
- TreeStore.prototype.insertBefore = function insertBefore(data, refData) {
- var refNode = this.getNode(refData);
- refNode.parent.insertBefore({ data: data }, refNode);
- };
- TreeStore.prototype.insertAfter = function insertAfter(data, refData) {
- var refNode = this.getNode(refData);
- refNode.parent.insertAfter({ data: data }, refNode);
- };
- TreeStore.prototype.remove = function remove(data) {
- var node = this.getNode(data);
- if (node) {
- node.parent.removeChild(node);
- }
- };
- TreeStore.prototype.append = function append(data, parentData) {
- var parentNode = parentData ? this.getNode(parentData) : this.root;
- if (parentNode) {
- parentNode.insertChild({ data: data });
- }
- };
- TreeStore.prototype._initDefaultCheckedNodes = function _initDefaultCheckedNodes() {
- var _this2 = this;
- var defaultCheckedKeys = this.defaultCheckedKeys || [];
- var nodesMap = this.nodesMap;
- defaultCheckedKeys.forEach(function (checkedKey) {
- var node = nodesMap[checkedKey];
- if (node) {
- node.setChecked(true, !_this2.checkStrictly);
- }
- });
- };
- TreeStore.prototype._initDefaultCheckedNode = function _initDefaultCheckedNode(node) {
- var defaultCheckedKeys = this.defaultCheckedKeys || [];
- if (defaultCheckedKeys.indexOf(node.key) !== -1) {
- node.setChecked(true, !this.checkStrictly);
- }
- };
- TreeStore.prototype.setDefaultCheckedKey = function setDefaultCheckedKey(newVal) {
- if (newVal !== this.defaultCheckedKeys) {
- this.defaultCheckedKeys = newVal;
- this._initDefaultCheckedNodes();
- }
- };
- TreeStore.prototype.registerNode = function registerNode(node) {
- var key = this.key;
- if (!key || !node || !node.data) return;
- var nodeKey = node.key;
- if (nodeKey !== undefined) this.nodesMap[node.key] = node;
- };
- TreeStore.prototype.deregisterNode = function deregisterNode(node) {
- var key = this.key;
- if (!key || !node || !node.data) return;
- var childNodes = node.childNodes;
- for (var i = 0, j = childNodes.length; i < j; i++) {
- var child = childNodes[i];
- this.deregisterNode(child);
- }
- delete this.nodesMap[node.key];
- };
- TreeStore.prototype.getCheckedNodes = function getCheckedNodes() {
- var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var checkedNodes = [];
- var traverse = function traverse(node) {
- var childNodes = node.root ? node.root.childNodes : node.childNodes;
- childNodes.forEach(function (child) {
- if (!leafOnly && child.checked || leafOnly && child.isLeaf && child.checked) {
- checkedNodes.push(child.data);
- }
- traverse(child);
- });
- };
- traverse(this);
- return checkedNodes;
- };
- TreeStore.prototype.getCheckedKeys = function getCheckedKeys() {
- var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var key = this.key;
- var allNodes = this._getAllNodes();
- var keys = [];
- allNodes.forEach(function (node) {
- if (!leafOnly || leafOnly && node.isLeaf) {
- if (node.checked) {
- keys.push((node.data || {})[key]);
- }
- }
- });
- return keys;
- };
- TreeStore.prototype._getAllNodes = function _getAllNodes() {
- var allNodes = [];
- var nodesMap = this.nodesMap;
- for (var nodeKey in nodesMap) {
- if (nodesMap.hasOwnProperty(nodeKey)) {
- allNodes.push(nodesMap[nodeKey]);
- }
- }
- return allNodes;
- };
- TreeStore.prototype.updateChildren = function updateChildren(key, data) {
- var node = this.nodesMap[key];
- if (!node) return;
- var childNodes = node.childNodes;
- for (var i = childNodes.length - 1; i >= 0; i--) {
- var child = childNodes[i];
- this.remove(child.data);
- }
- for (var _i = 0, j = data.length; _i < j; _i++) {
- var _child = data[_i];
- this.append(_child, node.data);
- }
- };
- TreeStore.prototype._setCheckedKeys = function _setCheckedKeys(key) {
- var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var checkedKeys = arguments[2];
- var allNodes = this._getAllNodes().sort(function (a, b) {
- return b.level - a.level;
- });
- var cache = Object.create(null);
- var keys = Object.keys(checkedKeys);
- allNodes.forEach(function (node) {
- return node.setChecked(false, false);
- });
- for (var i = 0, j = allNodes.length; i < j; i++) {
- var node = allNodes[i];
- var nodeKey = node.data[key].toString();
- var checked = keys.indexOf(nodeKey) > -1;
- if (!checked) {
- if (node.checked && !cache[nodeKey]) {
- node.setChecked(false, false);
- }
- continue;
- }
- var parent = node.parent;
- while (parent && parent.level > 0) {
- cache[parent.data[key]] = true;
- parent = parent.parent;
- }
- if (node.isLeaf || this.checkStrictly) {
- node.setChecked(true, false);
- continue;
- }
- node.setChecked(true, true);
- if (leafOnly) {
- (function () {
- node.setChecked(false, false);
- var traverse = function traverse(node) {
- var childNodes = node.childNodes;
- childNodes.forEach(function (child) {
- if (!child.isLeaf) {
- child.setChecked(false, false);
- }
- traverse(child);
- });
- };
- traverse(node);
- })();
- }
- }
- };
- TreeStore.prototype.setCheckedNodes = function setCheckedNodes(array) {
- var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var key = this.key;
- var checkedKeys = {};
- array.forEach(function (item) {
- checkedKeys[(item || {})[key]] = true;
- });
- this._setCheckedKeys(key, leafOnly, checkedKeys);
- };
- TreeStore.prototype.setCheckedKeys = function setCheckedKeys(keys) {
- var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- this.defaultCheckedKeys = keys;
- var key = this.key;
- var checkedKeys = {};
- keys.forEach(function (key) {
- checkedKeys[key] = true;
- });
- this._setCheckedKeys(key, leafOnly, checkedKeys);
- };
- TreeStore.prototype.setDefaultExpandedKeys = function setDefaultExpandedKeys(keys) {
- var _this3 = this;
- keys = keys || [];
- this.defaultExpandedKeys = keys;
- keys.forEach(function (key) {
- var node = _this3.getNode(key);
- if (node) node.expand(null, _this3.autoExpandParent);
- });
- };
- TreeStore.prototype.setChecked = function setChecked(data, checked, deep) {
- var node = this.getNode(data);
- if (node) {
- node.setChecked(!!checked, deep);
- }
- };
- TreeStore.prototype.getCurrentNode = function getCurrentNode() {
- return this.currentNode;
- };
- TreeStore.prototype.setCurrentNode = function setCurrentNode(node) {
- this.currentNode = node;
- };
- TreeStore.prototype.setUserCurrentNode = function setUserCurrentNode(node) {
- var key = node[this.key];
- var currNode = this.nodesMap[key];
- this.setCurrentNode(currNode);
- };
- TreeStore.prototype.setCurrentNodeKey = function setCurrentNodeKey(key) {
- var node = this.getNode(key);
- if (node) {
- this.currentNode = node;
- }
- };
- return TreeStore;
- }();
- exports.default = TreeStore;
- ;
- /***/ }),
- /***/ 290:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- exports.getChildState = undefined;
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- var _merge = __webpack_require__(9);
- var _merge2 = _interopRequireDefault(_merge);
- var _util = __webpack_require__(48);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var getChildState = exports.getChildState = function getChildState(node) {
- var all = true;
- var none = true;
- var allWithoutDisable = true;
- for (var i = 0, j = node.length; i < j; i++) {
- var n = node[i];
- if (n.checked !== true || n.indeterminate) {
- all = false;
- if (!n.disabled) {
- allWithoutDisable = false;
- }
- }
- if (n.checked !== false || n.indeterminate) {
- none = false;
- }
- }
- return { all: all, none: none, allWithoutDisable: allWithoutDisable, half: !all && !none };
- };
- var reInitChecked = function reInitChecked(node) {
- if (node.childNodes.length === 0) return;
- var _getChildState = getChildState(node.childNodes),
- all = _getChildState.all,
- none = _getChildState.none,
- half = _getChildState.half;
- if (all) {
- node.checked = true;
- node.indeterminate = false;
- } else if (half) {
- node.checked = false;
- node.indeterminate = true;
- } else if (none) {
- node.checked = false;
- node.indeterminate = false;
- }
- var parent = node.parent;
- if (!parent || parent.level === 0) return;
- if (!node.store.checkStrictly) {
- reInitChecked(parent);
- }
- };
- var getPropertyFromData = function getPropertyFromData(node, prop) {
- var props = node.store.props;
- var data = node.data || {};
- var config = props[prop];
- if (typeof config === 'function') {
- return config(data, node);
- } else if (typeof config === 'string') {
- return data[config];
- } else if (typeof config === 'undefined') {
- var dataProp = data[prop];
- return dataProp === undefined ? '' : dataProp;
- }
- };
- var nodeIdSeed = 0;
- var Node = function () {
- function Node(options) {
- _classCallCheck(this, Node);
- this.id = nodeIdSeed++;
- this.text = null;
- this.checked = false;
- this.indeterminate = false;
- this.data = null;
- this.expanded = false;
- this.parent = null;
- this.visible = true;
- for (var name in options) {
- if (options.hasOwnProperty(name)) {
- this[name] = options[name];
- }
- }
- // internal
- this.level = 0;
- this.loaded = false;
- this.childNodes = [];
- this.loading = false;
- if (this.parent) {
- this.level = this.parent.level + 1;
- }
- var store = this.store;
- if (!store) {
- throw new Error('[Node]store is required!');
- }
- store.registerNode(this);
- var props = store.props;
- if (props && typeof props.isLeaf !== 'undefined') {
- var isLeaf = getPropertyFromData(this, 'isLeaf');
- if (typeof isLeaf === 'boolean') {
- this.isLeafByUser = isLeaf;
- }
- }
- if (store.lazy !== true && this.data) {
- this.setData(this.data);
- if (store.defaultExpandAll) {
- this.expanded = true;
- }
- } else if (this.level > 0 && store.lazy && store.defaultExpandAll) {
- this.expand();
- }
- if (!this.data) return;
- var defaultExpandedKeys = store.defaultExpandedKeys;
- var key = store.key;
- if (key && defaultExpandedKeys && defaultExpandedKeys.indexOf(this.key) !== -1) {
- this.expand(null, store.autoExpandParent);
- }
- if (key && store.currentNodeKey !== undefined && this.key === store.currentNodeKey) {
- store.currentNode = this;
- }
- if (store.lazy) {
- store._initDefaultCheckedNode(this);
- }
- this.updateLeafState();
- }
- Node.prototype.setData = function setData(data) {
- if (!Array.isArray(data)) {
- (0, _util.markNodeData)(this, data);
- }
- this.data = data;
- this.childNodes = [];
- var children = void 0;
- if (this.level === 0 && this.data instanceof Array) {
- children = this.data;
- } else {
- children = getPropertyFromData(this, 'children') || [];
- }
- for (var i = 0, j = children.length; i < j; i++) {
- this.insertChild({ data: children[i] });
- }
- };
- Node.prototype.insertChild = function insertChild(child, index) {
- if (!child) throw new Error('insertChild error: child is required.');
- if (!(child instanceof Node)) {
- (0, _merge2.default)(child, {
- parent: this,
- store: this.store
- });
- child = new Node(child);
- }
- child.level = this.level + 1;
- if (typeof index === 'undefined' || index < 0) {
- this.childNodes.push(child);
- } else {
- this.childNodes.splice(index, 0, child);
- }
- this.updateLeafState();
- };
- Node.prototype.insertBefore = function insertBefore(child, ref) {
- var index = void 0;
- if (ref) {
- index = this.childNodes.indexOf(ref);
- }
- this.insertChild(child, index);
- };
- Node.prototype.insertAfter = function insertAfter(child, ref) {
- var index = void 0;
- if (ref) {
- index = this.childNodes.indexOf(ref);
- if (index !== -1) index += 1;
- }
- this.insertChild(child, index);
- };
- Node.prototype.removeChild = function removeChild(child) {
- var index = this.childNodes.indexOf(child);
- if (index > -1) {
- this.store && this.store.deregisterNode(child);
- child.parent = null;
- this.childNodes.splice(index, 1);
- }
- this.updateLeafState();
- };
- Node.prototype.removeChildByData = function removeChildByData(data) {
- var targetNode = null;
- this.childNodes.forEach(function (node) {
- if (node.data === data) {
- targetNode = node;
- }
- });
- if (targetNode) {
- this.removeChild(targetNode);
- }
- };
- Node.prototype.expand = function expand(callback, expandParent) {
- var _this = this;
- var done = function done() {
- if (expandParent) {
- var parent = _this.parent;
- while (parent.level > 0) {
- parent.expanded = true;
- parent = parent.parent;
- }
- }
- _this.expanded = true;
- if (callback) callback();
- };
- if (this.shouldLoadData()) {
- this.loadData(function (data) {
- if (data instanceof Array) {
- if (_this.checked) {
- _this.setChecked(true, true);
- } else {
- reInitChecked(_this);
- }
- done();
- }
- });
- } else {
- done();
- }
- };
- Node.prototype.doCreateChildren = function doCreateChildren(array) {
- var _this2 = this;
- var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- array.forEach(function (item) {
- _this2.insertChild((0, _merge2.default)({ data: item }, defaultProps));
- });
- };
- Node.prototype.collapse = function collapse() {
- this.expanded = false;
- };
- Node.prototype.shouldLoadData = function shouldLoadData() {
- return this.store.lazy === true && this.store.load && !this.loaded;
- };
- Node.prototype.updateLeafState = function updateLeafState() {
- if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== 'undefined') {
- this.isLeaf = this.isLeafByUser;
- return;
- }
- var childNodes = this.childNodes;
- if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
- this.isLeaf = !childNodes || childNodes.length === 0;
- return;
- }
- this.isLeaf = false;
- };
- Node.prototype.setChecked = function setChecked(value, deep, recursion, passValue) {
- var _this3 = this;
- this.indeterminate = value === 'half';
- this.checked = value === true;
- if (this.store.checkStrictly) return;
- if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
- var _ret = function () {
- var _getChildState2 = getChildState(_this3.childNodes),
- all = _getChildState2.all,
- allWithoutDisable = _getChildState2.allWithoutDisable;
- if (!_this3.isLeaf && !all && allWithoutDisable) {
- _this3.checked = false;
- value = false;
- }
- var handleDescendants = function handleDescendants() {
- if (deep) {
- var childNodes = _this3.childNodes;
- for (var i = 0, j = childNodes.length; i < j; i++) {
- var child = childNodes[i];
- passValue = passValue || value !== false;
- var isCheck = child.disabled ? child.checked : passValue;
- child.setChecked(isCheck, deep, true, passValue);
- }
- var _getChildState3 = getChildState(childNodes),
- half = _getChildState3.half,
- _all = _getChildState3.all;
- if (!_all) {
- _this3.checked = _all;
- _this3.indeterminate = half;
- }
- }
- };
- if (_this3.shouldLoadData()) {
- // Only work on lazy load data.
- _this3.loadData(function () {
- handleDescendants();
- reInitChecked(_this3);
- }, {
- checked: value !== false
- });
- return {
- v: void 0
- };
- } else {
- handleDescendants();
- }
- }();
- if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
- }
- var parent = this.parent;
- if (!parent || parent.level === 0) return;
- if (!recursion) {
- reInitChecked(parent);
- }
- };
- Node.prototype.getChildren = function getChildren() {
- // this is data
- var data = this.data;
- if (!data) return null;
- var props = this.store.props;
- var children = 'children';
- if (props) {
- children = props.children || 'children';
- }
- if (data[children] === undefined) {
- data[children] = null;
- }
- return data[children];
- };
- Node.prototype.updateChildren = function updateChildren() {
- var _this4 = this;
- var newData = this.getChildren() || [];
- var oldData = this.childNodes.map(function (node) {
- return node.data;
- });
- var newDataMap = {};
- var newNodes = [];
- newData.forEach(function (item, index) {
- if (item[_util.NODE_KEY]) {
- newDataMap[item[_util.NODE_KEY]] = { index: index, data: item };
- } else {
- newNodes.push({ index: index, data: item });
- }
- });
- oldData.forEach(function (item) {
- if (!newDataMap[item[_util.NODE_KEY]]) _this4.removeChildByData(item);
- });
- newNodes.forEach(function (_ref) {
- var index = _ref.index,
- data = _ref.data;
- _this4.insertChild({ data: data }, index);
- });
- this.updateLeafState();
- };
- Node.prototype.loadData = function loadData(callback) {
- var _this5 = this;
- var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
- this.loading = true;
- var resolve = function resolve(children) {
- _this5.loaded = true;
- _this5.loading = false;
- _this5.childNodes = [];
- _this5.doCreateChildren(children, defaultProps);
- _this5.updateLeafState();
- if (callback) {
- callback.call(_this5, children);
- }
- };
- this.store.load(this, resolve);
- } else {
- if (callback) {
- callback.call(this);
- }
- }
- };
- _createClass(Node, [{
- key: 'label',
- get: function get() {
- return getPropertyFromData(this, 'label');
- }
- }, {
- key: 'icon',
- get: function get() {
- return getPropertyFromData(this, 'icon');
- }
- }, {
- key: 'key',
- get: function get() {
- var nodeKey = this.store.key;
- if (this.data) return this.data[nodeKey];
- return null;
- }
- }, {
- key: 'disabled',
- get: function get() {
- return getPropertyFromData(this, 'disabled');
- }
- }]);
- return Node;
- }();
- exports.default = Node;
- /***/ }),
- /***/ 291:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_tree_node_vue__ = __webpack_require__(292);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_tree_node_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_tree_node_vue__);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_751ff8ec_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_tree_node_vue__ = __webpack_require__(293);
- var normalizeComponent = __webpack_require__(0)
- /* script */
- /* template */
- /* template functional */
- var __vue_template_functional__ = false
- /* styles */
- var __vue_styles__ = null
- /* scopeId */
- var __vue_scopeId__ = null
- /* moduleIdentifier (server only) */
- var __vue_module_identifier__ = null
- var Component = normalizeComponent(
- __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_tree_node_vue___default.a,
- __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_751ff8ec_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_tree_node_vue__["a" /* default */],
- __vue_template_functional__,
- __vue_styles__,
- __vue_scopeId__,
- __vue_module_identifier__
- )
- /* harmony default export */ __webpack_exports__["default"] = (Component.exports);
- /***/ }),
- /***/ 292:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var _collapseTransition = __webpack_require__(21);
- var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
- var _checkbox = __webpack_require__(16);
- var _checkbox2 = _interopRequireDefault(_checkbox);
- var _emitter = __webpack_require__(1);
- var _emitter2 = _interopRequireDefault(_emitter);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = {
- name: 'ElTreeNode',
- componentName: 'ElTreeNode',
- mixins: [_emitter2.default],
- props: {
- node: {
- default: function _default() {
- return {};
- }
- },
- props: {},
- renderContent: Function
- },
- components: {
- ElCollapseTransition: _collapseTransition2.default,
- ElCheckbox: _checkbox2.default,
- NodeContent: {
- props: {
- node: {
- required: true
- }
- },
- render: function render(h) {
- var parent = this.$parent;
- var node = this.node;
- var data = node.data;
- var store = node.store;
- return parent.renderContent ? parent.renderContent.call(parent._renderProxy, h, { _self: parent.tree.$vnode.context, node: node, data: data, store: store }) : h(
- 'span',
- { 'class': 'el-tree-node__label' },
- [this.node.label]
- );
- }
- }
- },
- data: function data() {
- return {
- tree: null,
- expanded: false,
- childNodeRendered: false,
- showCheckbox: false,
- oldChecked: null,
- oldIndeterminate: null
- };
- },
- watch: {
- 'node.indeterminate': function nodeIndeterminate(val) {
- this.handleSelectChange(this.node.checked, val);
- },
- 'node.checked': function nodeChecked(val) {
- this.handleSelectChange(val, this.node.indeterminate);
- },
- 'node.expanded': function nodeExpanded(val) {
- var _this = this;
- this.$nextTick(function () {
- return _this.expanded = val;
- });
- if (val) {
- this.childNodeRendered = true;
- }
- }
- },
- methods: {
- getNodeKey: function getNodeKey(node, index) {
- var nodeKey = this.tree.nodeKey;
- if (nodeKey && node) {
- return node.data[nodeKey];
- }
- return index;
- },
- handleSelectChange: function handleSelectChange(checked, indeterminate) {
- if (this.oldChecked !== checked && this.oldIndeterminate !== indeterminate) {
- this.tree.$emit('check-change', this.node.data, checked, indeterminate);
- }
- this.oldChecked = checked;
- this.indeterminate = indeterminate;
- },
- handleClick: function handleClick() {
- var store = this.tree.store;
- store.setCurrentNode(this.node);
- this.tree.$emit('current-change', store.currentNode ? store.currentNode.data : null, store.currentNode);
- this.tree.currentNode = this;
- if (this.tree.expandOnClickNode) {
- this.handleExpandIconClick();
- }
- this.tree.$emit('node-click', this.node.data, this.node, this);
- },
- handleExpandIconClick: function handleExpandIconClick() {
- if (this.node.isLeaf) return;
- if (this.expanded) {
- this.tree.$emit('node-collapse', this.node.data, this.node, this);
- this.node.collapse();
- } else {
- this.node.expand();
- this.$emit('node-expand', this.node.data, this.node, this);
- }
- },
- handleCheckChange: function handleCheckChange(value, ev) {
- this.node.setChecked(ev.target.checked, !this.tree.checkStrictly);
- },
- handleChildNodeExpand: function handleChildNodeExpand(nodeData, node, instance) {
- this.broadcast('ElTreeNode', 'tree-node-expand', node);
- this.tree.$emit('node-expand', nodeData, node, instance);
- }
- },
- created: function created() {
- var _this2 = this;
- var parent = this.$parent;
- if (parent.isTree) {
- this.tree = parent;
- } else {
- this.tree = parent.tree;
- }
- var tree = this.tree;
- if (!tree) {
- console.warn('Can not find node\'s tree.');
- }
- var props = tree.props || {};
- var childrenKey = props['children'] || 'children';
- this.$watch('node.data.' + childrenKey, function () {
- _this2.node.updateChildren();
- });
- this.showCheckbox = tree.showCheckbox;
- if (this.node.expanded) {
- this.expanded = true;
- this.childNodeRendered = true;
- }
- if (this.tree.accordion) {
- this.$on('tree-node-expand', function (node) {
- if (_this2.node !== node) {
- _this2.node.collapse();
- }
- });
- }
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- /***/ }),
- /***/ 293:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.node.visible),expression:"node.visible"}],staticClass:"el-tree-node",class:{
- 'is-expanded': _vm.expanded,
- 'is-current': _vm.tree.store.currentNode === _vm.node,
- 'is-hidden': !_vm.node.visible,
- 'is-focusable': !_vm.node.disabled,
- 'is-checked': !_vm.node.disabled && _vm.node.checked
- },attrs:{"role":"treeitem","tabindex":"-1","aria-expanded":_vm.expanded,"aria-disabled":_vm.node.disabled,"aria-checked":_vm.node.checked},on:{"click":function($event){$event.stopPropagation();_vm.handleClick($event)}}},[_c('div',{staticClass:"el-tree-node__content",style:({ 'padding-left': (_vm.node.level - 1) * _vm.tree.indent + 'px' })},[_c('span',{staticClass:"el-tree-node__expand-icon el-icon-caret-right",class:{ 'is-leaf': _vm.node.isLeaf, expanded: !_vm.node.isLeaf && _vm.expanded },on:{"click":function($event){$event.stopPropagation();_vm.handleExpandIconClick($event)}}}),(_vm.showCheckbox)?_c('el-checkbox',{attrs:{"indeterminate":_vm.node.indeterminate,"disabled":!!_vm.node.disabled},on:{"change":_vm.handleCheckChange},nativeOn:{"click":function($event){$event.stopPropagation();}},model:{value:(_vm.node.checked),callback:function ($$v) {_vm.$set(_vm.node, "checked", $$v)},expression:"node.checked"}}):_vm._e(),(_vm.node.loading)?_c('span',{staticClass:"el-tree-node__loading-icon el-icon-loading"}):_vm._e(),_c('node-content',{attrs:{"node":_vm.node}})],1),_c('el-collapse-transition',[(_vm.childNodeRendered)?_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.expanded),expression:"expanded"}],staticClass:"el-tree-node__children",attrs:{"role":"group","aria-expanded":_vm.expanded}},_vm._l((_vm.node.childNodes),function(child){return _c('el-tree-node',{key:_vm.getNodeKey(child),attrs:{"render-content":_vm.renderContent,"node":child},on:{"node-expand":_vm.handleChildNodeExpand}})})):_vm._e()])],1)}
- var staticRenderFns = []
- var esExports = { render: render, staticRenderFns: staticRenderFns }
- /* harmony default export */ __webpack_exports__["a"] = (esExports);
- /***/ }),
- /***/ 294:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"el-tree",class:{ 'el-tree--highlight-current': _vm.highlightCurrent },attrs:{"role":"tree"}},[_vm._l((_vm.root.childNodes),function(child){return _c('el-tree-node',{key:_vm.getNodeKey(child),attrs:{"node":child,"props":_vm.props,"render-content":_vm.renderContent},on:{"node-expand":_vm.handleNodeExpand}})}),(!_vm.root.childNodes || _vm.root.childNodes.length === 0)?_c('div',{staticClass:"el-tree__empty-block"},[_c('span',{staticClass:"el-tree__empty-text"},[_vm._v(_vm._s(_vm.emptyText))])]):_vm._e()],2)}
- var staticRenderFns = []
- var esExports = { render: render, staticRenderFns: staticRenderFns }
- /* harmony default export */ __webpack_exports__["a"] = (esExports);
- /***/ }),
- /***/ 48:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var NODE_KEY = exports.NODE_KEY = '$treeNodeId';
- var markNodeData = exports.markNodeData = function markNodeData(node, data) {
- if (data[NODE_KEY]) return;
- Object.defineProperty(data, NODE_KEY, {
- value: node.id,
- enumerable: false,
- configurable: false,
- writable: false
- });
- };
- var getNodeKey = exports.getNodeKey = function getNodeKey(key, data) {
- if (!key) return data[NODE_KEY];
- return data[key];
- };
- /***/ }),
- /***/ 9:
- /***/ (function(module, exports) {
- module.exports = require("element-ui/lib/utils/merge");
- /***/ })
- /******/ });
|