cy-element-ui 1.1.19 → 1.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/lib/index.js +1 -1
  2. package/package.json +1 -1
  3. package/src/index.js +1 -1
  4. package/lib/Alert.js +0 -420
  5. package/lib/Aside.js +0 -277
  6. package/lib/Autocomplete.js +0 -2051
  7. package/lib/Avatar.js +0 -363
  8. package/lib/Backtop.js +0 -404
  9. package/lib/Badge.js +0 -334
  10. package/lib/Breadcrumb.js +0 -293
  11. package/lib/BreadcrumbItem.js +0 -322
  12. package/lib/Button.js +0 -357
  13. package/lib/ButtonGroup.js +0 -262
  14. package/lib/Calendar.js +0 -1146
  15. package/lib/Card.js +0 -297
  16. package/lib/Carousel.js +0 -707
  17. package/lib/CarouselItem.js +0 -434
  18. package/lib/Cascader.js +0 -4641
  19. package/lib/CascaderPanel.js +0 -2602
  20. package/lib/Checkbox.js +0 -627
  21. package/lib/CheckboxButton.js +0 -583
  22. package/lib/CheckboxGroup.js +0 -313
  23. package/lib/Col.js +0 -177
  24. package/lib/Collapse.js +0 -329
  25. package/lib/CollapseItem.js +0 -497
  26. package/lib/ColorPicker.js +0 -2885
  27. package/lib/Container.js +0 -288
  28. package/lib/CySelectDisplayInput.js +0 -367
  29. package/lib/CySubTitle.js +0 -295
  30. package/lib/CyTabDialog.js +0 -1184
  31. package/lib/CyTreeSelect.js +0 -4422
  32. package/lib/DatePicker.js +0 -7574
  33. package/lib/Descriptions.js +0 -457
  34. package/lib/DescriptionsItem.js +0 -140
  35. package/lib/Dialog.js +0 -598
  36. package/lib/Divider.js +0 -313
  37. package/lib/Drawer.js +0 -592
  38. package/lib/Dropdown.js +0 -856
  39. package/lib/DropdownItem.js +0 -316
  40. package/lib/DropdownMenu.js +0 -351
  41. package/lib/Empty.js +0 -730
  42. package/lib/Footer.js +0 -277
  43. package/lib/Form.js +0 -466
  44. package/lib/FormItem.js +0 -826
  45. package/lib/Header.js +0 -277
  46. package/lib/Icon.js +0 -265
  47. package/lib/Image.js +0 -1138
  48. package/lib/InfiniteScroll.js +0 -301
  49. package/lib/Input.js +0 -999
  50. package/lib/InputNumber.js +0 -1552
  51. package/lib/Link.js +0 -332
  52. package/lib/Loading.js +0 -631
  53. package/lib/Main.js +0 -264
  54. package/lib/Menu.js +0 -865
  55. package/lib/MenuItem.js +0 -818
  56. package/lib/MenuItemGroup.js +0 -308
  57. package/lib/Message.js +0 -548
  58. package/lib/MessageBox.js +0 -2134
  59. package/lib/Notification.js +0 -615
  60. package/lib/Option.js +0 -474
  61. package/lib/OptionGroup.js +0 -344
  62. package/lib/PageHeader.js +0 -319
  63. package/lib/Pagination.js +0 -4123
  64. package/lib/Popconfirm.js +0 -1025
  65. package/lib/Popover.js +0 -617
  66. package/lib/Progress.js +0 -595
  67. package/lib/Radio.js +0 -497
  68. package/lib/RadioButton.js +0 -463
  69. package/lib/RadioGroup.js +0 -391
  70. package/lib/Rate.js +0 -670
  71. package/lib/Result.js +0 -578
  72. package/lib/Row.js +0 -149
  73. package/lib/Scrollbar.js +0 -423
  74. package/lib/Select.js +0 -3368
  75. package/lib/Skeleton.js +0 -372
  76. package/lib/SkeletonItem.js +0 -342
  77. package/lib/Slider.js +0 -2854
  78. package/lib/Spinner.js +0 -301
  79. package/lib/Statistic.js +0 -533
  80. package/lib/Step.js +0 -522
  81. package/lib/Steps.js +0 -342
  82. package/lib/Submenu.js +0 -700
  83. package/lib/Switch.js +0 -554
  84. package/lib/TabPane.js +0 -332
  85. package/lib/Table.js +0 -6125
  86. package/lib/TableColumn.js +0 -1481
  87. package/lib/Tabs.js +0 -920
  88. package/lib/Tag.js +0 -304
  89. package/lib/TimePicker.js +0 -4059
  90. package/lib/TimeSelect.js +0 -2871
  91. package/lib/Timeline.js +0 -275
  92. package/lib/TimelineItem.js +0 -371
  93. package/lib/Tooltip.js +0 -425
  94. package/lib/Transfer.js +0 -2557
  95. package/lib/Tree.js +0 -2680
  96. package/lib/Upload.js +0 -1782
