├── .browserslistrc
├── postcss.config.js
├── public
├── favicon.ico
└── index.html
├── examples
├── assets
│ └── logo.png
├── App.vue
├── router.js
├── main.js
└── views
│ └── home.vue
├── lib
├── demo.html
├── tree-select.umd.min.js
└── tree-select.common.js
├── packages
├── index.js
└── src
│ ├── index.vue
│ └── js
│ └── index.js
├── babel.config.js
├── .gitignore
├── vue.config.js
├── package.json
└── README.md
/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: {
3 | autoprefixer: {}
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/532pyh/pyh-tree-select/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/examples/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/532pyh/pyh-tree-select/HEAD/examples/assets/logo.png
--------------------------------------------------------------------------------
/examples/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
9 |
--------------------------------------------------------------------------------
/lib/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
tree-select demo
3 |
4 |
5 |
6 |
9 |
--------------------------------------------------------------------------------
/packages/index.js:
--------------------------------------------------------------------------------
1 | import treeSelect from './src/index.vue';
2 | treeSelect.install = function(Vue) {
3 | Vue.component(treeSelect.name, treeSelect);
4 | };
5 | export default treeSelect;
6 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | "presets": ['@vue/app'],
3 | "plugins": [
4 | [
5 | "component",
6 | {
7 | "libraryName": "element-ui",
8 | "styleLibraryName": "theme-chalk"
9 | }
10 | ]
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | # examples/
4 | # packages/
5 | # public/
6 |
7 | # local env files
8 | .env.local
9 | .env.*.local
10 |
11 | # Log files
12 | # vue.config.js
13 | # babel.config.js
14 | npm-debug.log*
15 | yarn-debug.log*
16 | yarn-error.log*
17 |
18 | # Editor directories and files
19 | .idea
20 | .vscode
21 | *.suo
22 | *.ntvs*
23 | *.njsproj
24 | *.sln
25 | *.sw?
26 |
--------------------------------------------------------------------------------
/examples/router.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import home from './views/home.vue'
4 |
5 | Vue.use(Router)
6 |
7 | export default new Router({
8 | mode: 'history',
9 | base: process.env.BASE_URL,
10 | routes: [
11 | {
12 | path: '/',
13 | name: 'home',
14 | component: home
15 | },
16 | ]
17 | })
18 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | 树结构数据下拉选择组件
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/examples/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import router from './router'
4 | import 'element-ui/lib/theme-chalk/index.css';
5 | import { Select, Option, Tree } from 'element-ui';
6 | import treeSelect from '@/index'
7 |
8 | Vue.config.productionTip = false
9 |
10 | Vue.use(Select)
11 | Vue.use(Option)
12 | Vue.use(Tree)
13 |
14 | Vue.use(treeSelect)
15 |
16 |
17 | new Vue({
18 | router,
19 | render: h => h(App)
20 | }).$mount('#app')
21 |
--------------------------------------------------------------------------------
/vue.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | function resolve(dir) {
3 | return path.resolve(__dirname, dir)
4 | }
5 | module.exports = {
6 | pages: {
7 | index: {
8 | entry: 'examples/main.js',
9 | template: 'public/index.html',
10 | filename: 'index.html',
11 | },
12 | },
13 | css: {
14 | extract: false,
15 | },
16 | configureWebpack: {
17 | resolve: {
18 | extensions: ['.js', '.vue', '.json'],
19 | alias: {
20 | '@': resolve('packages'),
21 | 'assets': resolve('examples/assets'),
22 | 'views': resolve('examples/views'),
23 | }
24 | },
25 | output: {
26 | libraryExport: 'default'
27 | }
28 | },
29 | outputDir: 'lib',
30 | productionSourceMap: false,
31 | devServer: {
32 | port: 8091,
33 | hot: true,
34 | open: 'Google Chrome'
35 | }
36 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fxft-tree-select",
3 | "version": "1.2.6",
4 | "private": false,
5 | "main": "lib/tree-select.umd.min.js",
6 | "keyword": "tree-select tree select",
7 | "description": "基于element组件中Select 选择器和Tree 树形控件扩展出来的树结构数据下拉选择器",
8 | "author": "pengyh",
9 | "scripts": {
10 | "dev": "vue-cli-service serve",
11 | "lib": "vue-cli-service build --target lib --name tree-select --dest lib packages/index.js",
12 | "inspect": "vue-cli-service --mode production inspect > output.js"
13 | },
14 | "dependencies": {
15 | "core-js": "^2.6.5",
16 | "element-ui": "^2.10.1",
17 | "vue": "^2.6.10",
18 | "vue-router": "^3.0.3"
19 | },
20 | "devDependencies": {
21 | "@vue/cli-plugin-babel": "^3.9.0",
22 | "@vue/cli-service": "^3.9.0",
23 | "babel-plugin-component": "^1.1.1",
24 | "less": "^3.0.4",
25 | "less-loader": "^4.1.0",
26 | "vue-template-compiler": "^2.6.10"
27 | }
28 | }
--------------------------------------------------------------------------------
/packages/src/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
16 |
--------------------------------------------------------------------------------
/examples/views/home.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |

4 |
5 |
6 |
7 |
8 |
9 |
10 |
47 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #### el-select-tree组件使用说明
2 | ##### 安装
3 | ```
4 | npm install fxft-tree-select -s
5 | ````
6 | #### 使用
7 | ```
8 | import treeSelect from 'fxft-tree-select';
9 | Vue.use(treeSelect);
10 | ```
11 | ##### Attributes
12 |
13 | | 参数 | 说明 | 类型 | 可选值 | 默认值 |
14 | | -------- | -------- | -------- | -------- | -------- |
15 | | value / v-model | 绑定值 | string/number/array | — | — |
16 | | disabled | 是否禁用 | boolean | — | false |
17 | | size | 输入框尺寸 | string | medium/small/mini | mini |
18 | | clearable | 是否可以清空选项 | boolean | — | false |
19 | | placeholder | 占位符 | string | — | 请选择 |
20 | | filterable | 是否可搜索 | boolean | — | false |
21 | | popper-append-to-body | 是否将弹出框插入至 body 元素。在弹出框的定位出现问题时,可将该属性设置为 false | boolean | -- | false |
22 | | data | 展示数据 | array | — | — |
23 | | node-key | 用于设置绑定值属性 | String | — | id |
24 | | props | 配置选项,具体看下表 | object | — | — |
25 | | default-expand-all | 是否默认展开所有节点 | boolean | — | false |
26 | | default-expanded-keys | 默认展开的节点的 key 的数组 | array | — | — |
27 | | show-checkbox | 显示复选框,即多选 | 节点是否可被选择 | — | false |
28 | | check-strictly | 在显示复选框的情况下,是否严格的遵循父子不互相关联的做法(不相关联:父的选择影响子,子的选择不影响父),默认为 false | boolean | — | false |
29 | | checkHalf | 在check-strictly为true下起作用,选择子节点后将其所有关联的父节点直到顶部全部选中,默认为 false | boolean | — | false |
30 |
31 | ##### props
32 | | 参数 | 说明 | 类型 | 可选值 | 默认值 |
33 | | -------- | -------- | -------- | -------- | -------- |
34 | | label | 指定节点标签为节点对象的某个属性值 | string | — | text |
35 | | children | 指定子树为节点对象的某个属性值 | string | — | children |
36 | | disabled | 指定节点选择框是否禁用为节点对象的某个属性值 | string | — | disabled |
37 | | pid | 当check-strictly值为true时,必须指定当前数据对象的父级id | string | — | pid |
38 |
39 | ##### 方法
40 | | 方法名 | 说明 | 参数 |
41 | | -------- | -------- | -------- |
42 | | getCheckedNodes | 若节点可被选择(即 show-checkbox 为 true),则返回目前被选中的节点所组成的数组 | — |
43 | | getCheckedKeys | 若节点可被选择(即 show-checkbox 为 true),则返回目前被选中的节点的 key 所组成的数组 | — |
44 | | getCurrentKey | show-checkbox为false,获取当前被选中节点的 key,使用此方法必须设置 node-key 属性,若没有节点被选中则返回 null | — |
45 | | getCurrentNode | show-checkbox为false,获取当前被选中节点的 data,若没有节点被选中则返回 null | — |
46 |
47 | ##### Events
48 | | 事件名称 | 说明 | 回调参数 |
49 | | -------- | -------- | -------- |
50 | | node-click | 节点被点击时的回调 | 共三个参数,依次为:传递给 data 属性的数组中该节点所对应的对象、节点对应的 Node、节点组件本身。 |
51 |
--------------------------------------------------------------------------------
/packages/src/js/index.js:
--------------------------------------------------------------------------------
1 |
2 | export default {
3 | name: 'treeSelect',
4 | props: {
5 | checkHalf: {
6 | type: Boolean,
7 | default: false,
8 | },
9 | /*select属性*/
10 | value: {
11 | required: true
12 | },
13 | clearable: Boolean,
14 | placeholder: {
15 | type: String,
16 | default: '请选择'
17 | },
18 | size: {
19 | type: String,
20 | default: 'mini'
21 | },
22 | filterable: Boolean,
23 | popperAppendToBody: Boolean,
24 | disabled: {
25 | type: Boolean,
26 | default: false,
27 | },
28 |
29 | /*tree属性*/
30 | nodeKey: {
31 | type: String,
32 | default: 'id'
33 | },
34 | checkStrictly: Boolean,
35 | data: {
36 | type: Array,
37 | default() {
38 | return []
39 | }
40 | },
41 | props: {
42 | default() {
43 | return {
44 | };
45 | }
46 | },
47 | showCheckbox: {
48 | type: Boolean,
49 | default: false
50 | },
51 | defaultExpandAll: Boolean,
52 | defaultExpandedKeys: Array
53 | },
54 | data() {
55 | return {
56 | label: this.showCheckbox ? [] : '', //select-绑定值
57 | expandOnClickNode: this.showCheckbox, //tree-是否在点击节点的时候展开或者收缩节点
58 | multiple: this.showCheckbox, //select-是否多选
59 | collapseTags: this.showCheckbox, //select-多选时是否将选中值按文字的形式展示
60 | highlightCurrent: !this.showCheckbox, //tree-是否高亮当前选中节点
61 | mergeProps: {
62 | children: 'children',
63 | label: 'label',
64 | disabled: 'disabled',
65 | pid: 'pid', //父级ID
66 | },
67 | mapById:{},
68 | }
69 | },
70 | watch: {
71 | value: {
72 | deep: true,
73 | handler(newValue, oldValue) {
74 | let newValueClone = [], oldValueClone = [];
75 | const toString = Object.prototype.toString;
76 | const clone = function (array) {
77 | return JSON.parse(JSON.stringify(array));
78 | };
79 |
80 | if (toString.apply(newValue) == "[object Array]") {
81 | newValueClone = clone(newValue);
82 | newValueClone.sort();
83 | }
84 |
85 | if (toString.apply(oldValue) == "[object Array]") {
86 | oldValueClone = clone(oldValue);
87 | oldValueClone.sort();
88 | }
89 |
90 | if ((toString.apply(newValue) == "[object Array]" && newValueClone.toString() != oldValueClone.toString()) ||
91 | (toString.apply(newValue) != "[object Array]" && newValue != oldValue)) {
92 | if (this.showCheckbox) {
93 | this.setCheckedKeys(newValue, false, false);
94 | } else {
95 | this.setCurrentKey(this.isEmpty(newValue) ? null : newValue, false);
96 | }
97 | }
98 | }
99 | },
100 | data: {
101 | deep: true,
102 | handler(data) {
103 | this.mapById = {};
104 | this.mapDataById(data);
105 | if (!this.isEmpty(this.value)) {
106 | if (this.showCheckbox) {
107 | this.setCheckedKeys(this.value, false, false);
108 | } else {
109 | this.setCurrentKey(this.isEmpty(this.value) ? null : this.value, false);
110 | }
111 | }
112 | }
113 | },
114 | multiple(boolean) {
115 | if (boolean) this.label = [];
116 | },
117 | showCheckbox(boolean) {
118 | this.expandOnClickNode = this.multiple = this.collapseTags = boolean;
119 | this.highlightCurrent = !boolean;
120 | this.label = boolean ? [] : '';
121 | },
122 | },
123 | created() {
124 | this.mergeProps = Object.assign({}, this.mergeProps, this.props);
125 | },
126 | methods: {
127 | mapDataById(data) {
128 | data.forEach(item => {
129 | this.mapById[item.id] = item;
130 | if (item[this.mergeProps.children]) {
131 | this.mapDataById(item[this.mergeProps.children])
132 | }
133 | })
134 | },
135 | isEmpty(value) {
136 | return value === '' || value === null || value === undefined;
137 | },
138 |
139 | /**
140 | * 可清空的单选模式下用户点击清空按钮时触发
141 | */
142 | selectClearAll() {
143 | this.$emit('input', this.showCheckbox ? [] : '');
144 | if (!this.multiple) {
145 | this.$refs.tree.setCurrentKey(null);
146 | } else {
147 | this.$refs.tree.setCheckedKeys([]);
148 | }
149 | },
150 |
151 | /**
152 | * 多选模式下移除tag时触发
153 | * @param tag 移除的tag值
154 | */
155 | selectRemoveTag(tag) {
156 | const self = this;
157 | let data = this.$refs.tree.getCheckedNodes();
158 | let checkedIds = this.$refs.tree.getCheckedKeys();
159 | let keys = [];
160 |
161 | //复选框时,checkStrictly:true时父节点的选择影响子节点,子节点的选择不影响父节点;false=父子互相关联
162 | if (this.checkStrictly) {
163 | //不关联
164 | data.forEach(item => {
165 | if (item[this.mergeProps.label] != tag) {
166 | keys.push(item[this.nodeKey]);
167 | }
168 | });
169 | } else {
170 | //关联
171 | let tagId, tagPid; //删除项的id和父级id
172 | let removeIds = []; //要删除的id
173 |
174 | //获取当前删除项的id和父级id
175 | for (let item of data) {
176 | if (item[this.mergeProps.label] == tag) {
177 | tagId = item[this.nodeKey];
178 | tagPid = item[this.mergeProps.pid];
179 | break;
180 | }
181 | }
182 | //获取过滤的子级id
183 | let getChildrenIds = function (data) {
184 | let ids = [];
185 | data.forEach(item => {
186 | ids.push(item[self.nodeKey]);
187 | if (Array.isArray(item[self.mergeProps.children]) && item[self.mergeProps.children].length) {
188 | ids = ids.concat(getChildrenIds(item[self.mergeProps.children]));
189 | }
190 | });
191 | return ids;
192 | };
193 |
194 | //获取过滤的父级id
195 | let getParentIds = function (data, pid) {
196 | let ids = [];
197 | for (let item of data) {
198 | if (item[self.nodeKey] == pid) {
199 | ids.push(item[self.nodeKey]);
200 | ids = ids.concat(getParentIds(data, item[self.mergeProps.pid]));
201 | break;
202 | }
203 | }
204 | return ids;
205 | };
206 |
207 | //获取不满足的id
208 | for (let item of data) {
209 | if (item[this.nodeKey] == tagId) {
210 | removeIds.push(item[this.nodeKey]); //当前项过滤
211 |
212 | //获取过滤的子级id
213 | if (Array.isArray(item[this.mergeProps.children]) && item[this.mergeProps.children].length) {
214 | removeIds = removeIds.concat(getChildrenIds(item[this.mergeProps.children]));
215 | }
216 |
217 | //获取过滤的父级id
218 | removeIds = removeIds.concat(getParentIds(data, tagPid));
219 | break;
220 | }
221 | }
222 | keys = checkedIds.filter(id => !removeIds.includes(id));
223 |
224 | //显示文本信息处理
225 | let labels = [];
226 | data.forEach(item => {
227 | if (keys.includes(item[this.nodeKey])) {
228 | labels.push(item[this.mergeProps.label]);
229 | }
230 | });
231 | this.label = labels;
232 | }
233 | this.$refs.tree.setCheckedKeys(keys);
234 | this.$emit('input', keys);
235 | },
236 |
237 | /**
238 | * 下拉框出现/隐藏时触发
239 | * 出现则为 true,隐藏则为 false
240 | * @param bool
241 | */
242 | selectVisibleChange(bool) {
243 | if (!bool) this.dataRestore();
244 | },
245 |
246 | /**
247 | * 搜索
248 | * @param query
249 | */
250 | selectFilterMethod(query = '') {
251 | this.$refs.tree.filter(query);
252 | },
253 |
254 | /**
255 | * 数据还原
256 | */
257 | dataRestore() {
258 | if (this.filterable) {
259 | this.selectFilterMethod();
260 | }
261 | },
262 |
263 | /**
264 | * 对树节点进行筛选时执行的方法,返回 true 表示这个节点可以显示,返回 false 则表示这个节点会被隐藏
265 | */
266 | treeFilterNode(value, data, node) {
267 | if (!value) return true;
268 | return data[this.mergeProps.label].indexOf(value) !== -1;
269 | },
270 |
271 | /**
272 | * 节点被点击时的回调
273 | * 共三个参数,依次为:传递给 data 属性的数组中该节点所对应的对象、节点对应的 Node、节点组件本身。
274 | * @param data
275 | * @param node
276 | * @param component
277 | */
278 | treeNodeClick(data, node, component) {
279 | if (this.showCheckbox) { //多选
280 |
281 | } else { //单选
282 | if(data[this.mergeProps.disabled]){
283 | return false;
284 | }
285 | this.label = node.label;
286 | this.$refs.selectTree.blur();
287 | this.$emit('input', node.key);
288 | this.$emit('node-click', data, node, component);
289 | }
290 | },
291 |
292 | /**
293 | * 当复选框被点击的时候触发
294 | *共两个参数,依次为:传递给 data 属性的数组中该节点所对应的对象、树目前的选中状态对象,
295 | * 包含 checkedNodes、checkedKeys、halfCheckedNodes、halfCheckedKeys 四个属性
296 | */
297 | treeCheck(data, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) {
298 | if (this.checkStrictly) { //父子不相关联
299 | //当前节点是否选中
300 | const checked = checkedKeys.includes(data[this.nodeKey]);
301 | let checkedArray = [], //当前树的选择节点id
302 | currendChidenIds = []; //当前节点子节点id数组
303 | let checkedLabelArray = []; //当前树的选择节点名称
304 | //获取子树id
305 | let getIds = array => {
306 | let checkedIds = [];
307 | if (Array.isArray(array) && array.length) {
308 | for (let item of array) {
309 | checkedIds.push(item[this.nodeKey]);
310 | if (Array.isArray(item[this.mergeProps.children]) && item[this.mergeProps.children].length) {
311 | checkedIds = checkedIds.concat(getIds(item[this.mergeProps.children]));
312 | }
313 | }
314 | }
315 | return checkedIds;
316 | };
317 |
318 | //获取父节点id
319 | let getParentIds = data => {
320 | let checkedIds = [];
321 | if (data[this.mergeProps.pid]) {
322 | checkedIds.push(data[this.mergeProps.pid]);
323 | if (this.mapById[data[this.mergeProps.pid]]) {
324 | checkedIds = checkedIds.concat(getParentIds(this.mapById[data[this.mergeProps.pid]]));
325 | }
326 | }
327 | return checkedIds
328 | };
329 |
330 | if (Array.isArray(data[this.mergeProps.children]) && data[this.mergeProps.children].length) {
331 | currendChidenIds = getIds(data[this.mergeProps.children]);
332 | //获取树的选中id(不包含当前子节点id)
333 | for (let id of checkedKeys) {
334 | if (!currendChidenIds.includes(id)) {
335 | checkedArray.push(id);
336 | }
337 | }
338 |
339 | //当前节点选中,加入当前子节点id
340 | if (checked) {
341 | checkedArray = checkedArray.concat(currendChidenIds);
342 | }
343 |
344 | //将子节点所有关联的父节点都选中直到顶部
345 | if (this.checkHalf) {
346 | checkedArray = checkedArray.concat(getParentIds(data));
347 | }
348 |
349 | this.setCheckedKeys(checkedArray);
350 | }
351 | else {
352 | //将子节点所有关联的父节点都选中直到顶部
353 | if (this.checkHalf) {
354 | checkedArray = getParentIds(data);
355 | const keys = checkedNodes.map(item => item[this.nodeKey]);
356 | checkedArray = checkedArray.concat(keys);
357 | this.setCheckedKeys(checkedArray);
358 | } else {
359 | this.label = checkedNodes.map(item => item[this.mergeProps.label]);
360 | this.$emit('input', checkedNodes.map(item => item[this.nodeKey]));
361 | }
362 | }
363 |
364 | } else {
365 | this.label = checkedNodes.map(item => item[this.mergeProps.label]);
366 | this.$emit('input', checkedNodes.map(item => item[this.nodeKey]));
367 | }
368 | },
369 |
370 | /**
371 | * 当前选中节点变化时触发的事件
372 | * @param data 当前节点的数据
373 | * @param node 前节点的 Node 对象
374 | */
375 | treeCurrentChange(data, node) {
376 |
377 | },
378 |
379 | /**
380 | * 节点选中状态发生变化时的回调
381 | * @param data 传递给 data 属性的数组中该节点所对应的对象
382 | * @param checked 节点本身是否被选中
383 | * @param childChecked 节点的子树中是否有被选中的节点
384 | */
385 | treeCheckChange(data, checked, childChecked) {
386 | },
387 |
388 | /**
389 | * 若节点可被选择(即 show-checkbox 为 true),则返回目前被选中的节点所组成的数组
390 | */
391 | getCheckedNodes() {
392 | if (this.showCheckbox)
393 | return this.$refs.tree.getCheckedNodes();
394 |
395 | },
396 |
397 | /**
398 | * 设置目前勾选的节点,使用此方法必须设置 node-key 属性
399 | * @param nodes 接收勾选节点数据的数组
400 | */
401 | setCheckedNodes(nodes) {
402 | if (this.showCheckbox)
403 | this.$refs.tree.setCheckedNodes(nodes);
404 | },
405 |
406 | /**
407 | * 若节点可被选择(即 show-checkbox 为 true),则返回目前被选中的节点的 key 所组成的数组
408 | */
409 | getCheckedKeys() {
410 | if (this.showCheckbox)
411 | return this.$refs.tree.getCheckedKeys();
412 | },
413 |
414 | /**
415 | * 通过 keys 设置目前勾选的节点,使用此方法必须设置 node-key 属性
416 | * (keys, leafOnly) 接收两个参数
417 | * @param keys 勾选节点的 key 的数组
418 | * @param leafOnly boolean 类型的参数,若为 true 则仅设置叶子节点的选中状态,默认值为 false
419 | * @param emit 是否触发input事件
420 | */
421 | setCheckedKeys(keys, leafOnly = false, emit = true) {
422 | this.$nextTick(() => {
423 | if (this.showCheckbox) {
424 | this.$refs.tree.setCheckedKeys(keys, leafOnly);
425 | const nodes = this.$refs.tree.getCheckedNodes();
426 | this.label = nodes.map(item => item[this.mergeProps.label]);
427 | if (emit) {
428 | this.$emit('input', nodes.map(item => item[this.nodeKey]));
429 | }
430 | }
431 | });
432 | },
433 |
434 | /**
435 | * 获取当前被选中节点的 key,使用此方法必须设置 node-key 属性,若没有节点被选中则返回 null
436 | */
437 | getCurrentKey() {
438 | return this.$refs.tree.getCurrentKey();
439 | },
440 |
441 | /**
442 | * 通过 key 设置某个节点的当前选中状态,使用此方法必须设置 node-key 属性
443 | * @param key 待被选节点的 key,若为 null 则取消当前高亮的节点
444 | * @param emit 是否触发input事件
445 | */
446 | setCurrentKey(key, emit = true) {
447 | this.$nextTick(() => {
448 | if (key === null && this.$refs.tree.getCurrentKey() === null) return;
449 | this.$refs.tree.setCurrentKey(key);
450 | const node = this.$refs.tree.getCurrentNode();
451 | if (node) {
452 | this.label = node[this.mergeProps.label];
453 | if (emit) {
454 | this.$emit('input', node[this.nodeKey]);
455 | }
456 | } else {
457 | this.label = '';
458 | }
459 | });
460 | },
461 |
462 | /**
463 | * 获取当前被选中节点的 data,若没有节点被选中则返回 null
464 | */
465 | getCurrentNode() {
466 | return this.$refs.tree.getCurrentNode();
467 | },
468 |
469 | /**
470 | * 通过 node 设置某个节点的当前选中状态,使用此方法必须设置 node-key 属性
471 | * @param node 待被选节点的 node
472 | */
473 | setCurrentNode(node) {
474 | this.$refs.tree.setCurrentNode(node);
475 | }
476 | }
477 | }
478 |
--------------------------------------------------------------------------------
/lib/tree-select.umd.min.js:
--------------------------------------------------------------------------------
1 | (function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["tree-select"]=t():e["tree-select"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="112a")}({"00db":function(e,t,n){var r=n("1277")("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,!"/./"[e](t)}catch(o){}}return!0}},"0614":function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},"0cc1":function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},"112a":function(e,t,n){"use strict";var r;(n.r(t),"undefined"!==typeof window)&&(n("e67d"),(r=window.document.currentScript)&&(r=r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=r[1]));n("7cfd");var o=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("el-select",{ref:"selectTree",attrs:{disabled:e.disabled,placeholder:e.placeholder,size:e.size,clearable:e.clearable,multiple:e.multiple,"collapse-tags":e.collapseTags,filterable:e.filterable,"filter-method":e.selectFilterMethod,"popper-append-to-body":e.popperAppendToBody},on:{clear:e.selectClearAll,"visible-change":e.selectVisibleChange,"remove-tag":e.selectRemoveTag},model:{value:e.label,callback:function(t){e.label=t},expression:"label"}},[n("el-option",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{value:"1"}}),n("el-tree",{ref:"tree",attrs:{"node-key":e.nodeKey,"show-checkbox":e.showCheckbox,"expand-on-click-node":e.expandOnClickNode,data:e.data,props:e.props,"check-strictly":e.checkStrictly,"highlight-current":e.highlightCurrent,"default-expand-all":e.defaultExpandAll,"default-expanded-keys":e.defaultExpandedKeys,"filter-node-method":e.treeFilterNode},on:{"node-click":e.treeNodeClick,check:e.treeCheck,"current-change":e.treeCurrentChange,"check-change":e.treeCheckChange}})],1)},i=[],c=(n("40c5"),n("23cc"),n("4b5e"),n("6c28"),n("4634"),n("e783"),n("de90"),n("cc1d"),{name:"treeSelect",props:{checkHalf:{type:Boolean,default:!1},value:{required:!0},clearable:Boolean,placeholder:{type:String,default:"请选择"},size:{type:String,default:"mini"},filterable:Boolean,popperAppendToBody:Boolean,disabled:{type:Boolean,default:!1},nodeKey:{type:String,default:"id"},checkStrictly:Boolean,data:{type:Array,default:function(){return[]}},props:{default:function(){return{}}},showCheckbox:{type:Boolean,default:!1},defaultExpandAll:Boolean,defaultExpandedKeys:Array},data:function(){return{label:this.showCheckbox?[]:"",expandOnClickNode:this.showCheckbox,multiple:this.showCheckbox,collapseTags:this.showCheckbox,highlightCurrent:!this.showCheckbox,mergeProps:{children:"children",label:"label",disabled:"disabled",pid:"pid"},mapById:{}}},watch:{value:{deep:!0,handler:function(e,t){var n=[],r=[],o=Object.prototype.toString,i=function(e){return JSON.parse(JSON.stringify(e))};"[object Array]"==o.apply(e)&&(n=i(e),n.sort()),"[object Array]"==o.apply(t)&&(r=i(t),r.sort()),("[object Array]"==o.apply(e)&&n.toString()!=r.toString()||"[object Array]"!=o.apply(e)&&e!=t)&&(this.showCheckbox?this.setCheckedKeys(e,!1,!1):this.setCurrentKey(this.isEmpty(e)?null:e,!1))}},data:{deep:!0,handler:function(e){this.mapById={},this.mapDataById(e),this.isEmpty(this.value)||(this.showCheckbox?this.setCheckedKeys(this.value,!1,!1):this.setCurrentKey(this.isEmpty(this.value)?null:this.value,!1))}},multiple:function(e){e&&(this.label=[])},showCheckbox:function(e){this.expandOnClickNode=this.multiple=this.collapseTags=e,this.highlightCurrent=!e,this.label=e?[]:""}},created:function(){this.mergeProps=Object.assign({},this.mergeProps,this.props)},methods:{mapDataById:function(e){var t=this;e.forEach((function(e){t.mapById[e.id]=e,e[t.mergeProps.children]&&t.mapDataById(e[t.mergeProps.children])}))},isEmpty:function(e){return""===e||null===e||void 0===e},selectClearAll:function(){this.$emit("input",this.showCheckbox?[]:""),this.multiple?this.$refs.tree.setCheckedKeys([]):this.$refs.tree.setCurrentKey(null)},selectRemoveTag:function(e){var t=this,n=this,r=this.$refs.tree.getCheckedNodes(),o=this.$refs.tree.getCheckedKeys(),i=[];if(this.checkStrictly)r.forEach((function(n){n[t.mergeProps.label]!=e&&i.push(n[t.nodeKey])}));else{var c,a,u=[],s=!0,f=!1,l=void 0;try{for(var d,p=r[Symbol.iterator]();!(s=(d=p.next()).done);s=!0){var h=d.value;if(h[this.mergeProps.label]==e){c=h[this.nodeKey],a=h[this.mergeProps.pid];break}}}catch(k){f=!0,l=k}finally{try{s||null==p.return||p.return()}finally{if(f)throw l}}var y=function e(t){var r=[];return t.forEach((function(t){r.push(t[n.nodeKey]),Array.isArray(t[n.mergeProps.children])&&t[n.mergeProps.children].length&&(r=r.concat(e(t[n.mergeProps.children])))})),r},v=function e(t,r){var o=[],i=!0,c=!1,a=void 0;try{for(var u,s=t[Symbol.iterator]();!(i=(u=s.next()).done);i=!0){var f=u.value;if(f[n.nodeKey]==r){o.push(f[n.nodeKey]),o=o.concat(e(t,f[n.mergeProps.pid]));break}}}catch(k){c=!0,a=k}finally{try{i||null==s.return||s.return()}finally{if(c)throw a}}return o},b=!0,g=!1,m=void 0;try{for(var x,S=r[Symbol.iterator]();!(b=(x=S.next()).done);b=!0){var C=x.value;if(C[this.nodeKey]==c){u.push(C[this.nodeKey]),Array.isArray(C[this.mergeProps.children])&&C[this.mergeProps.children].length&&(u=u.concat(y(C[this.mergeProps.children]))),u=u.concat(v(r,a));break}}}catch(k){g=!0,m=k}finally{try{b||null==S.return||S.return()}finally{if(g)throw m}}i=o.filter((function(e){return!u.includes(e)}));var w=[];r.forEach((function(e){i.includes(e[t.nodeKey])&&w.push(e[t.mergeProps.label])})),this.label=w}this.$refs.tree.setCheckedKeys(i),this.$emit("input",i)},selectVisibleChange:function(e){e||this.dataRestore()},selectFilterMethod:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.$refs.tree.filter(e)},dataRestore:function(){this.filterable&&this.selectFilterMethod()},treeFilterNode:function(e,t,n){return!e||-1!==t[this.mergeProps.label].indexOf(e)},treeNodeClick:function(e,t,n){if(this.showCheckbox);else{if(e[this.mergeProps.disabled])return!1;this.label=t.label,this.$refs.selectTree.blur(),this.$emit("input",t.key),this.$emit("node-click",e,t,n)}},treeCheck:function(e,t){var n=this,r=t.checkedNodes,o=t.checkedKeys;t.halfCheckedNodes,t.halfCheckedKeys;if(this.checkStrictly){var i=o.includes(e[this.nodeKey]),c=[],a=[],u=function e(t){var r=[];if(Array.isArray(t)&&t.length){var o=!0,i=!1,c=void 0;try{for(var a,u=t[Symbol.iterator]();!(o=(a=u.next()).done);o=!0){var s=a.value;r.push(s[n.nodeKey]),Array.isArray(s[n.mergeProps.children])&&s[n.mergeProps.children].length&&(r=r.concat(e(s[n.mergeProps.children])))}}catch(f){i=!0,c=f}finally{try{o||null==u.return||u.return()}finally{if(i)throw c}}}return r},s=function e(t){var r=[];return t[n.mergeProps.pid]&&(r.push(t[n.mergeProps.pid]),n.mapById[t[n.mergeProps.pid]]&&(r=r.concat(e(n.mapById[t[n.mergeProps.pid]])))),r};if(Array.isArray(e[this.mergeProps.children])&&e[this.mergeProps.children].length){a=u(e[this.mergeProps.children]);var f=!0,l=!1,d=void 0;try{for(var p,h=o[Symbol.iterator]();!(f=(p=h.next()).done);f=!0){var y=p.value;a.includes(y)||c.push(y)}}catch(b){l=!0,d=b}finally{try{f||null==h.return||h.return()}finally{if(l)throw d}}i&&(c=c.concat(a)),this.checkHalf&&(c=c.concat(s(e))),this.setCheckedKeys(c)}else if(this.checkHalf){c=s(e);var v=r.map((function(e){return e[n.nodeKey]}));c=c.concat(v),this.setCheckedKeys(c)}else this.label=r.map((function(e){return e[n.mergeProps.label]})),this.$emit("input",r.map((function(e){return e[n.nodeKey]})))}else this.label=r.map((function(e){return e[n.mergeProps.label]})),this.$emit("input",r.map((function(e){return e[n.nodeKey]})))},treeCurrentChange:function(e,t){},treeCheckChange:function(e,t,n){},getCheckedNodes:function(){if(this.showCheckbox)return this.$refs.tree.getCheckedNodes()},setCheckedNodes:function(e){this.showCheckbox&&this.$refs.tree.setCheckedNodes(e)},getCheckedKeys:function(){if(this.showCheckbox)return this.$refs.tree.getCheckedKeys()},setCheckedKeys:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.$nextTick((function(){if(t.showCheckbox){t.$refs.tree.setCheckedKeys(e,n);var o=t.$refs.tree.getCheckedNodes();t.label=o.map((function(e){return e[t.mergeProps.label]})),r&&t.$emit("input",o.map((function(e){return e[t.nodeKey]})))}}))},getCurrentKey:function(){return this.$refs.tree.getCurrentKey()},setCurrentKey:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.$nextTick((function(){if(null!==e||null!==t.$refs.tree.getCurrentKey()){t.$refs.tree.setCurrentKey(e);var r=t.$refs.tree.getCurrentNode();r?(t.label=r[t.mergeProps.label],n&&t.$emit("input",r[t.nodeKey])):t.label=""}}))},getCurrentNode:function(){return this.$refs.tree.getCurrentNode()},setCurrentNode:function(e){this.$refs.tree.setCurrentNode(e)}}}),a=c;n("d7f8");function u(e,t,n,r,o,i,c,a){var u,s="function"===typeof e?e.options:e;if(t&&(s.render=t,s.staticRenderFns=n,s._compiled=!0),r&&(s.functional=!0),i&&(s._scopeId="data-v-"+i),c?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(c)},s._ssrRegister=u):o&&(u=a?function(){o.call(this,this.$root.$options.shadowRoot)}:o),u)if(s.functional){s._injectStyles=u;var f=s.render;s.render=function(e,t){return u.call(t),f(e,t)}}else{var l=s.beforeCreate;s.beforeCreate=l?[].concat(l,u):[u]}return{exports:e,options:s}}var s=u(a,o,i,!1,null,"240804a7",null),f=s.exports;f.install=function(e){e.component(f.name,f)};var l=f;t["default"]=l},1277:function(e,t,n){var r=n("f341")("wks"),o=n("4d2c"),i=n("3f8b").Symbol,c="function"==typeof i,a=e.exports=function(e){return r[e]||(r[e]=c&&i[e]||(c?i:o)("Symbol."+e))};a.store=r},"17cb":function(e,t,n){var r=n("3f8b").document;e.exports=r&&r.documentElement},"1f9e":function(e,t,n){var r=n("6117"),o=n("8941"),i=n("c3a9");e.exports=function(e){return function(t,n,c){var a,u=r(t),s=o(u.length),f=i(c,s);if(e&&n!=n){while(s>f)if(a=u[f++],a!=a)return!0}else for(;s>f;f++)if((e||f in u)&&u[f]===n)return e||f||0;return!e&&-1}}},"23cc":function(e,t,n){"use strict";var r=n("2498"),o=n("69ba"),i="includes";r(r.P+r.F*n("00db")(i),"String",{includes:function(e){return!!~o(this,e,i).indexOf(e,arguments.length>1?arguments[1]:void 0)}})},2498:function(e,t,n){var r=n("3f8b"),o=n("da27"),i=n("b8ea"),c=n("a6d5"),a=n("e85e"),u="prototype",s=function(e,t,n){var f,l,d,p,h=e&s.F,y=e&s.G,v=e&s.S,b=e&s.P,g=e&s.B,m=y?r:v?r[t]||(r[t]={}):(r[t]||{})[u],x=y?o:o[t]||(o[t]={}),S=x[u]||(x[u]={});for(f in y&&(n=t),n)l=!h&&m&&void 0!==m[f],d=(l?m:n)[f],p=g&&l?a(d,r):b&&"function"==typeof d?a(Function.call,d):d,m&&c(m,f,d,e&s.U),x[f]!=d&&i(x,f,p),b&&S[f]!=d&&(S[f]=d)};r.core=o,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},"25ae":function(e,t,n){e.exports=!n("f9a5")&&!n("0cc1")((function(){return 7!=Object.defineProperty(n("6618")("div"),"a",{get:function(){return 7}}).a}))},2896:function(e,t,n){var r=n("5ba0");"string"===typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);var o=n("85cb").default;o("34ef41b4",r,!0,{sourceMap:!1,shadowMode:!1})},"2ab1":function(e,t,n){var r=n("da0b");e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},3038:function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},"3d87":function(e,t,n){var r=n("d3d8").f,o=n("549d"),i=n("1277")("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},"3f5c":function(e,t,n){var r=n("7d56"),o=n("9d61"),i=n("c864");e.exports=function(e){var t=r(e),n=o.f;if(n){var c,a=n(e),u=i.f,s=0;while(a.length>s)u.call(e,c=a[s++])&&t.push(c)}return t}},"3f8b":function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},"40c5":function(e,t,n){"use strict";var r=n("2498"),o=n("1f9e")(!0);r(r.P,"Array",{includes:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),n("ab19")("includes")},4634:function(e,t,n){for(var r=n("96dd"),o=n("7d56"),i=n("a6d5"),c=n("3f8b"),a=n("b8ea"),u=n("e3b3"),s=n("1277"),f=s("iterator"),l=s("toStringTag"),d=u.Array,p={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},h=o(p),y=0;y";t.style.display="none",n("17cb").appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(o+"script"+c+"document.F=Object"+o+"/script"+c),e.close(),s=e.F;while(r--)delete s[u][i[r]];return s()};e.exports=Object.create||function(e,t){var n;return null!==e?(a[u]=r(e),n=new a,a[u]=null,n[c]=e):n=s(),void 0===t?n:o(n,t)}},6618:function(e,t,n){var r=n("da0b"),o=n("3f8b").document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},"690e":function(e,t){function n(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"===typeof btoa){var i=r(o),c=o.sources.map((function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"}));return[n].concat(c).concat([i]).join("\n")}return[n].join("\n")}function r(e){var t=btoa(unescape(encodeURIComponent(JSON.stringify(e)))),n="sourceMappingURL=data:application/json;charset=utf-8;base64,"+t;return"/*# "+n+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r=n(t,e);return t[2]?"@media "+t[2]+"{"+r+"}":r})).join("")},t.i=function(e,n){"string"===typeof e&&(e=[[null,e,""]]);for(var r={},o=0;oo)X(e,n=r[o++],t[n]);return e},Q=function(e,t){return void 0===t?k(e):Y(k(e),t)},Z=function(e){var t=B.call(this,e=C(e,!0));return!(this===G&&o(D,e)&&!o(U,e))&&(!(t||!o(this,e)||!o(D,e)||o(this,F)&&this[F][e])||t)},ee=function(e,t){if(e=S(e),t=C(t,!0),e!==G||!o(D,t)||o(U,t)){var n=N(e,t);return!n||!o(D,t)||o(e,F)&&e[F][t]||(n.enumerable=!0),n}},te=function(e){var t,n=K(S(e)),r=[],i=0;while(n.length>i)o(D,t=n[i++])||t==F||t==u||r.push(t);return r},ne=function(e){var t,n=e===G,r=K(n?U:S(e)),i=[],c=0;while(r.length>c)!o(D,t=r[c++])||n&&!o(G,t)||i.push(D[t]);return i};V||(A=function(){if(this instanceof A)throw TypeError("Symbol is not a constructor!");var e=d(arguments.length>0?arguments[0]:void 0),t=function(n){this===G&&t.call(U,n),o(this,F)&&o(this[F],e)&&(this[F][e]=!1),z(this,e,w(1,n))};return i&&H&&z(G,e,{configurable:!0,set:t}),W(e)},a(A[L],"toString",(function(){return this._k})),P.f=ee,E.f=X,n("cb2e").f=O.f=te,n("c864").f=Z,j.f=ne,i&&!n("6cc2")&&a(G,"propertyIsEnumerable",Z,!0),h.f=function(e){return W(p(e))}),c(c.G+c.W+c.F*!V,{Symbol:A});for(var re="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),oe=0;re.length>oe;)p(re[oe++]);for(var ie=_(p.store),ce=0;ie.length>ce;)y(ie[ce++]);c(c.S+c.F*!V,"Symbol",{for:function(e){return o(I,e+="")?I[e]:I[e]=A(e)},keyFor:function(e){if(!q(e))throw TypeError(e+" is not a symbol!");for(var t in I)if(I[t]===e)return t},useSetter:function(){H=!0},useSimple:function(){H=!1}}),c(c.S+c.F*!V,"Object",{create:Q,defineProperty:X,defineProperties:Y,getOwnPropertyDescriptor:ee,getOwnPropertyNames:te,getOwnPropertySymbols:ne});var ae=s((function(){j.f(1)}));c(c.S+c.F*ae,"Object",{getOwnPropertySymbols:function(e){return j.f(x(e))}}),M&&c(c.S+c.F*(!V||s((function(){var e=A();return"[null]"!=$([e])||"{}"!=$({a:e})||"{}"!=$(Object(e))}))),"JSON",{stringify:function(e){var t,n,r=[e],o=1;while(arguments.length>o)r.push(arguments[o++]);if(n=t=r[1],(m(t)||void 0!==e)&&!q(e))return b(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!q(t))return t}),r[1]=t,$.apply(M,r)}}),A[L][R]||n("b8ea")(A[L],R,A[L].valueOf),l(A,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},"6cc2":function(e,t){e.exports=!1},"6fe0":function(e,t,n){e.exports=n("f341")("native-function-to-string",Function.toString)},7206:function(e,t,n){t.f=n("1277")},"7afe":function(e,t,n){var r=n("549d"),o=n("6117"),i=n("1f9e")(!1),c=n("9947")("IE_PROTO");e.exports=function(e,t){var n,a=o(e),u=0,s=[];for(n in a)n!=c&&r(a,n)&&s.push(n);while(t.length>u)r(a,n=t[u++])&&(~i(s,n)||s.push(n));return s}},"7cfd":function(e,t,n){var r=n("d3d8").f,o=Function.prototype,i=/^\s*function ([^ (]*)/,c="name";c in o||n("f9a5")&&r(o,c,{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(e){return""}}})},"7d56":function(e,t,n){var r=n("7afe"),o=n("d93f");e.exports=Object.keys||function(e){return r(e,o)}},8451:function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},"85cb":function(e,t,n){"use strict";function r(e,t){for(var n=[],r={},o=0;on.parts.length&&(r.parts.length=n.parts.length)}else{var c=[];for(o=0;of){var p,h=u(arguments[f++]),y=l?o(h).concat(l(h)):o(h),v=y.length,b=0;while(v>b)p=y[b++],r&&!d.call(h,p)||(n[p]=h[p])}return n}:s},8941:function(e,t,n){var r=n("a6ad"),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},"8cac":function(e,t,n){var r=n("da0b");e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},"8d69":function(e,t,n){var r=n("d3d8"),o=n("8cac"),i=n("7d56");e.exports=n("f9a5")?Object.defineProperties:function(e,t){o(e);var n,c=i(t),a=c.length,u=0;while(a>u)r.f(e,n=c[u++],t[n]);return e}},"8eba":function(e,t,n){"use strict";var r=n("0cc1");e.exports=function(e,t){return!!e&&r((function(){t?e.call(null,(function(){}),1):e.call(null)}))}},"96dd":function(e,t,n){"use strict";var r=n("ab19"),o=n("c8e9"),i=n("e3b3"),c=n("6117");e.exports=n("4aef")(Array,"Array",(function(e,t){this._t=c(e),this._i=0,this._k=t}),(function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,o(1)):o(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])}),"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},9947:function(e,t,n){var r=n("f341")("keys"),o=n("4d2c");e.exports=function(e){return r[e]||(r[e]=o(e))}},9952:function(e,t,n){var r=n("6077");e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},"9d61":function(e,t){t.f=Object.getOwnPropertySymbols},"9f7e":function(e,t,n){n("f9a5")&&"g"!=/./g.flags&&n("d3d8").f(RegExp.prototype,"flags",{configurable:!0,get:n("e7a1")})},a6ad:function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},a6d5:function(e,t,n){var r=n("3f8b"),o=n("b8ea"),i=n("549d"),c=n("4d2c")("src"),a=n("6fe0"),u="toString",s=(""+a).split(u);n("da27").inspectSource=function(e){return a.call(e)},(e.exports=function(e,t,n,a){var u="function"==typeof n;u&&(i(n,"name")||o(n,"name",t)),e[t]!==n&&(u&&(i(n,c)||o(n,c,e[t]?""+e[t]:s.join(String(t)))),e===r?e[t]=n:a?e[t]?e[t]=n:o(e,t,n):(delete e[t],o(e,t,n)))})(Function.prototype,u,(function(){return"function"==typeof this&&this[c]||a.call(this)}))},a9cf:function(e,t,n){var r=n("3038");e.exports=function(e){return Object(r(e))}},ab19:function(e,t,n){var r=n("1277")("unscopables"),o=Array.prototype;void 0==o[r]&&n("b8ea")(o,r,{}),e.exports=function(e){o[r][e]=!0}},ac59:function(e,t,n){var r=n("3f8b"),o=n("da27"),i=n("6cc2"),c=n("7206"),a=n("d3d8").f;e.exports=function(e){var t=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||a(t,e,{value:c.f(e)})}},b081:function(e,t,n){var r=n("4d2c")("meta"),o=n("da0b"),i=n("549d"),c=n("d3d8").f,a=0,u=Object.isExtensible||function(){return!0},s=!n("0cc1")((function(){return u(Object.preventExtensions({}))})),f=function(e){c(e,r,{value:{i:"O"+ ++a,w:{}}})},l=function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!u(e))return"F";if(!t)return"E";f(e)}return e[r].i},d=function(e,t){if(!i(e,r)){if(!u(e))return!0;if(!t)return!1;f(e)}return e[r].w},p=function(e){return s&&h.NEED&&u(e)&&!i(e,r)&&f(e),e},h=e.exports={KEY:r,NEED:!1,fastKey:l,getWeak:d,onFreeze:p}},b8ea:function(e,t,n){var r=n("d3d8"),o=n("0614");e.exports=n("f9a5")?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},c264:function(e,t,n){"use strict";var r=n("65c3"),o=n("0614"),i=n("3d87"),c={};n("b8ea")(c,n("1277")("iterator"),(function(){return this})),e.exports=function(e,t,n){e.prototype=r(c,{next:o(1,n)}),i(e,t+" Iterator")}},c26a:function(e,t,n){var r=n("6117"),o=n("cb2e").f,i={}.toString,c="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],a=function(e){try{return o(e)}catch(t){return c.slice()}};e.exports.f=function(e){return c&&"[object Window]"==i.call(e)?a(e):o(r(e))}},c3a9:function(e,t,n){var r=n("a6ad"),o=Math.max,i=Math.min;e.exports=function(e,t){return e=r(e),e<0?o(e+t,0):i(e,t)}},c58e:function(e,t,n){var r=n("6077");e.exports=Array.isArray||function(e){return"Array"==r(e)}},c864:function(e,t){t.f={}.propertyIsEnumerable},c8e9:function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},cb2e:function(e,t,n){var r=n("7afe"),o=n("d93f").concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},cc1d:function(e,t,n){"use strict";n("9f7e");var r=n("8cac"),o=n("e7a1"),i=n("f9a5"),c="toString",a=/./[c],u=function(e){n("a6d5")(RegExp.prototype,c,e,!0)};n("0cc1")((function(){return"/a/b"!=a.call({source:"a",flags:"b"})}))?u((function(){var e=r(this);return"/".concat(e.source,"/","flags"in e?e.flags:!i&&e instanceof RegExp?o.call(e):void 0)})):a.name!=c&&u((function(){return a.call(this)}))},d15b:function(e,t,n){var r=n("549d"),o=n("a9cf"),i=n("9947")("IE_PROTO"),c=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=o(e),r(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?c:null}},d3d8:function(e,t,n){var r=n("8cac"),o=n("25ae"),i=n("2ab1"),c=Object.defineProperty;t.f=n("f9a5")?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return c(e,t,n)}catch(a){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},d7f8:function(e,t,n){"use strict";var r=n("2896"),o=n.n(r);o.a},d93f:function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},da0b:function(e,t){e.exports=function(e){return"object"===typeof e?null!==e:"function"===typeof e}},da27:function(e,t){var n=e.exports={version:"2.6.10"};"number"==typeof __e&&(__e=n)},de90:function(e,t,n){"use strict";var r=n("2498"),o=n("8451"),i=n("a9cf"),c=n("0cc1"),a=[].sort,u=[1,2,3];r(r.P+r.F*(c((function(){u.sort(void 0)}))||!c((function(){u.sort(null)}))||!n("8eba")(a)),"Array",{sort:function(e){return void 0===e?a.call(i(this)):a.call(i(this),o(e))}})},e3b3:function(e,t){e.exports={}},e493:function(e,t,n){var r=n("c864"),o=n("0614"),i=n("6117"),c=n("2ab1"),a=n("549d"),u=n("25ae"),s=Object.getOwnPropertyDescriptor;t.f=n("f9a5")?s:function(e,t){if(e=i(e),t=c(t,!0),u)try{return s(e,t)}catch(n){}if(a(e,t))return o(!r.f.call(e,t),e[t])}},e67d:function(e,t){(function(e){var t="currentScript",n=e.getElementsByTagName("script");t in e||Object.defineProperty(e,t,{get:function(){try{throw new Error}catch(r){var e,t=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(r.stack)||[!1])[1];for(e in n)if(n[e].src==t||"interactive"==n[e].readyState)return n[e];return null}}})})(document)},e783:function(e,t,n){var r=n("2498");r(r.S+r.F,"Object",{assign:n("87c5")})},e7a1:function(e,t,n){"use strict";var r=n("8cac");e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},e85e:function(e,t,n){var r=n("8451");e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},f341:function(e,t,n){var r=n("da27"),o=n("3f8b"),i="__core-js_shared__",c=o[i]||(o[i]={});(e.exports=function(e,t){return c[e]||(c[e]=void 0!==t?t:{})})("versions",[]).push({version:r.version,mode:n("6cc2")?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},f9a5:function(e,t,n){e.exports=!n("0cc1")((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))}})["default"]}));
--------------------------------------------------------------------------------
/lib/tree-select.common.js:
--------------------------------------------------------------------------------
1 | module.exports =
2 | /******/ (function(modules) { // webpackBootstrap
3 | /******/ // The module cache
4 | /******/ var installedModules = {};
5 | /******/
6 | /******/ // The require function
7 | /******/ function __webpack_require__(moduleId) {
8 | /******/
9 | /******/ // Check if module is in cache
10 | /******/ if(installedModules[moduleId]) {
11 | /******/ return installedModules[moduleId].exports;
12 | /******/ }
13 | /******/ // Create a new module (and put it into the cache)
14 | /******/ var module = installedModules[moduleId] = {
15 | /******/ i: moduleId,
16 | /******/ l: false,
17 | /******/ exports: {}
18 | /******/ };
19 | /******/
20 | /******/ // Execute the module function
21 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22 | /******/
23 | /******/ // Flag the module as loaded
24 | /******/ module.l = true;
25 | /******/
26 | /******/ // Return the exports of the module
27 | /******/ return module.exports;
28 | /******/ }
29 | /******/
30 | /******/
31 | /******/ // expose the modules object (__webpack_modules__)
32 | /******/ __webpack_require__.m = modules;
33 | /******/
34 | /******/ // expose the module cache
35 | /******/ __webpack_require__.c = installedModules;
36 | /******/
37 | /******/ // define getter function for harmony exports
38 | /******/ __webpack_require__.d = function(exports, name, getter) {
39 | /******/ if(!__webpack_require__.o(exports, name)) {
40 | /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41 | /******/ }
42 | /******/ };
43 | /******/
44 | /******/ // define __esModule on exports
45 | /******/ __webpack_require__.r = function(exports) {
46 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48 | /******/ }
49 | /******/ Object.defineProperty(exports, '__esModule', { value: true });
50 | /******/ };
51 | /******/
52 | /******/ // create a fake namespace object
53 | /******/ // mode & 1: value is a module id, require it
54 | /******/ // mode & 2: merge all properties of value into the ns
55 | /******/ // mode & 4: return value when already ns object
56 | /******/ // mode & 8|1: behave like require
57 | /******/ __webpack_require__.t = function(value, mode) {
58 | /******/ if(mode & 1) value = __webpack_require__(value);
59 | /******/ if(mode & 8) return value;
60 | /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61 | /******/ var ns = Object.create(null);
62 | /******/ __webpack_require__.r(ns);
63 | /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64 | /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65 | /******/ return ns;
66 | /******/ };
67 | /******/
68 | /******/ // getDefaultExport function for compatibility with non-harmony modules
69 | /******/ __webpack_require__.n = function(module) {
70 | /******/ var getter = module && module.__esModule ?
71 | /******/ function getDefault() { return module['default']; } :
72 | /******/ function getModuleExports() { return module; };
73 | /******/ __webpack_require__.d(getter, 'a', getter);
74 | /******/ return getter;
75 | /******/ };
76 | /******/
77 | /******/ // Object.prototype.hasOwnProperty.call
78 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79 | /******/
80 | /******/ // __webpack_public_path__
81 | /******/ __webpack_require__.p = "";
82 | /******/
83 | /******/
84 | /******/ // Load entry module and return exports
85 | /******/ return __webpack_require__(__webpack_require__.s = "112a");
86 | /******/ })
87 | /************************************************************************/
88 | /******/ ({
89 |
90 | /***/ "00db":
91 | /***/ (function(module, exports, __webpack_require__) {
92 |
93 | var MATCH = __webpack_require__("1277")('match');
94 | module.exports = function (KEY) {
95 | var re = /./;
96 | try {
97 | '/./'[KEY](re);
98 | } catch (e) {
99 | try {
100 | re[MATCH] = false;
101 | return !'/./'[KEY](re);
102 | } catch (f) { /* empty */ }
103 | } return true;
104 | };
105 |
106 |
107 | /***/ }),
108 |
109 | /***/ "0614":
110 | /***/ (function(module, exports) {
111 |
112 | module.exports = function (bitmap, value) {
113 | return {
114 | enumerable: !(bitmap & 1),
115 | configurable: !(bitmap & 2),
116 | writable: !(bitmap & 4),
117 | value: value
118 | };
119 | };
120 |
121 |
122 | /***/ }),
123 |
124 | /***/ "0cc1":
125 | /***/ (function(module, exports) {
126 |
127 | module.exports = function (exec) {
128 | try {
129 | return !!exec();
130 | } catch (e) {
131 | return true;
132 | }
133 | };
134 |
135 |
136 | /***/ }),
137 |
138 | /***/ "112a":
139 | /***/ (function(module, __webpack_exports__, __webpack_require__) {
140 |
141 | "use strict";
142 | __webpack_require__.r(__webpack_exports__);
143 |
144 | // CONCATENATED MODULE: ./node_modules/_@vue_cli-service@3.12.1@@vue/cli-service/lib/commands/build/setPublicPath.js
145 | // This file is imported into lib/wc client bundles.
146 |
147 | if (typeof window !== 'undefined') {
148 | if (true) {
149 | __webpack_require__("e67d")
150 | }
151 |
152 | var i
153 | if ((i = window.document.currentScript) && (i = i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))) {
154 | __webpack_require__.p = i[1] // eslint-disable-line
155 | }
156 | }
157 |
158 | // Indicate to webpack that this file can be concatenated
159 | /* harmony default export */ var setPublicPath = (null);
160 |
161 | // EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.function.name.js
162 | var es6_function_name = __webpack_require__("7cfd");
163 |
164 | // CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"fdebafe2-vue-loader-template"}!./node_modules/_vue-loader@15.7.2@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.7.2@vue-loader/lib??vue-loader-options!./packages/src/index.vue?vue&type=template&id=240804a7&scoped=true&
165 | var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-select',{ref:"selectTree",attrs:{"disabled":_vm.disabled,"placeholder":_vm.placeholder,"size":_vm.size,"clearable":_vm.clearable,"multiple":_vm.multiple,"collapse-tags":_vm.collapseTags,"filterable":_vm.filterable,"filter-method":_vm.selectFilterMethod,"popper-append-to-body":_vm.popperAppendToBody},on:{"clear":_vm.selectClearAll,"visible-change":_vm.selectVisibleChange,"remove-tag":_vm.selectRemoveTag},model:{value:(_vm.label),callback:function ($$v) {_vm.label=$$v},expression:"label"}},[_c('el-option',{directives:[{name:"show",rawName:"v-show",value:(false),expression:"false"}],attrs:{"value":"1"}}),_c('el-tree',{ref:"tree",attrs:{"node-key":_vm.nodeKey,"show-checkbox":_vm.showCheckbox,"expand-on-click-node":_vm.expandOnClickNode,"data":_vm.data,"props":_vm.props,"check-strictly":_vm.checkStrictly,"highlight-current":_vm.highlightCurrent,"default-expand-all":_vm.defaultExpandAll,"default-expanded-keys":_vm.defaultExpandedKeys,"filter-node-method":_vm.treeFilterNode},on:{"node-click":_vm.treeNodeClick,"check":_vm.treeCheck,"current-change":_vm.treeCurrentChange,"check-change":_vm.treeCheckChange}})],1)}
166 | var staticRenderFns = []
167 |
168 |
169 | // CONCATENATED MODULE: ./packages/src/index.vue?vue&type=template&id=240804a7&scoped=true&
170 |
171 | // EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es7.array.includes.js
172 | var es7_array_includes = __webpack_require__("40c5");
173 |
174 | // EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.string.includes.js
175 | var es6_string_includes = __webpack_require__("23cc");
176 |
177 | // EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es7.symbol.async-iterator.js
178 | var es7_symbol_async_iterator = __webpack_require__("4b5e");
179 |
180 | // EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.symbol.js
181 | var es6_symbol = __webpack_require__("6c28");
182 |
183 | // EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/web.dom.iterable.js
184 | var web_dom_iterable = __webpack_require__("4634");
185 |
186 | // EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.object.assign.js
187 | var es6_object_assign = __webpack_require__("e783");
188 |
189 | // EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.array.sort.js
190 | var es6_array_sort = __webpack_require__("de90");
191 |
192 | // EXTERNAL MODULE: ./node_modules/_core-js@2.6.10@core-js/modules/es6.regexp.to-string.js
193 | var es6_regexp_to_string = __webpack_require__("cc1d");
194 |
195 | // CONCATENATED MODULE: ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.0.6@babel-loader/lib!./packages/src/js?vue&type=script&lang=js&
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 | /* harmony default export */ var js_vue_type_script_lang_js_ = ({
205 | name: 'treeSelect',
206 | props: {
207 | checkHalf: {
208 | type: Boolean,
209 | default: false
210 | },
211 |
212 | /*select属性*/
213 | value: {
214 | required: true
215 | },
216 | clearable: Boolean,
217 | placeholder: {
218 | type: String,
219 | default: '请选择'
220 | },
221 | size: {
222 | type: String,
223 | default: 'mini'
224 | },
225 | filterable: Boolean,
226 | popperAppendToBody: Boolean,
227 | disabled: {
228 | type: Boolean,
229 | default: false
230 | },
231 |
232 | /*tree属性*/
233 | nodeKey: {
234 | type: String,
235 | default: 'id'
236 | },
237 | checkStrictly: Boolean,
238 | data: {
239 | type: Array,
240 | default: function _default() {
241 | return [];
242 | }
243 | },
244 | props: {
245 | default: function _default() {
246 | return {};
247 | }
248 | },
249 | showCheckbox: {
250 | type: Boolean,
251 | default: false
252 | },
253 | defaultExpandAll: Boolean,
254 | defaultExpandedKeys: Array
255 | },
256 | data: function data() {
257 | return {
258 | label: this.showCheckbox ? [] : '',
259 | //select-绑定值
260 | expandOnClickNode: this.showCheckbox,
261 | //tree-是否在点击节点的时候展开或者收缩节点
262 | multiple: this.showCheckbox,
263 | //select-是否多选
264 | collapseTags: this.showCheckbox,
265 | //select-多选时是否将选中值按文字的形式展示
266 | highlightCurrent: !this.showCheckbox,
267 | //tree-是否高亮当前选中节点
268 | mergeProps: {
269 | children: 'children',
270 | label: 'label',
271 | disabled: 'disabled',
272 | pid: 'pid' //父级ID
273 |
274 | },
275 | mapById: {}
276 | };
277 | },
278 | watch: {
279 | value: {
280 | deep: true,
281 | handler: function handler(newValue, oldValue) {
282 | var newValueClone = [],
283 | oldValueClone = [];
284 | var toString = Object.prototype.toString;
285 |
286 | var clone = function clone(array) {
287 | return JSON.parse(JSON.stringify(array));
288 | };
289 |
290 | if (toString.apply(newValue) == "[object Array]") {
291 | newValueClone = clone(newValue);
292 | newValueClone.sort();
293 | }
294 |
295 | if (toString.apply(oldValue) == "[object Array]") {
296 | oldValueClone = clone(oldValue);
297 | oldValueClone.sort();
298 | }
299 |
300 | if (toString.apply(newValue) == "[object Array]" && newValueClone.toString() != oldValueClone.toString() || toString.apply(newValue) != "[object Array]" && newValue != oldValue) {
301 | if (this.showCheckbox) {
302 | this.setCheckedKeys(newValue, false, false);
303 | } else {
304 | this.setCurrentKey(this.isEmpty(newValue) ? null : newValue, false);
305 | }
306 | }
307 | }
308 | },
309 | data: {
310 | deep: true,
311 | handler: function handler(data) {
312 | this.mapById = {};
313 | this.mapDataById(data);
314 |
315 | if (!this.isEmpty(this.value)) {
316 | if (this.showCheckbox) {
317 | this.setCheckedKeys(this.value, false, false);
318 | } else {
319 | this.setCurrentKey(this.isEmpty(this.value) ? null : this.value, false);
320 | }
321 | }
322 | }
323 | },
324 | multiple: function multiple(boolean) {
325 | if (boolean) this.label = [];
326 | },
327 | showCheckbox: function showCheckbox(boolean) {
328 | this.expandOnClickNode = this.multiple = this.collapseTags = boolean;
329 | this.highlightCurrent = !boolean;
330 | this.label = boolean ? [] : '';
331 | }
332 | },
333 | created: function created() {
334 | this.mergeProps = Object.assign({}, this.mergeProps, this.props);
335 | },
336 | methods: {
337 | mapDataById: function mapDataById(data) {
338 | var _this = this;
339 |
340 | data.forEach(function (item) {
341 | _this.mapById[item.id] = item;
342 |
343 | if (item[_this.mergeProps.children]) {
344 | _this.mapDataById(item[_this.mergeProps.children]);
345 | }
346 | });
347 | },
348 | isEmpty: function isEmpty(value) {
349 | return value === '' || value === null || value === undefined;
350 | },
351 |
352 | /**
353 | * 可清空的单选模式下用户点击清空按钮时触发
354 | */
355 | selectClearAll: function selectClearAll() {
356 | this.$emit('input', this.showCheckbox ? [] : '');
357 |
358 | if (!this.multiple) {
359 | this.$refs.tree.setCurrentKey(null);
360 | } else {
361 | this.$refs.tree.setCheckedKeys([]);
362 | }
363 | },
364 |
365 | /**
366 | * 多选模式下移除tag时触发
367 | * @param tag 移除的tag值
368 | */
369 | selectRemoveTag: function selectRemoveTag(tag) {
370 | var _this2 = this;
371 |
372 | var self = this;
373 | var data = this.$refs.tree.getCheckedNodes();
374 | var checkedIds = this.$refs.tree.getCheckedKeys();
375 | var keys = []; //复选框时,checkStrictly:true时父节点的选择影响子节点,子节点的选择不影响父节点;false=父子互相关联
376 |
377 | if (this.checkStrictly) {
378 | //不关联
379 | data.forEach(function (item) {
380 | if (item[_this2.mergeProps.label] != tag) {
381 | keys.push(item[_this2.nodeKey]);
382 | }
383 | });
384 | } else {
385 | //关联
386 | var tagId, tagPid; //删除项的id和父级id
387 |
388 | var removeIds = []; //要删除的id
389 | //获取当前删除项的id和父级id
390 |
391 | var _iteratorNormalCompletion = true;
392 | var _didIteratorError = false;
393 | var _iteratorError = undefined;
394 |
395 | try {
396 | for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
397 | var item = _step.value;
398 |
399 | if (item[this.mergeProps.label] == tag) {
400 | tagId = item[this.nodeKey];
401 | tagPid = item[this.mergeProps.pid];
402 | break;
403 | }
404 | } //获取过滤的子级id
405 |
406 | } catch (err) {
407 | _didIteratorError = true;
408 | _iteratorError = err;
409 | } finally {
410 | try {
411 | if (!_iteratorNormalCompletion && _iterator.return != null) {
412 | _iterator.return();
413 | }
414 | } finally {
415 | if (_didIteratorError) {
416 | throw _iteratorError;
417 | }
418 | }
419 | }
420 |
421 | var getChildrenIds = function getChildrenIds(data) {
422 | var ids = [];
423 | data.forEach(function (item) {
424 | ids.push(item[self.nodeKey]);
425 |
426 | if (Array.isArray(item[self.mergeProps.children]) && item[self.mergeProps.children].length) {
427 | ids = ids.concat(getChildrenIds(item[self.mergeProps.children]));
428 | }
429 | });
430 | return ids;
431 | }; //获取过滤的父级id
432 |
433 |
434 | var getParentIds = function getParentIds(data, pid) {
435 | var ids = [];
436 | var _iteratorNormalCompletion2 = true;
437 | var _didIteratorError2 = false;
438 | var _iteratorError2 = undefined;
439 |
440 | try {
441 | for (var _iterator2 = data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
442 | var item = _step2.value;
443 |
444 | if (item[self.nodeKey] == pid) {
445 | ids.push(item[self.nodeKey]);
446 | ids = ids.concat(getParentIds(data, item[self.mergeProps.pid]));
447 | break;
448 | }
449 | }
450 | } catch (err) {
451 | _didIteratorError2 = true;
452 | _iteratorError2 = err;
453 | } finally {
454 | try {
455 | if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
456 | _iterator2.return();
457 | }
458 | } finally {
459 | if (_didIteratorError2) {
460 | throw _iteratorError2;
461 | }
462 | }
463 | }
464 |
465 | return ids;
466 | }; //获取不满足的id
467 |
468 |
469 | var _iteratorNormalCompletion3 = true;
470 | var _didIteratorError3 = false;
471 | var _iteratorError3 = undefined;
472 |
473 | try {
474 | for (var _iterator3 = data[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
475 | var _item = _step3.value;
476 |
477 | if (_item[this.nodeKey] == tagId) {
478 | removeIds.push(_item[this.nodeKey]); //当前项过滤
479 | //获取过滤的子级id
480 |
481 | if (Array.isArray(_item[this.mergeProps.children]) && _item[this.mergeProps.children].length) {
482 | removeIds = removeIds.concat(getChildrenIds(_item[this.mergeProps.children]));
483 | } //获取过滤的父级id
484 |
485 |
486 | removeIds = removeIds.concat(getParentIds(data, tagPid));
487 | break;
488 | }
489 | }
490 | } catch (err) {
491 | _didIteratorError3 = true;
492 | _iteratorError3 = err;
493 | } finally {
494 | try {
495 | if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
496 | _iterator3.return();
497 | }
498 | } finally {
499 | if (_didIteratorError3) {
500 | throw _iteratorError3;
501 | }
502 | }
503 | }
504 |
505 | keys = checkedIds.filter(function (id) {
506 | return !removeIds.includes(id);
507 | }); //显示文本信息处理
508 |
509 | var labels = [];
510 | data.forEach(function (item) {
511 | if (keys.includes(item[_this2.nodeKey])) {
512 | labels.push(item[_this2.mergeProps.label]);
513 | }
514 | });
515 | this.label = labels;
516 | }
517 |
518 | this.$refs.tree.setCheckedKeys(keys);
519 | this.$emit('input', keys);
520 | },
521 |
522 | /**
523 | * 下拉框出现/隐藏时触发
524 | * 出现则为 true,隐藏则为 false
525 | * @param bool
526 | */
527 | selectVisibleChange: function selectVisibleChange(bool) {
528 | if (!bool) this.dataRestore();
529 | },
530 |
531 | /**
532 | * 搜索
533 | * @param query
534 | */
535 | selectFilterMethod: function selectFilterMethod() {
536 | var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
537 | this.$refs.tree.filter(query);
538 | },
539 |
540 | /**
541 | * 数据还原
542 | */
543 | dataRestore: function dataRestore() {
544 | if (this.filterable) {
545 | this.selectFilterMethod();
546 | }
547 | },
548 |
549 | /**
550 | * 对树节点进行筛选时执行的方法,返回 true 表示这个节点可以显示,返回 false 则表示这个节点会被隐藏
551 | */
552 | treeFilterNode: function treeFilterNode(value, data, node) {
553 | if (!value) return true;
554 | return data[this.mergeProps.label].indexOf(value) !== -1;
555 | },
556 |
557 | /**
558 | * 节点被点击时的回调
559 | * 共三个参数,依次为:传递给 data 属性的数组中该节点所对应的对象、节点对应的 Node、节点组件本身。
560 | * @param data
561 | * @param node
562 | * @param component
563 | */
564 | treeNodeClick: function treeNodeClick(data, node, component) {
565 | if (this.showCheckbox) {//多选
566 | } else {
567 | //单选
568 | if (data[this.mergeProps.disabled]) {
569 | return false;
570 | }
571 |
572 | this.label = node.label;
573 | this.$refs.selectTree.blur();
574 | this.$emit('input', node.key);
575 | this.$emit('node-click', data, node, component);
576 | }
577 | },
578 |
579 | /**
580 | * 当复选框被点击的时候触发
581 | *共两个参数,依次为:传递给 data 属性的数组中该节点所对应的对象、树目前的选中状态对象,
582 | * 包含 checkedNodes、checkedKeys、halfCheckedNodes、halfCheckedKeys 四个属性
583 | */
584 | treeCheck: function treeCheck(data, _ref) {
585 | var _this3 = this;
586 |
587 | var checkedNodes = _ref.checkedNodes,
588 | checkedKeys = _ref.checkedKeys,
589 | halfCheckedNodes = _ref.halfCheckedNodes,
590 | halfCheckedKeys = _ref.halfCheckedKeys;
591 |
592 | if (this.checkStrictly) {
593 | //父子不相关联
594 | //当前节点是否选中
595 | var checked = checkedKeys.includes(data[this.nodeKey]);
596 | var checkedArray = [],
597 | //当前树的选择节点id
598 | currendChidenIds = []; //当前节点子节点id数组
599 |
600 | var checkedLabelArray = []; //当前树的选择节点名称
601 | //获取子树id
602 |
603 | var getIds = function getIds(array) {
604 | var checkedIds = [];
605 |
606 | if (Array.isArray(array) && array.length) {
607 | var _iteratorNormalCompletion4 = true;
608 | var _didIteratorError4 = false;
609 | var _iteratorError4 = undefined;
610 |
611 | try {
612 | for (var _iterator4 = array[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
613 | var item = _step4.value;
614 | checkedIds.push(item[_this3.nodeKey]);
615 |
616 | if (Array.isArray(item[_this3.mergeProps.children]) && item[_this3.mergeProps.children].length) {
617 | checkedIds = checkedIds.concat(getIds(item[_this3.mergeProps.children]));
618 | }
619 | }
620 | } catch (err) {
621 | _didIteratorError4 = true;
622 | _iteratorError4 = err;
623 | } finally {
624 | try {
625 | if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
626 | _iterator4.return();
627 | }
628 | } finally {
629 | if (_didIteratorError4) {
630 | throw _iteratorError4;
631 | }
632 | }
633 | }
634 | }
635 |
636 | return checkedIds;
637 | }; //获取父节点id
638 |
639 |
640 | var getParentIds = function getParentIds(data) {
641 | var checkedIds = [];
642 |
643 | if (data[_this3.mergeProps.pid]) {
644 | checkedIds.push(data[_this3.mergeProps.pid]);
645 |
646 | if (_this3.mapById[data[_this3.mergeProps.pid]]) {
647 | checkedIds = checkedIds.concat(getParentIds(_this3.mapById[data[_this3.mergeProps.pid]]));
648 | }
649 | }
650 |
651 | return checkedIds;
652 | };
653 |
654 | if (Array.isArray(data[this.mergeProps.children]) && data[this.mergeProps.children].length) {
655 | currendChidenIds = getIds(data[this.mergeProps.children]); //获取树的选中id(不包含当前子节点id)
656 |
657 | var _iteratorNormalCompletion5 = true;
658 | var _didIteratorError5 = false;
659 | var _iteratorError5 = undefined;
660 |
661 | try {
662 | for (var _iterator5 = checkedKeys[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
663 | var id = _step5.value;
664 |
665 | if (!currendChidenIds.includes(id)) {
666 | checkedArray.push(id);
667 | }
668 | } //当前节点选中,加入当前子节点id
669 |
670 | } catch (err) {
671 | _didIteratorError5 = true;
672 | _iteratorError5 = err;
673 | } finally {
674 | try {
675 | if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
676 | _iterator5.return();
677 | }
678 | } finally {
679 | if (_didIteratorError5) {
680 | throw _iteratorError5;
681 | }
682 | }
683 | }
684 |
685 | if (checked) {
686 | checkedArray = checkedArray.concat(currendChidenIds);
687 | } //将子节点所有关联的父节点都选中直到顶部
688 |
689 |
690 | if (this.checkHalf) {
691 | checkedArray = checkedArray.concat(getParentIds(data));
692 | }
693 |
694 | this.setCheckedKeys(checkedArray);
695 | } else {
696 | //将子节点所有关联的父节点都选中直到顶部
697 | if (this.checkHalf) {
698 | checkedArray = getParentIds(data);
699 | var keys = checkedNodes.map(function (item) {
700 | return item[_this3.nodeKey];
701 | });
702 | checkedArray = checkedArray.concat(keys);
703 | this.setCheckedKeys(checkedArray);
704 | } else {
705 | this.label = checkedNodes.map(function (item) {
706 | return item[_this3.mergeProps.label];
707 | });
708 | this.$emit('input', checkedNodes.map(function (item) {
709 | return item[_this3.nodeKey];
710 | }));
711 | }
712 | }
713 | } else {
714 | this.label = checkedNodes.map(function (item) {
715 | return item[_this3.mergeProps.label];
716 | });
717 | this.$emit('input', checkedNodes.map(function (item) {
718 | return item[_this3.nodeKey];
719 | }));
720 | }
721 | },
722 |
723 | /**
724 | * 当前选中节点变化时触发的事件
725 | * @param data 当前节点的数据
726 | * @param node 前节点的 Node 对象
727 | */
728 | treeCurrentChange: function treeCurrentChange(data, node) {},
729 |
730 | /**
731 | * 节点选中状态发生变化时的回调
732 | * @param data 传递给 data 属性的数组中该节点所对应的对象
733 | * @param checked 节点本身是否被选中
734 | * @param childChecked 节点的子树中是否有被选中的节点
735 | */
736 | treeCheckChange: function treeCheckChange(data, checked, childChecked) {},
737 |
738 | /**
739 | * 若节点可被选择(即 show-checkbox 为 true),则返回目前被选中的节点所组成的数组
740 | */
741 | getCheckedNodes: function getCheckedNodes() {
742 | if (this.showCheckbox) return this.$refs.tree.getCheckedNodes();
743 | },
744 |
745 | /**
746 | * 设置目前勾选的节点,使用此方法必须设置 node-key 属性
747 | * @param nodes 接收勾选节点数据的数组
748 | */
749 | setCheckedNodes: function setCheckedNodes(nodes) {
750 | if (this.showCheckbox) this.$refs.tree.setCheckedNodes(nodes);
751 | },
752 |
753 | /**
754 | * 若节点可被选择(即 show-checkbox 为 true),则返回目前被选中的节点的 key 所组成的数组
755 | */
756 | getCheckedKeys: function getCheckedKeys() {
757 | if (this.showCheckbox) return this.$refs.tree.getCheckedKeys();
758 | },
759 |
760 | /**
761 | * 通过 keys 设置目前勾选的节点,使用此方法必须设置 node-key 属性
762 | * (keys, leafOnly) 接收两个参数
763 | * @param keys 勾选节点的 key 的数组
764 | * @param leafOnly boolean 类型的参数,若为 true 则仅设置叶子节点的选中状态,默认值为 false
765 | * @param emit 是否触发input事件
766 | */
767 | setCheckedKeys: function setCheckedKeys(keys) {
768 | var _this4 = this;
769 |
770 | var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
771 | var emit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
772 | this.$nextTick(function () {
773 | if (_this4.showCheckbox) {
774 | _this4.$refs.tree.setCheckedKeys(keys, leafOnly);
775 |
776 | var nodes = _this4.$refs.tree.getCheckedNodes();
777 |
778 | _this4.label = nodes.map(function (item) {
779 | return item[_this4.mergeProps.label];
780 | });
781 |
782 | if (emit) {
783 | _this4.$emit('input', nodes.map(function (item) {
784 | return item[_this4.nodeKey];
785 | }));
786 | }
787 | }
788 | });
789 | },
790 |
791 | /**
792 | * 获取当前被选中节点的 key,使用此方法必须设置 node-key 属性,若没有节点被选中则返回 null
793 | */
794 | getCurrentKey: function getCurrentKey() {
795 | return this.$refs.tree.getCurrentKey();
796 | },
797 |
798 | /**
799 | * 通过 key 设置某个节点的当前选中状态,使用此方法必须设置 node-key 属性
800 | * @param key 待被选节点的 key,若为 null 则取消当前高亮的节点
801 | * @param emit 是否触发input事件
802 | */
803 | setCurrentKey: function setCurrentKey(key) {
804 | var _this5 = this;
805 |
806 | var emit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
807 | this.$nextTick(function () {
808 | if (key === null && _this5.$refs.tree.getCurrentKey() === null) return;
809 |
810 | _this5.$refs.tree.setCurrentKey(key);
811 |
812 | var node = _this5.$refs.tree.getCurrentNode();
813 |
814 | if (node) {
815 | _this5.label = node[_this5.mergeProps.label];
816 |
817 | if (emit) {
818 | _this5.$emit('input', node[_this5.nodeKey]);
819 | }
820 | } else {
821 | _this5.label = '';
822 | }
823 | });
824 | },
825 |
826 | /**
827 | * 获取当前被选中节点的 data,若没有节点被选中则返回 null
828 | */
829 | getCurrentNode: function getCurrentNode() {
830 | return this.$refs.tree.getCurrentNode();
831 | },
832 |
833 | /**
834 | * 通过 node 设置某个节点的当前选中状态,使用此方法必须设置 node-key 属性
835 | * @param node 待被选节点的 node
836 | */
837 | setCurrentNode: function setCurrentNode(node) {
838 | this.$refs.tree.setCurrentNode(node);
839 | }
840 | }
841 | });
842 | // CONCATENATED MODULE: ./packages/src/js?vue&type=script&lang=js&
843 | /* harmony default export */ var src_js_vue_type_script_lang_js_ = (js_vue_type_script_lang_js_);
844 | // EXTERNAL MODULE: ./packages/src/index.vue?vue&type=style&index=0&id=240804a7&scoped=true&lang=less&
845 | var srcvue_type_style_index_0_id_240804a7_scoped_true_lang_less_ = __webpack_require__("d7f8");
846 |
847 | // CONCATENATED MODULE: ./node_modules/_vue-loader@15.7.2@vue-loader/lib/runtime/componentNormalizer.js
848 | /* globals __VUE_SSR_CONTEXT__ */
849 |
850 | // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
851 | // This module is a runtime utility for cleaner component module output and will
852 | // be included in the final webpack user bundle.
853 |
854 | function normalizeComponent (
855 | scriptExports,
856 | render,
857 | staticRenderFns,
858 | functionalTemplate,
859 | injectStyles,
860 | scopeId,
861 | moduleIdentifier, /* server only */
862 | shadowMode /* vue-cli only */
863 | ) {
864 | // Vue.extend constructor export interop
865 | var options = typeof scriptExports === 'function'
866 | ? scriptExports.options
867 | : scriptExports
868 |
869 | // render functions
870 | if (render) {
871 | options.render = render
872 | options.staticRenderFns = staticRenderFns
873 | options._compiled = true
874 | }
875 |
876 | // functional template
877 | if (functionalTemplate) {
878 | options.functional = true
879 | }
880 |
881 | // scopedId
882 | if (scopeId) {
883 | options._scopeId = 'data-v-' + scopeId
884 | }
885 |
886 | var hook
887 | if (moduleIdentifier) { // server build
888 | hook = function (context) {
889 | // 2.3 injection
890 | context =
891 | context || // cached call
892 | (this.$vnode && this.$vnode.ssrContext) || // stateful
893 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
894 | // 2.2 with runInNewContext: true
895 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
896 | context = __VUE_SSR_CONTEXT__
897 | }
898 | // inject component styles
899 | if (injectStyles) {
900 | injectStyles.call(this, context)
901 | }
902 | // register component module identifier for async chunk inferrence
903 | if (context && context._registeredComponents) {
904 | context._registeredComponents.add(moduleIdentifier)
905 | }
906 | }
907 | // used by ssr in case component is cached and beforeCreate
908 | // never gets called
909 | options._ssrRegister = hook
910 | } else if (injectStyles) {
911 | hook = shadowMode
912 | ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
913 | : injectStyles
914 | }
915 |
916 | if (hook) {
917 | if (options.functional) {
918 | // for template-only hot-reload because in that case the render fn doesn't
919 | // go through the normalizer
920 | options._injectStyles = hook
921 | // register for functioal component in vue file
922 | var originalRender = options.render
923 | options.render = function renderWithStyleInjection (h, context) {
924 | hook.call(context)
925 | return originalRender(h, context)
926 | }
927 | } else {
928 | // inject component registration as beforeCreate hook
929 | var existing = options.beforeCreate
930 | options.beforeCreate = existing
931 | ? [].concat(existing, hook)
932 | : [hook]
933 | }
934 | }
935 |
936 | return {
937 | exports: scriptExports,
938 | options: options
939 | }
940 | }
941 |
942 | // CONCATENATED MODULE: ./packages/src/index.vue
943 |
944 |
945 |
946 |
947 |
948 |
949 | /* normalize component */
950 |
951 | var component = normalizeComponent(
952 | src_js_vue_type_script_lang_js_,
953 | render,
954 | staticRenderFns,
955 | false,
956 | null,
957 | "240804a7",
958 | null
959 |
960 | )
961 |
962 | /* harmony default export */ var src = (component.exports);
963 | // CONCATENATED MODULE: ./packages/index.js
964 |
965 |
966 |
967 | src.install = function (Vue) {
968 | Vue.component(src.name, src);
969 | };
970 |
971 | /* harmony default export */ var packages_0 = (src);
972 | // CONCATENATED MODULE: ./node_modules/_@vue_cli-service@3.12.1@@vue/cli-service/lib/commands/build/entry-lib.js
973 |
974 |
975 | /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (packages_0);
976 |
977 |
978 |
979 | /***/ }),
980 |
981 | /***/ "1277":
982 | /***/ (function(module, exports, __webpack_require__) {
983 |
984 | var store = __webpack_require__("f341")('wks');
985 | var uid = __webpack_require__("4d2c");
986 | var Symbol = __webpack_require__("3f8b").Symbol;
987 | var USE_SYMBOL = typeof Symbol == 'function';
988 |
989 | var $exports = module.exports = function (name) {
990 | return store[name] || (store[name] =
991 | USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
992 | };
993 |
994 | $exports.store = store;
995 |
996 |
997 | /***/ }),
998 |
999 | /***/ "17cb":
1000 | /***/ (function(module, exports, __webpack_require__) {
1001 |
1002 | var document = __webpack_require__("3f8b").document;
1003 | module.exports = document && document.documentElement;
1004 |
1005 |
1006 | /***/ }),
1007 |
1008 | /***/ "1f9e":
1009 | /***/ (function(module, exports, __webpack_require__) {
1010 |
1011 | // false -> Array#indexOf
1012 | // true -> Array#includes
1013 | var toIObject = __webpack_require__("6117");
1014 | var toLength = __webpack_require__("8941");
1015 | var toAbsoluteIndex = __webpack_require__("c3a9");
1016 | module.exports = function (IS_INCLUDES) {
1017 | return function ($this, el, fromIndex) {
1018 | var O = toIObject($this);
1019 | var length = toLength(O.length);
1020 | var index = toAbsoluteIndex(fromIndex, length);
1021 | var value;
1022 | // Array#includes uses SameValueZero equality algorithm
1023 | // eslint-disable-next-line no-self-compare
1024 | if (IS_INCLUDES && el != el) while (length > index) {
1025 | value = O[index++];
1026 | // eslint-disable-next-line no-self-compare
1027 | if (value != value) return true;
1028 | // Array#indexOf ignores holes, Array#includes - not
1029 | } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
1030 | if (O[index] === el) return IS_INCLUDES || index || 0;
1031 | } return !IS_INCLUDES && -1;
1032 | };
1033 | };
1034 |
1035 |
1036 | /***/ }),
1037 |
1038 | /***/ "23cc":
1039 | /***/ (function(module, exports, __webpack_require__) {
1040 |
1041 | "use strict";
1042 | // 21.1.3.7 String.prototype.includes(searchString, position = 0)
1043 |
1044 | var $export = __webpack_require__("2498");
1045 | var context = __webpack_require__("69ba");
1046 | var INCLUDES = 'includes';
1047 |
1048 | $export($export.P + $export.F * __webpack_require__("00db")(INCLUDES), 'String', {
1049 | includes: function includes(searchString /* , position = 0 */) {
1050 | return !!~context(this, searchString, INCLUDES)
1051 | .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
1052 | }
1053 | });
1054 |
1055 |
1056 | /***/ }),
1057 |
1058 | /***/ "2498":
1059 | /***/ (function(module, exports, __webpack_require__) {
1060 |
1061 | var global = __webpack_require__("3f8b");
1062 | var core = __webpack_require__("da27");
1063 | var hide = __webpack_require__("b8ea");
1064 | var redefine = __webpack_require__("a6d5");
1065 | var ctx = __webpack_require__("e85e");
1066 | var PROTOTYPE = 'prototype';
1067 |
1068 | var $export = function (type, name, source) {
1069 | var IS_FORCED = type & $export.F;
1070 | var IS_GLOBAL = type & $export.G;
1071 | var IS_STATIC = type & $export.S;
1072 | var IS_PROTO = type & $export.P;
1073 | var IS_BIND = type & $export.B;
1074 | var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
1075 | var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
1076 | var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
1077 | var key, own, out, exp;
1078 | if (IS_GLOBAL) source = name;
1079 | for (key in source) {
1080 | // contains in native
1081 | own = !IS_FORCED && target && target[key] !== undefined;
1082 | // export native or passed
1083 | out = (own ? target : source)[key];
1084 | // bind timers to global for call from export context
1085 | exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
1086 | // extend global
1087 | if (target) redefine(target, key, out, type & $export.U);
1088 | // export
1089 | if (exports[key] != out) hide(exports, key, exp);
1090 | if (IS_PROTO && expProto[key] != out) expProto[key] = out;
1091 | }
1092 | };
1093 | global.core = core;
1094 | // type bitmap
1095 | $export.F = 1; // forced
1096 | $export.G = 2; // global
1097 | $export.S = 4; // static
1098 | $export.P = 8; // proto
1099 | $export.B = 16; // bind
1100 | $export.W = 32; // wrap
1101 | $export.U = 64; // safe
1102 | $export.R = 128; // real proto method for `library`
1103 | module.exports = $export;
1104 |
1105 |
1106 | /***/ }),
1107 |
1108 | /***/ "25ae":
1109 | /***/ (function(module, exports, __webpack_require__) {
1110 |
1111 | module.exports = !__webpack_require__("f9a5") && !__webpack_require__("0cc1")(function () {
1112 | return Object.defineProperty(__webpack_require__("6618")('div'), 'a', { get: function () { return 7; } }).a != 7;
1113 | });
1114 |
1115 |
1116 | /***/ }),
1117 |
1118 | /***/ "2896":
1119 | /***/ (function(module, exports, __webpack_require__) {
1120 |
1121 | // style-loader: Adds some css to the DOM by adding a