element-ps 2.0.36 → 2.0.37
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/index.full.js +3 -1
- package/dist/index.full.min.js +1 -1
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +1 -1
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +3 -1
- package/es/components/alert/index.mjs +2 -2
- package/es/components/alert/src/alert.mjs +83 -33
- package/es/components/alert/src/alert.mjs.map +1 -1
- package/es/components/alert/src/alert2.mjs +33 -83
- package/es/components/alert/src/alert2.mjs.map +1 -1
- package/es/components/autocomplete/index.mjs +2 -2
- package/es/components/autocomplete/src/autocomplete.mjs +58 -94
- package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
- package/es/components/autocomplete/src/autocomplete2.mjs +94 -58
- package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
- package/es/components/avatar/index.mjs +2 -2
- package/es/components/avatar/src/avatar.mjs +29 -61
- package/es/components/avatar/src/avatar.mjs.map +1 -1
- package/es/components/avatar/src/avatar2.mjs +61 -29
- package/es/components/avatar/src/avatar2.mjs.map +1 -1
- package/es/components/badge/index.mjs +2 -2
- package/es/components/badge/src/badge.mjs +17 -54
- package/es/components/badge/src/badge.mjs.map +1 -1
- package/es/components/badge/src/badge2.mjs +54 -17
- package/es/components/badge/src/badge2.mjs.map +1 -1
- package/es/components/button/index.mjs +2 -2
- package/es/components/button/src/button-group.mjs +1 -1
- package/es/components/button/src/button.mjs +96 -48
- package/es/components/button/src/button.mjs.map +1 -1
- package/es/components/button/src/button2.mjs +48 -96
- package/es/components/button/src/button2.mjs.map +1 -1
- package/es/components/calendar/index.mjs +2 -2
- package/es/components/calendar/src/calendar.mjs +188 -9
- package/es/components/calendar/src/calendar.mjs.map +1 -1
- package/es/components/calendar/src/calendar2.mjs +9 -188
- package/es/components/calendar/src/calendar2.mjs.map +1 -1
- package/es/components/card/index.mjs +2 -2
- package/es/components/card/src/card.mjs +35 -15
- package/es/components/card/src/card.mjs.map +1 -1
- package/es/components/card/src/card2.mjs +15 -35
- package/es/components/card/src/card2.mjs.map +1 -1
- package/es/components/carousel/index.mjs +2 -2
- package/es/components/carousel/src/carousel.mjs +43 -201
- package/es/components/carousel/src/carousel.mjs.map +1 -1
- package/es/components/carousel/src/carousel2.mjs +201 -43
- package/es/components/carousel/src/carousel2.mjs.map +1 -1
- package/es/components/collection/index.mjs +1 -1
- package/es/components/collection/src/collection.mjs +30 -10
- package/es/components/collection/src/collection.mjs.map +1 -1
- package/es/components/collection/src/collection2.mjs +10 -30
- package/es/components/collection/src/collection2.mjs.map +1 -1
- package/es/components/dialog/src/dialog-content.mjs +34 -79
- package/es/components/dialog/src/dialog-content.mjs.map +1 -1
- package/es/components/dialog/src/dialog-content2.mjs +79 -34
- package/es/components/dialog/src/dialog-content2.mjs.map +1 -1
- package/es/components/dialog/src/dialog.mjs +1 -1
- package/es/components/dialog/src/dialog2.mjs +1 -1
- package/es/components/divider/index.mjs +2 -2
- package/es/components/divider/src/divider.mjs +34 -17
- package/es/components/divider/src/divider.mjs.map +1 -1
- package/es/components/divider/src/divider2.mjs +17 -34
- package/es/components/divider/src/divider2.mjs.map +1 -1
- package/es/components/drawer/index.mjs +2 -2
- package/es/components/drawer/src/drawer.mjs +117 -23
- package/es/components/drawer/src/drawer.mjs.map +1 -1
- package/es/components/drawer/src/drawer2.mjs +23 -117
- package/es/components/drawer/src/drawer2.mjs.map +1 -1
- package/es/components/dropdown/index.mjs +2 -2
- package/es/components/dropdown/src/dropdown-item-impl.mjs +1 -1
- package/es/components/dropdown/src/dropdown-item.mjs +1 -1
- package/es/components/dropdown/src/dropdown-menu.mjs +1 -1
- package/es/components/dropdown/src/dropdown.mjs +100 -109
- package/es/components/dropdown/src/dropdown.mjs.map +1 -1
- package/es/components/dropdown/src/dropdown2.mjs +109 -100
- package/es/components/dropdown/src/dropdown2.mjs.map +1 -1
- package/es/components/empty/index.mjs +2 -2
- package/es/components/empty/src/empty.mjs +11 -56
- package/es/components/empty/src/empty.mjs.map +1 -1
- package/es/components/empty/src/empty2.mjs +56 -11
- package/es/components/empty/src/empty2.mjs.map +1 -1
- package/es/components/form/index.mjs +4 -4
- package/es/components/form/src/form-item.mjs +171 -46
- package/es/components/form/src/form-item.mjs.map +1 -1
- package/es/components/form/src/form-item2.mjs +46 -171
- package/es/components/form/src/form-item2.mjs.map +1 -1
- package/es/components/form/src/form.mjs +45 -40
- package/es/components/form/src/form.mjs.map +1 -1
- package/es/components/form/src/form2.mjs +40 -45
- package/es/components/form/src/form2.mjs.map +1 -1
- package/es/components/icon/index.mjs +2 -2
- package/es/components/icon/src/icon.mjs +35 -8
- package/es/components/icon/src/icon.mjs.map +1 -1
- package/es/components/icon/src/icon2.mjs +8 -35
- package/es/components/icon/src/icon2.mjs.map +1 -1
- package/es/components/image/index.mjs +2 -2
- package/es/components/image/src/image.mjs +50 -127
- package/es/components/image/src/image.mjs.map +1 -1
- package/es/components/image/src/image2.mjs +127 -50
- package/es/components/image/src/image2.mjs.map +1 -1
- package/es/components/image-viewer/index.mjs +2 -2
- package/es/components/image-viewer/src/image-viewer.mjs +31 -210
- package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
- package/es/components/image-viewer/src/image-viewer2.mjs +210 -31
- package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
- package/es/components/index.mjs +27 -27
- package/es/components/menu/index.mjs +2 -2
- package/es/components/menu/src/menu-item-group.mjs +35 -4
- package/es/components/menu/src/menu-item-group.mjs.map +1 -1
- package/es/components/menu/src/menu-item-group2.mjs +4 -35
- package/es/components/menu/src/menu-item-group2.mjs.map +1 -1
- package/es/components/page-header/index.mjs +2 -2
- package/es/components/page-header/src/page-header.mjs +14 -55
- package/es/components/page-header/src/page-header.mjs.map +1 -1
- package/es/components/page-header/src/page-header2.mjs +55 -14
- package/es/components/page-header/src/page-header2.mjs.map +1 -1
- package/es/components/popconfirm/src/popconfirm.mjs +1 -1
- package/es/components/popconfirm/src/popconfirm2.mjs +4 -2
- package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
- package/es/components/popover/src/popover.mjs +1 -1
- package/es/components/popper/index.mjs +4 -4
- package/es/components/popper/src/arrow.mjs +31 -7
- package/es/components/popper/src/arrow.mjs.map +1 -1
- package/es/components/popper/src/arrow2.mjs +7 -31
- package/es/components/popper/src/arrow2.mjs.map +1 -1
- package/es/components/popper/src/content.mjs +64 -52
- package/es/components/popper/src/content.mjs.map +1 -1
- package/es/components/popper/src/content2.mjs +52 -64
- package/es/components/popper/src/content2.mjs.map +1 -1
- package/es/components/rate/index.mjs +2 -2
- package/es/components/rate/src/rate.mjs +84 -169
- package/es/components/rate/src/rate.mjs.map +1 -1
- package/es/components/rate/src/rate2.mjs +169 -84
- package/es/components/rate/src/rate2.mjs.map +1 -1
- package/es/components/roving-focus-group/src/roving-focus-group.mjs +1 -1
- package/es/components/tabs/index.mjs +1 -1
- package/es/components/tabs/src/tab-bar.mjs +76 -7
- package/es/components/tabs/src/tab-bar.mjs.map +1 -1
- package/es/components/tabs/src/tab-bar2.mjs +7 -76
- package/es/components/tabs/src/tab-bar2.mjs.map +1 -1
- package/es/components/tabs/src/tab-nav.mjs +1 -1
- package/es/components/tooltip/src/tooltip.mjs +1 -1
- package/es/components/tooltip/src/tooltip2.mjs +1 -1
- package/es/components/tooltip-v2/index.mjs +2 -2
- package/es/components/tooltip-v2/src/arrow.mjs +22 -38
- package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
- package/es/components/tooltip-v2/src/arrow2.mjs +38 -22
- package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
- package/es/components/tooltip-v2/src/tooltip.mjs +2 -2
- package/es/components/tooltip-v2/src/tooltip2.mjs +4 -4
- package/es/components/tooltip-v2/src/trigger.mjs +11 -89
- package/es/components/tooltip-v2/src/trigger.mjs.map +1 -1
- package/es/components/tooltip-v2/src/trigger2.mjs +89 -11
- package/es/components/tooltip-v2/src/trigger2.mjs.map +1 -1
- package/es/components/upload/index.mjs +2 -2
- package/es/components/upload/src/upload-content.mjs +46 -15
- package/es/components/upload/src/upload-content.mjs.map +1 -1
- package/es/components/upload/src/upload-content2.mjs +15 -46
- package/es/components/upload/src/upload-content2.mjs.map +1 -1
- package/es/components/upload/src/upload-dragger.mjs +32 -11
- package/es/components/upload/src/upload-dragger.mjs.map +1 -1
- package/es/components/upload/src/upload-dragger2.mjs +11 -32
- package/es/components/upload/src/upload-dragger2.mjs.map +1 -1
- package/es/components/upload/src/upload2.mjs +1 -1
- package/es/index.mjs +27 -27
- package/lib/components/alert/index.js +2 -2
- package/lib/components/alert/src/alert.js +82 -33
- package/lib/components/alert/src/alert.js.map +1 -1
- package/lib/components/alert/src/alert2.js +33 -82
- package/lib/components/alert/src/alert2.js.map +1 -1
- package/lib/components/autocomplete/index.js +2 -2
- package/lib/components/autocomplete/src/autocomplete.js +58 -94
- package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
- package/lib/components/autocomplete/src/autocomplete2.js +94 -58
- package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
- package/lib/components/avatar/index.js +2 -2
- package/lib/components/avatar/src/avatar.js +29 -61
- package/lib/components/avatar/src/avatar.js.map +1 -1
- package/lib/components/avatar/src/avatar2.js +61 -29
- package/lib/components/avatar/src/avatar2.js.map +1 -1
- package/lib/components/badge/index.js +2 -2
- package/lib/components/badge/src/badge.js +17 -54
- package/lib/components/badge/src/badge.js.map +1 -1
- package/lib/components/badge/src/badge2.js +54 -17
- package/lib/components/badge/src/badge2.js.map +1 -1
- package/lib/components/button/index.js +2 -2
- package/lib/components/button/src/button-group.js +1 -1
- package/lib/components/button/src/button.js +96 -50
- package/lib/components/button/src/button.js.map +1 -1
- package/lib/components/button/src/button2.js +50 -96
- package/lib/components/button/src/button2.js.map +1 -1
- package/lib/components/calendar/index.js +2 -2
- package/lib/components/calendar/src/calendar.js +192 -9
- package/lib/components/calendar/src/calendar.js.map +1 -1
- package/lib/components/calendar/src/calendar2.js +9 -192
- package/lib/components/calendar/src/calendar2.js.map +1 -1
- package/lib/components/card/index.js +2 -2
- package/lib/components/card/src/card.js +35 -15
- package/lib/components/card/src/card.js.map +1 -1
- package/lib/components/card/src/card2.js +15 -35
- package/lib/components/card/src/card2.js.map +1 -1
- package/lib/components/carousel/index.js +2 -2
- package/lib/components/carousel/src/carousel.js +43 -201
- package/lib/components/carousel/src/carousel.js.map +1 -1
- package/lib/components/carousel/src/carousel2.js +201 -43
- package/lib/components/carousel/src/carousel2.js.map +1 -1
- package/lib/components/collection/index.js +1 -1
- package/lib/components/collection/src/collection.js +30 -9
- package/lib/components/collection/src/collection.js.map +1 -1
- package/lib/components/collection/src/collection2.js +9 -30
- package/lib/components/collection/src/collection2.js.map +1 -1
- package/lib/components/dialog/src/dialog-content.js +33 -78
- package/lib/components/dialog/src/dialog-content.js.map +1 -1
- package/lib/components/dialog/src/dialog-content2.js +78 -33
- package/lib/components/dialog/src/dialog-content2.js.map +1 -1
- package/lib/components/dialog/src/dialog.js +1 -1
- package/lib/components/dialog/src/dialog2.js +1 -1
- package/lib/components/divider/index.js +2 -2
- package/lib/components/divider/src/divider.js +34 -17
- package/lib/components/divider/src/divider.js.map +1 -1
- package/lib/components/divider/src/divider2.js +17 -34
- package/lib/components/divider/src/divider2.js.map +1 -1
- package/lib/components/drawer/index.js +2 -2
- package/lib/components/drawer/src/drawer.js +117 -23
- package/lib/components/drawer/src/drawer.js.map +1 -1
- package/lib/components/drawer/src/drawer2.js +23 -117
- package/lib/components/drawer/src/drawer2.js.map +1 -1
- package/lib/components/dropdown/index.js +2 -2
- package/lib/components/dropdown/src/dropdown-item-impl.js +1 -1
- package/lib/components/dropdown/src/dropdown-item.js +1 -1
- package/lib/components/dropdown/src/dropdown-menu.js +1 -1
- package/lib/components/dropdown/src/dropdown.js +109 -109
- package/lib/components/dropdown/src/dropdown.js.map +1 -1
- package/lib/components/dropdown/src/dropdown2.js +109 -109
- package/lib/components/dropdown/src/dropdown2.js.map +1 -1
- package/lib/components/empty/index.js +2 -2
- package/lib/components/empty/src/empty.js +11 -56
- package/lib/components/empty/src/empty.js.map +1 -1
- package/lib/components/empty/src/empty2.js +56 -11
- package/lib/components/empty/src/empty2.js.map +1 -1
- package/lib/components/form/index.js +4 -4
- package/lib/components/form/src/form-item.js +171 -47
- package/lib/components/form/src/form-item.js.map +1 -1
- package/lib/components/form/src/form-item2.js +47 -171
- package/lib/components/form/src/form-item2.js.map +1 -1
- package/lib/components/form/src/form.js +45 -40
- package/lib/components/form/src/form.js.map +1 -1
- package/lib/components/form/src/form2.js +40 -45
- package/lib/components/form/src/form2.js.map +1 -1
- package/lib/components/icon/index.js +2 -2
- package/lib/components/icon/src/icon.js +35 -8
- package/lib/components/icon/src/icon.js.map +1 -1
- package/lib/components/icon/src/icon2.js +8 -35
- package/lib/components/icon/src/icon2.js.map +1 -1
- package/lib/components/image/index.js +2 -2
- package/lib/components/image/src/image.js +50 -127
- package/lib/components/image/src/image.js.map +1 -1
- package/lib/components/image/src/image2.js +127 -50
- package/lib/components/image/src/image2.js.map +1 -1
- package/lib/components/image-viewer/index.js +2 -2
- package/lib/components/image-viewer/src/image-viewer.js +31 -210
- package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
- package/lib/components/image-viewer/src/image-viewer2.js +210 -31
- package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
- package/lib/components/index.js +27 -27
- package/lib/components/menu/index.js +2 -2
- package/lib/components/menu/src/menu-item-group.js +35 -4
- package/lib/components/menu/src/menu-item-group.js.map +1 -1
- package/lib/components/menu/src/menu-item-group2.js +4 -35
- package/lib/components/menu/src/menu-item-group2.js.map +1 -1
- package/lib/components/page-header/index.js +2 -2
- package/lib/components/page-header/src/page-header.js +14 -55
- package/lib/components/page-header/src/page-header.js.map +1 -1
- package/lib/components/page-header/src/page-header2.js +55 -14
- package/lib/components/page-header/src/page-header2.js.map +1 -1
- package/lib/components/popconfirm/src/popconfirm.js +1 -1
- package/lib/components/popconfirm/src/popconfirm2.js +3 -1
- package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
- package/lib/components/popover/src/popover.js +1 -1
- package/lib/components/popper/index.js +4 -4
- package/lib/components/popper/src/arrow.js +31 -7
- package/lib/components/popper/src/arrow.js.map +1 -1
- package/lib/components/popper/src/arrow2.js +7 -31
- package/lib/components/popper/src/arrow2.js.map +1 -1
- package/lib/components/popper/src/content.js +65 -52
- package/lib/components/popper/src/content.js.map +1 -1
- package/lib/components/popper/src/content2.js +52 -65
- package/lib/components/popper/src/content2.js.map +1 -1
- package/lib/components/rate/index.js +2 -2
- package/lib/components/rate/src/rate.js +84 -169
- package/lib/components/rate/src/rate.js.map +1 -1
- package/lib/components/rate/src/rate2.js +169 -84
- package/lib/components/rate/src/rate2.js.map +1 -1
- package/lib/components/roving-focus-group/src/roving-focus-group.js +1 -1
- package/lib/components/tabs/index.js +1 -1
- package/lib/components/tabs/src/tab-bar.js +76 -7
- package/lib/components/tabs/src/tab-bar.js.map +1 -1
- package/lib/components/tabs/src/tab-bar2.js +7 -76
- package/lib/components/tabs/src/tab-bar2.js.map +1 -1
- package/lib/components/tabs/src/tab-nav.js +1 -1
- package/lib/components/tooltip/src/tooltip.js +1 -1
- package/lib/components/tooltip/src/tooltip2.js +1 -1
- package/lib/components/tooltip-v2/index.js +2 -2
- package/lib/components/tooltip-v2/src/arrow.js +23 -38
- package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
- package/lib/components/tooltip-v2/src/arrow2.js +38 -23
- package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
- package/lib/components/tooltip-v2/src/tooltip.js +2 -2
- package/lib/components/tooltip-v2/src/tooltip2.js +4 -4
- package/lib/components/tooltip-v2/src/trigger.js +11 -89
- package/lib/components/tooltip-v2/src/trigger.js.map +1 -1
- package/lib/components/tooltip-v2/src/trigger2.js +89 -11
- package/lib/components/tooltip-v2/src/trigger2.js.map +1 -1
- package/lib/components/upload/index.js +2 -2
- package/lib/components/upload/src/upload-content.js +46 -15
- package/lib/components/upload/src/upload-content.js.map +1 -1
- package/lib/components/upload/src/upload-content2.js +15 -46
- package/lib/components/upload/src/upload-content2.js.map +1 -1
- package/lib/components/upload/src/upload-dragger.js +32 -12
- package/lib/components/upload/src/upload-dragger.js.map +1 -1
- package/lib/components/upload/src/upload-dragger2.js +12 -32
- package/lib/components/upload/src/upload-dragger2.js.map +1 -1
- package/lib/components/upload/src/upload2.js +1 -1
- package/lib/index.js +27 -27
- package/package.json +1 -1
- package/web-types.json +1 -1
|
@@ -1,13 +1,82 @@
|
|
|
1
|
+
import { defineComponent, getCurrentInstance, inject, ref, watch, nextTick, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle } from 'vue';
|
|
2
|
+
import { useResizeObserver } from '@vueuse/core';
|
|
1
3
|
import '../../../utils/index.mjs';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
+
import '../../../tokens/index.mjs';
|
|
5
|
+
import '../../../hooks/index.mjs';
|
|
6
|
+
import { tabBarProps } from './tab-bar2.mjs';
|
|
7
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
8
|
+
import { tabsRootContextKey } from '../../../tokens/tabs.mjs';
|
|
9
|
+
import { throwError } from '../../../utils/error.mjs';
|
|
10
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
11
|
+
import { capitalize } from '@vue/shared';
|
|
4
12
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
const __default__ = {
|
|
14
|
+
name: "PsTabBar"
|
|
15
|
+
};
|
|
16
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
17
|
+
...__default__,
|
|
18
|
+
props: tabBarProps,
|
|
19
|
+
setup(__props, { expose }) {
|
|
20
|
+
const props = __props;
|
|
21
|
+
const COMPONENT_NAME = "PsTabBar";
|
|
22
|
+
const instance = getCurrentInstance();
|
|
23
|
+
const rootTabs = inject(tabsRootContextKey);
|
|
24
|
+
if (!rootTabs)
|
|
25
|
+
throwError(COMPONENT_NAME, "<ps-tabs><ps-tab-bar /></ps-tabs>");
|
|
26
|
+
const ns = useNamespace("tabs");
|
|
27
|
+
const barRef = ref();
|
|
28
|
+
const barStyle = ref();
|
|
29
|
+
const getBarStyle = () => {
|
|
30
|
+
let offset = 0;
|
|
31
|
+
let tabSize = 0;
|
|
32
|
+
const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
|
|
33
|
+
const sizeDir = sizeName === "width" ? "x" : "y";
|
|
34
|
+
props.tabs.every((tab) => {
|
|
35
|
+
var _a, _b, _c, _d;
|
|
36
|
+
const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.paneName}`];
|
|
37
|
+
if (!$el)
|
|
38
|
+
return false;
|
|
39
|
+
if (!tab.active) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
tabSize = $el[`client${capitalize(sizeName)}`];
|
|
43
|
+
const position = sizeDir === "x" ? "left" : "top";
|
|
44
|
+
offset = $el.getBoundingClientRect()[position] - ((_d = (_c = $el.parentElement) == null ? void 0 : _c.getBoundingClientRect()[position]) != null ? _d : 0);
|
|
45
|
+
const tabStyles = window.getComputedStyle($el);
|
|
46
|
+
if (sizeName === "width") {
|
|
47
|
+
if (props.tabs.length > 1) {
|
|
48
|
+
tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
|
|
49
|
+
}
|
|
50
|
+
offset += Number.parseFloat(tabStyles.paddingLeft);
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
[sizeName]: `${tabSize}px`,
|
|
56
|
+
transform: `translate${capitalize(sizeDir)}(${offset}px)`
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const update = () => barStyle.value = getBarStyle();
|
|
60
|
+
watch(() => props.tabs, async () => {
|
|
61
|
+
await nextTick();
|
|
62
|
+
update();
|
|
63
|
+
}, { immediate: true });
|
|
64
|
+
useResizeObserver(barRef, () => update());
|
|
65
|
+
expose({
|
|
66
|
+
ref: barRef,
|
|
67
|
+
update
|
|
68
|
+
});
|
|
69
|
+
return (_ctx, _cache) => {
|
|
70
|
+
return openBlock(), createElementBlock("div", {
|
|
71
|
+
ref_key: "barRef",
|
|
72
|
+
ref: barRef,
|
|
73
|
+
class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
|
|
74
|
+
style: normalizeStyle(barStyle.value)
|
|
75
|
+
}, null, 6);
|
|
76
|
+
};
|
|
9
77
|
}
|
|
10
78
|
});
|
|
79
|
+
var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/tabs/src/tab-bar.vue"]]);
|
|
11
80
|
|
|
12
|
-
export {
|
|
81
|
+
export { TabBar as default };
|
|
13
82
|
//# sourceMappingURL=tab-bar.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-bar.mjs","sources":["../../../../../../packages/components/tabs/src/tab-bar.
|
|
1
|
+
{"version":3,"file":"tab-bar.mjs","sources":["../../../../../../packages/components/tabs/src/tab-bar.vue"],"sourcesContent":["<template>\n <div\n ref=\"barRef\"\n :class=\"[ns.e('active-bar'), ns.is(rootTabs.props.tabPosition)]\"\n :style=\"barStyle\"\n />\n</template>\n<script lang=\"ts\" setup>\nimport { getCurrentInstance, inject, nextTick, ref, watch } from 'vue'\nimport { useResizeObserver } from '@vueuse/core'\nimport { capitalize, throwError } from '@element-ps/utils'\nimport { tabsRootContextKey } from '@element-ps/tokens'\nimport { useNamespace } from '@element-ps/hooks'\nimport { tabBarProps } from './tab-bar'\n\nimport type { CSSProperties } from 'vue'\n\nconst COMPONENT_NAME = 'PsTabBar'\ndefineOptions({\n name: 'PsTabBar',\n})\nconst props = defineProps(tabBarProps)\n\nconst instance = getCurrentInstance()!\nconst rootTabs = inject(tabsRootContextKey)\nif (!rootTabs) throwError(COMPONENT_NAME, '<ps-tabs><ps-tab-bar /></ps-tabs>')\n\nconst ns = useNamespace('tabs')\n\nconst barRef = ref<HTMLDivElement>()\nconst barStyle = ref<CSSProperties>()\n\nconst getBarStyle = (): CSSProperties => {\n let offset = 0\n let tabSize = 0\n\n const sizeName = ['top', 'bottom'].includes(rootTabs.props.tabPosition)\n ? 'width'\n : 'height'\n const sizeDir = sizeName === 'width' ? 'x' : 'y'\n\n props.tabs.every((tab) => {\n const $el = instance.parent?.refs?.[`tab-${tab.paneName}`] as HTMLElement\n if (!$el) return false\n\n if (!tab.active) {\n return true\n }\n\n tabSize = $el[`client${capitalize(sizeName)}`]\n const position = sizeDir === 'x' ? 'left' : 'top'\n offset =\n $el.getBoundingClientRect()[position] -\n ($el.parentElement?.getBoundingClientRect()[position] ?? 0)\n const tabStyles = window.getComputedStyle($el)\n\n if (sizeName === 'width') {\n if (props.tabs.length > 1) {\n tabSize -=\n Number.parseFloat(tabStyles.paddingLeft) +\n Number.parseFloat(tabStyles.paddingRight)\n }\n offset += Number.parseFloat(tabStyles.paddingLeft)\n }\n return false\n })\n\n return {\n [sizeName]: `${tabSize}px`,\n transform: `translate${capitalize(sizeDir)}(${offset}px)`,\n }\n}\n\nconst update = () => (barStyle.value = getBarStyle())\n\nwatch(\n () => props.tabs,\n async () => {\n await nextTick()\n update()\n },\n { immediate: true }\n)\nuseResizeObserver(barRef, () => update())\n\ndefineExpose({\n /** @description tab root html element */\n ref: barRef,\n /** @description method to manually update tab bar style */\n update,\n})\n</script>\n"],"names":[],"mappings":"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"}
|
|
@@ -1,82 +1,13 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, inject, ref, watch, nextTick, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle } from 'vue';
|
|
2
|
-
import { useResizeObserver } from '@vueuse/core';
|
|
3
1
|
import '../../../utils/index.mjs';
|
|
4
|
-
import '../../../
|
|
5
|
-
import '../../../
|
|
6
|
-
import { tabBarProps } from './tab-bar.mjs';
|
|
7
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
8
|
-
import { tabsRootContextKey } from '../../../tokens/tabs.mjs';
|
|
9
|
-
import { throwError } from '../../../utils/error.mjs';
|
|
10
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
11
|
-
import { capitalize } from '@vue/shared';
|
|
2
|
+
import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
|
|
3
|
+
import { mutable } from '../../../utils/typescript.mjs';
|
|
12
4
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
...__default__,
|
|
18
|
-
props: tabBarProps,
|
|
19
|
-
setup(__props, { expose }) {
|
|
20
|
-
const props = __props;
|
|
21
|
-
const COMPONENT_NAME = "PsTabBar";
|
|
22
|
-
const instance = getCurrentInstance();
|
|
23
|
-
const rootTabs = inject(tabsRootContextKey);
|
|
24
|
-
if (!rootTabs)
|
|
25
|
-
throwError(COMPONENT_NAME, "<ps-tabs><ps-tab-bar /></ps-tabs>");
|
|
26
|
-
const ns = useNamespace("tabs");
|
|
27
|
-
const barRef = ref();
|
|
28
|
-
const barStyle = ref();
|
|
29
|
-
const getBarStyle = () => {
|
|
30
|
-
let offset = 0;
|
|
31
|
-
let tabSize = 0;
|
|
32
|
-
const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
|
|
33
|
-
const sizeDir = sizeName === "width" ? "x" : "y";
|
|
34
|
-
props.tabs.every((tab) => {
|
|
35
|
-
var _a, _b, _c, _d;
|
|
36
|
-
const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.paneName}`];
|
|
37
|
-
if (!$el)
|
|
38
|
-
return false;
|
|
39
|
-
if (!tab.active) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
tabSize = $el[`client${capitalize(sizeName)}`];
|
|
43
|
-
const position = sizeDir === "x" ? "left" : "top";
|
|
44
|
-
offset = $el.getBoundingClientRect()[position] - ((_d = (_c = $el.parentElement) == null ? void 0 : _c.getBoundingClientRect()[position]) != null ? _d : 0);
|
|
45
|
-
const tabStyles = window.getComputedStyle($el);
|
|
46
|
-
if (sizeName === "width") {
|
|
47
|
-
if (props.tabs.length > 1) {
|
|
48
|
-
tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
|
|
49
|
-
}
|
|
50
|
-
offset += Number.parseFloat(tabStyles.paddingLeft);
|
|
51
|
-
}
|
|
52
|
-
return false;
|
|
53
|
-
});
|
|
54
|
-
return {
|
|
55
|
-
[sizeName]: `${tabSize}px`,
|
|
56
|
-
transform: `translate${capitalize(sizeDir)}(${offset}px)`
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
const update = () => barStyle.value = getBarStyle();
|
|
60
|
-
watch(() => props.tabs, async () => {
|
|
61
|
-
await nextTick();
|
|
62
|
-
update();
|
|
63
|
-
}, { immediate: true });
|
|
64
|
-
useResizeObserver(barRef, () => update());
|
|
65
|
-
expose({
|
|
66
|
-
ref: barRef,
|
|
67
|
-
update
|
|
68
|
-
});
|
|
69
|
-
return (_ctx, _cache) => {
|
|
70
|
-
return openBlock(), createElementBlock("div", {
|
|
71
|
-
ref_key: "barRef",
|
|
72
|
-
ref: barRef,
|
|
73
|
-
class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
|
|
74
|
-
style: normalizeStyle(barStyle.value)
|
|
75
|
-
}, null, 6);
|
|
76
|
-
};
|
|
5
|
+
const tabBarProps = buildProps({
|
|
6
|
+
tabs: {
|
|
7
|
+
type: definePropType(Array),
|
|
8
|
+
default: () => mutable([])
|
|
77
9
|
}
|
|
78
10
|
});
|
|
79
|
-
var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/tabs/src/tab-bar.vue"]]);
|
|
80
11
|
|
|
81
|
-
export {
|
|
12
|
+
export { tabBarProps };
|
|
82
13
|
//# sourceMappingURL=tab-bar2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-bar2.mjs","sources":["../../../../../../packages/components/tabs/src/tab-bar.
|
|
1
|
+
{"version":3,"file":"tab-bar2.mjs","sources":["../../../../../../packages/components/tabs/src/tab-bar.ts"],"sourcesContent":["import { buildProps, definePropType, mutable } from '@element-ps/utils'\nimport type { ExtractPropTypes } from 'vue'\nimport type { TabsPaneContext } from '@element-ps/tokens'\nimport type TabBar from './tab-bar.vue'\n\nexport const tabBarProps = buildProps({\n tabs: {\n type: definePropType<TabsPaneContext[]>(Array),\n default: () => mutable([] as const),\n },\n} as const)\n\nexport type TabBarProps = ExtractPropTypes<typeof tabBarProps>\nexport type TabBarInstance = InstanceType<typeof TabBar>\n"],"names":[],"mappings":";;;;AACY,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC;AAC9B,GAAG;AACH,CAAC;;;;"}
|
|
@@ -7,7 +7,7 @@ import { PsIcon } from '../../icon/index.mjs';
|
|
|
7
7
|
import { ArrowLeft, ArrowRight, Close } from '@element-plus/icons-vue';
|
|
8
8
|
import '../../../tokens/index.mjs';
|
|
9
9
|
import '../../../hooks/index.mjs';
|
|
10
|
-
import TabBar from './tab-
|
|
10
|
+
import TabBar from './tab-bar.mjs';
|
|
11
11
|
import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
|
|
12
12
|
import { mutable } from '../../../utils/typescript.mjs';
|
|
13
13
|
import { tabsRootContextKey } from '../../../tokens/tabs.mjs';
|
|
@@ -3,7 +3,7 @@ import '../../popper/index.mjs';
|
|
|
3
3
|
import '../../../hooks/index.mjs';
|
|
4
4
|
import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
|
|
5
5
|
import { useDelayedToggleProps } from '../../../hooks/use-delayed-toggle/index.mjs';
|
|
6
|
-
import { usePopperContentProps } from '../../popper/src/
|
|
6
|
+
import { usePopperContentProps } from '../../popper/src/content.mjs';
|
|
7
7
|
import { POPPER_CONTAINER_SELECTOR } from '../../../hooks/use-popper-container/index.mjs';
|
|
8
8
|
import { usePopperTriggerProps } from '../../popper/src/trigger.mjs';
|
|
9
9
|
|
|
@@ -7,7 +7,7 @@ import { useTooltipContentProps, useTooltipTriggerProps, useTooltipProps } from
|
|
|
7
7
|
import { TOOLTIP_INJECTION_KEY } from './tokens.mjs';
|
|
8
8
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
9
9
|
import { createModelToggleComposable } from '../../../hooks/use-model-toggle/index.mjs';
|
|
10
|
-
import { usePopperArrowProps } from '../../popper/src/
|
|
10
|
+
import { usePopperArrowProps } from '../../popper/src/arrow2.mjs';
|
|
11
11
|
import { usePopperContainer } from '../../../hooks/use-popper-container/index.mjs';
|
|
12
12
|
import { useId } from '../../../hooks/use-id/index.mjs';
|
|
13
13
|
import { isBoolean } from '@vueuse/core';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
2
|
import TooltipV2 from './src/tooltip2.mjs';
|
|
3
|
-
export { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './src/
|
|
3
|
+
export { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './src/arrow.mjs';
|
|
4
4
|
export { tooltipV2ContentProps } from './src/content.mjs';
|
|
5
5
|
export { tooltipV2RootProps } from './src/root.mjs';
|
|
6
6
|
export { tooltipV2Props } from './src/tooltip.mjs';
|
|
7
|
-
export { tooltipV2TriggerProps } from './src/
|
|
7
|
+
export { tooltipV2TriggerProps } from './src/trigger.mjs';
|
|
8
8
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
9
9
|
|
|
10
10
|
const PsTooltipV2 = withInstall(TooltipV2);
|
|
@@ -1,44 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '
|
|
3
|
-
import {
|
|
4
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
5
|
-
import { tooltipV2RootKey, tooltipV2ContentKey } from '../../../tokens/tooltip-v2.mjs';
|
|
1
|
+
import '../../../utils/index.mjs';
|
|
2
|
+
import { tooltipV2Sides } from './common.mjs';
|
|
3
|
+
import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
|
|
6
4
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
...__default__,
|
|
12
|
-
props: {
|
|
13
|
-
...tooltipV2ArrowProps,
|
|
14
|
-
...tooltipV2ArrowSpecialProps
|
|
5
|
+
const tooltipV2ArrowProps = buildProps({
|
|
6
|
+
width: {
|
|
7
|
+
type: Number,
|
|
8
|
+
default: 10
|
|
15
9
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
return (_ctx, _cache) => {
|
|
32
|
-
return openBlock(), createElementBlock("span", {
|
|
33
|
-
ref_key: "arrowRef",
|
|
34
|
-
ref: arrowRef,
|
|
35
|
-
style: normalizeStyle(unref(arrowStyle)),
|
|
36
|
-
class: normalizeClass(unref(ns).e("arrow"))
|
|
37
|
-
}, null, 6);
|
|
38
|
-
};
|
|
10
|
+
height: {
|
|
11
|
+
type: Number,
|
|
12
|
+
default: 10
|
|
13
|
+
},
|
|
14
|
+
style: {
|
|
15
|
+
type: definePropType(Object),
|
|
16
|
+
default: null
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const tooltipV2ArrowSpecialProps = buildProps({
|
|
20
|
+
side: {
|
|
21
|
+
type: definePropType(String),
|
|
22
|
+
values: tooltipV2Sides,
|
|
23
|
+
required: true
|
|
39
24
|
}
|
|
40
25
|
});
|
|
41
|
-
var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/tooltip-v2/src/arrow.vue"]]);
|
|
42
26
|
|
|
43
|
-
export {
|
|
27
|
+
export { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps };
|
|
44
28
|
//# sourceMappingURL=arrow.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/arrow.
|
|
1
|
+
{"version":3,"file":"arrow.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/arrow.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-ps/utils'\nimport { tooltipV2Sides } from './common'\n\nimport type { CSSProperties, ExtractPropTypes } from 'vue'\nimport type { TooltipV2Sides } from './common'\n\nexport const tooltipV2ArrowProps = buildProps({\n width: {\n type: Number,\n default: 10,\n },\n height: {\n type: Number,\n default: 10,\n },\n style: {\n type: definePropType<CSSProperties | null>(Object),\n default: null,\n },\n} as const)\n\nexport const tooltipV2ArrowSpecialProps = buildProps({\n side: {\n type: definePropType<TooltipV2Sides>(String),\n values: tooltipV2Sides,\n required: true,\n },\n} as const)\n\nexport type TooltipV2ArrowProps = ExtractPropTypes<typeof tooltipV2ArrowProps>\n"],"names":[],"mappings":";;;;AAEY,MAAC,mBAAmB,GAAG,UAAU,CAAC;AAC9C,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,0BAA0B,GAAG,UAAU,CAAC;AACrD,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC;AAChC,IAAI,MAAM,EAAE,cAAc;AAC1B,IAAI,QAAQ,EAAE,IAAI;AAClB,GAAG;AACH,CAAC;;;;"}
|
|
@@ -1,28 +1,44 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { defineComponent, inject, computed, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass } from 'vue';
|
|
2
|
+
import '../../../tokens/index.mjs';
|
|
3
|
+
import { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './arrow.mjs';
|
|
4
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
5
|
+
import { tooltipV2RootKey, tooltipV2ContentKey } from '../../../tokens/tooltip-v2.mjs';
|
|
4
6
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const __default__ = {
|
|
8
|
+
name: "PsTooltipV2Arrow"
|
|
9
|
+
};
|
|
10
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
|
+
...__default__,
|
|
12
|
+
props: {
|
|
13
|
+
...tooltipV2ArrowProps,
|
|
14
|
+
...tooltipV2ArrowSpecialProps
|
|
9
15
|
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
const { ns } = inject(tooltipV2RootKey);
|
|
19
|
+
const { arrowRef } = inject(tooltipV2ContentKey);
|
|
20
|
+
const arrowStyle = computed(() => {
|
|
21
|
+
const { style, width, height } = props;
|
|
22
|
+
const namespace = ns.namespace.value;
|
|
23
|
+
return {
|
|
24
|
+
[`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
|
|
25
|
+
[`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
|
|
26
|
+
[`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
|
|
27
|
+
[`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
|
|
28
|
+
...style || {}
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
return (_ctx, _cache) => {
|
|
32
|
+
return openBlock(), createElementBlock("span", {
|
|
33
|
+
ref_key: "arrowRef",
|
|
34
|
+
ref: arrowRef,
|
|
35
|
+
style: normalizeStyle(unref(arrowStyle)),
|
|
36
|
+
class: normalizeClass(unref(ns).e("arrow"))
|
|
37
|
+
}, null, 6);
|
|
38
|
+
};
|
|
24
39
|
}
|
|
25
40
|
});
|
|
41
|
+
var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/tooltip-v2/src/arrow.vue"]]);
|
|
26
42
|
|
|
27
|
-
export {
|
|
43
|
+
export { TooltipV2Arrow as default };
|
|
28
44
|
//# sourceMappingURL=arrow2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow2.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/arrow.
|
|
1
|
+
{"version":3,"file":"arrow2.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/arrow.vue"],"sourcesContent":["<template>\n <span ref=\"arrowRef\" :style=\"arrowStyle\" :class=\"ns.e('arrow')\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, inject } from 'vue'\nimport { tooltipV2ContentKey, tooltipV2RootKey } from '@element-ps/tokens'\nimport { tooltipV2ArrowProps, tooltipV2ArrowSpecialProps } from './arrow'\n\nimport type { CSSProperties } from 'vue'\n\ndefineOptions({\n name: 'PsTooltipV2Arrow',\n})\n\nconst props = defineProps({\n ...tooltipV2ArrowProps,\n ...tooltipV2ArrowSpecialProps,\n})\n\nconst { ns } = inject(tooltipV2RootKey)!\nconst { arrowRef } = inject(tooltipV2ContentKey)!\n\nconst arrowStyle = computed<CSSProperties>(() => {\n const { style, width, height } = props\n const namespace = ns.namespace.value\n\n return {\n [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,\n [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,\n [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,\n [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,\n ...(style || {}),\n }\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAoBA,IAAA,MAAA,EAAA,EAAA,EAAA,GAAA,MAAA,CAAA,gBAAA,CAAA,CAAA;AACA,IAAA,MAAA,EAAA,QAAA,EAAA,GAAA,MAAA,CAAA,mBAAA,CAAA,CAAA;AAEA,IAAA,MAAA,UAAA,GAAA,SAAA,MAAA;AACA,MAAA,MAAA,EAAA,KAAA,EAAA,KAAA,EAAA,MAAA,EAAA,GAAA,KAAA,CAAA;AACA,MAAA,MAAA,SAAA,GAAA,GAAA,SAAA,CAAA,KAAA,CAAA;AAEA,MAAA,OAAA;AAAA,QACA,CAAA,CAAA,EAAA,EAAA,qCAAA,CAAA,EAAA,KAAA,CAAA,EAAA,CAAA;AAAA,QACA,CAAA,CAAA,EAAA,EAAA,sCAAA,CAAA,EAAA,MAAA,CAAA,EAAA,CAAA;AAAA,QACA,CAAA,CAAA,EAAA,EAAA,SAAA,CAAA,8BAAA,CAAA,GAAA,CAAA,EAAA,KAAA,GAAA,CAAA,CAAA,EAAA,CAAA;AAAA,QACA,CAAA,CAAA,EAAA,EAAA,SAAA,CAAA,6BAAA,CAAA,GAAA,KAAA,GAAA,CAAA,GAAA,CAAA;AAAA,QAAA,GACA,SAAA,EAAA;AAAA,OACA,CAAA;AAAA,KACA,CAAA,CAAA;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../../../utils/index.mjs';
|
|
2
2
|
import { tooltipV2RootProps } from './root.mjs';
|
|
3
|
-
import { tooltipV2TriggerProps } from './
|
|
4
|
-
import { tooltipV2ArrowProps } from './
|
|
3
|
+
import { tooltipV2TriggerProps } from './trigger.mjs';
|
|
4
|
+
import { tooltipV2ArrowProps } from './arrow.mjs';
|
|
5
5
|
import { tooltipV2ContentProps } from './content.mjs';
|
|
6
6
|
import { buildProps, definePropType } from '../../../utils/vue/props.mjs';
|
|
7
7
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { defineComponent, toRefs, reactive, openBlock, createBlock, normalizeProps, guardReactiveProps, unref, withCtx, createVNode, mergeProps, renderSlot, Teleport, Transition, createCommentVNode, createElementBlock, Fragment } from 'vue';
|
|
2
2
|
import { pick } from 'lodash-unified';
|
|
3
|
-
import { tooltipV2ArrowProps } from './
|
|
3
|
+
import { tooltipV2ArrowProps } from './arrow.mjs';
|
|
4
4
|
import { tooltipV2ContentProps } from './content.mjs';
|
|
5
5
|
import { tooltipV2RootProps } from './root.mjs';
|
|
6
6
|
import { tooltipV2Props } from './tooltip.mjs';
|
|
7
|
-
import { tooltipV2TriggerProps } from './
|
|
7
|
+
import { tooltipV2TriggerProps } from './trigger.mjs';
|
|
8
8
|
import TooltipV2Root from './root2.mjs';
|
|
9
|
-
import TooltipV2Arrow from './
|
|
9
|
+
import TooltipV2Arrow from './arrow2.mjs';
|
|
10
10
|
import TooltipV2Content from './content2.mjs';
|
|
11
|
-
import TooltipV2Trigger from './
|
|
11
|
+
import TooltipV2Trigger from './trigger2.mjs';
|
|
12
12
|
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
13
13
|
|
|
14
14
|
const __default__ = {
|
|
@@ -1,95 +1,17 @@
|
|
|
1
|
-
import { defineComponent, inject, watch, onBeforeUnmount, openBlock, createBlock, unref, withCtx, renderSlot, createElementBlock, mergeProps } from 'vue';
|
|
2
1
|
import '../../../utils/index.mjs';
|
|
3
|
-
import '../../../
|
|
4
|
-
import ForwardRef from './forward-ref.mjs';
|
|
5
|
-
import { tooltipV2TriggerProps } from './trigger2.mjs';
|
|
6
|
-
import { tooltipV2CommonProps } from './common.mjs';
|
|
7
|
-
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
8
|
-
import { tooltipV2RootKey } from '../../../tokens/tooltip-v2.mjs';
|
|
9
|
-
import { composeEventHandlers } from '../../../utils/dom/event.mjs';
|
|
2
|
+
import { definePropType, buildProps } from '../../../utils/vue/props.mjs';
|
|
10
3
|
|
|
11
|
-
const
|
|
12
|
-
|
|
4
|
+
const EventHandler = {
|
|
5
|
+
type: definePropType(Function)
|
|
13
6
|
};
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const props = __props;
|
|
22
|
-
const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = inject(tooltipV2RootKey);
|
|
23
|
-
let isMousedown = false;
|
|
24
|
-
const setTriggerRef = (el) => {
|
|
25
|
-
triggerRef.value = el;
|
|
26
|
-
};
|
|
27
|
-
const onMouseup = () => {
|
|
28
|
-
isMousedown = false;
|
|
29
|
-
};
|
|
30
|
-
const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
|
|
31
|
-
const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
|
|
32
|
-
const onMousedown = composeEventHandlers(props.onMouseDown, () => {
|
|
33
|
-
onClose();
|
|
34
|
-
isMousedown = true;
|
|
35
|
-
document.addEventListener("mouseup", onMouseup, { once: true });
|
|
36
|
-
});
|
|
37
|
-
const onFocus = composeEventHandlers(props.onFocus, () => {
|
|
38
|
-
if (!isMousedown)
|
|
39
|
-
onOpen();
|
|
40
|
-
});
|
|
41
|
-
const onBlur = composeEventHandlers(props.onBlur, onClose);
|
|
42
|
-
const onClick = composeEventHandlers(props.onClick, (e) => {
|
|
43
|
-
if (e.detail === 0)
|
|
44
|
-
onClose();
|
|
45
|
-
});
|
|
46
|
-
const events = {
|
|
47
|
-
blur: onBlur,
|
|
48
|
-
click: onClick,
|
|
49
|
-
focus: onFocus,
|
|
50
|
-
mousedown: onMousedown,
|
|
51
|
-
mouseenter: onMouseenter,
|
|
52
|
-
mouseleave: onMouseleave
|
|
53
|
-
};
|
|
54
|
-
const setEvents = (el, events2, type) => {
|
|
55
|
-
if (el) {
|
|
56
|
-
Object.entries(events2).forEach(([name, handler]) => {
|
|
57
|
-
el[type](name, handler);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
watch(triggerRef, (triggerEl, previousTriggerEl) => {
|
|
62
|
-
setEvents(triggerEl, events, "addEventListener");
|
|
63
|
-
setEvents(previousTriggerEl, events, "removeEventListener");
|
|
64
|
-
if (triggerEl) {
|
|
65
|
-
triggerEl.setAttribute("aria-describedby", contentId.value);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
onBeforeUnmount(() => {
|
|
69
|
-
setEvents(triggerRef.value, events, "removeEventListener");
|
|
70
|
-
document.removeEventListener("mouseup", onMouseup);
|
|
71
|
-
});
|
|
72
|
-
return (_ctx, _cache) => {
|
|
73
|
-
return _ctx.nowrap ? (openBlock(), createBlock(unref(ForwardRef), {
|
|
74
|
-
key: 0,
|
|
75
|
-
"set-ref": setTriggerRef,
|
|
76
|
-
"only-child": ""
|
|
77
|
-
}, {
|
|
78
|
-
default: withCtx(() => [
|
|
79
|
-
renderSlot(_ctx.$slots, "default")
|
|
80
|
-
]),
|
|
81
|
-
_: 3
|
|
82
|
-
})) : (openBlock(), createElementBlock("button", mergeProps({
|
|
83
|
-
key: 1,
|
|
84
|
-
ref_key: "triggerRef",
|
|
85
|
-
ref: triggerRef
|
|
86
|
-
}, _ctx.$attrs), [
|
|
87
|
-
renderSlot(_ctx.$slots, "default")
|
|
88
|
-
], 16));
|
|
89
|
-
};
|
|
90
|
-
}
|
|
7
|
+
const tooltipV2TriggerProps = buildProps({
|
|
8
|
+
onBlur: EventHandler,
|
|
9
|
+
onClick: EventHandler,
|
|
10
|
+
onFocus: EventHandler,
|
|
11
|
+
onMouseDown: EventHandler,
|
|
12
|
+
onMouseEnter: EventHandler,
|
|
13
|
+
onMouseLeave: EventHandler
|
|
91
14
|
});
|
|
92
|
-
var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/Users/meng/workspace/element-ps/packages/components/tooltip-v2/src/trigger.vue"]]);
|
|
93
15
|
|
|
94
|
-
export {
|
|
16
|
+
export { tooltipV2TriggerProps };
|
|
95
17
|
//# sourceMappingURL=trigger.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/trigger.
|
|
1
|
+
{"version":3,"file":"trigger.mjs","sources":["../../../../../../packages/components/tooltip-v2/src/trigger.ts"],"sourcesContent":["import { buildProps, definePropType } from '@element-ps/utils'\n\nimport type { ExtractPropTypes } from 'vue'\n\nconst EventHandler = {\n type: definePropType<(e: Event) => boolean | void>(Function),\n} as const\n\nexport const tooltipV2TriggerProps = buildProps({\n onBlur: EventHandler,\n onClick: EventHandler,\n onFocus: EventHandler,\n onMouseDown: EventHandler,\n onMouseEnter: EventHandler,\n onMouseLeave: EventHandler,\n} as const)\n\nexport type TooltipV2TriggerProps = ExtractPropTypes<\n typeof tooltipV2TriggerProps\n>\n"],"names":[],"mappings":";;;AACA,MAAM,YAAY,GAAG;AACrB,EAAE,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAChC,CAAC,CAAC;AACU,MAAC,qBAAqB,GAAG,UAAU,CAAC;AAChD,EAAE,MAAM,EAAE,YAAY;AACtB,EAAE,OAAO,EAAE,YAAY;AACvB,EAAE,OAAO,EAAE,YAAY;AACvB,EAAE,WAAW,EAAE,YAAY;AAC3B,EAAE,YAAY,EAAE,YAAY;AAC5B,EAAE,YAAY,EAAE,YAAY;AAC5B,CAAC;;;;"}
|