element-ui-for-gov
Advanced tools
Comparing version 0.2.17 to 0.2.18
@@ -0,0 +0,0 @@ module.exports = |
@@ -0,0 +0,0 @@ ## 自定义字体 |
@@ -276,7 +276,7 @@ module.exports = | ||
"default-expanded-keys": _vm.defaultExpandedKeys, | ||
"default-checked-keys": _vm.defaultCheckedKeys, | ||
"default-checked-keys": _vm.myDefaultCheckedKeys, | ||
"show-checkbox": _vm.showCheckbox, | ||
"node-key": _vm.uniqueId, | ||
lazy: _vm.lazy, | ||
load: _vm.load, | ||
load: _vm.loadAsyncData, | ||
props: { | ||
@@ -577,6 +577,3 @@ label: _vm.showName, | ||
defaultCheckedKeys: { | ||
type: Array, | ||
default: function _default() { | ||
return []; | ||
} | ||
type: Array | ||
}, | ||
@@ -616,2 +613,5 @@ getLeafOnly: { | ||
} | ||
}, | ||
defaultCheckedNodes: { | ||
type: Array | ||
} | ||
@@ -626,17 +626,55 @@ }, | ||
currentNodes: [], | ||
setRadioDefault: false | ||
setRadioDefault: false, | ||
myDefaultCheckedKeys: [], | ||
nodeMap: {} | ||
}; | ||
}, | ||
mounted: function mounted() { | ||
var _this = this; | ||
this.$nextTick(function () { | ||
_this.initDefaultCheck(); | ||
}); | ||
}, | ||
methods: { | ||
asyncChangeCurrentNodes: function asyncChangeCurrentNodes() { | ||
var _this = this; | ||
methods: { | ||
if (this.lazy) { | ||
var unLoadCheckedNodes = []; | ||
var treeCheckedNodes = this.getNodes(); | ||
if (this.currentNodes && this.currentNodes.length) { | ||
this.currentNodes.forEach(function (node) { | ||
if (!_this.nodeMap[node[_this.uniqueId]]) { | ||
unLoadCheckedNodes.push(node); | ||
} | ||
}); | ||
} | ||
this.currentNodes = treeCheckedNodes.concat(unLoadCheckedNodes); | ||
} else { | ||
this.currentNodes = this.getNodes(); | ||
} | ||
}, | ||
_register: function _register(node) { | ||
var _this2 = this; | ||
if (node[this.uniqueId]) { | ||
this.nodeMap[node[this.uniqueId]] = node; | ||
} | ||
if (node[this.children] && node[this.children].length) { | ||
node[this.children].forEach(function (cNode) { | ||
_this2._register(cNode); | ||
}); | ||
} | ||
}, | ||
loadAsyncData: function loadAsyncData(node, resolve) { | ||
var _this3 = this; | ||
this.load(node, function (data) { | ||
if (data && data.length) { | ||
data.forEach(function (dNode) { | ||
_this3._register(dNode); | ||
}); | ||
} | ||
resolve(data); | ||
}); | ||
}, | ||
initDefaultCheck: function initDefaultCheck() { | ||
if (!this.showCheckbox) { | ||
this.radio = this.defaultCheckedKeys[0]; | ||
this.radio = this.myDefaultCheckedKeys[0]; | ||
var node = this.findNode(this.radio, this.data || []) || {}; | ||
@@ -651,2 +689,17 @@ this.radioNode = node; | ||
}, | ||
initDefaultCheckedNodes: function initDefaultCheckedNodes() { | ||
var _this4 = this; | ||
if (this.defaultCheckedNodes && this.defaultCheckedNodes.length) { | ||
this.currentNodes = this.defaultCheckedNodes; | ||
var keys = this.defaultCheckedNodes.map(function (node) { | ||
return node[_this4.uniqueId]; | ||
}); | ||
this.myDefaultCheckedKeys = keys; | ||
if (this.radio) { | ||
this.radio = this.defaultCheckedNodes[0][this.uniqueId]; | ||
this.radioNode = this.defaultCheckedNodes[0]; | ||
} | ||
} | ||
}, | ||
stopRadio: function stopRadio(e) { | ||
@@ -656,3 +709,3 @@ e.stopPropagation(); | ||
renderWrapContent: function renderWrapContent() { | ||
var _this2 = this; | ||
var _this5 = this; | ||
@@ -670,11 +723,11 @@ var h = this.$createElement; | ||
{ 'class': 'wrap-tree-node' }, | ||
[!_this2.showCheckbox && h(radio_default.a, { | ||
[!_this5.showCheckbox && h(radio_default.a, { | ||
nativeOn: { | ||
'click': _this2.stopRadio | ||
'click': _this5.stopRadio | ||
}, | ||
attrs: { value: _this2.radio, label: data[_this2.uniqueId], disabled: node.disabled === true }, | ||
attrs: { value: _this5.radio, label: data[_this5.uniqueId], disabled: node.disabled === true }, | ||
on: { | ||
'input': _this2.$_handleRadio | ||
'input': _this5.$_handleRadio | ||
} | ||
}), _this2.renderContent(h, { node: node, data: data, store: store })] | ||
}), _this5.renderContent(h, { node: node, data: data, store: store })] | ||
); | ||
@@ -691,9 +744,9 @@ }; | ||
{ 'class': 'wrap-tree-node' }, | ||
[!_this2.showCheckbox && h(radio_default.a, { | ||
[!_this5.showCheckbox && h(radio_default.a, { | ||
nativeOn: { | ||
'click': _this2.stopRadio | ||
'click': _this5.stopRadio | ||
}, | ||
attrs: { value: _this2.radio, label: data[_this2.uniqueId], disabled: node.disabled === true }, | ||
attrs: { value: _this5.radio, label: data[_this5.uniqueId], disabled: node.disabled === true }, | ||
on: { | ||
'input': _this2.$_handleRadio | ||
'input': _this5.$_handleRadio | ||
} | ||
@@ -723,2 +776,5 @@ }), h('span', { 'class': 'el-icon-folder wrap-tree-node__icon' }), h('span', [node.label])] | ||
}, | ||
getCheckedNodes: function getCheckedNodes() { | ||
return this.currentNodes; | ||
}, | ||
filterNode: function filterNode(value, data) { | ||
@@ -732,3 +788,3 @@ if (!value) return true; | ||
} else { | ||
this.currentNodes = this.getNodes(); | ||
this.asyncChangeCurrentNodes(); | ||
} | ||
@@ -755,2 +811,12 @@ | ||
} else { | ||
if (this.myDefaultCheckedKeys && this.myDefaultCheckedKeys.length) { | ||
for (var i = 0; i < this.myDefaultCheckedKeys.length; i++) { | ||
if (this.myDefaultCheckedKeys[i] === node[this.uniqueId]) { | ||
var arr = this.myDefaultCheckedKeys; | ||
arr.splice(i, 1); | ||
this.myDefaultCheckedKeys = arr; | ||
break; | ||
} | ||
} | ||
} | ||
this.$refs.tree && this.$refs.tree.setChecked(node[this.uniqueId], false); | ||
@@ -773,3 +839,3 @@ this.currentNodes = this.getNodes(); | ||
checkAll: function checkAll() { | ||
var _this3 = this; | ||
var _this6 = this; | ||
@@ -779,4 +845,4 @@ if (this.$refs.tree && this.$refs.tree.store) { | ||
var traverse = function traverse(node) { | ||
if (node.data && node.data[_this3.uniqueId] && node.data[_this3.showName] && !node.data.isdisabled) { | ||
_this3.$refs.tree.setChecked(node.data[_this3.uniqueId], true); | ||
if (node.data && node.data[_this6.uniqueId] && node.data[_this6.showName] && !node.data.isdisabled) { | ||
_this6.$refs.tree.setChecked(node.data[_this6.uniqueId], true); | ||
} | ||
@@ -794,11 +860,13 @@ if (node.childNodes) { | ||
clear: function clear() { | ||
var _this4 = this; | ||
var _this7 = this; | ||
var arr = this.currentNodes; | ||
arr.forEach(function (item) { | ||
_this4.$refs.tree.setChecked(item[_this4.uniqueId], false); | ||
_this7.$refs.tree.setChecked(item[_this7.uniqueId], false); | ||
}); | ||
this.currentNodes = []; | ||
this.myDefaultCheckedKeys = []; | ||
}, | ||
setDefaultCheck: function setDefaultCheck(_ref3) { | ||
var _this5 = this; | ||
var _this8 = this; | ||
@@ -810,18 +878,25 @@ var store = _ref3.store, | ||
this.$nextTick(function () { | ||
_this5.currentNodes = _this5.getNodes(); | ||
_this8.asyncChangeCurrentNodes(); | ||
}); | ||
} else if (!this.setRadioDefault) { | ||
if (!store && data && data.length && this.defaultCheckedKeys && this.defaultCheckedKeys[0]) { | ||
if (this.lazy && this.defaultCheckedNodes && this.defaultCheckedNodes.length) { | ||
this.radio = this.defaultCheckedNodes[0][this.uniqueId]; | ||
this.radioNode = this.defaultCheckedNodes[0]; | ||
this.currentNodes = [this.defaultCheckedNodes[0]]; | ||
this.setRadioDefault = true; | ||
return; | ||
} | ||
if (!store && data && data.length && this.myDefaultCheckedKeys && this.myDefaultCheckedKeys[0]) { | ||
data.forEach(function (item) { | ||
if (item[_this5.uniqueId] === _this5.defaultCheckedKeys[0]) { | ||
_this5.radio = _this5.defaultCheckedKeys[0]; | ||
_this5.radioNode = item; | ||
_this5.currentNodes = [item]; | ||
_this5.setRadioDefault = true; | ||
if (item[_this8.uniqueId] === _this8.myDefaultCheckedKeys[0]) { | ||
_this8.radio = _this8.myDefaultCheckedKeys[0]; | ||
_this8.radioNode = item; | ||
_this8.currentNodes = [item]; | ||
_this8.setRadioDefault = true; | ||
} | ||
}); | ||
} else if (store && this.defaultCheckedKeys && this.defaultCheckedKeys[0]) { | ||
if (store.nodesMap && store.nodesMap[this.defaultCheckedKeys[0]]) { | ||
var node = store.nodesMap[this.defaultCheckedKeys[0]].data; | ||
this.radio = this.defaultCheckedKeys[0]; | ||
} else if (store && this.myDefaultCheckedKeys && this.myDefaultCheckedKeys[0]) { | ||
if (store.nodesMap && store.nodesMap[this.myDefaultCheckedKeys[0]]) { | ||
var node = store.nodesMap[this.myDefaultCheckedKeys[0]].data; | ||
this.radio = this.myDefaultCheckedKeys[0]; | ||
this.radioNode = node; | ||
@@ -843,7 +918,7 @@ this.currentNodes = [node]; | ||
filterCheckNodes: function filterCheckNodes() { | ||
var _this6 = this; | ||
var _this9 = this; | ||
if (this.showCheckbox) { | ||
return this.currentNodes.filter(function (item) { | ||
return item[_this6.showName] && item[_this6.showName].indexOf(_this6.filterCheckText) !== -1; | ||
return item[_this9.showName] && item[_this9.showName].indexOf(_this9.filterCheckText) !== -1; | ||
}); | ||
@@ -862,6 +937,6 @@ } else { | ||
handler: function handler() { | ||
var _this7 = this; | ||
var _this10 = this; | ||
this.$nextTick(function () { | ||
_this7.initDefaultCheck(); | ||
_this10.initDefaultCheck(); | ||
}); | ||
@@ -872,10 +947,27 @@ } | ||
handler: function handler() { | ||
var _this8 = this; | ||
var _this11 = this; | ||
if (!(this.defaultCheckedNodes && this.defaultCheckedNodes.length)) { | ||
this.myDefaultCheckedKeys = this.defaultCheckedKeys; | ||
this.$nextTick(function () { | ||
_this11.initDefaultCheck(); | ||
}); | ||
} | ||
}, | ||
immediate: true | ||
}, | ||
defaultCheckedNodes: { | ||
handler: function handler() { | ||
var _this12 = this; | ||
this.$nextTick(function () { | ||
_this8.initDefaultCheck(); | ||
_this12.initDefaultCheckedNodes(); | ||
}); | ||
} | ||
}, | ||
immediate: true | ||
} | ||
} | ||
}); | ||
@@ -882,0 +974,0 @@ // CONCATENATED MODULE: ./packages/tree-transfer/src/main.vue?vue&type=script&lang=js& |
{ | ||
"name": "element-ui-for-gov", | ||
"version": "0.2.17", | ||
"version": "0.2.18", | ||
"description": "element-ui for gov", | ||
@@ -5,0 +5,0 @@ "main": "lib/element-ui-for-gov.common.js", |
@@ -0,0 +0,0 @@ import DataTable from './src/dataTable'; |
@@ -0,0 +0,0 @@ import ElEditor from './src/main'; |
@@ -0,0 +0,0 @@ import directive from './src/directive'; |
@@ -0,0 +0,0 @@ import PopoverSelect from './src/main'; |
@@ -0,0 +0,0 @@ // import QueryBox from './src/main'; |
@@ -0,0 +0,0 @@ ## 自定义字体 |
@@ -0,0 +0,0 @@ ## 自定义字体 |
@@ -0,0 +0,0 @@ import TreeDialog from './src/main'; |
@@ -0,0 +0,0 @@ import TreeTransfer from './src/main'; |
@@ -0,0 +0,0 @@ import UploadImage from './src/main'; |
@@ -0,0 +0,0 @@ import { ElementUIComponentForGov } from './component' |
@@ -0,0 +0,0 @@ import { ElementUIComponentForGov } from './component' |
@@ -0,0 +0,0 @@ import { ElementUIComponentForGov } from './component' |
@@ -0,0 +0,0 @@ import { ElementUIComponentForGov } from './component' |
@@ -0,0 +0,0 @@ import { ElementUIComponentForGov } from './component' |
@@ -0,0 +0,0 @@ import { ElementUIComponentForGov } from './component' |
@@ -0,0 +0,0 @@ import { ElementUIComponentForGov } from './component' |
@@ -0,0 +0,0 @@ import { ElementUIComponentForGov } from './component' |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11513094
191683
832