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
package/lib/Tree.js DELETED
@@ -1,2680 +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 = 46);
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
- /***/ 16:
203
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
204
-
205
- "use strict";
206
- // ESM COMPAT FLAG
207
- __webpack_require__.r(__webpack_exports__);
208
-
209
- // 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
210
- var render = function () {
211
- var _vm = this
212
- var _h = _vm.$createElement
213
- var _c = _vm._self._c || _h
214
- return _c(
215
- "label",
216
- {
217
- staticClass: "el-checkbox",
218
- class: [
219
- _vm.border && _vm.checkboxSize
220
- ? "el-checkbox--" + _vm.checkboxSize
221
- : "",
222
- { "is-disabled": _vm.isDisabled },
223
- { "is-bordered": _vm.border },
224
- { "is-checked": _vm.isChecked },
225
- ],
226
- attrs: { id: _vm.id },
227
- },
228
- [
229
- _c(
230
- "span",
231
- {
232
- staticClass: "el-checkbox__input",
233
- class: {
234
- "is-disabled": _vm.isDisabled,
235
- "is-checked": _vm.isChecked,
236
- "is-indeterminate": _vm.indeterminate,
237
- "is-focus": _vm.focus,
238
- },
239
- attrs: {
240
- tabindex: _vm.indeterminate ? 0 : false,
241
- role: _vm.indeterminate ? "checkbox" : false,
242
- "aria-checked": _vm.indeterminate ? "mixed" : false,
243
- },
244
- },
245
- [
246
- _c("span", { staticClass: "el-checkbox__inner" }),
247
- _vm.trueLabel || _vm.falseLabel
248
- ? _c("input", {
249
- directives: [
250
- {
251
- name: "model",
252
- rawName: "v-model",
253
- value: _vm.model,
254
- expression: "model",
255
- },
256
- ],
257
- staticClass: "el-checkbox__original",
258
- attrs: {
259
- type: "checkbox",
260
- "aria-hidden": _vm.indeterminate ? "true" : "false",
261
- name: _vm.name,
262
- disabled: _vm.isDisabled,
263
- "true-value": _vm.trueLabel,
264
- "false-value": _vm.falseLabel,
265
- },
266
- domProps: {
267
- checked: Array.isArray(_vm.model)
268
- ? _vm._i(_vm.model, null) > -1
269
- : _vm._q(_vm.model, _vm.trueLabel),
270
- },
271
- on: {
272
- change: [
273
- function ($event) {
274
- var $$a = _vm.model,
275
- $$el = $event.target,
276
- $$c = $$el.checked ? _vm.trueLabel : _vm.falseLabel
277
- if (Array.isArray($$a)) {
278
- var $$v = null,
279
- $$i = _vm._i($$a, $$v)
280
- if ($$el.checked) {
281
- $$i < 0 && (_vm.model = $$a.concat([$$v]))
282
- } else {
283
- $$i > -1 &&
284
- (_vm.model = $$a
285
- .slice(0, $$i)
286
- .concat($$a.slice($$i + 1)))
287
- }
288
- } else {
289
- _vm.model = $$c
290
- }
291
- },
292
- _vm.handleChange,
293
- ],
294
- focus: function ($event) {
295
- _vm.focus = true
296
- },
297
- blur: function ($event) {
298
- _vm.focus = false
299
- },
300
- },
301
- })
302
- : _c("input", {
303
- directives: [
304
- {
305
- name: "model",
306
- rawName: "v-model",
307
- value: _vm.model,
308
- expression: "model",
309
- },
310
- ],
311
- staticClass: "el-checkbox__original",
312
- attrs: {
313
- type: "checkbox",
314
- "aria-hidden": _vm.indeterminate ? "true" : "false",
315
- disabled: _vm.isDisabled,
316
- name: _vm.name,
317
- },
318
- domProps: {
319
- value: _vm.label,
320
- checked: Array.isArray(_vm.model)
321
- ? _vm._i(_vm.model, _vm.label) > -1
322
- : _vm.model,
323
- },
324
- on: {
325
- change: [
326
- function ($event) {
327
- var $$a = _vm.model,
328
- $$el = $event.target,
329
- $$c = $$el.checked ? true : false
330
- if (Array.isArray($$a)) {
331
- var $$v = _vm.label,
332
- $$i = _vm._i($$a, $$v)
333
- if ($$el.checked) {
334
- $$i < 0 && (_vm.model = $$a.concat([$$v]))
335
- } else {
336
- $$i > -1 &&
337
- (_vm.model = $$a
338
- .slice(0, $$i)
339
- .concat($$a.slice($$i + 1)))
340
- }
341
- } else {
342
- _vm.model = $$c
343
- }
344
- },
345
- _vm.handleChange,
346
- ],
347
- focus: function ($event) {
348
- _vm.focus = true
349
- },
350
- blur: function ($event) {
351
- _vm.focus = false
352
- },
353
- },
354
- }),
355
- ]
356
- ),
357
- _vm.$slots.default || _vm.label
358
- ? _c(
359
- "span",
360
- { staticClass: "el-checkbox__label" },
361
- [
362
- _vm._t("default"),
363
- !_vm.$slots.default ? [_vm._v(_vm._s(_vm.label))] : _vm._e(),
364
- ],
365
- 2
366
- )
367
- : _vm._e(),
368
- ]
369
- )
370
- }
371
- var staticRenderFns = []
372
- render._withStripped = true
373
-
374
-
375
- // CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=template&id=5f30258f
376
-
377
- // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
378
- var emitter_ = __webpack_require__(4);
379
- var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
380
-
381
- // 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
382
- //
383
- //
384
- //
385
- //
386
- //
387
- //
388
- //
389
- //
390
- //
391
- //
392
- //
393
- //
394
- //
395
- //
396
- //
397
- //
398
- //
399
- //
400
- //
401
- //
402
- //
403
- //
404
- //
405
- //
406
- //
407
- //
408
- //
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
- /* harmony default export */ var checkboxvue_type_script_lang_js = ({
441
- name: 'ElCheckbox',
442
-
443
- mixins: [emitter_default.a],
444
-
445
- inject: {
446
- elForm: {
447
- default: ''
448
- },
449
- elFormItem: {
450
- default: ''
451
- }
452
- },
453
-
454
- componentName: 'ElCheckbox',
455
-
456
- data: function data() {
457
- return {
458
- selfModel: false,
459
- focus: false,
460
- isLimitExceeded: false
461
- };
462
- },
463
-
464
-
465
- computed: {
466
- model: {
467
- get: function get() {
468
- return this.isGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
469
- },
470
- set: function set(val) {
471
- if (this.isGroup) {
472
- this.isLimitExceeded = false;
473
- this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (this.isLimitExceeded = true);
474
-
475
- this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (this.isLimitExceeded = true);
476
-
477
- this.isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
478
- } else {
479
- this.$emit('input', val);
480
- this.selfModel = val;
481
- }
482
- }
483
- },
484
-
485
- isChecked: function isChecked() {
486
- if ({}.toString.call(this.model) === '[object Boolean]') {
487
- return this.model;
488
- } else if (Array.isArray(this.model)) {
489
- return this.model.indexOf(this.label) > -1;
490
- } else if (this.model !== null && this.model !== undefined) {
491
- return this.model === this.trueLabel;
492
- }
493
- },
494
- isGroup: function isGroup() {
495
- var parent = this.$parent;
496
- while (parent) {
497
- if (parent.$options.componentName !== 'ElCheckboxGroup') {
498
- parent = parent.$parent;
499
- } else {
500
- this._checkboxGroup = parent;
501
- return true;
502
- }
503
- }
504
- return false;
505
- },
506
- store: function store() {
507
- return this._checkboxGroup ? this._checkboxGroup.value : this.value;
508
- },
509
-
510
-
511
- /* used to make the isDisabled judgment under max/min props */
512
- isLimitDisabled: function isLimitDisabled() {
513
- var _checkboxGroup = this._checkboxGroup,
514
- max = _checkboxGroup.max,
515
- min = _checkboxGroup.min;
516
-
517
- return !!(max || min) && this.model.length >= max && !this.isChecked || this.model.length <= min && this.isChecked;
518
- },
519
- isDisabled: function isDisabled() {
520
- return this.isGroup ? this._checkboxGroup.disabled || this.disabled || (this.elForm || {}).disabled || this.isLimitDisabled : this.disabled || (this.elForm || {}).disabled;
521
- },
522
- _elFormItemSize: function _elFormItemSize() {
523
- return (this.elFormItem || {}).elFormItemSize;
524
- },
525
- checkboxSize: function checkboxSize() {
526
- var temCheckboxSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
527
- return this.isGroup ? this._checkboxGroup.checkboxGroupSize || temCheckboxSize : temCheckboxSize;
528
- }
529
- },
530
-
531
- props: {
532
- value: {},
533
- label: {},
534
- indeterminate: Boolean,
535
- disabled: Boolean,
536
- checked: Boolean,
537
- name: String,
538
- trueLabel: [String, Number],
539
- falseLabel: [String, Number],
540
- id: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
541
- controls: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
542
- border: Boolean,
543
- size: String
544
- },
545
-
546
- methods: {
547
- addToStore: function addToStore() {
548
- if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
549
- this.model.push(this.label);
550
- } else {
551
- this.model = this.trueLabel || true;
552
- }
553
- },
554
- handleChange: function handleChange(ev) {
555
- var _this = this;
556
-
557
- if (this.isLimitExceeded) return;
558
- var value = void 0;
559
- if (ev.target.checked) {
560
- value = this.trueLabel === undefined ? true : this.trueLabel;
561
- } else {
562
- value = this.falseLabel === undefined ? false : this.falseLabel;
563
- }
564
- this.$emit('change', value, ev);
565
- this.$nextTick(function () {
566
- if (_this.isGroup) {
567
- _this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
568
- }
569
- });
570
- }
571
- },
572
-
573
- created: function created() {
574
- this.checked && this.addToStore();
575
- },
576
- mounted: function mounted() {
577
- // 为indeterminate元素 添加aria-controls 属性
578
- if (this.indeterminate) {
579
- this.$el.setAttribute('aria-controls', this.controls);
580
- }
581
- },
582
-
583
-
584
- watch: {
585
- value: function value(_value) {
586
- this.dispatch('ElFormItem', 'el.form.change', _value);
587
- }
588
- }
589
- });
590
- // CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=script&lang=js
591
- /* harmony default export */ var src_checkboxvue_type_script_lang_js = (checkboxvue_type_script_lang_js);
592
- // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
593
- var componentNormalizer = __webpack_require__(0);
594
-
595
- // CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue
596
-
597
-
598
-
599
-
600
-
601
- /* normalize component */
602
-
603
- var component = Object(componentNormalizer["a" /* default */])(
604
- src_checkboxvue_type_script_lang_js,
605
- render,
606
- staticRenderFns,
607
- false,
608
- null,
609
- null,
610
- null
611
-
612
- )
613
-
614
- /* harmony default export */ var src_checkbox = (component.exports);
615
- // CONCATENATED MODULE: ./packages/checkbox/index.js
616
-
617
-
618
- /* istanbul ignore next */
619
- src_checkbox.install = function (Vue) {
620
- Vue.component(src_checkbox.name, src_checkbox);
621
- };
622
-
623
- /* harmony default export */ var packages_checkbox = __webpack_exports__["default"] = (src_checkbox);
624
-
625
- /***/ }),
626
-
627
- /***/ 22:
628
- /***/ (function(module, exports) {
629
-
630
- module.exports = require("element-ui/lib/locale");
631
-
632
- /***/ }),
633
-
634
- /***/ 27:
635
- /***/ (function(module, exports) {
636
-
637
- module.exports = require("element-ui/lib/transitions/collapse-transition");
638
-
639
- /***/ }),
640
-
641
- /***/ 3:
642
- /***/ (function(module, exports) {
643
-
644
- module.exports = require("element-ui/lib/utils/util");
645
-
646
- /***/ }),
647
-
648
- /***/ 4:
649
- /***/ (function(module, exports) {
650
-
651
- module.exports = require("element-ui/lib/mixins/emitter");
652
-
653
- /***/ }),
654
-
655
- /***/ 46:
656
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
657
-
658
- "use strict";
659
- // ESM COMPAT FLAG
660
- __webpack_require__.r(__webpack_exports__);
661
-
662
- // 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
663
- var render = function () {
664
- var _vm = this
665
- var _h = _vm.$createElement
666
- var _c = _vm._self._c || _h
667
- return _c(
668
- "div",
669
- {
670
- staticClass: "el-tree",
671
- class: {
672
- "el-tree--highlight-current": _vm.highlightCurrent,
673
- "is-dragging": !!_vm.dragState.draggingNode,
674
- "is-drop-not-allow": !_vm.dragState.allowDrop,
675
- "is-drop-inner": _vm.dragState.dropType === "inner",
676
- },
677
- attrs: { role: "tree" },
678
- },
679
- [
680
- _vm._l(_vm.root.childNodes, function (child) {
681
- return _c("el-tree-node", {
682
- key: _vm.getNodeKey(child),
683
- attrs: {
684
- node: child,
685
- props: _vm.props,
686
- "render-after-expand": _vm.renderAfterExpand,
687
- "show-checkbox": _vm.showCheckbox,
688
- "render-content": _vm.renderContent,
689
- },
690
- on: { "node-expand": _vm.handleNodeExpand },
691
- })
692
- }),
693
- _vm.isEmpty
694
- ? _c("div", { staticClass: "el-tree__empty-block" }, [
695
- _c("span", { staticClass: "el-tree__empty-text" }, [
696
- _vm._v(_vm._s(_vm.emptyText)),
697
- ]),
698
- ])
699
- : _vm._e(),
700
- _c("div", {
701
- directives: [
702
- {
703
- name: "show",
704
- rawName: "v-show",
705
- value: _vm.dragState.showDropIndicator,
706
- expression: "dragState.showDropIndicator",
707
- },
708
- ],
709
- ref: "dropIndicator",
710
- staticClass: "el-tree__drop-indicator",
711
- }),
712
- ],
713
- 2
714
- )
715
- }
716
- var staticRenderFns = []
717
- render._withStripped = true
718
-
719
-
720
- // CONCATENATED MODULE: ./packages/tree/src/tree.vue?vue&type=template&id=37500abf
721
-
722
- // EXTERNAL MODULE: external "element-ui/lib/utils/merge"
723
- var merge_ = __webpack_require__(6);
724
- var merge_default = /*#__PURE__*/__webpack_require__.n(merge_);
725
-
726
- // CONCATENATED MODULE: ./packages/tree/src/model/util.js
727
- var NODE_KEY = '$treeNodeId';
728
-
729
- var markNodeData = function markNodeData(node, data) {
730
- if (!data || data[NODE_KEY]) return;
731
- Object.defineProperty(data, NODE_KEY, {
732
- value: node.id,
733
- enumerable: false,
734
- configurable: false,
735
- writable: false
736
- });
737
- };
738
-
739
- var util_getNodeKey = function getNodeKey(key, data) {
740
- if (!key) return data[NODE_KEY];
741
- return data[key];
742
- };
743
-
744
- var findNearestComponent = function findNearestComponent(element, componentName) {
745
- var target = element;
746
- while (target && target.tagName !== 'BODY') {
747
- if (target.__vue__ && target.__vue__.$options.name === componentName) {
748
- return target.__vue__;
749
- }
750
- target = target.parentNode;
751
- }
752
- return null;
753
- };
754
- // EXTERNAL MODULE: external "element-ui/lib/utils/util"
755
- var util_ = __webpack_require__(3);
756
-
757
- // CONCATENATED MODULE: ./packages/tree/src/model/node.js
758
- 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; }; }();
759
-
760
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
761
-
762
-
763
-
764
-
765
-
766
- var getChildState = function getChildState(node) {
767
- var all = true;
768
- var none = true;
769
- var allWithoutDisable = true;
770
- for (var i = 0, j = node.length; i < j; i++) {
771
- var n = node[i];
772
- if (n.checked !== true || n.indeterminate) {
773
- all = false;
774
- if (!n.disabled) {
775
- allWithoutDisable = false;
776
- }
777
- }
778
- if (n.checked !== false || n.indeterminate) {
779
- none = false;
780
- }
781
- }
782
-
783
- return { all: all, none: none, allWithoutDisable: allWithoutDisable, half: !all && !none };
784
- };
785
-
786
- var reInitChecked = function reInitChecked(node) {
787
- if (node.childNodes.length === 0 || node.loading) return;
788
-
789
- var _getChildState = getChildState(node.childNodes),
790
- all = _getChildState.all,
791
- none = _getChildState.none,
792
- half = _getChildState.half;
793
-
794
- if (all) {
795
- node.checked = true;
796
- node.indeterminate = false;
797
- } else if (half) {
798
- node.checked = false;
799
- node.indeterminate = true;
800
- } else if (none) {
801
- node.checked = false;
802
- node.indeterminate = false;
803
- }
804
-
805
- var parent = node.parent;
806
- if (!parent || parent.level === 0) return;
807
-
808
- if (!node.store.checkStrictly) {
809
- reInitChecked(parent);
810
- }
811
- };
812
-
813
- var getPropertyFromData = function getPropertyFromData(node, prop) {
814
- var props = node.store.props;
815
- var data = node.data || {};
816
- var config = props[prop];
817
-
818
- if (typeof config === 'function') {
819
- return config(data, node);
820
- } else if (typeof config === 'string') {
821
- return data[config];
822
- } else if (typeof config === 'undefined') {
823
- var dataProp = data[prop];
824
- return dataProp === undefined ? '' : dataProp;
825
- }
826
- };
827
-
828
- var nodeIdSeed = 0;
829
-
830
- var node_Node = function () {
831
- function Node(options) {
832
- _classCallCheck(this, Node);
833
-
834
- this.id = nodeIdSeed++;
835
- this.text = null;
836
- this.checked = false;
837
- this.indeterminate = false;
838
- this.data = null;
839
- this.expanded = false;
840
- this.parent = null;
841
- this.visible = true;
842
- this.isCurrent = false;
843
-
844
- for (var name in options) {
845
- if (options.hasOwnProperty(name)) {
846
- this[name] = options[name];
847
- }
848
- }
849
-
850
- // internal
851
- this.level = 0;
852
- this.loaded = false;
853
- this.childNodes = [];
854
- this.loading = false;
855
-
856
- if (this.parent) {
857
- this.level = this.parent.level + 1;
858
- }
859
-
860
- var store = this.store;
861
- if (!store) {
862
- throw new Error('[Node]store is required!');
863
- }
864
- store.registerNode(this);
865
-
866
- var props = store.props;
867
- if (props && typeof props.isLeaf !== 'undefined') {
868
- var isLeaf = getPropertyFromData(this, 'isLeaf');
869
- if (typeof isLeaf === 'boolean') {
870
- this.isLeafByUser = isLeaf;
871
- }
872
- }
873
-
874
- if (store.lazy !== true && this.data) {
875
- this.setData(this.data);
876
-
877
- if (store.defaultExpandAll) {
878
- this.expanded = true;
879
- }
880
- } else if (this.level > 0 && store.lazy && store.defaultExpandAll) {
881
- this.expand();
882
- }
883
- if (!Array.isArray(this.data)) {
884
- markNodeData(this, this.data);
885
- }
886
- if (!this.data) return;
887
- var defaultExpandedKeys = store.defaultExpandedKeys;
888
- var key = store.key;
889
- if (key && defaultExpandedKeys && defaultExpandedKeys.indexOf(this.key) !== -1) {
890
- this.expand(null, store.autoExpandParent);
891
- }
892
-
893
- if (key && store.currentNodeKey !== undefined && this.key === store.currentNodeKey) {
894
- store.currentNode = this;
895
- store.currentNode.isCurrent = true;
896
- }
897
-
898
- if (store.lazy) {
899
- store._initDefaultCheckedNode(this);
900
- }
901
-
902
- this.updateLeafState();
903
- }
904
-
905
- Node.prototype.setData = function setData(data) {
906
- if (!Array.isArray(data)) {
907
- markNodeData(this, data);
908
- }
909
-
910
- this.data = data;
911
- this.childNodes = [];
912
-
913
- var children = void 0;
914
- if (this.level === 0 && this.data instanceof Array) {
915
- children = this.data;
916
- } else {
917
- children = getPropertyFromData(this, 'children') || [];
918
- }
919
-
920
- for (var i = 0, j = children.length; i < j; i++) {
921
- this.insertChild({ data: children[i] });
922
- }
923
- };
924
-
925
- Node.prototype.contains = function contains(target) {
926
- var deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
927
-
928
- var walk = function walk(parent) {
929
- var children = parent.childNodes || [];
930
- var result = false;
931
- for (var i = 0, j = children.length; i < j; i++) {
932
- var child = children[i];
933
- if (child === target || deep && walk(child)) {
934
- result = true;
935
- break;
936
- }
937
- }
938
- return result;
939
- };
940
-
941
- return walk(this);
942
- };
943
-
944
- Node.prototype.remove = function remove() {
945
- var parent = this.parent;
946
- if (parent) {
947
- parent.removeChild(this);
948
- }
949
- };
950
-
951
- Node.prototype.insertChild = function insertChild(child, index, batch) {
952
- if (!child) throw new Error('insertChild error: child is required.');
953
-
954
- if (!(child instanceof Node)) {
955
- if (!batch) {
956
- var children = this.getChildren(true) || [];
957
- if (children.indexOf(child.data) === -1) {
958
- if (typeof index === 'undefined' || index < 0) {
959
- children.push(child.data);
960
- } else {
961
- children.splice(index, 0, child.data);
962
- }
963
- }
964
- }
965
- merge_default()(child, {
966
- parent: this,
967
- store: this.store
968
- });
969
- child = new Node(child);
970
- }
971
-
972
- child.level = this.level + 1;
973
-
974
- if (typeof index === 'undefined' || index < 0) {
975
- this.childNodes.push(child);
976
- } else {
977
- this.childNodes.splice(index, 0, child);
978
- }
979
-
980
- this.updateLeafState();
981
- };
982
-
983
- Node.prototype.insertBefore = function insertBefore(child, ref) {
984
- var index = void 0;
985
- if (ref) {
986
- index = this.childNodes.indexOf(ref);
987
- }
988
- this.insertChild(child, index);
989
- };
990
-
991
- Node.prototype.insertAfter = function insertAfter(child, ref) {
992
- var index = void 0;
993
- if (ref) {
994
- index = this.childNodes.indexOf(ref);
995
- if (index !== -1) index += 1;
996
- }
997
- this.insertChild(child, index);
998
- };
999
-
1000
- Node.prototype.removeChild = function removeChild(child) {
1001
- var children = this.getChildren() || [];
1002
- var dataIndex = children.indexOf(child.data);
1003
- if (dataIndex > -1) {
1004
- children.splice(dataIndex, 1);
1005
- }
1006
-
1007
- var index = this.childNodes.indexOf(child);
1008
-
1009
- if (index > -1) {
1010
- this.store && this.store.deregisterNode(child);
1011
- child.parent = null;
1012
- this.childNodes.splice(index, 1);
1013
- }
1014
-
1015
- this.updateLeafState();
1016
- };
1017
-
1018
- Node.prototype.removeChildByData = function removeChildByData(data) {
1019
- var targetNode = null;
1020
-
1021
- for (var i = 0; i < this.childNodes.length; i++) {
1022
- if (this.childNodes[i].data === data) {
1023
- targetNode = this.childNodes[i];
1024
- break;
1025
- }
1026
- }
1027
-
1028
- if (targetNode) {
1029
- this.removeChild(targetNode);
1030
- }
1031
- };
1032
-
1033
- Node.prototype.expand = function expand(callback, expandParent) {
1034
- var _this = this;
1035
-
1036
- var done = function done() {
1037
- if (expandParent) {
1038
- var parent = _this.parent;
1039
- while (parent.level > 0) {
1040
- parent.expanded = true;
1041
- parent = parent.parent;
1042
- }
1043
- }
1044
- _this.expanded = true;
1045
- if (callback) callback();
1046
- };
1047
-
1048
- if (this.shouldLoadData()) {
1049
- this.loadData(function (data) {
1050
- if (data instanceof Array) {
1051
- if (_this.checked) {
1052
- _this.setChecked(true, true);
1053
- } else if (!_this.store.checkStrictly) {
1054
- reInitChecked(_this);
1055
- }
1056
- done();
1057
- }
1058
- });
1059
- } else {
1060
- done();
1061
- }
1062
- };
1063
-
1064
- Node.prototype.doCreateChildren = function doCreateChildren(array) {
1065
- var _this2 = this;
1066
-
1067
- var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1068
-
1069
- array.forEach(function (item) {
1070
- _this2.insertChild(merge_default()({ data: item }, defaultProps), undefined, true);
1071
- });
1072
- };
1073
-
1074
- Node.prototype.collapse = function collapse() {
1075
- this.expanded = false;
1076
- };
1077
-
1078
- Node.prototype.shouldLoadData = function shouldLoadData() {
1079
- return this.store.lazy === true && this.store.load && !this.loaded;
1080
- };
1081
-
1082
- Node.prototype.updateLeafState = function updateLeafState() {
1083
- if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== 'undefined') {
1084
- this.isLeaf = this.isLeafByUser;
1085
- return;
1086
- }
1087
- var childNodes = this.childNodes;
1088
- if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
1089
- this.isLeaf = !childNodes || childNodes.length === 0;
1090
- return;
1091
- }
1092
- this.isLeaf = false;
1093
- };
1094
-
1095
- Node.prototype.setChecked = function setChecked(value, deep, recursion, passValue) {
1096
- var _this3 = this;
1097
-
1098
- this.indeterminate = value === 'half';
1099
- this.checked = value === true;
1100
-
1101
- if (this.store.checkStrictly) return;
1102
-
1103
- if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
1104
- var _getChildState2 = getChildState(this.childNodes),
1105
- all = _getChildState2.all,
1106
- allWithoutDisable = _getChildState2.allWithoutDisable;
1107
-
1108
- if (!this.isLeaf && !all && allWithoutDisable) {
1109
- this.checked = false;
1110
- value = false;
1111
- }
1112
-
1113
- var handleDescendants = function handleDescendants() {
1114
- if (deep) {
1115
- var childNodes = _this3.childNodes;
1116
- for (var i = 0, j = childNodes.length; i < j; i++) {
1117
- var child = childNodes[i];
1118
- passValue = passValue || value !== false;
1119
- var isCheck = child.disabled ? child.checked : passValue;
1120
- child.setChecked(isCheck, deep, true, passValue);
1121
- }
1122
-
1123
- var _getChildState3 = getChildState(childNodes),
1124
- half = _getChildState3.half,
1125
- _all = _getChildState3.all;
1126
-
1127
- if (!_all) {
1128
- _this3.checked = _all;
1129
- _this3.indeterminate = half;
1130
- }
1131
- }
1132
- };
1133
-
1134
- if (this.shouldLoadData()) {
1135
- // Only work on lazy load data.
1136
- this.loadData(function () {
1137
- handleDescendants();
1138
- reInitChecked(_this3);
1139
- }, {
1140
- checked: value !== false
1141
- });
1142
- return;
1143
- } else {
1144
- handleDescendants();
1145
- }
1146
- }
1147
-
1148
- var parent = this.parent;
1149
- if (!parent || parent.level === 0) return;
1150
-
1151
- if (!recursion) {
1152
- reInitChecked(parent);
1153
- }
1154
- };
1155
-
1156
- Node.prototype.getChildren = function getChildren() {
1157
- var forceInit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1158
- // this is data
1159
- if (this.level === 0) return this.data;
1160
- var data = this.data;
1161
- if (!data) return null;
1162
-
1163
- var props = this.store.props;
1164
- var children = 'children';
1165
- if (props) {
1166
- children = props.children || 'children';
1167
- }
1168
-
1169
- if (data[children] === undefined) {
1170
- data[children] = null;
1171
- }
1172
-
1173
- if (forceInit && !data[children]) {
1174
- data[children] = [];
1175
- }
1176
-
1177
- return data[children];
1178
- };
1179
-
1180
- Node.prototype.updateChildren = function updateChildren() {
1181
- var _this4 = this;
1182
-
1183
- var newData = this.getChildren() || [];
1184
- var oldData = this.childNodes.map(function (node) {
1185
- return node.data;
1186
- });
1187
-
1188
- var newDataMap = {};
1189
- var newNodes = [];
1190
-
1191
- newData.forEach(function (item, index) {
1192
- var key = item[NODE_KEY];
1193
- var isNodeExists = !!key && Object(util_["arrayFindIndex"])(oldData, function (data) {
1194
- return data[NODE_KEY] === key;
1195
- }) >= 0;
1196
- if (isNodeExists) {
1197
- newDataMap[key] = { index: index, data: item };
1198
- } else {
1199
- newNodes.push({ index: index, data: item });
1200
- }
1201
- });
1202
-
1203
- if (!this.store.lazy) {
1204
- oldData.forEach(function (item) {
1205
- if (!newDataMap[item[NODE_KEY]]) _this4.removeChildByData(item);
1206
- });
1207
- }
1208
-
1209
- newNodes.forEach(function (_ref) {
1210
- var index = _ref.index,
1211
- data = _ref.data;
1212
-
1213
- _this4.insertChild({ data: data }, index);
1214
- });
1215
-
1216
- this.updateLeafState();
1217
- };
1218
-
1219
- Node.prototype.loadData = function loadData(callback) {
1220
- var _this5 = this;
1221
-
1222
- var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1223
-
1224
- if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
1225
- this.loading = true;
1226
-
1227
- var resolve = function resolve(children) {
1228
- _this5.childNodes = [];
1229
-
1230
- _this5.doCreateChildren(children, defaultProps);
1231
- _this5.loaded = true;
1232
- _this5.loading = false;
1233
- _this5.updateLeafState();
1234
- if (callback) {
1235
- callback.call(_this5, children);
1236
- }
1237
- };
1238
-
1239
- this.store.load(this, resolve);
1240
- } else {
1241
- if (callback) {
1242
- callback.call(this);
1243
- }
1244
- }
1245
- };
1246
-
1247
- _createClass(Node, [{
1248
- key: 'label',
1249
- get: function get() {
1250
- return getPropertyFromData(this, 'label');
1251
- }
1252
- }, {
1253
- key: 'key',
1254
- get: function get() {
1255
- var nodeKey = this.store.key;
1256
- if (this.data) return this.data[nodeKey];
1257
- return null;
1258
- }
1259
- }, {
1260
- key: 'disabled',
1261
- get: function get() {
1262
- return getPropertyFromData(this, 'disabled');
1263
- }
1264
- }, {
1265
- key: 'nextSibling',
1266
- get: function get() {
1267
- var parent = this.parent;
1268
- if (parent) {
1269
- var index = parent.childNodes.indexOf(this);
1270
- if (index > -1) {
1271
- return parent.childNodes[index + 1];
1272
- }
1273
- }
1274
- return null;
1275
- }
1276
- }, {
1277
- key: 'previousSibling',
1278
- get: function get() {
1279
- var parent = this.parent;
1280
- if (parent) {
1281
- var index = parent.childNodes.indexOf(this);
1282
- if (index > -1) {
1283
- return index > 0 ? parent.childNodes[index - 1] : null;
1284
- }
1285
- }
1286
- return null;
1287
- }
1288
- }]);
1289
-
1290
- return Node;
1291
- }();
1292
-
1293
- /* harmony default export */ var model_node = (node_Node);
1294
- // CONCATENATED MODULE: ./packages/tree/src/model/tree-store.js
1295
- 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; };
1296
-
1297
- function tree_store_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1298
-
1299
-
1300
-
1301
-
1302
- var tree_store_TreeStore = function () {
1303
- function TreeStore(options) {
1304
- var _this = this;
1305
-
1306
- tree_store_classCallCheck(this, TreeStore);
1307
-
1308
- this.currentNode = null;
1309
- this.currentNodeKey = null;
1310
-
1311
- for (var option in options) {
1312
- if (options.hasOwnProperty(option)) {
1313
- this[option] = options[option];
1314
- }
1315
- }
1316
-
1317
- this.nodesMap = {};
1318
-
1319
- this.root = new model_node({
1320
- data: this.data,
1321
- store: this
1322
- });
1323
-
1324
- if (this.lazy && this.load) {
1325
- var loadFn = this.load;
1326
- loadFn(this.root, function (data) {
1327
- _this.root.doCreateChildren(data);
1328
- _this._initDefaultCheckedNodes();
1329
- });
1330
- } else {
1331
- this._initDefaultCheckedNodes();
1332
- }
1333
- }
1334
-
1335
- TreeStore.prototype.filter = function filter(value) {
1336
- var filterNodeMethod = this.filterNodeMethod;
1337
- var lazy = this.lazy;
1338
- var traverse = function traverse(node) {
1339
- var childNodes = node.root ? node.root.childNodes : node.childNodes;
1340
-
1341
- childNodes.forEach(function (child) {
1342
- child.visible = filterNodeMethod.call(child, value, child.data, child);
1343
-
1344
- traverse(child);
1345
- });
1346
-
1347
- if (!node.visible && childNodes.length) {
1348
- var allHidden = true;
1349
- allHidden = !childNodes.some(function (child) {
1350
- return child.visible;
1351
- });
1352
-
1353
- if (node.root) {
1354
- node.root.visible = allHidden === false;
1355
- } else {
1356
- node.visible = allHidden === false;
1357
- }
1358
- }
1359
- if (!value) return;
1360
-
1361
- if (node.visible && !node.isLeaf && !lazy) node.expand();
1362
- };
1363
-
1364
- traverse(this);
1365
- };
1366
-
1367
- TreeStore.prototype.setData = function setData(newVal) {
1368
- var instanceChanged = newVal !== this.root.data;
1369
- if (instanceChanged) {
1370
- this.root.setData(newVal);
1371
- this._initDefaultCheckedNodes();
1372
- } else {
1373
- this.root.updateChildren();
1374
- }
1375
- };
1376
-
1377
- TreeStore.prototype.getNode = function getNode(data) {
1378
- if (data instanceof model_node) return data;
1379
- var key = (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object' ? data : util_getNodeKey(this.key, data);
1380
- return this.nodesMap[key] || null;
1381
- };
1382
-
1383
- TreeStore.prototype.insertBefore = function insertBefore(data, refData) {
1384
- var refNode = this.getNode(refData);
1385
- refNode.parent.insertBefore({ data: data }, refNode);
1386
- };
1387
-
1388
- TreeStore.prototype.insertAfter = function insertAfter(data, refData) {
1389
- var refNode = this.getNode(refData);
1390
- refNode.parent.insertAfter({ data: data }, refNode);
1391
- };
1392
-
1393
- TreeStore.prototype.remove = function remove(data) {
1394
- var node = this.getNode(data);
1395
-
1396
- if (node && node.parent) {
1397
- if (node === this.currentNode) {
1398
- this.currentNode = null;
1399
- }
1400
- node.parent.removeChild(node);
1401
- }
1402
- };
1403
-
1404
- TreeStore.prototype.append = function append(data, parentData) {
1405
- var parentNode = parentData ? this.getNode(parentData) : this.root;
1406
-
1407
- if (parentNode) {
1408
- parentNode.insertChild({ data: data });
1409
- }
1410
- };
1411
-
1412
- TreeStore.prototype._initDefaultCheckedNodes = function _initDefaultCheckedNodes() {
1413
- var _this2 = this;
1414
-
1415
- var defaultCheckedKeys = this.defaultCheckedKeys || [];
1416
- var nodesMap = this.nodesMap;
1417
-
1418
- defaultCheckedKeys.forEach(function (checkedKey) {
1419
- var node = nodesMap[checkedKey];
1420
-
1421
- if (node) {
1422
- node.setChecked(true, !_this2.checkStrictly);
1423
- }
1424
- });
1425
- };
1426
-
1427
- TreeStore.prototype._initDefaultCheckedNode = function _initDefaultCheckedNode(node) {
1428
- var defaultCheckedKeys = this.defaultCheckedKeys || [];
1429
-
1430
- if (defaultCheckedKeys.indexOf(node.key) !== -1) {
1431
- node.setChecked(true, !this.checkStrictly);
1432
- }
1433
- };
1434
-
1435
- TreeStore.prototype.setDefaultCheckedKey = function setDefaultCheckedKey(newVal) {
1436
- if (newVal !== this.defaultCheckedKeys) {
1437
- this.defaultCheckedKeys = newVal;
1438
- this._initDefaultCheckedNodes();
1439
- }
1440
- };
1441
-
1442
- TreeStore.prototype.registerNode = function registerNode(node) {
1443
- var key = this.key;
1444
- if (!key || !node || !node.data) return;
1445
-
1446
- var nodeKey = node.key;
1447
- if (nodeKey !== undefined) this.nodesMap[node.key] = node;
1448
- };
1449
-
1450
- TreeStore.prototype.deregisterNode = function deregisterNode(node) {
1451
- var _this3 = this;
1452
-
1453
- var key = this.key;
1454
- if (!key || !node || !node.data) return;
1455
-
1456
- node.childNodes.forEach(function (child) {
1457
- _this3.deregisterNode(child);
1458
- });
1459
-
1460
- delete this.nodesMap[node.key];
1461
- };
1462
-
1463
- TreeStore.prototype.getCheckedNodes = function getCheckedNodes() {
1464
- var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1465
- var includeHalfChecked = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1466
-
1467
- var checkedNodes = [];
1468
- var traverse = function traverse(node) {
1469
- var childNodes = node.root ? node.root.childNodes : node.childNodes;
1470
-
1471
- childNodes.forEach(function (child) {
1472
- if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
1473
- checkedNodes.push(child.data);
1474
- }
1475
-
1476
- traverse(child);
1477
- });
1478
- };
1479
-
1480
- traverse(this);
1481
-
1482
- return checkedNodes;
1483
- };
1484
-
1485
- TreeStore.prototype.getCheckedKeys = function getCheckedKeys() {
1486
- var _this4 = this;
1487
-
1488
- var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1489
-
1490
- return this.getCheckedNodes(leafOnly).map(function (data) {
1491
- return (data || {})[_this4.key];
1492
- });
1493
- };
1494
-
1495
- TreeStore.prototype.getHalfCheckedNodes = function getHalfCheckedNodes() {
1496
- var nodes = [];
1497
- var traverse = function traverse(node) {
1498
- var childNodes = node.root ? node.root.childNodes : node.childNodes;
1499
-
1500
- childNodes.forEach(function (child) {
1501
- if (child.indeterminate) {
1502
- nodes.push(child.data);
1503
- }
1504
-
1505
- traverse(child);
1506
- });
1507
- };
1508
-
1509
- traverse(this);
1510
-
1511
- return nodes;
1512
- };
1513
-
1514
- TreeStore.prototype.getHalfCheckedKeys = function getHalfCheckedKeys() {
1515
- var _this5 = this;
1516
-
1517
- return this.getHalfCheckedNodes().map(function (data) {
1518
- return (data || {})[_this5.key];
1519
- });
1520
- };
1521
-
1522
- TreeStore.prototype._getAllNodes = function _getAllNodes() {
1523
- var allNodes = [];
1524
- var nodesMap = this.nodesMap;
1525
- for (var nodeKey in nodesMap) {
1526
- if (nodesMap.hasOwnProperty(nodeKey)) {
1527
- allNodes.push(nodesMap[nodeKey]);
1528
- }
1529
- }
1530
-
1531
- return allNodes;
1532
- };
1533
-
1534
- TreeStore.prototype.updateChildren = function updateChildren(key, data) {
1535
- var node = this.nodesMap[key];
1536
- if (!node) return;
1537
- var childNodes = node.childNodes;
1538
- for (var i = childNodes.length - 1; i >= 0; i--) {
1539
- var child = childNodes[i];
1540
- this.remove(child.data);
1541
- }
1542
- for (var _i = 0, j = data.length; _i < j; _i++) {
1543
- var _child = data[_i];
1544
- this.append(_child, node.data);
1545
- }
1546
- };
1547
-
1548
- TreeStore.prototype._setCheckedKeys = function _setCheckedKeys(key) {
1549
- var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1550
- var checkedKeys = arguments[2];
1551
-
1552
- var allNodes = this._getAllNodes().sort(function (a, b) {
1553
- return b.level - a.level;
1554
- });
1555
- var cache = Object.create(null);
1556
- var keys = Object.keys(checkedKeys);
1557
- allNodes.forEach(function (node) {
1558
- return node.setChecked(false, false);
1559
- });
1560
- for (var i = 0, j = allNodes.length; i < j; i++) {
1561
- var node = allNodes[i];
1562
- var nodeKey = node.data[key].toString();
1563
- var checked = keys.indexOf(nodeKey) > -1;
1564
- if (!checked) {
1565
- if (node.checked && !cache[nodeKey]) {
1566
- node.setChecked(false, false);
1567
- }
1568
- continue;
1569
- }
1570
-
1571
- var parent = node.parent;
1572
- while (parent && parent.level > 0) {
1573
- cache[parent.data[key]] = true;
1574
- parent = parent.parent;
1575
- }
1576
-
1577
- if (node.isLeaf || this.checkStrictly) {
1578
- node.setChecked(true, false);
1579
- continue;
1580
- }
1581
- node.setChecked(true, true);
1582
-
1583
- if (leafOnly) {
1584
- (function () {
1585
- node.setChecked(false, false);
1586
- var traverse = function traverse(node) {
1587
- var childNodes = node.childNodes;
1588
- childNodes.forEach(function (child) {
1589
- if (!child.isLeaf) {
1590
- child.setChecked(false, false);
1591
- }
1592
- traverse(child);
1593
- });
1594
- };
1595
- traverse(node);
1596
- })();
1597
- }
1598
- }
1599
- };
1600
-
1601
- TreeStore.prototype.setCheckedNodes = function setCheckedNodes(array) {
1602
- var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1603
-
1604
- var key = this.key;
1605
- var checkedKeys = {};
1606
- array.forEach(function (item) {
1607
- checkedKeys[(item || {})[key]] = true;
1608
- });
1609
-
1610
- this._setCheckedKeys(key, leafOnly, checkedKeys);
1611
- };
1612
-
1613
- TreeStore.prototype.setCheckedKeys = function setCheckedKeys(keys) {
1614
- var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1615
-
1616
- this.defaultCheckedKeys = keys;
1617
- var key = this.key;
1618
- var checkedKeys = {};
1619
- keys.forEach(function (key) {
1620
- checkedKeys[key] = true;
1621
- });
1622
-
1623
- this._setCheckedKeys(key, leafOnly, checkedKeys);
1624
- };
1625
-
1626
- TreeStore.prototype.setDefaultExpandedKeys = function setDefaultExpandedKeys(keys) {
1627
- var _this6 = this;
1628
-
1629
- keys = keys || [];
1630
- this.defaultExpandedKeys = keys;
1631
-
1632
- keys.forEach(function (key) {
1633
- var node = _this6.getNode(key);
1634
- if (node) node.expand(null, _this6.autoExpandParent);
1635
- });
1636
- };
1637
-
1638
- TreeStore.prototype.setChecked = function setChecked(data, checked, deep) {
1639
- var node = this.getNode(data);
1640
-
1641
- if (node) {
1642
- node.setChecked(!!checked, deep);
1643
- }
1644
- };
1645
-
1646
- TreeStore.prototype.getCurrentNode = function getCurrentNode() {
1647
- return this.currentNode;
1648
- };
1649
-
1650
- TreeStore.prototype.setCurrentNode = function setCurrentNode(currentNode) {
1651
- var prevCurrentNode = this.currentNode;
1652
- if (prevCurrentNode) {
1653
- prevCurrentNode.isCurrent = false;
1654
- }
1655
- this.currentNode = currentNode;
1656
- this.currentNode.isCurrent = true;
1657
- };
1658
-
1659
- TreeStore.prototype.setUserCurrentNode = function setUserCurrentNode(node) {
1660
- var key = node[this.key];
1661
- var currNode = this.nodesMap[key];
1662
- this.setCurrentNode(currNode);
1663
- };
1664
-
1665
- TreeStore.prototype.setCurrentNodeKey = function setCurrentNodeKey(key) {
1666
- if (key === null || key === undefined) {
1667
- this.currentNode && (this.currentNode.isCurrent = false);
1668
- this.currentNode = null;
1669
- return;
1670
- }
1671
- var node = this.getNode(key);
1672
- if (node) {
1673
- this.setCurrentNode(node);
1674
- }
1675
- };
1676
-
1677
- return TreeStore;
1678
- }();
1679
-
1680
- /* harmony default export */ var tree_store = (tree_store_TreeStore);
1681
- ;
1682
- // 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
1683
- var tree_nodevue_type_template_id_769053c6_render = function () {
1684
- var this$1 = this
1685
- var _vm = this
1686
- var _h = _vm.$createElement
1687
- var _c = _vm._self._c || _h
1688
- return _c(
1689
- "div",
1690
- {
1691
- directives: [
1692
- {
1693
- name: "show",
1694
- rawName: "v-show",
1695
- value: _vm.node.visible,
1696
- expression: "node.visible",
1697
- },
1698
- ],
1699
- ref: "node",
1700
- staticClass: "el-tree-node",
1701
- class: {
1702
- "is-expanded": _vm.expanded,
1703
- "is-current": _vm.node.isCurrent,
1704
- "is-hidden": !_vm.node.visible,
1705
- "is-focusable": !_vm.node.disabled,
1706
- "is-checked": !_vm.node.disabled && _vm.node.checked,
1707
- },
1708
- attrs: {
1709
- role: "treeitem",
1710
- tabindex: "-1",
1711
- "aria-expanded": _vm.expanded,
1712
- "aria-disabled": _vm.node.disabled,
1713
- "aria-checked": _vm.node.checked,
1714
- draggable: _vm.tree.draggable,
1715
- },
1716
- on: {
1717
- click: function ($event) {
1718
- $event.stopPropagation()
1719
- return _vm.handleClick($event)
1720
- },
1721
- contextmenu: function ($event) {
1722
- return this$1.handleContextMenu($event)
1723
- },
1724
- dragstart: function ($event) {
1725
- $event.stopPropagation()
1726
- return _vm.handleDragStart($event)
1727
- },
1728
- dragover: function ($event) {
1729
- $event.stopPropagation()
1730
- return _vm.handleDragOver($event)
1731
- },
1732
- dragend: function ($event) {
1733
- $event.stopPropagation()
1734
- return _vm.handleDragEnd($event)
1735
- },
1736
- drop: function ($event) {
1737
- $event.stopPropagation()
1738
- return _vm.handleDrop($event)
1739
- },
1740
- },
1741
- },
1742
- [
1743
- _c(
1744
- "div",
1745
- {
1746
- staticClass: "el-tree-node__content",
1747
- style: {
1748
- "padding-left": (_vm.node.level - 1) * _vm.tree.indent + "px",
1749
- },
1750
- },
1751
- [
1752
- _c("span", {
1753
- class: [
1754
- {
1755
- "is-leaf": _vm.node.isLeaf,
1756
- expanded: !_vm.node.isLeaf && _vm.expanded,
1757
- },
1758
- "el-tree-node__expand-icon",
1759
- _vm.tree.iconClass ? _vm.tree.iconClass : "el-icon-caret-right",
1760
- ],
1761
- on: {
1762
- click: function ($event) {
1763
- $event.stopPropagation()
1764
- return _vm.handleExpandIconClick($event)
1765
- },
1766
- },
1767
- }),
1768
- _vm.showCheckbox
1769
- ? _c("el-checkbox", {
1770
- attrs: {
1771
- indeterminate: _vm.node.indeterminate,
1772
- disabled: !!_vm.node.disabled,
1773
- },
1774
- on: { change: _vm.handleCheckChange },
1775
- nativeOn: {
1776
- click: function ($event) {
1777
- $event.stopPropagation()
1778
- },
1779
- },
1780
- model: {
1781
- value: _vm.node.checked,
1782
- callback: function ($$v) {
1783
- _vm.$set(_vm.node, "checked", $$v)
1784
- },
1785
- expression: "node.checked",
1786
- },
1787
- })
1788
- : _vm._e(),
1789
- _vm.node.loading
1790
- ? _c("span", {
1791
- staticClass: "el-tree-node__loading-icon el-icon-loading",
1792
- })
1793
- : _vm._e(),
1794
- _c("node-content", { attrs: { node: _vm.node } }),
1795
- ],
1796
- 1
1797
- ),
1798
- _c("el-collapse-transition", [
1799
- !_vm.renderAfterExpand || _vm.childNodeRendered
1800
- ? _c(
1801
- "div",
1802
- {
1803
- directives: [
1804
- {
1805
- name: "show",
1806
- rawName: "v-show",
1807
- value: _vm.expanded,
1808
- expression: "expanded",
1809
- },
1810
- ],
1811
- staticClass: "el-tree-node__children",
1812
- attrs: { role: "group", "aria-expanded": _vm.expanded },
1813
- },
1814
- _vm._l(_vm.node.childNodes, function (child) {
1815
- return _c("el-tree-node", {
1816
- key: _vm.getNodeKey(child),
1817
- attrs: {
1818
- "render-content": _vm.renderContent,
1819
- "render-after-expand": _vm.renderAfterExpand,
1820
- "show-checkbox": _vm.showCheckbox,
1821
- node: child,
1822
- },
1823
- on: { "node-expand": _vm.handleChildNodeExpand },
1824
- })
1825
- }),
1826
- 1
1827
- )
1828
- : _vm._e(),
1829
- ]),
1830
- ],
1831
- 1
1832
- )
1833
- }
1834
- var tree_nodevue_type_template_id_769053c6_staticRenderFns = []
1835
- tree_nodevue_type_template_id_769053c6_render._withStripped = true
1836
-
1837
-
1838
- // CONCATENATED MODULE: ./packages/tree/src/tree-node.vue?vue&type=template&id=769053c6
1839
-
1840
- // EXTERNAL MODULE: external "element-ui/lib/transitions/collapse-transition"
1841
- var collapse_transition_ = __webpack_require__(27);
1842
- var collapse_transition_default = /*#__PURE__*/__webpack_require__.n(collapse_transition_);
1843
-
1844
- // EXTERNAL MODULE: ./packages/checkbox/index.js + 5 modules
1845
- var packages_checkbox = __webpack_require__(16);
1846
-
1847
- // EXTERNAL MODULE: external "element-ui/lib/mixins/emitter"
1848
- var emitter_ = __webpack_require__(4);
1849
- var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
1850
-
1851
- // 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
1852
- //
1853
- //
1854
- //
1855
- //
1856
- //
1857
- //
1858
- //
1859
- //
1860
- //
1861
- //
1862
- //
1863
- //
1864
- //
1865
- //
1866
- //
1867
- //
1868
- //
1869
- //
1870
- //
1871
- //
1872
- //
1873
- //
1874
- //
1875
- //
1876
- //
1877
- //
1878
- //
1879
- //
1880
- //
1881
- //
1882
- //
1883
- //
1884
- //
1885
- //
1886
- //
1887
- //
1888
- //
1889
- //
1890
- //
1891
- //
1892
- //
1893
- //
1894
- //
1895
- //
1896
- //
1897
- //
1898
- //
1899
- //
1900
- //
1901
- //
1902
- //
1903
- //
1904
- //
1905
- //
1906
- //
1907
- //
1908
- //
1909
- //
1910
- //
1911
- //
1912
- //
1913
- //
1914
- //
1915
- //
1916
- //
1917
- //
1918
- //
1919
- //
1920
- //
1921
- //
1922
- //
1923
- //
1924
- //
1925
-
1926
-
1927
-
1928
-
1929
-
1930
-
1931
- /* harmony default export */ var tree_nodevue_type_script_lang_js = ({
1932
- name: 'ElTreeNode',
1933
-
1934
- componentName: 'ElTreeNode',
1935
-
1936
- mixins: [emitter_default.a],
1937
-
1938
- props: {
1939
- node: {
1940
- default: function _default() {
1941
- return {};
1942
- }
1943
- },
1944
- props: {},
1945
- renderContent: Function,
1946
- renderAfterExpand: {
1947
- type: Boolean,
1948
- default: true
1949
- },
1950
- showCheckbox: {
1951
- type: Boolean,
1952
- default: false
1953
- }
1954
- },
1955
-
1956
- components: {
1957
- ElCollapseTransition: collapse_transition_default.a,
1958
- ElCheckbox: packages_checkbox["default"],
1959
- NodeContent: {
1960
- props: {
1961
- node: {
1962
- required: true
1963
- }
1964
- },
1965
- render: function render(h) {
1966
- var parent = this.$parent;
1967
- var tree = parent.tree;
1968
- var node = this.node;
1969
- var data = node.data,
1970
- store = node.store;
1971
-
1972
- 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(
1973
- 'span',
1974
- { 'class': 'el-tree-node__label' },
1975
- [node.label]
1976
- );
1977
- }
1978
- }
1979
- },
1980
-
1981
- data: function data() {
1982
- return {
1983
- tree: null,
1984
- expanded: false,
1985
- childNodeRendered: false,
1986
- oldChecked: null,
1987
- oldIndeterminate: null
1988
- };
1989
- },
1990
-
1991
-
1992
- watch: {
1993
- 'node.indeterminate': function nodeIndeterminate(val) {
1994
- this.handleSelectChange(this.node.checked, val);
1995
- },
1996
- 'node.checked': function nodeChecked(val) {
1997
- this.handleSelectChange(val, this.node.indeterminate);
1998
- },
1999
- 'node.expanded': function nodeExpanded(val) {
2000
- var _this = this;
2001
-
2002
- this.$nextTick(function () {
2003
- return _this.expanded = val;
2004
- });
2005
- if (val) {
2006
- this.childNodeRendered = true;
2007
- }
2008
- }
2009
- },
2010
-
2011
- methods: {
2012
- getNodeKey: function getNodeKey(node) {
2013
- return util_getNodeKey(this.tree.nodeKey, node.data);
2014
- },
2015
- handleSelectChange: function handleSelectChange(checked, indeterminate) {
2016
- if (this.oldChecked !== checked && this.oldIndeterminate !== indeterminate) {
2017
- this.tree.$emit('check-change', this.node.data, checked, indeterminate);
2018
- }
2019
- this.oldChecked = checked;
2020
- this.indeterminate = indeterminate;
2021
- },
2022
- handleClick: function handleClick() {
2023
- var store = this.tree.store;
2024
- store.setCurrentNode(this.node);
2025
- this.tree.$emit('current-change', store.currentNode ? store.currentNode.data : null, store.currentNode);
2026
- this.tree.currentNode = this;
2027
- if (this.tree.expandOnClickNode) {
2028
- this.handleExpandIconClick();
2029
- }
2030
- if (this.tree.checkOnClickNode && !this.node.disabled) {
2031
- this.handleCheckChange(null, {
2032
- target: { checked: !this.node.checked }
2033
- });
2034
- }
2035
- this.tree.$emit('node-click', this.node.data, this.node, this);
2036
- },
2037
- handleContextMenu: function handleContextMenu(event) {
2038
- if (this.tree._events['node-contextmenu'] && this.tree._events['node-contextmenu'].length > 0) {
2039
- event.stopPropagation();
2040
- event.preventDefault();
2041
- }
2042
- this.tree.$emit('node-contextmenu', event, this.node.data, this.node, this);
2043
- },
2044
- handleExpandIconClick: function handleExpandIconClick() {
2045
- if (this.node.isLeaf) return;
2046
- if (this.expanded) {
2047
- this.tree.$emit('node-collapse', this.node.data, this.node, this);
2048
- this.node.collapse();
2049
- } else {
2050
- this.node.expand();
2051
- this.$emit('node-expand', this.node.data, this.node, this);
2052
- }
2053
- },
2054
- handleCheckChange: function handleCheckChange(value, ev) {
2055
- var _this2 = this;
2056
-
2057
- this.node.setChecked(ev.target.checked, !this.tree.checkStrictly);
2058
- this.$nextTick(function () {
2059
- var store = _this2.tree.store;
2060
- _this2.tree.$emit('check', _this2.node.data, {
2061
- checkedNodes: store.getCheckedNodes(),
2062
- checkedKeys: store.getCheckedKeys(),
2063
- halfCheckedNodes: store.getHalfCheckedNodes(),
2064
- halfCheckedKeys: store.getHalfCheckedKeys()
2065
- });
2066
- });
2067
- },
2068
- handleChildNodeExpand: function handleChildNodeExpand(nodeData, node, instance) {
2069
- this.broadcast('ElTreeNode', 'tree-node-expand', node);
2070
- this.tree.$emit('node-expand', nodeData, node, instance);
2071
- },
2072
- handleDragStart: function handleDragStart(event) {
2073
- if (!this.tree.draggable) return;
2074
- this.tree.$emit('tree-node-drag-start', event, this);
2075
- },
2076
- handleDragOver: function handleDragOver(event) {
2077
- if (!this.tree.draggable) return;
2078
- this.tree.$emit('tree-node-drag-over', event, this);
2079
- event.preventDefault();
2080
- },
2081
- handleDrop: function handleDrop(event) {
2082
- event.preventDefault();
2083
- },
2084
- handleDragEnd: function handleDragEnd(event) {
2085
- if (!this.tree.draggable) return;
2086
- this.tree.$emit('tree-node-drag-end', event, this);
2087
- }
2088
- },
2089
-
2090
- created: function created() {
2091
- var _this3 = this;
2092
-
2093
- var parent = this.$parent;
2094
-
2095
- if (parent.isTree) {
2096
- this.tree = parent;
2097
- } else {
2098
- this.tree = parent.tree;
2099
- }
2100
-
2101
- var tree = this.tree;
2102
- if (!tree) {
2103
- console.warn('Can not find node\'s tree.');
2104
- }
2105
-
2106
- var props = tree.props || {};
2107
- var childrenKey = props['children'] || 'children';
2108
-
2109
- this.$watch('node.data.' + childrenKey, function () {
2110
- _this3.node.updateChildren();
2111
- });
2112
-
2113
- if (this.node.expanded) {
2114
- this.expanded = true;
2115
- this.childNodeRendered = true;
2116
- }
2117
-
2118
- if (this.tree.accordion) {
2119
- this.$on('tree-node-expand', function (node) {
2120
- if (_this3.node !== node) {
2121
- _this3.node.collapse();
2122
- }
2123
- });
2124
- }
2125
- }
2126
- });
2127
- // CONCATENATED MODULE: ./packages/tree/src/tree-node.vue?vue&type=script&lang=js
2128
- /* harmony default export */ var src_tree_nodevue_type_script_lang_js = (tree_nodevue_type_script_lang_js);
2129
- // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
2130
- var componentNormalizer = __webpack_require__(0);
2131
-
2132
- // CONCATENATED MODULE: ./packages/tree/src/tree-node.vue
2133
-
2134
-
2135
-
2136
-
2137
-
2138
- /* normalize component */
2139
-
2140
- var component = Object(componentNormalizer["a" /* default */])(
2141
- src_tree_nodevue_type_script_lang_js,
2142
- tree_nodevue_type_template_id_769053c6_render,
2143
- tree_nodevue_type_template_id_769053c6_staticRenderFns,
2144
- false,
2145
- null,
2146
- null,
2147
- null
2148
-
2149
- )
2150
-
2151
- /* harmony default export */ var tree_node = (component.exports);
2152
- // EXTERNAL MODULE: external "element-ui/lib/locale"
2153
- var locale_ = __webpack_require__(22);
2154
-
2155
- // EXTERNAL MODULE: external "element-ui/lib/utils/dom"
2156
- var dom_ = __webpack_require__(1);
2157
-
2158
- // 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
2159
- //
2160
- //
2161
- //
2162
- //
2163
- //
2164
- //
2165
- //
2166
- //
2167
- //
2168
- //
2169
- //
2170
- //
2171
- //
2172
- //
2173
- //
2174
- //
2175
- //
2176
- //
2177
- //
2178
- //
2179
- //
2180
- //
2181
- //
2182
- //
2183
- //
2184
- //
2185
- //
2186
- //
2187
- //
2188
- //
2189
- //
2190
- //
2191
-
2192
-
2193
-
2194
-
2195
-
2196
-
2197
-
2198
-
2199
- /* harmony default export */ var treevue_type_script_lang_js = ({
2200
- name: 'ElTree',
2201
-
2202
- mixins: [emitter_default.a],
2203
-
2204
- components: {
2205
- ElTreeNode: tree_node
2206
- },
2207
-
2208
- data: function data() {
2209
- return {
2210
- store: null,
2211
- root: null,
2212
- currentNode: null,
2213
- treeItems: null,
2214
- checkboxItems: [],
2215
- dragState: {
2216
- showDropIndicator: false,
2217
- draggingNode: null,
2218
- dropNode: null,
2219
- allowDrop: true
2220
- }
2221
- };
2222
- },
2223
-
2224
-
2225
- props: {
2226
- data: {
2227
- type: Array
2228
- },
2229
- emptyText: {
2230
- type: String,
2231
- default: function _default() {
2232
- return Object(locale_["t"])('el.tree.emptyText');
2233
- }
2234
- },
2235
- renderAfterExpand: {
2236
- type: Boolean,
2237
- default: true
2238
- },
2239
- nodeKey: String,
2240
- checkStrictly: Boolean,
2241
- defaultExpandAll: Boolean,
2242
- expandOnClickNode: {
2243
- type: Boolean,
2244
- default: true
2245
- },
2246
- checkOnClickNode: Boolean,
2247
- checkDescendants: {
2248
- type: Boolean,
2249
- default: false
2250
- },
2251
- autoExpandParent: {
2252
- type: Boolean,
2253
- default: true
2254
- },
2255
- defaultCheckedKeys: Array,
2256
- defaultExpandedKeys: Array,
2257
- currentNodeKey: [String, Number],
2258
- renderContent: Function,
2259
- showCheckbox: {
2260
- type: Boolean,
2261
- default: false
2262
- },
2263
- draggable: {
2264
- type: Boolean,
2265
- default: false
2266
- },
2267
- allowDrag: Function,
2268
- allowDrop: Function,
2269
- props: {
2270
- default: function _default() {
2271
- return {
2272
- children: 'children',
2273
- label: 'label',
2274
- disabled: 'disabled'
2275
- };
2276
- }
2277
- },
2278
- lazy: {
2279
- type: Boolean,
2280
- default: false
2281
- },
2282
- highlightCurrent: Boolean,
2283
- load: Function,
2284
- filterNodeMethod: Function,
2285
- accordion: Boolean,
2286
- indent: {
2287
- type: Number,
2288
- default: 18
2289
- },
2290
- iconClass: String
2291
- },
2292
-
2293
- computed: {
2294
- children: {
2295
- set: function set(value) {
2296
- this.data = value;
2297
- },
2298
- get: function get() {
2299
- return this.data;
2300
- }
2301
- },
2302
-
2303
- treeItemArray: function treeItemArray() {
2304
- return Array.prototype.slice.call(this.treeItems);
2305
- },
2306
- isEmpty: function isEmpty() {
2307
- var childNodes = this.root.childNodes;
2308
-
2309
- return !childNodes || childNodes.length === 0 || childNodes.every(function (_ref) {
2310
- var visible = _ref.visible;
2311
- return !visible;
2312
- });
2313
- }
2314
- },
2315
-
2316
- watch: {
2317
- defaultCheckedKeys: function defaultCheckedKeys(newVal) {
2318
- this.store.setDefaultCheckedKey(newVal);
2319
- },
2320
- defaultExpandedKeys: function defaultExpandedKeys(newVal) {
2321
- this.store.defaultExpandedKeys = newVal;
2322
- this.store.setDefaultExpandedKeys(newVal);
2323
- },
2324
- data: function data(newVal) {
2325
- this.store.setData(newVal);
2326
- },
2327
- checkboxItems: function checkboxItems(val) {
2328
- Array.prototype.forEach.call(val, function (checkbox) {
2329
- checkbox.setAttribute('tabindex', -1);
2330
- });
2331
- },
2332
- checkStrictly: function checkStrictly(newVal) {
2333
- this.store.checkStrictly = newVal;
2334
- }
2335
- },
2336
-
2337
- methods: {
2338
- filter: function filter(value) {
2339
- if (!this.filterNodeMethod) throw new Error('[Tree] filterNodeMethod is required when filter');
2340
- this.store.filter(value);
2341
- },
2342
- getNodeKey: function getNodeKey(node) {
2343
- return util_getNodeKey(this.nodeKey, node.data);
2344
- },
2345
- getNodePath: function getNodePath(data) {
2346
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getNodePath');
2347
- var node = this.store.getNode(data);
2348
- if (!node) return [];
2349
- var path = [node.data];
2350
- var parent = node.parent;
2351
- while (parent && parent !== this.root) {
2352
- path.push(parent.data);
2353
- parent = parent.parent;
2354
- }
2355
- return path.reverse();
2356
- },
2357
- getCheckedNodes: function getCheckedNodes(leafOnly, includeHalfChecked) {
2358
- return this.store.getCheckedNodes(leafOnly, includeHalfChecked);
2359
- },
2360
- getCheckedKeys: function getCheckedKeys(leafOnly) {
2361
- return this.store.getCheckedKeys(leafOnly);
2362
- },
2363
- getCurrentNode: function getCurrentNode() {
2364
- var currentNode = this.store.getCurrentNode();
2365
- return currentNode ? currentNode.data : null;
2366
- },
2367
- getCurrentKey: function getCurrentKey() {
2368
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getCurrentKey');
2369
- var currentNode = this.getCurrentNode();
2370
- return currentNode ? currentNode[this.nodeKey] : null;
2371
- },
2372
- setCheckedNodes: function setCheckedNodes(nodes, leafOnly) {
2373
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedNodes');
2374
- this.store.setCheckedNodes(nodes, leafOnly);
2375
- },
2376
- setCheckedKeys: function setCheckedKeys(keys, leafOnly) {
2377
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedKeys');
2378
- this.store.setCheckedKeys(keys, leafOnly);
2379
- },
2380
- setChecked: function setChecked(data, checked, deep) {
2381
- this.store.setChecked(data, checked, deep);
2382
- },
2383
- getHalfCheckedNodes: function getHalfCheckedNodes() {
2384
- return this.store.getHalfCheckedNodes();
2385
- },
2386
- getHalfCheckedKeys: function getHalfCheckedKeys() {
2387
- return this.store.getHalfCheckedKeys();
2388
- },
2389
- setCurrentNode: function setCurrentNode(node) {
2390
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentNode');
2391
- this.store.setUserCurrentNode(node);
2392
- },
2393
- setCurrentKey: function setCurrentKey(key) {
2394
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentKey');
2395
- this.store.setCurrentNodeKey(key);
2396
- },
2397
- getNode: function getNode(data) {
2398
- return this.store.getNode(data);
2399
- },
2400
- remove: function remove(data) {
2401
- this.store.remove(data);
2402
- },
2403
- append: function append(data, parentNode) {
2404
- this.store.append(data, parentNode);
2405
- },
2406
- insertBefore: function insertBefore(data, refNode) {
2407
- this.store.insertBefore(data, refNode);
2408
- },
2409
- insertAfter: function insertAfter(data, refNode) {
2410
- this.store.insertAfter(data, refNode);
2411
- },
2412
- handleNodeExpand: function handleNodeExpand(nodeData, node, instance) {
2413
- this.broadcast('ElTreeNode', 'tree-node-expand', node);
2414
- this.$emit('node-expand', nodeData, node, instance);
2415
- },
2416
- updateKeyChildren: function updateKeyChildren(key, data) {
2417
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in updateKeyChild');
2418
- this.store.updateChildren(key, data);
2419
- },
2420
- initTabIndex: function initTabIndex() {
2421
- this.treeItems = this.$el.querySelectorAll('.is-focusable[role=treeitem]');
2422
- this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
2423
- var checkedItem = this.$el.querySelectorAll('.is-checked[role=treeitem]');
2424
- if (checkedItem.length) {
2425
- checkedItem[0].setAttribute('tabindex', 0);
2426
- return;
2427
- }
2428
- this.treeItems[0] && this.treeItems[0].setAttribute('tabindex', 0);
2429
- },
2430
- handleKeydown: function handleKeydown(ev) {
2431
- var currentItem = ev.target;
2432
- if (currentItem.className.indexOf('el-tree-node') === -1) return;
2433
- var keyCode = ev.keyCode;
2434
- this.treeItems = this.$el.querySelectorAll('.is-focusable[role=treeitem]');
2435
- var currentIndex = this.treeItemArray.indexOf(currentItem);
2436
- var nextIndex = void 0;
2437
- if ([38, 40].indexOf(keyCode) > -1) {
2438
- // up、down
2439
- ev.preventDefault();
2440
- if (keyCode === 38) {
2441
- // up
2442
- nextIndex = currentIndex !== 0 ? currentIndex - 1 : 0;
2443
- } else {
2444
- nextIndex = currentIndex < this.treeItemArray.length - 1 ? currentIndex + 1 : 0;
2445
- }
2446
- this.treeItemArray[nextIndex].focus(); // 选中
2447
- }
2448
- if ([37, 39].indexOf(keyCode) > -1) {
2449
- // left、right 展开
2450
- ev.preventDefault();
2451
- currentItem.click(); // 选中
2452
- }
2453
- var hasInput = currentItem.querySelector('[type="checkbox"]');
2454
- if ([13, 32].indexOf(keyCode) > -1 && hasInput) {
2455
- // space enter选中checkbox
2456
- ev.preventDefault();
2457
- hasInput.click();
2458
- }
2459
- }
2460
- },
2461
-
2462
- created: function created() {
2463
- var _this = this;
2464
-
2465
- this.isTree = true;
2466
-
2467
- this.store = new tree_store({
2468
- key: this.nodeKey,
2469
- data: this.data,
2470
- lazy: this.lazy,
2471
- props: this.props,
2472
- load: this.load,
2473
- currentNodeKey: this.currentNodeKey,
2474
- checkStrictly: this.checkStrictly,
2475
- checkDescendants: this.checkDescendants,
2476
- defaultCheckedKeys: this.defaultCheckedKeys,
2477
- defaultExpandedKeys: this.defaultExpandedKeys,
2478
- autoExpandParent: this.autoExpandParent,
2479
- defaultExpandAll: this.defaultExpandAll,
2480
- filterNodeMethod: this.filterNodeMethod
2481
- });
2482
-
2483
- this.root = this.store.root;
2484
-
2485
- var dragState = this.dragState;
2486
- this.$on('tree-node-drag-start', function (event, treeNode) {
2487
- if (typeof _this.allowDrag === 'function' && !_this.allowDrag(treeNode.node)) {
2488
- event.preventDefault();
2489
- return false;
2490
- }
2491
- event.dataTransfer.effectAllowed = 'move';
2492
-
2493
- // wrap in try catch to address IE's error when first param is 'text/plain'
2494
- try {
2495
- // setData is required for draggable to work in FireFox
2496
- // the content has to be '' so dragging a node out of the tree won't open a new tab in FireFox
2497
- event.dataTransfer.setData('text/plain', '');
2498
- } catch (e) {}
2499
- dragState.draggingNode = treeNode;
2500
- _this.$emit('node-drag-start', treeNode.node, event);
2501
- });
2502
-
2503
- this.$on('tree-node-drag-over', function (event, treeNode) {
2504
- var dropNode = findNearestComponent(event.target, 'ElTreeNode');
2505
- var oldDropNode = dragState.dropNode;
2506
- if (oldDropNode && oldDropNode !== dropNode) {
2507
- Object(dom_["removeClass"])(oldDropNode.$el, 'is-drop-inner');
2508
- }
2509
- var draggingNode = dragState.draggingNode;
2510
- if (!draggingNode || !dropNode) return;
2511
-
2512
- var dropPrev = true;
2513
- var dropInner = true;
2514
- var dropNext = true;
2515
- var userAllowDropInner = true;
2516
- if (typeof _this.allowDrop === 'function') {
2517
- dropPrev = _this.allowDrop(draggingNode.node, dropNode.node, 'prev');
2518
- userAllowDropInner = dropInner = _this.allowDrop(draggingNode.node, dropNode.node, 'inner');
2519
- dropNext = _this.allowDrop(draggingNode.node, dropNode.node, 'next');
2520
- }
2521
- event.dataTransfer.dropEffect = dropInner ? 'move' : 'none';
2522
- if ((dropPrev || dropInner || dropNext) && oldDropNode !== dropNode) {
2523
- if (oldDropNode) {
2524
- _this.$emit('node-drag-leave', draggingNode.node, oldDropNode.node, event);
2525
- }
2526
- _this.$emit('node-drag-enter', draggingNode.node, dropNode.node, event);
2527
- }
2528
-
2529
- if (dropPrev || dropInner || dropNext) {
2530
- dragState.dropNode = dropNode;
2531
- }
2532
-
2533
- if (dropNode.node.nextSibling === draggingNode.node) {
2534
- dropNext = false;
2535
- }
2536
- if (dropNode.node.previousSibling === draggingNode.node) {
2537
- dropPrev = false;
2538
- }
2539
- if (dropNode.node.contains(draggingNode.node, false)) {
2540
- dropInner = false;
2541
- }
2542
- if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
2543
- dropPrev = false;
2544
- dropInner = false;
2545
- dropNext = false;
2546
- }
2547
-
2548
- var targetPosition = dropNode.$el.getBoundingClientRect();
2549
- var treePosition = _this.$el.getBoundingClientRect();
2550
-
2551
- var dropType = void 0;
2552
- var prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
2553
- var nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
2554
-
2555
- var indicatorTop = -9999;
2556
- var distance = event.clientY - targetPosition.top;
2557
- if (distance < targetPosition.height * prevPercent) {
2558
- dropType = 'before';
2559
- } else if (distance > targetPosition.height * nextPercent) {
2560
- dropType = 'after';
2561
- } else if (dropInner) {
2562
- dropType = 'inner';
2563
- } else {
2564
- dropType = 'none';
2565
- }
2566
-
2567
- var iconPosition = dropNode.$el.querySelector('.el-tree-node__expand-icon').getBoundingClientRect();
2568
- var dropIndicator = _this.$refs.dropIndicator;
2569
- if (dropType === 'before') {
2570
- indicatorTop = iconPosition.top - treePosition.top;
2571
- } else if (dropType === 'after') {
2572
- indicatorTop = iconPosition.bottom - treePosition.top;
2573
- }
2574
- dropIndicator.style.top = indicatorTop + 'px';
2575
- dropIndicator.style.left = iconPosition.right - treePosition.left + 'px';
2576
-
2577
- if (dropType === 'inner') {
2578
- Object(dom_["addClass"])(dropNode.$el, 'is-drop-inner');
2579
- } else {
2580
- Object(dom_["removeClass"])(dropNode.$el, 'is-drop-inner');
2581
- }
2582
-
2583
- dragState.showDropIndicator = dropType === 'before' || dropType === 'after';
2584
- dragState.allowDrop = dragState.showDropIndicator || userAllowDropInner;
2585
- dragState.dropType = dropType;
2586
- _this.$emit('node-drag-over', draggingNode.node, dropNode.node, event);
2587
- });
2588
-
2589
- this.$on('tree-node-drag-end', function (event) {
2590
- var draggingNode = dragState.draggingNode,
2591
- dropType = dragState.dropType,
2592
- dropNode = dragState.dropNode;
2593
-
2594
- event.preventDefault();
2595
- event.dataTransfer.dropEffect = 'move';
2596
-
2597
- if (draggingNode && dropNode) {
2598
- var draggingNodeCopy = { data: draggingNode.node.data };
2599
- if (dropType !== 'none') {
2600
- draggingNode.node.remove();
2601
- }
2602
- if (dropType === 'before') {
2603
- dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
2604
- } else if (dropType === 'after') {
2605
- dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
2606
- } else if (dropType === 'inner') {
2607
- dropNode.node.insertChild(draggingNodeCopy);
2608
- }
2609
- if (dropType !== 'none') {
2610
- _this.store.registerNode(draggingNodeCopy);
2611
- }
2612
-
2613
- Object(dom_["removeClass"])(dropNode.$el, 'is-drop-inner');
2614
-
2615
- _this.$emit('node-drag-end', draggingNode.node, dropNode.node, dropType, event);
2616
- if (dropType !== 'none') {
2617
- _this.$emit('node-drop', draggingNode.node, dropNode.node, dropType, event);
2618
- }
2619
- }
2620
- if (draggingNode && !dropNode) {
2621
- _this.$emit('node-drag-end', draggingNode.node, null, dropType, event);
2622
- }
2623
-
2624
- dragState.showDropIndicator = false;
2625
- dragState.draggingNode = null;
2626
- dragState.dropNode = null;
2627
- dragState.allowDrop = true;
2628
- });
2629
- },
2630
- mounted: function mounted() {
2631
- this.initTabIndex();
2632
- this.$el.addEventListener('keydown', this.handleKeydown);
2633
- },
2634
- updated: function updated() {
2635
- this.treeItems = this.$el.querySelectorAll('[role=treeitem]');
2636
- this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
2637
- }
2638
- });
2639
- // CONCATENATED MODULE: ./packages/tree/src/tree.vue?vue&type=script&lang=js
2640
- /* harmony default export */ var src_treevue_type_script_lang_js = (treevue_type_script_lang_js);
2641
- // CONCATENATED MODULE: ./packages/tree/src/tree.vue
2642
-
2643
-
2644
-
2645
-
2646
-
2647
- /* normalize component */
2648
-
2649
- var tree_component = Object(componentNormalizer["a" /* default */])(
2650
- src_treevue_type_script_lang_js,
2651
- render,
2652
- staticRenderFns,
2653
- false,
2654
- null,
2655
- null,
2656
- null
2657
-
2658
- )
2659
-
2660
- /* harmony default export */ var tree = (tree_component.exports);
2661
- // CONCATENATED MODULE: ./packages/tree/index.js
2662
-
2663
-
2664
- /* istanbul ignore next */
2665
- tree.install = function (Vue) {
2666
- Vue.component(tree.name, tree);
2667
- };
2668
-
2669
- /* harmony default export */ var packages_tree = __webpack_exports__["default"] = (tree);
2670
-
2671
- /***/ }),
2672
-
2673
- /***/ 6:
2674
- /***/ (function(module, exports) {
2675
-
2676
- module.exports = require("element-ui/lib/utils/merge");
2677
-
2678
- /***/ })
2679
-
2680
- /******/ });