vxe-pc-ui 3.0.0-alpha.2 → 3.0.0-alpha.3
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/es/alert/index.js +12 -0
- package/es/alert/src/alert.js +99 -0
- package/es/alert/style.css +129 -0
- package/es/alert/style.min.css +1 -0
- package/es/anchor/index.js +12 -0
- package/es/anchor/src/anchor-link.js +137 -0
- package/es/anchor/src/anchor.js +231 -0
- package/es/anchor/src/util.js +19 -0
- package/es/anchor/style.css +42 -0
- package/es/anchor/style.min.css +1 -0
- package/es/anchor-link/index.js +12 -0
- package/es/anchor-link/style.css +0 -0
- package/es/anchor-link/style.min.css +0 -0
- package/es/breadcrumb/index.js +12 -0
- package/es/breadcrumb/src/breadcrumb-item.js +101 -0
- package/es/breadcrumb/src/breadcrumb.js +76 -0
- package/es/breadcrumb/style.css +33 -0
- package/es/breadcrumb/style.min.css +1 -0
- package/es/breadcrumb-item/index.js +12 -0
- package/es/breadcrumb-item/style.css +0 -0
- package/es/breadcrumb-item/style.min.css +0 -0
- package/es/button/index.js +2 -0
- package/es/button/src/button-group.js +1 -1
- package/es/button-group/index.js +2 -0
- package/es/col/index.js +2 -0
- package/es/components.js +43 -43
- package/es/dynamics/index.js +25 -45
- package/es/icon/index.js +2 -0
- package/es/icon/style.css +1 -1
- package/es/image/index.js +12 -0
- package/es/image/src/group.js +121 -0
- package/es/image/src/image.js +147 -0
- package/es/image/src/preview.js +675 -0
- package/es/image/src/util.js +46 -0
- package/es/image-group/index.js +12 -0
- package/es/image-preview/index.js +14 -0
- package/es/layout-aside/index.js +2 -0
- package/es/layout-aside/src/layout-aside.js +1 -1
- package/es/layout-body/index.js +2 -0
- package/es/layout-body/src/layout-body.js +1 -1
- package/es/layout-container/index.js +2 -0
- package/es/layout-container/src/layout-container.js +1 -1
- package/es/layout-footer/index.js +2 -0
- package/es/layout-footer/src/layout-footer.js +1 -1
- package/es/layout-header/index.js +2 -0
- package/es/layout-header/src/layout-header.js +1 -1
- package/es/link/index.js +2 -0
- package/es/link/src/link.js +1 -1
- package/es/loading/index.js +4 -3
- package/es/loading/src/loading.js +3 -2
- package/es/menu/index.js +2 -0
- package/es/menu/src/menu.js +1 -1
- package/es/modal/index.js +122 -0
- package/es/modal/src/modal.js +1433 -0
- package/es/print/index.js +14 -0
- package/es/print/src/page-break.js +66 -0
- package/es/print/src/print.js +225 -0
- package/es/print/src/util.js +160 -0
- package/es/print-page-break/index.js +10 -0
- package/es/radio/index.js +2 -0
- package/es/radio/src/button.js +1 -1
- package/es/radio/src/radio.js +1 -1
- package/es/radio-button/index.js +2 -0
- package/es/radio-group/index.js +2 -0
- package/es/row/index.js +2 -0
- package/es/row/src/col.js +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/switch/index.js +2 -0
- package/es/switch/src/switch.js +1 -1
- package/es/tag/index.js +2 -0
- package/es/tag/src/tag.js +1 -1
- package/es/text/index.js +2 -0
- package/es/text/src/text.js +1 -1
- package/es/tip/index.js +2 -0
- package/es/tip/src/tip.js +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/upload/index.js +15 -0
- package/es/upload/src/upload.js +1365 -0
- package/es/upload/src/util.js +103 -0
- package/es/upload/style.css +393 -0
- package/es/upload/style.min.css +1 -0
- package/es/vxe-alert/index.js +3 -0
- package/es/vxe-alert/style.css +129 -0
- package/es/vxe-alert/style.min.css +1 -0
- package/es/vxe-anchor/index.js +3 -0
- package/es/vxe-anchor/style.css +42 -0
- package/es/vxe-anchor/style.min.css +1 -0
- package/es/vxe-anchor-link/index.js +3 -0
- package/es/vxe-anchor-link/style.css +0 -0
- package/es/vxe-anchor-link/style.min.css +0 -0
- package/es/vxe-breadcrumb/index.js +3 -0
- package/es/vxe-breadcrumb/style.css +33 -0
- package/es/vxe-breadcrumb/style.min.css +1 -0
- package/es/vxe-breadcrumb-item/index.js +3 -0
- package/es/vxe-breadcrumb-item/style.css +0 -0
- package/es/vxe-breadcrumb-item/style.min.css +0 -0
- package/es/vxe-upload/index.js +3 -0
- package/es/vxe-upload/style.css +393 -0
- package/es/vxe-upload/style.min.css +1 -0
- package/lib/alert/index.js +19 -0
- package/lib/alert/index.min.js +1 -0
- package/lib/alert/src/alert.js +96 -0
- package/lib/alert/src/alert.min.js +1 -0
- package/lib/alert/style/index.js +1 -0
- package/lib/alert/style/style.css +129 -0
- package/lib/alert/style/style.min.css +1 -0
- package/lib/anchor/index.js +19 -0
- package/lib/anchor/index.min.js +1 -0
- package/lib/anchor/src/anchor-link.js +151 -0
- package/lib/anchor/src/anchor-link.min.js +1 -0
- package/lib/anchor/src/anchor.js +253 -0
- package/lib/anchor/src/anchor.min.js +1 -0
- package/lib/anchor/src/util.js +29 -0
- package/lib/anchor/src/util.min.js +1 -0
- package/lib/anchor/style/index.js +1 -0
- package/lib/anchor/style/style.css +42 -0
- package/lib/anchor/style/style.min.css +1 -0
- package/lib/anchor-link/index.js +19 -0
- package/lib/anchor-link/index.min.js +1 -0
- package/lib/anchor-link/style/index.js +1 -0
- package/lib/anchor-link/style/style.css +0 -0
- package/lib/anchor-link/style/style.min.css +0 -0
- package/lib/breadcrumb/index.js +19 -0
- package/lib/breadcrumb/index.min.js +1 -0
- package/lib/breadcrumb/src/breadcrumb-item.js +102 -0
- package/lib/breadcrumb/src/breadcrumb-item.min.js +1 -0
- package/lib/breadcrumb/src/breadcrumb.js +87 -0
- package/lib/breadcrumb/src/breadcrumb.min.js +1 -0
- package/lib/breadcrumb/style/index.js +1 -0
- package/lib/breadcrumb/style/style.css +33 -0
- package/lib/breadcrumb/style/style.min.css +1 -0
- package/lib/breadcrumb-item/index.js +19 -0
- package/lib/breadcrumb-item/index.min.js +1 -0
- package/lib/breadcrumb-item/style/index.js +1 -0
- package/lib/breadcrumb-item/style/style.css +0 -0
- package/lib/breadcrumb-item/style/style.min.css +0 -0
- package/lib/button/index.js +2 -0
- package/lib/button/index.min.js +1 -1
- package/lib/button/src/button-group.js +1 -1
- package/lib/button/src/button-group.min.js +1 -1
- package/lib/button-group/index.js +2 -0
- package/lib/button-group/index.min.js +1 -1
- package/lib/col/index.js +2 -0
- package/lib/col/index.min.js +1 -1
- package/lib/components.js +168 -51
- package/lib/components.min.js +1 -1
- package/lib/dynamics/index.js +27 -49
- package/lib/dynamics/index.min.js +1 -1
- package/lib/icon/index.js +2 -0
- package/lib/icon/index.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/image/index.js +19 -0
- package/lib/image/index.min.js +1 -0
- package/lib/image/src/group.js +142 -0
- package/lib/image/src/group.min.js +1 -0
- package/lib/image/src/image.js +173 -0
- package/lib/image/src/image.min.js +1 -0
- package/lib/image/src/preview.js +664 -0
- package/lib/image/src/preview.min.js +1 -0
- package/lib/image/src/util.js +57 -0
- package/lib/image/src/util.min.js +1 -0
- package/lib/image-group/index.js +19 -0
- package/lib/image-group/index.min.js +1 -0
- package/lib/image-preview/index.js +21 -0
- package/lib/image-preview/index.min.js +1 -0
- package/lib/index.umd.js +8317 -2588
- package/lib/index.umd.min.js +1 -1
- package/lib/layout-aside/index.js +2 -0
- package/lib/layout-aside/index.min.js +1 -1
- package/lib/layout-aside/src/layout-aside.js +1 -1
- package/lib/layout-body/index.js +2 -0
- package/lib/layout-body/index.min.js +1 -1
- package/lib/layout-body/src/layout-body.js +1 -1
- package/lib/layout-container/index.js +2 -0
- package/lib/layout-container/index.min.js +1 -1
- package/lib/layout-container/src/layout-container.js +1 -1
- package/lib/layout-footer/index.js +2 -0
- package/lib/layout-footer/index.min.js +1 -1
- package/lib/layout-footer/src/layout-footer.js +1 -1
- package/lib/layout-header/index.js +2 -0
- package/lib/layout-header/index.min.js +1 -1
- package/lib/layout-header/src/layout-header.js +1 -1
- package/lib/link/index.js +2 -0
- package/lib/link/index.min.js +1 -1
- package/lib/link/src/link.js +1 -1
- package/lib/loading/index.js +3 -2
- package/lib/loading/index.min.js +1 -1
- package/lib/loading/src/loading.js +3 -2
- package/lib/menu/index.js +2 -0
- package/lib/menu/index.min.js +1 -1
- package/lib/menu/src/menu.js +1 -1
- package/lib/modal/index.js +134 -0
- package/lib/modal/index.min.js +1 -0
- package/lib/modal/src/modal.js +1535 -0
- package/lib/modal/src/modal.min.js +1 -0
- package/lib/print/index.js +21 -0
- package/lib/print/index.min.js +1 -0
- package/lib/print/src/page-break.js +75 -0
- package/lib/print/src/page-break.min.js +1 -0
- package/lib/print/src/print.js +208 -0
- package/lib/print/src/print.min.js +1 -0
- package/lib/print/src/util.js +156 -0
- package/lib/print/src/util.min.js +1 -0
- package/lib/print-page-break/index.js +17 -0
- package/lib/print-page-break/index.min.js +1 -0
- package/lib/radio/index.js +2 -0
- package/lib/radio/index.min.js +1 -1
- package/lib/radio/src/button.js +1 -1
- package/lib/radio/src/radio.js +1 -1
- package/lib/radio-button/index.js +2 -0
- package/lib/radio-button/index.min.js +1 -1
- package/lib/radio-group/index.js +2 -0
- package/lib/radio-group/index.min.js +1 -1
- package/lib/row/index.js +2 -0
- package/lib/row/index.min.js +1 -1
- package/lib/row/src/col.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/switch/index.js +2 -0
- package/lib/switch/index.min.js +1 -1
- package/lib/switch/src/switch.js +1 -1
- package/lib/tag/index.js +2 -0
- package/lib/tag/index.min.js +1 -1
- package/lib/tag/src/tag.js +1 -1
- package/lib/text/index.js +2 -0
- package/lib/text/index.min.js +1 -1
- package/lib/text/src/text.js +1 -1
- package/lib/tip/index.js +2 -0
- package/lib/tip/index.min.js +1 -1
- package/lib/tip/src/tip.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/upload/index.js +22 -0
- package/lib/upload/index.min.js +1 -0
- package/lib/upload/src/upload.js +1384 -0
- package/lib/upload/src/upload.min.js +1 -0
- package/lib/upload/src/util.js +133 -0
- package/lib/upload/src/util.min.js +1 -0
- package/lib/upload/style/index.js +1 -0
- package/lib/upload/style/style.css +393 -0
- package/lib/upload/style/style.min.css +1 -0
- package/lib/vxe-alert/index.js +22 -0
- package/lib/vxe-alert/index.min.js +1 -0
- package/lib/vxe-alert/style/index.js +1 -0
- package/lib/vxe-alert/style/style.css +129 -0
- package/lib/vxe-alert/style/style.min.css +1 -0
- package/lib/vxe-anchor/index.js +22 -0
- package/lib/vxe-anchor/index.min.js +1 -0
- package/lib/vxe-anchor/style/index.js +1 -0
- package/lib/vxe-anchor/style/style.css +42 -0
- package/lib/vxe-anchor/style/style.min.css +1 -0
- package/lib/vxe-anchor-link/index.js +22 -0
- package/lib/vxe-anchor-link/index.min.js +1 -0
- package/lib/vxe-anchor-link/style/index.js +1 -0
- package/lib/vxe-anchor-link/style/style.css +0 -0
- package/lib/vxe-anchor-link/style/style.min.css +0 -0
- package/lib/vxe-breadcrumb/index.js +22 -0
- package/lib/vxe-breadcrumb/index.min.js +1 -0
- package/lib/vxe-breadcrumb/style/index.js +1 -0
- package/lib/vxe-breadcrumb/style/style.css +33 -0
- package/lib/vxe-breadcrumb/style/style.min.css +1 -0
- package/lib/vxe-breadcrumb-item/index.js +22 -0
- package/lib/vxe-breadcrumb-item/index.min.js +1 -0
- package/lib/vxe-breadcrumb-item/style/index.js +1 -0
- package/lib/vxe-breadcrumb-item/style/style.css +0 -0
- package/lib/vxe-breadcrumb-item/style/style.min.css +0 -0
- package/lib/vxe-upload/index.js +22 -0
- package/lib/vxe-upload/index.min.js +1 -0
- package/lib/vxe-upload/style/index.js +1 -0
- package/lib/vxe-upload/style/style.css +393 -0
- package/lib/vxe-upload/style/style.min.css +1 -0
- package/package.json +2 -2
- package/packages/alert/index.ts +16 -0
- package/packages/alert/src/alert.ts +106 -0
- package/packages/anchor/index.ts +16 -0
- package/packages/anchor/src/anchor-link.ts +158 -0
- package/packages/anchor/src/anchor.ts +250 -0
- package/packages/anchor/src/util.ts +23 -0
- package/packages/anchor-link/index.ts +16 -0
- package/packages/breadcrumb/index.ts +16 -0
- package/packages/breadcrumb/src/breadcrumb-item.ts +117 -0
- package/packages/breadcrumb/src/breadcrumb.ts +89 -0
- package/packages/breadcrumb-item/index.ts +16 -0
- package/packages/button/index.ts +2 -0
- package/packages/button/src/button-group.ts +1 -1
- package/packages/button-group/index.ts +2 -0
- package/packages/col/index.ts +2 -0
- package/packages/components.ts +43 -43
- package/packages/dynamics/index.ts +33 -50
- package/packages/icon/index.ts +2 -0
- package/packages/image/index.ts +16 -0
- package/packages/image/src/group.ts +138 -0
- package/packages/image/src/image.ts +169 -0
- package/packages/image/src/preview.ts +705 -0
- package/packages/image/src/util.ts +49 -0
- package/packages/image-group/index.ts +16 -0
- package/packages/image-preview/index.ts +18 -0
- package/packages/layout-aside/index.ts +2 -0
- package/packages/layout-aside/src/layout-aside.ts +1 -1
- package/packages/layout-body/index.ts +2 -0
- package/packages/layout-body/src/layout-body.ts +1 -1
- package/packages/layout-container/index.ts +2 -0
- package/packages/layout-container/src/layout-container.ts +1 -1
- package/packages/layout-footer/index.ts +2 -0
- package/packages/layout-footer/src/layout-footer.ts +1 -1
- package/packages/layout-header/index.ts +2 -0
- package/packages/layout-header/src/layout-header.ts +1 -1
- package/packages/link/index.ts +2 -0
- package/packages/link/src/link.ts +1 -1
- package/packages/loading/index.ts +4 -3
- package/packages/loading/src/loading.ts +3 -2
- package/packages/menu/index.ts +2 -0
- package/packages/menu/src/menu.ts +1 -1
- package/packages/modal/index.ts +143 -0
- package/packages/modal/src/modal.ts +1509 -0
- package/packages/print/index.ts +18 -0
- package/packages/print/src/page-break.ts +78 -0
- package/packages/print/src/print.ts +239 -0
- package/packages/print/src/util.ts +180 -0
- package/packages/print-page-break/index.ts +14 -0
- package/packages/radio/index.ts +2 -0
- package/packages/radio/src/button.ts +1 -1
- package/packages/radio/src/radio.ts +1 -1
- package/packages/radio-button/index.ts +2 -0
- package/packages/radio-group/index.ts +2 -0
- package/packages/row/index.ts +2 -0
- package/packages/row/src/col.ts +1 -1
- package/packages/switch/index.ts +2 -0
- package/packages/switch/src/switch.ts +1 -1
- package/packages/tag/index.ts +2 -0
- package/packages/tag/src/tag.ts +1 -1
- package/packages/text/index.ts +2 -0
- package/packages/text/src/text.ts +1 -1
- package/packages/tip/index.ts +2 -0
- package/packages/tip/src/tip.ts +1 -1
- package/packages/upload/index.ts +19 -0
- package/packages/upload/src/upload.ts +1444 -0
- package/packages/upload/src/util.ts +109 -0
- package/types/components/alert.d.ts +7 -7
- package/types/components/anchor-link.d.ts +8 -8
- package/types/components/anchor.d.ts +8 -7
- package/types/components/breadcrumb-item.d.ts +7 -7
- package/types/components/breadcrumb.d.ts +7 -7
- package/types/components/button-group.d.ts +6 -6
- package/types/components/button.d.ts +6 -7
- package/types/components/calendar.d.ts +6 -6
- package/types/components/card.d.ts +6 -6
- package/types/components/carousel-item.d.ts +6 -6
- package/types/components/carousel.d.ts +7 -7
- package/types/components/checkbox-group.d.ts +7 -7
- package/types/components/checkbox.d.ts +7 -7
- package/types/components/col.d.ts +6 -6
- package/types/components/colgroup.d.ts +7 -7
- package/types/components/collapse-pane.d.ts +7 -7
- package/types/components/collapse.d.ts +8 -7
- package/types/components/column.d.ts +6 -6
- package/types/components/countdown.d.ts +7 -7
- package/types/components/date-picker.d.ts +7 -7
- package/types/components/drawer.d.ts +6 -6
- package/types/components/flow-design.d.ts +7 -7
- package/types/components/flow-view.d.ts +7 -7
- package/types/components/form-design.d.ts +7 -8
- package/types/components/form-gather.d.ts +6 -4
- package/types/components/form-item.d.ts +6 -4
- package/types/components/form-view.d.ts +6 -6
- package/types/components/form.d.ts +6 -7
- package/types/components/grid.d.ts +7 -7
- package/types/components/icon-picker.d.ts +7 -7
- package/types/components/icon.d.ts +6 -6
- package/types/components/image-group.d.ts +7 -7
- package/types/components/image-preview.d.ts +7 -7
- package/types/components/image.d.ts +7 -7
- package/types/components/input.d.ts +7 -7
- package/types/components/layout-aside.d.ts +6 -6
- package/types/components/layout-body.d.ts +6 -6
- package/types/components/layout-container.d.ts +6 -6
- package/types/components/layout-footer.d.ts +6 -6
- package/types/components/layout-header.d.ts +6 -4
- package/types/components/link.d.ts +6 -6
- package/types/components/list-design.d.ts +7 -7
- package/types/components/list-view.d.ts +7 -7
- package/types/components/list.d.ts +7 -8
- package/types/components/loading.d.ts +6 -6
- package/types/components/menu.d.ts +7 -7
- package/types/components/modal.d.ts +27 -17
- package/types/components/number-input.d.ts +7 -7
- package/types/components/optgroup.d.ts +7 -7
- package/types/components/option.d.ts +7 -7
- package/types/components/pager.d.ts +7 -7
- package/types/components/password-input.d.ts +7 -7
- package/types/components/print-page-break.d.ts +7 -7
- package/types/components/print.d.ts +7 -7
- package/types/components/pulldown.d.ts +7 -7
- package/types/components/radio-button.d.ts +6 -6
- package/types/components/radio-group.d.ts +6 -6
- package/types/components/radio.d.ts +6 -6
- package/types/components/row.d.ts +6 -6
- package/types/components/select.d.ts +7 -7
- package/types/components/switch.d.ts +6 -7
- package/types/components/tab-pane.d.ts +7 -7
- package/types/components/table.d.ts +6 -7
- package/types/components/tabs.d.ts +7 -7
- package/types/components/tag.d.ts +6 -6
- package/types/components/text.d.ts +6 -6
- package/types/components/textarea.d.ts +7 -7
- package/types/components/tip.d.ts +7 -7
- package/types/components/toolbar.d.ts +7 -7
- package/types/components/tooltip.d.ts +7 -7
- package/types/components/tree-select.d.ts +6 -6
- package/types/components/tree.d.ts +6 -7
- package/types/components/upload.d.ts +12 -8
- /package/es/icon/style/{iconfont.1725529913473.ttf → iconfont.1725596818596.ttf} +0 -0
- /package/es/icon/style/{iconfont.1725529913473.woff → iconfont.1725596818596.woff} +0 -0
- /package/es/icon/style/{iconfont.1725529913473.woff2 → iconfont.1725596818596.woff2} +0 -0
- /package/es/{iconfont.1725529913473.ttf → iconfont.1725596818596.ttf} +0 -0
- /package/es/{iconfont.1725529913473.woff → iconfont.1725596818596.woff} +0 -0
- /package/es/{iconfont.1725529913473.woff2 → iconfont.1725596818596.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1725529913473.ttf → iconfont.1725596818596.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1725529913473.woff → iconfont.1725596818596.woff} +0 -0
- /package/lib/icon/style/{iconfont.1725529913473.woff2 → iconfont.1725596818596.woff2} +0 -0
- /package/lib/{iconfont.1725529913473.ttf → iconfont.1725596818596.ttf} +0 -0
- /package/lib/{iconfont.1725529913473.woff → iconfont.1725596818596.woff} +0 -0
- /package/lib/{iconfont.1725529913473.woff2 → iconfont.1725596818596.woff2} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VxeUI } from '@vxe-ui/core';
|
|
2
|
+
import { dynamicApp } from '../dynamics';
|
|
3
|
+
import VxeAlertComponent from './src/alert';
|
|
4
|
+
export const VxeAlert = Object.assign({}, VxeAlertComponent, {
|
|
5
|
+
install(app) {
|
|
6
|
+
app.component(VxeAlertComponent.name, VxeAlertComponent);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
dynamicApp.use(VxeAlert);
|
|
10
|
+
VxeUI.component(VxeAlertComponent);
|
|
11
|
+
export const Alert = VxeAlert;
|
|
12
|
+
export default VxeAlert;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { defineVxeComponent } from '../../ui/src/comp';
|
|
2
|
+
import XEUtils from 'xe-utils';
|
|
3
|
+
import { getConfig, createEvent, getIcon, renderEmptyElement } from '../../ui';
|
|
4
|
+
import { getSlotVNs } from '../../ui/src/vn';
|
|
5
|
+
export default defineVxeComponent({
|
|
6
|
+
name: 'VxeAlert',
|
|
7
|
+
props: {
|
|
8
|
+
title: {
|
|
9
|
+
type: [String, Number],
|
|
10
|
+
default: () => getConfig().alert.title
|
|
11
|
+
},
|
|
12
|
+
content: [String, Number],
|
|
13
|
+
status: String,
|
|
14
|
+
showIcon: Boolean,
|
|
15
|
+
showClose: Boolean,
|
|
16
|
+
icon: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: () => getConfig().alert.icon
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
data() {
|
|
22
|
+
const xID = XEUtils.uniqueId();
|
|
23
|
+
const reactData = {};
|
|
24
|
+
return {
|
|
25
|
+
xID,
|
|
26
|
+
reactData
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
methods: {
|
|
30
|
+
//
|
|
31
|
+
// Method
|
|
32
|
+
//
|
|
33
|
+
dispatchEvent(type, params, evnt) {
|
|
34
|
+
const $xeAlert = this;
|
|
35
|
+
this.$emit(type, createEvent(evnt, { $alert: $xeAlert }, params));
|
|
36
|
+
},
|
|
37
|
+
closeEvent(evnt) {
|
|
38
|
+
const $xeAlert = this;
|
|
39
|
+
$xeAlert.dispatchEvent('close', {}, evnt);
|
|
40
|
+
},
|
|
41
|
+
//
|
|
42
|
+
// Render
|
|
43
|
+
//
|
|
44
|
+
renderVN(h) {
|
|
45
|
+
const $xeAlert = this;
|
|
46
|
+
const props = $xeAlert;
|
|
47
|
+
const slots = $xeAlert.$scopedSlots;
|
|
48
|
+
const { status, content, icon, title, showIcon, showClose } = props;
|
|
49
|
+
const defaultSlot = slots.default;
|
|
50
|
+
const titleSlot = slots.title;
|
|
51
|
+
const iconSlot = slots.icon;
|
|
52
|
+
return h('div', {
|
|
53
|
+
ref: 'refElem',
|
|
54
|
+
class: ['vxe-alert', {
|
|
55
|
+
[`theme--${status}`]: status
|
|
56
|
+
}]
|
|
57
|
+
}, [
|
|
58
|
+
iconSlot || (showIcon && status) || icon
|
|
59
|
+
? h('div', {
|
|
60
|
+
class: 'vxe-alert--icon'
|
|
61
|
+
}, iconSlot
|
|
62
|
+
? getSlotVNs(iconSlot({}))
|
|
63
|
+
: [
|
|
64
|
+
h('i', {
|
|
65
|
+
class: icon || getIcon()[`ALERT_${status === null || status === void 0 ? void 0 : status.toUpperCase()}`]
|
|
66
|
+
})
|
|
67
|
+
])
|
|
68
|
+
: renderEmptyElement($xeAlert),
|
|
69
|
+
h('div', {
|
|
70
|
+
class: 'vxe-alert--body'
|
|
71
|
+
}, [
|
|
72
|
+
titleSlot || title
|
|
73
|
+
? h('div', {
|
|
74
|
+
class: 'vxe-alert--title'
|
|
75
|
+
}, titleSlot ? getSlotVNs(titleSlot({})) : XEUtils.toValueString(title))
|
|
76
|
+
: renderEmptyElement($xeAlert),
|
|
77
|
+
h('div', {
|
|
78
|
+
class: 'vxe-alert--content'
|
|
79
|
+
}, defaultSlot ? getSlotVNs(defaultSlot({})) : XEUtils.toValueString(content))
|
|
80
|
+
]),
|
|
81
|
+
showClose
|
|
82
|
+
? h('div', {
|
|
83
|
+
class: 'vxe-alert--close-btn',
|
|
84
|
+
on: {
|
|
85
|
+
click: $xeAlert.closeEvent
|
|
86
|
+
}
|
|
87
|
+
}, [
|
|
88
|
+
h('i', {
|
|
89
|
+
class: getIcon().ALERT_CLOSE
|
|
90
|
+
})
|
|
91
|
+
])
|
|
92
|
+
: renderEmptyElement($xeAlert)
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
render(h) {
|
|
97
|
+
return this.renderVN(h);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
.vxe-alert {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
color: var(--vxe-ui-font-color);
|
|
6
|
+
padding: var(--vxe-ui-layout-padding-default);
|
|
7
|
+
margin-bottom: var(--vxe-ui-layout-padding-default);
|
|
8
|
+
font-size: var(--vxe-ui-font-size-default);
|
|
9
|
+
border-radius: var(--vxe-ui-base-border-radius);
|
|
10
|
+
}
|
|
11
|
+
.vxe-alert.theme--primary {
|
|
12
|
+
color: var(--vxe-ui-font-primary-color);
|
|
13
|
+
border: 1px solid var(--vxe-ui-font-primary-lighten-color);
|
|
14
|
+
background-color: var(--vxe-ui-font-primary-tinge-color);
|
|
15
|
+
}
|
|
16
|
+
.vxe-alert.theme--primary::after {
|
|
17
|
+
background-color: var(--vxe-ui-font-primary-color);
|
|
18
|
+
}
|
|
19
|
+
.vxe-alert.theme--primary .vxe-alert--icon {
|
|
20
|
+
color: var(--vxe-ui-font-primary-color);
|
|
21
|
+
}
|
|
22
|
+
.vxe-alert.theme--primary .vxe-alert--close-btn:hover {
|
|
23
|
+
color: var(--vxe-ui-font-primary-lighten-color);
|
|
24
|
+
}
|
|
25
|
+
.vxe-alert.theme--success {
|
|
26
|
+
color: var(--vxe-ui-status-success-color);
|
|
27
|
+
border: 1px solid var(--vxe-ui-status-success-lighten-color);
|
|
28
|
+
background-color: var(--vxe-ui-status-success-tinge-color);
|
|
29
|
+
}
|
|
30
|
+
.vxe-alert.theme--success::after {
|
|
31
|
+
background-color: var(--vxe-ui-status-success-color);
|
|
32
|
+
}
|
|
33
|
+
.vxe-alert.theme--success .vxe-alert--icon {
|
|
34
|
+
color: var(--vxe-ui-status-success-color);
|
|
35
|
+
}
|
|
36
|
+
.vxe-alert.theme--success .vxe-alert--close-btn:hover {
|
|
37
|
+
color: var(--vxe-ui-status-success-lighten-color);
|
|
38
|
+
}
|
|
39
|
+
.vxe-alert.theme--info {
|
|
40
|
+
color: var(--vxe-ui-status-info-color);
|
|
41
|
+
border: 1px solid var(--vxe-ui-status-info-lighten-color);
|
|
42
|
+
background-color: var(--vxe-ui-status-info-tinge-color);
|
|
43
|
+
}
|
|
44
|
+
.vxe-alert.theme--info::after {
|
|
45
|
+
background-color: var(--vxe-ui-status-info-color);
|
|
46
|
+
}
|
|
47
|
+
.vxe-alert.theme--info .vxe-alert--icon {
|
|
48
|
+
color: var(--vxe-ui-status-info-color);
|
|
49
|
+
}
|
|
50
|
+
.vxe-alert.theme--info .vxe-alert--close-btn:hover {
|
|
51
|
+
color: var(--vxe-ui-status-info-lighten-color);
|
|
52
|
+
}
|
|
53
|
+
.vxe-alert.theme--warning {
|
|
54
|
+
color: var(--vxe-ui-status-warning-color);
|
|
55
|
+
border: 1px solid var(--vxe-ui-status-warning-lighten-color);
|
|
56
|
+
background-color: var(--vxe-ui-status-warning-tinge-color);
|
|
57
|
+
}
|
|
58
|
+
.vxe-alert.theme--warning::after {
|
|
59
|
+
background-color: var(--vxe-ui-status-warning-color);
|
|
60
|
+
}
|
|
61
|
+
.vxe-alert.theme--warning .vxe-alert--icon {
|
|
62
|
+
color: var(--vxe-ui-status-warning-color);
|
|
63
|
+
}
|
|
64
|
+
.vxe-alert.theme--warning .vxe-alert--close-btn:hover {
|
|
65
|
+
color: var(--vxe-ui-status-warning-lighten-color);
|
|
66
|
+
}
|
|
67
|
+
.vxe-alert.theme--danger {
|
|
68
|
+
color: var(--vxe-ui-status-danger-color);
|
|
69
|
+
border: 1px solid var(--vxe-ui-status-danger-lighten-color);
|
|
70
|
+
background-color: var(--vxe-ui-status-danger-tinge-color);
|
|
71
|
+
}
|
|
72
|
+
.vxe-alert.theme--danger::after {
|
|
73
|
+
background-color: var(--vxe-ui-status-danger-color);
|
|
74
|
+
}
|
|
75
|
+
.vxe-alert.theme--danger .vxe-alert--icon {
|
|
76
|
+
color: var(--vxe-ui-status-danger-color);
|
|
77
|
+
}
|
|
78
|
+
.vxe-alert.theme--danger .vxe-alert--close-btn:hover {
|
|
79
|
+
color: var(--vxe-ui-status-danger-lighten-color);
|
|
80
|
+
}
|
|
81
|
+
.vxe-alert.theme--error {
|
|
82
|
+
color: var(--vxe-ui-status-error-color);
|
|
83
|
+
border: 1px solid var(--vxe-ui-status-error-lighten-color);
|
|
84
|
+
background-color: var(--vxe-ui-status-error-tinge-color);
|
|
85
|
+
}
|
|
86
|
+
.vxe-alert.theme--error::after {
|
|
87
|
+
background-color: var(--vxe-ui-status-error-color);
|
|
88
|
+
}
|
|
89
|
+
.vxe-alert.theme--error .vxe-alert--icon {
|
|
90
|
+
color: var(--vxe-ui-status-error-color);
|
|
91
|
+
}
|
|
92
|
+
.vxe-alert.theme--error .vxe-alert--close-btn:hover {
|
|
93
|
+
color: var(--vxe-ui-status-error-lighten-color);
|
|
94
|
+
}
|
|
95
|
+
.vxe-alert.size--medium {
|
|
96
|
+
font-size: var(--vxe-ui-font-size-medium);
|
|
97
|
+
}
|
|
98
|
+
.vxe-alert.size--small {
|
|
99
|
+
font-size: var(--vxe-ui-font-size-small);
|
|
100
|
+
}
|
|
101
|
+
.vxe-alert.size--mini {
|
|
102
|
+
font-size: var(--vxe-ui-font-size-mini);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.vxe-alert--icon {
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: row;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
flex-shrink: 0;
|
|
111
|
+
font-size: 1.5em;
|
|
112
|
+
padding: 0 var(--vxe-ui-layout-padding-default);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.vxe-alert--body {
|
|
116
|
+
flex-grow: 1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.vxe-alert--title {
|
|
120
|
+
font-size: 1.1em;
|
|
121
|
+
font-weight: 700;
|
|
122
|
+
line-height: 2em;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.vxe-alert--close-btn {
|
|
126
|
+
padding: 0 0.4em;
|
|
127
|
+
line-height: 2.2em;
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.vxe-alert{position:relative;display:flex;flex-direction:row;color:var(--vxe-ui-font-color);padding:var(--vxe-ui-layout-padding-default);margin-bottom:var(--vxe-ui-layout-padding-default);font-size:var(--vxe-ui-font-size-default);border-radius:var(--vxe-ui-base-border-radius)}.vxe-alert.theme--primary{color:var(--vxe-ui-font-primary-color);border:1px solid var(--vxe-ui-font-primary-lighten-color);background-color:var(--vxe-ui-font-primary-tinge-color)}.vxe-alert.theme--primary::after{background-color:var(--vxe-ui-font-primary-color)}.vxe-alert.theme--primary .vxe-alert--icon{color:var(--vxe-ui-font-primary-color)}.vxe-alert.theme--primary .vxe-alert--close-btn:hover{color:var(--vxe-ui-font-primary-lighten-color)}.vxe-alert.theme--success{color:var(--vxe-ui-status-success-color);border:1px solid var(--vxe-ui-status-success-lighten-color);background-color:var(--vxe-ui-status-success-tinge-color)}.vxe-alert.theme--success::after{background-color:var(--vxe-ui-status-success-color)}.vxe-alert.theme--success .vxe-alert--icon{color:var(--vxe-ui-status-success-color)}.vxe-alert.theme--success .vxe-alert--close-btn:hover{color:var(--vxe-ui-status-success-lighten-color)}.vxe-alert.theme--info{color:var(--vxe-ui-status-info-color);border:1px solid var(--vxe-ui-status-info-lighten-color);background-color:var(--vxe-ui-status-info-tinge-color)}.vxe-alert.theme--info::after{background-color:var(--vxe-ui-status-info-color)}.vxe-alert.theme--info .vxe-alert--icon{color:var(--vxe-ui-status-info-color)}.vxe-alert.theme--info .vxe-alert--close-btn:hover{color:var(--vxe-ui-status-info-lighten-color)}.vxe-alert.theme--warning{color:var(--vxe-ui-status-warning-color);border:1px solid var(--vxe-ui-status-warning-lighten-color);background-color:var(--vxe-ui-status-warning-tinge-color)}.vxe-alert.theme--warning::after{background-color:var(--vxe-ui-status-warning-color)}.vxe-alert.theme--warning .vxe-alert--icon{color:var(--vxe-ui-status-warning-color)}.vxe-alert.theme--warning .vxe-alert--close-btn:hover{color:var(--vxe-ui-status-warning-lighten-color)}.vxe-alert.theme--danger{color:var(--vxe-ui-status-danger-color);border:1px solid var(--vxe-ui-status-danger-lighten-color);background-color:var(--vxe-ui-status-danger-tinge-color)}.vxe-alert.theme--danger::after{background-color:var(--vxe-ui-status-danger-color)}.vxe-alert.theme--danger .vxe-alert--icon{color:var(--vxe-ui-status-danger-color)}.vxe-alert.theme--danger .vxe-alert--close-btn:hover{color:var(--vxe-ui-status-danger-lighten-color)}.vxe-alert.theme--error{color:var(--vxe-ui-status-error-color);border:1px solid var(--vxe-ui-status-error-lighten-color);background-color:var(--vxe-ui-status-error-tinge-color)}.vxe-alert.theme--error::after{background-color:var(--vxe-ui-status-error-color)}.vxe-alert.theme--error .vxe-alert--icon{color:var(--vxe-ui-status-error-color)}.vxe-alert.theme--error .vxe-alert--close-btn:hover{color:var(--vxe-ui-status-error-lighten-color)}.vxe-alert.size--medium{font-size:var(--vxe-ui-font-size-medium)}.vxe-alert.size--small{font-size:var(--vxe-ui-font-size-small)}.vxe-alert.size--mini{font-size:var(--vxe-ui-font-size-mini)}.vxe-alert--icon{display:flex;flex-direction:row;align-items:center;justify-content:center;flex-shrink:0;font-size:1.5em;padding:0 var(--vxe-ui-layout-padding-default)}.vxe-alert--body{flex-grow:1}.vxe-alert--title{font-size:1.1em;font-weight:700;line-height:2em}.vxe-alert--close-btn{padding:0 .4em;line-height:2.2em;cursor:pointer}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VxeUI } from '@vxe-ui/core';
|
|
2
|
+
import { dynamicApp } from '../dynamics';
|
|
3
|
+
import VxeAnchorComponent from './src/anchor';
|
|
4
|
+
export const VxeAnchor = Object.assign({}, VxeAnchorComponent, {
|
|
5
|
+
install(app) {
|
|
6
|
+
app.component(VxeAnchorComponent.name, VxeAnchorComponent);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
dynamicApp.use(VxeAnchor);
|
|
10
|
+
VxeUI.component(VxeAnchorComponent);
|
|
11
|
+
export const Anchor = VxeAnchor;
|
|
12
|
+
export default VxeAnchor;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { defineVxeComponent } from '../../ui/src/comp';
|
|
2
|
+
import XEUtils from 'xe-utils';
|
|
3
|
+
import { createEvent, renderEmptyElement } from '../../ui';
|
|
4
|
+
import { assembleAnchorLink, destroyAnchorLink } from './util';
|
|
5
|
+
export default defineVxeComponent({
|
|
6
|
+
name: 'VxeAnchorLink',
|
|
7
|
+
props: {
|
|
8
|
+
content: [String, Number],
|
|
9
|
+
title: [String, Number],
|
|
10
|
+
href: String
|
|
11
|
+
},
|
|
12
|
+
inject: {
|
|
13
|
+
$xeAnchor: {
|
|
14
|
+
default: null
|
|
15
|
+
},
|
|
16
|
+
$xeParentAnchorLink: {
|
|
17
|
+
from: '$xeAnchorLink',
|
|
18
|
+
default: null
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
provide() {
|
|
22
|
+
const $xeAnchorLink = this;
|
|
23
|
+
return {
|
|
24
|
+
$xeAnchorLink
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
data() {
|
|
28
|
+
const xID = XEUtils.uniqueId();
|
|
29
|
+
const reactData = {};
|
|
30
|
+
const linkConfig = {
|
|
31
|
+
id: xID,
|
|
32
|
+
href: '',
|
|
33
|
+
children: []
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
xID,
|
|
37
|
+
reactData,
|
|
38
|
+
linkConfig
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
computed: Object.assign(Object.assign({}, {}), { computeIsActive() {
|
|
42
|
+
const $xeAnchorLink = this;
|
|
43
|
+
const props = $xeAnchorLink;
|
|
44
|
+
const $xeAnchor = $xeAnchorLink.$xeAnchor;
|
|
45
|
+
const { href } = props;
|
|
46
|
+
if ($xeAnchor) {
|
|
47
|
+
return $xeAnchor.reactData.activeHref === href;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
} }),
|
|
51
|
+
watch: {
|
|
52
|
+
href(val) {
|
|
53
|
+
const $xeAnchorLink = this;
|
|
54
|
+
const linkConfig = $xeAnchorLink.linkConfig;
|
|
55
|
+
linkConfig.href = val;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
//
|
|
60
|
+
// Method
|
|
61
|
+
//
|
|
62
|
+
dispatchEvent(type, params, evnt) {
|
|
63
|
+
const $xeAnchorLink = this;
|
|
64
|
+
$xeAnchorLink.$emit(type, createEvent(evnt, { $anchorLink: $xeAnchorLink }, params));
|
|
65
|
+
},
|
|
66
|
+
clickEvent(event) {
|
|
67
|
+
const $xeAnchorLink = this;
|
|
68
|
+
const props = $xeAnchorLink;
|
|
69
|
+
const $xeAnchor = $xeAnchorLink.$xeAnchor;
|
|
70
|
+
const { href } = props;
|
|
71
|
+
if ($xeAnchor) {
|
|
72
|
+
$xeAnchor.handleClickLink(event, href);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
//
|
|
76
|
+
// Render
|
|
77
|
+
//
|
|
78
|
+
renderVN(h) {
|
|
79
|
+
const $xeAnchorLink = this;
|
|
80
|
+
const props = $xeAnchorLink;
|
|
81
|
+
const slots = $xeAnchorLink.$scopedSlots;
|
|
82
|
+
const { href, content, title } = props;
|
|
83
|
+
const defaultSlot = slots.default;
|
|
84
|
+
const subSlot = slots.sub;
|
|
85
|
+
const isActive = $xeAnchorLink.computeIsActive;
|
|
86
|
+
return h('div', {
|
|
87
|
+
ref: 'refElem',
|
|
88
|
+
class: ['vxe-anchor-link', {
|
|
89
|
+
'is--active': isActive
|
|
90
|
+
}]
|
|
91
|
+
}, [
|
|
92
|
+
h('a', {
|
|
93
|
+
class: 'vxe-anchor-link--item',
|
|
94
|
+
attrs: {
|
|
95
|
+
href,
|
|
96
|
+
title
|
|
97
|
+
},
|
|
98
|
+
on: {
|
|
99
|
+
click: $xeAnchorLink.clickEvent
|
|
100
|
+
}
|
|
101
|
+
}, defaultSlot ? defaultSlot({}) : (XEUtils.toValueString(content))),
|
|
102
|
+
subSlot
|
|
103
|
+
? h('div', {
|
|
104
|
+
class: 'vxe-anchor-link--sub-items'
|
|
105
|
+
}, subSlot({}))
|
|
106
|
+
: renderEmptyElement($xeAnchorLink)
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
created() {
|
|
111
|
+
const $xeAnchorLink = this;
|
|
112
|
+
const props = $xeAnchorLink;
|
|
113
|
+
const linkConfig = $xeAnchorLink.linkConfig;
|
|
114
|
+
linkConfig.href = props.href;
|
|
115
|
+
},
|
|
116
|
+
mounted() {
|
|
117
|
+
const $xeAnchorLink = this;
|
|
118
|
+
const $xeAnchor = $xeAnchorLink.$xeAnchor;
|
|
119
|
+
const $xeParentAnchorLink = $xeAnchorLink.$xeParentAnchorLink;
|
|
120
|
+
const linkConfig = $xeAnchorLink.linkConfig;
|
|
121
|
+
const elem = $xeAnchorLink.$refs.refElem;
|
|
122
|
+
if ($xeAnchor && elem) {
|
|
123
|
+
assembleAnchorLink($xeAnchor, elem, linkConfig, $xeParentAnchorLink);
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
beforeDestroy() {
|
|
127
|
+
const $xeAnchorLink = this;
|
|
128
|
+
const $xeAnchor = $xeAnchorLink.$xeAnchor;
|
|
129
|
+
const linkConfig = $xeAnchorLink.linkConfig;
|
|
130
|
+
if ($xeAnchor) {
|
|
131
|
+
destroyAnchorLink($xeAnchor, linkConfig);
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
render(h) {
|
|
135
|
+
return this.renderVN(h);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { defineVxeComponent } from '../../ui/src/comp';
|
|
2
|
+
import XEUtils from 'xe-utils';
|
|
3
|
+
import { createEvent, renderEmptyElement } from '../../ui';
|
|
4
|
+
import { getOffsetPos } from '../../ui/src/dom';
|
|
5
|
+
import VxeAnchorLinkComponent from './anchor-link';
|
|
6
|
+
export default defineVxeComponent({
|
|
7
|
+
name: 'VxeAnchor',
|
|
8
|
+
props: {
|
|
9
|
+
value: String,
|
|
10
|
+
options: Array,
|
|
11
|
+
container: [String, Object, Function],
|
|
12
|
+
showMarker: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: true
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
provide() {
|
|
18
|
+
const $xeAnchor = this;
|
|
19
|
+
return {
|
|
20
|
+
$xeAnchor
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
data() {
|
|
24
|
+
const xID = XEUtils.uniqueId();
|
|
25
|
+
const reactData = {
|
|
26
|
+
activeHref: null,
|
|
27
|
+
staticLinks: [],
|
|
28
|
+
containerElem: null
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
xID,
|
|
32
|
+
reactData
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
computeAllHrefList() {
|
|
37
|
+
const $xeAnchor = this;
|
|
38
|
+
const reactData = $xeAnchor.reactData;
|
|
39
|
+
const list = [];
|
|
40
|
+
XEUtils.eachTree(reactData.staticLinks, item => {
|
|
41
|
+
list.push(item.href || '');
|
|
42
|
+
}, { children: 'children' });
|
|
43
|
+
return list;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
watch: {
|
|
47
|
+
value(val) {
|
|
48
|
+
const $xeAnchor = this;
|
|
49
|
+
const reactData = $xeAnchor.reactData;
|
|
50
|
+
reactData.activeHref = val;
|
|
51
|
+
},
|
|
52
|
+
'reactData.activeHref'() {
|
|
53
|
+
const $xeAnchor = this;
|
|
54
|
+
$xeAnchor.updateMarkerPos();
|
|
55
|
+
},
|
|
56
|
+
container() {
|
|
57
|
+
const $xeAnchor = this;
|
|
58
|
+
$xeAnchor.removeContainerElemScroll();
|
|
59
|
+
$xeAnchor.updateContainerElem();
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
methods: {
|
|
63
|
+
//
|
|
64
|
+
// Method
|
|
65
|
+
//
|
|
66
|
+
dispatchEvent(type, params, evnt) {
|
|
67
|
+
const $xeAnchor = this;
|
|
68
|
+
$xeAnchor.$emit(type, createEvent(evnt, { $anchor: $xeAnchor }, params));
|
|
69
|
+
},
|
|
70
|
+
getContainerElem() {
|
|
71
|
+
const $xeAnchor = this;
|
|
72
|
+
const props = $xeAnchor;
|
|
73
|
+
const { container } = props;
|
|
74
|
+
if (container) {
|
|
75
|
+
if (XEUtils.isElement(container)) {
|
|
76
|
+
return container;
|
|
77
|
+
}
|
|
78
|
+
if (XEUtils.isString(container)) {
|
|
79
|
+
return document.querySelector(container);
|
|
80
|
+
}
|
|
81
|
+
if (XEUtils.isFunction(container)) {
|
|
82
|
+
return container({ $anchor: $xeAnchor });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
},
|
|
87
|
+
emitEvent(value) {
|
|
88
|
+
const $xeAnchor = this;
|
|
89
|
+
const reactData = $xeAnchor.reactData;
|
|
90
|
+
reactData.activeHref = value;
|
|
91
|
+
$xeAnchor.$emit('input', value);
|
|
92
|
+
},
|
|
93
|
+
handleContainerScrollEvent() {
|
|
94
|
+
const $xeAnchor = this;
|
|
95
|
+
const reactData = $xeAnchor.reactData;
|
|
96
|
+
const allHrefList = $xeAnchor.computeAllHrefList;
|
|
97
|
+
const { containerElem } = reactData;
|
|
98
|
+
if (containerElem) {
|
|
99
|
+
const wrapperElList = containerElem.querySelectorAll(allHrefList.map(href => `${href}`).join(','));
|
|
100
|
+
for (let i = 0; i < wrapperElList.length; i++) {
|
|
101
|
+
const wrapperEl = wrapperElList[i];
|
|
102
|
+
const wrapperRect = wrapperEl.getBoundingClientRect();
|
|
103
|
+
if (wrapperRect.top > 0) {
|
|
104
|
+
const href = wrapperEl.id;
|
|
105
|
+
reactData.activeHref = `#${href}`;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
removeContainerElemScroll() {
|
|
112
|
+
const $xeAnchor = this;
|
|
113
|
+
const reactData = $xeAnchor.reactData;
|
|
114
|
+
const { containerElem } = reactData;
|
|
115
|
+
if (containerElem) {
|
|
116
|
+
containerElem.removeEventListener('scroll', $xeAnchor.handleContainerScrollEvent);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
updateContainerElem() {
|
|
120
|
+
const $xeAnchor = this;
|
|
121
|
+
const reactData = $xeAnchor.reactData;
|
|
122
|
+
const containerElem = $xeAnchor.getContainerElem();
|
|
123
|
+
reactData.containerElem = containerElem;
|
|
124
|
+
if (containerElem) {
|
|
125
|
+
containerElem.addEventListener('scroll', $xeAnchor.handleContainerScrollEvent, {
|
|
126
|
+
passive: false
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
updateMarkerPos() {
|
|
131
|
+
const $xeAnchor = this;
|
|
132
|
+
const reactData = $xeAnchor.reactData;
|
|
133
|
+
$xeAnchor.$nextTick(() => {
|
|
134
|
+
const { activeHref } = reactData;
|
|
135
|
+
const elem = $xeAnchor.$refs.refElem;
|
|
136
|
+
const markerEl = $xeAnchor.$refs.refMarkerElem;
|
|
137
|
+
if (elem && markerEl) {
|
|
138
|
+
if (activeHref) {
|
|
139
|
+
const linkEl = elem.querySelector(`[href="${activeHref}"]`);
|
|
140
|
+
if (linkEl) {
|
|
141
|
+
const { top } = getOffsetPos(linkEl, elem);
|
|
142
|
+
markerEl.style.top = `${top}px`;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
handleClickLink(evnt, href) {
|
|
149
|
+
const $xeAnchor = this;
|
|
150
|
+
evnt.preventDefault();
|
|
151
|
+
const targetEl = document.getElementById(`${href}`.replace('#', ''));
|
|
152
|
+
if (targetEl) {
|
|
153
|
+
targetEl.scrollIntoView({
|
|
154
|
+
behavior: 'smooth'
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
$xeAnchor.emitEvent(href);
|
|
158
|
+
$xeAnchor.dispatchEvent('click', { href }, evnt);
|
|
159
|
+
},
|
|
160
|
+
//
|
|
161
|
+
// Render
|
|
162
|
+
//
|
|
163
|
+
renderSubItems(h, options) {
|
|
164
|
+
const $xeAnchor = this;
|
|
165
|
+
const itemVNs = [];
|
|
166
|
+
if (options) {
|
|
167
|
+
options.forEach(item => {
|
|
168
|
+
const subItems = item.children;
|
|
169
|
+
if (subItems && subItems.length) {
|
|
170
|
+
itemVNs.push(h(VxeAnchorLinkComponent, {
|
|
171
|
+
props: {
|
|
172
|
+
content: item.content,
|
|
173
|
+
title: item.title,
|
|
174
|
+
href: item.href
|
|
175
|
+
},
|
|
176
|
+
scopedSlots: {
|
|
177
|
+
sub: () => $xeAnchor.renderSubItems(h, subItems)
|
|
178
|
+
}
|
|
179
|
+
}));
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
itemVNs.push(h(VxeAnchorLinkComponent, {
|
|
183
|
+
props: {
|
|
184
|
+
content: item.content,
|
|
185
|
+
title: item.title,
|
|
186
|
+
href: item.href
|
|
187
|
+
}
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
return itemVNs;
|
|
193
|
+
},
|
|
194
|
+
renderVN(h) {
|
|
195
|
+
const $xeAnchor = this;
|
|
196
|
+
const props = $xeAnchor;
|
|
197
|
+
const slots = $xeAnchor.$scopedSlots;
|
|
198
|
+
const { options, showMarker } = props;
|
|
199
|
+
const defaultSlot = slots.default;
|
|
200
|
+
return h('div', {
|
|
201
|
+
ref: 'refElem',
|
|
202
|
+
class: ['vxe-anchor', {
|
|
203
|
+
'is--marker': showMarker
|
|
204
|
+
}]
|
|
205
|
+
}, [
|
|
206
|
+
h('div', {
|
|
207
|
+
class: 'vxe-anchor--list'
|
|
208
|
+
}, defaultSlot ? defaultSlot({}) : $xeAnchor.renderSubItems(h, options)),
|
|
209
|
+
showMarker
|
|
210
|
+
? h('div', {
|
|
211
|
+
ref: 'refMarkerElem',
|
|
212
|
+
class: 'vxe-anchor--marker'
|
|
213
|
+
})
|
|
214
|
+
: renderEmptyElement($xeAnchor)
|
|
215
|
+
]);
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
mounted() {
|
|
219
|
+
const $xeAnchor = this;
|
|
220
|
+
$xeAnchor.$nextTick(() => {
|
|
221
|
+
$xeAnchor.updateContainerElem();
|
|
222
|
+
});
|
|
223
|
+
},
|
|
224
|
+
beforeDestroy() {
|
|
225
|
+
const $xeAnchor = this;
|
|
226
|
+
$xeAnchor.removeContainerElemScroll();
|
|
227
|
+
},
|
|
228
|
+
render(h) {
|
|
229
|
+
return this.renderVN(h);
|
|
230
|
+
}
|
|
231
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils';
|
|
2
|
+
export function assembleAnchorLink($xeAnchor, elem, linkConfig, $xeParentAnchorLink) {
|
|
3
|
+
const staticLinks = $xeAnchor.reactData.staticLinks;
|
|
4
|
+
const parentElem = elem.parentNode;
|
|
5
|
+
const parentLinkConfig = $xeParentAnchorLink ? $xeParentAnchorLink.linkConfig : null;
|
|
6
|
+
const parentLinks = parentLinkConfig ? parentLinkConfig.children : staticLinks;
|
|
7
|
+
if (parentElem && parentLinks) {
|
|
8
|
+
parentLinks.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, linkConfig);
|
|
9
|
+
$xeAnchor.reactData.staticLinks = staticLinks.slice(0);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function destroyAnchorLink($xeAnchor, linkConfig) {
|
|
13
|
+
const staticLinks = $xeAnchor.reactData.staticLinks;
|
|
14
|
+
const matchObj = XEUtils.findTree(staticLinks, item => item.id === linkConfig.id, { children: 'children' });
|
|
15
|
+
if (matchObj) {
|
|
16
|
+
matchObj.items.splice(matchObj.index, 1);
|
|
17
|
+
}
|
|
18
|
+
$xeAnchor.reactData.staticLinks = staticLinks.slice(0);
|
|
19
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.vxe-anchor {
|
|
2
|
+
position: relative;
|
|
3
|
+
color: var(--vxe-ui-font-color);
|
|
4
|
+
font-family: var(--vxe-ui-font-family);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.vxe-anchor--marker {
|
|
8
|
+
position: absolute;
|
|
9
|
+
left: 0;
|
|
10
|
+
top: 0;
|
|
11
|
+
width: 0.2em;
|
|
12
|
+
height: 1.5em;
|
|
13
|
+
padding: 0.25em 0;
|
|
14
|
+
transition: all 0.35s ease-in-out;
|
|
15
|
+
}
|
|
16
|
+
.vxe-anchor--marker::before {
|
|
17
|
+
display: block;
|
|
18
|
+
content: "";
|
|
19
|
+
height: 100%;
|
|
20
|
+
width: 100%;
|
|
21
|
+
border-radius: 1em;
|
|
22
|
+
background-color: var(--vxe-ui-anchor-link-active-color);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.vxe-anchor-link {
|
|
26
|
+
position: relative;
|
|
27
|
+
padding-left: 0.6em;
|
|
28
|
+
}
|
|
29
|
+
.vxe-anchor-link.is--active > .vxe-anchor-link--item {
|
|
30
|
+
color: var(--vxe-ui-anchor-link-active-color);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.vxe-anchor-link--item {
|
|
34
|
+
display: block;
|
|
35
|
+
height: 1.5em;
|
|
36
|
+
line-height: 1.5em;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
text-overflow: ellipsis;
|
|
39
|
+
white-space: nowrap;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
color: var(--vxe-ui-anchor-link-color);
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.vxe-anchor{position:relative;color:var(--vxe-ui-font-color);font-family:var(--vxe-ui-font-family)}.vxe-anchor--marker{position:absolute;left:0;top:0;width:.2em;height:1.5em;padding:.25em 0;transition:all .35s ease-in-out}.vxe-anchor--marker::before{display:block;content:"";height:100%;width:100%;border-radius:1em;background-color:var(--vxe-ui-anchor-link-active-color)}.vxe-anchor-link{position:relative;padding-left:.6em}.vxe-anchor-link.is--active>.vxe-anchor-link--item{color:var(--vxe-ui-anchor-link-active-color)}.vxe-anchor-link--item{display:block;height:1.5em;line-height:1.5em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer;color:var(--vxe-ui-anchor-link-color)}
|