primevue-mirror/doc/dialog/PositionDoc.vue

191 lines
10 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
2023-10-29 19:34:22 +00:00
<p>The <i>position</i> property defines the location of relative to the screen.</p>
2023-02-28 08:29:30 +00:00
</DocSectionText>
<div class="card">
<div class="flex flex-wrap justify-content-center gap-2 mb-2">
2024-01-23 22:25:44 +00:00
<Button label="Left" icon="pi pi-arrow-right" @click="openPosition('left')" severity="secondary" style="min-width: 10rem" />
<Button label="Right" icon="pi pi-arrow-left" @click="openPosition('right')" severity="secondary" style="min-width: 10rem" />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex flex-wrap justify-content-center gap-2 mb-2">
2024-01-23 22:25:44 +00:00
<Button label="TopLeft" icon="pi pi-arrow-down-right" @click="openPosition('topleft')" severity="secondary" style="min-width: 10rem" />
<Button label="Top" icon="pi pi-arrow-down" @click="openPosition('top')" severity="secondary" style="min-width: 10rem" />
<Button label="TopRight" icon="pi pi-arrow-down-left" @click="openPosition('topright')" severity="secondary" style="min-width: 10rem" />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex flex-wrap justify-content-center gap-2">
2024-01-23 22:25:44 +00:00
<Button label="BottomLeft" icon="pi pi-arrow-up-right" @click="openPosition('bottomleft')" severity="secondary" style="min-width: 10rem" />
<Button label="Bottom" icon="pi pi-arrow-up" @click="openPosition('bottom')" severity="secondary" style="min-width: 10rem" />
<Button label="BottomRight" icon="pi pi-arrow-up-left" @click="openPosition('bottomright')" severity="secondary" style="min-width: 10rem" />
2023-02-28 08:29:30 +00:00
</div>
2024-01-23 22:25:44 +00:00
<Dialog v-model:visible="visible" header="Edit Profile" :style="{ width: '25rem' }" :position="position" :modal="true" :draggable="false">
<span class="p-text-secondary block mb-5">Update your information.</span>
<div class="flex align-items-center gap-3 mb-3">
<label for="username" class="font-semibold w-6rem">Username</label>
<InputText id="username" class="flex-auto" autocomplete="off" />
</div>
<div class="flex align-items-center gap-3 mb-5">
<label for="email" class="font-semibold w-6rem">Email</label>
<InputText id="Email" class="flex-auto" autocomplete="off" />
</div>
<div class="flex justify-content-end gap-2">
<Button type="button" label="Cancel" severity="secondary" @click="visible = false"></Button>
<Button type="button" label="Save" @click="visible = false"></Button>
</div>
2023-02-28 08:29:30 +00:00
</Dialog>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
position: 'center',
visible: false,
code: {
2023-09-22 12:54:14 +00:00
basic: `
<div class="flex flex-wrap justify-content-center gap-2 mb-2">
2024-01-23 22:25:44 +00:00
<Button label="Left" icon="pi pi-arrow-right" @click="openPosition('left')" severity="secondary" style="min-width: 10rem" />
<Button label="Right" icon="pi pi-arrow-left" @click="openPosition('right')" severity="secondary" style="min-width: 10rem" />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex flex-wrap justify-content-center gap-2 mb-2">
2024-01-23 22:25:44 +00:00
<Button label="TopLeft" icon="pi pi-arrow-down-right" @click="openPosition('topleft')" severity="secondary" style="min-width: 10rem" />
<Button label="Top" icon="pi pi-arrow-down" @click="openPosition('top')" severity="secondary" style="min-width: 10rem" />
<Button label="TopRight" icon="pi pi-arrow-down-left" @click="openPosition('topright')" severity="secondary" style="min-width: 10rem" />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex flex-wrap justify-content-center gap-2">
2024-01-23 22:25:44 +00:00
<Button label="BottomLeft" icon="pi pi-arrow-up-right" @click="openPosition('bottomleft')" severity="secondary" style="min-width: 10rem" />
<Button label="Bottom" icon="pi pi-arrow-up" @click="openPosition('bottom')" severity="secondary" style="min-width: 10rem" />
<Button label="BottomRight" icon="pi pi-arrow-up-left" @click="openPosition('bottomright')" severity="secondary" style="min-width: 10rem" />
2023-02-28 08:29:30 +00:00
</div>
2024-01-23 22:25:44 +00:00
<Dialog v-model:visible="visible" header="Edit Profile" :style="{ width: '25rem' }" :position="position" :modal="true" :draggable="false">
<span class="p-text-secondary block mb-5">Update your information.</span>
<div class="flex align-items-center gap-3 mb-3">
<label for="username" class="font-semibold w-6rem">Username</label>
<InputText id="username" class="flex-auto" autocomplete="off" />
</div>
<div class="flex align-items-center gap-3 mb-5">
<label for="email" class="font-semibold w-6rem">Email</label>
<InputText id="Email" class="flex-auto" autocomplete="off" />
</div>
<div class="flex justify-content-end gap-2">
<Button type="button" label="Cancel" severity="secondary" @click="visible = false"></Button>
<Button type="button" label="Save" @click="visible = false"></Button>
</div>
2023-10-15 09:38:39 +00:00
</Dialog>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card">
<div class="flex flex-wrap justify-content-center gap-2 mb-2">
2024-01-23 22:25:44 +00:00
<Button label="Left" icon="pi pi-arrow-right" @click="openPosition('left')" severity="secondary" style="min-width: 10rem" />
<Button label="Right" icon="pi pi-arrow-left" @click="openPosition('right')" severity="secondary" style="min-width: 10rem" />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex flex-wrap justify-content-center gap-2 mb-2">
2024-01-23 22:25:44 +00:00
<Button label="TopLeft" icon="pi pi-arrow-down-right" @click="openPosition('topleft')" severity="secondary" style="min-width: 10rem" />
<Button label="Top" icon="pi pi-arrow-down" @click="openPosition('top')" severity="secondary" style="min-width: 10rem" />
<Button label="TopRight" icon="pi pi-arrow-down-left" @click="openPosition('topright')" severity="secondary" style="min-width: 10rem" />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex flex-wrap justify-content-center gap-2">
2024-01-23 22:25:44 +00:00
<Button label="BottomLeft" icon="pi pi-arrow-up-right" @click="openPosition('bottomleft')" severity="secondary" style="min-width: 10rem" />
<Button label="Bottom" icon="pi pi-arrow-up" @click="openPosition('bottom')" severity="secondary" style="min-width: 10rem" />
<Button label="BottomRight" icon="pi pi-arrow-up-left" @click="openPosition('bottomright')" severity="secondary" style="min-width: 10rem" />
2023-02-28 08:29:30 +00:00
</div>
2024-01-23 22:25:44 +00:00
<Dialog v-model:visible="visible" header="Edit Profile" :style="{ width: '25rem' }" :position="position" :modal="true" :draggable="false">
<span class="p-text-secondary block mb-5">Update your information.</span>
<div class="flex align-items-center gap-3 mb-3">
<label for="username" class="font-semibold w-6rem">Username</label>
<InputText id="username" class="flex-auto" autocomplete="off" />
</div>
<div class="flex align-items-center gap-3 mb-5">
<label for="email" class="font-semibold w-6rem">Email</label>
<InputText id="Email" class="flex-auto" autocomplete="off" />
</div>
<div class="flex justify-content-end gap-2">
<Button type="button" label="Cancel" severity="secondary" @click="visible = false"></Button>
<Button type="button" label="Save" @click="visible = false"></Button>
</div>
2023-02-28 08:29:30 +00:00
</Dialog>
</div>
</template>
<script>
export default {
data() {
return {
position: 'center',
visible: false
};
},
methods: {
openPosition(position) {
this.position = position;
this.visible = true;
}
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card">
<div class="flex flex-wrap justify-content-center gap-2 mb-2">
2024-01-23 22:25:44 +00:00
<Button label="Left" icon="pi pi-arrow-right" @click="openPosition('left')" severity="secondary" style="min-width: 10rem" />
<Button label="Right" icon="pi pi-arrow-left" @click="openPosition('right')" severity="secondary" style="min-width: 10rem" />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex flex-wrap justify-content-center gap-2 mb-2">
2024-01-23 22:25:44 +00:00
<Button label="TopLeft" icon="pi pi-arrow-down-right" @click="openPosition('topleft')" severity="secondary" style="min-width: 10rem" />
<Button label="Top" icon="pi pi-arrow-down" @click="openPosition('top')" severity="secondary" style="min-width: 10rem" />
<Button label="TopRight" icon="pi pi-arrow-down-left" @click="openPosition('topright')" severity="secondary" style="min-width: 10rem" />
2023-02-28 08:29:30 +00:00
</div>
<div class="flex flex-wrap justify-content-center gap-2">
2024-01-23 22:25:44 +00:00
<Button label="BottomLeft" icon="pi pi-arrow-up-right" @click="openPosition('bottomleft')" severity="secondary" style="min-width: 10rem" />
<Button label="Bottom" icon="pi pi-arrow-up" @click="openPosition('bottom')" severity="secondary" style="min-width: 10rem" />
<Button label="BottomRight" icon="pi pi-arrow-up-left" @click="openPosition('bottomright')" severity="secondary" style="min-width: 10rem" />
2023-02-28 08:29:30 +00:00
</div>
2024-01-23 22:25:44 +00:00
<Dialog v-model:visible="visible" header="Edit Profile" :style="{ width: '25rem' }" :position="position" :modal="true" :draggable="false">
<span class="p-text-secondary block mb-5">Update your information.</span>
<div class="flex align-items-center gap-3 mb-3">
<label for="username" class="font-semibold w-6rem">Username</label>
<InputText id="username" class="flex-auto" autocomplete="off" />
</div>
<div class="flex align-items-center gap-3 mb-5">
<label for="email" class="font-semibold w-6rem">Email</label>
<InputText id="Email" class="flex-auto" autocomplete="off" />
</div>
<div class="flex justify-content-end gap-2">
<Button type="button" label="Cancel" severity="secondary" @click="visible = false"></Button>
<Button type="button" label="Save" @click="visible = false"></Button>
</div>
2023-02-28 08:29:30 +00:00
</Dialog>
</div>
</template>
<script setup>
import { ref } from "vue";
const position = ref('center');
const visible = ref(false);
const openPosition = (pos) => {
position.value = pos;
visible.value = true;
}
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
},
methods: {
openPosition(position) {
this.position = position;
this.visible = true;
}
}
};
</script>