mazey-element-ui 2.0.1 → 2.15.16
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.
- package/LICENSE +2 -2
- package/README.md +71 -68
- package/lib/alert.js +271 -262
- package/lib/aside.js +134 -200
- package/lib/autocomplete.js +500 -443
- package/lib/avatar.js +284 -0
- package/lib/backtop.js +336 -0
- package/lib/badge.js +188 -221
- package/lib/breadcrumb-item.js +176 -226
- package/lib/breadcrumb.js +150 -213
- package/lib/button-group.js +121 -190
- package/lib/button.js +213 -268
- package/lib/calendar.js +801 -0
- package/lib/card.js +156 -203
- package/lib/carousel-item.js +242 -264
- package/lib/carousel.js +386 -284
- package/lib/cascader-panel.js +1323 -0
- package/lib/cascader.js +1000 -1116
- package/lib/checkbox-button.js +388 -327
- package/lib/checkbox-group.js +168 -233
- package/lib/checkbox.js +422 -350
- package/lib/col.js +58 -112
- package/lib/collapse-item.js +335 -327
- package/lib/collapse.js +177 -246
- package/lib/color-picker.js +1128 -1231
- package/lib/container.js +144 -211
- package/lib/date-picker.js +4316 -2745
- package/lib/descriptions-item.js +88 -0
- package/lib/descriptions.js +342 -0
- package/lib/dialog.js +359 -337
- package/lib/directives/mousewheel.js +6 -12
- package/lib/directives/repeat-click.js +10 -10
- package/lib/divider.js +251 -0
- package/lib/drawer.js +523 -0
- package/lib/dropdown-item.js +175 -228
- package/lib/dropdown-menu.js +203 -253
- package/lib/dropdown.js +286 -384
- package/lib/element-ui.common.js +34136 -25458
- package/lib/empty.js +657 -0
- package/lib/footer.js +134 -200
- package/lib/form-item.js +401 -304
- package/lib/form.js +278 -297
- package/lib/header.js +134 -200
- package/lib/icon.js +123 -193
- package/lib/image.js +1005 -0
- package/lib/index.js +1 -1
- package/lib/infinite-scroll.js +219 -0
- package/lib/input-number.js +442 -386
- package/lib/input.js +682 -512
- package/lib/link.js +267 -0
- package/lib/loading.js +278 -377
- package/lib/locale/format.js +14 -25
- package/lib/locale/index.js +19 -33
- package/lib/locale/lang/af-ZA.js +29 -8
- package/lib/locale/lang/ar.js +29 -14
- package/lib/locale/lang/az.js +127 -0
- package/lib/locale/lang/bg.js +35 -11
- package/lib/locale/lang/bn.js +126 -0
- package/lib/locale/lang/ca.js +24 -9
- package/lib/locale/lang/cs-CZ.js +19 -3
- package/lib/locale/lang/da.js +19 -3
- package/lib/locale/lang/de.js +19 -3
- package/lib/locale/lang/ee.js +24 -8
- package/lib/locale/lang/el.js +20 -4
- package/lib/locale/lang/en.js +25 -7
- package/lib/locale/lang/eo.js +128 -0
- package/lib/locale/lang/es.js +22 -7
- package/lib/locale/lang/eu.js +131 -0
- package/lib/locale/lang/fa.js +24 -8
- package/lib/locale/lang/fi.js +40 -24
- package/lib/locale/lang/fr.js +21 -4
- package/lib/locale/lang/he.js +29 -8
- package/lib/locale/lang/hr.js +131 -0
- package/lib/locale/lang/hu.js +20 -4
- package/lib/locale/lang/hy-AM.js +128 -0
- package/lib/locale/lang/id.js +23 -8
- package/lib/locale/lang/is.js +127 -0
- package/lib/locale/lang/it.js +21 -6
- package/lib/locale/lang/ja.js +19 -3
- package/lib/locale/lang/kg.js +128 -0
- package/lib/locale/lang/km.js +21 -6
- package/lib/locale/lang/ko.js +19 -3
- package/lib/locale/lang/ku.js +19 -3
- package/lib/locale/lang/kz.js +19 -3
- package/lib/locale/lang/lt.js +19 -3
- package/lib/locale/lang/lv.js +26 -10
- package/lib/locale/lang/mn.js +19 -3
- package/lib/locale/lang/ms.js +126 -0
- package/lib/locale/lang/nb-NO.js +28 -13
- package/lib/locale/lang/nl.js +19 -3
- package/lib/locale/lang/pl.js +19 -3
- package/lib/locale/lang/pt-br.js +18 -3
- package/lib/locale/lang/pt.js +35 -11
- package/lib/locale/lang/ro.js +19 -3
- package/lib/locale/lang/ru-RU.js +20 -5
- package/lib/locale/lang/si.js +130 -0
- package/lib/locale/lang/sk.js +23 -8
- package/lib/locale/lang/sl.js +26 -10
- package/lib/locale/lang/sr-Latn.js +127 -0
- package/lib/locale/lang/sr.js +131 -0
- package/lib/locale/lang/sv-SE.js +34 -15
- package/lib/locale/lang/sw.js +130 -0
- package/lib/locale/lang/ta.js +31 -9
- package/lib/locale/lang/th.js +30 -12
- package/lib/locale/lang/tk.js +27 -7
- package/lib/locale/lang/tr-TR.js +20 -4
- package/lib/locale/lang/ua.js +20 -5
- package/lib/locale/lang/ug-CN.js +22 -7
- package/lib/locale/lang/uz-UZ.js +127 -0
- package/lib/locale/lang/vi.js +23 -8
- package/lib/locale/lang/zh-CN.js +18 -3
- package/lib/locale/lang/zh-TW.js +25 -6
- package/lib/main.js +123 -192
- package/lib/menu-item-group.js +164 -225
- package/lib/menu-item.js +300 -333
- package/lib/menu.js +401 -576
- package/lib/message-box.js +730 -614
- package/lib/message.js +289 -327
- package/lib/mixins/emitter.js +2 -4
- package/lib/mixins/focus.js +3 -4
- package/lib/mixins/locale.js +5 -7
- package/lib/mixins/migrating.js +19 -21
- package/lib/notification.js +366 -394
- package/lib/option-group.js +198 -250
- package/lib/option.js +247 -291
- package/lib/page-header.js +248 -0
- package/lib/pagination.js +485 -635
- package/lib/popconfirm.js +381 -0
- package/lib/popover.js +361 -396
- package/lib/progress.js +387 -261
- package/lib/radio-button.js +319 -309
- package/lib/radio-group.js +224 -282
- package/lib/radio.js +347 -328
- package/lib/rate.js +286 -305
- package/lib/result.js +513 -0
- package/lib/row.js +59 -110
- package/lib/scrollbar.js +234 -344
- package/lib/select.js +1041 -806
- package/lib/skeleton-item.js +278 -0
- package/lib/skeleton.js +308 -0
- package/lib/slider.js +608 -467
- package/lib/spinner.js +160 -207
- package/lib/statistic.js +462 -0
- package/lib/step.js +270 -262
- package/lib/steps.js +198 -261
- package/lib/submenu.js +318 -420
- package/lib/switch.js +311 -281
- package/lib/tab-pane.js +185 -245
- package/lib/table-column.js +667 -414
- package/lib/table.js +3388 -2770
- package/lib/tabs.js +577 -648
- package/lib/tag.js +160 -227
- package/lib/theme-chalk/alert.css +1 -1
- package/lib/theme-chalk/aside.css +1 -1
- package/lib/theme-chalk/autocomplete.css +1 -1
- package/lib/theme-chalk/avatar.css +1 -0
- package/lib/theme-chalk/backtop.css +1 -0
- package/lib/theme-chalk/badge.css +1 -1
- package/lib/theme-chalk/base.css +1 -1
- package/lib/theme-chalk/breadcrumb.css +1 -1
- package/lib/theme-chalk/button.css +1 -1
- package/lib/theme-chalk/calendar.css +1 -0
- package/lib/theme-chalk/card.css +1 -1
- package/lib/theme-chalk/carousel-item.css +1 -1
- package/lib/theme-chalk/carousel.css +1 -1
- package/lib/theme-chalk/cascader-panel.css +1 -0
- package/lib/theme-chalk/cascader.css +1 -1
- package/lib/theme-chalk/checkbox.css +1 -1
- package/lib/theme-chalk/col.css +1 -1
- package/lib/theme-chalk/collapse.css +1 -1
- package/lib/theme-chalk/color-picker.css +1 -1
- package/lib/theme-chalk/container.css +1 -1
- package/lib/theme-chalk/date-picker.css +1 -1
- package/lib/theme-chalk/descriptions-item.css +1 -0
- package/lib/theme-chalk/descriptions.css +1 -0
- package/lib/theme-chalk/dialog.css +1 -1
- package/lib/theme-chalk/display.css +1 -1
- package/lib/theme-chalk/divider.css +1 -0
- package/lib/theme-chalk/drawer.css +1 -0
- package/lib/theme-chalk/dropdown.css +1 -1
- package/lib/theme-chalk/empty.css +1 -0
- package/lib/theme-chalk/fonts/element-icons.ttf +0 -0
- package/lib/theme-chalk/fonts/element-icons.woff +0 -0
- package/lib/theme-chalk/footer.css +1 -1
- package/lib/theme-chalk/form.css +1 -1
- package/lib/theme-chalk/header.css +1 -1
- package/lib/theme-chalk/icon.css +1 -1
- package/lib/theme-chalk/image.css +1 -0
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/input-number.css +1 -1
- package/lib/theme-chalk/input.css +1 -1
- package/lib/theme-chalk/link.css +1 -0
- package/lib/theme-chalk/loading.css +1 -1
- package/lib/theme-chalk/main.css +1 -1
- package/lib/theme-chalk/menu.css +1 -1
- package/lib/theme-chalk/message-box.css +1 -1
- package/lib/theme-chalk/message.css +1 -1
- package/lib/theme-chalk/notification.css +1 -1
- package/lib/theme-chalk/option-group.css +1 -1
- package/lib/theme-chalk/option.css +1 -1
- package/lib/theme-chalk/page-header.css +1 -0
- package/lib/theme-chalk/pagination.css +1 -1
- package/lib/theme-chalk/popconfirm.css +1 -0
- package/lib/theme-chalk/popover.css +1 -1
- package/lib/theme-chalk/popper.css +1 -1
- package/lib/theme-chalk/progress.css +1 -1
- package/lib/theme-chalk/radio-button.css +1 -1
- package/lib/theme-chalk/radio.css +1 -1
- package/lib/theme-chalk/rate.css +1 -1
- package/lib/theme-chalk/reset.css +1 -1
- package/lib/theme-chalk/result.css +1 -0
- package/lib/theme-chalk/row.css +1 -1
- package/lib/theme-chalk/scrollbar.css +1 -1
- package/lib/theme-chalk/select-dropdown.css +1 -1
- package/lib/theme-chalk/select.css +1 -1
- package/lib/theme-chalk/skeleton-item.css +1 -0
- package/lib/theme-chalk/skeleton.css +1 -0
- package/lib/theme-chalk/slider.css +1 -1
- package/lib/theme-chalk/spinner.css +1 -1
- package/lib/theme-chalk/statistic.css +1 -0
- package/lib/theme-chalk/step.css +1 -1
- package/lib/theme-chalk/steps.css +1 -1
- package/lib/theme-chalk/switch.css +1 -1
- package/lib/theme-chalk/table-column.css +1 -1
- package/lib/theme-chalk/table.css +1 -1
- package/lib/theme-chalk/tabs.css +1 -1
- package/lib/theme-chalk/tag.css +1 -1
- package/lib/theme-chalk/time-picker.css +1 -1
- package/lib/theme-chalk/time-select.css +1 -1
- package/lib/theme-chalk/timeline-item.css +1 -0
- package/lib/theme-chalk/timeline.css +1 -0
- package/lib/theme-chalk/tooltip.css +1 -1
- package/lib/theme-chalk/transfer.css +1 -1
- package/lib/theme-chalk/tree.css +1 -1
- package/lib/theme-chalk/upload.css +1 -1
- package/lib/time-picker.js +1548 -1348
- package/lib/time-select.js +633 -853
- package/lib/timeline-item.js +301 -0
- package/lib/timeline.js +207 -0
- package/lib/tooltip.js +166 -240
- package/lib/transfer.js +731 -639
- package/lib/transitions/collapse-transition.js +13 -31
- package/lib/tree.js +1769 -1883
- package/lib/umd/locale/af-ZA.js +35 -14
- package/lib/umd/locale/ar.js +35 -20
- package/lib/umd/locale/az.js +143 -0
- package/lib/umd/locale/bg.js +41 -17
- package/lib/umd/locale/bn.js +142 -0
- package/lib/umd/locale/ca.js +30 -15
- package/lib/umd/locale/cs-CZ.js +25 -9
- package/lib/umd/locale/da.js +25 -9
- package/lib/umd/locale/de.js +25 -9
- package/lib/umd/locale/ee.js +30 -14
- package/lib/umd/locale/el.js +26 -10
- package/lib/umd/locale/en.js +31 -13
- package/lib/umd/locale/eo.js +144 -0
- package/lib/umd/locale/es.js +28 -13
- package/lib/umd/locale/eu.js +147 -0
- package/lib/umd/locale/fa.js +30 -14
- package/lib/umd/locale/fi.js +46 -30
- package/lib/umd/locale/fr.js +27 -10
- package/lib/umd/locale/he.js +35 -14
- package/lib/umd/locale/hr.js +147 -0
- package/lib/umd/locale/hu.js +26 -10
- package/lib/umd/locale/hy-AM.js +144 -0
- package/lib/umd/locale/id.js +29 -14
- package/lib/umd/locale/is.js +143 -0
- package/lib/umd/locale/it.js +27 -12
- package/lib/umd/locale/ja.js +25 -9
- package/lib/umd/locale/kg.js +144 -0
- package/lib/umd/locale/km.js +27 -12
- package/lib/umd/locale/ko.js +25 -9
- package/lib/umd/locale/ku.js +25 -9
- package/lib/umd/locale/kz.js +25 -9
- package/lib/umd/locale/lt.js +25 -9
- package/lib/umd/locale/lv.js +32 -16
- package/lib/umd/locale/mn.js +25 -9
- package/lib/umd/locale/ms.js +142 -0
- package/lib/umd/locale/nb-NO.js +34 -19
- package/lib/umd/locale/nl.js +25 -9
- package/lib/umd/locale/pl.js +25 -9
- package/lib/umd/locale/pt-br.js +24 -9
- package/lib/umd/locale/pt.js +41 -17
- package/lib/umd/locale/ro.js +25 -9
- package/lib/umd/locale/ru-RU.js +26 -11
- package/lib/umd/locale/si.js +146 -0
- package/lib/umd/locale/sk.js +29 -14
- package/lib/umd/locale/sl.js +32 -16
- package/lib/umd/locale/sr-Latn.js +143 -0
- package/lib/umd/locale/sr.js +147 -0
- package/lib/umd/locale/sv-SE.js +40 -21
- package/lib/umd/locale/sw.js +146 -0
- package/lib/umd/locale/ta.js +37 -15
- package/lib/umd/locale/th.js +36 -18
- package/lib/umd/locale/tk.js +33 -13
- package/lib/umd/locale/tr-TR.js +26 -10
- package/lib/umd/locale/ua.js +26 -11
- package/lib/umd/locale/ug-CN.js +28 -13
- package/lib/umd/locale/uz-UZ.js +143 -0
- package/lib/umd/locale/vi.js +29 -14
- package/lib/umd/locale/zh-CN.js +24 -9
- package/lib/umd/locale/zh-TW.js +31 -12
- package/lib/upload.js +1093 -1338
- package/lib/utils/after-leave.js +19 -16
- package/lib/utils/aria-dialog.js +11 -29
- package/lib/utils/aria-utils.js +7 -15
- package/lib/utils/clickoutside.js +16 -24
- package/lib/utils/date-util.js +267 -0
- package/lib/utils/date.js +56 -52
- package/lib/utils/dom.js +57 -27
- package/lib/utils/lodash.js +9421 -0
- package/lib/utils/menu/aria-menubar.js +6 -11
- package/lib/utils/menu/aria-menuitem.js +11 -22
- package/lib/utils/menu/aria-submenu.js +7 -16
- package/lib/utils/merge.js +9 -16
- package/lib/utils/popper.js +1141 -1170
- package/lib/utils/popup/index.js +24 -76
- package/lib/utils/popup/popup-manager.js +17 -49
- package/lib/utils/resize-event.js +11 -24
- package/lib/utils/scroll-into-view.js +4 -12
- package/lib/utils/scrollbar-width.js +8 -19
- package/lib/utils/types.js +38 -0
- package/lib/utils/util.js +165 -18
- package/lib/utils/vdom.js +5 -16
- package/lib/utils/vue-popper.js +10 -31
- package/package.json +131 -139
- package/packages/alert/src/main.vue +15 -8
- package/packages/autocomplete/src/autocomplete-suggestions.vue +4 -4
- package/packages/autocomplete/src/autocomplete.vue +45 -14
- package/packages/avatar/index.js +8 -0
- package/packages/avatar/src/main.vue +107 -0
- package/packages/backtop/index.js +8 -0
- package/packages/backtop/src/main.vue +110 -0
- package/packages/badge/src/main.vue +15 -3
- package/packages/button/src/button.vue +2 -1
- package/packages/calendar/index.js +8 -0
- package/packages/calendar/src/date-table.vue +200 -0
- package/packages/calendar/src/main.vue +280 -0
- package/packages/carousel/src/item.vue +36 -12
- package/packages/carousel/src/main.vue +83 -22
- package/packages/cascader/index.js +1 -1
- package/packages/cascader/src/cascader.vue +663 -0
- package/packages/cascader-panel/index.js +8 -0
- package/packages/cascader-panel/src/cascader-menu.vue +138 -0
- package/packages/cascader-panel/src/cascader-node.vue +246 -0
- package/packages/cascader-panel/src/cascader-panel.vue +391 -0
- package/packages/cascader-panel/src/node.js +166 -0
- package/packages/cascader-panel/src/store.js +58 -0
- package/packages/checkbox/src/checkbox-button.vue +11 -3
- package/packages/checkbox/src/checkbox-group.vue +1 -1
- package/packages/checkbox/src/checkbox.vue +15 -8
- package/packages/collapse/src/collapse-item.vue +12 -11
- package/packages/color-picker/src/color.js +1 -0
- package/packages/color-picker/src/components/picker-dropdown.vue +10 -6
- package/packages/color-picker/src/components/sv-panel.vue +1 -3
- package/packages/color-picker/src/main.vue +13 -4
- package/packages/date-picker/src/basic/date-table.vue +104 -168
- package/packages/date-picker/src/basic/month-table.vue +223 -58
- package/packages/date-picker/src/basic/time-spinner.vue +31 -15
- package/packages/date-picker/src/basic/year-table.vue +16 -5
- package/packages/date-picker/src/panel/date-range.vue +105 -48
- package/packages/date-picker/src/panel/date.vue +82 -39
- package/packages/date-picker/src/panel/month-range.vue +289 -0
- package/packages/date-picker/src/panel/time-range.vue +2 -2
- package/packages/date-picker/src/panel/time-select.vue +3 -2
- package/packages/date-picker/src/panel/time.vue +2 -2
- package/packages/date-picker/src/picker/date-picker.js +3 -0
- package/packages/date-picker/src/picker.vue +87 -43
- package/packages/descriptions/index.js +8 -0
- package/packages/descriptions/src/descriptions-item.js +30 -0
- package/packages/descriptions/src/descriptions-row.js +116 -0
- package/packages/descriptions/src/index.js +180 -0
- package/packages/descriptions-item/index.js +8 -0
- package/packages/dialog/src/component.vue +35 -12
- package/packages/divider/index.js +8 -0
- package/packages/divider/src/main.vue +37 -0
- package/packages/drawer/index.js +8 -0
- package/packages/drawer/src/main.vue +205 -0
- package/packages/dropdown/src/dropdown-item.vue +4 -2
- package/packages/dropdown/src/dropdown-menu.vue +6 -3
- package/packages/dropdown/src/dropdown.vue +55 -35
- package/packages/empty/index.js +7 -0
- package/packages/empty/src/img-empty.vue +132 -0
- package/packages/empty/src/index.vue +50 -0
- package/packages/form/src/form-item.vue +76 -44
- package/packages/form/src/form.vue +59 -11
- package/packages/form/src/label-wrap.vue +78 -0
- package/packages/image/index.js +8 -0
- package/packages/image/src/image-viewer.vue +330 -0
- package/packages/image/src/main.vue +249 -0
- package/packages/infinite-scroll/index.js +8 -0
- package/packages/infinite-scroll/src/main.js +150 -0
- package/packages/input/src/input.vue +186 -75
- package/packages/input-number/src/input-number.vue +52 -25
- package/packages/link/index.js +8 -0
- package/packages/link/src/main.vue +53 -0
- package/packages/loading/src/directive.js +9 -4
- package/packages/loading/src/index.js +5 -5
- package/packages/menu/src/menu-item.vue +4 -4
- package/packages/menu/src/menu.vue +24 -10
- package/packages/menu/src/submenu.vue +26 -12
- package/packages/message/src/main.js +35 -16
- package/packages/message/src/main.vue +12 -15
- package/packages/message-box/src/main.js +6 -4
- package/packages/message-box/src/main.vue +32 -24
- package/packages/notification/src/main.js +9 -8
- package/packages/page-header/index.js +8 -0
- package/packages/page-header/src/main.vue +30 -0
- package/packages/pagination/src/pagination.js +36 -77
- package/packages/popconfirm/index.js +8 -0
- package/packages/popconfirm/src/main.vue +104 -0
- package/packages/popover/src/directive.js +5 -1
- package/packages/popover/src/main.vue +49 -31
- package/packages/progress/src/progress.vue +118 -21
- package/packages/radio/index.js +1 -1
- package/packages/radio/src/radio-button.vue +7 -3
- package/packages/radio/src/radio-group.vue +9 -3
- package/packages/radio/src/radio.vue +6 -3
- package/packages/rate/src/main.vue +36 -37
- package/packages/result/index.js +8 -0
- package/packages/result/src/icon-error.vue +13 -0
- package/packages/result/src/icon-info.vue +13 -0
- package/packages/result/src/icon-success.vue +13 -0
- package/packages/result/src/icon-warning.vue +13 -0
- package/packages/result/src/index.vue +65 -0
- package/packages/row/src/row.js +2 -5
- package/packages/scrollbar/src/bar.js +5 -1
- package/packages/scrollbar/src/main.js +3 -3
- package/packages/select/src/option-group.vue +1 -1
- package/packages/select/src/option.vue +22 -9
- package/packages/select/src/select-dropdown.vue +1 -1
- package/packages/select/src/select.vue +126 -105
- package/packages/skeleton/index.js +8 -0
- package/packages/skeleton/src/img-placeholder.vue +16 -0
- package/packages/skeleton/src/index.vue +76 -0
- package/packages/skeleton/src/item.vue +22 -0
- package/packages/skeleton-item/index.js +8 -0
- package/packages/slider/src/button.vue +6 -9
- package/packages/slider/src/main.vue +60 -32
- package/packages/slider/src/marker.js +18 -0
- package/packages/spinner/src/spinner.vue +1 -1
- package/packages/statistic/index.js +8 -0
- package/packages/statistic/src/main.vue +204 -0
- package/packages/steps/src/step.vue +5 -1
- package/packages/steps/src/steps.vue +1 -1
- package/packages/switch/src/component.vue +18 -7
- package/packages/table/src/config.js +124 -0
- package/packages/table/src/filter-panel.vue +9 -18
- package/packages/table/src/layout-observer.js +2 -2
- package/packages/table/src/store/current.js +76 -0
- package/packages/table/src/store/expand.js +65 -0
- package/packages/table/src/store/helper.js +41 -0
- package/packages/table/src/store/index.js +147 -0
- package/packages/table/src/store/tree.js +209 -0
- package/packages/table/src/store/watcher.js +381 -0
- package/packages/table/src/table-body.js +221 -166
- package/packages/table/src/table-column.js +203 -308
- package/packages/table/src/table-footer.js +75 -65
- package/packages/table/src/table-header.js +68 -77
- package/packages/table/src/table-layout.js +43 -25
- package/packages/table/src/table-row.js +101 -0
- package/packages/table/src/table.vue +155 -99
- package/packages/table/src/util.js +164 -1
- package/packages/tabs/src/tab-bar.vue +7 -7
- package/packages/tabs/src/tab-nav.vue +35 -14
- package/packages/tabs/src/tab-pane.vue +10 -18
- package/packages/tabs/src/tabs.vue +45 -22
- package/packages/tag/src/tag.vue +35 -18
- package/packages/theme-chalk/gulpfile.js +33 -0
- package/packages/theme-chalk/package.json +36 -0
- package/packages/theme-chalk/src/alert.scss +57 -15
- package/packages/theme-chalk/src/autocomplete.scss +3 -4
- package/packages/theme-chalk/src/avatar.scss +51 -0
- package/packages/theme-chalk/src/backtop.scss +22 -0
- package/packages/theme-chalk/src/badge.scss +17 -1
- package/packages/theme-chalk/src/button.scss +40 -20
- package/packages/theme-chalk/src/calendar.scss +79 -0
- package/packages/theme-chalk/src/carousel.scss +33 -6
- package/packages/theme-chalk/src/cascader-panel.scss +120 -0
- package/packages/theme-chalk/src/cascader.scss +118 -112
- package/packages/theme-chalk/src/checkbox.scss +18 -17
- package/packages/theme-chalk/src/collapse.scss +16 -9
- package/packages/theme-chalk/src/common/popup.scss +3 -2
- package/packages/theme-chalk/src/common/var.scss +500 -184
- package/packages/theme-chalk/src/date-picker/date-picker.scss +1 -1
- package/packages/theme-chalk/src/date-picker/date-range-picker.scss +4 -7
- package/packages/theme-chalk/src/date-picker/date-table.scss +11 -11
- package/packages/theme-chalk/src/date-picker/month-table.scss +48 -6
- package/packages/theme-chalk/src/date-picker/picker-panel.scss +3 -3
- package/packages/theme-chalk/src/date-picker/picker.scss +7 -0
- package/packages/theme-chalk/src/date-picker/time-picker.scss +1 -0
- package/packages/theme-chalk/src/date-picker/year-table.scss +9 -2
- package/packages/theme-chalk/src/descriptions-item.scss +42 -0
- package/packages/theme-chalk/src/descriptions.scss +111 -0
- package/packages/theme-chalk/src/dialog.scss +5 -4
- package/packages/theme-chalk/src/divider.scss +47 -0
- package/packages/theme-chalk/src/drawer.scss +219 -0
- package/packages/theme-chalk/src/dropdown.scss +14 -1
- package/packages/theme-chalk/src/empty.scss +45 -0
- package/packages/theme-chalk/src/fonts/element-icons.ttf +0 -0
- package/packages/theme-chalk/src/fonts/element-icons.woff +0 -0
- package/packages/theme-chalk/src/form.scss +18 -23
- package/packages/theme-chalk/src/icon.scss +1052 -71
- package/packages/theme-chalk/src/image.scss +179 -0
- package/packages/theme-chalk/src/index.scss +20 -0
- package/packages/theme-chalk/src/input.scss +56 -5
- package/packages/theme-chalk/src/link.scss +81 -0
- package/packages/theme-chalk/src/main.scss +2 -0
- package/packages/theme-chalk/src/menu.scss +11 -8
- package/packages/theme-chalk/src/message-box.scss +14 -11
- package/packages/theme-chalk/src/message.scss +10 -10
- package/packages/theme-chalk/src/notification.scss +8 -7
- package/packages/theme-chalk/src/option.scss +1 -5
- package/packages/theme-chalk/src/page-header.scss +41 -0
- package/packages/theme-chalk/src/pagination.scss +9 -10
- package/packages/theme-chalk/src/popconfirm.scss +16 -0
- package/packages/theme-chalk/src/popover.scss +3 -2
- package/packages/theme-chalk/src/popper.scss +4 -4
- package/packages/theme-chalk/src/progress.scss +13 -1
- package/packages/theme-chalk/src/radio-button.scss +8 -8
- package/packages/theme-chalk/src/radio.scss +7 -6
- package/packages/theme-chalk/src/result.scss +61 -0
- package/packages/theme-chalk/src/row.scss +4 -0
- package/packages/theme-chalk/src/scrollbar.scss +1 -0
- package/packages/theme-chalk/src/select-dropdown.scss +5 -2
- package/packages/theme-chalk/src/select.scss +14 -6
- package/packages/theme-chalk/src/skeleton-item.scss +84 -0
- package/packages/theme-chalk/src/skeleton.scss +40 -0
- package/packages/theme-chalk/src/slider.scss +22 -0
- package/packages/theme-chalk/src/statistic.scss +38 -0
- package/packages/theme-chalk/src/switch.scss +0 -3
- package/packages/theme-chalk/src/table.scss +67 -60
- package/packages/theme-chalk/src/tabs.scss +58 -32
- package/packages/theme-chalk/src/tag.scss +85 -68
- package/packages/theme-chalk/src/timeline-item.scss +86 -0
- package/packages/theme-chalk/src/timeline.scss +14 -0
- package/packages/theme-chalk/src/tooltip.scss +1 -0
- package/packages/theme-chalk/src/transfer.scss +2 -2
- package/packages/theme-chalk/src/tree.scss +8 -5
- package/packages/theme-chalk/src/upload.scss +1 -0
- package/packages/timeline/index.js +8 -0
- package/packages/timeline/src/item.vue +73 -0
- package/packages/timeline/src/main.vue +33 -0
- package/packages/timeline-item/index.js +8 -0
- package/packages/tooltip/src/main.js +52 -26
- package/packages/transfer/src/main.vue +15 -7
- package/packages/transfer/src/transfer-panel.vue +4 -4
- package/packages/tree/src/model/node.js +27 -21
- package/packages/tree/src/model/tree-store.js +22 -16
- package/packages/tree/src/tree-node.vue +16 -10
- package/packages/tree/src/tree.vue +41 -27
- package/packages/upload/src/index.vue +42 -13
- package/packages/upload/src/upload-list.vue +46 -41
- package/src/directives/repeat-click.js +6 -4
- package/src/index.js +66 -8
- package/src/locale/format.js +1 -1
- package/src/locale/index.js +1 -1
- package/src/locale/lang/af-ZA.js +15 -1
- package/src/locale/lang/ar.js +26 -12
- package/src/locale/lang/az.js +126 -0
- package/src/locale/lang/bg.js +15 -1
- package/src/locale/lang/bn.js +126 -0
- package/src/locale/lang/ca.js +21 -7
- package/src/locale/lang/cs-CZ.js +15 -1
- package/src/locale/lang/da.js +15 -1
- package/src/locale/lang/de.js +15 -1
- package/src/locale/lang/ee.js +20 -6
- package/src/locale/lang/el.js +16 -2
- package/src/locale/lang/en.js +16 -2
- package/src/locale/lang/eo.js +123 -0
- package/src/locale/lang/es.js +19 -5
- package/src/locale/lang/eu.js +123 -0
- package/src/locale/lang/fa.js +20 -6
- package/src/locale/lang/fi.js +36 -22
- package/src/locale/lang/fr.js +15 -1
- package/src/locale/lang/he.js +15 -1
- package/src/locale/lang/hr.js +123 -0
- package/src/locale/lang/hu.js +16 -2
- package/src/locale/lang/hy-AM.js +123 -0
- package/src/locale/lang/id.js +20 -6
- package/src/locale/lang/is.js +124 -0
- package/src/locale/lang/it.js +18 -4
- package/src/locale/lang/ja.js +15 -1
- package/src/locale/lang/kg.js +123 -0
- package/src/locale/lang/km.js +18 -4
- package/src/locale/lang/ko.js +15 -1
- package/src/locale/lang/ku.js +15 -1
- package/src/locale/lang/kz.js +15 -1
- package/src/locale/lang/lt.js +15 -1
- package/src/locale/lang/lv.js +22 -8
- package/src/locale/lang/mn.js +15 -1
- package/src/locale/lang/ms.js +122 -0
- package/src/locale/lang/nb-NO.js +25 -11
- package/src/locale/lang/nl.js +15 -1
- package/src/locale/lang/pl.js +15 -1
- package/src/locale/lang/pt-br.js +15 -1
- package/src/locale/lang/pt.js +15 -1
- package/src/locale/lang/ro.js +15 -1
- package/src/locale/lang/ru-RU.js +17 -3
- package/src/locale/lang/si.js +123 -0
- package/src/locale/lang/sk.js +20 -6
- package/src/locale/lang/sl.js +21 -7
- package/src/locale/lang/sr-Latn.js +123 -0
- package/src/locale/lang/sr.js +123 -0
- package/src/locale/lang/sv-SE.js +23 -9
- package/src/locale/lang/sw.js +123 -0
- package/src/locale/lang/ta.js +15 -1
- package/src/locale/lang/th.js +22 -8
- package/src/locale/lang/tk.js +15 -1
- package/src/locale/lang/tr-TR.js +16 -2
- package/src/locale/lang/ua.js +17 -3
- package/src/locale/lang/ug-CN.js +19 -5
- package/src/locale/lang/uz-UZ.js +123 -0
- package/src/locale/lang/vi.js +20 -6
- package/src/locale/lang/zh-CN.js +15 -1
- package/src/locale/lang/zh-TW.js +15 -1
- package/src/mixins/locale.js +1 -1
- package/src/mixins/migrating.js +6 -3
- package/src/transitions/collapse-transition.js +1 -1
- package/src/utils/aria-utils.js +2 -1
- package/src/utils/clickoutside.js +1 -1
- package/{packages/date-picker/src/util/index.js → src/utils/date-util.js} +69 -27
- package/src/utils/date.js +54 -30
- package/src/utils/dom.js +55 -2
- package/src/utils/lodash.js +18075 -0
- package/src/utils/merge.js +3 -13
- package/src/utils/popup/index.js +3 -11
- package/src/utils/popup/popup-manager.js +3 -3
- package/src/utils/resize-event.js +2 -1
- package/src/utils/types.js +38 -0
- package/src/utils/util.js +161 -0
- package/src/utils/vdom.js +1 -5
- package/src/utils/vue-popper.js +2 -1
- package/types/alert.d.ts +4 -0
- package/types/autocomplete.d.ts +6 -3
- package/types/avatar.d.ts +20 -0
- package/types/backtop.d.ts +16 -0
- package/types/calendar.d.ts +15 -0
- package/types/carousel.d.ts +4 -0
- package/types/cascader-panel.d.ts +72 -0
- package/types/cascader.d.ts +29 -21
- package/types/collapse-item.d.ts +3 -0
- package/types/descriptions-item.d.ts +37 -0
- package/types/descriptions.d.ts +52 -0
- package/types/dialog.d.ts +3 -0
- package/types/divider.d.ts +12 -0
- package/types/drawer.d.ts +63 -0
- package/types/dropdown-item.d.ts +3 -0
- package/types/dropdown.d.ts +12 -0
- package/types/element-ui.d.ts +91 -3
- package/types/empty.d.ts +31 -0
- package/types/form.d.ts +6 -6
- package/types/icon.d.ts +7 -0
- package/types/image.d.ts +43 -0
- package/types/infinite-scroll.d.ts +6 -0
- package/types/input-number.d.ts +4 -1
- package/types/input.d.ts +16 -1
- package/types/link.d.ts +25 -0
- package/types/loading.d.ts +3 -1
- package/types/message-box.d.ts +14 -4
- package/types/message.d.ts +17 -2
- package/types/page-header.d.ts +10 -0
- package/types/pagination.d.ts +3 -0
- package/types/popconfirm.d.ts +29 -0
- package/types/popover.d.ts +7 -1
- package/types/progress.d.ts +7 -1
- package/types/rate.d.ts +16 -4
- package/types/result.d.ts +33 -0
- package/types/select.d.ts +9 -0
- package/types/skeleton-item.d.ts +7 -0
- package/types/skeleton.d.ts +33 -0
- package/types/slider.d.ts +6 -0
- package/types/spinner.d.ts +16 -0
- package/types/statistic.d.ts +37 -0
- package/types/submenu.d.ts +1 -1
- package/types/switch.d.ts +3 -0
- package/types/table-column.d.ts +1 -1
- package/types/table.d.ts +58 -3
- package/types/tabs.d.ts +4 -1
- package/types/tag.d.ts +5 -1
- package/types/timeline-item.d.ts +20 -0
- package/types/timeline.d.ts +6 -0
- package/types/tooltip.d.ts +3 -0
- package/types/tree.d.ts +120 -97
- package/types/upload.d.ts +7 -4
- package/web-types.json +4195 -0
- package/CHANGELOG.en-US.md +0 -576
- package/CHANGELOG.es.md +0 -581
- package/CHANGELOG.zh-CN.md +0 -576
- package/lib/utils/sync.js +0 -59
- package/packages/carousel/_index.js +0 -10
- package/packages/carousel/cooking.conf.js +0 -6
- package/packages/carousel/package.json +0 -17
- package/packages/cascader/cooking.conf.js +0 -18
- package/packages/cascader/package.json +0 -15
- package/packages/cascader/src/main.vue +0 -438
- package/packages/cascader/src/menu.vue +0 -369
- package/packages/color-picker/cooking.conf.js +0 -6
- package/packages/color-picker/package.json +0 -15
- package/packages/date-picker/README.md +0 -64
- package/packages/date-picker/_index.js +0 -12
- package/packages/date-picker/cooking.conf.js +0 -6
- package/packages/date-picker/package.json +0 -15
- package/packages/loading/README.md +0 -66
- package/packages/loading/cooking.conf.js +0 -6
- package/packages/loading/package.json +0 -15
- package/packages/pagination/README.md +0 -59
- package/packages/pagination/cooking.conf.js +0 -6
- package/packages/pagination/package.json +0 -15
- package/packages/table/README.md +0 -106
- package/packages/table/_index.js +0 -10
- package/packages/table/cooking.conf.js +0 -6
- package/packages/table/package.json +0 -17
- package/packages/table/src/table-store.js +0 -619
- package/packages/theme-chalk/lib/alert.css +0 -1
- package/packages/theme-chalk/lib/aside.css +0 -1
- package/packages/theme-chalk/lib/autocomplete.css +0 -1
- package/packages/theme-chalk/lib/badge.css +0 -1
- package/packages/theme-chalk/lib/base.css +0 -1
- package/packages/theme-chalk/lib/breadcrumb.css +0 -1
- package/packages/theme-chalk/lib/button.css +0 -1
- package/packages/theme-chalk/lib/card.css +0 -1
- package/packages/theme-chalk/lib/carousel-item.css +0 -1
- package/packages/theme-chalk/lib/carousel.css +0 -1
- package/packages/theme-chalk/lib/cascader.css +0 -1
- package/packages/theme-chalk/lib/checkbox.css +0 -1
- package/packages/theme-chalk/lib/col.css +0 -1
- package/packages/theme-chalk/lib/collapse-item.css +0 -0
- package/packages/theme-chalk/lib/collapse.css +0 -1
- package/packages/theme-chalk/lib/color-picker.css +0 -1
- package/packages/theme-chalk/lib/container.css +0 -1
- package/packages/theme-chalk/lib/date-picker.css +0 -1
- package/packages/theme-chalk/lib/dialog.css +0 -1
- package/packages/theme-chalk/lib/display.css +0 -1
- package/packages/theme-chalk/lib/dropdown-item.css +0 -0
- package/packages/theme-chalk/lib/dropdown-menu.css +0 -0
- package/packages/theme-chalk/lib/dropdown.css +0 -1
- package/packages/theme-chalk/lib/fonts/element-icons.ttf +0 -0
- package/packages/theme-chalk/lib/fonts/element-icons.woff +0 -0
- package/packages/theme-chalk/lib/footer.css +0 -1
- package/packages/theme-chalk/lib/form-item.css +0 -0
- package/packages/theme-chalk/lib/form.css +0 -1
- package/packages/theme-chalk/lib/header.css +0 -1
- package/packages/theme-chalk/lib/icon.css +0 -1
- package/packages/theme-chalk/lib/index.css +0 -1
- package/packages/theme-chalk/lib/input-number.css +0 -1
- package/packages/theme-chalk/lib/input.css +0 -1
- package/packages/theme-chalk/lib/loading.css +0 -1
- package/packages/theme-chalk/lib/main.css +0 -1
- package/packages/theme-chalk/lib/menu-item-group.css +0 -0
- package/packages/theme-chalk/lib/menu-item.css +0 -0
- package/packages/theme-chalk/lib/menu.css +0 -1
- package/packages/theme-chalk/lib/message-box.css +0 -1
- package/packages/theme-chalk/lib/message.css +0 -1
- package/packages/theme-chalk/lib/notification.css +0 -1
- package/packages/theme-chalk/lib/option-group.css +0 -1
- package/packages/theme-chalk/lib/option.css +0 -1
- package/packages/theme-chalk/lib/pagination.css +0 -1
- package/packages/theme-chalk/lib/popover.css +0 -1
- package/packages/theme-chalk/lib/popper.css +0 -1
- package/packages/theme-chalk/lib/progress.css +0 -1
- package/packages/theme-chalk/lib/radio-button.css +0 -1
- package/packages/theme-chalk/lib/radio-group.css +0 -1
- package/packages/theme-chalk/lib/radio.css +0 -1
- package/packages/theme-chalk/lib/rate.css +0 -1
- package/packages/theme-chalk/lib/reset.css +0 -1
- package/packages/theme-chalk/lib/row.css +0 -1
- package/packages/theme-chalk/lib/scrollbar.css +0 -1
- package/packages/theme-chalk/lib/select-dropdown.css +0 -1
- package/packages/theme-chalk/lib/select.css +0 -1
- package/packages/theme-chalk/lib/slider.css +0 -1
- package/packages/theme-chalk/lib/spinner.css +0 -1
- package/packages/theme-chalk/lib/step.css +0 -1
- package/packages/theme-chalk/lib/steps.css +0 -1
- package/packages/theme-chalk/lib/submenu.css +0 -0
- package/packages/theme-chalk/lib/switch.css +0 -1
- package/packages/theme-chalk/lib/tab-pane.css +0 -0
- package/packages/theme-chalk/lib/table-column.css +0 -1
- package/packages/theme-chalk/lib/table.css +0 -1
- package/packages/theme-chalk/lib/tabs.css +0 -1
- package/packages/theme-chalk/lib/tag.css +0 -1
- package/packages/theme-chalk/lib/time-picker.css +0 -1
- package/packages/theme-chalk/lib/time-select.css +0 -1
- package/packages/theme-chalk/lib/tooltip.css +0 -1
- package/packages/theme-chalk/lib/transfer.css +0 -1
- package/packages/theme-chalk/lib/tree.css +0 -1
- package/packages/theme-chalk/lib/upload.css +0 -1
- package/packages/upload/README.md +0 -67
- package/packages/upload/cooking.conf.js +0 -6
- package/packages/upload/package.json +0 -16
- package/packages/upload/src/iframe-upload.vue +0 -167
- package/src/utils/sync.js +0 -54
- /package/{packages/theme-chalk/lib/breadcrumb-item.css → lib/theme-chalk/infinite-scroll.css} +0 -0
- /package/{packages/theme-chalk/lib/button-group.css → lib/theme-chalk/infiniteScroll.css} +0 -0
- /package/packages/theme-chalk/{lib/checkbox-button.css → src/infinite-scroll.scss} +0 -0
- /package/packages/theme-chalk/{lib/checkbox-group.css → src/infiniteScroll.scss} +0 -0
package/lib/tree.js
CHANGED
|
@@ -1,1841 +1,1155 @@
|
|
|
1
|
-
|
|
2
|
-
/******/
|
|
3
|
-
/******/ // The
|
|
4
|
-
/******/
|
|
5
|
-
/******/
|
|
6
|
-
|
|
7
|
-
/******/
|
|
8
|
-
/******/
|
|
9
|
-
/******/ //
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
/******/
|
|
16
|
-
/******/
|
|
17
|
-
/******/
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ "use strict";
|
|
3
|
+
/******/ // The require scope
|
|
4
|
+
/******/ const __webpack_require__ = {};
|
|
5
|
+
/******/
|
|
6
|
+
/************************************************************************/
|
|
7
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
8
|
+
/******/ (() => {
|
|
9
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
10
|
+
/******/ __webpack_require__.n = (module) => {
|
|
11
|
+
/******/ const getter = module && module.__esModule ?
|
|
12
|
+
/******/ () => (module['default']) :
|
|
13
|
+
/******/ () => (module);
|
|
14
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
15
|
+
/******/ return getter;
|
|
16
|
+
/******/ };
|
|
17
|
+
/******/ })();
|
|
18
|
+
/******/
|
|
19
|
+
/******/ /* webpack/runtime/define property getters */
|
|
20
|
+
/******/ (() => {
|
|
21
|
+
/******/ // define getter/value functions for harmony exports
|
|
22
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
23
|
+
/******/ if(Array.isArray(definition)) {
|
|
24
|
+
/******/ var i = 0;
|
|
25
|
+
/******/ while(i < definition.length) {
|
|
26
|
+
/******/ var key = definition[i++];
|
|
27
|
+
/******/ var binding = definition[i++];
|
|
28
|
+
/******/ if(!__webpack_require__.o(exports, key)) {
|
|
29
|
+
/******/ if(binding === 0) {
|
|
30
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
|
|
31
|
+
/******/ } else {
|
|
32
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ } else if(binding === 0) { i++; }
|
|
35
|
+
/******/ }
|
|
36
|
+
/******/ } else {
|
|
37
|
+
/******/ for(var key in definition) {
|
|
38
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
39
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
40
|
+
/******/ }
|
|
41
|
+
/******/ }
|
|
42
|
+
/******/ }
|
|
18
43
|
/******/ };
|
|
19
|
-
/******/
|
|
20
|
-
/******/
|
|
21
|
-
/******/
|
|
22
|
-
/******/
|
|
23
|
-
/******/
|
|
24
|
-
/******/
|
|
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, {
|
|
41
|
-
/******/ configurable: false,
|
|
42
|
-
/******/ enumerable: true,
|
|
43
|
-
/******/ get: getter
|
|
44
|
-
/******/ });
|
|
45
|
-
/******/ }
|
|
46
|
-
/******/ };
|
|
47
|
-
/******/
|
|
48
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
49
|
-
/******/ __webpack_require__.n = function(module) {
|
|
50
|
-
/******/ var getter = module && module.__esModule ?
|
|
51
|
-
/******/ function getDefault() { return module['default']; } :
|
|
52
|
-
/******/ function getModuleExports() { return module; };
|
|
53
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
54
|
-
/******/ return getter;
|
|
55
|
-
/******/ };
|
|
56
|
-
/******/
|
|
57
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
58
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
59
|
-
/******/
|
|
60
|
-
/******/ // __webpack_public_path__
|
|
61
|
-
/******/ __webpack_require__.p = "/dist/";
|
|
62
|
-
/******/
|
|
63
|
-
/******/ // Load entry module and return exports
|
|
64
|
-
/******/ return __webpack_require__(__webpack_require__.s = 289);
|
|
65
|
-
/******/ })
|
|
44
|
+
/******/ })();
|
|
45
|
+
/******/
|
|
46
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
47
|
+
/******/ (() => {
|
|
48
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
49
|
+
/******/ })();
|
|
50
|
+
/******/
|
|
66
51
|
/************************************************************************/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/***/ 0:
|
|
70
|
-
/***/ (function(module, exports) {
|
|
71
|
-
|
|
72
|
-
/* globals __VUE_SSR_CONTEXT__ */
|
|
73
|
-
|
|
74
|
-
// IMPORTANT: Do NOT use ES2015 features in this file.
|
|
75
|
-
// This module is a runtime utility for cleaner component module output and will
|
|
76
|
-
// be included in the final webpack user bundle.
|
|
52
|
+
let __webpack_exports__ = {};
|
|
77
53
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
injectStyles,
|
|
83
|
-
scopeId,
|
|
84
|
-
moduleIdentifier /* server only */
|
|
85
|
-
) {
|
|
86
|
-
var esModule
|
|
87
|
-
var scriptExports = rawScriptExports = rawScriptExports || {}
|
|
88
|
-
|
|
89
|
-
// ES6 modules interop
|
|
90
|
-
var type = typeof rawScriptExports.default
|
|
91
|
-
if (type === 'object' || type === 'function') {
|
|
92
|
-
esModule = rawScriptExports
|
|
93
|
-
scriptExports = rawScriptExports.default
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Vue.extend constructor export interop
|
|
97
|
-
var options = typeof scriptExports === 'function'
|
|
98
|
-
? scriptExports.options
|
|
99
|
-
: scriptExports
|
|
54
|
+
// EXPORTS
|
|
55
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
56
|
+
"default": () => (/* binding */ packages_tree)
|
|
57
|
+
});
|
|
100
58
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
59
|
+
;// ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/tree/src/tree.vue?vue&type=template&id=3fd19b68
|
|
60
|
+
var render = function () {
|
|
61
|
+
var _vm = this
|
|
62
|
+
var _h = _vm.$createElement
|
|
63
|
+
var _c = _vm._self._c || _h
|
|
64
|
+
return _c(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
staticClass: "el-tree",
|
|
68
|
+
class: {
|
|
69
|
+
"el-tree--highlight-current": _vm.highlightCurrent,
|
|
70
|
+
"is-dragging": !!_vm.dragState.draggingNode,
|
|
71
|
+
"is-drop-not-allow": !_vm.dragState.allowDrop,
|
|
72
|
+
"is-drop-inner": _vm.dragState.dropType === "inner",
|
|
73
|
+
},
|
|
74
|
+
attrs: { role: "tree" },
|
|
75
|
+
},
|
|
76
|
+
[
|
|
77
|
+
_vm._l(_vm.root.childNodes, function (child) {
|
|
78
|
+
return _c("el-tree-node", {
|
|
79
|
+
key: _vm.getNodeKey(child),
|
|
80
|
+
attrs: {
|
|
81
|
+
node: child,
|
|
82
|
+
props: _vm.props,
|
|
83
|
+
"render-after-expand": _vm.renderAfterExpand,
|
|
84
|
+
"show-checkbox": _vm.showCheckbox,
|
|
85
|
+
"render-content": _vm.renderContent,
|
|
86
|
+
},
|
|
87
|
+
on: { "node-expand": _vm.handleNodeExpand },
|
|
88
|
+
})
|
|
89
|
+
}),
|
|
90
|
+
_vm.isEmpty
|
|
91
|
+
? _c("div", { staticClass: "el-tree__empty-block" }, [
|
|
92
|
+
_c("span", { staticClass: "el-tree__empty-text" }, [
|
|
93
|
+
_vm._v(_vm._s(_vm.emptyText)),
|
|
94
|
+
]),
|
|
95
|
+
])
|
|
96
|
+
: _vm._e(),
|
|
97
|
+
_c("div", {
|
|
98
|
+
directives: [
|
|
99
|
+
{
|
|
100
|
+
name: "show",
|
|
101
|
+
rawName: "v-show",
|
|
102
|
+
value: _vm.dragState.showDropIndicator,
|
|
103
|
+
expression: "dragState.showDropIndicator",
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
ref: "dropIndicator",
|
|
107
|
+
staticClass: "el-tree__drop-indicator",
|
|
108
|
+
}),
|
|
109
|
+
],
|
|
110
|
+
2
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
var staticRenderFns = []
|
|
114
|
+
render._withStripped = true
|
|
107
115
|
|
|
108
|
-
// functional template
|
|
109
|
-
if (functionalTemplate) {
|
|
110
|
-
options.functional = true
|
|
111
|
-
}
|
|
112
116
|
|
|
113
|
-
|
|
114
|
-
if (scopeId) {
|
|
115
|
-
options._scopeId = scopeId
|
|
116
|
-
}
|
|
117
|
+
;// ./packages/tree/src/tree.vue?vue&type=template&id=3fd19b68
|
|
117
118
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
119
|
+
;// external "mazey-element-ui/lib/utils/merge"
|
|
120
|
+
const merge_namespaceObject = require("mazey-element-ui/lib/utils/merge");
|
|
121
|
+
var merge_default = /*#__PURE__*/__webpack_require__.n(merge_namespaceObject);
|
|
122
|
+
;// ./packages/tree/src/model/util.js
|
|
123
|
+
var NODE_KEY = '$treeNodeId';
|
|
124
|
+
var markNodeData = function markNodeData(node, data) {
|
|
125
|
+
if (!data || data[NODE_KEY]) return;
|
|
126
|
+
Object.defineProperty(data, NODE_KEY, {
|
|
127
|
+
value: node.id,
|
|
128
|
+
enumerable: false,
|
|
129
|
+
configurable: false,
|
|
130
|
+
writable: false
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
var util_getNodeKey = function getNodeKey(key, data) {
|
|
134
|
+
if (!key) return data[NODE_KEY];
|
|
135
|
+
return data[key];
|
|
136
|
+
};
|
|
137
|
+
var findNearestComponent = function findNearestComponent(element, componentName) {
|
|
138
|
+
var target = element;
|
|
139
|
+
while (target && target.tagName !== 'BODY') {
|
|
140
|
+
if (target.__vue__ && target.__vue__.$options.name === componentName) {
|
|
141
|
+
return target.__vue__;
|
|
138
142
|
}
|
|
139
|
-
|
|
140
|
-
// never gets called
|
|
141
|
-
options._ssrRegister = hook
|
|
142
|
-
} else if (injectStyles) {
|
|
143
|
-
hook = injectStyles
|
|
143
|
+
target = target.parentNode;
|
|
144
144
|
}
|
|
145
|
+
return null;
|
|
146
|
+
};
|
|
147
|
+
;// external "mazey-element-ui/lib/utils/util"
|
|
148
|
+
const utils_util_namespaceObject = require("mazey-element-ui/lib/utils/util");
|
|
149
|
+
;// ./packages/tree/src/model/node.js
|
|
150
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
151
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
152
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
153
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
154
|
+
;
|
|
145
155
|
|
|
146
|
-
if (hook) {
|
|
147
|
-
var functional = options.functional
|
|
148
|
-
var existing = functional
|
|
149
|
-
? options.render
|
|
150
|
-
: options.beforeCreate
|
|
151
156
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
options.render = function renderWithStyleInjection (h, context) {
|
|
163
|
-
hook.call(context)
|
|
164
|
-
return existing(h, context)
|
|
157
|
+
var getChildState = function getChildState(node) {
|
|
158
|
+
var all = true;
|
|
159
|
+
var none = true;
|
|
160
|
+
var allWithoutDisable = true;
|
|
161
|
+
for (var i = 0, j = node.length; i < j; i++) {
|
|
162
|
+
var n = node[i];
|
|
163
|
+
if (n.checked !== true || n.indeterminate) {
|
|
164
|
+
all = false;
|
|
165
|
+
if (!n.disabled) {
|
|
166
|
+
allWithoutDisable = false;
|
|
165
167
|
}
|
|
166
168
|
}
|
|
169
|
+
if (n.checked !== false || n.indeterminate) {
|
|
170
|
+
none = false;
|
|
171
|
+
}
|
|
167
172
|
}
|
|
168
|
-
|
|
169
173
|
return {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
174
|
+
all: all,
|
|
175
|
+
none: none,
|
|
176
|
+
allWithoutDisable: allWithoutDisable,
|
|
177
|
+
half: !all && !none
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
var _reInitChecked = function reInitChecked(node) {
|
|
181
|
+
if (node.childNodes.length === 0 || node.loading) return;
|
|
182
|
+
var _getChildState = getChildState(node.childNodes),
|
|
183
|
+
all = _getChildState.all,
|
|
184
|
+
none = _getChildState.none,
|
|
185
|
+
half = _getChildState.half;
|
|
186
|
+
if (all) {
|
|
187
|
+
node.checked = true;
|
|
188
|
+
node.indeterminate = false;
|
|
189
|
+
} else if (half) {
|
|
190
|
+
node.checked = false;
|
|
191
|
+
node.indeterminate = true;
|
|
192
|
+
} else if (none) {
|
|
193
|
+
node.checked = false;
|
|
194
|
+
node.indeterminate = false;
|
|
195
|
+
}
|
|
196
|
+
var parent = node.parent;
|
|
197
|
+
if (!parent || parent.level === 0) return;
|
|
198
|
+
if (!node.store.checkStrictly) {
|
|
199
|
+
_reInitChecked(parent);
|
|
173
200
|
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
/***/ }),
|
|
178
|
-
|
|
179
|
-
/***/ 1:
|
|
180
|
-
/***/ (function(module, exports) {
|
|
181
|
-
|
|
182
|
-
module.exports = require("element-ui/lib/mixins/emitter");
|
|
183
|
-
|
|
184
|
-
/***/ }),
|
|
185
|
-
|
|
186
|
-
/***/ 12:
|
|
187
|
-
/***/ (function(module, exports) {
|
|
188
|
-
|
|
189
|
-
module.exports = require("element-ui/lib/locale");
|
|
190
|
-
|
|
191
|
-
/***/ }),
|
|
192
|
-
|
|
193
|
-
/***/ 16:
|
|
194
|
-
/***/ (function(module, exports) {
|
|
195
|
-
|
|
196
|
-
module.exports = require("element-ui/lib/checkbox");
|
|
197
|
-
|
|
198
|
-
/***/ }),
|
|
199
|
-
|
|
200
|
-
/***/ 2:
|
|
201
|
-
/***/ (function(module, exports) {
|
|
202
|
-
|
|
203
|
-
module.exports = require("element-ui/lib/utils/dom");
|
|
204
|
-
|
|
205
|
-
/***/ }),
|
|
206
|
-
|
|
207
|
-
/***/ 22:
|
|
208
|
-
/***/ (function(module, exports) {
|
|
209
|
-
|
|
210
|
-
module.exports = require("element-ui/lib/transitions/collapse-transition");
|
|
211
|
-
|
|
212
|
-
/***/ }),
|
|
213
|
-
|
|
214
|
-
/***/ 289:
|
|
215
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
216
|
-
|
|
217
|
-
"use strict";
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
exports.__esModule = true;
|
|
221
|
-
|
|
222
|
-
var _tree = __webpack_require__(290);
|
|
223
|
-
|
|
224
|
-
var _tree2 = _interopRequireDefault(_tree);
|
|
225
|
-
|
|
226
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227
|
-
|
|
228
|
-
/* istanbul ignore next */
|
|
229
|
-
_tree2.default.install = function (Vue) {
|
|
230
|
-
Vue.component(_tree2.default.name, _tree2.default);
|
|
231
201
|
};
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
var
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
var
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
var Component = normalizeComponent(
|
|
261
|
-
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_script_index_0_tree_vue___default.a,
|
|
262
|
-
__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_13_7_3_vue_loader_lib_template_compiler_index_id_data_v_4e0a5cca_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_template_index_0_tree_vue__["a" /* default */],
|
|
263
|
-
__vue_template_functional__,
|
|
264
|
-
__vue_styles__,
|
|
265
|
-
__vue_scopeId__,
|
|
266
|
-
__vue_module_identifier__
|
|
267
|
-
)
|
|
268
|
-
|
|
269
|
-
/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
/***/ }),
|
|
273
|
-
|
|
274
|
-
/***/ 291:
|
|
275
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
276
|
-
|
|
277
|
-
"use strict";
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
exports.__esModule = true;
|
|
281
|
-
|
|
282
|
-
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; };
|
|
283
|
-
|
|
284
|
-
var _node = __webpack_require__(292);
|
|
285
|
-
|
|
286
|
-
var _node2 = _interopRequireDefault(_node);
|
|
287
|
-
|
|
288
|
-
var _util = __webpack_require__(36);
|
|
289
|
-
|
|
290
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
291
|
-
|
|
292
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
293
|
-
|
|
294
|
-
var TreeStore = function () {
|
|
295
|
-
function TreeStore(options) {
|
|
296
|
-
var _this = this;
|
|
297
|
-
|
|
298
|
-
_classCallCheck(this, TreeStore);
|
|
299
|
-
|
|
300
|
-
this.currentNode = null;
|
|
301
|
-
this.currentNodeKey = null;
|
|
302
|
-
|
|
303
|
-
for (var option in options) {
|
|
304
|
-
if (options.hasOwnProperty(option)) {
|
|
305
|
-
this[option] = options[option];
|
|
202
|
+
var getPropertyFromData = function getPropertyFromData(node, prop) {
|
|
203
|
+
var props = node.store.props;
|
|
204
|
+
var data = node.data || {};
|
|
205
|
+
var config = props[prop];
|
|
206
|
+
if (typeof config === 'function') {
|
|
207
|
+
return config(data, node);
|
|
208
|
+
} else if (typeof config === 'string') {
|
|
209
|
+
return data[config];
|
|
210
|
+
} else if (typeof config === 'undefined') {
|
|
211
|
+
var dataProp = data[prop];
|
|
212
|
+
return dataProp === undefined ? '' : dataProp;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
var nodeIdSeed = 0;
|
|
216
|
+
var Node = /*#__PURE__*/function () {
|
|
217
|
+
function Node(options) {
|
|
218
|
+
this.id = nodeIdSeed++;
|
|
219
|
+
this.text = null;
|
|
220
|
+
this.checked = false;
|
|
221
|
+
this.indeterminate = false;
|
|
222
|
+
this.data = null;
|
|
223
|
+
this.expanded = false;
|
|
224
|
+
this.parent = null;
|
|
225
|
+
this.visible = true;
|
|
226
|
+
this.isCurrent = false;
|
|
227
|
+
for (var name in options) {
|
|
228
|
+
if (options.hasOwnProperty(name)) {
|
|
229
|
+
this[name] = options[name];
|
|
306
230
|
}
|
|
307
231
|
}
|
|
308
232
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
this.
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
if (this.lazy && this.load) {
|
|
317
|
-
var loadFn = this.load;
|
|
318
|
-
loadFn(this.root, function (data) {
|
|
319
|
-
_this.root.doCreateChildren(data);
|
|
320
|
-
_this._initDefaultCheckedNodes();
|
|
321
|
-
});
|
|
322
|
-
} else {
|
|
323
|
-
this._initDefaultCheckedNodes();
|
|
233
|
+
// internal
|
|
234
|
+
this.level = 0;
|
|
235
|
+
this.loaded = false;
|
|
236
|
+
this.childNodes = [];
|
|
237
|
+
this.loading = false;
|
|
238
|
+
if (this.parent) {
|
|
239
|
+
this.level = this.parent.level + 1;
|
|
324
240
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
241
|
+
var store = this.store;
|
|
242
|
+
if (!store) {
|
|
243
|
+
throw new Error('[Node]store is required!');
|
|
244
|
+
}
|
|
245
|
+
store.registerNode(this);
|
|
246
|
+
var props = store.props;
|
|
247
|
+
if (props && typeof props.isLeaf !== 'undefined') {
|
|
248
|
+
var isLeaf = getPropertyFromData(this, 'isLeaf');
|
|
249
|
+
if (typeof isLeaf === 'boolean') {
|
|
250
|
+
this.isLeafByUser = isLeaf;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (store.lazy !== true && this.data) {
|
|
254
|
+
this.setData(this.data);
|
|
255
|
+
if (store.defaultExpandAll) {
|
|
256
|
+
this.expanded = true;
|
|
257
|
+
}
|
|
258
|
+
} else if (this.level > 0 && store.lazy && store.defaultExpandAll) {
|
|
259
|
+
this.expand();
|
|
260
|
+
}
|
|
261
|
+
if (!Array.isArray(this.data)) {
|
|
262
|
+
markNodeData(this, this.data);
|
|
263
|
+
}
|
|
264
|
+
if (!this.data) return;
|
|
265
|
+
var defaultExpandedKeys = store.defaultExpandedKeys;
|
|
266
|
+
var key = store.key;
|
|
267
|
+
if (key && defaultExpandedKeys && defaultExpandedKeys.indexOf(this.key) !== -1) {
|
|
268
|
+
this.expand(null, store.autoExpandParent);
|
|
269
|
+
}
|
|
270
|
+
if (key && store.currentNodeKey !== undefined && this.key === store.currentNodeKey) {
|
|
271
|
+
store.currentNode = this;
|
|
272
|
+
store.currentNode.isCurrent = true;
|
|
273
|
+
}
|
|
274
|
+
if (store.lazy) {
|
|
275
|
+
store._initDefaultCheckedNode(this);
|
|
276
|
+
}
|
|
277
|
+
this.updateLeafState();
|
|
278
|
+
}
|
|
279
|
+
var _proto = Node.prototype;
|
|
280
|
+
_proto.setData = function setData(data) {
|
|
281
|
+
if (!Array.isArray(data)) {
|
|
282
|
+
markNodeData(this, data);
|
|
283
|
+
}
|
|
284
|
+
this.data = data;
|
|
285
|
+
this.childNodes = [];
|
|
286
|
+
var children;
|
|
287
|
+
if (this.level === 0 && this.data instanceof Array) {
|
|
288
|
+
children = this.data;
|
|
289
|
+
} else {
|
|
290
|
+
children = getPropertyFromData(this, 'children') || [];
|
|
291
|
+
}
|
|
292
|
+
for (var i = 0, j = children.length; i < j; i++) {
|
|
293
|
+
this.insertChild({
|
|
294
|
+
data: children[i]
|
|
295
|
+
});
|
|
366
296
|
}
|
|
367
297
|
};
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
var key = (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object' ? data : (0, _util.getNodeKey)(this.key, data);
|
|
372
|
-
return this.nodesMap[key] || null;
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
TreeStore.prototype.insertBefore = function insertBefore(data, refData) {
|
|
376
|
-
var refNode = this.getNode(refData);
|
|
377
|
-
refNode.parent.insertBefore({ data: data }, refNode);
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
TreeStore.prototype.insertAfter = function insertAfter(data, refData) {
|
|
381
|
-
var refNode = this.getNode(refData);
|
|
382
|
-
refNode.parent.insertAfter({ data: data }, refNode);
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
TreeStore.prototype.remove = function remove(data) {
|
|
386
|
-
var node = this.getNode(data);
|
|
387
|
-
if (node) {
|
|
388
|
-
node.parent.removeChild(node);
|
|
298
|
+
_proto.contains = function contains(target, deep) {
|
|
299
|
+
if (deep === void 0) {
|
|
300
|
+
deep = true;
|
|
389
301
|
}
|
|
302
|
+
var _walk = function walk(parent) {
|
|
303
|
+
var children = parent.childNodes || [];
|
|
304
|
+
var result = false;
|
|
305
|
+
for (var i = 0, j = children.length; i < j; i++) {
|
|
306
|
+
var child = children[i];
|
|
307
|
+
if (child === target || deep && _walk(child)) {
|
|
308
|
+
result = true;
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return result;
|
|
313
|
+
};
|
|
314
|
+
return _walk(this);
|
|
390
315
|
};
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
if (parentNode) {
|
|
396
|
-
parentNode.insertChild({ data: data });
|
|
316
|
+
_proto.remove = function remove() {
|
|
317
|
+
var parent = this.parent;
|
|
318
|
+
if (parent) {
|
|
319
|
+
parent.removeChild(this);
|
|
397
320
|
}
|
|
398
321
|
};
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
322
|
+
_proto.insertChild = function insertChild(child, index, batch) {
|
|
323
|
+
if (!child) throw new Error('insertChild error: child is required.');
|
|
324
|
+
if (!(child instanceof Node)) {
|
|
325
|
+
if (!batch) {
|
|
326
|
+
var children = this.getChildren(true) || [];
|
|
327
|
+
if (children.indexOf(child.data) === -1) {
|
|
328
|
+
if (typeof index === 'undefined' || index < 0) {
|
|
329
|
+
children.push(child.data);
|
|
330
|
+
} else {
|
|
331
|
+
children.splice(index, 0, child.data);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
411
334
|
}
|
|
412
|
-
|
|
335
|
+
merge_default()(child, {
|
|
336
|
+
parent: this,
|
|
337
|
+
store: this.store
|
|
338
|
+
});
|
|
339
|
+
child = new Node(child);
|
|
340
|
+
}
|
|
341
|
+
child.level = this.level + 1;
|
|
342
|
+
if (typeof index === 'undefined' || index < 0) {
|
|
343
|
+
this.childNodes.push(child);
|
|
344
|
+
} else {
|
|
345
|
+
this.childNodes.splice(index, 0, child);
|
|
346
|
+
}
|
|
347
|
+
this.updateLeafState();
|
|
413
348
|
};
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
if (defaultCheckedKeys.indexOf(node.key) !== -1) {
|
|
419
|
-
node.setChecked(true, !this.checkStrictly);
|
|
349
|
+
_proto.insertBefore = function insertBefore(child, ref) {
|
|
350
|
+
var index;
|
|
351
|
+
if (ref) {
|
|
352
|
+
index = this.childNodes.indexOf(ref);
|
|
420
353
|
}
|
|
354
|
+
this.insertChild(child, index);
|
|
421
355
|
};
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
if (
|
|
425
|
-
|
|
426
|
-
|
|
356
|
+
_proto.insertAfter = function insertAfter(child, ref) {
|
|
357
|
+
var index;
|
|
358
|
+
if (ref) {
|
|
359
|
+
index = this.childNodes.indexOf(ref);
|
|
360
|
+
if (index !== -1) index += 1;
|
|
427
361
|
}
|
|
362
|
+
this.insertChild(child, index);
|
|
428
363
|
};
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
var
|
|
432
|
-
if (
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
364
|
+
_proto.removeChild = function removeChild(child) {
|
|
365
|
+
var children = this.getChildren() || [];
|
|
366
|
+
var dataIndex = children.indexOf(child.data);
|
|
367
|
+
if (dataIndex > -1) {
|
|
368
|
+
children.splice(dataIndex, 1);
|
|
369
|
+
}
|
|
370
|
+
var index = this.childNodes.indexOf(child);
|
|
371
|
+
if (index > -1) {
|
|
372
|
+
this.store && this.store.deregisterNode(child);
|
|
373
|
+
child.parent = null;
|
|
374
|
+
this.childNodes.splice(index, 1);
|
|
375
|
+
}
|
|
376
|
+
this.updateLeafState();
|
|
436
377
|
};
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
var
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
378
|
+
_proto.removeChildByData = function removeChildByData(data) {
|
|
379
|
+
var targetNode = null;
|
|
380
|
+
for (var i = 0; i < this.childNodes.length; i++) {
|
|
381
|
+
if (this.childNodes[i].data === data) {
|
|
382
|
+
targetNode = this.childNodes[i];
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
if (targetNode) {
|
|
387
|
+
this.removeChild(targetNode);
|
|
446
388
|
}
|
|
447
|
-
|
|
448
|
-
delete this.nodesMap[node.key];
|
|
449
389
|
};
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
var
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
childNodes.forEach(function (child) {
|
|
459
|
-
if (child.checked && (!leafOnly || leafOnly && child.isLeaf)) {
|
|
460
|
-
checkedNodes.push(child.data);
|
|
390
|
+
_proto.expand = function expand(callback, expandParent) {
|
|
391
|
+
var _this = this;
|
|
392
|
+
var done = function done() {
|
|
393
|
+
if (expandParent) {
|
|
394
|
+
var parent = _this.parent;
|
|
395
|
+
while (parent.level > 0) {
|
|
396
|
+
parent.expanded = true;
|
|
397
|
+
parent = parent.parent;
|
|
461
398
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
399
|
+
}
|
|
400
|
+
_this.expanded = true;
|
|
401
|
+
if (callback) callback();
|
|
465
402
|
};
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
476
|
-
|
|
477
|
-
return this.getCheckedNodes(leafOnly).map(function (data) {
|
|
478
|
-
return (data || {})[_this3.key];
|
|
479
|
-
});
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
TreeStore.prototype.getHalfCheckedNodes = function getHalfCheckedNodes() {
|
|
483
|
-
var nodes = [];
|
|
484
|
-
var traverse = function traverse(node) {
|
|
485
|
-
var childNodes = node.root ? node.root.childNodes : node.childNodes;
|
|
486
|
-
|
|
487
|
-
childNodes.forEach(function (child) {
|
|
488
|
-
if (child.indeterminate) {
|
|
489
|
-
nodes.push(child.data);
|
|
403
|
+
if (this.shouldLoadData()) {
|
|
404
|
+
this.loadData(function (data) {
|
|
405
|
+
if (data instanceof Array) {
|
|
406
|
+
if (_this.checked) {
|
|
407
|
+
_this.setChecked(true, true);
|
|
408
|
+
} else if (!_this.store.checkStrictly) {
|
|
409
|
+
_reInitChecked(_this);
|
|
410
|
+
}
|
|
411
|
+
done();
|
|
490
412
|
}
|
|
491
|
-
|
|
492
|
-
traverse(child);
|
|
493
413
|
});
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
return nodes;
|
|
414
|
+
} else {
|
|
415
|
+
done();
|
|
416
|
+
}
|
|
499
417
|
};
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
418
|
+
_proto.doCreateChildren = function doCreateChildren(array, defaultProps) {
|
|
419
|
+
var _this2 = this;
|
|
420
|
+
if (defaultProps === void 0) {
|
|
421
|
+
defaultProps = {};
|
|
422
|
+
}
|
|
423
|
+
array.forEach(function (item) {
|
|
424
|
+
_this2.insertChild(merge_default()({
|
|
425
|
+
data: item
|
|
426
|
+
}, defaultProps), undefined, true);
|
|
506
427
|
});
|
|
507
428
|
};
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
var allNodes = [];
|
|
511
|
-
var nodesMap = this.nodesMap;
|
|
512
|
-
for (var nodeKey in nodesMap) {
|
|
513
|
-
if (nodesMap.hasOwnProperty(nodeKey)) {
|
|
514
|
-
allNodes.push(nodesMap[nodeKey]);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
return allNodes;
|
|
429
|
+
_proto.collapse = function collapse() {
|
|
430
|
+
this.expanded = false;
|
|
519
431
|
};
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
this.remove(child.data);
|
|
432
|
+
_proto.shouldLoadData = function shouldLoadData() {
|
|
433
|
+
return this.store.lazy === true && this.store.load && !this.loaded;
|
|
434
|
+
};
|
|
435
|
+
_proto.updateLeafState = function updateLeafState() {
|
|
436
|
+
if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== 'undefined') {
|
|
437
|
+
this.isLeaf = this.isLeafByUser;
|
|
438
|
+
return;
|
|
528
439
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
this.
|
|
440
|
+
var childNodes = this.childNodes;
|
|
441
|
+
if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
|
|
442
|
+
this.isLeaf = !childNodes || childNodes.length === 0;
|
|
443
|
+
return;
|
|
532
444
|
}
|
|
445
|
+
this.isLeaf = false;
|
|
533
446
|
};
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
});
|
|
547
|
-
for (var i = 0, j = allNodes.length; i < j; i++) {
|
|
548
|
-
var node = allNodes[i];
|
|
549
|
-
var nodeKey = node.data[key].toString();
|
|
550
|
-
var checked = keys.indexOf(nodeKey) > -1;
|
|
551
|
-
if (!checked) {
|
|
552
|
-
if (node.checked && !cache[nodeKey]) {
|
|
553
|
-
node.setChecked(false, false);
|
|
554
|
-
}
|
|
555
|
-
continue;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
var parent = node.parent;
|
|
559
|
-
while (parent && parent.level > 0) {
|
|
560
|
-
cache[parent.data[key]] = true;
|
|
561
|
-
parent = parent.parent;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
if (node.isLeaf || this.checkStrictly) {
|
|
565
|
-
node.setChecked(true, false);
|
|
566
|
-
continue;
|
|
447
|
+
_proto.setChecked = function setChecked(value, deep, recursion, passValue) {
|
|
448
|
+
var _this3 = this;
|
|
449
|
+
this.indeterminate = value === 'half';
|
|
450
|
+
this.checked = value === true;
|
|
451
|
+
if (this.store.checkStrictly) return;
|
|
452
|
+
if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
|
|
453
|
+
var _getChildState2 = getChildState(this.childNodes),
|
|
454
|
+
all = _getChildState2.all,
|
|
455
|
+
allWithoutDisable = _getChildState2.allWithoutDisable;
|
|
456
|
+
if (!this.isLeaf && !all && allWithoutDisable) {
|
|
457
|
+
this.checked = false;
|
|
458
|
+
value = false;
|
|
567
459
|
}
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
var
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
460
|
+
var handleDescendants = function handleDescendants() {
|
|
461
|
+
if (deep) {
|
|
462
|
+
var childNodes = _this3.childNodes;
|
|
463
|
+
for (var i = 0, j = childNodes.length; i < j; i++) {
|
|
464
|
+
var child = childNodes[i];
|
|
465
|
+
passValue = passValue || value !== false;
|
|
466
|
+
var isCheck = child.disabled ? child.checked : passValue;
|
|
467
|
+
child.setChecked(isCheck, deep, true, passValue);
|
|
468
|
+
}
|
|
469
|
+
var _getChildState3 = getChildState(childNodes),
|
|
470
|
+
half = _getChildState3.half,
|
|
471
|
+
_all = _getChildState3.all;
|
|
472
|
+
if (!_all) {
|
|
473
|
+
_this3.checked = _all;
|
|
474
|
+
_this3.indeterminate = half;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
};
|
|
478
|
+
if (this.shouldLoadData()) {
|
|
479
|
+
// Only work on lazy load data.
|
|
480
|
+
this.loadData(function () {
|
|
481
|
+
handleDescendants();
|
|
482
|
+
_reInitChecked(_this3);
|
|
483
|
+
}, {
|
|
484
|
+
checked: value !== false
|
|
485
|
+
});
|
|
486
|
+
return;
|
|
487
|
+
} else {
|
|
488
|
+
handleDescendants();
|
|
584
489
|
}
|
|
585
490
|
}
|
|
491
|
+
var parent = this.parent;
|
|
492
|
+
if (!parent || parent.level === 0) return;
|
|
493
|
+
if (!recursion) {
|
|
494
|
+
_reInitChecked(parent);
|
|
495
|
+
}
|
|
586
496
|
};
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
497
|
+
_proto.getChildren = function getChildren(forceInit) {
|
|
498
|
+
if (forceInit === void 0) {
|
|
499
|
+
forceInit = false;
|
|
500
|
+
}
|
|
501
|
+
// this is data
|
|
502
|
+
if (this.level === 0) return this.data;
|
|
503
|
+
var data = this.data;
|
|
504
|
+
if (!data) return null;
|
|
505
|
+
var props = this.store.props;
|
|
506
|
+
var children = 'children';
|
|
507
|
+
if (props) {
|
|
508
|
+
children = props.children || 'children';
|
|
509
|
+
}
|
|
510
|
+
if (data[children] === undefined) {
|
|
511
|
+
data[children] = null;
|
|
512
|
+
}
|
|
513
|
+
if (forceInit && !data[children]) {
|
|
514
|
+
data[children] = [];
|
|
515
|
+
}
|
|
516
|
+
return data[children];
|
|
598
517
|
};
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
var
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
var key = this.key;
|
|
605
|
-
var checkedKeys = {};
|
|
606
|
-
keys.forEach(function (key) {
|
|
607
|
-
checkedKeys[key] = true;
|
|
518
|
+
_proto.updateChildren = function updateChildren() {
|
|
519
|
+
var _this4 = this;
|
|
520
|
+
var newData = this.getChildren() || [];
|
|
521
|
+
var oldData = this.childNodes.map(function (node) {
|
|
522
|
+
return node.data;
|
|
608
523
|
});
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
524
|
+
var newDataMap = {};
|
|
525
|
+
var newNodes = [];
|
|
526
|
+
newData.forEach(function (item, index) {
|
|
527
|
+
var key = item[NODE_KEY];
|
|
528
|
+
var isNodeExists = !!key && (0,utils_util_namespaceObject.arrayFindIndex)(oldData, function (data) {
|
|
529
|
+
return data[NODE_KEY] === key;
|
|
530
|
+
}) >= 0;
|
|
531
|
+
if (isNodeExists) {
|
|
532
|
+
newDataMap[key] = {
|
|
533
|
+
index: index,
|
|
534
|
+
data: item
|
|
535
|
+
};
|
|
536
|
+
} else {
|
|
537
|
+
newNodes.push({
|
|
538
|
+
index: index,
|
|
539
|
+
data: item
|
|
540
|
+
});
|
|
541
|
+
}
|
|
622
542
|
});
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
if (node) {
|
|
629
|
-
node.setChecked(!!checked, deep);
|
|
543
|
+
if (!this.store.lazy) {
|
|
544
|
+
oldData.forEach(function (item) {
|
|
545
|
+
if (!newDataMap[item[NODE_KEY]]) _this4.removeChildByData(item);
|
|
546
|
+
});
|
|
630
547
|
}
|
|
548
|
+
newNodes.forEach(function (_ref) {
|
|
549
|
+
var index = _ref.index,
|
|
550
|
+
data = _ref.data;
|
|
551
|
+
_this4.insertChild({
|
|
552
|
+
data: data
|
|
553
|
+
}, index);
|
|
554
|
+
});
|
|
555
|
+
this.updateLeafState();
|
|
631
556
|
};
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
TreeStore.prototype.setCurrentNode = function setCurrentNode(node) {
|
|
638
|
-
this.currentNode = node;
|
|
639
|
-
};
|
|
640
|
-
|
|
641
|
-
TreeStore.prototype.setUserCurrentNode = function setUserCurrentNode(node) {
|
|
642
|
-
var key = node[this.key];
|
|
643
|
-
var currNode = this.nodesMap[key];
|
|
644
|
-
this.setCurrentNode(currNode);
|
|
645
|
-
};
|
|
646
|
-
|
|
647
|
-
TreeStore.prototype.setCurrentNodeKey = function setCurrentNodeKey(key) {
|
|
648
|
-
if (key === null) {
|
|
649
|
-
this.currentNode = null;
|
|
650
|
-
return;
|
|
557
|
+
_proto.loadData = function loadData(callback, defaultProps) {
|
|
558
|
+
var _this5 = this;
|
|
559
|
+
if (defaultProps === void 0) {
|
|
560
|
+
defaultProps = {};
|
|
651
561
|
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
562
|
+
if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
|
|
563
|
+
this.loading = true;
|
|
564
|
+
var resolve = function resolve(children) {
|
|
565
|
+
_this5.childNodes = [];
|
|
566
|
+
_this5.doCreateChildren(children, defaultProps);
|
|
567
|
+
_this5.loaded = true;
|
|
568
|
+
_this5.loading = false;
|
|
569
|
+
_this5.updateLeafState();
|
|
570
|
+
if (callback) {
|
|
571
|
+
callback.call(_this5, children);
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
this.store.load(this, resolve);
|
|
575
|
+
} else {
|
|
576
|
+
if (callback) {
|
|
577
|
+
callback.call(this);
|
|
578
|
+
}
|
|
655
579
|
}
|
|
656
580
|
};
|
|
657
|
-
|
|
658
|
-
|
|
581
|
+
return _createClass(Node, [{
|
|
582
|
+
key: "label",
|
|
583
|
+
get: function get() {
|
|
584
|
+
return getPropertyFromData(this, 'label');
|
|
585
|
+
}
|
|
586
|
+
}, {
|
|
587
|
+
key: "key",
|
|
588
|
+
get: function get() {
|
|
589
|
+
var nodeKey = this.store.key;
|
|
590
|
+
if (this.data) return this.data[nodeKey];
|
|
591
|
+
return null;
|
|
592
|
+
}
|
|
593
|
+
}, {
|
|
594
|
+
key: "disabled",
|
|
595
|
+
get: function get() {
|
|
596
|
+
return getPropertyFromData(this, 'disabled');
|
|
597
|
+
}
|
|
598
|
+
}, {
|
|
599
|
+
key: "nextSibling",
|
|
600
|
+
get: function get() {
|
|
601
|
+
var parent = this.parent;
|
|
602
|
+
if (parent) {
|
|
603
|
+
var index = parent.childNodes.indexOf(this);
|
|
604
|
+
if (index > -1) {
|
|
605
|
+
return parent.childNodes[index + 1];
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
return null;
|
|
609
|
+
}
|
|
610
|
+
}, {
|
|
611
|
+
key: "previousSibling",
|
|
612
|
+
get: function get() {
|
|
613
|
+
var parent = this.parent;
|
|
614
|
+
if (parent) {
|
|
615
|
+
var index = parent.childNodes.indexOf(this);
|
|
616
|
+
if (index > -1) {
|
|
617
|
+
return index > 0 ? parent.childNodes[index - 1] : null;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
return null;
|
|
621
|
+
}
|
|
622
|
+
}]);
|
|
659
623
|
}();
|
|
660
624
|
|
|
661
|
-
|
|
662
|
-
;
|
|
663
|
-
|
|
664
|
-
/***/ }),
|
|
665
|
-
|
|
666
|
-
/***/ 292:
|
|
667
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
625
|
+
;// ./packages/tree/src/model/tree-store.js
|
|
668
626
|
|
|
669
|
-
"use strict";
|
|
670
627
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
var _merge2 = _interopRequireDefault(_merge);
|
|
680
|
-
|
|
681
|
-
var _util = __webpack_require__(36);
|
|
682
|
-
|
|
683
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
684
|
-
|
|
685
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
686
|
-
|
|
687
|
-
var getChildState = exports.getChildState = function getChildState(node) {
|
|
688
|
-
var all = true;
|
|
689
|
-
var none = true;
|
|
690
|
-
var allWithoutDisable = true;
|
|
691
|
-
for (var i = 0, j = node.length; i < j; i++) {
|
|
692
|
-
var n = node[i];
|
|
693
|
-
if (n.checked !== true || n.indeterminate) {
|
|
694
|
-
all = false;
|
|
695
|
-
if (!n.disabled) {
|
|
696
|
-
allWithoutDisable = false;
|
|
628
|
+
var TreeStore = /*#__PURE__*/function () {
|
|
629
|
+
function TreeStore(options) {
|
|
630
|
+
var _this = this;
|
|
631
|
+
this.currentNode = null;
|
|
632
|
+
this.currentNodeKey = null;
|
|
633
|
+
for (var option in options) {
|
|
634
|
+
if (options.hasOwnProperty(option)) {
|
|
635
|
+
this[option] = options[option];
|
|
697
636
|
}
|
|
698
637
|
}
|
|
699
|
-
|
|
700
|
-
|
|
638
|
+
this.nodesMap = {};
|
|
639
|
+
this.root = new Node({
|
|
640
|
+
data: this.data,
|
|
641
|
+
store: this
|
|
642
|
+
});
|
|
643
|
+
if (this.lazy && this.load) {
|
|
644
|
+
var loadFn = this.load;
|
|
645
|
+
loadFn(this.root, function (data) {
|
|
646
|
+
_this.root.doCreateChildren(data);
|
|
647
|
+
_this._initDefaultCheckedNodes();
|
|
648
|
+
});
|
|
649
|
+
} else {
|
|
650
|
+
this._initDefaultCheckedNodes();
|
|
701
651
|
}
|
|
702
652
|
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
var
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
node.indeterminate = false;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
var parent = node.parent;
|
|
727
|
-
if (!parent || parent.level === 0) return;
|
|
728
|
-
|
|
729
|
-
if (!node.store.checkStrictly) {
|
|
730
|
-
reInitChecked(parent);
|
|
731
|
-
}
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
var getPropertyFromData = function getPropertyFromData(node, prop) {
|
|
735
|
-
var props = node.store.props;
|
|
736
|
-
var data = node.data || {};
|
|
737
|
-
var config = props[prop];
|
|
738
|
-
|
|
739
|
-
if (typeof config === 'function') {
|
|
740
|
-
return config(data, node);
|
|
741
|
-
} else if (typeof config === 'string') {
|
|
742
|
-
return data[config];
|
|
743
|
-
} else if (typeof config === 'undefined') {
|
|
744
|
-
var dataProp = data[prop];
|
|
745
|
-
return dataProp === undefined ? '' : dataProp;
|
|
746
|
-
}
|
|
747
|
-
};
|
|
748
|
-
|
|
749
|
-
var nodeIdSeed = 0;
|
|
750
|
-
|
|
751
|
-
var Node = function () {
|
|
752
|
-
function Node(options) {
|
|
753
|
-
_classCallCheck(this, Node);
|
|
754
|
-
|
|
755
|
-
this.id = nodeIdSeed++;
|
|
756
|
-
this.text = null;
|
|
757
|
-
this.checked = false;
|
|
758
|
-
this.indeterminate = false;
|
|
759
|
-
this.data = null;
|
|
760
|
-
this.expanded = false;
|
|
761
|
-
this.parent = null;
|
|
762
|
-
this.visible = true;
|
|
763
|
-
|
|
764
|
-
for (var name in options) {
|
|
765
|
-
if (options.hasOwnProperty(name)) {
|
|
766
|
-
this[name] = options[name];
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
// internal
|
|
771
|
-
this.level = 0;
|
|
772
|
-
this.loaded = false;
|
|
773
|
-
this.childNodes = [];
|
|
774
|
-
this.loading = false;
|
|
775
|
-
|
|
776
|
-
if (this.parent) {
|
|
777
|
-
this.level = this.parent.level + 1;
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
var store = this.store;
|
|
781
|
-
if (!store) {
|
|
782
|
-
throw new Error('[Node]store is required!');
|
|
783
|
-
}
|
|
784
|
-
store.registerNode(this);
|
|
785
|
-
|
|
786
|
-
var props = store.props;
|
|
787
|
-
if (props && typeof props.isLeaf !== 'undefined') {
|
|
788
|
-
var isLeaf = getPropertyFromData(this, 'isLeaf');
|
|
789
|
-
if (typeof isLeaf === 'boolean') {
|
|
790
|
-
this.isLeafByUser = isLeaf;
|
|
653
|
+
var _proto = TreeStore.prototype;
|
|
654
|
+
_proto.filter = function filter(value) {
|
|
655
|
+
var filterNodeMethod = this.filterNodeMethod;
|
|
656
|
+
var lazy = this.lazy;
|
|
657
|
+
var _traverse = function traverse(node) {
|
|
658
|
+
var childNodes = node.root ? node.root.childNodes : node.childNodes;
|
|
659
|
+
childNodes.forEach(function (child) {
|
|
660
|
+
child.visible = filterNodeMethod.call(child, value, child.data, child);
|
|
661
|
+
_traverse(child);
|
|
662
|
+
});
|
|
663
|
+
if (!node.visible && childNodes.length) {
|
|
664
|
+
var allHidden = true;
|
|
665
|
+
allHidden = !childNodes.some(function (child) {
|
|
666
|
+
return child.visible;
|
|
667
|
+
});
|
|
668
|
+
if (node.root) {
|
|
669
|
+
node.root.visible = allHidden === false;
|
|
670
|
+
} else {
|
|
671
|
+
node.visible = allHidden === false;
|
|
672
|
+
}
|
|
791
673
|
}
|
|
674
|
+
if (!value) return;
|
|
675
|
+
if (node.visible && !node.isLeaf && !lazy) node.expand();
|
|
676
|
+
};
|
|
677
|
+
_traverse(this);
|
|
678
|
+
};
|
|
679
|
+
_proto.setData = function setData(newVal) {
|
|
680
|
+
var instanceChanged = newVal !== this.root.data;
|
|
681
|
+
if (instanceChanged) {
|
|
682
|
+
this.root.setData(newVal);
|
|
683
|
+
this._initDefaultCheckedNodes();
|
|
684
|
+
} else {
|
|
685
|
+
this.root.updateChildren();
|
|
792
686
|
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
687
|
+
};
|
|
688
|
+
_proto.getNode = function getNode(data) {
|
|
689
|
+
if (data instanceof Node) return data;
|
|
690
|
+
var key = typeof data !== 'object' ? data : util_getNodeKey(this.key, data);
|
|
691
|
+
return this.nodesMap[key] || null;
|
|
692
|
+
};
|
|
693
|
+
_proto.insertBefore = function insertBefore(data, refData) {
|
|
694
|
+
var refNode = this.getNode(refData);
|
|
695
|
+
refNode.parent.insertBefore({
|
|
696
|
+
data: data
|
|
697
|
+
}, refNode);
|
|
698
|
+
};
|
|
699
|
+
_proto.insertAfter = function insertAfter(data, refData) {
|
|
700
|
+
var refNode = this.getNode(refData);
|
|
701
|
+
refNode.parent.insertAfter({
|
|
702
|
+
data: data
|
|
703
|
+
}, refNode);
|
|
704
|
+
};
|
|
705
|
+
_proto.remove = function remove(data) {
|
|
706
|
+
var node = this.getNode(data);
|
|
707
|
+
if (node && node.parent) {
|
|
708
|
+
if (node === this.currentNode) {
|
|
709
|
+
this.currentNode = null;
|
|
799
710
|
}
|
|
800
|
-
|
|
801
|
-
this.expand();
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
if (!this.data) return;
|
|
805
|
-
var defaultExpandedKeys = store.defaultExpandedKeys;
|
|
806
|
-
var key = store.key;
|
|
807
|
-
if (key && defaultExpandedKeys && defaultExpandedKeys.indexOf(this.key) !== -1) {
|
|
808
|
-
this.expand(null, store.autoExpandParent);
|
|
711
|
+
node.parent.removeChild(node);
|
|
809
712
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
713
|
+
};
|
|
714
|
+
_proto.append = function append(data, parentData) {
|
|
715
|
+
var parentNode = parentData ? this.getNode(parentData) : this.root;
|
|
716
|
+
if (parentNode) {
|
|
717
|
+
parentNode.insertChild({
|
|
718
|
+
data: data
|
|
719
|
+
});
|
|
813
720
|
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
721
|
+
};
|
|
722
|
+
_proto._initDefaultCheckedNodes = function _initDefaultCheckedNodes() {
|
|
723
|
+
var _this2 = this;
|
|
724
|
+
var defaultCheckedKeys = this.defaultCheckedKeys || [];
|
|
725
|
+
var nodesMap = this.nodesMap;
|
|
726
|
+
defaultCheckedKeys.forEach(function (checkedKey) {
|
|
727
|
+
var node = nodesMap[checkedKey];
|
|
728
|
+
if (node) {
|
|
729
|
+
node.setChecked(true, !_this2.checkStrictly);
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
};
|
|
733
|
+
_proto._initDefaultCheckedNode = function _initDefaultCheckedNode(node) {
|
|
734
|
+
var defaultCheckedKeys = this.defaultCheckedKeys || [];
|
|
735
|
+
if (defaultCheckedKeys.indexOf(node.key) !== -1) {
|
|
736
|
+
node.setChecked(true, !this.checkStrictly);
|
|
817
737
|
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
if (!Array.isArray(data)) {
|
|
824
|
-
(0, _util.markNodeData)(this, data);
|
|
738
|
+
};
|
|
739
|
+
_proto.setDefaultCheckedKey = function setDefaultCheckedKey(newVal) {
|
|
740
|
+
if (newVal !== this.defaultCheckedKeys) {
|
|
741
|
+
this.defaultCheckedKeys = newVal;
|
|
742
|
+
this._initDefaultCheckedNodes();
|
|
825
743
|
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
var
|
|
831
|
-
if (
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
744
|
+
};
|
|
745
|
+
_proto.registerNode = function registerNode(node) {
|
|
746
|
+
var key = this.key;
|
|
747
|
+
if (!key || !node || !node.data) return;
|
|
748
|
+
var nodeKey = node.key;
|
|
749
|
+
if (nodeKey !== undefined) this.nodesMap[node.key] = node;
|
|
750
|
+
};
|
|
751
|
+
_proto.deregisterNode = function deregisterNode(node) {
|
|
752
|
+
var _this3 = this;
|
|
753
|
+
var key = this.key;
|
|
754
|
+
if (!key || !node || !node.data) return;
|
|
755
|
+
node.childNodes.forEach(function (child) {
|
|
756
|
+
_this3.deregisterNode(child);
|
|
757
|
+
});
|
|
758
|
+
delete this.nodesMap[node.key];
|
|
759
|
+
};
|
|
760
|
+
_proto.getCheckedNodes = function getCheckedNodes(leafOnly, includeHalfChecked) {
|
|
761
|
+
if (leafOnly === void 0) {
|
|
762
|
+
leafOnly = false;
|
|
835
763
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
this.insertChild({ data: children[i] });
|
|
764
|
+
if (includeHalfChecked === void 0) {
|
|
765
|
+
includeHalfChecked = false;
|
|
839
766
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
var children = parent.childNodes || [];
|
|
847
|
-
var result = false;
|
|
848
|
-
for (var i = 0, j = children.length; i < j; i++) {
|
|
849
|
-
var child = children[i];
|
|
850
|
-
if (child === target || deep && walk(child)) {
|
|
851
|
-
result = true;
|
|
852
|
-
break;
|
|
767
|
+
var checkedNodes = [];
|
|
768
|
+
var _traverse2 = function traverse(node) {
|
|
769
|
+
var childNodes = node.root ? node.root.childNodes : node.childNodes;
|
|
770
|
+
childNodes.forEach(function (child) {
|
|
771
|
+
if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
|
|
772
|
+
checkedNodes.push(child.data);
|
|
853
773
|
}
|
|
854
|
-
|
|
855
|
-
|
|
774
|
+
_traverse2(child);
|
|
775
|
+
});
|
|
856
776
|
};
|
|
857
|
-
|
|
858
|
-
return
|
|
777
|
+
_traverse2(this);
|
|
778
|
+
return checkedNodes;
|
|
859
779
|
};
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
parent.removeChild(this);
|
|
780
|
+
_proto.getCheckedKeys = function getCheckedKeys(leafOnly) {
|
|
781
|
+
var _this4 = this;
|
|
782
|
+
if (leafOnly === void 0) {
|
|
783
|
+
leafOnly = false;
|
|
865
784
|
}
|
|
785
|
+
return this.getCheckedNodes(leafOnly).map(function (data) {
|
|
786
|
+
return (data || {})[_this4.key];
|
|
787
|
+
});
|
|
866
788
|
};
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
if (children.indexOf(child.data) === -1) {
|
|
875
|
-
if (typeof index === 'undefined' || index < 0) {
|
|
876
|
-
children.push(child.data);
|
|
877
|
-
} else {
|
|
878
|
-
children.splice(index, 0, child.data);
|
|
879
|
-
}
|
|
789
|
+
_proto.getHalfCheckedNodes = function getHalfCheckedNodes() {
|
|
790
|
+
var nodes = [];
|
|
791
|
+
var _traverse3 = function traverse(node) {
|
|
792
|
+
var childNodes = node.root ? node.root.childNodes : node.childNodes;
|
|
793
|
+
childNodes.forEach(function (child) {
|
|
794
|
+
if (child.indeterminate) {
|
|
795
|
+
nodes.push(child.data);
|
|
880
796
|
}
|
|
881
|
-
|
|
882
|
-
(0, _merge2.default)(child, {
|
|
883
|
-
parent: this,
|
|
884
|
-
store: this.store
|
|
797
|
+
_traverse3(child);
|
|
885
798
|
});
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
child.level = this.level + 1;
|
|
890
|
-
|
|
891
|
-
if (typeof index === 'undefined' || index < 0) {
|
|
892
|
-
this.childNodes.push(child);
|
|
893
|
-
} else {
|
|
894
|
-
this.childNodes.splice(index, 0, child);
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
this.updateLeafState();
|
|
799
|
+
};
|
|
800
|
+
_traverse3(this);
|
|
801
|
+
return nodes;
|
|
898
802
|
};
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
}
|
|
905
|
-
this.insertChild(child, index);
|
|
803
|
+
_proto.getHalfCheckedKeys = function getHalfCheckedKeys() {
|
|
804
|
+
var _this5 = this;
|
|
805
|
+
return this.getHalfCheckedNodes().map(function (data) {
|
|
806
|
+
return (data || {})[_this5.key];
|
|
807
|
+
});
|
|
906
808
|
};
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
var
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
809
|
+
_proto._getAllNodes = function _getAllNodes() {
|
|
810
|
+
var allNodes = [];
|
|
811
|
+
var nodesMap = this.nodesMap;
|
|
812
|
+
for (var nodeKey in nodesMap) {
|
|
813
|
+
if (nodesMap.hasOwnProperty(nodeKey)) {
|
|
814
|
+
allNodes.push(nodesMap[nodeKey]);
|
|
815
|
+
}
|
|
913
816
|
}
|
|
914
|
-
|
|
817
|
+
return allNodes;
|
|
915
818
|
};
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
var
|
|
920
|
-
|
|
921
|
-
|
|
819
|
+
_proto.updateChildren = function updateChildren(key, data) {
|
|
820
|
+
var node = this.nodesMap[key];
|
|
821
|
+
if (!node) return;
|
|
822
|
+
var childNodes = node.childNodes;
|
|
823
|
+
for (var i = childNodes.length - 1; i >= 0; i--) {
|
|
824
|
+
var child = childNodes[i];
|
|
825
|
+
this.remove(child.data);
|
|
922
826
|
}
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
if (index > -1) {
|
|
927
|
-
this.store && this.store.deregisterNode(child);
|
|
928
|
-
child.parent = null;
|
|
929
|
-
this.childNodes.splice(index, 1);
|
|
827
|
+
for (var _i = 0, j = data.length; _i < j; _i++) {
|
|
828
|
+
var _child = data[_i];
|
|
829
|
+
this.append(_child, node.data);
|
|
930
830
|
}
|
|
931
|
-
|
|
932
|
-
this.updateLeafState();
|
|
933
831
|
};
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
if (node.data === data) {
|
|
939
|
-
targetNode = node;
|
|
940
|
-
}
|
|
941
|
-
});
|
|
942
|
-
|
|
943
|
-
if (targetNode) {
|
|
944
|
-
this.removeChild(targetNode);
|
|
832
|
+
_proto._setCheckedKeys = function _setCheckedKeys(key, leafOnly, checkedKeys) {
|
|
833
|
+
var _this6 = this;
|
|
834
|
+
if (leafOnly === void 0) {
|
|
835
|
+
leafOnly = false;
|
|
945
836
|
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
var
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
837
|
+
var allNodes = this._getAllNodes().sort(function (a, b) {
|
|
838
|
+
return b.level - a.level;
|
|
839
|
+
});
|
|
840
|
+
var cache = Object.create(null);
|
|
841
|
+
var keys = Object.keys(checkedKeys);
|
|
842
|
+
allNodes.forEach(function (node) {
|
|
843
|
+
return node.setChecked(false, false);
|
|
844
|
+
});
|
|
845
|
+
var _loop = function _loop() {
|
|
846
|
+
var node = allNodes[i];
|
|
847
|
+
var nodeKey = node.data[key].toString();
|
|
848
|
+
var checked = keys.indexOf(nodeKey) > -1;
|
|
849
|
+
if (!checked) {
|
|
850
|
+
if (node.checked && !cache[nodeKey]) {
|
|
851
|
+
node.setChecked(false, false);
|
|
852
|
+
}
|
|
853
|
+
return 0; // continue
|
|
854
|
+
}
|
|
855
|
+
var parent = node.parent;
|
|
856
|
+
while (parent && parent.level > 0) {
|
|
857
|
+
cache[parent.data[key]] = true;
|
|
956
858
|
parent = parent.parent;
|
|
957
859
|
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
};
|
|
962
|
-
|
|
963
|
-
if (this.shouldLoadData()) {
|
|
964
|
-
this.loadData(function (data) {
|
|
965
|
-
if (data instanceof Array) {
|
|
966
|
-
if (_this.checked) {
|
|
967
|
-
_this.setChecked(true, true);
|
|
968
|
-
} else {
|
|
969
|
-
reInitChecked(_this);
|
|
970
|
-
}
|
|
971
|
-
done();
|
|
860
|
+
if (node.isLeaf || _this6.checkStrictly) {
|
|
861
|
+
node.setChecked(true, false);
|
|
862
|
+
return 0; // continue
|
|
972
863
|
}
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
864
|
+
node.setChecked(true, true);
|
|
865
|
+
if (leafOnly) {
|
|
866
|
+
node.setChecked(false, false);
|
|
867
|
+
var _traverse4 = function traverse(node) {
|
|
868
|
+
var childNodes = node.childNodes;
|
|
869
|
+
childNodes.forEach(function (child) {
|
|
870
|
+
if (!child.isLeaf) {
|
|
871
|
+
child.setChecked(false, false);
|
|
872
|
+
}
|
|
873
|
+
_traverse4(child);
|
|
874
|
+
});
|
|
875
|
+
};
|
|
876
|
+
_traverse4(node);
|
|
877
|
+
}
|
|
878
|
+
},
|
|
879
|
+
_ret;
|
|
880
|
+
for (var i = 0, j = allNodes.length; i < j; i++) {
|
|
881
|
+
_ret = _loop();
|
|
882
|
+
if (_ret === 0) continue;
|
|
976
883
|
}
|
|
977
884
|
};
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
var
|
|
983
|
-
|
|
885
|
+
_proto.setCheckedNodes = function setCheckedNodes(array, leafOnly) {
|
|
886
|
+
if (leafOnly === void 0) {
|
|
887
|
+
leafOnly = false;
|
|
888
|
+
}
|
|
889
|
+
var key = this.key;
|
|
890
|
+
var checkedKeys = {};
|
|
984
891
|
array.forEach(function (item) {
|
|
985
|
-
|
|
892
|
+
checkedKeys[(item || {})[key]] = true;
|
|
986
893
|
});
|
|
894
|
+
this._setCheckedKeys(key, leafOnly, checkedKeys);
|
|
987
895
|
};
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
896
|
+
_proto.setCheckedKeys = function setCheckedKeys(keys, leafOnly) {
|
|
897
|
+
if (leafOnly === void 0) {
|
|
898
|
+
leafOnly = false;
|
|
899
|
+
}
|
|
900
|
+
this.defaultCheckedKeys = keys;
|
|
901
|
+
var key = this.key;
|
|
902
|
+
var checkedKeys = {};
|
|
903
|
+
keys.forEach(function (key) {
|
|
904
|
+
checkedKeys[key] = true;
|
|
905
|
+
});
|
|
906
|
+
this._setCheckedKeys(key, leafOnly, checkedKeys);
|
|
991
907
|
};
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
908
|
+
_proto.setDefaultExpandedKeys = function setDefaultExpandedKeys(keys) {
|
|
909
|
+
var _this7 = this;
|
|
910
|
+
keys = keys || [];
|
|
911
|
+
this.defaultExpandedKeys = keys;
|
|
912
|
+
keys.forEach(function (key) {
|
|
913
|
+
var node = _this7.getNode(key);
|
|
914
|
+
if (node) node.expand(null, _this7.autoExpandParent);
|
|
915
|
+
});
|
|
995
916
|
};
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
if (
|
|
999
|
-
|
|
1000
|
-
return;
|
|
1001
|
-
}
|
|
1002
|
-
var childNodes = this.childNodes;
|
|
1003
|
-
if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
|
|
1004
|
-
this.isLeaf = !childNodes || childNodes.length === 0;
|
|
1005
|
-
return;
|
|
917
|
+
_proto.setChecked = function setChecked(data, checked, deep) {
|
|
918
|
+
var node = this.getNode(data);
|
|
919
|
+
if (node) {
|
|
920
|
+
node.setChecked(!!checked, deep);
|
|
1006
921
|
}
|
|
1007
|
-
this.isLeaf = false;
|
|
1008
922
|
};
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
var _this3 = this;
|
|
1012
|
-
|
|
1013
|
-
this.indeterminate = value === 'half';
|
|
1014
|
-
this.checked = value === true;
|
|
1015
|
-
|
|
1016
|
-
if (this.store.checkStrictly) return;
|
|
1017
|
-
|
|
1018
|
-
if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
|
|
1019
|
-
var _getChildState2 = getChildState(this.childNodes),
|
|
1020
|
-
all = _getChildState2.all,
|
|
1021
|
-
allWithoutDisable = _getChildState2.allWithoutDisable;
|
|
1022
|
-
|
|
1023
|
-
if (!this.isLeaf && !all && allWithoutDisable) {
|
|
1024
|
-
this.checked = false;
|
|
1025
|
-
value = false;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
var handleDescendants = function handleDescendants() {
|
|
1029
|
-
if (deep) {
|
|
1030
|
-
var childNodes = _this3.childNodes;
|
|
1031
|
-
for (var i = 0, j = childNodes.length; i < j; i++) {
|
|
1032
|
-
var child = childNodes[i];
|
|
1033
|
-
passValue = passValue || value !== false;
|
|
1034
|
-
var isCheck = child.disabled ? child.checked : passValue;
|
|
1035
|
-
child.setChecked(isCheck, deep, true, passValue);
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
var _getChildState3 = getChildState(childNodes),
|
|
1039
|
-
half = _getChildState3.half,
|
|
1040
|
-
_all = _getChildState3.all;
|
|
1041
|
-
|
|
1042
|
-
if (!_all) {
|
|
1043
|
-
_this3.checked = _all;
|
|
1044
|
-
_this3.indeterminate = half;
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
};
|
|
1048
|
-
|
|
1049
|
-
if (this.shouldLoadData()) {
|
|
1050
|
-
// Only work on lazy load data.
|
|
1051
|
-
this.loadData(function () {
|
|
1052
|
-
handleDescendants();
|
|
1053
|
-
reInitChecked(_this3);
|
|
1054
|
-
}, {
|
|
1055
|
-
checked: value !== false
|
|
1056
|
-
});
|
|
1057
|
-
return;
|
|
1058
|
-
} else {
|
|
1059
|
-
handleDescendants();
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
var parent = this.parent;
|
|
1064
|
-
if (!parent || parent.level === 0) return;
|
|
1065
|
-
|
|
1066
|
-
if (!recursion) {
|
|
1067
|
-
reInitChecked(parent);
|
|
1068
|
-
}
|
|
923
|
+
_proto.getCurrentNode = function getCurrentNode() {
|
|
924
|
+
return this.currentNode;
|
|
1069
925
|
};
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
if (this.level === 0) return this.data;
|
|
1075
|
-
var data = this.data;
|
|
1076
|
-
if (!data) return null;
|
|
1077
|
-
|
|
1078
|
-
var props = this.store.props;
|
|
1079
|
-
var children = 'children';
|
|
1080
|
-
if (props) {
|
|
1081
|
-
children = props.children || 'children';
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
if (data[children] === undefined) {
|
|
1085
|
-
data[children] = null;
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
if (forceInit && !data[children]) {
|
|
1089
|
-
data[children] = [];
|
|
926
|
+
_proto.setCurrentNode = function setCurrentNode(currentNode) {
|
|
927
|
+
var prevCurrentNode = this.currentNode;
|
|
928
|
+
if (prevCurrentNode) {
|
|
929
|
+
prevCurrentNode.isCurrent = false;
|
|
1090
930
|
}
|
|
1091
|
-
|
|
1092
|
-
|
|
931
|
+
this.currentNode = currentNode;
|
|
932
|
+
this.currentNode.isCurrent = true;
|
|
1093
933
|
};
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
var
|
|
1097
|
-
|
|
1098
|
-
var newData = this.getChildren() || [];
|
|
1099
|
-
var oldData = this.childNodes.map(function (node) {
|
|
1100
|
-
return node.data;
|
|
1101
|
-
});
|
|
1102
|
-
|
|
1103
|
-
var newDataMap = {};
|
|
1104
|
-
var newNodes = [];
|
|
1105
|
-
|
|
1106
|
-
newData.forEach(function (item, index) {
|
|
1107
|
-
if (item[_util.NODE_KEY]) {
|
|
1108
|
-
newDataMap[item[_util.NODE_KEY]] = { index: index, data: item };
|
|
1109
|
-
} else {
|
|
1110
|
-
newNodes.push({ index: index, data: item });
|
|
1111
|
-
}
|
|
1112
|
-
});
|
|
1113
|
-
|
|
1114
|
-
oldData.forEach(function (item) {
|
|
1115
|
-
if (!newDataMap[item[_util.NODE_KEY]]) _this4.removeChildByData(item);
|
|
1116
|
-
});
|
|
1117
|
-
|
|
1118
|
-
newNodes.forEach(function (_ref) {
|
|
1119
|
-
var index = _ref.index,
|
|
1120
|
-
data = _ref.data;
|
|
1121
|
-
|
|
1122
|
-
_this4.insertChild({ data: data }, index);
|
|
1123
|
-
});
|
|
1124
|
-
|
|
1125
|
-
this.updateLeafState();
|
|
934
|
+
_proto.setUserCurrentNode = function setUserCurrentNode(node) {
|
|
935
|
+
var key = node[this.key];
|
|
936
|
+
var currNode = this.nodesMap[key];
|
|
937
|
+
this.setCurrentNode(currNode);
|
|
1126
938
|
};
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
var resolve = function resolve(children) {
|
|
1137
|
-
_this5.loaded = true;
|
|
1138
|
-
_this5.loading = false;
|
|
1139
|
-
_this5.childNodes = [];
|
|
1140
|
-
|
|
1141
|
-
_this5.doCreateChildren(children, defaultProps);
|
|
1142
|
-
|
|
1143
|
-
_this5.updateLeafState();
|
|
1144
|
-
if (callback) {
|
|
1145
|
-
callback.call(_this5, children);
|
|
1146
|
-
}
|
|
1147
|
-
};
|
|
1148
|
-
|
|
1149
|
-
this.store.load(this, resolve);
|
|
1150
|
-
} else {
|
|
1151
|
-
if (callback) {
|
|
1152
|
-
callback.call(this);
|
|
1153
|
-
}
|
|
939
|
+
_proto.setCurrentNodeKey = function setCurrentNodeKey(key) {
|
|
940
|
+
if (key === null || key === undefined) {
|
|
941
|
+
this.currentNode && (this.currentNode.isCurrent = false);
|
|
942
|
+
this.currentNode = null;
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
var node = this.getNode(key);
|
|
946
|
+
if (node) {
|
|
947
|
+
this.setCurrentNode(node);
|
|
1154
948
|
}
|
|
1155
949
|
};
|
|
950
|
+
return TreeStore;
|
|
951
|
+
}();
|
|
1156
952
|
|
|
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
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
return
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
|
1217
|
-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_script_index_0_tree_node_vue__ = __webpack_require__(96);
|
|
1218
|
-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_script_index_0_tree_node_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_script_index_0_tree_node_vue__);
|
|
1219
|
-
/* harmony namespace reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_script_index_0_tree_node_vue__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_script_index_0_tree_node_vue__[key]; }) }(__WEBPACK_IMPORT_KEY__));
|
|
1220
|
-
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_13_7_3_vue_loader_lib_template_compiler_index_id_data_v_473bc9ff_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_template_index_0_tree_node_vue__ = __webpack_require__(294);
|
|
1221
|
-
var normalizeComponent = __webpack_require__(0)
|
|
1222
|
-
/* script */
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
/* template */
|
|
1226
|
-
|
|
1227
|
-
/* template functional */
|
|
1228
|
-
var __vue_template_functional__ = false
|
|
1229
|
-
/* styles */
|
|
1230
|
-
var __vue_styles__ = null
|
|
1231
|
-
/* scopeId */
|
|
1232
|
-
var __vue_scopeId__ = null
|
|
1233
|
-
/* moduleIdentifier (server only) */
|
|
1234
|
-
var __vue_module_identifier__ = null
|
|
1235
|
-
var Component = normalizeComponent(
|
|
1236
|
-
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_script_index_0_tree_node_vue___default.a,
|
|
1237
|
-
__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_13_7_3_vue_loader_lib_template_compiler_index_id_data_v_473bc9ff_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_13_7_3_vue_loader_lib_selector_type_template_index_0_tree_node_vue__["a" /* default */],
|
|
1238
|
-
__vue_template_functional__,
|
|
1239
|
-
__vue_styles__,
|
|
1240
|
-
__vue_scopeId__,
|
|
1241
|
-
__vue_module_identifier__
|
|
1242
|
-
)
|
|
1243
|
-
|
|
1244
|
-
/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
/***/ }),
|
|
1248
|
-
|
|
1249
|
-
/***/ 294:
|
|
1250
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1251
|
-
|
|
1252
|
-
"use strict";
|
|
1253
|
-
var render = function () {
|
|
1254
|
-
var this$1 = this;
|
|
1255
|
-
var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.node.visible),expression:"node.visible"}],ref:"node",staticClass:"el-tree-node",class:{
|
|
1256
|
-
'is-expanded': _vm.expanded,
|
|
1257
|
-
'is-current': _vm.tree.store.currentNode === _vm.node,
|
|
1258
|
-
'is-hidden': !_vm.node.visible,
|
|
1259
|
-
'is-focusable': !_vm.node.disabled,
|
|
1260
|
-
'is-checked': !_vm.node.disabled && _vm.node.checked
|
|
1261
|
-
},attrs:{"role":"treeitem","tabindex":"-1","aria-expanded":_vm.expanded,"aria-disabled":_vm.node.disabled,"aria-checked":_vm.node.checked,"draggable":_vm.tree.draggable},on:{"click":function($event){$event.stopPropagation();return _vm.handleClick($event)},"contextmenu":function ($event) { return this$1.handleContextMenu($event); },"dragstart":function($event){$event.stopPropagation();return _vm.handleDragStart($event)},"dragover":function($event){$event.stopPropagation();return _vm.handleDragOver($event)},"dragend":function($event){$event.stopPropagation();return _vm.handleDragEnd($event)},"drop":function($event){$event.stopPropagation();return _vm.handleDrop($event)}}},[_c('div',{staticClass:"el-tree-node__content",style:({ 'padding-left': (_vm.node.level - 1) * _vm.tree.indent + 'px' })},[_c('span',{staticClass:"el-tree-node__expand-icon el-icon-caret-right",class:{ 'is-leaf': _vm.node.isLeaf, expanded: !_vm.node.isLeaf && _vm.expanded },on:{"click":function($event){$event.stopPropagation();return _vm.handleExpandIconClick($event)}}}),(_vm.showCheckbox)?_c('el-checkbox',{attrs:{"indeterminate":_vm.node.indeterminate,"disabled":!!_vm.node.disabled},on:{"change":_vm.handleCheckChange},nativeOn:{"click":function($event){$event.stopPropagation();}},model:{value:(_vm.node.checked),callback:function ($$v) {_vm.$set(_vm.node, "checked", $$v)},expression:"node.checked"}}):_vm._e(),(_vm.node.loading)?_c('span',{staticClass:"el-tree-node__loading-icon el-icon-loading"}):_vm._e(),_c('node-content',{attrs:{"node":_vm.node}})],1),_c('el-collapse-transition',[(!_vm.renderAfterExpand || _vm.childNodeRendered)?_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.expanded),expression:"expanded"}],staticClass:"el-tree-node__children",attrs:{"role":"group","aria-expanded":_vm.expanded}},_vm._l((_vm.node.childNodes),function(child){return _c('el-tree-node',{key:_vm.getNodeKey(child),attrs:{"render-content":_vm.renderContent,"render-after-expand":_vm.renderAfterExpand,"node":child},on:{"node-expand":_vm.handleChildNodeExpand}})})):_vm._e()])],1)}
|
|
1262
|
-
var staticRenderFns = []
|
|
1263
|
-
var esExports = { render: render, staticRenderFns: staticRenderFns }
|
|
1264
|
-
/* harmony default export */ __webpack_exports__["a"] = (esExports);
|
|
1265
|
-
|
|
1266
|
-
/***/ }),
|
|
1267
|
-
|
|
1268
|
-
/***/ 295:
|
|
1269
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1270
|
-
|
|
1271
|
-
"use strict";
|
|
1272
|
-
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"el-tree",class:{
|
|
1273
|
-
'el-tree--highlight-current': _vm.highlightCurrent,
|
|
1274
|
-
'is-dragging': !!_vm.dragState.draggingNode,
|
|
1275
|
-
'is-drop-not-allow': !_vm.dragState.allowDrop,
|
|
1276
|
-
'is-drop-inner': _vm.dragState.dropType === 'inner'
|
|
1277
|
-
},attrs:{"role":"tree"}},[_vm._l((_vm.root.childNodes),function(child){return _c('el-tree-node',{key:_vm.getNodeKey(child),attrs:{"node":child,"props":_vm.props,"render-after-expand":_vm.renderAfterExpand,"render-content":_vm.renderContent},on:{"node-expand":_vm.handleNodeExpand}})}),(!_vm.root.childNodes || _vm.root.childNodes.length === 0)?_c('div',{staticClass:"el-tree__empty-block"},[_c('span',{staticClass:"el-tree__empty-text"},[_vm._v(_vm._s(_vm.emptyText))])]):_vm._e(),_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.dragState.showDropIndicator),expression:"dragState.showDropIndicator"}],ref:"dropIndicator",staticClass:"el-tree__drop-indicator"})],2)}
|
|
1278
|
-
var staticRenderFns = []
|
|
1279
|
-
var esExports = { render: render, staticRenderFns: staticRenderFns }
|
|
1280
|
-
/* harmony default export */ __webpack_exports__["a"] = (esExports);
|
|
1281
|
-
|
|
1282
|
-
/***/ }),
|
|
1283
|
-
|
|
1284
|
-
/***/ 36:
|
|
1285
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1286
|
-
|
|
1287
|
-
"use strict";
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
exports.__esModule = true;
|
|
1291
|
-
var NODE_KEY = exports.NODE_KEY = '$treeNodeId';
|
|
1292
|
-
|
|
1293
|
-
var markNodeData = exports.markNodeData = function markNodeData(node, data) {
|
|
1294
|
-
if (!data || data[NODE_KEY]) return;
|
|
1295
|
-
Object.defineProperty(data, NODE_KEY, {
|
|
1296
|
-
value: node.id,
|
|
1297
|
-
enumerable: false,
|
|
1298
|
-
configurable: false,
|
|
1299
|
-
writable: false
|
|
1300
|
-
});
|
|
1301
|
-
};
|
|
1302
|
-
|
|
1303
|
-
var getNodeKey = exports.getNodeKey = function getNodeKey(key, data) {
|
|
1304
|
-
if (!key) return data[NODE_KEY];
|
|
1305
|
-
return data[key];
|
|
1306
|
-
};
|
|
1307
|
-
|
|
1308
|
-
var findNearestComponent = exports.findNearestComponent = function findNearestComponent(element, componentName) {
|
|
1309
|
-
var target = element;
|
|
1310
|
-
while (target && target.tagName !== 'BODY') {
|
|
1311
|
-
if (target.__vue__ && target.__vue__.$options.name === componentName) {
|
|
1312
|
-
return target.__vue__;
|
|
1313
|
-
}
|
|
1314
|
-
target = target.parentNode;
|
|
1315
|
-
}
|
|
1316
|
-
return null;
|
|
1317
|
-
};
|
|
1318
|
-
|
|
1319
|
-
/***/ }),
|
|
1320
|
-
|
|
1321
|
-
/***/ 9:
|
|
1322
|
-
/***/ (function(module, exports) {
|
|
1323
|
-
|
|
1324
|
-
module.exports = require("element-ui/lib/utils/merge");
|
|
1325
|
-
|
|
1326
|
-
/***/ }),
|
|
1327
|
-
|
|
1328
|
-
/***/ 95:
|
|
1329
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1330
|
-
|
|
1331
|
-
"use strict";
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
exports.__esModule = true;
|
|
1335
|
-
|
|
1336
|
-
var _treeStore = __webpack_require__(291);
|
|
1337
|
-
|
|
1338
|
-
var _treeStore2 = _interopRequireDefault(_treeStore);
|
|
1339
|
-
|
|
1340
|
-
var _util = __webpack_require__(36);
|
|
1341
|
-
|
|
1342
|
-
var _treeNode = __webpack_require__(293);
|
|
1343
|
-
|
|
1344
|
-
var _treeNode2 = _interopRequireDefault(_treeNode);
|
|
1345
|
-
|
|
1346
|
-
var _locale = __webpack_require__(12);
|
|
1347
|
-
|
|
1348
|
-
var _emitter = __webpack_require__(1);
|
|
1349
|
-
|
|
1350
|
-
var _emitter2 = _interopRequireDefault(_emitter);
|
|
1351
|
-
|
|
1352
|
-
var _dom = __webpack_require__(2);
|
|
1353
|
-
|
|
1354
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1355
|
-
|
|
1356
|
-
//
|
|
1357
|
-
//
|
|
1358
|
-
//
|
|
1359
|
-
//
|
|
1360
|
-
//
|
|
1361
|
-
//
|
|
1362
|
-
//
|
|
1363
|
-
//
|
|
1364
|
-
//
|
|
1365
|
-
//
|
|
1366
|
-
//
|
|
1367
|
-
//
|
|
1368
|
-
//
|
|
1369
|
-
//
|
|
1370
|
-
//
|
|
1371
|
-
//
|
|
1372
|
-
//
|
|
1373
|
-
//
|
|
1374
|
-
//
|
|
1375
|
-
//
|
|
1376
|
-
//
|
|
1377
|
-
//
|
|
1378
|
-
//
|
|
1379
|
-
//
|
|
1380
|
-
//
|
|
1381
|
-
//
|
|
1382
|
-
//
|
|
1383
|
-
//
|
|
1384
|
-
//
|
|
1385
|
-
//
|
|
1386
|
-
//
|
|
1387
|
-
|
|
1388
|
-
exports.default = {
|
|
1389
|
-
name: 'ElTree',
|
|
1390
|
-
|
|
1391
|
-
mixins: [_emitter2.default],
|
|
1392
|
-
|
|
1393
|
-
components: {
|
|
1394
|
-
ElTreeNode: _treeNode2.default
|
|
1395
|
-
},
|
|
1396
|
-
|
|
1397
|
-
data: function data() {
|
|
1398
|
-
return {
|
|
1399
|
-
store: null,
|
|
1400
|
-
root: null,
|
|
1401
|
-
currentNode: null,
|
|
1402
|
-
treeItems: null,
|
|
1403
|
-
checkboxItems: [],
|
|
1404
|
-
dragState: {
|
|
1405
|
-
showDropIndicator: false,
|
|
1406
|
-
draggingNode: null,
|
|
1407
|
-
dropNode: null,
|
|
1408
|
-
allowDrop: true
|
|
1409
|
-
}
|
|
1410
|
-
};
|
|
1411
|
-
},
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
props: {
|
|
1415
|
-
data: {
|
|
1416
|
-
type: Array
|
|
1417
|
-
},
|
|
1418
|
-
emptyText: {
|
|
1419
|
-
type: String,
|
|
1420
|
-
default: function _default() {
|
|
1421
|
-
return (0, _locale.t)('el.tree.emptyText');
|
|
1422
|
-
}
|
|
1423
|
-
},
|
|
1424
|
-
renderAfterExpand: {
|
|
1425
|
-
type: Boolean,
|
|
1426
|
-
default: true
|
|
1427
|
-
},
|
|
1428
|
-
nodeKey: String,
|
|
1429
|
-
checkStrictly: Boolean,
|
|
1430
|
-
defaultExpandAll: Boolean,
|
|
1431
|
-
expandOnClickNode: {
|
|
1432
|
-
type: Boolean,
|
|
1433
|
-
default: true
|
|
1434
|
-
},
|
|
1435
|
-
checkOnClickNode: Boolean,
|
|
1436
|
-
checkDescendants: {
|
|
1437
|
-
type: Boolean,
|
|
1438
|
-
default: false
|
|
1439
|
-
},
|
|
1440
|
-
autoExpandParent: {
|
|
1441
|
-
type: Boolean,
|
|
1442
|
-
default: true
|
|
1443
|
-
},
|
|
1444
|
-
defaultCheckedKeys: Array,
|
|
1445
|
-
defaultExpandedKeys: Array,
|
|
1446
|
-
renderContent: Function,
|
|
1447
|
-
showCheckbox: {
|
|
1448
|
-
type: Boolean,
|
|
1449
|
-
default: false
|
|
1450
|
-
},
|
|
1451
|
-
draggable: {
|
|
1452
|
-
type: Boolean,
|
|
1453
|
-
default: false
|
|
1454
|
-
},
|
|
1455
|
-
allowDrag: Function,
|
|
1456
|
-
allowDrop: Function,
|
|
1457
|
-
props: {
|
|
1458
|
-
default: function _default() {
|
|
1459
|
-
return {
|
|
1460
|
-
children: 'children',
|
|
1461
|
-
label: 'label',
|
|
1462
|
-
icon: 'icon',
|
|
1463
|
-
disabled: 'disabled'
|
|
1464
|
-
};
|
|
1465
|
-
}
|
|
1466
|
-
},
|
|
1467
|
-
lazy: {
|
|
1468
|
-
type: Boolean,
|
|
1469
|
-
default: false
|
|
1470
|
-
},
|
|
1471
|
-
highlightCurrent: Boolean,
|
|
1472
|
-
load: Function,
|
|
1473
|
-
filterNodeMethod: Function,
|
|
1474
|
-
accordion: Boolean,
|
|
1475
|
-
indent: {
|
|
1476
|
-
type: Number,
|
|
1477
|
-
default: 18
|
|
1478
|
-
}
|
|
1479
|
-
},
|
|
1480
|
-
|
|
1481
|
-
computed: {
|
|
1482
|
-
children: {
|
|
1483
|
-
set: function set(value) {
|
|
1484
|
-
this.data = value;
|
|
953
|
+
;
|
|
954
|
+
;// ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/tree/src/tree-node.vue?vue&type=template&id=3902b62c
|
|
955
|
+
var tree_nodevue_type_template_id_3902b62c_render = function () {
|
|
956
|
+
var this$1 = this
|
|
957
|
+
var _vm = this
|
|
958
|
+
var _h = _vm.$createElement
|
|
959
|
+
var _c = _vm._self._c || _h
|
|
960
|
+
return _c(
|
|
961
|
+
"div",
|
|
962
|
+
{
|
|
963
|
+
directives: [
|
|
964
|
+
{
|
|
965
|
+
name: "show",
|
|
966
|
+
rawName: "v-show",
|
|
967
|
+
value: _vm.node.visible,
|
|
968
|
+
expression: "node.visible",
|
|
969
|
+
},
|
|
970
|
+
],
|
|
971
|
+
ref: "node",
|
|
972
|
+
staticClass: "el-tree-node",
|
|
973
|
+
class: {
|
|
974
|
+
"is-expanded": _vm.expanded,
|
|
975
|
+
"is-current": _vm.node.isCurrent,
|
|
976
|
+
"is-hidden": !_vm.node.visible,
|
|
977
|
+
"is-focusable": !_vm.node.disabled,
|
|
978
|
+
"is-checked": !_vm.node.disabled && _vm.node.checked,
|
|
979
|
+
},
|
|
980
|
+
attrs: {
|
|
981
|
+
role: "treeitem",
|
|
982
|
+
tabindex: "-1",
|
|
983
|
+
"aria-expanded": _vm.expanded,
|
|
984
|
+
"aria-disabled": _vm.node.disabled,
|
|
985
|
+
"aria-checked": _vm.node.checked,
|
|
986
|
+
draggable: _vm.tree.draggable,
|
|
987
|
+
},
|
|
988
|
+
on: {
|
|
989
|
+
click: function ($event) {
|
|
990
|
+
$event.stopPropagation()
|
|
991
|
+
return _vm.handleClick($event)
|
|
992
|
+
},
|
|
993
|
+
contextmenu: function ($event) {
|
|
994
|
+
return this$1.handleContextMenu($event)
|
|
995
|
+
},
|
|
996
|
+
dragstart: function ($event) {
|
|
997
|
+
$event.stopPropagation()
|
|
998
|
+
return _vm.handleDragStart($event)
|
|
999
|
+
},
|
|
1000
|
+
dragover: function ($event) {
|
|
1001
|
+
$event.stopPropagation()
|
|
1002
|
+
return _vm.handleDragOver($event)
|
|
1003
|
+
},
|
|
1004
|
+
dragend: function ($event) {
|
|
1005
|
+
$event.stopPropagation()
|
|
1006
|
+
return _vm.handleDragEnd($event)
|
|
1007
|
+
},
|
|
1008
|
+
drop: function ($event) {
|
|
1009
|
+
$event.stopPropagation()
|
|
1010
|
+
return _vm.handleDrop($event)
|
|
1011
|
+
},
|
|
1485
1012
|
},
|
|
1486
|
-
get: function get() {
|
|
1487
|
-
return this.data;
|
|
1488
|
-
}
|
|
1489
|
-
},
|
|
1490
|
-
|
|
1491
|
-
treeItemArray: function treeItemArray() {
|
|
1492
|
-
return Array.prototype.slice.call(this.treeItems);
|
|
1493
|
-
}
|
|
1494
|
-
},
|
|
1495
|
-
|
|
1496
|
-
watch: {
|
|
1497
|
-
defaultCheckedKeys: function defaultCheckedKeys(newVal) {
|
|
1498
|
-
this.store.defaultCheckedKeys = newVal;
|
|
1499
|
-
this.store.setDefaultCheckedKey(newVal);
|
|
1500
|
-
},
|
|
1501
|
-
defaultExpandedKeys: function defaultExpandedKeys(newVal) {
|
|
1502
|
-
this.store.defaultExpandedKeys = newVal;
|
|
1503
|
-
this.store.setDefaultExpandedKeys(newVal);
|
|
1504
|
-
},
|
|
1505
|
-
data: function data(newVal) {
|
|
1506
|
-
this.store.setData(newVal);
|
|
1507
|
-
},
|
|
1508
|
-
checkboxItems: function checkboxItems(val) {
|
|
1509
|
-
Array.prototype.forEach.call(val, function (checkbox) {
|
|
1510
|
-
checkbox.setAttribute('tabindex', -1);
|
|
1511
|
-
});
|
|
1512
|
-
},
|
|
1513
|
-
checkStrictly: function checkStrictly(newVal) {
|
|
1514
|
-
this.store.checkStrictly = newVal;
|
|
1515
|
-
}
|
|
1516
|
-
},
|
|
1517
|
-
|
|
1518
|
-
methods: {
|
|
1519
|
-
filter: function filter(value) {
|
|
1520
|
-
if (!this.filterNodeMethod) throw new Error('[Tree] filterNodeMethod is required when filter');
|
|
1521
|
-
this.store.filter(value);
|
|
1522
|
-
},
|
|
1523
|
-
getNodeKey: function getNodeKey(node) {
|
|
1524
|
-
return (0, _util.getNodeKey)(this.nodeKey, node.data);
|
|
1525
|
-
},
|
|
1526
|
-
getNodePath: function getNodePath(data) {
|
|
1527
|
-
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getNodePath');
|
|
1528
|
-
var node = this.store.getNode(data);
|
|
1529
|
-
if (!node) return [];
|
|
1530
|
-
var path = [node.data];
|
|
1531
|
-
var parent = node.parent;
|
|
1532
|
-
while (parent && parent !== this.root) {
|
|
1533
|
-
path.push(parent.data);
|
|
1534
|
-
parent = parent.parent;
|
|
1535
|
-
}
|
|
1536
|
-
return path.reverse();
|
|
1537
|
-
},
|
|
1538
|
-
getCheckedNodes: function getCheckedNodes(leafOnly) {
|
|
1539
|
-
return this.store.getCheckedNodes(leafOnly);
|
|
1540
|
-
},
|
|
1541
|
-
getCheckedKeys: function getCheckedKeys(leafOnly) {
|
|
1542
|
-
return this.store.getCheckedKeys(leafOnly);
|
|
1543
|
-
},
|
|
1544
|
-
getCurrentNode: function getCurrentNode() {
|
|
1545
|
-
var currentNode = this.store.getCurrentNode();
|
|
1546
|
-
return currentNode ? currentNode.data : null;
|
|
1547
|
-
},
|
|
1548
|
-
getCurrentKey: function getCurrentKey() {
|
|
1549
|
-
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getCurrentKey');
|
|
1550
|
-
var currentNode = this.getCurrentNode();
|
|
1551
|
-
return currentNode ? currentNode[this.nodeKey] : null;
|
|
1552
|
-
},
|
|
1553
|
-
setCheckedNodes: function setCheckedNodes(nodes, leafOnly) {
|
|
1554
|
-
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedNodes');
|
|
1555
|
-
this.store.setCheckedNodes(nodes, leafOnly);
|
|
1556
|
-
},
|
|
1557
|
-
setCheckedKeys: function setCheckedKeys(keys, leafOnly) {
|
|
1558
|
-
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedKeys');
|
|
1559
|
-
this.store.setCheckedKeys(keys, leafOnly);
|
|
1560
|
-
},
|
|
1561
|
-
setChecked: function setChecked(data, checked, deep) {
|
|
1562
|
-
this.store.setChecked(data, checked, deep);
|
|
1563
|
-
},
|
|
1564
|
-
getHalfCheckedNodes: function getHalfCheckedNodes() {
|
|
1565
|
-
return this.store.getHalfCheckedNodes();
|
|
1566
|
-
},
|
|
1567
|
-
getHalfCheckedKeys: function getHalfCheckedKeys() {
|
|
1568
|
-
return this.store.getHalfCheckedKeys();
|
|
1569
|
-
},
|
|
1570
|
-
setCurrentNode: function setCurrentNode(node) {
|
|
1571
|
-
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentNode');
|
|
1572
|
-
this.store.setUserCurrentNode(node);
|
|
1573
|
-
},
|
|
1574
|
-
setCurrentKey: function setCurrentKey(key) {
|
|
1575
|
-
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentKey');
|
|
1576
|
-
this.store.setCurrentNodeKey(key);
|
|
1577
|
-
},
|
|
1578
|
-
getNode: function getNode(data) {
|
|
1579
|
-
return this.store.getNode(data);
|
|
1580
|
-
},
|
|
1581
|
-
remove: function remove(data) {
|
|
1582
|
-
this.store.remove(data);
|
|
1583
|
-
},
|
|
1584
|
-
append: function append(data, parentNode) {
|
|
1585
|
-
this.store.append(data, parentNode);
|
|
1586
|
-
},
|
|
1587
|
-
insertBefore: function insertBefore(data, refNode) {
|
|
1588
|
-
this.store.insertBefore(data, refNode);
|
|
1589
|
-
},
|
|
1590
|
-
insertAfter: function insertAfter(data, refNode) {
|
|
1591
|
-
this.store.insertAfter(data, refNode);
|
|
1592
|
-
},
|
|
1593
|
-
handleNodeExpand: function handleNodeExpand(nodeData, node, instance) {
|
|
1594
|
-
this.broadcast('ElTreeNode', 'tree-node-expand', node);
|
|
1595
|
-
this.$emit('node-expand', nodeData, node, instance);
|
|
1596
|
-
},
|
|
1597
|
-
updateKeyChildren: function updateKeyChildren(key, data) {
|
|
1598
|
-
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in updateKeyChild');
|
|
1599
|
-
this.store.updateChildren(key, data);
|
|
1600
|
-
},
|
|
1601
|
-
initTabIndex: function initTabIndex() {
|
|
1602
|
-
this.treeItems = this.$el.querySelectorAll('.is-focusable[role=treeitem]');
|
|
1603
|
-
this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
|
|
1604
|
-
var checkedItem = this.$el.querySelectorAll('.is-checked[role=treeitem]');
|
|
1605
|
-
if (checkedItem.length) {
|
|
1606
|
-
checkedItem[0].setAttribute('tabindex', 0);
|
|
1607
|
-
return;
|
|
1608
|
-
}
|
|
1609
|
-
this.treeItems[0] && this.treeItems[0].setAttribute('tabindex', 0);
|
|
1610
1013
|
},
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
_this.$emit('node-drag-enter', draggingNode.node, dropNode.node, event);
|
|
1706
|
-
}
|
|
1707
|
-
|
|
1708
|
-
if (dropPrev || dropInner || dropNext) {
|
|
1709
|
-
dragState.dropNode = dropNode;
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
|
-
if (dropNode.node.nextSibling === draggingNode.node) {
|
|
1713
|
-
dropNext = false;
|
|
1714
|
-
}
|
|
1715
|
-
if (dropNode.node.previousSibling === draggingNode.node) {
|
|
1716
|
-
dropPrev = false;
|
|
1717
|
-
}
|
|
1718
|
-
if (dropNode.node.contains(draggingNode.node, false)) {
|
|
1719
|
-
dropInner = false;
|
|
1720
|
-
}
|
|
1721
|
-
if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
|
|
1722
|
-
dropPrev = false;
|
|
1723
|
-
dropInner = false;
|
|
1724
|
-
dropNext = false;
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
var targetPosition = dropNode.$el.querySelector('.el-tree-node__expand-icon').getBoundingClientRect();
|
|
1728
|
-
var treePosition = _this.$el.getBoundingClientRect();
|
|
1729
|
-
|
|
1730
|
-
var dropType = void 0;
|
|
1731
|
-
var prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.5 : 1 : -1;
|
|
1732
|
-
var nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.5 : 0 : 1;
|
|
1733
|
-
|
|
1734
|
-
var indicatorTop = -9999;
|
|
1735
|
-
var distance = event.clientY - targetPosition.top;
|
|
1736
|
-
if (distance < targetPosition.height * prevPercent) {
|
|
1737
|
-
dropType = 'before';
|
|
1738
|
-
} else if (distance > targetPosition.height * nextPercent) {
|
|
1739
|
-
dropType = 'after';
|
|
1740
|
-
} else if (dropInner) {
|
|
1741
|
-
dropType = 'inner';
|
|
1742
|
-
} else {
|
|
1743
|
-
dropType = 'none';
|
|
1744
|
-
}
|
|
1745
|
-
|
|
1746
|
-
var dropIndicator = _this.$refs.dropIndicator;
|
|
1747
|
-
if (dropType === 'before') {
|
|
1748
|
-
indicatorTop = targetPosition.top - treePosition.top;
|
|
1749
|
-
} else if (dropType === 'after') {
|
|
1750
|
-
indicatorTop = targetPosition.bottom - treePosition.top;
|
|
1751
|
-
}
|
|
1752
|
-
dropIndicator.style.top = indicatorTop + 'px';
|
|
1753
|
-
dropIndicator.style.left = targetPosition.right - treePosition.left + 'px';
|
|
1754
|
-
|
|
1755
|
-
if (dropType === 'inner') {
|
|
1756
|
-
(0, _dom.addClass)(dropNode.$el, 'is-drop-inner');
|
|
1757
|
-
} else {
|
|
1758
|
-
(0, _dom.removeClass)(dropNode.$el, 'is-drop-inner');
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
|
-
dragState.showDropIndicator = dropType === 'before' || dropType === 'after';
|
|
1762
|
-
dragState.dropType = dropType;
|
|
1763
|
-
_this.$emit('node-drag-over', draggingNode.node, dropNode.node, event);
|
|
1764
|
-
});
|
|
1765
|
-
|
|
1766
|
-
this.$on('tree-node-drag-end', function (event) {
|
|
1767
|
-
var draggingNode = dragState.draggingNode,
|
|
1768
|
-
dropType = dragState.dropType,
|
|
1769
|
-
dropNode = dragState.dropNode;
|
|
1770
|
-
|
|
1771
|
-
event.preventDefault();
|
|
1772
|
-
event.dataTransfer.dropEffect = 'move';
|
|
1773
|
-
|
|
1774
|
-
if (draggingNode && dropNode) {
|
|
1775
|
-
var data = draggingNode.node.data;
|
|
1776
|
-
if (dropType === 'before') {
|
|
1777
|
-
draggingNode.node.remove();
|
|
1778
|
-
dropNode.node.parent.insertBefore({ data: data }, dropNode.node);
|
|
1779
|
-
} else if (dropType === 'after') {
|
|
1780
|
-
draggingNode.node.remove();
|
|
1781
|
-
dropNode.node.parent.insertAfter({ data: data }, dropNode.node);
|
|
1782
|
-
} else if (dropType === 'inner') {
|
|
1783
|
-
dropNode.node.insertChild({ data: data });
|
|
1784
|
-
draggingNode.node.remove();
|
|
1785
|
-
}
|
|
1786
|
-
(0, _dom.removeClass)(dropNode.$el, 'is-drop-inner');
|
|
1787
|
-
|
|
1788
|
-
_this.$emit('node-drag-end', draggingNode.node, dropNode.node, dropType, event);
|
|
1789
|
-
if (dropType !== 'none') {
|
|
1790
|
-
_this.$emit('node-drop', draggingNode.node, dropNode.node, dropType, event);
|
|
1791
|
-
}
|
|
1792
|
-
}
|
|
1793
|
-
if (draggingNode && !dropNode) {
|
|
1794
|
-
_this.$emit('node-drag-end', draggingNode.node, null, dropType, event);
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
dragState.showDropIndicator = false;
|
|
1798
|
-
dragState.draggingNode = null;
|
|
1799
|
-
dragState.dropNode = null;
|
|
1800
|
-
dragState.allowDrop = true;
|
|
1801
|
-
});
|
|
1802
|
-
},
|
|
1803
|
-
mounted: function mounted() {
|
|
1804
|
-
this.initTabIndex();
|
|
1805
|
-
this.$el.addEventListener('keydown', this.handelKeydown);
|
|
1806
|
-
},
|
|
1807
|
-
updated: function updated() {
|
|
1808
|
-
this.treeItems = this.$el.querySelectorAll('[role=treeitem]');
|
|
1809
|
-
this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
|
|
1810
|
-
}
|
|
1811
|
-
};
|
|
1812
|
-
|
|
1813
|
-
/***/ }),
|
|
1814
|
-
|
|
1815
|
-
/***/ 96:
|
|
1816
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1817
|
-
|
|
1818
|
-
"use strict";
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
exports.__esModule = true;
|
|
1822
|
-
|
|
1823
|
-
var _collapseTransition = __webpack_require__(22);
|
|
1824
|
-
|
|
1825
|
-
var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
|
|
1826
|
-
|
|
1827
|
-
var _checkbox = __webpack_require__(16);
|
|
1828
|
-
|
|
1829
|
-
var _checkbox2 = _interopRequireDefault(_checkbox);
|
|
1830
|
-
|
|
1831
|
-
var _emitter = __webpack_require__(1);
|
|
1832
|
-
|
|
1833
|
-
var _emitter2 = _interopRequireDefault(_emitter);
|
|
1014
|
+
[
|
|
1015
|
+
_c(
|
|
1016
|
+
"div",
|
|
1017
|
+
{
|
|
1018
|
+
staticClass: "el-tree-node__content",
|
|
1019
|
+
style: {
|
|
1020
|
+
"padding-left": (_vm.node.level - 1) * _vm.tree.indent + "px",
|
|
1021
|
+
},
|
|
1022
|
+
},
|
|
1023
|
+
[
|
|
1024
|
+
_c("span", {
|
|
1025
|
+
class: [
|
|
1026
|
+
{
|
|
1027
|
+
"is-leaf": _vm.node.isLeaf,
|
|
1028
|
+
expanded: !_vm.node.isLeaf && _vm.expanded,
|
|
1029
|
+
},
|
|
1030
|
+
"el-tree-node__expand-icon",
|
|
1031
|
+
_vm.tree.iconClass ? _vm.tree.iconClass : "el-icon-caret-right",
|
|
1032
|
+
],
|
|
1033
|
+
on: {
|
|
1034
|
+
click: function ($event) {
|
|
1035
|
+
$event.stopPropagation()
|
|
1036
|
+
return _vm.handleExpandIconClick($event)
|
|
1037
|
+
},
|
|
1038
|
+
},
|
|
1039
|
+
}),
|
|
1040
|
+
_vm.showCheckbox
|
|
1041
|
+
? _c("el-checkbox", {
|
|
1042
|
+
attrs: {
|
|
1043
|
+
indeterminate: _vm.node.indeterminate,
|
|
1044
|
+
disabled: !!_vm.node.disabled,
|
|
1045
|
+
},
|
|
1046
|
+
on: { change: _vm.handleCheckChange },
|
|
1047
|
+
nativeOn: {
|
|
1048
|
+
click: function ($event) {
|
|
1049
|
+
$event.stopPropagation()
|
|
1050
|
+
},
|
|
1051
|
+
},
|
|
1052
|
+
model: {
|
|
1053
|
+
value: _vm.node.checked,
|
|
1054
|
+
callback: function ($$v) {
|
|
1055
|
+
_vm.$set(_vm.node, "checked", $$v)
|
|
1056
|
+
},
|
|
1057
|
+
expression: "node.checked",
|
|
1058
|
+
},
|
|
1059
|
+
})
|
|
1060
|
+
: _vm._e(),
|
|
1061
|
+
_vm.node.loading
|
|
1062
|
+
? _c("span", {
|
|
1063
|
+
staticClass: "el-tree-node__loading-icon el-icon-loading",
|
|
1064
|
+
})
|
|
1065
|
+
: _vm._e(),
|
|
1066
|
+
_c("node-content", { attrs: { node: _vm.node } }),
|
|
1067
|
+
],
|
|
1068
|
+
1
|
|
1069
|
+
),
|
|
1070
|
+
_c("el-collapse-transition", [
|
|
1071
|
+
!_vm.renderAfterExpand || _vm.childNodeRendered
|
|
1072
|
+
? _c(
|
|
1073
|
+
"div",
|
|
1074
|
+
{
|
|
1075
|
+
directives: [
|
|
1076
|
+
{
|
|
1077
|
+
name: "show",
|
|
1078
|
+
rawName: "v-show",
|
|
1079
|
+
value: _vm.expanded,
|
|
1080
|
+
expression: "expanded",
|
|
1081
|
+
},
|
|
1082
|
+
],
|
|
1083
|
+
staticClass: "el-tree-node__children",
|
|
1084
|
+
attrs: { role: "group", "aria-expanded": _vm.expanded },
|
|
1085
|
+
},
|
|
1086
|
+
_vm._l(_vm.node.childNodes, function (child) {
|
|
1087
|
+
return _c("el-tree-node", {
|
|
1088
|
+
key: _vm.getNodeKey(child),
|
|
1089
|
+
attrs: {
|
|
1090
|
+
"render-content": _vm.renderContent,
|
|
1091
|
+
"render-after-expand": _vm.renderAfterExpand,
|
|
1092
|
+
"show-checkbox": _vm.showCheckbox,
|
|
1093
|
+
node: child,
|
|
1094
|
+
},
|
|
1095
|
+
on: { "node-expand": _vm.handleChildNodeExpand },
|
|
1096
|
+
})
|
|
1097
|
+
}),
|
|
1098
|
+
1
|
|
1099
|
+
)
|
|
1100
|
+
: _vm._e(),
|
|
1101
|
+
]),
|
|
1102
|
+
],
|
|
1103
|
+
1
|
|
1104
|
+
)
|
|
1105
|
+
}
|
|
1106
|
+
var tree_nodevue_type_template_id_3902b62c_staticRenderFns = []
|
|
1107
|
+
tree_nodevue_type_template_id_3902b62c_render._withStripped = true
|
|
1834
1108
|
|
|
1835
|
-
var _util = __webpack_require__(36);
|
|
1836
1109
|
|
|
1837
|
-
|
|
1110
|
+
;// ./packages/tree/src/tree-node.vue?vue&type=template&id=3902b62c
|
|
1838
1111
|
|
|
1112
|
+
;// external "mazey-element-ui/lib/transitions/collapse-transition"
|
|
1113
|
+
const collapse_transition_namespaceObject = require("mazey-element-ui/lib/transitions/collapse-transition");
|
|
1114
|
+
var collapse_transition_default = /*#__PURE__*/__webpack_require__.n(collapse_transition_namespaceObject);
|
|
1115
|
+
;// external "mazey-element-ui/lib/checkbox"
|
|
1116
|
+
const checkbox_namespaceObject = require("mazey-element-ui/lib/checkbox");
|
|
1117
|
+
var checkbox_default = /*#__PURE__*/__webpack_require__.n(checkbox_namespaceObject);
|
|
1118
|
+
;// external "mazey-element-ui/lib/mixins/emitter"
|
|
1119
|
+
const emitter_namespaceObject = require("mazey-element-ui/lib/mixins/emitter");
|
|
1120
|
+
var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_namespaceObject);
|
|
1121
|
+
;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/tree/src/tree-node.vue?vue&type=script&lang=js
|
|
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
|
+
//
|
|
1839
1153
|
//
|
|
1840
1154
|
//
|
|
1841
1155
|
//
|
|
@@ -1878,6 +1192,327 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
1878
1192
|
//
|
|
1879
1193
|
//
|
|
1880
1194
|
//
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
/* harmony default export */ const tree_nodevue_type_script_lang_js = ({
|
|
1201
|
+
name: 'ElTreeNode',
|
|
1202
|
+
componentName: 'ElTreeNode',
|
|
1203
|
+
mixins: [(emitter_default())],
|
|
1204
|
+
props: {
|
|
1205
|
+
node: {
|
|
1206
|
+
default: function _default() {
|
|
1207
|
+
return {};
|
|
1208
|
+
}
|
|
1209
|
+
},
|
|
1210
|
+
props: {},
|
|
1211
|
+
renderContent: Function,
|
|
1212
|
+
renderAfterExpand: {
|
|
1213
|
+
type: Boolean,
|
|
1214
|
+
default: true
|
|
1215
|
+
},
|
|
1216
|
+
showCheckbox: {
|
|
1217
|
+
type: Boolean,
|
|
1218
|
+
default: false
|
|
1219
|
+
}
|
|
1220
|
+
},
|
|
1221
|
+
components: {
|
|
1222
|
+
ElCollapseTransition: (collapse_transition_default()),
|
|
1223
|
+
ElCheckbox: (checkbox_default()),
|
|
1224
|
+
NodeContent: {
|
|
1225
|
+
props: {
|
|
1226
|
+
node: {
|
|
1227
|
+
required: true
|
|
1228
|
+
}
|
|
1229
|
+
},
|
|
1230
|
+
render: function render(h) {
|
|
1231
|
+
var parent = this.$parent;
|
|
1232
|
+
var tree = parent.tree;
|
|
1233
|
+
var node = this.node;
|
|
1234
|
+
var data = node.data,
|
|
1235
|
+
store = node.store;
|
|
1236
|
+
return parent.renderContent ? parent.renderContent.call(parent._renderProxy, h, {
|
|
1237
|
+
_self: tree.$vnode.context,
|
|
1238
|
+
node: node,
|
|
1239
|
+
data: data,
|
|
1240
|
+
store: store
|
|
1241
|
+
}) : tree.$scopedSlots.default ? tree.$scopedSlots.default({
|
|
1242
|
+
node: node,
|
|
1243
|
+
data: data
|
|
1244
|
+
}) : h("span", {
|
|
1245
|
+
"class": "el-tree-node__label"
|
|
1246
|
+
}, [node.label]);
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
data: function data() {
|
|
1251
|
+
return {
|
|
1252
|
+
tree: null,
|
|
1253
|
+
expanded: false,
|
|
1254
|
+
childNodeRendered: false,
|
|
1255
|
+
oldChecked: null,
|
|
1256
|
+
oldIndeterminate: null
|
|
1257
|
+
};
|
|
1258
|
+
},
|
|
1259
|
+
watch: {
|
|
1260
|
+
'node.indeterminate': function nodeIndeterminate(val) {
|
|
1261
|
+
this.handleSelectChange(this.node.checked, val);
|
|
1262
|
+
},
|
|
1263
|
+
'node.checked': function nodeChecked(val) {
|
|
1264
|
+
this.handleSelectChange(val, this.node.indeterminate);
|
|
1265
|
+
},
|
|
1266
|
+
'node.expanded': function nodeExpanded(val) {
|
|
1267
|
+
var _this = this;
|
|
1268
|
+
this.$nextTick(function () {
|
|
1269
|
+
return _this.expanded = val;
|
|
1270
|
+
});
|
|
1271
|
+
if (val) {
|
|
1272
|
+
this.childNodeRendered = true;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
},
|
|
1276
|
+
methods: {
|
|
1277
|
+
getNodeKey: function getNodeKey(node) {
|
|
1278
|
+
return util_getNodeKey(this.tree.nodeKey, node.data);
|
|
1279
|
+
},
|
|
1280
|
+
handleSelectChange: function handleSelectChange(checked, indeterminate) {
|
|
1281
|
+
if (this.oldChecked !== checked && this.oldIndeterminate !== indeterminate) {
|
|
1282
|
+
this.tree.$emit('check-change', this.node.data, checked, indeterminate);
|
|
1283
|
+
}
|
|
1284
|
+
this.oldChecked = checked;
|
|
1285
|
+
this.indeterminate = indeterminate;
|
|
1286
|
+
},
|
|
1287
|
+
handleClick: function handleClick() {
|
|
1288
|
+
var store = this.tree.store;
|
|
1289
|
+
store.setCurrentNode(this.node);
|
|
1290
|
+
this.tree.$emit('current-change', store.currentNode ? store.currentNode.data : null, store.currentNode);
|
|
1291
|
+
this.tree.currentNode = this;
|
|
1292
|
+
if (this.tree.expandOnClickNode) {
|
|
1293
|
+
this.handleExpandIconClick();
|
|
1294
|
+
}
|
|
1295
|
+
if (this.tree.checkOnClickNode && !this.node.disabled) {
|
|
1296
|
+
this.handleCheckChange(null, {
|
|
1297
|
+
target: {
|
|
1298
|
+
checked: !this.node.checked
|
|
1299
|
+
}
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
this.tree.$emit('node-click', this.node.data, this.node, this);
|
|
1303
|
+
},
|
|
1304
|
+
handleContextMenu: function handleContextMenu(event) {
|
|
1305
|
+
if (this.tree._events['node-contextmenu'] && this.tree._events['node-contextmenu'].length > 0) {
|
|
1306
|
+
event.stopPropagation();
|
|
1307
|
+
event.preventDefault();
|
|
1308
|
+
}
|
|
1309
|
+
this.tree.$emit('node-contextmenu', event, this.node.data, this.node, this);
|
|
1310
|
+
},
|
|
1311
|
+
handleExpandIconClick: function handleExpandIconClick() {
|
|
1312
|
+
if (this.node.isLeaf) return;
|
|
1313
|
+
if (this.expanded) {
|
|
1314
|
+
this.tree.$emit('node-collapse', this.node.data, this.node, this);
|
|
1315
|
+
this.node.collapse();
|
|
1316
|
+
} else {
|
|
1317
|
+
this.node.expand();
|
|
1318
|
+
this.$emit('node-expand', this.node.data, this.node, this);
|
|
1319
|
+
}
|
|
1320
|
+
},
|
|
1321
|
+
handleCheckChange: function handleCheckChange(value, ev) {
|
|
1322
|
+
var _this2 = this;
|
|
1323
|
+
this.node.setChecked(ev.target.checked, !this.tree.checkStrictly);
|
|
1324
|
+
this.$nextTick(function () {
|
|
1325
|
+
var store = _this2.tree.store;
|
|
1326
|
+
_this2.tree.$emit('check', _this2.node.data, {
|
|
1327
|
+
checkedNodes: store.getCheckedNodes(),
|
|
1328
|
+
checkedKeys: store.getCheckedKeys(),
|
|
1329
|
+
halfCheckedNodes: store.getHalfCheckedNodes(),
|
|
1330
|
+
halfCheckedKeys: store.getHalfCheckedKeys()
|
|
1331
|
+
});
|
|
1332
|
+
});
|
|
1333
|
+
},
|
|
1334
|
+
handleChildNodeExpand: function handleChildNodeExpand(nodeData, node, instance) {
|
|
1335
|
+
this.broadcast('ElTreeNode', 'tree-node-expand', node);
|
|
1336
|
+
this.tree.$emit('node-expand', nodeData, node, instance);
|
|
1337
|
+
},
|
|
1338
|
+
handleDragStart: function handleDragStart(event) {
|
|
1339
|
+
if (!this.tree.draggable) return;
|
|
1340
|
+
this.tree.$emit('tree-node-drag-start', event, this);
|
|
1341
|
+
},
|
|
1342
|
+
handleDragOver: function handleDragOver(event) {
|
|
1343
|
+
if (!this.tree.draggable) return;
|
|
1344
|
+
this.tree.$emit('tree-node-drag-over', event, this);
|
|
1345
|
+
event.preventDefault();
|
|
1346
|
+
},
|
|
1347
|
+
handleDrop: function handleDrop(event) {
|
|
1348
|
+
event.preventDefault();
|
|
1349
|
+
},
|
|
1350
|
+
handleDragEnd: function handleDragEnd(event) {
|
|
1351
|
+
if (!this.tree.draggable) return;
|
|
1352
|
+
this.tree.$emit('tree-node-drag-end', event, this);
|
|
1353
|
+
}
|
|
1354
|
+
},
|
|
1355
|
+
created: function created() {
|
|
1356
|
+
var _this3 = this;
|
|
1357
|
+
var parent = this.$parent;
|
|
1358
|
+
if (parent.isTree) {
|
|
1359
|
+
this.tree = parent;
|
|
1360
|
+
} else {
|
|
1361
|
+
this.tree = parent.tree;
|
|
1362
|
+
}
|
|
1363
|
+
var tree = this.tree;
|
|
1364
|
+
if (!tree) {
|
|
1365
|
+
console.warn('Can not find node\'s tree.');
|
|
1366
|
+
}
|
|
1367
|
+
var props = tree.props || {};
|
|
1368
|
+
var childrenKey = props['children'] || 'children';
|
|
1369
|
+
this.$watch("node.data." + childrenKey, function () {
|
|
1370
|
+
_this3.node.updateChildren();
|
|
1371
|
+
});
|
|
1372
|
+
if (this.node.expanded) {
|
|
1373
|
+
this.expanded = true;
|
|
1374
|
+
this.childNodeRendered = true;
|
|
1375
|
+
}
|
|
1376
|
+
if (this.tree.accordion) {
|
|
1377
|
+
this.$on('tree-node-expand', function (node) {
|
|
1378
|
+
if (_this3.node !== node) {
|
|
1379
|
+
_this3.node.collapse();
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
});
|
|
1385
|
+
;// ./packages/tree/src/tree-node.vue?vue&type=script&lang=js
|
|
1386
|
+
/* harmony default export */ const src_tree_nodevue_type_script_lang_js = (tree_nodevue_type_script_lang_js);
|
|
1387
|
+
;// ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
1388
|
+
/* globals __VUE_SSR_CONTEXT__ */
|
|
1389
|
+
|
|
1390
|
+
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
1391
|
+
// This module is a runtime utility for cleaner component module output and will
|
|
1392
|
+
// be included in the final webpack user bundle.
|
|
1393
|
+
|
|
1394
|
+
function normalizeComponent(
|
|
1395
|
+
scriptExports,
|
|
1396
|
+
render,
|
|
1397
|
+
staticRenderFns,
|
|
1398
|
+
functionalTemplate,
|
|
1399
|
+
injectStyles,
|
|
1400
|
+
scopeId,
|
|
1401
|
+
moduleIdentifier /* server only */,
|
|
1402
|
+
shadowMode /* vue-cli only */
|
|
1403
|
+
) {
|
|
1404
|
+
// Vue.extend constructor export interop
|
|
1405
|
+
var options =
|
|
1406
|
+
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
1407
|
+
|
|
1408
|
+
// render functions
|
|
1409
|
+
if (render) {
|
|
1410
|
+
options.render = render
|
|
1411
|
+
options.staticRenderFns = staticRenderFns
|
|
1412
|
+
options._compiled = true
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
// functional template
|
|
1416
|
+
if (functionalTemplate) {
|
|
1417
|
+
options.functional = true
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
// scopedId
|
|
1421
|
+
if (scopeId) {
|
|
1422
|
+
options._scopeId = 'data-v-' + scopeId
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
var hook
|
|
1426
|
+
if (moduleIdentifier) {
|
|
1427
|
+
// server build
|
|
1428
|
+
hook = function (context) {
|
|
1429
|
+
// 2.3 injection
|
|
1430
|
+
context =
|
|
1431
|
+
context || // cached call
|
|
1432
|
+
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
1433
|
+
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
1434
|
+
// 2.2 with runInNewContext: true
|
|
1435
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
1436
|
+
context = __VUE_SSR_CONTEXT__
|
|
1437
|
+
}
|
|
1438
|
+
// inject component styles
|
|
1439
|
+
if (injectStyles) {
|
|
1440
|
+
injectStyles.call(this, context)
|
|
1441
|
+
}
|
|
1442
|
+
// register component module identifier for async chunk inferrence
|
|
1443
|
+
if (context && context._registeredComponents) {
|
|
1444
|
+
context._registeredComponents.add(moduleIdentifier)
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
// used by ssr in case component is cached and beforeCreate
|
|
1448
|
+
// never gets called
|
|
1449
|
+
options._ssrRegister = hook
|
|
1450
|
+
} else if (injectStyles) {
|
|
1451
|
+
hook = shadowMode
|
|
1452
|
+
? function () {
|
|
1453
|
+
injectStyles.call(
|
|
1454
|
+
this,
|
|
1455
|
+
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
1456
|
+
)
|
|
1457
|
+
}
|
|
1458
|
+
: injectStyles
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
if (hook) {
|
|
1462
|
+
if (options.functional) {
|
|
1463
|
+
// for template-only hot-reload because in that case the render fn doesn't
|
|
1464
|
+
// go through the normalizer
|
|
1465
|
+
options._injectStyles = hook
|
|
1466
|
+
// register for functional component in vue file
|
|
1467
|
+
var originalRender = options.render
|
|
1468
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
1469
|
+
hook.call(context)
|
|
1470
|
+
return originalRender(h, context)
|
|
1471
|
+
}
|
|
1472
|
+
} else {
|
|
1473
|
+
// inject component registration as beforeCreate hook
|
|
1474
|
+
var existing = options.beforeCreate
|
|
1475
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
return {
|
|
1480
|
+
exports: scriptExports,
|
|
1481
|
+
options: options
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
;// ./packages/tree/src/tree-node.vue
|
|
1486
|
+
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
/* normalize component */
|
|
1492
|
+
;
|
|
1493
|
+
var component = normalizeComponent(
|
|
1494
|
+
src_tree_nodevue_type_script_lang_js,
|
|
1495
|
+
tree_nodevue_type_template_id_3902b62c_render,
|
|
1496
|
+
tree_nodevue_type_template_id_3902b62c_staticRenderFns,
|
|
1497
|
+
false,
|
|
1498
|
+
null,
|
|
1499
|
+
null,
|
|
1500
|
+
null
|
|
1501
|
+
|
|
1502
|
+
)
|
|
1503
|
+
|
|
1504
|
+
/* harmony default export */ const tree_node = (component.exports);
|
|
1505
|
+
;// external "mazey-element-ui/lib/locale"
|
|
1506
|
+
const locale_namespaceObject = require("mazey-element-ui/lib/locale");
|
|
1507
|
+
;// external "mazey-element-ui/lib/utils/dom"
|
|
1508
|
+
const dom_namespaceObject = require("mazey-element-ui/lib/utils/dom");
|
|
1509
|
+
;// ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options!./packages/tree/src/tree.vue?vue&type=script&lang=js
|
|
1510
|
+
//
|
|
1511
|
+
//
|
|
1512
|
+
//
|
|
1513
|
+
//
|
|
1514
|
+
//
|
|
1515
|
+
//
|
|
1881
1516
|
//
|
|
1882
1517
|
//
|
|
1883
1518
|
//
|
|
@@ -1905,202 +1540,453 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
1905
1540
|
//
|
|
1906
1541
|
//
|
|
1907
1542
|
|
|
1908
|
-
exports.default = {
|
|
1909
|
-
name: 'ElTreeNode',
|
|
1910
1543
|
|
|
1911
|
-
componentName: 'ElTreeNode',
|
|
1912
1544
|
|
|
1913
|
-
mixins: [_emitter2.default],
|
|
1914
1545
|
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
|
|
1549
|
+
/* harmony default export */ const treevue_type_script_lang_js = ({
|
|
1550
|
+
name: 'ElTree',
|
|
1551
|
+
mixins: [(emitter_default())],
|
|
1552
|
+
components: {
|
|
1553
|
+
ElTreeNode: tree_node
|
|
1554
|
+
},
|
|
1555
|
+
data: function data() {
|
|
1556
|
+
return {
|
|
1557
|
+
store: null,
|
|
1558
|
+
root: null,
|
|
1559
|
+
currentNode: null,
|
|
1560
|
+
treeItems: null,
|
|
1561
|
+
checkboxItems: [],
|
|
1562
|
+
dragState: {
|
|
1563
|
+
showDropIndicator: false,
|
|
1564
|
+
draggingNode: null,
|
|
1565
|
+
dropNode: null,
|
|
1566
|
+
allowDrop: true
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
},
|
|
1915
1570
|
props: {
|
|
1916
|
-
|
|
1571
|
+
data: {
|
|
1572
|
+
type: Array
|
|
1573
|
+
},
|
|
1574
|
+
emptyText: {
|
|
1575
|
+
type: String,
|
|
1917
1576
|
default: function _default() {
|
|
1918
|
-
return
|
|
1577
|
+
return (0,locale_namespaceObject.t)('el.tree.emptyText');
|
|
1919
1578
|
}
|
|
1920
1579
|
},
|
|
1921
|
-
props: {},
|
|
1922
|
-
renderContent: Function,
|
|
1923
1580
|
renderAfterExpand: {
|
|
1924
1581
|
type: Boolean,
|
|
1925
1582
|
default: true
|
|
1926
|
-
}
|
|
1583
|
+
},
|
|
1584
|
+
nodeKey: String,
|
|
1585
|
+
checkStrictly: Boolean,
|
|
1586
|
+
defaultExpandAll: Boolean,
|
|
1587
|
+
expandOnClickNode: {
|
|
1588
|
+
type: Boolean,
|
|
1589
|
+
default: true
|
|
1590
|
+
},
|
|
1591
|
+
checkOnClickNode: Boolean,
|
|
1592
|
+
checkDescendants: {
|
|
1593
|
+
type: Boolean,
|
|
1594
|
+
default: false
|
|
1595
|
+
},
|
|
1596
|
+
autoExpandParent: {
|
|
1597
|
+
type: Boolean,
|
|
1598
|
+
default: true
|
|
1599
|
+
},
|
|
1600
|
+
defaultCheckedKeys: Array,
|
|
1601
|
+
defaultExpandedKeys: Array,
|
|
1602
|
+
currentNodeKey: [String, Number],
|
|
1603
|
+
renderContent: Function,
|
|
1604
|
+
showCheckbox: {
|
|
1605
|
+
type: Boolean,
|
|
1606
|
+
default: false
|
|
1607
|
+
},
|
|
1608
|
+
draggable: {
|
|
1609
|
+
type: Boolean,
|
|
1610
|
+
default: false
|
|
1611
|
+
},
|
|
1612
|
+
allowDrag: Function,
|
|
1613
|
+
allowDrop: Function,
|
|
1614
|
+
props: {
|
|
1615
|
+
default: function _default() {
|
|
1616
|
+
return {
|
|
1617
|
+
children: 'children',
|
|
1618
|
+
label: 'label',
|
|
1619
|
+
disabled: 'disabled'
|
|
1620
|
+
};
|
|
1621
|
+
}
|
|
1622
|
+
},
|
|
1623
|
+
lazy: {
|
|
1624
|
+
type: Boolean,
|
|
1625
|
+
default: false
|
|
1626
|
+
},
|
|
1627
|
+
highlightCurrent: Boolean,
|
|
1628
|
+
load: Function,
|
|
1629
|
+
filterNodeMethod: Function,
|
|
1630
|
+
accordion: Boolean,
|
|
1631
|
+
indent: {
|
|
1632
|
+
type: Number,
|
|
1633
|
+
default: 18
|
|
1634
|
+
},
|
|
1635
|
+
iconClass: String
|
|
1927
1636
|
},
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
NodeContent: {
|
|
1933
|
-
props: {
|
|
1934
|
-
node: {
|
|
1935
|
-
required: true
|
|
1936
|
-
}
|
|
1637
|
+
computed: {
|
|
1638
|
+
children: {
|
|
1639
|
+
set: function set(value) {
|
|
1640
|
+
this.data = value;
|
|
1937
1641
|
},
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
var tree = parent.tree;
|
|
1941
|
-
var node = this.node;
|
|
1942
|
-
var data = node.data,
|
|
1943
|
-
store = node.store;
|
|
1944
|
-
|
|
1945
|
-
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(
|
|
1946
|
-
'span',
|
|
1947
|
-
{ 'class': 'el-tree-node__label' },
|
|
1948
|
-
[node.label]
|
|
1949
|
-
);
|
|
1642
|
+
get: function get() {
|
|
1643
|
+
return this.data;
|
|
1950
1644
|
}
|
|
1645
|
+
},
|
|
1646
|
+
treeItemArray: function treeItemArray() {
|
|
1647
|
+
return Array.prototype.slice.call(this.treeItems);
|
|
1648
|
+
},
|
|
1649
|
+
isEmpty: function isEmpty() {
|
|
1650
|
+
var childNodes = this.root.childNodes;
|
|
1651
|
+
return !childNodes || childNodes.length === 0 || childNodes.every(function (_ref) {
|
|
1652
|
+
var visible = _ref.visible;
|
|
1653
|
+
return !visible;
|
|
1654
|
+
});
|
|
1951
1655
|
}
|
|
1952
1656
|
},
|
|
1953
|
-
|
|
1954
|
-
data: function data() {
|
|
1955
|
-
return {
|
|
1956
|
-
tree: null,
|
|
1957
|
-
expanded: false,
|
|
1958
|
-
childNodeRendered: false,
|
|
1959
|
-
showCheckbox: false,
|
|
1960
|
-
oldChecked: null,
|
|
1961
|
-
oldIndeterminate: null
|
|
1962
|
-
};
|
|
1963
|
-
},
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
1657
|
watch: {
|
|
1967
|
-
|
|
1968
|
-
this.
|
|
1658
|
+
defaultCheckedKeys: function defaultCheckedKeys(newVal) {
|
|
1659
|
+
this.store.setDefaultCheckedKey(newVal);
|
|
1969
1660
|
},
|
|
1970
|
-
|
|
1971
|
-
this.
|
|
1661
|
+
defaultExpandedKeys: function defaultExpandedKeys(newVal) {
|
|
1662
|
+
this.store.defaultExpandedKeys = newVal;
|
|
1663
|
+
this.store.setDefaultExpandedKeys(newVal);
|
|
1664
|
+
},
|
|
1665
|
+
data: function data(newVal) {
|
|
1666
|
+
this.store.setData(newVal);
|
|
1667
|
+
},
|
|
1668
|
+
checkboxItems: function checkboxItems(val) {
|
|
1669
|
+
Array.prototype.forEach.call(val, function (checkbox) {
|
|
1670
|
+
checkbox.setAttribute('tabindex', -1);
|
|
1671
|
+
});
|
|
1672
|
+
},
|
|
1673
|
+
checkStrictly: function checkStrictly(newVal) {
|
|
1674
|
+
this.store.checkStrictly = newVal;
|
|
1675
|
+
}
|
|
1676
|
+
},
|
|
1677
|
+
methods: {
|
|
1678
|
+
filter: function filter(value) {
|
|
1679
|
+
if (!this.filterNodeMethod) throw new Error('[Tree] filterNodeMethod is required when filter');
|
|
1680
|
+
this.store.filter(value);
|
|
1681
|
+
},
|
|
1682
|
+
getNodeKey: function getNodeKey(node) {
|
|
1683
|
+
return util_getNodeKey(this.nodeKey, node.data);
|
|
1684
|
+
},
|
|
1685
|
+
getNodePath: function getNodePath(data) {
|
|
1686
|
+
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getNodePath');
|
|
1687
|
+
var node = this.store.getNode(data);
|
|
1688
|
+
if (!node) return [];
|
|
1689
|
+
var path = [node.data];
|
|
1690
|
+
var parent = node.parent;
|
|
1691
|
+
while (parent && parent !== this.root) {
|
|
1692
|
+
path.push(parent.data);
|
|
1693
|
+
parent = parent.parent;
|
|
1694
|
+
}
|
|
1695
|
+
return path.reverse();
|
|
1696
|
+
},
|
|
1697
|
+
getCheckedNodes: function getCheckedNodes(leafOnly, includeHalfChecked) {
|
|
1698
|
+
return this.store.getCheckedNodes(leafOnly, includeHalfChecked);
|
|
1699
|
+
},
|
|
1700
|
+
getCheckedKeys: function getCheckedKeys(leafOnly) {
|
|
1701
|
+
return this.store.getCheckedKeys(leafOnly);
|
|
1702
|
+
},
|
|
1703
|
+
getCurrentNode: function getCurrentNode() {
|
|
1704
|
+
var currentNode = this.store.getCurrentNode();
|
|
1705
|
+
return currentNode ? currentNode.data : null;
|
|
1706
|
+
},
|
|
1707
|
+
getCurrentKey: function getCurrentKey() {
|
|
1708
|
+
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getCurrentKey');
|
|
1709
|
+
var currentNode = this.getCurrentNode();
|
|
1710
|
+
return currentNode ? currentNode[this.nodeKey] : null;
|
|
1711
|
+
},
|
|
1712
|
+
setCheckedNodes: function setCheckedNodes(nodes, leafOnly) {
|
|
1713
|
+
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedNodes');
|
|
1714
|
+
this.store.setCheckedNodes(nodes, leafOnly);
|
|
1715
|
+
},
|
|
1716
|
+
setCheckedKeys: function setCheckedKeys(keys, leafOnly) {
|
|
1717
|
+
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedKeys');
|
|
1718
|
+
this.store.setCheckedKeys(keys, leafOnly);
|
|
1719
|
+
},
|
|
1720
|
+
setChecked: function setChecked(data, checked, deep) {
|
|
1721
|
+
this.store.setChecked(data, checked, deep);
|
|
1722
|
+
},
|
|
1723
|
+
getHalfCheckedNodes: function getHalfCheckedNodes() {
|
|
1724
|
+
return this.store.getHalfCheckedNodes();
|
|
1725
|
+
},
|
|
1726
|
+
getHalfCheckedKeys: function getHalfCheckedKeys() {
|
|
1727
|
+
return this.store.getHalfCheckedKeys();
|
|
1728
|
+
},
|
|
1729
|
+
setCurrentNode: function setCurrentNode(node) {
|
|
1730
|
+
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentNode');
|
|
1731
|
+
this.store.setUserCurrentNode(node);
|
|
1732
|
+
},
|
|
1733
|
+
setCurrentKey: function setCurrentKey(key) {
|
|
1734
|
+
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentKey');
|
|
1735
|
+
this.store.setCurrentNodeKey(key);
|
|
1736
|
+
},
|
|
1737
|
+
getNode: function getNode(data) {
|
|
1738
|
+
return this.store.getNode(data);
|
|
1739
|
+
},
|
|
1740
|
+
remove: function remove(data) {
|
|
1741
|
+
this.store.remove(data);
|
|
1742
|
+
},
|
|
1743
|
+
append: function append(data, parentNode) {
|
|
1744
|
+
this.store.append(data, parentNode);
|
|
1745
|
+
},
|
|
1746
|
+
insertBefore: function insertBefore(data, refNode) {
|
|
1747
|
+
this.store.insertBefore(data, refNode);
|
|
1748
|
+
},
|
|
1749
|
+
insertAfter: function insertAfter(data, refNode) {
|
|
1750
|
+
this.store.insertAfter(data, refNode);
|
|
1751
|
+
},
|
|
1752
|
+
handleNodeExpand: function handleNodeExpand(nodeData, node, instance) {
|
|
1753
|
+
this.broadcast('ElTreeNode', 'tree-node-expand', node);
|
|
1754
|
+
this.$emit('node-expand', nodeData, node, instance);
|
|
1755
|
+
},
|
|
1756
|
+
updateKeyChildren: function updateKeyChildren(key, data) {
|
|
1757
|
+
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in updateKeyChild');
|
|
1758
|
+
this.store.updateChildren(key, data);
|
|
1759
|
+
},
|
|
1760
|
+
initTabIndex: function initTabIndex() {
|
|
1761
|
+
this.treeItems = this.$el.querySelectorAll('.is-focusable[role=treeitem]');
|
|
1762
|
+
this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
|
|
1763
|
+
var checkedItem = this.$el.querySelectorAll('.is-checked[role=treeitem]');
|
|
1764
|
+
if (checkedItem.length) {
|
|
1765
|
+
checkedItem[0].setAttribute('tabindex', 0);
|
|
1766
|
+
return;
|
|
1767
|
+
}
|
|
1768
|
+
this.treeItems[0] && this.treeItems[0].setAttribute('tabindex', 0);
|
|
1972
1769
|
},
|
|
1973
|
-
|
|
1974
|
-
var
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1770
|
+
handleKeydown: function handleKeydown(ev) {
|
|
1771
|
+
var currentItem = ev.target;
|
|
1772
|
+
if (currentItem.className.indexOf('el-tree-node') === -1) return;
|
|
1773
|
+
var keyCode = ev.keyCode;
|
|
1774
|
+
this.treeItems = this.$el.querySelectorAll('.is-focusable[role=treeitem]');
|
|
1775
|
+
var currentIndex = this.treeItemArray.indexOf(currentItem);
|
|
1776
|
+
var nextIndex;
|
|
1777
|
+
if ([38, 40].indexOf(keyCode) > -1) {
|
|
1778
|
+
// up、down
|
|
1779
|
+
ev.preventDefault();
|
|
1780
|
+
if (keyCode === 38) {
|
|
1781
|
+
// up
|
|
1782
|
+
nextIndex = currentIndex !== 0 ? currentIndex - 1 : 0;
|
|
1783
|
+
} else {
|
|
1784
|
+
nextIndex = currentIndex < this.treeItemArray.length - 1 ? currentIndex + 1 : 0;
|
|
1785
|
+
}
|
|
1786
|
+
this.treeItemArray[nextIndex].focus(); // 选中
|
|
1787
|
+
}
|
|
1788
|
+
if ([37, 39].indexOf(keyCode) > -1) {
|
|
1789
|
+
// left、right 展开
|
|
1790
|
+
ev.preventDefault();
|
|
1791
|
+
currentItem.click(); // 选中
|
|
1792
|
+
}
|
|
1793
|
+
var hasInput = currentItem.querySelector('[type="checkbox"]');
|
|
1794
|
+
if ([13, 32].indexOf(keyCode) > -1 && hasInput) {
|
|
1795
|
+
// space enter选中checkbox
|
|
1796
|
+
ev.preventDefault();
|
|
1797
|
+
hasInput.click();
|
|
1981
1798
|
}
|
|
1982
1799
|
}
|
|
1983
1800
|
},
|
|
1801
|
+
created: function created() {
|
|
1802
|
+
var _this = this;
|
|
1803
|
+
this.isTree = true;
|
|
1804
|
+
this.store = new TreeStore({
|
|
1805
|
+
key: this.nodeKey,
|
|
1806
|
+
data: this.data,
|
|
1807
|
+
lazy: this.lazy,
|
|
1808
|
+
props: this.props,
|
|
1809
|
+
load: this.load,
|
|
1810
|
+
currentNodeKey: this.currentNodeKey,
|
|
1811
|
+
checkStrictly: this.checkStrictly,
|
|
1812
|
+
checkDescendants: this.checkDescendants,
|
|
1813
|
+
defaultCheckedKeys: this.defaultCheckedKeys,
|
|
1814
|
+
defaultExpandedKeys: this.defaultExpandedKeys,
|
|
1815
|
+
autoExpandParent: this.autoExpandParent,
|
|
1816
|
+
defaultExpandAll: this.defaultExpandAll,
|
|
1817
|
+
filterNodeMethod: this.filterNodeMethod
|
|
1818
|
+
});
|
|
1819
|
+
this.root = this.store.root;
|
|
1820
|
+
var dragState = this.dragState;
|
|
1821
|
+
this.$on('tree-node-drag-start', function (event, treeNode) {
|
|
1822
|
+
if (typeof _this.allowDrag === 'function' && !_this.allowDrag(treeNode.node)) {
|
|
1823
|
+
event.preventDefault();
|
|
1824
|
+
return false;
|
|
1825
|
+
}
|
|
1826
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
1984
1827
|
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1828
|
+
// wrap in try catch to address IE's error when first param is 'text/plain'
|
|
1829
|
+
try {
|
|
1830
|
+
// setData is required for draggable to work in FireFox
|
|
1831
|
+
// the content has to be '' so dragging a node out of the tree won't open a new tab in FireFox
|
|
1832
|
+
event.dataTransfer.setData('text/plain', '');
|
|
1833
|
+
} catch (e) {}
|
|
1834
|
+
dragState.draggingNode = treeNode;
|
|
1835
|
+
_this.$emit('node-drag-start', treeNode.node, event);
|
|
1836
|
+
});
|
|
1837
|
+
this.$on('tree-node-drag-over', function (event, treeNode) {
|
|
1838
|
+
var dropNode = findNearestComponent(event.target, 'ElTreeNode');
|
|
1839
|
+
var oldDropNode = dragState.dropNode;
|
|
1840
|
+
if (oldDropNode && oldDropNode !== dropNode) {
|
|
1841
|
+
(0,dom_namespaceObject.removeClass)(oldDropNode.$el, 'is-drop-inner');
|
|
1992
1842
|
}
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
var
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
1843
|
+
var draggingNode = dragState.draggingNode;
|
|
1844
|
+
if (!draggingNode || !dropNode) return;
|
|
1845
|
+
var dropPrev = true;
|
|
1846
|
+
var dropInner = true;
|
|
1847
|
+
var dropNext = true;
|
|
1848
|
+
var userAllowDropInner = true;
|
|
1849
|
+
if (typeof _this.allowDrop === 'function') {
|
|
1850
|
+
dropPrev = _this.allowDrop(draggingNode.node, dropNode.node, 'prev');
|
|
1851
|
+
userAllowDropInner = dropInner = _this.allowDrop(draggingNode.node, dropNode.node, 'inner');
|
|
1852
|
+
dropNext = _this.allowDrop(draggingNode.node, dropNode.node, 'next');
|
|
2003
1853
|
}
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
1854
|
+
event.dataTransfer.dropEffect = dropInner ? 'move' : 'none';
|
|
1855
|
+
if ((dropPrev || dropInner || dropNext) && oldDropNode !== dropNode) {
|
|
1856
|
+
if (oldDropNode) {
|
|
1857
|
+
_this.$emit('node-drag-leave', draggingNode.node, oldDropNode.node, event);
|
|
1858
|
+
}
|
|
1859
|
+
_this.$emit('node-drag-enter', draggingNode.node, dropNode.node, event);
|
|
2008
1860
|
}
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
handleContextMenu: function handleContextMenu(event) {
|
|
2012
|
-
if (this.tree._events['node-contextmenu'] && this.tree._events['node-contextmenu'].length > 0) {
|
|
2013
|
-
event.stopPropagation();
|
|
2014
|
-
event.preventDefault();
|
|
1861
|
+
if (dropPrev || dropInner || dropNext) {
|
|
1862
|
+
dragState.dropNode = dropNode;
|
|
2015
1863
|
}
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
if (
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
1864
|
+
if (dropNode.node.nextSibling === draggingNode.node) {
|
|
1865
|
+
dropNext = false;
|
|
1866
|
+
}
|
|
1867
|
+
if (dropNode.node.previousSibling === draggingNode.node) {
|
|
1868
|
+
dropPrev = false;
|
|
1869
|
+
}
|
|
1870
|
+
if (dropNode.node.contains(draggingNode.node, false)) {
|
|
1871
|
+
dropInner = false;
|
|
1872
|
+
}
|
|
1873
|
+
if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
|
|
1874
|
+
dropPrev = false;
|
|
1875
|
+
dropInner = false;
|
|
1876
|
+
dropNext = false;
|
|
1877
|
+
}
|
|
1878
|
+
var targetPosition = dropNode.$el.getBoundingClientRect();
|
|
1879
|
+
var treePosition = _this.$el.getBoundingClientRect();
|
|
1880
|
+
var dropType;
|
|
1881
|
+
var prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
|
|
1882
|
+
var nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
|
|
1883
|
+
var indicatorTop = -9999;
|
|
1884
|
+
var distance = event.clientY - targetPosition.top;
|
|
1885
|
+
if (distance < targetPosition.height * prevPercent) {
|
|
1886
|
+
dropType = 'before';
|
|
1887
|
+
} else if (distance > targetPosition.height * nextPercent) {
|
|
1888
|
+
dropType = 'after';
|
|
1889
|
+
} else if (dropInner) {
|
|
1890
|
+
dropType = 'inner';
|
|
2023
1891
|
} else {
|
|
2024
|
-
|
|
2025
|
-
this.$emit('node-expand', this.node.data, this.node, this);
|
|
1892
|
+
dropType = 'none';
|
|
2026
1893
|
}
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
}
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
handleDragOver: function handleDragOver(event) {
|
|
2051
|
-
if (!this.tree.draggable) return;
|
|
2052
|
-
this.tree.$emit('tree-node-drag-over', event, this);
|
|
2053
|
-
event.preventDefault();
|
|
2054
|
-
},
|
|
2055
|
-
handleDrop: function handleDrop(event) {
|
|
1894
|
+
var iconPosition = dropNode.$el.querySelector('.el-tree-node__expand-icon').getBoundingClientRect();
|
|
1895
|
+
var dropIndicator = _this.$refs.dropIndicator;
|
|
1896
|
+
if (dropType === 'before') {
|
|
1897
|
+
indicatorTop = iconPosition.top - treePosition.top;
|
|
1898
|
+
} else if (dropType === 'after') {
|
|
1899
|
+
indicatorTop = iconPosition.bottom - treePosition.top;
|
|
1900
|
+
}
|
|
1901
|
+
dropIndicator.style.top = indicatorTop + 'px';
|
|
1902
|
+
dropIndicator.style.left = iconPosition.right - treePosition.left + 'px';
|
|
1903
|
+
if (dropType === 'inner') {
|
|
1904
|
+
(0,dom_namespaceObject.addClass)(dropNode.$el, 'is-drop-inner');
|
|
1905
|
+
} else {
|
|
1906
|
+
(0,dom_namespaceObject.removeClass)(dropNode.$el, 'is-drop-inner');
|
|
1907
|
+
}
|
|
1908
|
+
dragState.showDropIndicator = dropType === 'before' || dropType === 'after';
|
|
1909
|
+
dragState.allowDrop = dragState.showDropIndicator || userAllowDropInner;
|
|
1910
|
+
dragState.dropType = dropType;
|
|
1911
|
+
_this.$emit('node-drag-over', draggingNode.node, dropNode.node, event);
|
|
1912
|
+
});
|
|
1913
|
+
this.$on('tree-node-drag-end', function (event) {
|
|
1914
|
+
var draggingNode = dragState.draggingNode,
|
|
1915
|
+
dropType = dragState.dropType,
|
|
1916
|
+
dropNode = dragState.dropNode;
|
|
2056
1917
|
event.preventDefault();
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
1918
|
+
event.dataTransfer.dropEffect = 'move';
|
|
1919
|
+
if (draggingNode && dropNode) {
|
|
1920
|
+
var draggingNodeCopy = {
|
|
1921
|
+
data: draggingNode.node.data
|
|
1922
|
+
};
|
|
1923
|
+
if (dropType !== 'none') {
|
|
1924
|
+
draggingNode.node.remove();
|
|
1925
|
+
}
|
|
1926
|
+
if (dropType === 'before') {
|
|
1927
|
+
dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
|
|
1928
|
+
} else if (dropType === 'after') {
|
|
1929
|
+
dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
|
|
1930
|
+
} else if (dropType === 'inner') {
|
|
1931
|
+
dropNode.node.insertChild(draggingNodeCopy);
|
|
1932
|
+
}
|
|
1933
|
+
if (dropType !== 'none') {
|
|
1934
|
+
_this.store.registerNode(draggingNodeCopy);
|
|
1935
|
+
}
|
|
1936
|
+
;(0,dom_namespaceObject.removeClass)(dropNode.$el, 'is-drop-inner');
|
|
1937
|
+
_this.$emit('node-drag-end', draggingNode.node, dropNode.node, dropType, event);
|
|
1938
|
+
if (dropType !== 'none') {
|
|
1939
|
+
_this.$emit('node-drop', draggingNode.node, dropNode.node, dropType, event);
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
if (draggingNode && !dropNode) {
|
|
1943
|
+
_this.$emit('node-drag-end', draggingNode.node, null, dropType, event);
|
|
1944
|
+
}
|
|
1945
|
+
dragState.showDropIndicator = false;
|
|
1946
|
+
dragState.draggingNode = null;
|
|
1947
|
+
dragState.dropNode = null;
|
|
1948
|
+
dragState.allowDrop = true;
|
|
1949
|
+
});
|
|
2062
1950
|
},
|
|
1951
|
+
mounted: function mounted() {
|
|
1952
|
+
this.initTabIndex();
|
|
1953
|
+
this.$el.addEventListener('keydown', this.handleKeydown);
|
|
1954
|
+
},
|
|
1955
|
+
updated: function updated() {
|
|
1956
|
+
this.treeItems = this.$el.querySelectorAll('[role=treeitem]');
|
|
1957
|
+
this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
|
|
1958
|
+
}
|
|
1959
|
+
});
|
|
1960
|
+
;// ./packages/tree/src/tree.vue?vue&type=script&lang=js
|
|
1961
|
+
/* harmony default export */ const src_treevue_type_script_lang_js = (treevue_type_script_lang_js);
|
|
1962
|
+
;// ./packages/tree/src/tree.vue
|
|
2063
1963
|
|
|
2064
|
-
created: function created() {
|
|
2065
|
-
var _this3 = this;
|
|
2066
|
-
|
|
2067
|
-
var parent = this.$parent;
|
|
2068
1964
|
|
|
2069
|
-
if (parent.isTree) {
|
|
2070
|
-
this.tree = parent;
|
|
2071
|
-
} else {
|
|
2072
|
-
this.tree = parent.tree;
|
|
2073
|
-
}
|
|
2074
1965
|
|
|
2075
|
-
var tree = this.tree;
|
|
2076
|
-
if (!tree) {
|
|
2077
|
-
console.warn('Can not find node\'s tree.');
|
|
2078
|
-
}
|
|
2079
1966
|
|
|
2080
|
-
var props = tree.props || {};
|
|
2081
|
-
var childrenKey = props['children'] || 'children';
|
|
2082
1967
|
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
1968
|
+
/* normalize component */
|
|
1969
|
+
;
|
|
1970
|
+
var tree_component = normalizeComponent(
|
|
1971
|
+
src_treevue_type_script_lang_js,
|
|
1972
|
+
render,
|
|
1973
|
+
staticRenderFns,
|
|
1974
|
+
false,
|
|
1975
|
+
null,
|
|
1976
|
+
null,
|
|
1977
|
+
null
|
|
1978
|
+
|
|
1979
|
+
)
|
|
2086
1980
|
|
|
2087
|
-
|
|
1981
|
+
/* harmony default export */ const tree = (tree_component.exports);
|
|
1982
|
+
;// ./packages/tree/index.js
|
|
2088
1983
|
|
|
2089
|
-
if (this.node.expanded) {
|
|
2090
|
-
this.expanded = true;
|
|
2091
|
-
this.childNodeRendered = true;
|
|
2092
|
-
}
|
|
2093
1984
|
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
_this3.node.collapse();
|
|
2098
|
-
}
|
|
2099
|
-
});
|
|
2100
|
-
}
|
|
2101
|
-
}
|
|
1985
|
+
/* istanbul ignore next */
|
|
1986
|
+
tree.install = function (Vue) {
|
|
1987
|
+
Vue.component(tree.name, tree);
|
|
2102
1988
|
};
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
1989
|
+
/* harmony default export */ const packages_tree = (tree);
|
|
1990
|
+
module.exports = __webpack_exports__["default"];
|
|
1991
|
+
/******/ })()
|
|
1992
|
+
;
|