|
495 | 495 | a(href="#toggle-a-pane-with-v-if") Toggle a pane with #[span.code v-if]
|
496 | 496 |
|
497 | 497 | w-button.mb2(@click="hidePane2 = !hidePane2")
|
498 |
| - w-icon.mr2 mdi mdi-{{ hidePane2 ? 'eye' : 'eye-off'}} |
| 498 | + w-icon.mr2 mdi mdi-{{ hidePane2 ? 'eye' : 'eye-off' }} |
499 | 499 | | {{ hidePane2 ? 'Show' : 'Hide' }} Pane 2
|
500 | 500 | splitpanes.default-theme.example(style="height: 400px")
|
501 | 501 | pane
|
|
519 | 519 | </pane>
|
520 | 520 | </splitpanes>
|
521 | 521 |
|
| 522 | + //- Example. |
| 523 | + h3.mt12.pt8.mb2(id="resizable-drawer") |
| 524 | + a(href="#resizable-drawer") Resizable Drawer |
| 525 | + |
| 526 | + p. |
| 527 | + Sometimes, you need a resizable drawer that goes on top of your app.#[br] |
| 528 | + Here's one way to do this, mostly thanks to CSS powers. The key here is to set the Splitpanes |
| 529 | + container to #[code pointer-events: none;] and reactivate the pointer events in the splitter and drawer |
| 530 | + so that you can click through Splitpanes on the rest of the page. |
| 531 | + |
| 532 | + w-button.mb2(@click="showDrawer = !showDrawer") |
| 533 | + w-icon.mr2 mdi mdi-{{ showDrawer ? 'eye' : 'eye-off' }} |
| 534 | + | {{ showDrawer ? 'Hide' : 'Show' }} Drawer |
| 535 | + splitpanes.default-theme.example.example--drawer(v-if="showDrawer") |
| 536 | + pane |
| 537 | + pane.drawer(size="40") |
| 538 | + h3.mt12 Resizable Drawer |
| 539 | + |
| 540 | + ssh-pre(language="html-vue" label="HTML"). |
| 541 | + <button @click="showDrawer = !showDrawer"> |
| 542 | + {{ "\{\{ showDrawer ? 'Hide' : 'Show' \}\}" }} Drawer |
| 543 | + </button> |
| 544 | + |
| 545 | + <splitpanes v-if="showDrawer" class="default-theme"> |
| 546 | + <pane></pane> |
| 547 | + <pane size="40"> |
| 548 | + <h3>Resizable Drawer</h3> |
| 549 | + </pane> |
| 550 | + </splitpanes> |
| 551 | + |
| 552 | + ssh-pre(language="css" label="CSS"). |
| 553 | + .splitpanes { |
| 554 | + position: fixed; |
| 555 | + inset: 0 0 0 auto; |
| 556 | + z-index: 100; |
| 557 | + pointer-events: none; |
| 558 | + |
| 559 | + .splitpanes__pane:first-child {background-color: transparent;} |
| 560 | + .splitpanes__splitter {pointer-events: all;} |
| 561 | + |
| 562 | + .splitpanes__pane ~ .splitpanes__pane { |
| 563 | + pointer-events: all; |
| 564 | + background-color: #fff; |
| 565 | + box-shadow: none; |
| 566 | + align-items: flex-start; |
| 567 | + overflow: hidden; |
| 568 | + white-space: nowrap; |
| 569 | + } |
| 570 | + } |
| 571 | + |
522 | 572 | //- Example.
|
523 | 573 | h3.mt12.pt8.mb2(id="vue-router")
|
524 | 574 | a(href="#vue-router") Vue Router inside splitpanes
|
@@ -864,6 +914,7 @@ const paneSize = ref(50)
|
864 | 914 | const hidePane2 = ref(false)
|
865 | 915 | const horizontal = ref(false)
|
866 | 916 | const firstSplitter = ref(false)
|
| 917 | +const showDrawer = ref(false) |
867 | 918 |
|
868 | 919 | const panesNumberAbs = computed(() => {
|
869 | 920 | // eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
@@ -1020,6 +1071,25 @@ em.specs {
|
1020 | 1071 | }
|
1021 | 1072 | }
|
1022 | 1073 |
|
| 1074 | +.example.example--drawer { |
| 1075 | + position: fixed; |
| 1076 | + inset: 0 0 0 auto; |
| 1077 | + z-index: 100; |
| 1078 | + pointer-events: none; |
| 1079 | +
|
| 1080 | + .splitpanes__pane:first-child {background-color: transparent;} |
| 1081 | + .splitpanes__splitter {pointer-events: all;} |
| 1082 | +
|
| 1083 | + .splitpanes__pane.drawer { |
| 1084 | + pointer-events: all; |
| 1085 | + background-color: #fff; |
| 1086 | + box-shadow: none; |
| 1087 | + align-items: flex-start; |
| 1088 | + overflow: hidden; |
| 1089 | + white-space: nowrap; |
| 1090 | + } |
| 1091 | +} |
| 1092 | +
|
1023 | 1093 | // In order to showcase the synchronicity with the panes.
|
1024 | 1094 | div.w-slider__thumb, div.w-slider__range {transition: none;}
|
1025 | 1095 | .example--programmatic-resizing .splitpanes__pane {transition: none;}
|
|
0 commit comments