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