@@ -1,4422 +0,0 @@
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 = "/dist/";
82
- /******/
83
- /******/
84
- /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 119);
86
- /******/ })
87
- /************************************************************************/
88
- /******/ ({
89
-
90
- /***/ 0:
91
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
-
93
- "use strict";
94
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
95
- /* globals __VUE_SSR_CONTEXT__ */
96
-
97
- // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
98
- // This module is a runtime utility for cleaner component module output and will
99
- // be included in the final webpack user bundle.
100
-
101
- function normalizeComponent(
102
- scriptExports,
103
- render,
104
- staticRenderFns,
105
- functionalTemplate,
106
- injectStyles,
107
- scopeId,
108
- moduleIdentifier /* server only */,
109
- shadowMode /* vue-cli only */
110
- ) {
111
- // Vue.extend constructor export interop
112
- var options =
113
- typeof scriptExports === 'function' ? scriptExports.options : scriptExports
114
-
115
- // render functions
116
- if (render) {
117
- options.render = render
118
- options.staticRenderFns = staticRenderFns
119
- options._compiled = true
120
- }
121
-
122
- // functional template
123
- if (functionalTemplate) {
124
- options.functional = true
125
- }
126
-
127
- // scopedId
128
- if (scopeId) {
129
- options._scopeId = 'data-v-' + scopeId
130
- }
131
-
132
- var hook
133
- if (moduleIdentifier) {
134
- // server build
135
- hook = function (context) {
136
- // 2.3 injection
137
- context =
138
- context || // cached call
139
- (this.$vnode && this.$vnode.ssrContext) || // stateful
140
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
141
- // 2.2 with runInNewContext: true
142
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
143
- context = __VUE_SSR_CONTEXT__
144
- }
145
- // inject component styles
146
- if (injectStyles) {
147
- injectStyles.call(this, context)
148
- }
149
- // register component module identifier for async chunk inferrence
150
- if (context && context._registeredComponents) {
151
- context._registeredComponents.add(moduleIdentifier)
152
- }
153
- }
154
- // used by ssr in case component is cached and beforeCreate
155
- // never gets called
156
- options._ssrRegister = hook
157
- } else if (injectStyles) {
158
- hook = shadowMode
159
- ? function () {
160
- injectStyles.call(
161
- this,
162
- (options.functional ? this.parent : this).$root.$options.shadowRoot
163
- )
164
- }
165
- : injectStyles
166
- }
167
-
168
- if (hook) {
169
- if (options.functional) {
170
- // for template-only hot-reload because in that case the render fn doesn't
171
- // go through the normalizer
172
- options._injectStyles = hook
173
- // register for functional component in vue file
174
- var originalRender = options.render
175
- options.render = function renderWithStyleInjection(h, context) {
176
- hook.call(context)
177
- return originalRender(h, context)
178
- }
179
- } else {
180
- // inject component registration as beforeCreate hook
181
- var existing = options.beforeCreate
182
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
183
- }
184
- }
185
-
186
- return {
187
- exports: scriptExports,
188
- options: options
189
- }
190
- }
191
-
192
-
193
- /***/ }),
194
-
195
- /***/ 1:
196
- /***/ (function(module, exports) {
197
-
198
- module.exports = require("element-ui/lib/utils/dom");
199
-
200
- /***/ }),
201
-
202
- /***/ 11:
203
- /***/ (function(module, exports) {
204
-
205
- module.exports = require("element-ui/lib/utils/shared");
206
-
207
- /***/ }),
208
-
209
- /***/ 119:
210
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
211
-
212
- "use strict";
213
- // ESM COMPAT FLAG
214
- __webpack_require__.r(__webpack_exports__);
215
-
216
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/cy/treeSelect/src/main.vue?vue&type=template&id=5e4054a3
217
- var render = function () {
218
- var _vm = this
219
- var _h = _vm.$createElement
220
- var _c = _vm._self._c || _h
221
- return _c(
222
- "div",
223
- { staticClass: "cy-tree-select" },
224
- [
225
- _c(
226
- "el-popover",
227
- {
228
- attrs: {
229
- placement: "bottom-start",
230
- width: "300",
231
- trigger: "click",
232
- "popper-class": _vm.popperClass,
233
- },
234
- on: {
235
- show: function ($event) {
236
- _vm.popoverOpen = true
237
- },
238
- hide: function ($event) {
239
- _vm.popoverOpen = false
240
- },
241
- },
242
- model: {
243
- value: _vm.popoverOpen,
244
- callback: function ($$v) {
245
- _vm.popoverOpen = $$v
246
- },
247
- expression: "popoverOpen",
248
- },
249
- },
250
- [
251
- _c("div", { staticClass: "cy-tree-select-select-con" }, [
252
- _vm.filterable
253
- ? _c(
254
- "div",
255
- { staticClass: "cy-tree-select-select-con-s" },
256
- [
257
- _c("el-input", {
258
- attrs: {
259
- placeholder: "搜索",
260
- "prefix-icon": "el-icon-search",
261
- clearable: "",
262
- size: "small",
263
- },
264
- model: {
265
- value: _vm.filterText,
266
- callback: function ($$v) {
267
- _vm.filterText = $$v
268
- },
269
- expression: "filterText",
270
- },
271
- }),
272
- ],
273
- 1
274
- )
275
- : _vm._e(),
276
- _vm.showCheckStrictly
277
- ? _c(
278
- "div",
279
- { staticClass: "cy-tree-select-select-con-t" },
280
- [
281
- _c(
282
- "el-checkbox",
283
- {
284
- model: {
285
- value: _vm.isCheckStrictly,
286
- callback: function ($$v) {
287
- _vm.isCheckStrictly = $$v
288
- },
289
- expression: "isCheckStrictly",
290
- },
291
- },
292
- [_vm._v("父子节点联动")]
293
- ),
294
- ],
295
- 1
296
- )
297
- : _vm._e(),
298
- _c(
299
- "div",
300
- { staticClass: "cy-tree-select-select-con-c" },
301
- [
302
- _c("el-tree", {
303
- ref: "tree",
304
- attrs: {
305
- data: _vm.treeOptions,
306
- "show-checkbox": _vm.multiple,
307
- "node-key": _vm.defaultOptions.id,
308
- "check-strictly": !_vm.isCheckStrictly,
309
- props: _vm.defaultOptions,
310
- "expand-on-click-node": false,
311
- "default-expand-all": _vm.defaultExpandAll,
312
- "filter-node-method": _vm.filterNode,
313
- },
314
- on: { check: _vm.treeCheck, "node-click": _vm.treeClick },
315
- }),
316
- ],
317
- 1
318
- ),
319
- ]),
320
- _c(
321
- "div",
322
- {
323
- staticClass: "cy-tree-select-select",
324
- class: _vm.size,
325
- style: _vm.vStyle,
326
- attrs: { slot: "reference" },
327
- slot: "reference",
328
- },
329
- [
330
- _c("div", { staticClass: "cy-tree-select-select-v" }, [
331
- _vm.checkedArr.length < 1
332
- ? _c(
333
- "span",
334
- { staticClass: "cy-tree-select-select-v-placeholder" },
335
- [_vm._v(_vm._s(_vm.placeholder))]
336
- )
337
- : _c("span", [
338
- _vm._v(
339
- _vm._s(
340
- _vm.checkedArr
341
- .map(function (item) {
342
- return item[_vm.defaultOptions.label]
343
- })
344
- .join()
345
- )
346
- ),
347
- ]),
348
- ]),
349
- _c(
350
- "div",
351
- {
352
- staticClass: "cy-tree-select-select-v-icon",
353
- on: {
354
- mouseenter: function ($event) {
355
- _vm.isClearIcon = true
356
- },
357
- mouseleave: function ($event) {
358
- _vm.isClearIcon = false
359
- },
360
- },
361
- },
362
- [
363
- _vm.isClearIcon && _vm.clearable
364
- ? _c("i", {
365
- staticClass: "el-icon-circle-close",
366
- on: {
367
- click: function ($event) {
368
- $event.stopPropagation()
369
- return _vm.handleClear($event)
370
- },
371
- },
372
- })
373
- : _c("i", {
374
- staticClass:
375
- "el-icon-arrow-down cy-tree-select-select-v-arrow",
376
- class: {
377
- "cy-tree-select-select-v-arrow-show": _vm.popoverOpen,
378
- },
379
- }),
380
- ]
381
- ),
382
- ]
383
- ),
384
- ]
385
- ),
386
- ],
387
- 1
388
- )
389
- }
390
- var staticRenderFns = []
391
- render._withStripped = true
392
-
393
-
394
- // CONCATENATED MODULE: ./packages/cy/treeSelect/src/main.vue?vue&type=template&id=5e4054a3
395
-
396
- // EXTERNAL MODULE: ./packages/checkbox/index.js + 5 modules
397
- var packages_checkbox = __webpack_require__(16);
398
-
399
- // EXTERNAL MODULE: ./packages/popover/index.js + 6 modules
400
- var popover = __webpack_require__(36);
401
-
402
- // EXTERNAL MODULE: ./packages/input/index.js + 6 modules
403
- var input = __webpack_require__(13);
404
-
405
- // EXTERNAL MODULE: ./packages/tree/index.js + 13 modules
406
- var tree = __webpack_require__(46);
407
-
408
- // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/cy/treeSelect/src/main.vue?vue&type=script&lang=js
409
- //
410
- //
411
- //
412
- //
413
- //
414
- //
415
- //
416
- //
417
- //
418
- //
419
- //
420
- //
421
- //
422
- //
423
- //
424
- //
425
- //
426
- //
427
- //
428
- //
429
- //
430
- //
431
- //
432
- //
433
- //
434
- //
435
- //
436
- //
437
- //
438
- //
439
- //
440
- //
441
- //
442
- //
443
- //
444
- //
445
- //
446
- //
447
- //
448
- //
449
- //
450
- //
451
- //
452
- //
453
- //
454
- //
455
- //
456
- //
457
- //
458
-
459
-
460
-
461
-
462
-
463
-
464
- /* harmony default export */ var mainvue_type_script_lang_js = ({
465
- name: 'CyTreeSelect',
466
- components: {
467
- ElCheckbox: packages_checkbox["default"],
468
- ElPopover: popover["default"],
469
- ElInput: input["default"],
470
- ElTree: tree["default"]
471
- },
472
- model: {
473
- prop: 'value',
474
- event: 'change'
475
- },
476
- props: {
477
- value: {
478
- type: [String, Number, Array],
479
- default: ''
480
- },
481
-
482
- options: {
483
- type: Array,
484
- default: []
485
- },
486
-
487
- placeholder: {
488
- type: String,
489
- default: ''
490
- },
491
-
492
- size: {
493
- type: String
494
- },
495
-
496
- filterable: {
497
- type: Boolean,
498
- default: false
499
- },
500
-
501
- showCheckStrictly: {
502
- type: Boolean,
503
- default: true
504
- },
505
-
506
- checkStrictly: {
507
- type: Boolean,
508
- default: true
509
- },
510
-
511
- clearable: {
512
- type: Boolean,
513
- default: false
514
- },
515
-
516
- multiple: {
517
- type: Boolean,
518
- default: false
519
- },
520
-
521
- defaultOptions: {
522
- type: Object,
523
- default: function _default() {
524
- return {
525
- children: 'children',
526
- label: 'label',
527
- id: 'id'
528
- };
529
- }
530
- },
531
-
532
- vStyle: {
533
- type: [Array, String, Object],
534
- default: ''
535
- },
536
-
537
- popperClass: {
538
- type: String,
539
- default: ''
540
- },
541
-
542
- defaultExpandAll: {
543
- type: Boolean,
544
- default: false
545
- }
546
- },
547
- data: function data() {
548
- return {
549
- isCheckStrictly: true,
550
- popoverOpen: false,
551
- isClearIcon: false,
552
-
553
- treeOptions: [],
554
- treeArr: [],
555
- filterText: '',
556
- matchedNodeIds: []
557
- };
558
- },
559
-
560
- computed: {
561
- checkedArr: function checkedArr() {
562
- var _this = this;
563
-
564
- if (this.multiple) {
565
- var arr = [];
566
- this.value && this.value.forEach(function (id) {
567
- var cItem = _this.treeArr.filter(function (tItem) {
568
- return tItem[_this.defaultOptions.id] === id;
569
- })[0];
570
- if (cItem) arr.push(cItem);
571
- });
572
- return arr;
573
- } else {
574
- var cItem = this.treeArr.filter(function (tItem) {
575
- return tItem[_this.defaultOptions.id] === Number(_this.value);
576
- })[0];
577
- return cItem ? [cItem] : [];
578
- }
579
- }
580
- },
581
- watch: {
582
- checkStrictly: {
583
- immediate: true,
584
- handler: function handler() {
585
- this.isCheckStrictly = this.checkStrictly;
586
- }
587
- },
588
-
589
- value: {
590
- immediate: true,
591
- deep: true,
592
- handler: function handler() {
593
- var _this2 = this;
594
-
595
- this.$nextTick(function () {
596
- _this2.init();
597
- });
598
- }
599
- },
600
-
601
- options: {
602
- deep: true,
603
- immediate: true,
604
- handler: function handler() {
605
- this.treeOptions = this.options;
606
- this.treeArr = this.turnFormatTreeData([], this.treeOptions, 0);
607
- }
608
- },
609
-
610
- filterText: function filterText(val) {
611
- var _this3 = this;
612
-
613
- if (val) {
614
- this.matchedNodeIds = this.findMatchedNodes(val, this.treeOptions);
615
- this.$refs.tree.filter(val);
616
- this.$nextTick(function () {
617
- _this3.expandMatchedNodes();
618
- });
619
- } else {
620
- this.matchedNodeIds = [];
621
- this.$refs.tree.filter(val);
622
- }
623
- }
624
- },
625
- created: function created() {},
626
-
627
- methods: {
628
- filterNode: function filterNode(value, data) {
629
- if (!value) return true;
630
- return this.matchedNodeIds.includes(data[this.defaultOptions.id]);
631
- },
632
- findMatchedNodes: function findMatchedNodes(value, nodes) {
633
- var _this4 = this;
634
-
635
- var parentMatched = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
636
-
637
- var matchedIds = [];
638
-
639
- nodes.forEach(function (node) {
640
- var currentNodeMatched = node[_this4.defaultOptions.label].indexOf(value) !== -1;
641
- var shouldShow = currentNodeMatched || parentMatched;
642
-
643
- if (shouldShow) {
644
- matchedIds.push(node[_this4.defaultOptions.id]);
645
- }
646
-
647
- if (node[_this4.defaultOptions.children] && node[_this4.defaultOptions.children].length > 0) {
648
- var childIds = _this4.findMatchedNodes(value, node[_this4.defaultOptions.children], shouldShow);
649
- matchedIds = matchedIds.concat(childIds);
650
- }
651
- });
652
-
653
- return matchedIds;
654
- },
655
- expandMatchedNodes: function expandMatchedNodes() {
656
- var _this5 = this;
657
-
658
- this.matchedNodeIds.forEach(function (nodeId) {
659
- var treeNode = _this5.$refs.tree.store.nodesMap[nodeId];
660
- if (treeNode) {
661
- treeNode.expand();
662
- }
663
- });
664
- },
665
- init: function init() {
666
- var _this6 = this;
667
-
668
- var arr = [];
669
- if (this.multiple) {
670
- arr = this.value ? this.value : [];
671
- } else {
672
- arr = this.value ? [this.value] : [];
673
- }
674
- this.$nextTick(function () {
675
- _this6.$refs.tree.setCheckedKeys(arr);
676
- });
677
- },
678
- treeCheck: function treeCheck(value, _ref) {
679
- var _this7 = this;
680
-
681
- var checkedKeys = _ref.checkedKeys,
682
- checkedNodes = _ref.checkedNodes;
683
-
684
- var arr = [];
685
- arr = checkedNodes;
686
- var idArr = arr.map(function (item) {
687
- return item[_this7.defaultOptions.id];
688
- });
689
- this.$emit('change', this.multiple ? idArr : idArr[0], this.multiple ? arr : arr[0]);
690
- },
691
- treeClick: function treeClick(value, node, event) {
692
- if (this.multiple) return;
693
-
694
- this.$emit('change', value.id, value);
695
- this.popoverOpen = false;
696
- },
697
- handleClear: function handleClear() {
698
- this.$emit('change', this.multiple ? [] : '', this.multiple ? [] : null);
699
- this.$refs.tree.setCheckedKeys([]);
700
- },
701
- turnFormatTreeData: function turnFormatTreeData(arr, data, pId) {
702
- var _this8 = this;
703
-
704
- data.forEach(function (item) {
705
- var cItem = JSON.parse(JSON.stringify(item));
706
- delete cItem[_this8.defaultOptions.children];
707
- cItem.pId = pId;
708
- arr.push(cItem);
709
-
710
- if (item[_this8.defaultOptions.children] && item[_this8.defaultOptions.children].length > 0) {
711
- _this8.turnFormatTreeData(arr, item[_this8.defaultOptions.children], item[_this8.defaultOptions.id]);
712
- }
713
- });
714
- return arr;
715
- }
716
- }
717
- });
718
- // CONCATENATED MODULE: ./packages/cy/treeSelect/src/main.vue?vue&type=script&lang=js
719
- /* harmony default export */ var src_mainvue_type_script_lang_js = (mainvue_type_script_lang_js);
720
- // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
721
- var componentNormalizer = __webpack_require__(0);
722
-
723
- // CONCATENATED MODULE: ./packages/cy/treeSelect/src/main.vue
724
-
725
-
726
-
727
-
728
-
729
- /* normalize component */
730
-
731
- var component = Object(componentNormalizer["a" /* default */])(
732
- src_mainvue_type_script_lang_js,
733
- render,
734
- staticRenderFns,
735
- false,
736
- null,
737
- null,
738
- null
739
-
740
- )
741
-
742
- /* harmony default export */ var main = (component.exports);
743
- // CONCATENATED MODULE: ./packages/cy/treeSelect/index.js
744
-
745
-
746
- main.install = function (Vue) {
747
- Vue.component(main.name, main);
748
- };
749
-
750
- /* harmony default export */ var treeSelect = __webpack_exports__["default"] = (main);
751
-
752
- /***/ }),
753
-
754
- /***/ 13:
755
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
756
-
757
- "use strict";
758
- // ESM COMPAT FLAG
759
- __webpack_require__.r(__webpack_exports__);
760
-
761
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/input/src/input.vue?vue&type=template&id=048a9cde
762
- var render = function () {
763
- var _vm = this
764
- var _h = _vm.$createElement
765
- var _c = _vm._self._c || _h
766
- return _c(
767
- "div",
768
- {
769
- class: [
770
- _vm.type === "textarea" ? "el-textarea" : "el-input",
771
- _vm.inputSize ? "el-input--" + _vm.inputSize : "",
772
- {
773
- "is-disabled": _vm.inputDisabled,
774
- "is-exceed": _vm.inputExceed,
775
- "el-input-group": _vm.$slots.prepend || _vm.$slots.append,
776
- "el-input-group--append": _vm.$slots.append,
777
- "el-input-group--prepend": _vm.$slots.prepend,
778
- "el-input--prefix": _vm.$slots.prefix || _vm.prefixIcon,
779
- "el-input--suffix":
780
- _vm.$slots.suffix ||
781
- _vm.suffixIcon ||
782
- _vm.clearable ||
783
- _vm.showPassword,
784
- },
785
- ],
786
- on: {
787
- mouseenter: function ($event) {
788
- _vm.hovering = true
789
- },
790
- mouseleave: function ($event) {
791
- _vm.hovering = false
792
- },
793
- },
794
- },
795
- [
796
- _vm.type !== "textarea"
797
- ? [
798
- _vm.$slots.prepend
799
- ? _c(
800
- "div",
801
- { staticClass: "el-input-group__prepend" },
802
- [_vm._t("prepend")],
803
- 2
804
- )
805
- : _vm._e(),
806
- _vm.type !== "textarea"
807
- ? _c(
808
- "input",
809
- _vm._b(
810
- {
811
- ref: "input",
812
- staticClass: "el-input__inner",
813
- attrs: {
814
- tabindex: _vm.tabindex,
815
- type: _vm.showPassword
816
- ? _vm.passwordVisible
817
- ? "text"
818
- : "password"
819
- : _vm.type,
820
- disabled: _vm.inputDisabled,
821
- readonly: _vm.readonly,
822
- autocomplete: _vm.autoComplete || _vm.autocomplete,
823
- "aria-label": _vm.label,
824
- },
825
- on: {
826
- compositionstart: _vm.handleCompositionStart,
827
- compositionupdate: _vm.handleCompositionUpdate,
828
- compositionend: _vm.handleCompositionEnd,
829
- input: _vm.handleInput,
830
- focus: _vm.handleFocus,
831
- blur: _vm.handleBlur,
832
- change: _vm.handleChange,
833
- },
834
- },
835
- "input",
836
- _vm.$attrs,
837
- false
838
- )
839
- )
840
- : _vm._e(),
841
- _vm.$slots.prefix || _vm.prefixIcon
842
- ? _c(
843
- "span",
844
- { staticClass: "el-input__prefix" },
845
- [
846
- _vm._t("prefix"),
847
- _vm.prefixIcon
848
- ? _c("i", {
849
- staticClass: "el-input__icon",
850
- class: _vm.prefixIcon,
851
- })
852
- : _vm._e(),
853
- ],
854
- 2
855
- )
856
- : _vm._e(),
857
- _vm.getSuffixVisible()
858
- ? _c("span", { staticClass: "el-input__suffix" }, [
859
- _c(
860
- "span",
861
- { staticClass: "el-input__suffix-inner" },
862
- [
863
- !_vm.showClear ||
864
- !_vm.showPwdVisible ||
865
- !_vm.isWordLimitVisible
866
- ? [
867
- _vm._t("suffix"),
868
- _vm.suffixIcon
869
- ? _c("i", {
870
- staticClass: "el-input__icon",
871
- class: _vm.suffixIcon,
872
- })
873
- : _vm._e(),
874
- ]
875
- : _vm._e(),
876
- _vm.showClear
877
- ? _c("i", {
878
- staticClass:
879
- "el-input__icon el-icon-circle-close el-input__clear",
880
- on: {
881
- mousedown: function ($event) {
882
- $event.preventDefault()
883
- },
884
- click: _vm.clear,
885
- },
886
- })
887
- : _vm._e(),
888
- _vm.showPwdVisible
889
- ? _c("i", {
890
- staticClass:
891
- "el-input__icon el-icon-view el-input__clear",
892
- on: { click: _vm.handlePasswordVisible },
893
- })
894
- : _vm._e(),
895
- _vm.isWordLimitVisible
896
- ? _c("span", { staticClass: "el-input__count" }, [
897
- _c(
898
- "span",
899
- { staticClass: "el-input__count-inner" },
900
- [
901
- _vm._v(
902
- "\n\t\t\t\t\t\t\t" +
903
- _vm._s(_vm.textLength) +
904
- "/" +
905
- _vm._s(_vm.upperLimit) +
906
- "\n\t\t\t\t\t\t"
907
- ),
908
- ]
909
- ),
910
- ])
911
- : _vm._e(),
912
- ],
913
- 2
914
- ),
915
- _vm.validateState
916
- ? _c("i", {
917
- staticClass: "el-input__icon",
918
- class: ["el-input__validateIcon", _vm.validateIcon],
919
- })
920
- : _vm._e(),
921
- ])
922
- : _vm._e(),
923
- _vm.$slots.append
924
- ? _c(
925
- "div",
926
- { staticClass: "el-input-group__append" },
927
- [_vm._t("append")],
928
- 2
929
- )
930
- : _vm._e(),
931
- ]
932
- : _c(
933
- "textarea",
934
- _vm._b(
935
- {
936
- ref: "textarea",
937
- staticClass: "el-textarea__inner",
938
- style: _vm.textareaStyle,
939
- attrs: {
940
- tabindex: _vm.tabindex,
941
- disabled: _vm.inputDisabled,
942
- readonly: _vm.readonly,
943
- autocomplete: _vm.autoComplete || _vm.autocomplete,
944
- "aria-label": _vm.label,
945
- },
946
- on: {
947
- compositionstart: _vm.handleCompositionStart,
948
- compositionupdate: _vm.handleCompositionUpdate,
949
- compositionend: _vm.handleCompositionEnd,
950
- input: _vm.handleInput,
951
- focus: _vm.handleFocus,
952
- blur: _vm.handleBlur,
953
- change: _vm.handleChange,
954
- },
955
- },
956
- "textarea",
957
- _vm.$attrs,
958
- false
959
- )
960
- ),
961
- _vm.isWordLimitVisible && _vm.type === "textarea"
962
- ? _c("span", { staticClass: "el-input__count" }, [
963
- _vm._v(_vm._s(_vm.textLength) + "/" + _vm._s(_vm.upperLimit)),
964
- ])
965
- : _vm._e(),
966
- ],
967
- 2
968
- )
969
- }
970
- var staticRenderFns = []
971
- render._withStripped = true
972
-
973
-
974
- // CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=template&id=048a9cde
975
-
976
- // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
977
- var emitter_ = __webpack_require__(4);
978
- var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
979
-
980
- // EXTERNAL MODULE: external "element-ui/lib/mixins/migrating"
981
- var migrating_ = __webpack_require__(7);
982
- var migrating_default = /*#__PURE__*/__webpack_require__.n(migrating_);
983
-
984
- // CONCATENATED MODULE: ./packages/input/src/calcTextareaHeight.js
985
- var hiddenTextarea = void 0;
986
-
987
- var HIDDEN_STYLE = '\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n';
988
-
989
- var CONTEXT_STYLE = ['letter-spacing', 'line-height', 'padding-top', 'padding-bottom', 'font-family', 'font-weight', 'font-size', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-left', 'padding-right', 'border-width', 'box-sizing'];
990
-
991
- function calculateNodeStyling(targetElement) {
992
- var style = window.getComputedStyle(targetElement);
993
-
994
- var boxSizing = style.getPropertyValue('box-sizing');
995
-
996
- var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));
997
-
998
- var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));
999
-
1000
- var contextStyle = CONTEXT_STYLE.map(function (name) {
1001
- return name + ':' + style.getPropertyValue(name);
1002
- }).join(';');
1003
-
1004
- return { contextStyle: contextStyle, paddingSize: paddingSize, borderSize: borderSize, boxSizing: boxSizing };
1005
- }
1006
-
1007
- function calcTextareaHeight(targetElement) {
1008
- var minRows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1009
- var maxRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1010
-
1011
- if (!hiddenTextarea) {
1012
- hiddenTextarea = document.createElement('textarea');
1013
- document.body.appendChild(hiddenTextarea);
1014
- }
1015
-
1016
- var _calculateNodeStyling = calculateNodeStyling(targetElement),
1017
- paddingSize = _calculateNodeStyling.paddingSize,
1018
- borderSize = _calculateNodeStyling.borderSize,
1019
- boxSizing = _calculateNodeStyling.boxSizing,
1020
- contextStyle = _calculateNodeStyling.contextStyle;
1021
-
1022
- hiddenTextarea.setAttribute('style', contextStyle + ';' + HIDDEN_STYLE);
1023
- hiddenTextarea.value = targetElement.value || targetElement.placeholder || '';
1024
-
1025
- var height = hiddenTextarea.scrollHeight;
1026
- var result = {};
1027
-
1028
- if (boxSizing === 'border-box') {
1029
- height = height + borderSize;
1030
- } else if (boxSizing === 'content-box') {
1031
- height = height - paddingSize;
1032
- }
1033
-
1034
- hiddenTextarea.value = '';
1035
- var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
1036
-
1037
- if (minRows !== null) {
1038
- var minHeight = singleRowHeight * minRows;
1039
- if (boxSizing === 'border-box') {
1040
- minHeight = minHeight + paddingSize + borderSize;
1041
- }
1042
- height = Math.max(minHeight, height);
1043
- result.minHeight = minHeight + 'px';
1044
- }
1045
- if (maxRows !== null) {
1046
- var maxHeight = singleRowHeight * maxRows;
1047
- if (boxSizing === 'border-box') {
1048
- maxHeight = maxHeight + paddingSize + borderSize;
1049
- }
1050
- height = Math.min(maxHeight, height);
1051
- }
1052
- result.height = height + 'px';
1053
- hiddenTextarea.parentNode && hiddenTextarea.parentNode.removeChild(hiddenTextarea);
1054
- hiddenTextarea = null;
1055
- return result;
1056
- };
1057
- // EXTERNAL MODULE: external "element-ui/lib/utils/merge"
1058
- var merge_ = __webpack_require__(6);
1059
- var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
1060
-
1061
- // EXTERNAL MODULE: external "element-ui/lib/utils/shared"
1062
- var shared_ = __webpack_require__(11);
1063
-
1064
- // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/input/src/input.vue?vue&type=script&lang=js
1065
- //
1066
- //
1067
- //
1068
- //
1069
- //
1070
- //
1071
- //
1072
- //
1073
- //
1074
- //
1075
- //
1076
- //
1077
- //
1078
- //
1079
- //
1080
- //
1081
- //
1082
- //
1083
- //
1084
- //
1085
- //
1086
- //
1087
- //
1088
- //
1089
- //
1090
- //
1091
- //
1092
- //
1093
- //
1094
- //
1095
- //
1096
- //
1097
- //
1098
- //
1099
- //
1100
- //
1101
- //
1102
- //
1103
- //
1104
- //
1105
- //
1106
- //
1107
- //
1108
- //
1109
- //
1110
- //
1111
- //
1112
- //
1113
- //
1114
- //
1115
- //
1116
- //
1117
- //
1118
- //
1119
- //
1120
- //
1121
- //
1122
- //
1123
- //
1124
- //
1125
- //
1126
- //
1127
- //
1128
- //
1129
- //
1130
- //
1131
- //
1132
- //
1133
- //
1134
- //
1135
- //
1136
- //
1137
- //
1138
- //
1139
- //
1140
- //
1141
- //
1142
- //
1143
- //
1144
- //
1145
- //
1146
- //
1147
- //
1148
- //
1149
- //
1150
- //
1151
- //
1152
- //
1153
- //
1154
- //
1155
- //
1156
- //
1157
- //
1158
- //
1159
- //
1160
- //
1161
- //
1162
- //
1163
- //
1164
- //
1165
- //
1166
- //
1167
- //
1168
- //
1169
- //
1170
- //
1171
- //
1172
- //
1173
- //
1174
-
1175
-
1176
-
1177
-
1178
-
1179
-
1180
-
1181
- /* harmony default export */ var inputvue_type_script_lang_js = ({
1182
- name: 'ElInput',
1183
-
1184
- componentName: 'ElInput',
1185
-
1186
- mixins: [emitter_default.a, migrating_default.a],
1187
-
1188
- inheritAttrs: false,
1189
-
1190
- inject: {
1191
- elForm: {
1192
- default: ''
1193
- },
1194
- elFormItem: {
1195
- default: ''
1196
- }
1197
- },
1198
-
1199
- data: function data() {
1200
- return {
1201
- textareaCalcStyle: {},
1202
- hovering: false,
1203
- focused: false,
1204
- isComposing: false,
1205
- passwordVisible: false
1206
- };
1207
- },
1208
-
1209
-
1210
- props: {
1211
- value: [String, Number],
1212
- size: String,
1213
- resize: String,
1214
- form: String,
1215
- disabled: Boolean,
1216
- readonly: Boolean,
1217
- type: {
1218
- type: String,
1219
- default: 'text'
1220
- },
1221
- autosize: {
1222
- type: [Boolean, Object],
1223
- default: false
1224
- },
1225
- autocomplete: {
1226
- type: String,
1227
- default: 'off'
1228
- },
1229
- /** @Deprecated in next major version */
1230
- autoComplete: {
1231
- type: String,
1232
- validator: function validator(val) {
1233
- false && false;
1234
- return true;
1235
- }
1236
- },
1237
- validateEvent: {
1238
- type: Boolean,
1239
- default: true
1240
- },
1241
- suffixIcon: String,
1242
- prefixIcon: String,
1243
- label: String,
1244
- clearable: {
1245
- type: Boolean,
1246
- default: false
1247
- },
1248
- showPassword: {
1249
- type: Boolean,
1250
- default: false
1251
- },
1252
- showWordLimit: {
1253
- type: Boolean,
1254
- default: false
1255
- },
1256
- tabindex: String
1257
- },
1258
-
1259
- computed: {
1260
- _elFormItemSize: function _elFormItemSize() {
1261
- return (this.elFormItem || {}).elFormItemSize;
1262
- },
1263
- validateState: function validateState() {
1264
- return this.elFormItem ? this.elFormItem.validateState : '';
1265
- },
1266
- needStatusIcon: function needStatusIcon() {
1267
- return this.elForm ? this.elForm.statusIcon : false;
1268
- },
1269
- validateIcon: function validateIcon() {
1270
- return {
1271
- validating: 'el-icon-loading',
1272
- success: 'el-icon-circle-check',
1273
- error: 'el-icon-circle-close'
1274
- }[this.validateState];
1275
- },
1276
- textareaStyle: function textareaStyle() {
1277
- return merge_default()({}, this.textareaCalcStyle, { resize: this.resize });
1278
- },
1279
- inputSize: function inputSize() {
1280
- return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
1281
- },
1282
- inputDisabled: function inputDisabled() {
1283
- return this.disabled || (this.elForm || {}).disabled;
1284
- },
1285
- nativeInputValue: function nativeInputValue() {
1286
- return this.value === null || this.value === undefined ? '' : String(this.value);
1287
- },
1288
- showClear: function showClear() {
1289
- return this.clearable && !this.inputDisabled && !this.readonly && this.nativeInputValue && (this.focused || this.hovering);
1290
- },
1291
- showPwdVisible: function showPwdVisible() {
1292
- return this.showPassword && !this.inputDisabled && !this.readonly && (!!this.nativeInputValue || this.focused);
1293
- },
1294
- isWordLimitVisible: function isWordLimitVisible() {
1295
- return this.showWordLimit && this.$attrs.maxlength && (this.type === 'text' || this.type === 'textarea') && !this.inputDisabled && !this.readonly && !this.showPassword;
1296
- },
1297
- upperLimit: function upperLimit() {
1298
- return this.$attrs.maxlength;
1299
- },
1300
- textLength: function textLength() {
1301
- if (typeof this.value === 'number') {
1302
- return String(this.value).length;
1303
- }
1304
-
1305
- return (this.value || '').length;
1306
- },
1307
- inputExceed: function inputExceed() {
1308
- // show exceed style if length of initial value greater then maxlength
1309
- return this.isWordLimitVisible && this.textLength > this.upperLimit;
1310
- }
1311
- },
1312
-
1313
- watch: {
1314
- value: function value(val) {
1315
- this.$nextTick(this.resizeTextarea);
1316
- if (this.validateEvent) {
1317
- this.dispatch('ElFormItem', 'el.form.change', [val]);
1318
- }
1319
- },
1320
-
1321
- // native input value is set explicitly
1322
- // do not use v-model / :value in template
1323
- // see: https://github.com/ElemeFE/element/issues/14521
1324
- nativeInputValue: function nativeInputValue() {
1325
- this.setNativeInputValue();
1326
- },
1327
-
1328
- // when change between <input> and <textarea>,
1329
- // update DOM dependent value and styles
1330
- // https://github.com/ElemeFE/element/issues/14857
1331
- type: function type() {
1332
- var _this = this;
1333
-
1334
- this.$nextTick(function () {
1335
- _this.setNativeInputValue();
1336
- _this.resizeTextarea();
1337
- _this.updateIconOffset();
1338
- });
1339
- }
1340
- },
1341
-
1342
- methods: {
1343
- focus: function focus() {
1344
- this.getInput().focus();
1345
- },
1346
- blur: function blur() {
1347
- this.getInput().blur();
1348
- },
1349
- getMigratingConfig: function getMigratingConfig() {
1350
- return {
1351
- props: {
1352
- 'icon': 'icon is removed, use suffix-icon / prefix-icon instead.',
1353
- 'on-icon-click': 'on-icon-click is removed.'
1354
- },
1355
- events: {
1356
- 'click': 'click is removed.'
1357
- }
1358
- };
1359
- },
1360
- handleBlur: function handleBlur(event) {
1361
- this.focused = false;
1362
- this.$emit('blur', event);
1363
- if (this.validateEvent) {
1364
- this.dispatch('ElFormItem', 'el.form.blur', [this.value]);
1365
- }
1366
- },
1367
- select: function select() {
1368
- this.getInput().select();
1369
- },
1370
- resizeTextarea: function resizeTextarea() {
1371
- if (this.$isServer) return;
1372
- var autosize = this.autosize,
1373
- type = this.type;
1374
-
1375
- if (type !== 'textarea') return;
1376
- if (!autosize) {
1377
- this.textareaCalcStyle = {
1378
- minHeight: calcTextareaHeight(this.$refs.textarea).minHeight
1379
- };
1380
- return;
1381
- }
1382
- var minRows = autosize.minRows;
1383
- var maxRows = autosize.maxRows;
1384
-
1385
- this.textareaCalcStyle = calcTextareaHeight(this.$refs.textarea, minRows, maxRows);
1386
- },
1387
- setNativeInputValue: function setNativeInputValue() {
1388
- var input = this.getInput();
1389
- if (!input) return;
1390
- if (input.value === this.nativeInputValue) return;
1391
- input.value = this.nativeInputValue;
1392
- },
1393
- handleFocus: function handleFocus(event) {
1394
- this.focused = true;
1395
- this.$emit('focus', event);
1396
- },
1397
- handleCompositionStart: function handleCompositionStart(event) {
1398
- this.$emit('compositionstart', event);
1399
- this.isComposing = true;
1400
- },
1401
- handleCompositionUpdate: function handleCompositionUpdate(event) {
1402
- this.$emit('compositionupdate', event);
1403
- var text = event.target.value;
1404
- var lastCharacter = text[text.length - 1] || '';
1405
- this.isComposing = !Object(shared_["isKorean"])(lastCharacter);
1406
- },
1407
- handleCompositionEnd: function handleCompositionEnd(event) {
1408
- this.$emit('compositionend', event);
1409
- if (this.isComposing) {
1410
- this.isComposing = false;
1411
- this.handleInput(event);
1412
- }
1413
- },
1414
- handleInput: function handleInput(event) {
1415
- // should not emit input during composition
1416
- // see: https://github.com/ElemeFE/element/issues/10516
1417
- if (this.isComposing) return;
1418
-
1419
- // hack for https://github.com/ElemeFE/element/issues/8548
1420
- // should remove the following line when we don't support IE
1421
- if (event.target.value === this.nativeInputValue) return;
1422
-
1423
- this.$emit('input', event.target.value);
1424
-
1425
- // ensure native input value is controlled
1426
- // see: https://github.com/ElemeFE/element/issues/12850
1427
- this.$nextTick(this.setNativeInputValue);
1428
- },
1429
- handleChange: function handleChange(event) {
1430
- this.$emit('change', event.target.value);
1431
- },
1432
- calcIconOffset: function calcIconOffset(place) {
1433
- var elList = [].slice.call(this.$el.querySelectorAll('.el-input__' + place) || []);
1434
- if (!elList.length) return;
1435
- var el = null;
1436
- for (var i = 0; i < elList.length; i++) {
1437
- if (elList[i].parentNode === this.$el) {
1438
- el = elList[i];
1439
- break;
1440
- }
1441
- }
1442
- if (!el) return;
1443
- var pendantMap = {
1444
- suffix: 'append',
1445
- prefix: 'prepend'
1446
- };
1447
-
1448
- var pendant = pendantMap[place];
1449
- if (this.$slots[pendant]) {
1450
- el.style.transform = 'translateX(' + (place === 'suffix' ? '-' : '') + this.$el.querySelector('.el-input-group__' + pendant).offsetWidth + 'px)';
1451
- } else {
1452
- el.removeAttribute('style');
1453
- }
1454
- },
1455
- updateIconOffset: function updateIconOffset() {
1456
- this.calcIconOffset('prefix');
1457
- this.calcIconOffset('suffix');
1458
- },
1459
- clear: function clear() {
1460
- this.$emit('input', '');
1461
- this.$emit('change', '');
1462
- this.$emit('clear');
1463
- },
1464
- handlePasswordVisible: function handlePasswordVisible() {
1465
- var _this2 = this;
1466
-
1467
- this.passwordVisible = !this.passwordVisible;
1468
- this.$nextTick(function () {
1469
- _this2.focus();
1470
- });
1471
- },
1472
- getInput: function getInput() {
1473
- return this.$refs.input || this.$refs.textarea;
1474
- },
1475
- getSuffixVisible: function getSuffixVisible() {
1476
- return this.$slots.suffix || this.suffixIcon || this.showClear || this.showPassword || this.isWordLimitVisible || this.validateState && this.needStatusIcon;
1477
- }
1478
- },
1479
-
1480
- created: function created() {
1481
- this.$on('inputSelect', this.select);
1482
- },
1483
- mounted: function mounted() {
1484
- this.setNativeInputValue();
1485
- this.resizeTextarea();
1486
- this.updateIconOffset();
1487
- },
1488
- updated: function updated() {
1489
- this.$nextTick(this.updateIconOffset);
1490
- }
1491
- });
1492
- // CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=script&lang=js
1493
- /* harmony default export */ var src_inputvue_type_script_lang_js = (inputvue_type_script_lang_js);
1494
- // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
1495
- var componentNormalizer = __webpack_require__(0);
1496
-
1497
- // CONCATENATED MODULE: ./packages/input/src/input.vue
1498
-
1499
-
1500
-
1501
-
1502
-
1503
- /* normalize component */
1504
-
1505
- var component = Object(componentNormalizer["a" /* default */])(
1506
- src_inputvue_type_script_lang_js,
1507
- render,
1508
- staticRenderFns,
1509
- false,
1510
- null,
1511
- null,
1512
- null
1513
-
1514
- )
1515
-
1516
- /* harmony default export */ var input = (component.exports);
1517
- // CONCATENATED MODULE: ./packages/input/index.js
1518
-
1519
-
1520
- /* istanbul ignore next */
1521
- input.install = function (Vue) {
1522
- Vue.component(input.name, input);
1523
- };
1524
-
1525
- /* harmony default export */ var packages_input = __webpack_exports__["default"] = (input);
1526
-
1527
- /***/ }),
1528
-
1529
- /***/ 16:
1530
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1531
-
1532
- "use strict";
1533
- // ESM COMPAT FLAG
1534
- __webpack_require__.r(__webpack_exports__);
1535
-
1536
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/checkbox/src/checkbox.vue?vue&type=template&id=5f30258f
1537
- var render = function () {
1538
- var _vm = this
1539
- var _h = _vm.$createElement
1540
- var _c = _vm._self._c || _h
1541
- return _c(
1542
- "label",
1543
- {
1544
- staticClass: "el-checkbox",
1545
- class: [
1546
- _vm.border && _vm.checkboxSize
1547
- ? "el-checkbox--" + _vm.checkboxSize
1548
- : "",
1549
- { "is-disabled": _vm.isDisabled },
1550
- { "is-bordered": _vm.border },
1551
- { "is-checked": _vm.isChecked },
1552
- ],
1553
- attrs: { id: _vm.id },
1554
- },
1555
- [
1556
- _c(
1557
- "span",
1558
- {
1559
- staticClass: "el-checkbox__input",
1560
- class: {
1561
- "is-disabled": _vm.isDisabled,
1562
- "is-checked": _vm.isChecked,
1563
- "is-indeterminate": _vm.indeterminate,
1564
- "is-focus": _vm.focus,
1565
- },
1566
- attrs: {
1567
- tabindex: _vm.indeterminate ? 0 : false,
1568
- role: _vm.indeterminate ? "checkbox" : false,
1569
- "aria-checked": _vm.indeterminate ? "mixed" : false,
1570
- },
1571
- },
1572
- [
1573
- _c("span", { staticClass: "el-checkbox__inner" }),
1574
- _vm.trueLabel || _vm.falseLabel
1575
- ? _c("input", {
1576
- directives: [
1577
- {
1578
- name: "model",
1579
- rawName: "v-model",
1580
- value: _vm.model,
1581
- expression: "model",
1582
- },
1583
- ],
1584
- staticClass: "el-checkbox__original",
1585
- attrs: {
1586
- type: "checkbox",
1587
- "aria-hidden": _vm.indeterminate ? "true" : "false",
1588
- name: _vm.name,
1589
- disabled: _vm.isDisabled,
1590
- "true-value": _vm.trueLabel,
1591
- "false-value": _vm.falseLabel,
1592
- },
1593
- domProps: {
1594
- checked: Array.isArray(_vm.model)
1595
- ? _vm._i(_vm.model, null) > -1
1596
- : _vm._q(_vm.model, _vm.trueLabel),
1597
- },
1598
- on: {
1599
- change: [
1600
- function ($event) {
1601
- var $$a = _vm.model,
1602
- $$el = $event.target,
1603
- $$c = $$el.checked ? _vm.trueLabel : _vm.falseLabel
1604
- if (Array.isArray($$a)) {
1605
- var $$v = null,
1606
- $$i = _vm._i($$a, $$v)
1607
- if ($$el.checked) {
1608
- $$i < 0 && (_vm.model = $$a.concat([$$v]))
1609
- } else {
1610
- $$i > -1 &&
1611
- (_vm.model = $$a
1612
- .slice(0, $$i)
1613
- .concat($$a.slice($$i + 1)))
1614
- }
1615
- } else {
1616
- _vm.model = $$c
1617
- }
1618
- },
1619
- _vm.handleChange,
1620
- ],
1621
- focus: function ($event) {
1622
- _vm.focus = true
1623
- },
1624
- blur: function ($event) {
1625
- _vm.focus = false
1626
- },
1627
- },
1628
- })
1629
- : _c("input", {
1630
- directives: [
1631
- {
1632
- name: "model",
1633
- rawName: "v-model",
1634
- value: _vm.model,
1635
- expression: "model",
1636
- },
1637
- ],
1638
- staticClass: "el-checkbox__original",
1639
- attrs: {
1640
- type: "checkbox",
1641
- "aria-hidden": _vm.indeterminate ? "true" : "false",
1642
- disabled: _vm.isDisabled,
1643
- name: _vm.name,
1644
- },
1645
- domProps: {
1646
- value: _vm.label,
1647
- checked: Array.isArray(_vm.model)
1648
- ? _vm._i(_vm.model, _vm.label) > -1
1649
- : _vm.model,
1650
- },
1651
- on: {
1652
- change: [
1653
- function ($event) {
1654
- var $$a = _vm.model,
1655
- $$el = $event.target,
1656
- $$c = $$el.checked ? true : false
1657
- if (Array.isArray($$a)) {
1658
- var $$v = _vm.label,
1659
- $$i = _vm._i($$a, $$v)
1660
- if ($$el.checked) {
1661
- $$i < 0 && (_vm.model = $$a.concat([$$v]))
1662
- } else {
1663
- $$i > -1 &&
1664
- (_vm.model = $$a
1665
- .slice(0, $$i)
1666
- .concat($$a.slice($$i + 1)))
1667
- }
1668
- } else {
1669
- _vm.model = $$c
1670
- }
1671
- },
1672
- _vm.handleChange,
1673
- ],
1674
- focus: function ($event) {
1675
- _vm.focus = true
1676
- },
1677
- blur: function ($event) {
1678
- _vm.focus = false
1679
- },
1680
- },
1681
- }),
1682
- ]
1683
- ),
1684
- _vm.$slots.default || _vm.label
1685
- ? _c(
1686
- "span",
1687
- { staticClass: "el-checkbox__label" },
1688
- [
1689
- _vm._t("default"),
1690
- !_vm.$slots.default ? [_vm._v(_vm._s(_vm.label))] : _vm._e(),
1691
- ],
1692
- 2
1693
- )
1694
- : _vm._e(),
1695
- ]
1696
- )
1697
- }
1698
- var staticRenderFns = []
1699
- render._withStripped = true
1700
-
1701
-
1702
- // CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=template&id=5f30258f
1703
-
1704
- // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
1705
- var emitter_ = __webpack_require__(4);
1706
- var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
1707
-
1708
- // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/checkbox/src/checkbox.vue?vue&type=script&lang=js
1709
- //
1710
- //
1711
- //
1712
- //
1713
- //
1714
- //
1715
- //
1716
- //
1717
- //
1718
- //
1719
- //
1720
- //
1721
- //
1722
- //
1723
- //
1724
- //
1725
- //
1726
- //
1727
- //
1728
- //
1729
- //
1730
- //
1731
- //
1732
- //
1733
- //
1734
- //
1735
- //
1736
- //
1737
- //
1738
- //
1739
- //
1740
- //
1741
- //
1742
- //
1743
- //
1744
- //
1745
- //
1746
- //
1747
- //
1748
- //
1749
- //
1750
- //
1751
- //
1752
- //
1753
- //
1754
- //
1755
- //
1756
- //
1757
- //
1758
- //
1759
- //
1760
- //
1761
- //
1762
- //
1763
- //
1764
-
1765
-
1766
-
1767
- /* harmony default export */ var checkboxvue_type_script_lang_js = ({
1768
- name: 'ElCheckbox',
1769
-
1770
- mixins: [emitter_default.a],
1771
-
1772
- inject: {
1773
- elForm: {
1774
- default: ''
1775
- },
1776
- elFormItem: {
1777
- default: ''
1778
- }
1779
- },
1780
-
1781
- componentName: 'ElCheckbox',
1782
-
1783
- data: function data() {
1784
- return {
1785
- selfModel: false,
1786
- focus: false,
1787
- isLimitExceeded: false
1788
- };
1789
- },
1790
-
1791
-
1792
- computed: {
1793
- model: {
1794
- get: function get() {
1795
- return this.isGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
1796
- },
1797
- set: function set(val) {
1798
- if (this.isGroup) {
1799
- this.isLimitExceeded = false;
1800
- this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (this.isLimitExceeded = true);
1801
-
1802
- this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (this.isLimitExceeded = true);
1803
-
1804
- this.isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
1805
- } else {
1806
- this.$emit('input', val);
1807
- this.selfModel = val;
1808
- }
1809
- }
1810
- },
1811
-
1812
- isChecked: function isChecked() {
1813
- if ({}.toString.call(this.model) === '[object Boolean]') {
1814
- return this.model;
1815
- } else if (Array.isArray(this.model)) {
1816
- return this.model.indexOf(this.label) > -1;
1817
- } else if (this.model !== null && this.model !== undefined) {
1818
- return this.model === this.trueLabel;
1819
- }
1820
- },
1821
- isGroup: function isGroup() {
1822
- var parent = this.$parent;
1823
- while (parent) {
1824
- if (parent.$options.componentName !== 'ElCheckboxGroup') {
1825
- parent = parent.$parent;
1826
- } else {
1827
- this._checkboxGroup = parent;
1828
- return true;
1829
- }
1830
- }
1831
- return false;
1832
- },
1833
- store: function store() {
1834
- return this._checkboxGroup ? this._checkboxGroup.value : this.value;
1835
- },
1836
-
1837
-
1838
- /* used to make the isDisabled judgment under max/min props */
1839
- isLimitDisabled: function isLimitDisabled() {
1840
- var _checkboxGroup = this._checkboxGroup,
1841
- max = _checkboxGroup.max,
1842
- min = _checkboxGroup.min;
1843
-
1844
- return !!(max || min) && this.model.length >= max && !this.isChecked || this.model.length <= min && this.isChecked;
1845
- },
1846
- isDisabled: function isDisabled() {
1847
- return this.isGroup ? this._checkboxGroup.disabled || this.disabled || (this.elForm || {}).disabled || this.isLimitDisabled : this.disabled || (this.elForm || {}).disabled;
1848
- },
1849
- _elFormItemSize: function _elFormItemSize() {
1850
- return (this.elFormItem || {}).elFormItemSize;
1851
- },
1852
- checkboxSize: function checkboxSize() {
1853
- var temCheckboxSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
1854
- return this.isGroup ? this._checkboxGroup.checkboxGroupSize || temCheckboxSize : temCheckboxSize;
1855
- }
1856
- },
1857
-
1858
- props: {
1859
- value: {},
1860
- label: {},
1861
- indeterminate: Boolean,
1862
- disabled: Boolean,
1863
- checked: Boolean,
1864
- name: String,
1865
- trueLabel: [String, Number],
1866
- falseLabel: [String, Number],
1867
- id: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
1868
- controls: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
1869
- border: Boolean,
1870
- size: String
1871
- },
1872
-
1873
- methods: {
1874
- addToStore: function addToStore() {
1875
- if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
1876
- this.model.push(this.label);
1877
- } else {
1878
- this.model = this.trueLabel || true;
1879
- }
1880
- },
1881
- handleChange: function handleChange(ev) {
1882
- var _this = this;
1883
-
1884
- if (this.isLimitExceeded) return;
1885
- var value = void 0;
1886
- if (ev.target.checked) {
1887
- value = this.trueLabel === undefined ? true : this.trueLabel;
1888
- } else {
1889
- value = this.falseLabel === undefined ? false : this.falseLabel;
1890
- }
1891
- this.$emit('change', value, ev);
1892
- this.$nextTick(function () {
1893
- if (_this.isGroup) {
1894
- _this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
1895
- }
1896
- });
1897
- }
1898
- },
1899
-
1900
- created: function created() {
1901
- this.checked && this.addToStore();
1902
- },
1903
- mounted: function mounted() {
1904
- // 为indeterminate元素 添加aria-controls 属性
1905
- if (this.indeterminate) {
1906
- this.$el.setAttribute('aria-controls', this.controls);
1907
- }
1908
- },
1909
-
1910
-
1911
- watch: {
1912
- value: function value(_value) {
1913
- this.dispatch('ElFormItem', 'el.form.change', _value);
1914
- }
1915
- }
1916
- });
1917
- // CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=script&lang=js
1918
- /* harmony default export */ var src_checkboxvue_type_script_lang_js = (checkboxvue_type_script_lang_js);
1919
- // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
1920
- var componentNormalizer = __webpack_require__(0);
1921
-
1922
- // CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue
1923
-
1924
-
1925
-
1926
-
1927
-
1928
- /* normalize component */
1929
-
1930
- var component = Object(componentNormalizer["a" /* default */])(
1931
- src_checkboxvue_type_script_lang_js,
1932
- render,
1933
- staticRenderFns,
1934
- false,
1935
- null,
1936
- null,
1937
- null
1938
-
1939
- )
1940
-
1941
- /* harmony default export */ var src_checkbox = (component.exports);
1942
- // CONCATENATED MODULE: ./packages/checkbox/index.js
1943
-
1944
-
1945
- /* istanbul ignore next */
1946
- src_checkbox.install = function (Vue) {
1947
- Vue.component(src_checkbox.name, src_checkbox);
1948
- };
1949
-
1950
- /* harmony default export */ var packages_checkbox = __webpack_exports__["default"] = (src_checkbox);
1951
-
1952
- /***/ }),
1953
-
1954
- /***/ 22:
1955
- /***/ (function(module, exports) {
1956
-
1957
- module.exports = require("element-ui/lib/locale");
1958
-
1959
- /***/ }),
1960
-
1961
- /***/ 27:
1962
- /***/ (function(module, exports) {
1963
-
1964
- module.exports = require("element-ui/lib/transitions/collapse-transition");
1965
-
1966
- /***/ }),
1967
-
1968
- /***/ 3:
1969
- /***/ (function(module, exports) {
1970
-
1971
- module.exports = require("element-ui/lib/utils/util");
1972
-
1973
- /***/ }),
1974
-
1975
- /***/ 36:
1976
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1977
-
1978
- "use strict";
1979
- // ESM COMPAT FLAG
1980
- __webpack_require__.r(__webpack_exports__);
1981
-
1982
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/popover/src/main.vue?vue&type=template&id=0e66f51f
1983
- var render = function () {
1984
- var _vm = this
1985
- var _h = _vm.$createElement
1986
- var _c = _vm._self._c || _h
1987
- return _c(
1988
- "span",
1989
- [
1990
- _c(
1991
- "transition",
1992
- {
1993
- attrs: { name: _vm.transition },
1994
- on: {
1995
- "after-enter": _vm.handleAfterEnter,
1996
- "after-leave": _vm.handleAfterLeave,
1997
- },
1998
- },
1999
- [
2000
- _c(
2001
- "div",
2002
- {
2003
- directives: [
2004
- {
2005
- name: "show",
2006
- rawName: "v-show",
2007
- value: !_vm.disabled && _vm.showPopper,
2008
- expression: "!disabled && showPopper",
2009
- },
2010
- ],
2011
- ref: "popper",
2012
- staticClass: "el-popover el-popper",
2013
- class: [_vm.popperClass, _vm.content && "el-popover--plain"],
2014
- style: { width: _vm.width + "px" },
2015
- attrs: {
2016
- role: "tooltip",
2017
- id: _vm.tooltipId,
2018
- "aria-hidden":
2019
- _vm.disabled || !_vm.showPopper ? "true" : "false",
2020
- },
2021
- },
2022
- [
2023
- _vm.title
2024
- ? _c("div", {
2025
- staticClass: "el-popover__title",
2026
- domProps: { textContent: _vm._s(_vm.title) },
2027
- })
2028
- : _vm._e(),
2029
- _vm._t("default", [_vm._v(_vm._s(_vm.content))]),
2030
- ],
2031
- 2
2032
- ),
2033
- ]
2034
- ),
2035
- _c(
2036
- "span",
2037
- { ref: "wrapper", staticClass: "el-popover__reference-wrapper" },
2038
- [_vm._t("reference")],
2039
- 2
2040
- ),
2041
- ],
2042
- 1
2043
- )
2044
- }
2045
- var staticRenderFns = []
2046
- render._withStripped = true
2047
-
2048
-
2049
- // CONCATENATED MODULE: ./packages/popover/src/main.vue?vue&type=template&id=0e66f51f
2050
-
2051
- // EXTERNAL MODULE: external "element-ui/lib/utils/vue-popper"
2052
- var vue_popper_ = __webpack_require__(5);
2053
- var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
2054
-
2055
- // EXTERNAL MODULE: external "element-ui/lib/utils/dom"
2056
- var dom_ = __webpack_require__(1);
2057
-
2058
- // EXTERNAL MODULE: external "element-ui/lib/utils/util"
2059
- var util_ = __webpack_require__(3);
2060
-
2061
- // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/popover/src/main.vue?vue&type=script&lang=js
2062
- //
2063
- //
2064
- //
2065
- //
2066
- //
2067
- //
2068
- //
2069
- //
2070
- //
2071
- //
2072
- //
2073
- //
2074
- //
2075
- //
2076
- //
2077
- //
2078
- //
2079
- //
2080
- //
2081
- //
2082
- //
2083
- //
2084
- //
2085
- //
2086
- //
2087
-
2088
-
2089
-
2090
-
2091
-
2092
-
2093
- /* harmony default export */ var mainvue_type_script_lang_js = ({
2094
- name: 'ElPopover',
2095
-
2096
- mixins: [vue_popper_default.a],
2097
-
2098
- props: {
2099
- trigger: {
2100
- type: String,
2101
- default: 'click',
2102
- validator: function validator(value) {
2103
- return ['click', 'focus', 'hover', 'manual'].indexOf(value) > -1;
2104
- }
2105
- },
2106
- openDelay: {
2107
- type: Number,
2108
- default: 0
2109
- },
2110
- closeDelay: {
2111
- type: Number,
2112
- default: 200
2113
- },
2114
- title: String,
2115
- disabled: Boolean,
2116
- content: String,
2117
- reference: {},
2118
- popperClass: String,
2119
- width: {},
2120
- visibleArrow: {
2121
- default: true
2122
- },
2123
- arrowOffset: {
2124
- type: Number,
2125
- default: 0
2126
- },
2127
- transition: {
2128
- type: String,
2129
- default: 'fade-in-linear'
2130
- },
2131
- tabindex: {
2132
- type: Number,
2133
- default: 0
2134
- }
2135
- },
2136
-
2137
- computed: {
2138
- tooltipId: function tooltipId() {
2139
- return 'el-popover-' + Object(util_["generateId"])();
2140
- }
2141
- },
2142
- watch: {
2143
- showPopper: function showPopper(val) {
2144
- if (this.disabled) {
2145
- return;
2146
- }
2147
- val ? this.$emit('show') : this.$emit('hide');
2148
- }
2149
- },
2150
-
2151
- mounted: function mounted() {
2152
- var _this = this;
2153
-
2154
- var reference = this.referenceElm = this.reference || this.$refs.reference;
2155
- var popper = this.popper || this.$refs.popper;
2156
-
2157
- if (!reference && this.$refs.wrapper.children) {
2158
- reference = this.referenceElm = this.$refs.wrapper.children[0];
2159
- }
2160
- // 可访问性
2161
- if (reference) {
2162
- Object(dom_["addClass"])(reference, 'el-popover__reference');
2163
- reference.setAttribute('aria-describedby', this.tooltipId);
2164
- reference.setAttribute('tabindex', this.tabindex); // tab序列
2165
- popper.setAttribute('tabindex', 0);
2166
-
2167
- if (this.trigger !== 'click') {
2168
- Object(dom_["on"])(reference, 'focusin', function () {
2169
- _this.handleFocus();
2170
- var instance = reference.__vue__;
2171
- if (instance && typeof instance.focus === 'function') {
2172
- instance.focus();
2173
- }
2174
- });
2175
- Object(dom_["on"])(popper, 'focusin', this.handleFocus);
2176
- Object(dom_["on"])(reference, 'focusout', this.handleBlur);
2177
- Object(dom_["on"])(popper, 'focusout', this.handleBlur);
2178
- }
2179
- Object(dom_["on"])(reference, 'keydown', this.handleKeydown);
2180
- Object(dom_["on"])(reference, 'click', this.handleClick);
2181
- }
2182
- if (this.trigger === 'click') {
2183
- Object(dom_["on"])(reference, 'click', this.doToggle);
2184
- Object(dom_["on"])(document, 'click', this.handleDocumentClick);
2185
- } else if (this.trigger === 'hover') {
2186
- Object(dom_["on"])(reference, 'mouseenter', this.handleMouseEnter);
2187
- Object(dom_["on"])(popper, 'mouseenter', this.handleMouseEnter);
2188
- Object(dom_["on"])(reference, 'mouseleave', this.handleMouseLeave);
2189
- Object(dom_["on"])(popper, 'mouseleave', this.handleMouseLeave);
2190
- } else if (this.trigger === 'focus') {
2191
- if (this.tabindex < 0) {
2192
- console.warn('[Element Warn][Popover]a negative taindex means that the element cannot be focused by tab key');
2193
- }
2194
- if (reference.querySelector('input, textarea')) {
2195
- Object(dom_["on"])(reference, 'focusin', this.doShow);
2196
- Object(dom_["on"])(reference, 'focusout', this.doClose);
2197
- } else {
2198
- Object(dom_["on"])(reference, 'mousedown', this.doShow);
2199
- Object(dom_["on"])(reference, 'mouseup', this.doClose);
2200
- }
2201
- }
2202
- },
2203
- beforeDestroy: function beforeDestroy() {
2204
- this.cleanup();
2205
- },
2206
- deactivated: function deactivated() {
2207
- this.cleanup();
2208
- },
2209
-
2210
-
2211
- methods: {
2212
- doToggle: function doToggle() {
2213
- this.showPopper = !this.showPopper;
2214
- },
2215
- doShow: function doShow() {
2216
- this.showPopper = true;
2217
- },
2218
- doClose: function doClose() {
2219
- this.showPopper = false;
2220
- },
2221
- handleFocus: function handleFocus() {
2222
- Object(dom_["addClass"])(this.referenceElm, 'focusing');
2223
- if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = true;
2224
- },
2225
- handleClick: function handleClick() {
2226
- Object(dom_["removeClass"])(this.referenceElm, 'focusing');
2227
- },
2228
- handleBlur: function handleBlur() {
2229
- Object(dom_["removeClass"])(this.referenceElm, 'focusing');
2230
- if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = false;
2231
- },
2232
- handleMouseEnter: function handleMouseEnter() {
2233
- var _this2 = this;
2234
-
2235
- clearTimeout(this._timer);
2236
- if (this.openDelay) {
2237
- this._timer = setTimeout(function () {
2238
- _this2.showPopper = true;
2239
- }, this.openDelay);
2240
- } else {
2241
- this.showPopper = true;
2242
- }
2243
- },
2244
- handleKeydown: function handleKeydown(ev) {
2245
- if (ev.keyCode === 27 && this.trigger !== 'manual') {
2246
- // esc
2247
- this.doClose();
2248
- }
2249
- },
2250
- handleMouseLeave: function handleMouseLeave() {
2251
- var _this3 = this;
2252
-
2253
- clearTimeout(this._timer);
2254
- if (this.closeDelay) {
2255
- this._timer = setTimeout(function () {
2256
- _this3.showPopper = false;
2257
- }, this.closeDelay);
2258
- } else {
2259
- this.showPopper = false;
2260
- }
2261
- },
2262
- handleDocumentClick: function handleDocumentClick(e) {
2263
- var reference = this.reference || this.$refs.reference;
2264
- var popper = this.popper || this.$refs.popper;
2265
-
2266
- if (!reference && this.$refs.wrapper.children) {
2267
- reference = this.referenceElm = this.$refs.wrapper.children[0];
2268
- }
2269
- if (!this.$el || !reference || this.$el.contains(e.target) || reference.contains(e.target) || !popper || popper.contains(e.target)) return;
2270
- this.showPopper = false;
2271
- },
2272
- handleAfterEnter: function handleAfterEnter() {
2273
- this.$emit('after-enter');
2274
- },
2275
- handleAfterLeave: function handleAfterLeave() {
2276
- this.$emit('after-leave');
2277
- this.doDestroy();
2278
- },
2279
- cleanup: function cleanup() {
2280
- if (this.openDelay || this.closeDelay) {
2281
- clearTimeout(this._timer);
2282
- }
2283
- }
2284
- },
2285
-
2286
- destroyed: function destroyed() {
2287
- var reference = this.reference;
2288
-
2289
- Object(dom_["off"])(reference, 'click', this.doToggle);
2290
- Object(dom_["off"])(reference, 'mouseup', this.doClose);
2291
- Object(dom_["off"])(reference, 'mousedown', this.doShow);
2292
- Object(dom_["off"])(reference, 'focusin', this.doShow);
2293
- Object(dom_["off"])(reference, 'focusout', this.doClose);
2294
- Object(dom_["off"])(reference, 'mousedown', this.doShow);
2295
- Object(dom_["off"])(reference, 'mouseup', this.doClose);
2296
- Object(dom_["off"])(reference, 'mouseleave', this.handleMouseLeave);
2297
- Object(dom_["off"])(reference, 'mouseenter', this.handleMouseEnter);
2298
- Object(dom_["off"])(document, 'click', this.handleDocumentClick);
2299
- }
2300
- });
2301
- // CONCATENATED MODULE: ./packages/popover/src/main.vue?vue&type=script&lang=js
2302
- /* harmony default export */ var src_mainvue_type_script_lang_js = (mainvue_type_script_lang_js);
2303
- // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
2304
- var componentNormalizer = __webpack_require__(0);
2305
-
2306
- // CONCATENATED MODULE: ./packages/popover/src/main.vue
2307
-
2308
-
2309
-
2310
-
2311
-
2312
- /* normalize component */
2313
-
2314
- var component = Object(componentNormalizer["a" /* default */])(
2315
- src_mainvue_type_script_lang_js,
2316
- render,
2317
- staticRenderFns,
2318
- false,
2319
- null,
2320
- null,
2321
- null
2322
-
2323
- )
2324
-
2325
- /* harmony default export */ var main = (component.exports);
2326
- // CONCATENATED MODULE: ./packages/popover/src/directive.js
2327
- var getReference = function getReference(el, binding, vnode) {
2328
- var _ref = binding.expression ? binding.value : binding.arg;
2329
- var popper = vnode.context.$refs[_ref];
2330
- if (popper) {
2331
- if (Array.isArray(popper)) {
2332
- popper[0].$refs.reference = el;
2333
- } else {
2334
- popper.$refs.reference = el;
2335
- }
2336
- }
2337
- };
2338
-
2339
- /* harmony default export */ var directive = ({
2340
- bind: function bind(el, binding, vnode) {
2341
- getReference(el, binding, vnode);
2342
- },
2343
- inserted: function inserted(el, binding, vnode) {
2344
- getReference(el, binding, vnode);
2345
- }
2346
- });
2347
- // EXTERNAL MODULE: external "vue"
2348
- var external_vue_ = __webpack_require__(8);
2349
- var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
2350
-
2351
- // CONCATENATED MODULE: ./packages/popover/index.js
2352
-
2353
-
2354
-
2355
-
2356
- external_vue_default.a.directive('popover', directive);
2357
-
2358
- /* istanbul ignore next */
2359
- main.install = function (Vue) {
2360
- Vue.directive('popover', directive);
2361
- Vue.component(main.name, main);
2362
- };
2363
- main.directive = directive;
2364
-
2365
- /* harmony default export */ var popover = __webpack_exports__["default"] = (main);
2366
-
2367
- /***/ }),
2368
-
2369
- /***/ 4:
2370
- /***/ (function(module, exports) {
2371
-
2372
- module.exports = require("element-ui/lib/mixins/emitter");
2373
-
2374
- /***/ }),
2375
-
2376
- /***/ 46:
2377
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2378
-
2379
- "use strict";
2380
- // ESM COMPAT FLAG
2381
- __webpack_require__.r(__webpack_exports__);
2382
-
2383
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/tree/src/tree.vue?vue&type=template&id=37500abf
2384
- var render = function () {
2385
- var _vm = this
2386
- var _h = _vm.$createElement
2387
- var _c = _vm._self._c || _h
2388
- return _c(
2389
- "div",
2390
- {
2391
- staticClass: "el-tree",
2392
- class: {
2393
- "el-tree--highlight-current": _vm.highlightCurrent,
2394
- "is-dragging": !!_vm.dragState.draggingNode,
2395
- "is-drop-not-allow": !_vm.dragState.allowDrop,
2396
- "is-drop-inner": _vm.dragState.dropType === "inner",
2397
- },
2398
- attrs: { role: "tree" },
2399
- },
2400
- [
2401
- _vm._l(_vm.root.childNodes, function (child) {
2402
- return _c("el-tree-node", {
2403
- key: _vm.getNodeKey(child),
2404
- attrs: {
2405
- node: child,
2406
- props: _vm.props,
2407
- "render-after-expand": _vm.renderAfterExpand,
2408
- "show-checkbox": _vm.showCheckbox,
2409
- "render-content": _vm.renderContent,
2410
- },
2411
- on: { "node-expand": _vm.handleNodeExpand },
2412
- })
2413
- }),
2414
- _vm.isEmpty
2415
- ? _c("div", { staticClass: "el-tree__empty-block" }, [
2416
- _c("span", { staticClass: "el-tree__empty-text" }, [
2417
- _vm._v(_vm._s(_vm.emptyText)),
2418
- ]),
2419
- ])
2420
- : _vm._e(),
2421
- _c("div", {
2422
- directives: [
2423
- {
2424
- name: "show",
2425
- rawName: "v-show",
2426
- value: _vm.dragState.showDropIndicator,
2427
- expression: "dragState.showDropIndicator",
2428
- },
2429
- ],
2430
- ref: "dropIndicator",
2431
- staticClass: "el-tree__drop-indicator",
2432
- }),
2433
- ],
2434
- 2
2435
- )
2436
- }
2437
- var staticRenderFns = []
2438
- render._withStripped = true
2439
-
2440
-
2441
- // CONCATENATED MODULE: ./packages/tree/src/tree.vue?vue&type=template&id=37500abf
2442
-
2443
- // EXTERNAL MODULE: external "element-ui/lib/utils/merge"
2444
- var merge_ = __webpack_require__(6);
2445
- var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
2446
-
2447
- // CONCATENATED MODULE: ./packages/tree/src/model/util.js
2448
- var NODE_KEY = '$treeNodeId';
2449
-
2450
- var markNodeData = function markNodeData(node, data) {
2451
- if (!data || data[NODE_KEY]) return;
2452
- Object.defineProperty(data, NODE_KEY, {
2453
- value: node.id,
2454
- enumerable: false,
2455
- configurable: false,
2456
- writable: false
2457
- });
2458
- };
2459
-
2460
- var util_getNodeKey = function getNodeKey(key, data) {
2461
- if (!key) return data[NODE_KEY];
2462
- return data[key];
2463
- };
2464
-
2465
- var findNearestComponent = function findNearestComponent(element, componentName) {
2466
- var target = element;
2467
- while (target && target.tagName !== 'BODY') {
2468
- if (target.__vue__ && target.__vue__.$options.name === componentName) {
2469
- return target.__vue__;
2470
- }
2471
- target = target.parentNode;
2472
- }
2473
- return null;
2474
- };
2475
- // EXTERNAL MODULE: external "element-ui/lib/utils/util"
2476
- var util_ = __webpack_require__(3);
2477
-
2478
- // CONCATENATED MODULE: ./packages/tree/src/model/node.js
2479
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2480
-
2481
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2482
-
2483
-
2484
-
2485
-
2486
-
2487
- var getChildState = function getChildState(node) {
2488
- var all = true;
2489
- var none = true;
2490
- var allWithoutDisable = true;
2491
- for (var i = 0, j = node.length; i < j; i++) {
2492
- var n = node[i];
2493
- if (n.checked !== true || n.indeterminate) {
2494
- all = false;
2495
- if (!n.disabled) {
2496
- allWithoutDisable = false;
2497
- }
2498
- }
2499
- if (n.checked !== false || n.indeterminate) {
2500
- none = false;
2501
- }
2502
- }
2503
-
2504
- return { all: all, none: none, allWithoutDisable: allWithoutDisable, half: !all && !none };
2505
- };
2506
-
2507
- var reInitChecked = function reInitChecked(node) {
2508
- if (node.childNodes.length === 0 || node.loading) return;
2509
-
2510
- var _getChildState = getChildState(node.childNodes),
2511
- all = _getChildState.all,
2512
- none = _getChildState.none,
2513
- half = _getChildState.half;
2514
-
2515
- if (all) {
2516
- node.checked = true;
2517
- node.indeterminate = false;
2518
- } else if (half) {
2519
- node.checked = false;
2520
- node.indeterminate = true;
2521
- } else if (none) {
2522
- node.checked = false;
2523
- node.indeterminate = false;
2524
- }
2525
-
2526
- var parent = node.parent;
2527
- if (!parent || parent.level === 0) return;
2528
-
2529
- if (!node.store.checkStrictly) {
2530
- reInitChecked(parent);
2531
- }
2532
- };
2533
-
2534
- var getPropertyFromData = function getPropertyFromData(node, prop) {
2535
- var props = node.store.props;
2536
- var data = node.data || {};
2537
- var config = props[prop];
2538
-
2539
- if (typeof config === 'function') {
2540
- return config(data, node);
2541
- } else if (typeof config === 'string') {
2542
- return data[config];
2543
- } else if (typeof config === 'undefined') {
2544
- var dataProp = data[prop];
2545
- return dataProp === undefined ? '' : dataProp;
2546
- }
2547
- };
2548
-
2549
- var nodeIdSeed = 0;
2550
-
2551
- var node_Node = function () {
2552
- function Node(options) {
2553
- _classCallCheck(this, Node);
2554
-
2555
- this.id = nodeIdSeed++;
2556
- this.text = null;
2557
- this.checked = false;
2558
- this.indeterminate = false;
2559
- this.data = null;
2560
- this.expanded = false;
2561
- this.parent = null;
2562
- this.visible = true;
2563
- this.isCurrent = false;
2564
-
2565
- for (var name in options) {
2566
- if (options.hasOwnProperty(name)) {
2567
- this[name] = options[name];
2568
- }
2569
- }
2570
-
2571
- // internal
2572
- this.level = 0;
2573
- this.loaded = false;
2574
- this.childNodes = [];
2575
- this.loading = false;
2576
-
2577
- if (this.parent) {
2578
- this.level = this.parent.level + 1;
2579
- }
2580
-
2581
- var store = this.store;
2582
- if (!store) {
2583
- throw new Error('[Node]store is required!');
2584
- }
2585
- store.registerNode(this);
2586
-
2587
- var props = store.props;
2588
- if (props && typeof props.isLeaf !== 'undefined') {
2589
- var isLeaf = getPropertyFromData(this, 'isLeaf');
2590
- if (typeof isLeaf === 'boolean') {
2591
- this.isLeafByUser = isLeaf;
2592
- }
2593
- }
2594
-
2595
- if (store.lazy !== true && this.data) {
2596
- this.setData(this.data);
2597
-
2598
- if (store.defaultExpandAll) {
2599
- this.expanded = true;
2600
- }
2601
- } else if (this.level > 0 && store.lazy && store.defaultExpandAll) {
2602
- this.expand();
2603
- }
2604
- if (!Array.isArray(this.data)) {
2605
- markNodeData(this, this.data);
2606
- }
2607
- if (!this.data) return;
2608
- var defaultExpandedKeys = store.defaultExpandedKeys;
2609
- var key = store.key;
2610
- if (key && defaultExpandedKeys && defaultExpandedKeys.indexOf(this.key) !== -1) {
2611
- this.expand(null, store.autoExpandParent);
2612
- }
2613
-
2614
- if (key && store.currentNodeKey !== undefined && this.key === store.currentNodeKey) {
2615
- store.currentNode = this;
2616
- store.currentNode.isCurrent = true;
2617
- }
2618
-
2619
- if (store.lazy) {
2620
- store._initDefaultCheckedNode(this);
2621
- }
2622
-
2623
- this.updateLeafState();
2624
- }
2625
-
2626
- Node.prototype.setData = function setData(data) {
2627
- if (!Array.isArray(data)) {
2628
- markNodeData(this, data);
2629
- }
2630
-
2631
- this.data = data;
2632
- this.childNodes = [];
2633
-
2634
- var children = void 0;
2635
- if (this.level === 0 && this.data instanceof Array) {
2636
- children = this.data;
2637
- } else {
2638
- children = getPropertyFromData(this, 'children') || [];
2639
- }
2640
-
2641
- for (var i = 0, j = children.length; i < j; i++) {
2642
- this.insertChild({ data: children[i] });
2643
- }
2644
- };
2645
-
2646
- Node.prototype.contains = function contains(target) {
2647
- var deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2648
-
2649
- var walk = function walk(parent) {
2650
- var children = parent.childNodes || [];
2651
- var result = false;
2652
- for (var i = 0, j = children.length; i < j; i++) {
2653
- var child = children[i];
2654
- if (child === target || deep && walk(child)) {
2655
- result = true;
2656
- break;
2657
- }
2658
- }
2659
- return result;
2660
- };
2661
-
2662
- return walk(this);
2663
- };
2664
-
2665
- Node.prototype.remove = function remove() {
2666
- var parent = this.parent;
2667
- if (parent) {
2668
- parent.removeChild(this);
2669
- }
2670
- };
2671
-
2672
- Node.prototype.insertChild = function insertChild(child, index, batch) {
2673
- if (!child) throw new Error('insertChild error: child is required.');
2674
-
2675
- if (!(child instanceof Node)) {
2676
- if (!batch) {
2677
- var children = this.getChildren(true) || [];
2678
- if (children.indexOf(child.data) === -1) {
2679
- if (typeof index === 'undefined' || index < 0) {
2680
- children.push(child.data);
2681
- } else {
2682
- children.splice(index, 0, child.data);
2683
- }
2684
- }
2685
- }
2686
- merge_default()(child, {
2687
- parent: this,
2688
- store: this.store
2689
- });
2690
- child = new Node(child);
2691
- }
2692
-
2693
- child.level = this.level + 1;
2694
-
2695
- if (typeof index === 'undefined' || index < 0) {
2696
- this.childNodes.push(child);
2697
- } else {
2698
- this.childNodes.splice(index, 0, child);
2699
- }
2700
-
2701
- this.updateLeafState();
2702
- };
2703
-
2704
- Node.prototype.insertBefore = function insertBefore(child, ref) {
2705
- var index = void 0;
2706
- if (ref) {
2707
- index = this.childNodes.indexOf(ref);
2708
- }
2709
- this.insertChild(child, index);
2710
- };
2711
-
2712
- Node.prototype.insertAfter = function insertAfter(child, ref) {
2713
- var index = void 0;
2714
- if (ref) {
2715
- index = this.childNodes.indexOf(ref);
2716
- if (index !== -1) index += 1;
2717
- }
2718
- this.insertChild(child, index);
2719
- };
2720
-
2721
- Node.prototype.removeChild = function removeChild(child) {
2722
- var children = this.getChildren() || [];
2723
- var dataIndex = children.indexOf(child.data);
2724
- if (dataIndex > -1) {
2725
- children.splice(dataIndex, 1);
2726
- }
2727
-
2728
- var index = this.childNodes.indexOf(child);
2729
-
2730
- if (index > -1) {
2731
- this.store && this.store.deregisterNode(child);
2732
- child.parent = null;
2733
- this.childNodes.splice(index, 1);
2734
- }
2735
-
2736
- this.updateLeafState();
2737
- };
2738
-
2739
- Node.prototype.removeChildByData = function removeChildByData(data) {
2740
- var targetNode = null;
2741
-
2742
- for (var i = 0; i < this.childNodes.length; i++) {
2743
- if (this.childNodes[i].data === data) {
2744
- targetNode = this.childNodes[i];
2745
- break;
2746
- }
2747
- }
2748
-
2749
- if (targetNode) {
2750
- this.removeChild(targetNode);
2751
- }
2752
- };
2753
-
2754
- Node.prototype.expand = function expand(callback, expandParent) {
2755
- var _this = this;
2756
-
2757
- var done = function done() {
2758
- if (expandParent) {
2759
- var parent = _this.parent;
2760
- while (parent.level > 0) {
2761
- parent.expanded = true;
2762
- parent = parent.parent;
2763
- }
2764
- }
2765
- _this.expanded = true;
2766
- if (callback) callback();
2767
- };
2768
-
2769
- if (this.shouldLoadData()) {
2770
- this.loadData(function (data) {
2771
- if (data instanceof Array) {
2772
- if (_this.checked) {
2773
- _this.setChecked(true, true);
2774
- } else if (!_this.store.checkStrictly) {
2775
- reInitChecked(_this);
2776
- }
2777
- done();
2778
- }
2779
- });
2780
- } else {
2781
- done();
2782
- }
2783
- };
2784
-
2785
- Node.prototype.doCreateChildren = function doCreateChildren(array) {
2786
- var _this2 = this;
2787
-
2788
- var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2789
-
2790
- array.forEach(function (item) {
2791
- _this2.insertChild(merge_default()({ data: item }, defaultProps), undefined, true);
2792
- });
2793
- };
2794
-
2795
- Node.prototype.collapse = function collapse() {
2796
- this.expanded = false;
2797
- };
2798
-
2799
- Node.prototype.shouldLoadData = function shouldLoadData() {
2800
- return this.store.lazy === true && this.store.load && !this.loaded;
2801
- };
2802
-
2803
- Node.prototype.updateLeafState = function updateLeafState() {
2804
- if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== 'undefined') {
2805
- this.isLeaf = this.isLeafByUser;
2806
- return;
2807
- }
2808
- var childNodes = this.childNodes;
2809
- if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
2810
- this.isLeaf = !childNodes || childNodes.length === 0;
2811
- return;
2812
- }
2813
- this.isLeaf = false;
2814
- };
2815
-
2816
- Node.prototype.setChecked = function setChecked(value, deep, recursion, passValue) {
2817
- var _this3 = this;
2818
-
2819
- this.indeterminate = value === 'half';
2820
- this.checked = value === true;
2821
-
2822
- if (this.store.checkStrictly) return;
2823
-
2824
- if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
2825
- var _getChildState2 = getChildState(this.childNodes),
2826
- all = _getChildState2.all,
2827
- allWithoutDisable = _getChildState2.allWithoutDisable;
2828
-
2829
- if (!this.isLeaf && !all && allWithoutDisable) {
2830
- this.checked = false;
2831
- value = false;
2832
- }
2833
-
2834
- var handleDescendants = function handleDescendants() {
2835
- if (deep) {
2836
- var childNodes = _this3.childNodes;
2837
- for (var i = 0, j = childNodes.length; i < j; i++) {
2838
- var child = childNodes[i];
2839
- passValue = passValue || value !== false;
2840
- var isCheck = child.disabled ? child.checked : passValue;
2841
- child.setChecked(isCheck, deep, true, passValue);
2842
- }
2843
-
2844
- var _getChildState3 = getChildState(childNodes),
2845
- half = _getChildState3.half,
2846
- _all = _getChildState3.all;
2847
-
2848
- if (!_all) {
2849
- _this3.checked = _all;
2850
- _this3.indeterminate = half;
2851
- }
2852
- }
2853
- };
2854
-
2855
- if (this.shouldLoadData()) {
2856
- // Only work on lazy load data.
2857
- this.loadData(function () {
2858
- handleDescendants();
2859
- reInitChecked(_this3);
2860
- }, {
2861
- checked: value !== false
2862
- });
2863
- return;
2864
- } else {
2865
- handleDescendants();
2866
- }
2867
- }
2868
-
2869
- var parent = this.parent;
2870
- if (!parent || parent.level === 0) return;
2871
-
2872
- if (!recursion) {
2873
- reInitChecked(parent);
2874
- }
2875
- };
2876
-
2877
- Node.prototype.getChildren = function getChildren() {
2878
- var forceInit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2879
- // this is data
2880
- if (this.level === 0) return this.data;
2881
- var data = this.data;
2882
- if (!data) return null;
2883
-
2884
- var props = this.store.props;
2885
- var children = 'children';
2886
- if (props) {
2887
- children = props.children || 'children';
2888
- }
2889
-
2890
- if (data[children] === undefined) {
2891
- data[children] = null;
2892
- }
2893
-
2894
- if (forceInit && !data[children]) {
2895
- data[children] = [];
2896
- }
2897
-
2898
- return data[children];
2899
- };
2900
-
2901
- Node.prototype.updateChildren = function updateChildren() {
2902
- var _this4 = this;
2903
-
2904
- var newData = this.getChildren() || [];
2905
- var oldData = this.childNodes.map(function (node) {
2906
- return node.data;
2907
- });
2908
-
2909
- var newDataMap = {};
2910
- var newNodes = [];
2911
-
2912
- newData.forEach(function (item, index) {
2913
- var key = item[NODE_KEY];
2914
- var isNodeExists = !!key && Object(util_["arrayFindIndex"])(oldData, function (data) {
2915
- return data[NODE_KEY] === key;
2916
- }) >= 0;
2917
- if (isNodeExists) {
2918
- newDataMap[key] = { index: index, data: item };
2919
- } else {
2920
- newNodes.push({ index: index, data: item });
2921
- }
2922
- });
2923
-
2924
- if (!this.store.lazy) {
2925
- oldData.forEach(function (item) {
2926
- if (!newDataMap[item[NODE_KEY]]) _this4.removeChildByData(item);
2927
- });
2928
- }
2929
-
2930
- newNodes.forEach(function (_ref) {
2931
- var index = _ref.index,
2932
- data = _ref.data;
2933
-
2934
- _this4.insertChild({ data: data }, index);
2935
- });
2936
-
2937
- this.updateLeafState();
2938
- };
2939
-
2940
- Node.prototype.loadData = function loadData(callback) {
2941
- var _this5 = this;
2942
-
2943
- var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2944
-
2945
- if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
2946
- this.loading = true;
2947
-
2948
- var resolve = function resolve(children) {
2949
- _this5.childNodes = [];
2950
-
2951
- _this5.doCreateChildren(children, defaultProps);
2952
- _this5.loaded = true;
2953
- _this5.loading = false;
2954
- _this5.updateLeafState();
2955
- if (callback) {
2956
- callback.call(_this5, children);
2957
- }
2958
- };
2959
-
2960
- this.store.load(this, resolve);
2961
- } else {
2962
- if (callback) {
2963
- callback.call(this);
2964
- }
2965
- }
2966
- };
2967
-
2968
- _createClass(Node, [{
2969
- key: 'label',
2970
- get: function get() {
2971
- return getPropertyFromData(this, 'label');
2972
- }
2973
- }, {
2974
- key: 'key',
2975
- get: function get() {
2976
- var nodeKey = this.store.key;
2977
- if (this.data) return this.data[nodeKey];
2978
- return null;
2979
- }
2980
- }, {
2981
- key: 'disabled',
2982
- get: function get() {
2983
- return getPropertyFromData(this, 'disabled');
2984
- }
2985
- }, {
2986
- key: 'nextSibling',
2987
- get: function get() {
2988
- var parent = this.parent;
2989
- if (parent) {
2990
- var index = parent.childNodes.indexOf(this);
2991
- if (index > -1) {
2992
- return parent.childNodes[index + 1];
2993
- }
2994
- }
2995
- return null;
2996
- }
2997
- }, {
2998
- key: 'previousSibling',
2999
- get: function get() {
3000
- var parent = this.parent;
3001
- if (parent) {
3002
- var index = parent.childNodes.indexOf(this);
3003
- if (index > -1) {
3004
- return index > 0 ? parent.childNodes[index - 1] : null;
3005
- }
3006
- }
3007
- return null;
3008
- }
3009
- }]);
3010
-
3011
- return Node;
3012
- }();
3013
-
3014
- /* harmony default export */ var model_node = (node_Node);
3015
- // CONCATENATED MODULE: ./packages/tree/src/model/tree-store.js
3016
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
3017
-
3018
- function tree_store_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3019
-
3020
-
3021
-
3022
-
3023
- var tree_store_TreeStore = function () {
3024
- function TreeStore(options) {
3025
- var _this = this;
3026
-
3027
- tree_store_classCallCheck(this, TreeStore);
3028
-
3029
- this.currentNode = null;
3030
- this.currentNodeKey = null;
3031
-
3032
- for (var option in options) {
3033
- if (options.hasOwnProperty(option)) {
3034
- this[option] = options[option];
3035
- }
3036
- }
3037
-
3038
- this.nodesMap = {};
3039
-
3040
- this.root = new model_node({
3041
- data: this.data,
3042
- store: this
3043
- });
3044
-
3045
- if (this.lazy && this.load) {
3046
- var loadFn = this.load;
3047
- loadFn(this.root, function (data) {
3048
- _this.root.doCreateChildren(data);
3049
- _this._initDefaultCheckedNodes();
3050
- });
3051
- } else {
3052
- this._initDefaultCheckedNodes();
3053
- }
3054
- }
3055
-
3056
- TreeStore.prototype.filter = function filter(value) {
3057
- var filterNodeMethod = this.filterNodeMethod;
3058
- var lazy = this.lazy;
3059
- var traverse = function traverse(node) {
3060
- var childNodes = node.root ? node.root.childNodes : node.childNodes;
3061
-
3062
- childNodes.forEach(function (child) {
3063
- child.visible = filterNodeMethod.call(child, value, child.data, child);
3064
-
3065
- traverse(child);
3066
- });
3067
-
3068
- if (!node.visible && childNodes.length) {
3069
- var allHidden = true;
3070
- allHidden = !childNodes.some(function (child) {
3071
- return child.visible;
3072
- });
3073
-
3074
- if (node.root) {
3075
- node.root.visible = allHidden === false;
3076
- } else {
3077
- node.visible = allHidden === false;
3078
- }
3079
- }
3080
- if (!value) return;
3081
-
3082
- if (node.visible && !node.isLeaf && !lazy) node.expand();
3083
- };
3084
-
3085
- traverse(this);
3086
- };
3087
-
3088
- TreeStore.prototype.setData = function setData(newVal) {
3089
- var instanceChanged = newVal !== this.root.data;
3090
- if (instanceChanged) {
3091
- this.root.setData(newVal);
3092
- this._initDefaultCheckedNodes();
3093
- } else {
3094
- this.root.updateChildren();
3095
- }
3096
- };
3097
-
3098
- TreeStore.prototype.getNode = function getNode(data) {
3099
- if (data instanceof model_node) return data;
3100
- var key = (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object' ? data : util_getNodeKey(this.key, data);
3101
- return this.nodesMap[key] || null;
3102
- };
3103
-
3104
- TreeStore.prototype.insertBefore = function insertBefore(data, refData) {
3105
- var refNode = this.getNode(refData);
3106
- refNode.parent.insertBefore({ data: data }, refNode);
3107
- };
3108
-
3109
- TreeStore.prototype.insertAfter = function insertAfter(data, refData) {
3110
- var refNode = this.getNode(refData);
3111
- refNode.parent.insertAfter({ data: data }, refNode);
3112
- };
3113
-
3114
- TreeStore.prototype.remove = function remove(data) {
3115
- var node = this.getNode(data);
3116
-
3117
- if (node && node.parent) {
3118
- if (node === this.currentNode) {
3119
- this.currentNode = null;
3120
- }
3121
- node.parent.removeChild(node);
3122
- }
3123
- };
3124
-
3125
- TreeStore.prototype.append = function append(data, parentData) {
3126
- var parentNode = parentData ? this.getNode(parentData) : this.root;
3127
-
3128
- if (parentNode) {
3129
- parentNode.insertChild({ data: data });
3130
- }
3131
- };
3132
-
3133
- TreeStore.prototype._initDefaultCheckedNodes = function _initDefaultCheckedNodes() {
3134
- var _this2 = this;
3135
-
3136
- var defaultCheckedKeys = this.defaultCheckedKeys || [];
3137
- var nodesMap = this.nodesMap;
3138
-
3139
- defaultCheckedKeys.forEach(function (checkedKey) {
3140
- var node = nodesMap[checkedKey];
3141
-
3142
- if (node) {
3143
- node.setChecked(true, !_this2.checkStrictly);
3144
- }
3145
- });
3146
- };
3147
-
3148
- TreeStore.prototype._initDefaultCheckedNode = function _initDefaultCheckedNode(node) {
3149
- var defaultCheckedKeys = this.defaultCheckedKeys || [];
3150
-
3151
- if (defaultCheckedKeys.indexOf(node.key) !== -1) {
3152
- node.setChecked(true, !this.checkStrictly);
3153
- }
3154
- };
3155
-
3156
- TreeStore.prototype.setDefaultCheckedKey = function setDefaultCheckedKey(newVal) {
3157
- if (newVal !== this.defaultCheckedKeys) {
3158
- this.defaultCheckedKeys = newVal;
3159
- this._initDefaultCheckedNodes();
3160
- }
3161
- };
3162
-
3163
- TreeStore.prototype.registerNode = function registerNode(node) {
3164
- var key = this.key;
3165
- if (!key || !node || !node.data) return;
3166
-
3167
- var nodeKey = node.key;
3168
- if (nodeKey !== undefined) this.nodesMap[node.key] = node;
3169
- };
3170
-
3171
- TreeStore.prototype.deregisterNode = function deregisterNode(node) {
3172
- var _this3 = this;
3173
-
3174
- var key = this.key;
3175
- if (!key || !node || !node.data) return;
3176
-
3177
- node.childNodes.forEach(function (child) {
3178
- _this3.deregisterNode(child);
3179
- });
3180
-
3181
- delete this.nodesMap[node.key];
3182
- };
3183
-
3184
- TreeStore.prototype.getCheckedNodes = function getCheckedNodes() {
3185
- var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3186
- var includeHalfChecked = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3187
-
3188
- var checkedNodes = [];
3189
- var traverse = function traverse(node) {
3190
- var childNodes = node.root ? node.root.childNodes : node.childNodes;
3191
-
3192
- childNodes.forEach(function (child) {
3193
- if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
3194
- checkedNodes.push(child.data);
3195
- }
3196
-
3197
- traverse(child);
3198
- });
3199
- };
3200
-
3201
- traverse(this);
3202
-
3203
- return checkedNodes;
3204
- };
3205
-
3206
- TreeStore.prototype.getCheckedKeys = function getCheckedKeys() {
3207
- var _this4 = this;
3208
-
3209
- var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3210
-
3211
- return this.getCheckedNodes(leafOnly).map(function (data) {
3212
- return (data || {})[_this4.key];
3213
- });
3214
- };
3215
-
3216
- TreeStore.prototype.getHalfCheckedNodes = function getHalfCheckedNodes() {
3217
- var nodes = [];
3218
- var traverse = function traverse(node) {
3219
- var childNodes = node.root ? node.root.childNodes : node.childNodes;
3220
-
3221
- childNodes.forEach(function (child) {
3222
- if (child.indeterminate) {
3223
- nodes.push(child.data);
3224
- }
3225
-
3226
- traverse(child);
3227
- });
3228
- };
3229
-
3230
- traverse(this);
3231
-
3232
- return nodes;
3233
- };
3234
-
3235
- TreeStore.prototype.getHalfCheckedKeys = function getHalfCheckedKeys() {
3236
- var _this5 = this;
3237
-
3238
- return this.getHalfCheckedNodes().map(function (data) {
3239
- return (data || {})[_this5.key];
3240
- });
3241
- };
3242
-
3243
- TreeStore.prototype._getAllNodes = function _getAllNodes() {
3244
- var allNodes = [];
3245
- var nodesMap = this.nodesMap;
3246
- for (var nodeKey in nodesMap) {
3247
- if (nodesMap.hasOwnProperty(nodeKey)) {
3248
- allNodes.push(nodesMap[nodeKey]);
3249
- }
3250
- }
3251
-
3252
- return allNodes;
3253
- };
3254
-
3255
- TreeStore.prototype.updateChildren = function updateChildren(key, data) {
3256
- var node = this.nodesMap[key];
3257
- if (!node) return;
3258
- var childNodes = node.childNodes;
3259
- for (var i = childNodes.length - 1; i >= 0; i--) {
3260
- var child = childNodes[i];
3261
- this.remove(child.data);
3262
- }
3263
- for (var _i = 0, j = data.length; _i < j; _i++) {
3264
- var _child = data[_i];
3265
- this.append(_child, node.data);
3266
- }
3267
- };
3268
-
3269
- TreeStore.prototype._setCheckedKeys = function _setCheckedKeys(key) {
3270
- var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3271
- var checkedKeys = arguments[2];
3272
-
3273
- var allNodes = this._getAllNodes().sort(function (a, b) {
3274
- return b.level - a.level;
3275
- });
3276
- var cache = Object.create(null);
3277
- var keys = Object.keys(checkedKeys);
3278
- allNodes.forEach(function (node) {
3279
- return node.setChecked(false, false);
3280
- });
3281
- for (var i = 0, j = allNodes.length; i < j; i++) {
3282
- var node = allNodes[i];
3283
- var nodeKey = node.data[key].toString();
3284
- var checked = keys.indexOf(nodeKey) > -1;
3285
- if (!checked) {
3286
- if (node.checked && !cache[nodeKey]) {
3287
- node.setChecked(false, false);
3288
- }
3289
- continue;
3290
- }
3291
-
3292
- var parent = node.parent;
3293
- while (parent && parent.level > 0) {
3294
- cache[parent.data[key]] = true;
3295
- parent = parent.parent;
3296
- }
3297
-
3298
- if (node.isLeaf || this.checkStrictly) {
3299
- node.setChecked(true, false);
3300
- continue;
3301
- }
3302
- node.setChecked(true, true);
3303
-
3304
- if (leafOnly) {
3305
- (function () {
3306
- node.setChecked(false, false);
3307
- var traverse = function traverse(node) {
3308
- var childNodes = node.childNodes;
3309
- childNodes.forEach(function (child) {
3310
- if (!child.isLeaf) {
3311
- child.setChecked(false, false);
3312
- }
3313
- traverse(child);
3314
- });
3315
- };
3316
- traverse(node);
3317
- })();
3318
- }
3319
- }
3320
- };
3321
-
3322
- TreeStore.prototype.setCheckedNodes = function setCheckedNodes(array) {
3323
- var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3324
-
3325
- var key = this.key;
3326
- var checkedKeys = {};
3327
- array.forEach(function (item) {
3328
- checkedKeys[(item || {})[key]] = true;
3329
- });
3330
-
3331
- this._setCheckedKeys(key, leafOnly, checkedKeys);
3332
- };
3333
-
3334
- TreeStore.prototype.setCheckedKeys = function setCheckedKeys(keys) {
3335
- var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3336
-
3337
- this.defaultCheckedKeys = keys;
3338
- var key = this.key;
3339
- var checkedKeys = {};
3340
- keys.forEach(function (key) {
3341
- checkedKeys[key] = true;
3342
- });
3343
-
3344
- this._setCheckedKeys(key, leafOnly, checkedKeys);
3345
- };
3346
-
3347
- TreeStore.prototype.setDefaultExpandedKeys = function setDefaultExpandedKeys(keys) {
3348
- var _this6 = this;
3349
-
3350
- keys = keys || [];
3351
- this.defaultExpandedKeys = keys;
3352
-
3353
- keys.forEach(function (key) {
3354
- var node = _this6.getNode(key);
3355
- if (node) node.expand(null, _this6.autoExpandParent);
3356
- });
3357
- };
3358
-
3359
- TreeStore.prototype.setChecked = function setChecked(data, checked, deep) {
3360
- var node = this.getNode(data);
3361
-
3362
- if (node) {
3363
- node.setChecked(!!checked, deep);
3364
- }
3365
- };
3366
-
3367
- TreeStore.prototype.getCurrentNode = function getCurrentNode() {
3368
- return this.currentNode;
3369
- };
3370
-
3371
- TreeStore.prototype.setCurrentNode = function setCurrentNode(currentNode) {
3372
- var prevCurrentNode = this.currentNode;
3373
- if (prevCurrentNode) {
3374
- prevCurrentNode.isCurrent = false;
3375
- }
3376
- this.currentNode = currentNode;
3377
- this.currentNode.isCurrent = true;
3378
- };
3379
-
3380
- TreeStore.prototype.setUserCurrentNode = function setUserCurrentNode(node) {
3381
- var key = node[this.key];
3382
- var currNode = this.nodesMap[key];
3383
- this.setCurrentNode(currNode);
3384
- };
3385
-
3386
- TreeStore.prototype.setCurrentNodeKey = function setCurrentNodeKey(key) {
3387
- if (key === null || key === undefined) {
3388
- this.currentNode && (this.currentNode.isCurrent = false);
3389
- this.currentNode = null;
3390
- return;
3391
- }
3392
- var node = this.getNode(key);
3393
- if (node) {
3394
- this.setCurrentNode(node);
3395
- }
3396
- };
3397
-
3398
- return TreeStore;
3399
- }();
3400
-
3401
- /* harmony default export */ var tree_store = (tree_store_TreeStore);
3402
- ;
3403
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/tree/src/tree-node.vue?vue&type=template&id=769053c6
3404
- var tree_nodevue_type_template_id_769053c6_render = function () {
3405
- var this$1 = this
3406
- var _vm = this
3407
- var _h = _vm.$createElement
3408
- var _c = _vm._self._c || _h
3409
- return _c(
3410
- "div",
3411
- {
3412
- directives: [
3413
- {
3414
- name: "show",
3415
- rawName: "v-show",
3416
- value: _vm.node.visible,
3417
- expression: "node.visible",
3418
- },
3419
- ],
3420
- ref: "node",
3421
- staticClass: "el-tree-node",
3422
- class: {
3423
- "is-expanded": _vm.expanded,
3424
- "is-current": _vm.node.isCurrent,
3425
- "is-hidden": !_vm.node.visible,
3426
- "is-focusable": !_vm.node.disabled,
3427
- "is-checked": !_vm.node.disabled && _vm.node.checked,
3428
- },
3429
- attrs: {
3430
- role: "treeitem",
3431
- tabindex: "-1",
3432
- "aria-expanded": _vm.expanded,
3433
- "aria-disabled": _vm.node.disabled,
3434
- "aria-checked": _vm.node.checked,
3435
- draggable: _vm.tree.draggable,
3436
- },
3437
- on: {
3438
- click: function ($event) {
3439
- $event.stopPropagation()
3440
- return _vm.handleClick($event)
3441
- },
3442
- contextmenu: function ($event) {
3443
- return this$1.handleContextMenu($event)
3444
- },
3445
- dragstart: function ($event) {
3446
- $event.stopPropagation()
3447
- return _vm.handleDragStart($event)
3448
- },
3449
- dragover: function ($event) {
3450
- $event.stopPropagation()
3451
- return _vm.handleDragOver($event)
3452
- },
3453
- dragend: function ($event) {
3454
- $event.stopPropagation()
3455
- return _vm.handleDragEnd($event)
3456
- },
3457
- drop: function ($event) {
3458
- $event.stopPropagation()
3459
- return _vm.handleDrop($event)
3460
- },
3461
- },
3462
- },
3463
- [
3464
- _c(
3465
- "div",
3466
- {
3467
- staticClass: "el-tree-node__content",
3468
- style: {
3469
- "padding-left": (_vm.node.level - 1) * _vm.tree.indent + "px",
3470
- },
3471
- },
3472
- [
3473
- _c("span", {
3474
- class: [
3475
- {
3476
- "is-leaf": _vm.node.isLeaf,
3477
- expanded: !_vm.node.isLeaf && _vm.expanded,
3478
- },
3479
- "el-tree-node__expand-icon",
3480
- _vm.tree.iconClass ? _vm.tree.iconClass : "el-icon-caret-right",
3481
- ],
3482
- on: {
3483
- click: function ($event) {
3484
- $event.stopPropagation()
3485
- return _vm.handleExpandIconClick($event)
3486
- },
3487
- },
3488
- }),
3489
- _vm.showCheckbox
3490
- ? _c("el-checkbox", {
3491
- attrs: {
3492
- indeterminate: _vm.node.indeterminate,
3493
- disabled: !!_vm.node.disabled,
3494
- },
3495
- on: { change: _vm.handleCheckChange },
3496
- nativeOn: {
3497
- click: function ($event) {
3498
- $event.stopPropagation()
3499
- },
3500
- },
3501
- model: {
3502
- value: _vm.node.checked,
3503
- callback: function ($$v) {
3504
- _vm.$set(_vm.node, "checked", $$v)
3505
- },
3506
- expression: "node.checked",
3507
- },
3508
- })
3509
- : _vm._e(),
3510
- _vm.node.loading
3511
- ? _c("span", {
3512
- staticClass: "el-tree-node__loading-icon el-icon-loading",
3513
- })
3514
- : _vm._e(),
3515
- _c("node-content", { attrs: { node: _vm.node } }),
3516
- ],
3517
- 1
3518
- ),
3519
- _c("el-collapse-transition", [
3520
- !_vm.renderAfterExpand || _vm.childNodeRendered
3521
- ? _c(
3522
- "div",
3523
- {
3524
- directives: [
3525
- {
3526
- name: "show",
3527
- rawName: "v-show",
3528
- value: _vm.expanded,
3529
- expression: "expanded",
3530
- },
3531
- ],
3532
- staticClass: "el-tree-node__children",
3533
- attrs: { role: "group", "aria-expanded": _vm.expanded },
3534
- },
3535
- _vm._l(_vm.node.childNodes, function (child) {
3536
- return _c("el-tree-node", {
3537
- key: _vm.getNodeKey(child),
3538
- attrs: {
3539
- "render-content": _vm.renderContent,
3540
- "render-after-expand": _vm.renderAfterExpand,
3541
- "show-checkbox": _vm.showCheckbox,
3542
- node: child,
3543
- },
3544
- on: { "node-expand": _vm.handleChildNodeExpand },
3545
- })
3546
- }),
3547
- 1
3548
- )
3549
- : _vm._e(),
3550
- ]),
3551
- ],
3552
- 1
3553
- )
3554
- }
3555
- var tree_nodevue_type_template_id_769053c6_staticRenderFns = []
3556
- tree_nodevue_type_template_id_769053c6_render._withStripped = true
3557
-
3558
-
3559
- // CONCATENATED MODULE: ./packages/tree/src/tree-node.vue?vue&type=template&id=769053c6
3560
-
3561
- // EXTERNAL MODULE: external "element-ui/lib/transitions/collapse-transition"
3562
- var collapse_transition_ = __webpack_require__(27);
3563
- var collapse_transition_default = /*#__PURE__*/__webpack_require__.n(collapse_transition_);
3564
-
3565
- // EXTERNAL MODULE: ./packages/checkbox/index.js + 5 modules
3566
- var packages_checkbox = __webpack_require__(16);
3567
-
3568
- // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
3569
- var emitter_ = __webpack_require__(4);
3570
- var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
3571
-
3572
- // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/tree/src/tree-node.vue?vue&type=script&lang=js
3573
- //
3574
- //
3575
- //
3576
- //
3577
- //
3578
- //
3579
- //
3580
- //
3581
- //
3582
- //
3583
- //
3584
- //
3585
- //
3586
- //
3587
- //
3588
- //
3589
- //
3590
- //
3591
- //
3592
- //
3593
- //
3594
- //
3595
- //
3596
- //
3597
- //
3598
- //
3599
- //
3600
- //
3601
- //
3602
- //
3603
- //
3604
- //
3605
- //
3606
- //
3607
- //
3608
- //
3609
- //
3610
- //
3611
- //
3612
- //
3613
- //
3614
- //
3615
- //
3616
- //
3617
- //
3618
- //
3619
- //
3620
- //
3621
- //
3622
- //
3623
- //
3624
- //
3625
- //
3626
- //
3627
- //
3628
- //
3629
- //
3630
- //
3631
- //
3632
- //
3633
- //
3634
- //
3635
- //
3636
- //
3637
- //
3638
- //
3639
- //
3640
- //
3641
- //
3642
- //
3643
- //
3644
- //
3645
- //
3646
-
3647
-
3648
-
3649
-
3650
-
3651
-
3652
- /* harmony default export */ var tree_nodevue_type_script_lang_js = ({
3653
- name: 'ElTreeNode',
3654
-
3655
- componentName: 'ElTreeNode',
3656
-
3657
- mixins: [emitter_default.a],
3658
-
3659
- props: {
3660
- node: {
3661
- default: function _default() {
3662
- return {};
3663
- }
3664
- },
3665
- props: {},
3666
- renderContent: Function,
3667
- renderAfterExpand: {
3668
- type: Boolean,
3669
- default: true
3670
- },
3671
- showCheckbox: {
3672
- type: Boolean,
3673
- default: false
3674
- }
3675
- },
3676
-
3677
- components: {
3678
- ElCollapseTransition: collapse_transition_default.a,
3679
- ElCheckbox: packages_checkbox["default"],
3680
- NodeContent: {
3681
- props: {
3682
- node: {
3683
- required: true
3684
- }
3685
- },
3686
- render: function render(h) {
3687
- var parent = this.$parent;
3688
- var tree = parent.tree;
3689
- var node = this.node;
3690
- var data = node.data,
3691
- store = node.store;
3692
-
3693
- return parent.renderContent ? parent.renderContent.call(parent._renderProxy, h, { _self: tree.$vnode.context, node: node, data: data, store: store }) : tree.$scopedSlots.default ? tree.$scopedSlots.default({ node: node, data: data }) : h(
3694
- 'span',
3695
- { 'class': 'el-tree-node__label' },
3696
- [node.label]
3697
- );
3698
- }
3699
- }
3700
- },
3701
-
3702
- data: function data() {
3703
- return {
3704
- tree: null,
3705
- expanded: false,
3706
- childNodeRendered: false,
3707
- oldChecked: null,
3708
- oldIndeterminate: null
3709
- };
3710
- },
3711
-
3712
-
3713
- watch: {
3714
- 'node.indeterminate': function nodeIndeterminate(val) {
3715
- this.handleSelectChange(this.node.checked, val);
3716
- },
3717
- 'node.checked': function nodeChecked(val) {
3718
- this.handleSelectChange(val, this.node.indeterminate);
3719
- },
3720
- 'node.expanded': function nodeExpanded(val) {
3721
- var _this = this;
3722
-
3723
- this.$nextTick(function () {
3724
- return _this.expanded = val;
3725
- });
3726
- if (val) {
3727
- this.childNodeRendered = true;
3728
- }
3729
- }
3730
- },
3731
-
3732
- methods: {
3733
- getNodeKey: function getNodeKey(node) {
3734
- return util_getNodeKey(this.tree.nodeKey, node.data);
3735
- },
3736
- handleSelectChange: function handleSelectChange(checked, indeterminate) {
3737
- if (this.oldChecked !== checked && this.oldIndeterminate !== indeterminate) {
3738
- this.tree.$emit('check-change', this.node.data, checked, indeterminate);
3739
- }
3740
- this.oldChecked = checked;
3741
- this.indeterminate = indeterminate;
3742
- },
3743
- handleClick: function handleClick() {
3744
- var store = this.tree.store;
3745
- store.setCurrentNode(this.node);
3746
- this.tree.$emit('current-change', store.currentNode ? store.currentNode.data : null, store.currentNode);
3747
- this.tree.currentNode = this;
3748
- if (this.tree.expandOnClickNode) {
3749
- this.handleExpandIconClick();
3750
- }
3751
- if (this.tree.checkOnClickNode && !this.node.disabled) {
3752
- this.handleCheckChange(null, {
3753
- target: { checked: !this.node.checked }
3754
- });
3755
- }
3756
- this.tree.$emit('node-click', this.node.data, this.node, this);
3757
- },
3758
- handleContextMenu: function handleContextMenu(event) {
3759
- if (this.tree._events['node-contextmenu'] && this.tree._events['node-contextmenu'].length > 0) {
3760
- event.stopPropagation();
3761
- event.preventDefault();
3762
- }
3763
- this.tree.$emit('node-contextmenu', event, this.node.data, this.node, this);
3764
- },
3765
- handleExpandIconClick: function handleExpandIconClick() {
3766
- if (this.node.isLeaf) return;
3767
- if (this.expanded) {
3768
- this.tree.$emit('node-collapse', this.node.data, this.node, this);
3769
- this.node.collapse();
3770
- } else {
3771
- this.node.expand();
3772
- this.$emit('node-expand', this.node.data, this.node, this);
3773
- }
3774
- },
3775
- handleCheckChange: function handleCheckChange(value, ev) {
3776
- var _this2 = this;
3777
-
3778
- this.node.setChecked(ev.target.checked, !this.tree.checkStrictly);
3779
- this.$nextTick(function () {
3780
- var store = _this2.tree.store;
3781
- _this2.tree.$emit('check', _this2.node.data, {
3782
- checkedNodes: store.getCheckedNodes(),
3783
- checkedKeys: store.getCheckedKeys(),
3784
- halfCheckedNodes: store.getHalfCheckedNodes(),
3785
- halfCheckedKeys: store.getHalfCheckedKeys()
3786
- });
3787
- });
3788
- },
3789
- handleChildNodeExpand: function handleChildNodeExpand(nodeData, node, instance) {
3790
- this.broadcast('ElTreeNode', 'tree-node-expand', node);
3791
- this.tree.$emit('node-expand', nodeData, node, instance);
3792
- },
3793
- handleDragStart: function handleDragStart(event) {
3794
- if (!this.tree.draggable) return;
3795
- this.tree.$emit('tree-node-drag-start', event, this);
3796
- },
3797
- handleDragOver: function handleDragOver(event) {
3798
- if (!this.tree.draggable) return;
3799
- this.tree.$emit('tree-node-drag-over', event, this);
3800
- event.preventDefault();
3801
- },
3802
- handleDrop: function handleDrop(event) {
3803
- event.preventDefault();
3804
- },
3805
- handleDragEnd: function handleDragEnd(event) {
3806
- if (!this.tree.draggable) return;
3807
- this.tree.$emit('tree-node-drag-end', event, this);
3808
- }
3809
- },
3810
-
3811
- created: function created() {
3812
- var _this3 = this;
3813
-
3814
- var parent = this.$parent;
3815
-
3816
- if (parent.isTree) {
3817
- this.tree = parent;
3818
- } else {
3819
- this.tree = parent.tree;
3820
- }
3821
-
3822
- var tree = this.tree;
3823
- if (!tree) {
3824
- console.warn('Can not find node\'s tree.');
3825
- }
3826
-
3827
- var props = tree.props || {};
3828
- var childrenKey = props['children'] || 'children';
3829
-
3830
- this.$watch('node.data.' + childrenKey, function () {
3831
- _this3.node.updateChildren();
3832
- });
3833
-
3834
- if (this.node.expanded) {
3835
- this.expanded = true;
3836
- this.childNodeRendered = true;
3837
- }
3838
-
3839
- if (this.tree.accordion) {
3840
- this.$on('tree-node-expand', function (node) {
3841
- if (_this3.node !== node) {
3842
- _this3.node.collapse();
3843
- }
3844
- });
3845
- }
3846
- }
3847
- });
3848
- // CONCATENATED MODULE: ./packages/tree/src/tree-node.vue?vue&type=script&lang=js
3849
- /* harmony default export */ var src_tree_nodevue_type_script_lang_js = (tree_nodevue_type_script_lang_js);
3850
- // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
3851
- var componentNormalizer = __webpack_require__(0);
3852
-
3853
- // CONCATENATED MODULE: ./packages/tree/src/tree-node.vue
3854
-
3855
-
3856
-
3857
-
3858
-
3859
- /* normalize component */
3860
-
3861
- var component = Object(componentNormalizer["a" /* default */])(
3862
- src_tree_nodevue_type_script_lang_js,
3863
- tree_nodevue_type_template_id_769053c6_render,
3864
- tree_nodevue_type_template_id_769053c6_staticRenderFns,
3865
- false,
3866
- null,
3867
- null,
3868
- null
3869
-
3870
- )
3871
-
3872
- /* harmony default export */ var tree_node = (component.exports);
3873
- // EXTERNAL MODULE: external "element-ui/lib/locale"
3874
- var locale_ = __webpack_require__(22);
3875
-
3876
- // EXTERNAL MODULE: external "element-ui/lib/utils/dom"
3877
- var dom_ = __webpack_require__(1);
3878
-
3879
- // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/tree/src/tree.vue?vue&type=script&lang=js
3880
- //
3881
- //
3882
- //
3883
- //
3884
- //
3885
- //
3886
- //
3887
- //
3888
- //
3889
- //
3890
- //
3891
- //
3892
- //
3893
- //
3894
- //
3895
- //
3896
- //
3897
- //
3898
- //
3899
- //
3900
- //
3901
- //
3902
- //
3903
- //
3904
- //
3905
- //
3906
- //
3907
- //
3908
- //
3909
- //
3910
- //
3911
- //
3912
-
3913
-
3914
-
3915
-
3916
-
3917
-
3918
-
3919
-
3920
- /* harmony default export */ var treevue_type_script_lang_js = ({
3921
- name: 'ElTree',
3922
-
3923
- mixins: [emitter_default.a],
3924
-
3925
- components: {
3926
- ElTreeNode: tree_node
3927
- },
3928
-
3929
- data: function data() {
3930
- return {
3931
- store: null,
3932
- root: null,
3933
- currentNode: null,
3934
- treeItems: null,
3935
- checkboxItems: [],
3936
- dragState: {
3937
- showDropIndicator: false,
3938
- draggingNode: null,
3939
- dropNode: null,
3940
- allowDrop: true
3941
- }
3942
- };
3943
- },
3944
-
3945
-
3946
- props: {
3947
- data: {
3948
- type: Array
3949
- },
3950
- emptyText: {
3951
- type: String,
3952
- default: function _default() {
3953
- return Object(locale_["t"])('el.tree.emptyText');
3954
- }
3955
- },
3956
- renderAfterExpand: {
3957
- type: Boolean,
3958
- default: true
3959
- },
3960
- nodeKey: String,
3961
- checkStrictly: Boolean,
3962
- defaultExpandAll: Boolean,
3963
- expandOnClickNode: {
3964
- type: Boolean,
3965
- default: true
3966
- },
3967
- checkOnClickNode: Boolean,
3968
- checkDescendants: {
3969
- type: Boolean,
3970
- default: false
3971
- },
3972
- autoExpandParent: {
3973
- type: Boolean,
3974
- default: true
3975
- },
3976
- defaultCheckedKeys: Array,
3977
- defaultExpandedKeys: Array,
3978
- currentNodeKey: [String, Number],
3979
- renderContent: Function,
3980
- showCheckbox: {
3981
- type: Boolean,
3982
- default: false
3983
- },
3984
- draggable: {
3985
- type: Boolean,
3986
- default: false
3987
- },
3988
- allowDrag: Function,
3989
- allowDrop: Function,
3990
- props: {
3991
- default: function _default() {
3992
- return {
3993
- children: 'children',
3994
- label: 'label',
3995
- disabled: 'disabled'
3996
- };
3997
- }
3998
- },
3999
- lazy: {
4000
- type: Boolean,
4001
- default: false
4002
- },
4003
- highlightCurrent: Boolean,
4004
- load: Function,
4005
- filterNodeMethod: Function,
4006
- accordion: Boolean,
4007
- indent: {
4008
- type: Number,
4009
- default: 18
4010
- },
4011
- iconClass: String
4012
- },
4013
-
4014
- computed: {
4015
- children: {
4016
- set: function set(value) {
4017
- this.data = value;
4018
- },
4019
- get: function get() {
4020
- return this.data;
4021
- }
4022
- },
4023
-
4024
- treeItemArray: function treeItemArray() {
4025
- return Array.prototype.slice.call(this.treeItems);
4026
- },
4027
- isEmpty: function isEmpty() {
4028
- var childNodes = this.root.childNodes;
4029
-
4030
- return !childNodes || childNodes.length === 0 || childNodes.every(function (_ref) {
4031
- var visible = _ref.visible;
4032
- return !visible;
4033
- });
4034
- }
4035
- },
4036
-
4037
- watch: {
4038
- defaultCheckedKeys: function defaultCheckedKeys(newVal) {
4039
- this.store.setDefaultCheckedKey(newVal);
4040
- },
4041
- defaultExpandedKeys: function defaultExpandedKeys(newVal) {
4042
- this.store.defaultExpandedKeys = newVal;
4043
- this.store.setDefaultExpandedKeys(newVal);
4044
- },
4045
- data: function data(newVal) {
4046
- this.store.setData(newVal);
4047
- },
4048
- checkboxItems: function checkboxItems(val) {
4049
- Array.prototype.forEach.call(val, function (checkbox) {
4050
- checkbox.setAttribute('tabindex', -1);
4051
- });
4052
- },
4053
- checkStrictly: function checkStrictly(newVal) {
4054
- this.store.checkStrictly = newVal;
4055
- }
4056
- },
4057
-
4058
- methods: {
4059
- filter: function filter(value) {
4060
- if (!this.filterNodeMethod) throw new Error('[Tree] filterNodeMethod is required when filter');
4061
- this.store.filter(value);
4062
- },
4063
- getNodeKey: function getNodeKey(node) {
4064
- return util_getNodeKey(this.nodeKey, node.data);
4065
- },
4066
- getNodePath: function getNodePath(data) {
4067
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getNodePath');
4068
- var node = this.store.getNode(data);
4069
- if (!node) return [];
4070
- var path = [node.data];
4071
- var parent = node.parent;
4072
- while (parent && parent !== this.root) {
4073
- path.push(parent.data);
4074
- parent = parent.parent;
4075
- }
4076
- return path.reverse();
4077
- },
4078
- getCheckedNodes: function getCheckedNodes(leafOnly, includeHalfChecked) {
4079
- return this.store.getCheckedNodes(leafOnly, includeHalfChecked);
4080
- },
4081
- getCheckedKeys: function getCheckedKeys(leafOnly) {
4082
- return this.store.getCheckedKeys(leafOnly);
4083
- },
4084
- getCurrentNode: function getCurrentNode() {
4085
- var currentNode = this.store.getCurrentNode();
4086
- return currentNode ? currentNode.data : null;
4087
- },
4088
- getCurrentKey: function getCurrentKey() {
4089
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getCurrentKey');
4090
- var currentNode = this.getCurrentNode();
4091
- return currentNode ? currentNode[this.nodeKey] : null;
4092
- },
4093
- setCheckedNodes: function setCheckedNodes(nodes, leafOnly) {
4094
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedNodes');
4095
- this.store.setCheckedNodes(nodes, leafOnly);
4096
- },
4097
- setCheckedKeys: function setCheckedKeys(keys, leafOnly) {
4098
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedKeys');
4099
- this.store.setCheckedKeys(keys, leafOnly);
4100
- },
4101
- setChecked: function setChecked(data, checked, deep) {
4102
- this.store.setChecked(data, checked, deep);
4103
- },
4104
- getHalfCheckedNodes: function getHalfCheckedNodes() {
4105
- return this.store.getHalfCheckedNodes();
4106
- },
4107
- getHalfCheckedKeys: function getHalfCheckedKeys() {
4108
- return this.store.getHalfCheckedKeys();
4109
- },
4110
- setCurrentNode: function setCurrentNode(node) {
4111
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentNode');
4112
- this.store.setUserCurrentNode(node);
4113
- },
4114
- setCurrentKey: function setCurrentKey(key) {
4115
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentKey');
4116
- this.store.setCurrentNodeKey(key);
4117
- },
4118
- getNode: function getNode(data) {
4119
- return this.store.getNode(data);
4120
- },
4121
- remove: function remove(data) {
4122
- this.store.remove(data);
4123
- },
4124
- append: function append(data, parentNode) {
4125
- this.store.append(data, parentNode);
4126
- },
4127
- insertBefore: function insertBefore(data, refNode) {
4128
- this.store.insertBefore(data, refNode);
4129
- },
4130
- insertAfter: function insertAfter(data, refNode) {
4131
- this.store.insertAfter(data, refNode);
4132
- },
4133
- handleNodeExpand: function handleNodeExpand(nodeData, node, instance) {
4134
- this.broadcast('ElTreeNode', 'tree-node-expand', node);
4135
- this.$emit('node-expand', nodeData, node, instance);
4136
- },
4137
- updateKeyChildren: function updateKeyChildren(key, data) {
4138
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in updateKeyChild');
4139
- this.store.updateChildren(key, data);
4140
- },
4141
- initTabIndex: function initTabIndex() {
4142
- this.treeItems = this.$el.querySelectorAll('.is-focusable[role=treeitem]');
4143
- this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
4144
- var checkedItem = this.$el.querySelectorAll('.is-checked[role=treeitem]');
4145
- if (checkedItem.length) {
4146
- checkedItem[0].setAttribute('tabindex', 0);
4147
- return;
4148
- }
4149
- this.treeItems[0] && this.treeItems[0].setAttribute('tabindex', 0);
4150
- },
4151
- handleKeydown: function handleKeydown(ev) {
4152
- var currentItem = ev.target;
4153
- if (currentItem.className.indexOf('el-tree-node') === -1) return;
4154
- var keyCode = ev.keyCode;
4155
- this.treeItems = this.$el.querySelectorAll('.is-focusable[role=treeitem]');
4156
- var currentIndex = this.treeItemArray.indexOf(currentItem);
4157
- var nextIndex = void 0;
4158
- if ([38, 40].indexOf(keyCode) > -1) {
4159
- // up、down
4160
- ev.preventDefault();
4161
- if (keyCode === 38) {
4162
- // up
4163
- nextIndex = currentIndex !== 0 ? currentIndex - 1 : 0;
4164
- } else {
4165
- nextIndex = currentIndex < this.treeItemArray.length - 1 ? currentIndex + 1 : 0;
4166
- }
4167
- this.treeItemArray[nextIndex].focus(); // 选中
4168
- }
4169
- if ([37, 39].indexOf(keyCode) > -1) {
4170
- // left、right 展开
4171
- ev.preventDefault();
4172
- currentItem.click(); // 选中
4173
- }
4174
- var hasInput = currentItem.querySelector('[type="checkbox"]');
4175
- if ([13, 32].indexOf(keyCode) > -1 && hasInput) {
4176
- // space enter选中checkbox
4177
- ev.preventDefault();
4178
- hasInput.click();
4179
- }
4180
- }
4181
- },
4182
-
4183
- created: function created() {
4184
- var _this = this;
4185
-
4186
- this.isTree = true;
4187
-
4188
- this.store = new tree_store({
4189
- key: this.nodeKey,
4190
- data: this.data,
4191
- lazy: this.lazy,
4192
- props: this.props,
4193
- load: this.load,
4194
- currentNodeKey: this.currentNodeKey,
4195
- checkStrictly: this.checkStrictly,
4196
- checkDescendants: this.checkDescendants,
4197
- defaultCheckedKeys: this.defaultCheckedKeys,
4198
- defaultExpandedKeys: this.defaultExpandedKeys,
4199
- autoExpandParent: this.autoExpandParent,
4200
- defaultExpandAll: this.defaultExpandAll,
4201
- filterNodeMethod: this.filterNodeMethod
4202
- });
4203
-
4204
- this.root = this.store.root;
4205
-
4206
- var dragState = this.dragState;
4207
- this.$on('tree-node-drag-start', function (event, treeNode) {
4208
- if (typeof _this.allowDrag === 'function' && !_this.allowDrag(treeNode.node)) {
4209
- event.preventDefault();
4210
- return false;
4211
- }
4212
- event.dataTransfer.effectAllowed = 'move';
4213
-
4214
- // wrap in try catch to address IE's error when first param is 'text/plain'
4215
- try {
4216
- // setData is required for draggable to work in FireFox
4217
- // the content has to be '' so dragging a node out of the tree won't open a new tab in FireFox
4218
- event.dataTransfer.setData('text/plain', '');
4219
- } catch (e) {}
4220
- dragState.draggingNode = treeNode;
4221
- _this.$emit('node-drag-start', treeNode.node, event);
4222
- });
4223
-
4224
- this.$on('tree-node-drag-over', function (event, treeNode) {
4225
- var dropNode = findNearestComponent(event.target, 'ElTreeNode');
4226
- var oldDropNode = dragState.dropNode;
4227
- if (oldDropNode && oldDropNode !== dropNode) {
4228
- Object(dom_["removeClass"])(oldDropNode.$el, 'is-drop-inner');
4229
- }
4230
- var draggingNode = dragState.draggingNode;
4231
- if (!draggingNode || !dropNode) return;
4232
-
4233
- var dropPrev = true;
4234
- var dropInner = true;
4235
- var dropNext = true;
4236
- var userAllowDropInner = true;
4237
- if (typeof _this.allowDrop === 'function') {
4238
- dropPrev = _this.allowDrop(draggingNode.node, dropNode.node, 'prev');
4239
- userAllowDropInner = dropInner = _this.allowDrop(draggingNode.node, dropNode.node, 'inner');
4240
- dropNext = _this.allowDrop(draggingNode.node, dropNode.node, 'next');
4241
- }
4242
- event.dataTransfer.dropEffect = dropInner ? 'move' : 'none';
4243
- if ((dropPrev || dropInner || dropNext) && oldDropNode !== dropNode) {
4244
- if (oldDropNode) {
4245
- _this.$emit('node-drag-leave', draggingNode.node, oldDropNode.node, event);
4246
- }
4247
- _this.$emit('node-drag-enter', draggingNode.node, dropNode.node, event);
4248
- }
4249
-
4250
- if (dropPrev || dropInner || dropNext) {
4251
- dragState.dropNode = dropNode;
4252
- }
4253
-
4254
- if (dropNode.node.nextSibling === draggingNode.node) {
4255
- dropNext = false;
4256
- }
4257
- if (dropNode.node.previousSibling === draggingNode.node) {
4258
- dropPrev = false;
4259
- }
4260
- if (dropNode.node.contains(draggingNode.node, false)) {
4261
- dropInner = false;
4262
- }
4263
- if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
4264
- dropPrev = false;
4265
- dropInner = false;
4266
- dropNext = false;
4267
- }
4268
-
4269
- var targetPosition = dropNode.$el.getBoundingClientRect();
4270
- var treePosition = _this.$el.getBoundingClientRect();
4271
-
4272
- var dropType = void 0;
4273
- var prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
4274
- var nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
4275
-
4276
- var indicatorTop = -9999;
4277
- var distance = event.clientY - targetPosition.top;
4278
- if (distance < targetPosition.height * prevPercent) {
4279
- dropType = 'before';
4280
- } else if (distance > targetPosition.height * nextPercent) {
4281
- dropType = 'after';
4282
- } else if (dropInner) {
4283
- dropType = 'inner';
4284
- } else {
4285
- dropType = 'none';
4286
- }
4287
-
4288
- var iconPosition = dropNode.$el.querySelector('.el-tree-node__expand-icon').getBoundingClientRect();
4289
- var dropIndicator = _this.$refs.dropIndicator;
4290
- if (dropType === 'before') {
4291
- indicatorTop = iconPosition.top - treePosition.top;
4292
- } else if (dropType === 'after') {
4293
- indicatorTop = iconPosition.bottom - treePosition.top;
4294
- }
4295
- dropIndicator.style.top = indicatorTop + 'px';
4296
- dropIndicator.style.left = iconPosition.right - treePosition.left + 'px';
4297
-
4298
- if (dropType === 'inner') {
4299
- Object(dom_["addClass"])(dropNode.$el, 'is-drop-inner');
4300
- } else {
4301
- Object(dom_["removeClass"])(dropNode.$el, 'is-drop-inner');
4302
- }
4303
-
4304
- dragState.showDropIndicator = dropType === 'before' || dropType === 'after';
4305
- dragState.allowDrop = dragState.showDropIndicator || userAllowDropInner;
4306
- dragState.dropType = dropType;
4307
- _this.$emit('node-drag-over', draggingNode.node, dropNode.node, event);
4308
- });
4309
-
4310
- this.$on('tree-node-drag-end', function (event) {
4311
- var draggingNode = dragState.draggingNode,
4312
- dropType = dragState.dropType,
4313
- dropNode = dragState.dropNode;
4314
-
4315
- event.preventDefault();
4316
- event.dataTransfer.dropEffect = 'move';
4317
-
4318
- if (draggingNode && dropNode) {
4319
- var draggingNodeCopy = { data: draggingNode.node.data };
4320
- if (dropType !== 'none') {
4321
- draggingNode.node.remove();
4322
- }
4323
- if (dropType === 'before') {
4324
- dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
4325
- } else if (dropType === 'after') {
4326
- dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
4327
- } else if (dropType === 'inner') {
4328
- dropNode.node.insertChild(draggingNodeCopy);
4329
- }
4330
- if (dropType !== 'none') {
4331
- _this.store.registerNode(draggingNodeCopy);
4332
- }
4333
-
4334
- Object(dom_["removeClass"])(dropNode.$el, 'is-drop-inner');
4335
-
4336
- _this.$emit('node-drag-end', draggingNode.node, dropNode.node, dropType, event);
4337
- if (dropType !== 'none') {
4338
- _this.$emit('node-drop', draggingNode.node, dropNode.node, dropType, event);
4339
- }
4340
- }
4341
- if (draggingNode && !dropNode) {
4342
- _this.$emit('node-drag-end', draggingNode.node, null, dropType, event);
4343
- }
4344
-
4345
- dragState.showDropIndicator = false;
4346
- dragState.draggingNode = null;
4347
- dragState.dropNode = null;
4348
- dragState.allowDrop = true;
4349
- });
4350
- },
4351
- mounted: function mounted() {
4352
- this.initTabIndex();
4353
- this.$el.addEventListener('keydown', this.handleKeydown);
4354
- },
4355
- updated: function updated() {
4356
- this.treeItems = this.$el.querySelectorAll('[role=treeitem]');
4357
- this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
4358
- }
4359
- });
4360
- // CONCATENATED MODULE: ./packages/tree/src/tree.vue?vue&type=script&lang=js
4361
- /* harmony default export */ var src_treevue_type_script_lang_js = (treevue_type_script_lang_js);
4362
- // CONCATENATED MODULE: ./packages/tree/src/tree.vue
4363
-
4364
-
4365
-
4366
-
4367
-
4368
- /* normalize component */
4369
-
4370
- var tree_component = Object(componentNormalizer["a" /* default */])(
4371
- src_treevue_type_script_lang_js,
4372
- render,
4373
- staticRenderFns,
4374
- false,
4375
- null,
4376
- null,
4377
- null
4378
-
4379
- )
4380
-
4381
- /* harmony default export */ var tree = (tree_component.exports);
4382
- // CONCATENATED MODULE: ./packages/tree/index.js
4383
-
4384
-
4385
- /* istanbul ignore next */
4386
- tree.install = function (Vue) {
4387
- Vue.component(tree.name, tree);
4388
- };
4389
-
4390
- /* harmony default export */ var packages_tree = __webpack_exports__["default"] = (tree);
4391
-
4392
- /***/ }),
4393
-
4394
- /***/ 5:
4395
- /***/ (function(module, exports) {
4396
-
4397
- module.exports = require("element-ui/lib/utils/vue-popper");
4398
-
4399
- /***/ }),
4400
-
4401
- /***/ 6:
4402
- /***/ (function(module, exports) {
4403
-
4404
- module.exports = require("element-ui/lib/utils/merge");
4405
-
4406
- /***/ }),
4407
-
4408
- /***/ 7:
4409
- /***/ (function(module, exports) {
4410
-
4411
- module.exports = require("element-ui/lib/mixins/migrating");
4412
-
4413
- /***/ }),
4414
-
4415
- /***/ 8:
4416
- /***/ (function(module, exports) {
4417
-
4418
- module.exports = require("vue");
4419
-
4420
- /***/ })
4421
-
4422
- /******/ });