@veltra/desktop 1.3.1 → 1.3.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/dist/components/action/action-group.vue.d.ts +3 -3
- package/dist/components/action/action.vue.d.ts +4 -2
- package/dist/components/action/index.d.ts +3 -2
- package/dist/components/action/style.d.ts +2 -1
- package/dist/components/auto-complete/auto-complete.vue.d.ts +2 -1
- package/dist/components/auto-complete/index.d.ts +2 -1
- package/dist/components/auto-complete/style.d.ts +4 -1
- package/dist/components/auto-complete/use-keyboard.js +1 -1
- package/dist/components/auto-complete/use-keyboard.js.map +1 -1
- package/dist/components/badge/badge.vue.d.ts +2 -1
- package/dist/components/badge/index.d.ts +2 -1
- package/dist/components/batch-edit/batch-edit.vue.d.ts +11 -9
- package/dist/components/batch-edit/helper.d.ts +1 -0
- package/dist/components/batch-edit/index.d.ts +3 -2
- package/dist/components/batch-edit/style.d.ts +5 -1
- package/dist/components/batch-edit/use-features.js +1 -1
- package/dist/components/batch-edit/use-features.js.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.vue.d.ts +2 -1
- package/dist/components/breadcrumb/index.d.ts +2 -1
- package/dist/components/button/button-group.vue.d.ts +2 -1
- package/dist/components/button/button.vue.d.ts +2 -1
- package/dist/components/button/index.d.ts +3 -2
- package/dist/components/button/style.d.ts +1 -1
- package/dist/components/calendar/calendar.vue.d.ts +2 -1
- package/dist/components/calendar/index.d.ts +2 -1
- package/dist/components/card/card-action.vue.d.ts +2 -1
- package/dist/components/card/card-content.vue.d.ts +2 -1
- package/dist/components/card/card-cover.vue.d.ts +2 -1
- package/dist/components/card/card-header.vue.d.ts +1 -1
- package/dist/components/card/card.vue.d.ts +2 -1
- package/dist/components/card/index.d.ts +6 -5
- package/dist/components/cascade/cascade.vue.d.ts +3 -2
- package/dist/components/cascade/index.d.ts +2 -1
- package/dist/components/cascade/style.d.ts +3 -1
- package/dist/components/check-tag/check-tag.vue.d.ts +2 -1
- package/dist/components/check-tag/index.d.ts +2 -1
- package/dist/components/checkbox/checkbox-button.vue.d.ts +3 -2
- package/dist/components/checkbox/checkbox.vue.d.ts +2 -1
- package/dist/components/checkbox/index.d.ts +3 -2
- package/dist/components/checkbox/style.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.vue.d.ts +2 -1
- package/dist/components/checkbox-group/index.d.ts +2 -1
- package/dist/components/checkbox-group/style.d.ts +1 -1
- package/dist/components/code-editor/code-editor.vue.d.ts +2 -1
- package/dist/components/code-editor/index.d.ts +2 -1
- package/dist/components/code-editor/langs/spel/language.js +2 -2
- package/dist/components/code-editor/langs/spel/language.js.map +1 -1
- package/dist/components/code-editor/style.d.ts +1 -1
- package/dist/components/collapse/collapse-item.vue.d.ts +4 -3
- package/dist/components/collapse/collapse.vue.d.ts +2 -1
- package/dist/components/collapse/index.d.ts +3 -2
- package/dist/components/condition-editor/condition-editor.vue.d.ts +3 -1
- package/dist/components/condition-editor/core/evaluator.d.ts +1 -0
- package/dist/components/condition-editor/index.d.ts +3 -2
- package/dist/components/condition-editor/style.d.ts +2 -1
- package/dist/components/contextmenu/api.d.ts +1 -0
- package/dist/components/contextmenu/contextmenu.vue.d.ts +2 -1
- package/dist/components/contextmenu/index.d.ts +3 -2
- package/dist/components/contextmenu/style.d.ts +2 -1
- package/dist/components/date-panel/date-panel.vue.d.ts +3 -2
- package/dist/components/date-panel/index.d.ts +2 -1
- package/dist/components/date-picker/date-picker.vue.d.ts +3 -2
- package/dist/components/date-picker/index.d.ts +2 -1
- package/dist/components/date-picker/style.d.ts +2 -1
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +3 -2
- package/dist/components/date-range-picker/index.d.ts +2 -1
- package/dist/components/date-range-picker/style.d.ts +1 -1
- package/dist/components/dialog/dialog.vue.d.ts +5 -2
- package/dist/components/dialog/index.d.ts +2 -1
- package/dist/components/dialog/style.d.ts +1 -1
- package/dist/components/drawer/drawer.vue.d.ts +3 -1
- package/dist/components/drawer/index.d.ts +2 -1
- package/dist/components/drawer/style.d.ts +1 -1
- package/dist/components/dropdown/dropdown.vue.d.ts +6 -2
- package/dist/components/dropdown/index.d.ts +2 -1
- package/dist/components/dropdown/style.d.ts +1 -1
- package/dist/components/dual-nav/dual-nav.vue.d.ts +2 -1
- package/dist/components/dual-nav/index.d.ts +2 -1
- package/dist/components/dual-nav/style.d.ts +1 -1
- package/dist/components/empty/empty.vue.d.ts +2 -1
- package/dist/components/empty/index.d.ts +2 -1
- package/dist/components/expression-editor/expression-editor.vue.d.ts +3 -1
- package/dist/components/expression-editor/index.d.ts +2 -1
- package/dist/components/file-picker/file-picker.js +6 -3
- package/dist/components/file-picker/file-picker.js.map +1 -1
- package/dist/components/file-picker/file-picker.vue.d.ts +2 -1
- package/dist/components/file-picker/index.d.ts +2 -1
- package/dist/components/file-viewer/file-viewer.js +2 -2
- package/dist/components/file-viewer/file-viewer.js.map +1 -1
- package/dist/components/file-viewer/file-viewer.vue.d.ts +1 -2
- package/dist/components/file-viewer/helper.js +4 -4
- package/dist/components/file-viewer/helper.js.map +1 -1
- package/dist/components/file-viewer/index.d.ts +2 -1
- package/dist/components/float-button/float-button.vue.d.ts +2 -1
- package/dist/components/float-button/index.d.ts +2 -1
- package/dist/components/float-button/style.d.ts +1 -1
- package/dist/components/form/form.vue.d.ts +2 -1
- package/dist/components/form/index.d.ts +2 -1
- package/dist/components/form-item/form-item.js.map +1 -1
- package/dist/components/form-item/form-item.vue.d.ts +4 -2
- package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/form-item/index.d.ts +2 -1
- package/dist/components/gantt-chart/gantt-chart.vue.d.ts +2 -1
- package/dist/components/gantt-chart/index.d.ts +2 -1
- package/dist/components/grid/grid-item.vue.d.ts +2 -1
- package/dist/components/grid/grid.vue.d.ts +3 -1
- package/dist/components/grid/index.d.ts +3 -2
- package/dist/components/grid/use-responsive.js +2 -1
- package/dist/components/grid/use-responsive.js.map +1 -1
- package/dist/components/grid-input/grid-input.vue.d.ts +3 -1
- package/dist/components/grid-input/index.d.ts +2 -1
- package/dist/components/group-input/group-input.vue.d.ts +4 -3
- package/dist/components/group-input/index.d.ts +2 -1
- package/dist/components/group-input/style.d.ts +1 -1
- package/dist/components/group-nav/group-nav.vue.d.ts +1 -2
- package/dist/components/group-nav/index.d.ts +2 -1
- package/dist/components/icon/icon.vue.d.ts +2 -1
- package/dist/components/icon/index.d.ts +2 -1
- package/dist/components/index.d.ts +168 -92
- package/dist/components/index.js +5 -5
- package/dist/components/input/index.d.ts +2 -1
- package/dist/components/input/input.vue.d.ts +2 -1
- package/dist/components/input/style.d.ts +1 -1
- package/dist/components/kbd/kbd.vue.d.ts +1 -1
- package/dist/components/layout/index.d.ts +2 -1
- package/dist/components/layout/layout.vue.d.ts +2 -1
- package/dist/components/list/index.d.ts +3 -2
- package/dist/components/list/list-item.vue.d.ts +1 -1
- package/dist/components/list/list.vue.d.ts +2 -1
- package/dist/components/list/style.d.ts +1 -1
- package/dist/components/loading/directive.d.ts +0 -1
- package/dist/components/loading/index.d.ts +3 -2
- package/dist/components/loading/loading.vue.d.ts +3 -1
- package/dist/components/loading/style.d.ts +1 -1
- package/dist/components/message/index.d.ts +3 -2
- package/dist/components/message/message.d.ts +1 -0
- package/dist/components/message/message.vue.d.ts +3 -1
- package/dist/components/message-confirm/index.d.ts +3 -2
- package/dist/components/message-confirm/message-confirm-box.js +39 -0
- package/dist/components/message-confirm/message-confirm-box.js.map +1 -0
- package/dist/components/message-confirm/message-confirm.d.ts +5 -7
- package/dist/components/message-confirm/message-confirm.js +32 -46
- package/dist/components/message-confirm/message-confirm.js.map +1 -1
- package/dist/components/message-confirm/message-confirm.vue.d.ts +8 -4
- package/dist/components/message-confirm/message-confirm2.js +98 -23
- package/dist/components/message-confirm/message-confirm2.js.map +1 -1
- package/dist/components/message-confirm/style2.css +9 -9
- package/dist/components/multi-select/index.d.ts +2 -1
- package/dist/components/multi-select/multi-select.vue.d.ts +8 -7
- package/dist/components/multi-select/style.d.ts +5 -1
- package/dist/components/multi-tree-select/index.d.ts +2 -1
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +2 -2
- package/dist/components/multi-tree-select/style.d.ts +6 -1
- package/dist/components/nav/index.d.ts +4 -3
- package/dist/components/nav/nav-item.vue.d.ts +2 -1
- package/dist/components/nav/nav-sub.vue.d.ts +2 -1
- package/dist/components/nav/nav.vue.d.ts +2 -1
- package/dist/components/node-render/index.d.ts +2 -1
- package/dist/components/node-render/node-render.d.ts +1 -2
- package/dist/components/notification/index.d.ts +3 -8
- package/dist/components/notification/notification-box.js +130 -0
- package/dist/components/notification/notification-box.js.map +1 -0
- package/dist/components/notification/notification.d.ts +8 -0
- package/dist/components/notification/notification.js +62 -84
- package/dist/components/notification/notification.js.map +1 -1
- package/dist/components/notification/notification.vue.d.ts +10 -5
- package/dist/components/notification/notification2.js +134 -0
- package/dist/components/notification/notification2.js.map +1 -0
- package/dist/components/notification/style2.css +62 -32
- package/dist/components/number/index.d.ts +2 -1
- package/dist/components/number/number.vue.d.ts +2 -1
- package/dist/components/number-input/index.d.ts +2 -1
- package/dist/components/number-input/number-input.js +2 -1
- package/dist/components/number-input/number-input.js.map +1 -1
- package/dist/components/number-input/number-input.vue.d.ts +4 -2
- package/dist/components/number-input/style.d.ts +2 -1
- package/dist/components/number-range-input/index.d.ts +2 -1
- package/dist/components/number-range-input/number-range-input.js +4 -2
- package/dist/components/number-range-input/number-range-input.js.map +1 -1
- package/dist/components/number-range-input/number-range-input.vue.d.ts +3 -2
- package/dist/components/number-range-input/style.d.ts +1 -1
- package/dist/components/paginator/index.d.ts +2 -1
- package/dist/components/paginator/paginator.vue.d.ts +2 -1
- package/dist/components/paginator/style.d.ts +2 -1
- package/dist/components/palette/index.d.ts +2 -1
- package/dist/components/palette/palette-sv.js +4 -2
- package/dist/components/palette/palette-sv.js.map +1 -1
- package/dist/components/palette/palette.vue.d.ts +2 -1
- package/dist/components/palette/style.d.ts +2 -1
- package/dist/components/password-input/index.d.ts +2 -1
- package/dist/components/password-input/password-input.vue.d.ts +2 -1
- package/dist/components/password-input/style.d.ts +1 -1
- package/dist/components/pop-confirm/index.d.ts +2 -1
- package/dist/components/pop-confirm/pop-confirm.vue.d.ts +3 -1
- package/dist/components/pop-confirm/style.d.ts +1 -1
- package/dist/components/progress/index.d.ts +2 -1
- package/dist/components/progress/progress.vue.d.ts +4 -3
- package/dist/components/progress-nodes/index.d.ts +2 -1
- package/dist/components/progress-nodes/progress-nodes.js +2 -1
- package/dist/components/progress-nodes/progress-nodes.js.map +1 -1
- package/dist/components/progress-nodes/progress-nodes.vue.d.ts +8 -7
- package/dist/components/radio/index.d.ts +2 -1
- package/dist/components/radio/radio.vue.d.ts +2 -1
- package/dist/components/radio/style.d.ts +1 -1
- package/dist/components/radio-group/index.d.ts +2 -1
- package/dist/components/radio-group/radio-group.vue.d.ts +2 -1
- package/dist/components/radio-group/style.d.ts +1 -1
- package/dist/components/rich-text-editor/index.d.ts +2 -1
- package/dist/components/rich-text-editor/rich-text-editor.js +2 -1
- package/dist/components/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +3 -1
- package/dist/components/rich-text-editor/toolbar.js +2 -1
- package/dist/components/rich-text-editor/toolbar.js.map +1 -1
- package/dist/components/scroll/index.d.ts +2 -1
- package/dist/components/scroll/scroll.vue.d.ts +5 -2
- package/dist/components/select/index.d.ts +2 -1
- package/dist/components/select/select.vue.d.ts +5 -2
- package/dist/components/select/style.d.ts +3 -1
- package/dist/components/slider/index.d.ts +2 -1
- package/dist/components/slider/slider.vue.d.ts +4 -3
- package/dist/components/steps/index.d.ts +2 -1
- package/dist/components/steps/steps.vue.d.ts +4 -3
- package/dist/components/switch/index.d.ts +2 -1
- package/dist/components/switch/switch.vue.d.ts +2 -1
- package/dist/components/table/index.d.ts +3 -2
- package/dist/components/table/node/col.d.ts +1 -1
- package/dist/components/table/node/row.d.ts +0 -1
- package/dist/components/table/style.d.ts +3 -1
- package/dist/components/table/table-row.js +2 -1
- package/dist/components/table/table-row.js.map +1 -1
- package/dist/components/table/table.vue.d.ts +3 -1
- package/dist/components/table/use-columns.d.ts +3 -0
- package/dist/components/table/use-columns.js +2 -1
- package/dist/components/table/use-columns.js.map +1 -1
- package/dist/components/table-editor/index.d.ts +2 -1
- package/dist/components/table-editor/style.d.ts +2 -1
- package/dist/components/table-editor/table-editor.vue.d.ts +2 -1
- package/dist/components/tabs/index.d.ts +4 -3
- package/dist/components/tabs/style.d.ts +2 -1
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +5 -4
- package/dist/components/tabs/tabs-vertical.vue.d.ts +5 -4
- package/dist/components/tabs/tabs.vue.d.ts +5 -4
- package/dist/components/tag/index.d.ts +2 -1
- package/dist/components/tag/tag.vue.d.ts +2 -1
- package/dist/components/text/index.d.ts +2 -1
- package/dist/components/text/text.vue.d.ts +2 -1
- package/dist/components/textarea/index.d.ts +2 -1
- package/dist/components/textarea/style.d.ts +1 -1
- package/dist/components/textarea/textarea.js +4 -2
- package/dist/components/textarea/textarea.js.map +1 -1
- package/dist/components/textarea/textarea.vue.d.ts +2 -1
- package/dist/components/theme/index.d.ts +2 -1
- package/dist/components/theme/style.d.ts +5 -1
- package/dist/components/theme/theme.vue.d.ts +2 -1
- package/dist/components/tip/index.d.ts +2 -1
- package/dist/components/tip/tip.js +32 -5
- package/dist/components/tip/tip.js.map +1 -1
- package/dist/components/tip/tip.vue.d.ts +4 -1
- package/dist/components/tree/di.d.ts +2 -0
- package/dist/components/tree/index.d.ts +2 -1
- package/dist/components/tree/style.d.ts +1 -1
- package/dist/components/tree/tree.vue.d.ts +3 -1
- package/dist/components/tree-select/index.d.ts +2 -1
- package/dist/components/tree-select/style.d.ts +3 -1
- package/dist/components/tree-select/tree-select.vue.d.ts +5 -3
- package/dist/components/watermark/index.d.ts +2 -1
- package/dist/components/watermark/watermark.vue.d.ts +2 -1
- package/dist/index.d.ts +97 -98
- package/dist/index.js +3 -3
- package/dist/install.d.ts +1 -1
- package/dist/node_modules/.bun/@codemirror_autocomplete@6.20.3/node_modules/@codemirror/autocomplete/dist/index.js +13 -4
- package/dist/node_modules/.bun/@codemirror_autocomplete@6.20.3/node_modules/@codemirror/autocomplete/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@codemirror_commands@6.10.4/node_modules/@codemirror/commands/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_lang-css@6.3.1/node_modules/@codemirror/lang-css/dist/index.js +3 -2
- package/dist/node_modules/.bun/@codemirror_lang-css@6.3.1/node_modules/@codemirror/lang-css/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@codemirror_lang-html@6.4.11/node_modules/@codemirror/lang-html/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_lang-java@6.0.2/node_modules/@codemirror/lang-java/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_lang-javascript@6.2.5/node_modules/@codemirror/lang-javascript/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_lang-json@6.0.2/node_modules/@codemirror/lang-json/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_lang-markdown@6.5.1/node_modules/@codemirror/lang-markdown/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_lang-sql@6.10.0/node_modules/@codemirror/lang-sql/dist/index.js +31 -5
- package/dist/node_modules/.bun/@codemirror_lang-sql@6.10.0/node_modules/@codemirror/lang-sql/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js +5 -3
- package/dist/node_modules/.bun/@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@codemirror_lint@6.9.7/node_modules/@codemirror/lint/dist/index.js +1 -1
- package/dist/node_modules/.bun/@codemirror_search@6.7.1/node_modules/@codemirror/search/dist/index.js +3 -2
- package/dist/node_modules/.bun/@codemirror_search@6.7.1/node_modules/@codemirror/search/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@codemirror_state@6.7.0/node_modules/@codemirror/state/dist/index.js +3 -2
- package/dist/node_modules/.bun/@codemirror_state@6.7.0/node_modules/@codemirror/state/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@codemirror_theme-one-dark@6.1.3/node_modules/@codemirror/theme-one-dark/dist/index.js +30 -7
- package/dist/node_modules/.bun/@codemirror_theme-one-dark@6.1.3/node_modules/@codemirror/theme-one-dark/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@codemirror_view@6.43.4/node_modules/@codemirror/view/dist/index.js +11 -5
- package/dist/node_modules/.bun/@codemirror_view@6.43.4/node_modules/@codemirror/view/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js +3 -2
- package/dist/node_modules/.bun/@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@lezer_css@1.3.4/node_modules/@lezer/css/dist/index.js +20 -2
- package/dist/node_modules/.bun/@lezer_css@1.3.4/node_modules/@lezer/css/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@lezer_highlight@1.2.3/node_modules/@lezer/highlight/dist/index.js +15 -2
- package/dist/node_modules/.bun/@lezer_highlight@1.2.3/node_modules/@lezer/highlight/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@lezer_html@1.3.13/node_modules/@lezer/html/dist/index.js +42 -3
- package/dist/node_modules/.bun/@lezer_html@1.3.13/node_modules/@lezer/html/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@lezer_javascript@1.5.4/node_modules/@lezer/javascript/dist/index.js +23 -2
- package/dist/node_modules/.bun/@lezer_javascript@1.5.4/node_modules/@lezer/javascript/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@lezer_lr@1.4.10/node_modules/@lezer/lr/dist/index.js +1 -1
- package/dist/node_modules/.bun/@lezer_markdown@1.7.2/node_modules/@lezer/markdown/dist/index.js +39 -29
- package/dist/node_modules/.bun/@lezer_markdown@1.7.2/node_modules/@lezer/markdown/dist/index.js.map +1 -1
- package/dist/node_modules/.bun/@marijn_find-cluster-break@1.0.2/node_modules/@marijn/find-cluster-break/src/index.js +3 -2
- package/dist/node_modules/.bun/@marijn_find-cluster-break@1.0.2/node_modules/@marijn/find-cluster-break/src/index.js.map +1 -1
- package/dist/style.d.ts +39 -1
- package/dist/types/action.d.ts +0 -1
- package/dist/types/animation.d.ts +0 -1
- package/dist/types/auto-complete.d.ts +0 -1
- package/dist/types/badge.d.ts +0 -1
- package/dist/types/batch-edit.d.ts +18 -13
- package/dist/types/breadcrumb.d.ts +0 -1
- package/dist/types/button.d.ts +0 -1
- package/dist/types/calendar.d.ts +0 -1
- package/dist/types/card.d.ts +0 -1
- package/dist/types/cascade.d.ts +0 -1
- package/dist/types/check-tag.d.ts +0 -1
- package/dist/types/checkbox-group.d.ts +0 -1
- package/dist/types/checkbox.d.ts +0 -1
- package/dist/types/code-editor.d.ts +0 -1
- package/dist/types/collapse.d.ts +0 -1
- package/dist/types/condition-editor.d.ts +0 -1
- package/dist/types/contextmenu.d.ts +0 -1
- package/dist/types/css-transition.d.ts +0 -1
- package/dist/types/date-panel.d.ts +0 -1
- package/dist/types/date-picker.d.ts +0 -1
- package/dist/types/date-range-picker.d.ts +0 -1
- package/dist/types/dialog.d.ts +0 -1
- package/dist/types/drawer.d.ts +0 -1
- package/dist/types/dropdown.d.ts +2 -2
- package/dist/types/dual-nav.d.ts +0 -1
- package/dist/types/empty.d.ts +0 -1
- package/dist/types/expression-editor.d.ts +0 -1
- package/dist/types/file-picker.d.ts +0 -1
- package/dist/types/file-viewer.d.ts +0 -1
- package/dist/types/float-button.d.ts +0 -1
- package/dist/types/form-item.d.ts +0 -1
- package/dist/types/form.d.ts +0 -1
- package/dist/types/grid-input.d.ts +0 -1
- package/dist/types/grid.d.ts +1 -2
- package/dist/types/group-input.d.ts +0 -1
- package/dist/types/group-nav.d.ts +0 -1
- package/dist/types/index.d.ts +4 -6
- package/dist/types/input.d.ts +0 -1
- package/dist/types/layout.d.ts +0 -1
- package/dist/types/list.d.ts +0 -1
- package/dist/types/loading.d.ts +0 -1
- package/dist/types/message-confirm.d.ts +48 -5
- package/dist/types/message.d.ts +3 -2
- package/dist/types/multi-auto-complete.d.ts +0 -1
- package/dist/types/multi-select.d.ts +0 -1
- package/dist/types/multi-tree-select.d.ts +0 -1
- package/dist/types/nav.d.ts +0 -1
- package/dist/types/node-render.d.ts +0 -1
- package/dist/types/notification.d.ts +67 -17
- package/dist/types/number-input.d.ts +0 -1
- package/dist/types/number-range-input.d.ts +0 -1
- package/dist/types/paginator.d.ts +0 -1
- package/dist/types/palette.d.ts +0 -1
- package/dist/types/password-input.d.ts +0 -1
- package/dist/types/pop-confirm.d.ts +0 -1
- package/dist/types/pop.d.ts +0 -1
- package/dist/types/progress-nodes.d.ts +0 -1
- package/dist/types/progress.d.ts +0 -1
- package/dist/types/quick-batch-edit.d.ts +0 -1
- package/dist/types/radio-group.d.ts +0 -1
- package/dist/types/radio.d.ts +0 -1
- package/dist/types/rich-text-editor.d.ts +0 -1
- package/dist/types/scroll.d.ts +11 -6
- package/dist/types/select.d.ts +0 -1
- package/dist/types/slider.d.ts +0 -1
- package/dist/types/steps.d.ts +0 -1
- package/dist/types/switch.d.ts +0 -1
- package/dist/types/table-editor.d.ts +0 -1
- package/dist/types/table.d.ts +0 -1
- package/dist/types/tabs.d.ts +2 -2
- package/dist/types/tag.d.ts +0 -1
- package/dist/types/text-editor.d.ts +0 -1
- package/dist/types/textarea.d.ts +0 -1
- package/dist/types/theme.d.ts +0 -1
- package/dist/types/tip.d.ts +5 -1
- package/dist/types/tree-select.d.ts +0 -1
- package/dist/types/tree.d.ts +0 -1
- package/dist/types/watermark.d.ts +0 -1
- package/package.json +19 -19
- package/src/components/form-item/form-item.vue +1 -1
- package/src/components/message-confirm/index.ts +1 -1
- package/src/components/message-confirm/message-confirm-box.vue +36 -0
- package/src/components/message-confirm/message-confirm.ts +113 -21
- package/src/components/message-confirm/message-confirm.vue +30 -37
- package/src/components/message-confirm/style.scss +10 -12
- package/src/components/notification/index.ts +1 -143
- package/src/components/notification/notification-box.vue +150 -0
- package/src/components/notification/notification.ts +142 -0
- package/src/components/notification/notification.vue +40 -66
- package/src/components/notification/style.scss +65 -38
- package/src/components/tip/tip.vue +36 -5
- package/src/types/message-confirm.ts +52 -3
- package/src/types/notification.ts +71 -15
- package/src/types/tip.ts +6 -0
- package/dist/components/notification/index.js +0 -140
- package/dist/components/notification/index.js.map +0 -1
|
@@ -1,31 +1,123 @@
|
|
|
1
|
-
import { zIndex } from '@veltra/utils'
|
|
2
|
-
import {
|
|
1
|
+
import { bem, zIndex } from '@veltra/utils'
|
|
2
|
+
import { h, render, shallowReactive } from 'vue'
|
|
3
3
|
|
|
4
|
-
import type {
|
|
5
|
-
|
|
4
|
+
import type {
|
|
5
|
+
MessageConfirm,
|
|
6
|
+
MessageConfirmAction,
|
|
7
|
+
MessageConfirmInstance,
|
|
8
|
+
MessageConfirmOptions
|
|
9
|
+
} from '../../types'
|
|
10
|
+
import UMessageConfirmBox from './message-confirm-box.vue'
|
|
6
11
|
|
|
7
|
-
const
|
|
12
|
+
const cls = bem('message-confirm')
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
/** 确认框项数据结构 */
|
|
15
|
+
type ConfirmItem = MessageConfirmOptions & { key: string }
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
/** --- 状态管理 --- */
|
|
18
|
+
let container: HTMLElement | null = null
|
|
19
|
+
const confirms = shallowReactive<ConfirmItem[]>([])
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/** 关闭动画结束后的回调 */
|
|
22
|
+
const closedCallbacks = new Map<string, (action: MessageConfirmAction) => void>()
|
|
23
|
+
|
|
24
|
+
/** 记录每项关闭时的用户操作,动画结束后随回调抛出 */
|
|
25
|
+
const pendingActions = new Map<string, MessageConfirmAction>()
|
|
26
|
+
|
|
27
|
+
/** 用于计数正在显示的 DOM 节点 (包含动画执行中) */
|
|
28
|
+
let activeCount = 0
|
|
29
|
+
let uid = 0
|
|
30
|
+
|
|
31
|
+
/** --- 内部辅助函数 --- */
|
|
32
|
+
|
|
33
|
+
/** 彻底销毁容器 */
|
|
34
|
+
const destroy = () => {
|
|
35
|
+
if (container) {
|
|
36
|
+
render(null, container)
|
|
37
|
+
document.body.removeChild(container)
|
|
38
|
+
container = null
|
|
39
|
+
}
|
|
23
40
|
}
|
|
24
41
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
42
|
+
/** 离开动画结束后的清理 */
|
|
43
|
+
const handleClosed = (key: string) => {
|
|
44
|
+
activeCount--
|
|
45
|
+
|
|
46
|
+
const cb = closedCallbacks.get(key)
|
|
47
|
+
if (cb) {
|
|
48
|
+
cb(pendingActions.get(key) ?? 'cancel')
|
|
49
|
+
closedCallbacks.delete(key)
|
|
28
50
|
}
|
|
51
|
+
pendingActions.delete(key)
|
|
52
|
+
|
|
53
|
+
// 没有活跃确认框时销毁容器,保持页面干净
|
|
54
|
+
if (activeCount === 0) destroy()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** 触发关闭 (仅从数组移除,触发 Transition 离开动画) */
|
|
58
|
+
const handleClose = (key: string, action: MessageConfirmAction) => {
|
|
59
|
+
pendingActions.set(key, action)
|
|
60
|
+
const index = confirms.findIndex((c) => c.key === key)
|
|
61
|
+
if (index !== -1) confirms.splice(index, 1)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** 挂载并渲染容器 */
|
|
65
|
+
const ensureContainer = () => {
|
|
66
|
+
if (container) return container
|
|
67
|
+
|
|
68
|
+
container = document.createElement('div')
|
|
69
|
+
container.className = cls.e('container')
|
|
70
|
+
document.body.appendChild(container)
|
|
71
|
+
return container
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** 执行 Vue 渲染逻辑 */
|
|
75
|
+
const updateView = () => {
|
|
76
|
+
const el = ensureContainer()
|
|
77
|
+
|
|
78
|
+
const vnode = h(UMessageConfirmBox, { confirms, onClosed: handleClosed, onClose: handleClose })
|
|
79
|
+
|
|
80
|
+
vnode.appContext = messageConfirm._context
|
|
81
|
+
render(vnode, el)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** 创建确认框实例 */
|
|
85
|
+
const createConfirm = (options: MessageConfirmOptions): MessageConfirmInstance => {
|
|
86
|
+
const { onClosed: userOnClosed, ...confirmOptions } = options
|
|
87
|
+
const id = `confirm_${uid++}`
|
|
88
|
+
activeCount++
|
|
89
|
+
|
|
90
|
+
// 生命周期 Promise
|
|
91
|
+
let resolveClosed: (action: MessageConfirmAction) => void
|
|
92
|
+
const onClosed = new Promise<MessageConfirmAction>((r) => (resolveClosed = r))
|
|
93
|
+
|
|
94
|
+
closedCallbacks.set(id, (action) => {
|
|
95
|
+
userOnClosed?.(action)
|
|
96
|
+
resolveClosed(action)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
confirms.push({ zIndex: zIndex(), ...confirmOptions, key: id })
|
|
100
|
+
updateView()
|
|
101
|
+
|
|
102
|
+
return { id, close: (action = 'cancel') => handleClose(id, action), onClosed }
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** --- 导出 API --- */
|
|
106
|
+
|
|
107
|
+
export const messageConfirm = ((options) => {
|
|
108
|
+
return createConfirm(typeof options === 'string' ? { message: options } : options)
|
|
109
|
+
}) as MessageConfirm
|
|
110
|
+
|
|
111
|
+
messageConfirm._context = null
|
|
112
|
+
|
|
113
|
+
// 挂载快捷方法: messageConfirm.danger(...)
|
|
114
|
+
const confirmTypes = ['primary', 'success', 'info', 'warning', 'danger'] as const
|
|
115
|
+
confirmTypes.forEach((type) => {
|
|
116
|
+
messageConfirm[type] = (msg, config) =>
|
|
117
|
+
messageConfirm({ ...config, message: msg, confirmButtonType: type })
|
|
29
118
|
})
|
|
30
119
|
|
|
31
|
-
|
|
120
|
+
/** 关闭所有当前显示的确认框 */
|
|
121
|
+
messageConfirm.closeAll = () => {
|
|
122
|
+
confirms.splice(0)
|
|
123
|
+
}
|
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<div :class="
|
|
4
|
-
<div :class="cls.e('
|
|
5
|
-
<div :class="cls.e('
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
>
|
|
22
|
-
</div>
|
|
2
|
+
<div :class="[cls.b, cls.m(size)]">
|
|
3
|
+
<div :class="cls.e('mask')" :style="{ zIndex }">
|
|
4
|
+
<div :class="cls.e('box')">
|
|
5
|
+
<div :class="cls.e('header')" v-if="title">{{ title }}</div>
|
|
6
|
+
<div :class="cls.e('content')">{{ message }}</div>
|
|
7
|
+
<div :class="cls.e('footer')">
|
|
8
|
+
<UButton
|
|
9
|
+
plain
|
|
10
|
+
@click="emit('close', 'cancel')"
|
|
11
|
+
:class="cls.em('footer', 'btn')"
|
|
12
|
+
v-if="cancelButtonText"
|
|
13
|
+
>{{ cancelButtonText }}</UButton
|
|
14
|
+
>
|
|
15
|
+
<UButton
|
|
16
|
+
:type="confirmButtonType"
|
|
17
|
+
@click="emit('close', 'confirm')"
|
|
18
|
+
:class="cls.em('footer', 'btn')"
|
|
19
|
+
>{{ confirmButtonText }}</UButton
|
|
20
|
+
>
|
|
23
21
|
</div>
|
|
24
22
|
</div>
|
|
25
23
|
</div>
|
|
26
|
-
</
|
|
24
|
+
</div>
|
|
27
25
|
</template>
|
|
28
26
|
|
|
29
27
|
<script lang="ts" setup>
|
|
30
28
|
import { useFallbackProps } from '@veltra/compositions'
|
|
31
|
-
import { bem
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
import { bem } from '@veltra/utils'
|
|
30
|
+
|
|
31
|
+
import type {
|
|
32
|
+
MessageConfirmProps,
|
|
33
|
+
MessageConfirmEmits,
|
|
34
|
+
ColorType,
|
|
35
|
+
ComponentSize
|
|
36
|
+
} from '../../types'
|
|
35
37
|
import { UButton } from '../button'
|
|
36
38
|
|
|
37
39
|
defineOptions({ name: 'UMessageConfirm' })
|
|
@@ -44,18 +46,9 @@ const props = withDefaults(defineProps<MessageConfirmProps>(), {
|
|
|
44
46
|
cancelButtonText: ''
|
|
45
47
|
})
|
|
46
48
|
|
|
49
|
+
const emit = defineEmits<MessageConfirmEmits>()
|
|
50
|
+
|
|
47
51
|
const { size } = useFallbackProps([props], { size: 'default' as ComponentSize })
|
|
48
52
|
|
|
49
53
|
const cls = bem('message-confirm')
|
|
50
|
-
|
|
51
|
-
const visible = ref<boolean>(false)
|
|
52
|
-
|
|
53
|
-
onMounted(() => {
|
|
54
|
-
visible.value = true
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
const close = (action: 'cancel' | 'confirm') => {
|
|
58
|
-
visible.value = false
|
|
59
|
-
if (props.onClose) props.onClose(action)
|
|
60
|
-
}
|
|
61
54
|
</script>
|
|
@@ -15,6 +15,7 @@ $root-name: message-confirm;
|
|
|
15
15
|
bottom: 0;
|
|
16
16
|
left: 0;
|
|
17
17
|
@include m.flex($justify: center);
|
|
18
|
+
transition: opacity fn.use-var(transition, normal) fn.use-var(transition, ease);
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
@include m.e(box) {
|
|
@@ -23,9 +24,8 @@ $root-name: message-confirm;
|
|
|
23
24
|
border: fn.use-var(border);
|
|
24
25
|
box-shadow: fn.use-var(shadow, lg);
|
|
25
26
|
transition:
|
|
26
|
-
opacity
|
|
27
|
-
transform
|
|
28
|
-
transform: translateY(-50%);
|
|
27
|
+
opacity fn.use-var(transition, normal) fn.use-var(transition, ease),
|
|
28
|
+
transform fn.use-var(transition, normal) fn.use-var(transition, ease-out);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
@include m.e(header) {
|
|
@@ -57,16 +57,14 @@ $root-name: message-confirm;
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
.#{$root-name}-
|
|
61
|
-
.#{$root-name}-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
.#{$root-name}-fade-enter-from,
|
|
66
|
-
.#{$root-name}-fade-leave-to {
|
|
67
|
-
// opacity: 0;
|
|
60
|
+
.#{$root-name}-enter-from,
|
|
61
|
+
.#{$root-name}-leave-to {
|
|
62
|
+
@include m.bem($root-name, mask) {
|
|
63
|
+
opacity: 0;
|
|
64
|
+
}
|
|
68
65
|
|
|
69
66
|
@include m.bem($root-name, box) {
|
|
70
|
-
|
|
67
|
+
opacity: 0;
|
|
68
|
+
transform: translateY(-40px);
|
|
71
69
|
}
|
|
72
70
|
}
|
|
@@ -1,145 +1,3 @@
|
|
|
1
1
|
export { default as UNotification } from './notification.vue'
|
|
2
|
-
import { zIndex } from '@veltra/utils'
|
|
3
|
-
import { createVNode, render, type VNode, reactive } from 'vue'
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
import UNotification from './notification.vue'
|
|
7
|
-
|
|
8
|
-
type NotificationItem = { vm: VNode }
|
|
9
|
-
|
|
10
|
-
const notificationQueue = reactive({
|
|
11
|
-
'bottom-right': [] as NotificationItem[],
|
|
12
|
-
'bottom-left': [] as NotificationItem[],
|
|
13
|
-
'top-right': [] as NotificationItem[],
|
|
14
|
-
'top-left': [] as NotificationItem[]
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
const length = (key: string) => {
|
|
18
|
-
return notificationQueue[key].length
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let count = 1
|
|
22
|
-
|
|
23
|
-
const close = (id: string, position: string, userClose?: (vm: VNode) => void) => {
|
|
24
|
-
const index = notificationQueue[position].findIndex(({ vm }) => {
|
|
25
|
-
return id === vm.component!.props.id
|
|
26
|
-
})
|
|
27
|
-
if (index > -1) {
|
|
28
|
-
const { vm } = notificationQueue[position][index]!
|
|
29
|
-
userClose?.(vm)
|
|
30
|
-
let offset = Number(notificationQueue[position][index]!.vm.component!.props.offset)
|
|
31
|
-
notificationQueue[position].splice(index, 1)
|
|
32
|
-
let temp = 0
|
|
33
|
-
for (let i = length(position); i > 0; i--) {
|
|
34
|
-
if (i < index + 1) {
|
|
35
|
-
temp = Number(notificationQueue[position][i - 1]!.vm.component!.props.offset)
|
|
36
|
-
notificationQueue[position][i - 1]!.vm.component!.props.offset = offset
|
|
37
|
-
offset = temp
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (!notificationQueue[position].length) {
|
|
42
|
-
const wrapper = document.getElementById(`notification-${position}-id`)!
|
|
43
|
-
wrapper.style.removeProperty('height')
|
|
44
|
-
wrapper.style.removeProperty('overflow')
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const createWrapper = (options: NotificationProps) => {
|
|
49
|
-
const position = options.position || 'bottom-right'
|
|
50
|
-
if (document.getElementById(`notification-${position}-id`)) {
|
|
51
|
-
return document.getElementById(`notification-${position}-id`)
|
|
52
|
-
} else {
|
|
53
|
-
const offset = options.offset || 20
|
|
54
|
-
const wrapper = document.createElement('div')
|
|
55
|
-
wrapper.id = `notification-${position}-id`
|
|
56
|
-
Object.assign(
|
|
57
|
-
wrapper.style,
|
|
58
|
-
{ position: 'fixed', textAlign: 'center' },
|
|
59
|
-
{
|
|
60
|
-
'top-right': { top: `${offset}px`, right: `${offset}px` },
|
|
61
|
-
'top-left': { top: `${offset}px`, left: `${offset}px` },
|
|
62
|
-
'bottom-left': { bottom: `${offset}px`, left: `${offset}px` },
|
|
63
|
-
'bottom-right': { bottom: `${offset}px`, right: `${offset}px` }
|
|
64
|
-
}[position]
|
|
65
|
-
)
|
|
66
|
-
wrapper.addEventListener('mouseenter', (e: MouseEvent) => {
|
|
67
|
-
if (length(position)) {
|
|
68
|
-
let innerCount = 0
|
|
69
|
-
let innerOffset = 0
|
|
70
|
-
let width = 0
|
|
71
|
-
let height = 0
|
|
72
|
-
for (let i = length(position); i > 0; i--) {
|
|
73
|
-
notificationQueue[position][i - 1]!.vm.component!.exposed!.clearTimer()
|
|
74
|
-
if (i === length(position)) {
|
|
75
|
-
width = notificationQueue[position][i - 1]!.vm.el?.offsetWidth + 8
|
|
76
|
-
}
|
|
77
|
-
notificationQueue[position][i - 1]!.vm.component!.props.offset = innerOffset
|
|
78
|
-
innerOffset += notificationQueue[position][i - 1]!.vm.el?.offsetHeight / 2 + 5
|
|
79
|
-
if (innerCount < 3) height += notificationQueue[position][i - 1]!.vm.el?.offsetHeight + 10
|
|
80
|
-
innerCount++
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
Object.assign((e.target as HTMLElement).style, {
|
|
84
|
-
width: `${width}px`,
|
|
85
|
-
height: `${height}px`,
|
|
86
|
-
overflow: 'hidden',
|
|
87
|
-
transition: 'height 0.4s'
|
|
88
|
-
})
|
|
89
|
-
}
|
|
90
|
-
})
|
|
91
|
-
wrapper.addEventListener('mouseleave', (e: MouseEvent) => {
|
|
92
|
-
if (length(position)) {
|
|
93
|
-
let innerOffset = 0
|
|
94
|
-
let innerCount = 0
|
|
95
|
-
let height = 0
|
|
96
|
-
for (let i = length(position); i > 0; i--) {
|
|
97
|
-
notificationQueue[position][i - 1]!.vm.component!.exposed!.startTimer()
|
|
98
|
-
if (i === length(position))
|
|
99
|
-
height = notificationQueue[position][i - 1]!.vm.el?.offsetHeight + 80
|
|
100
|
-
notificationQueue[position][i - 1]!.vm.component!.props.offset = innerOffset
|
|
101
|
-
if (innerCount < 2) innerOffset += 10
|
|
102
|
-
innerCount++
|
|
103
|
-
}
|
|
104
|
-
;(e.target as HTMLElement).style.transition = 'height 0.45s'
|
|
105
|
-
;(e.target as HTMLElement).style.height = `${height}px`
|
|
106
|
-
} else {
|
|
107
|
-
;(e.target as HTMLElement).style.removeProperty('height')
|
|
108
|
-
;(e.target as HTMLElement).style.removeProperty('overflow')
|
|
109
|
-
}
|
|
110
|
-
})
|
|
111
|
-
document.body.appendChild(wrapper)
|
|
112
|
-
return wrapper
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export const Notification = (options: NotificationProps): void => {
|
|
117
|
-
const position = options.position || 'bottom-right'
|
|
118
|
-
const container = document.createElement('div')
|
|
119
|
-
const id = `notification_${count++}`
|
|
120
|
-
|
|
121
|
-
if (length(position)) {
|
|
122
|
-
let innerOffset = 0
|
|
123
|
-
let innerCount = 0
|
|
124
|
-
for (let i = length(position); i > 0; i--) {
|
|
125
|
-
if (innerCount < 2) innerOffset += 10
|
|
126
|
-
notificationQueue[position][i - 1]!.vm.component!.props.offset = innerOffset
|
|
127
|
-
innerCount++
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const vm = createVNode(UNotification, {
|
|
132
|
-
...options,
|
|
133
|
-
offset: 0,
|
|
134
|
-
id,
|
|
135
|
-
zIndex: zIndex(),
|
|
136
|
-
onClose: () => {
|
|
137
|
-
close(id, position, options.onClose)
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
vm.props!.onDestroy = () => render(null, container)
|
|
141
|
-
render(vm, container)
|
|
142
|
-
notificationQueue[position].push({ vm })
|
|
143
|
-
const wrapper = createWrapper(options)
|
|
144
|
-
wrapper?.appendChild(container.firstElementChild!)
|
|
145
|
-
}
|
|
3
|
+
export { notification } from './notification'
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="[cls.e('stack'), cls.em('stack', position)]"
|
|
4
|
+
:style="stackStyle"
|
|
5
|
+
@mouseenter="hovering = true"
|
|
6
|
+
@mouseleave="hovering = false"
|
|
7
|
+
>
|
|
8
|
+
<transition-group :name="`notification-${vertical}`" appear @after-leave="handleAfterLeave">
|
|
9
|
+
<div
|
|
10
|
+
v-for="(item, index) of notifications"
|
|
11
|
+
:key="item.key"
|
|
12
|
+
:ref="(el) => observeItem(el, item.key)"
|
|
13
|
+
:data-key="item.key"
|
|
14
|
+
:class="cls.e('item')"
|
|
15
|
+
>
|
|
16
|
+
<UNotification
|
|
17
|
+
v-bind="toCardProps(item)"
|
|
18
|
+
:style="cardStyle(index)"
|
|
19
|
+
@close="handleClose(item.key, item.onClose)"
|
|
20
|
+
@action="handleAction(item.key, item.onClick, item.onClose, $event)"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
</transition-group>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script lang="ts" setup>
|
|
28
|
+
import { bem } from '@veltra/utils'
|
|
29
|
+
import { computed, onBeforeUnmount, reactive, ref, type CSSProperties } from 'vue'
|
|
30
|
+
|
|
31
|
+
import type { NotificationOptions, NotificationPosition, NotificationProps } from '../../types'
|
|
32
|
+
import UNotification from './notification.vue'
|
|
33
|
+
|
|
34
|
+
defineOptions({ name: 'UNotificationBox' })
|
|
35
|
+
|
|
36
|
+
/** 通知项数据结构 */
|
|
37
|
+
type NotificationItem = NotificationOptions & { key: string }
|
|
38
|
+
|
|
39
|
+
const props = defineProps<{ notifications: NotificationItem[]; position: NotificationPosition }>()
|
|
40
|
+
|
|
41
|
+
const emit = defineEmits<{ (e: 'closed', key: string): void; (e: 'close', key: string): void }>()
|
|
42
|
+
|
|
43
|
+
const cls = bem('notification')
|
|
44
|
+
|
|
45
|
+
/** 展开态卡片间距 */
|
|
46
|
+
const GAP = 10
|
|
47
|
+
/** 折叠态每层露出的高度 */
|
|
48
|
+
const PEEK = 14
|
|
49
|
+
/** 折叠态最多露出的卡片数 */
|
|
50
|
+
const MAX_VISIBLE = 3
|
|
51
|
+
|
|
52
|
+
const hovering = ref(false)
|
|
53
|
+
|
|
54
|
+
/** 各卡片实测高度, 驱动展开态位移与容器高度 */
|
|
55
|
+
const heights = reactive<Record<string, number>>({})
|
|
56
|
+
|
|
57
|
+
const vertical = computed(() => (props.position.startsWith('top') ? 'top' : 'bottom'))
|
|
58
|
+
|
|
59
|
+
/** 底部锚定向上堆叠(负向偏移), 顶部锚定向下堆叠 */
|
|
60
|
+
const direction = computed(() => (vertical.value === 'bottom' ? -1 : 1))
|
|
61
|
+
|
|
62
|
+
const observer = new ResizeObserver((entries) => {
|
|
63
|
+
for (const entry of entries) {
|
|
64
|
+
const el = entry.target as HTMLElement
|
|
65
|
+
const key = el.dataset.key
|
|
66
|
+
if (key) heights[key] = el.offsetHeight
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
function observeItem(el: Element | null, key: string) {
|
|
71
|
+
if (el) observer.observe(el)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
onBeforeUnmount(() => observer.disconnect())
|
|
75
|
+
|
|
76
|
+
/** 数组末尾为最新通知, 位于堆叠最前 */
|
|
77
|
+
function cardStyle(index: number): CSSProperties {
|
|
78
|
+
const items = props.notifications
|
|
79
|
+
const stackIndex = items.length - 1 - index
|
|
80
|
+
|
|
81
|
+
if (hovering.value) {
|
|
82
|
+
// 展开态: 按前方卡片累计高度偏移
|
|
83
|
+
let offset = 0
|
|
84
|
+
for (let i = index + 1; i < items.length; i++) {
|
|
85
|
+
offset += (heights[items[i]!.key] ?? 0) + GAP
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
transform: `translateY(${direction.value * offset}px) scale(1)`,
|
|
89
|
+
opacity: 1,
|
|
90
|
+
pointerEvents: 'auto'
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const clamped = Math.min(stackIndex, MAX_VISIBLE - 1)
|
|
95
|
+
return {
|
|
96
|
+
transform: `translateY(${direction.value * clamped * PEEK}px) scale(${1 - clamped * 0.05})`,
|
|
97
|
+
opacity: stackIndex >= MAX_VISIBLE ? 0 : 1,
|
|
98
|
+
pointerEvents: stackIndex === 0 ? 'auto' : 'none'
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const stackStyle = computed<CSSProperties>(() => {
|
|
103
|
+
const items = props.notifications
|
|
104
|
+
if (!items.length) return { height: '0px' }
|
|
105
|
+
|
|
106
|
+
if (hovering.value) {
|
|
107
|
+
const total = items.reduce((sum, item) => sum + (heights[item.key] ?? 0), 0)
|
|
108
|
+
return { height: `${total + (items.length - 1) * GAP}px` }
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const frontHeight = heights[items[items.length - 1]!.key] ?? 0
|
|
112
|
+
const behind = Math.min(items.length - 1, MAX_VISIBLE - 1)
|
|
113
|
+
return { height: `${frontHeight + behind * PEEK}px` }
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
function toCardProps(item: NotificationItem): NotificationProps {
|
|
117
|
+
return {
|
|
118
|
+
title: item.title,
|
|
119
|
+
message: item.message,
|
|
120
|
+
type: item.type,
|
|
121
|
+
closable: item.closable,
|
|
122
|
+
duration: item.duration,
|
|
123
|
+
icon: item.icon,
|
|
124
|
+
buttonText: item.buttonText,
|
|
125
|
+
size: item.size
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function handleAfterLeave(el: Element) {
|
|
130
|
+
const key = (el as HTMLElement).dataset.key as string
|
|
131
|
+
observer.unobserve(el as HTMLElement)
|
|
132
|
+
delete heights[key]
|
|
133
|
+
emit('closed', key)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function handleClose(key: string, onClose?: () => void) {
|
|
137
|
+
emit('close', key)
|
|
138
|
+
onClose?.()
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function handleAction(
|
|
142
|
+
key: string,
|
|
143
|
+
onClick: NotificationItem['onClick'],
|
|
144
|
+
onClose: NotificationItem['onClose'],
|
|
145
|
+
e: MouseEvent
|
|
146
|
+
) {
|
|
147
|
+
onClick?.(e)
|
|
148
|
+
handleClose(key, onClose)
|
|
149
|
+
}
|
|
150
|
+
</script>
|