Deferred context added

pull/5315/head
tugcekucukoglu 2024-02-21 10:31:43 +03:00
parent 9a416252a7
commit 2f353f2c19
44 changed files with 801 additions and 635 deletions

View File

@ -9726,7 +9726,7 @@ const services = {
{ {
key: '7-1', key: '7-1',
data: { data: {
name: 'primeng.png', name: 'primevue.png',
size: '30kb', size: '30kb',
type: 'Picture' type: 'Picture'
} }

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Advanced Galleria implementation with a custom UI.</p> <p>Advanced Galleria implementation with a custom UI.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Galleria <Galleria
ref="galleria" ref="galleria"
@ -48,6 +49,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" :dependencies="{ sass: '1.45.0', 'sass-loader': '8.0.2' }" /> <DocSectionCode :code="code" :service="['PhotoService']" :dependencies="{ sass: '1.45.0', 'sass-loader': '8.0.2' }" />
</template> </template>
@ -424,11 +426,11 @@ const slideButtonIcon = computed(() => {
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
this.bindDocumentListeners(); this.bindDocumentListeners();
}, },
methods: {
toggleAutoSlide() { toggleAutoSlide() {
this.isAutoPlay = !this.isAutoPlay; this.isAutoPlay = !this.isAutoPlay;
}, },

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>A slideshow implementation is defined by adding <i>circular</i> and <i>autoPlay</i> properties.</p> <p>A slideshow implementation is defined by adding <i>circular</i> and <i>autoPlay</i> properties.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" containerStyle="max-width: 640px" :circular="true" :autoPlay="true" :transitionInterval="2000"> <Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" containerStyle="max-width: 640px" :circular="true" :autoPlay="true" :transitionInterval="2000">
<template #item="slotProps"> <template #item="slotProps">
@ -12,6 +13,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -133,8 +135,10 @@ const responsiveOptions = ref([
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Galleria requires a <i>value</i> as a collection of images, <i>item</i> template for the higher resolution image and <i>thumbnail</i> template to display as a thumbnail.</p> <p>Galleria requires a <i>value</i> as a collection of images, <i>item</i> template for the higher resolution image and <i>thumbnail</i> template to display as a thumbnail.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" containerStyle="max-width: 640px"> <Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" containerStyle="max-width: 640px">
<template #item="slotProps"> <template #item="slotProps">
@ -12,6 +13,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -130,8 +132,10 @@ const responsiveOptions = ref([
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Description of an image is specified with the <i>caption</i> property that takes the displayed object and returns content.</p> <p>Description of an image is specified with the <i>caption</i> property that takes the displayed object and returns content.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" containerStyle="max-width: 640px"> <Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" containerStyle="max-width: 640px">
<template #item="slotProps"> <template #item="slotProps">
@ -16,6 +17,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -146,8 +148,10 @@ const responsiveOptions = ref([
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Galleria can be controlled programmatically using a binding to <i>activeIndex</i>.</p> <p>Galleria can be controlled programmatically using a binding to <i>activeIndex</i>.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<div class="mb-3"> <div class="mb-3">
<Button icon="pi pi-minus" @click="prev" /> <Button icon="pi pi-minus" @click="prev" />
@ -17,6 +18,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -168,10 +170,10 @@ const prev = () => {
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
}, },
methods: {
next() { next() {
this.activeIndex = this.activeIndex === this.images.length - 1 ? this.images.length - 1 : this.activeIndex + 1; this.activeIndex = this.activeIndex === this.images.length - 1 ? this.images.length - 1 : this.activeIndex + 1;
}, },

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Settings per screen size is defined via the <i>responsiveOptions</i> property.</p> <p>Settings per screen size is defined via the <i>responsiveOptions</i> property.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" containerStyle="max-width: 640px"> <Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" containerStyle="max-width: 640px">
<template #item="slotProps"> <template #item="slotProps">
@ -14,6 +15,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -138,8 +140,10 @@ const responsiveOptions = ref([
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Thumbnails represent a smaller version of the actual content.</p> <p>Thumbnails represent a smaller version of the actual content.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<div class="flex flex-wrap gap-3 mb-5"> <div class="flex flex-wrap gap-3 mb-5">
<div v-for="option in positionOptions" :key="option.label" class="flex align-items-center"> <div v-for="option in positionOptions" :key="option.label" class="flex align-items-center">
@ -20,6 +21,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -213,8 +215,10 @@ onMounted(() => {
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Using <i>activeIndex</i>, Galleria is displayed with a specific initial image.</p> <p>Using <i>activeIndex</i>, Galleria is displayed with a specific initial image.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card flex justify-content-center"> <div class="card flex justify-content-center">
<Galleria <Galleria
v-model:activeIndex="activeIndex" v-model:activeIndex="activeIndex"
@ -29,6 +30,7 @@
</div> </div>
</div> </div>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -191,10 +193,10 @@ const imageClick = (index) => {
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
}, },
methods: {
imageClick(index) { imageClick(index) {
this.activeIndex = index; this.activeIndex = index;
this.displayCustom = true; this.displayCustom = true;

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Full screen mode is enabled by adding <i>fullScreen</i> property and and visibility is controlled with a binding to <i>visible</i> property.</p> <p>Full screen mode is enabled by adding <i>fullScreen</i> property and and visibility is controlled with a binding to <i>visible</i> property.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card flex justify-content-center"> <div class="card flex justify-content-center">
<Galleria v-model:visible="displayBasic" :value="images" :responsiveOptions="responsiveOptions" :numVisible="9" containerStyle="max-width: 50%" :circular="true" :fullScreen="true" :showItemNavigators="true"> <Galleria v-model:visible="displayBasic" :value="images" :responsiveOptions="responsiveOptions" :numVisible="9" containerStyle="max-width: 50%" :circular="true" :fullScreen="true" :showItemNavigators="true">
<template #item="slotProps"> <template #item="slotProps">
@ -14,6 +15,7 @@
<Button label="Show" icon="pi pi-external-link" @click="displayBasic = true" /> <Button label="Show" icon="pi pi-external-link" @click="displayBasic = true" />
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -165,8 +167,10 @@ onMounted(() => {
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Thumbnails can also be hidden in full screen mode.</p> <p>Thumbnails can also be hidden in full screen mode.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card flex justify-content-center"> <div class="card flex justify-content-center">
<Galleria v-model:visible="displayBasic" :value="images" :responsiveOptions="responsiveOptions" :numVisible="9" containerStyle="max-width: 50%" :circular="true" :fullScreen="true" :showItemNavigators="true" :showThumbnails="false"> <Galleria v-model:visible="displayBasic" :value="images" :responsiveOptions="responsiveOptions" :numVisible="9" containerStyle="max-width: 50%" :circular="true" :fullScreen="true" :showItemNavigators="true" :showThumbnails="false">
<template #item="slotProps"> <template #item="slotProps">
@ -14,6 +15,7 @@
<Button label="Show" icon="pi pi-external-link" @click="displayBasic = true" /> <Button label="Show" icon="pi pi-external-link" @click="displayBasic = true" />
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -165,8 +167,10 @@ onMounted(() => {
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Indicators are displayed at the bottom by enabling <i>showIndicators</i> property and interacted with the click event by default.</p> <p>Indicators are displayed at the bottom by enabling <i>showIndicators</i> property and interacted with the click event by default.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Galleria :value="images" :numVisible="5" containerStyle="max-width: 640px" :showThumbnails="false" :showIndicators="true"> <Galleria :value="images" :numVisible="5" containerStyle="max-width: 640px" :showThumbnails="false" :showIndicators="true">
<template #item="slotProps"> <template #item="slotProps">
@ -9,6 +10,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -91,8 +93,10 @@ const images = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Indicators can be activated on hover instead of click if <i>changeItemOnIndicatorHover</i> is added.</p> <p>Indicators can be activated on hover instead of click if <i>changeItemOnIndicatorHover</i> is added.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Galleria :value="images" :numVisible="5" containerStyle="max-width: 640px" :showThumbnails="false" :showIndicators="true" :changeItemOnIndicatorHover="true"> <Galleria :value="images" :numVisible="5" containerStyle="max-width: 640px" :showThumbnails="false" :showIndicators="true" :changeItemOnIndicatorHover="true">
<template #item="slotProps"> <template #item="slotProps">
@ -9,6 +10,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -91,8 +93,10 @@ const images = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Indicators can be placed at four different sides using the <i>indicatorsPosition</i> property. In addition, enabling <i>showIndicatorsOnItem</i> moves the indicators inside the image section.</p> <p>Indicators can be placed at four different sides using the <i>indicatorsPosition</i> property. In addition, enabling <i>showIndicatorsOnItem</i> moves the indicators inside the image section.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<div class="flex flex-wrap gap-3 mb-5"> <div class="flex flex-wrap gap-3 mb-5">
<div v-for="option in positionOptions" :key="option.label" class="flex align-items-center"> <div v-for="option in positionOptions" :key="option.label" class="flex align-items-center">
@ -19,6 +20,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -181,8 +183,10 @@ const positionOptions = ref([
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Indicator content can be customized with the <i>indicator</i> property that takes an index as a parameter and expects content.</p> <p>Indicator content can be customized with the <i>indicator</i> property that takes an index as a parameter and expects content.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Galleria :value="images" :numVisible="5" containerStyle="max-width: 640px" :showThumbnails="false" :showIndicators="true" :changeItemOnIndicatorHover="true" :showIndicatorsOnItem="true" indicatorsPosition="left"> <Galleria :value="images" :numVisible="5" containerStyle="max-width: 640px" :showThumbnails="false" :showIndicators="true" :changeItemOnIndicatorHover="true" :showIndicatorsOnItem="true" indicatorsPosition="left">
<template #item="slotProps"> <template #item="slotProps">
@ -12,6 +13,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -103,8 +105,10 @@ const images = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Navigators are displayed on hover only if <i>showItemNavigatorsOnHover</i> is enabled.</p> <p>Navigators are displayed on hover only if <i>showItemNavigatorsOnHover</i> is enabled.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" containerStyle="max-width: 640px" :showItemNavigators="true" :showItemNavigatorsOnHover="true"> <Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" containerStyle="max-width: 640px" :showItemNavigators="true" :showItemNavigatorsOnHover="true">
<template #item="slotProps"> <template #item="slotProps">
@ -12,6 +13,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -130,8 +132,10 @@ const responsiveOptions = ref([
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,8 +2,19 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Navigators and Indicators can be combined as well.</p> <p>Navigators and Indicators can be combined as well.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" containerStyle="max-width: 640px" :showItemNavigators="true" :showThumbnails="false" :showItemNavigatorsOnHover="true" :showIndicators="true"> <Galleria
:value="images"
:responsiveOptions="responsiveOptions"
:numVisible="5"
:circular="true"
containerStyle="max-width: 640px"
:showItemNavigators="true"
:showThumbnails="false"
:showItemNavigatorsOnHover="true"
:showIndicators="true"
>
<template #item="slotProps"> <template #item="slotProps">
<img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" /> <img :src="slotProps.item.itemImageSrc" :alt="slotProps.item.alt" style="width: 100%; display: block" />
</template> </template>
@ -12,6 +23,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -145,8 +157,10 @@ const responsiveOptions = ref([
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Add <i>showItemNavigators</i> to display navigator elements and the left and right side.</p> <p>Add <i>showItemNavigators</i> to display navigator elements and the left and right side.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" containerStyle="max-width: 640px" :showItemNavigators="true"> <Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" containerStyle="max-width: 640px" :showItemNavigators="true">
<template #item="slotProps"> <template #item="slotProps">
@ -12,6 +13,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -133,8 +135,10 @@ const responsiveOptions = ref([
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Simple example with indicators only.</p> <p>Simple example with indicators only.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" containerStyle="max-width: 640px" :showItemNavigators="true" :showThumbnails="false"> <Galleria :value="images" :responsiveOptions="responsiveOptions" :numVisible="5" :circular="true" containerStyle="max-width: 640px" :showItemNavigators="true" :showThumbnails="false">
<template #item="slotProps"> <template #item="slotProps">
@ -12,6 +13,7 @@
</template> </template>
</Galleria> </Galleria>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['PhotoService']" /> <DocSectionCode :code="code" :service="['PhotoService']" />
</template> </template>
@ -145,8 +147,10 @@ const responsiveOptions = ref([
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
PhotoService.getImages().then((data) => (this.images = data)); PhotoService.getImages().then((data) => (this.images = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>TreeTable requires a collection of <i>TreeNode</i> instances as a <i>value</i> and <i>Column</i> components as children for the representation. The column with the element to toggle a node should have <i>expander</i> enabled.</p> <p>TreeTable requires a collection of <i>TreeNode</i> instances as a <i>value</i> and <i>Column</i> components as children for the representation. The column with the element to toggle a node should have <i>expander</i> enabled.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes"> <TreeTable :value="nodes">
<Column field="name" header="Name" expander></Column> <Column field="name" header="Name" expander></Column>
@ -9,6 +10,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -106,8 +108,10 @@ const nodes = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Column visibility based on a condition can be implemented with dynamic columns, in this sample a MultiSelect is used to manage the visible columns.</p> <p>Column visibility based on a condition can be implemented with dynamic columns, in this sample a MultiSelect is used to manage the visible columns.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes"> <TreeTable :value="nodes">
<template #header> <template #header>
@ -13,6 +14,7 @@
<Column v-for="col of selectedColumns" :key="col.field" :field="col.field" :header="col.header"></Column> <Column v-for="col of selectedColumns" :key="col.field" :field="col.field" :header="col.header"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -155,10 +157,10 @@ const onToggle = (val) => {
this.selectedColumns = this.columns; this.selectedColumns = this.columns;
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
}, },
methods: {
onToggle(value) { onToggle(value) {
this.selectedColumns = this.columns.filter((col) => value.includes(col)); this.selectedColumns = this.columns.filter((col) => value.includes(col));
} }

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Expansion state is controlled with <i>expandedKeys</i> property. The <i>expandedKeys</i> should be an object whose keys refer to the node key and values represent the expanded state e.g. <i>&#123;'0-0': true&#125;</i>.</p> <p>Expansion state is controlled with <i>expandedKeys</i> property. The <i>expandedKeys</i> should be an object whose keys refer to the node key and values represent the expanded state e.g. <i>&#123;'0-0': true&#125;</i>.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<Button @click="toggleApplications" label="Toggle Applications" /> <Button @click="toggleApplications" label="Toggle Applications" />
<TreeTable v-model:expandedKeys="expandedKeys" :value="nodes" class="mt-4"> <TreeTable v-model:expandedKeys="expandedKeys" :value="nodes" class="mt-4">
@ -10,6 +11,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -131,10 +133,10 @@ const toggleApplications = () => {
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
}, },
methods: {
toggleApplications() { toggleApplications() {
let _expandedKeys = { ...this.expandedKeys }; let _expandedKeys = { ...this.expandedKeys };

View File

@ -2,11 +2,13 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Columns can be created programmatically.</p> <p>Columns can be created programmatically.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes"> <TreeTable :value="nodes">
<Column v-for="col of columns" :key="col.field" :field="col.field" :header="col.header" :expander="col.expander"></Column> <Column v-for="col of columns" :key="col.field" :field="col.field" :header="col.header" :expander="col.expander"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -119,8 +121,10 @@ const columns = ref([
{ field: 'type', header: 'Type' } { field: 'type', header: 'Type' }
]; ];
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -6,6 +6,7 @@
support filtering. support filtering.
</p> </p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<div class="flex justify-content-center mb-4"> <div class="flex justify-content-center mb-4">
<SelectButton v-model="filterMode" optionLabel="label" dataKey="label" :options="filterOptions" /> <SelectButton v-model="filterMode" optionLabel="label" dataKey="label" :options="filterOptions" />
@ -38,6 +39,7 @@
</Column> </Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -226,8 +228,10 @@ const filterOptions = ref([
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -10,6 +10,7 @@
</p> </p>
<p>In addition, only the root elements should be loaded, children can be loaded on demand using <i>nodeExpand</i> callback.</p> <p>In addition, only the root elements should be loaded, children can be loaded on demand using <i>nodeExpand</i> callback.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes" :lazy="true" :paginator="true" :rows="rows" :loading="loading" @nodeExpand="onExpand" @page="onPage" :totalRecords="totalRecords"> <TreeTable :value="nodes" :lazy="true" :paginator="true" :rows="rows" :loading="loading" @nodeExpand="onExpand" @page="onPage" :totalRecords="totalRecords">
<Column field="name" header="Name" expander></Column> <Column field="name" header="Name" expander></Column>
@ -17,6 +18,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -237,7 +239,8 @@ const loadNodes = (first, rows) => {
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
this.loading = true; this.loading = true;
setTimeout(() => { setTimeout(() => {
@ -246,7 +249,7 @@ const loadNodes = (first, rows) => {
this.totalRecords = 1000; this.totalRecords = 1000;
}, 1000); }, 1000);
}, },
methods: {
onExpand(node) { onExpand(node) {
if (!node.children) { if (!node.children) {
this.loading = true; this.loading = true;

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>A horizontal scrollbar is displayed when parent of the table gets smaller than the defined <i>minWidth</i>.</p> <p>A horizontal scrollbar is displayed when parent of the table gets smaller than the defined <i>minWidth</i>.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes" :tableProps="{ style: { minWidth: '650px' } }" style="overflow: auto"> <TreeTable :value="nodes" :tableProps="{ style: { minWidth: '650px' } }" style="overflow: auto">
<Column field="name" header="Name" expander></Column> <Column field="name" header="Name" expander></Column>
@ -9,6 +10,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -106,8 +108,10 @@ const nodes = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>In addition to a regular table, alternatives with alternative sizes are available.</p> <p>In addition to a regular table, alternatives with alternative sizes are available.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<div class="flex justify-content-center mb-4"> <div class="flex justify-content-center mb-4">
<SelectButton v-model="size" :options="sizeOptions" optionLabel="label" dataKey="label" /> <SelectButton v-model="size" :options="sizeOptions" optionLabel="label" dataKey="label" />
@ -12,6 +13,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -127,8 +129,10 @@ const sizeOptions = ref([
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Custom content at <i>header</i> and <i>footer</i> slots are supported via templating.</p> <p>Custom content at <i>header</i> and <i>footer</i> slots are supported via templating.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes"> <TreeTable :value="nodes">
<template #header> <template #header>
@ -25,6 +26,7 @@
</template> </template>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -170,8 +172,10 @@ const nodes = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Pagination is enabled by adding <i>paginator</i> property and defining <i>rows</i> per page.</p> <p>Pagination is enabled by adding <i>paginator</i> property and defining <i>rows</i> per page.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes" :paginator="true" :rows="5" :rowsPerPageOptions="[5, 10, 25]"> <TreeTable :value="nodes" :paginator="true" :rows="5" :rowsPerPageOptions="[5, 10, 25]">
<Column field="name" header="Name" expander></Column> <Column field="name" header="Name" expander></Column>
@ -9,6 +10,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -121,7 +123,9 @@ nodes.value = files;
} }
}; };
}, },
mounted() { mounted() {},
methods: {
loadDemoData() {
let files = []; let files = [];
for (let i = 0; i < 50; i++) { for (let i = 0; i < 50; i++) {
@ -149,5 +153,6 @@ nodes.value = files;
this.nodes = files; this.nodes = files;
} }
}
}; };
</script> </script>

View File

@ -5,6 +5,7 @@
<PrimeVueNuxtLink to="/paginator">Paginator</PrimeVueNuxtLink> component for more information about the advanced customization options. <PrimeVueNuxtLink to="/paginator">Paginator</PrimeVueNuxtLink> component for more information about the advanced customization options.
</p> </p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable <TreeTable
:value="nodes" :value="nodes"
@ -25,6 +26,7 @@
</template> </template>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -161,7 +163,8 @@ nodes.value = files;
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
let files = []; let files = [];
for (let i = 0; i < 50; i++) { for (let i = 0; i < 50; i++) {
@ -189,5 +192,6 @@ nodes.value = files;
this.nodes = files; this.nodes = files;
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Setting <i>columnResizeMode</i> as <i>expand</i> changes the table width as well.</p> <p>Setting <i>columnResizeMode</i> as <i>expand</i> changes the table width as well.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes" :resizableColumns="true" columnResizeMode="expand" showGridlines :tableProps="{ style: { minWidth: '50rem' } }"> <TreeTable :value="nodes" :resizableColumns="true" columnResizeMode="expand" showGridlines :tableProps="{ style: { minWidth: '50rem' } }">
<Column field="name" header="Name" expander></Column> <Column field="name" header="Name" expander></Column>
@ -9,6 +10,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -106,8 +108,10 @@ const nodes = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -5,6 +5,7 @@
that does not change the overall table width. that does not change the overall table width.
</p> </p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes" :resizableColumns="true" showGridlines :tableProps="{ style: { minWidth: '50rem' } }"> <TreeTable :value="nodes" :resizableColumns="true" showGridlines :tableProps="{ style: { minWidth: '50rem' } }">
<Column field="name" header="Name" expander></Column> <Column field="name" header="Name" expander></Column>
@ -12,6 +13,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -109,8 +111,10 @@ const nodes = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -5,6 +5,7 @@
adjusts itself according to the size changes. adjusts itself according to the size changes.
</p> </p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card flex justify-content-center"> <div class="card flex justify-content-center">
<Button label="Show" icon="pi pi-external-link" @click="dialogVisible = true" /> <Button label="Show" icon="pi pi-external-link" @click="dialogVisible = true" />
@ -19,6 +20,7 @@
</template> </template>
</Dialog> </Dialog>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -110,8 +112,10 @@ const dialogVisible = ref(false);
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>A column can be fixed during horizontal scrolling by enabling the <i>frozen</i> property on a Column. The location is defined with the <i>alignFrozen</i> that can be <i>left</i> or <i>right</i>.</p> <p>A column can be fixed during horizontal scrolling by enabling the <i>frozen</i> property on a Column. The location is defined with the <i>alignFrozen</i> that can be <i>left</i> or <i>right</i>.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes" scrollable scrollHeight="300px" scrollDirection="both"> <TreeTable :value="nodes" scrollable scrollHeight="300px" scrollDirection="both">
<Column field="name" header="Name" expander frozen style="width: 250px; height: 57px"></Column> <Column field="name" header="Name" expander frozen style="width: 250px; height: 57px"></Column>
@ -12,6 +13,7 @@
<Column field="size" header="Size 3" style="width: 250px; height: 57px"></Column> <Column field="size" header="Size 3" style="width: 250px; height: 57px"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -118,8 +120,10 @@ const nodes = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Horizontal scrolling is enabled when the total width of columns exceeds table width.</p> <p>Horizontal scrolling is enabled when the total width of columns exceeds table width.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes" scrollable scrollHeight="300px" scrollDirection="both"> <TreeTable :value="nodes" scrollable scrollHeight="300px" scrollDirection="both">
<Column field="name" header="Name" expander style="width: 250px"></Column> <Column field="name" header="Name" expander style="width: 250px"></Column>
@ -12,6 +13,7 @@
<Column field="size" header="Size 3" style="width: 250px"></Column> <Column field="size" header="Size 3" style="width: 250px"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -118,8 +120,10 @@ const nodes = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Adding <i>scrollable</i> property along with a <i>scrollHeight</i> for the data viewport enables vertical scrolling with fixed headers.</p> <p>Adding <i>scrollable</i> property along with a <i>scrollHeight</i> for the data viewport enables vertical scrolling with fixed headers.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes" scrollable scrollHeight="270px"> <TreeTable :value="nodes" scrollable scrollHeight="270px">
<Column field="name" header="Name" expander></Column> <Column field="name" header="Name" expander></Column>
@ -9,6 +10,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -106,8 +108,10 @@ const nodes = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -6,6 +6,7 @@
</p> </p>
</DocSectionText> </DocSectionText>
<DocSectionCode :code="introCode" hideToggleCode importCode hideStackBlitz /> <DocSectionCode :code="introCode" hideToggleCode importCode hideStackBlitz />
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable v-model:selectionKeys="selectedKey" :value="nodes" selectionMode="checkbox"> <TreeTable v-model:selectionKeys="selectedKey" :value="nodes" selectionMode="checkbox">
<Column field="name" header="Name" expander></Column> <Column field="name" header="Name" expander></Column>
@ -13,6 +14,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -123,8 +125,10 @@ const selectedKey = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -6,6 +6,7 @@
</p> </p>
<p>In multiple selection mode, value binding should be a key-value pair where key is the node key and value is a boolean to indicate selection.</p> <p>In multiple selection mode, value binding should be a key-value pair where key is the node key and value is a boolean to indicate selection.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<div class="flex justify-content-center align-items-center mb-4 gap-2"> <div class="flex justify-content-center align-items-center mb-4 gap-2">
<InputSwitch v-model="metaKey" inputId="input-metakey" /> <InputSwitch v-model="metaKey" inputId="input-metakey" />
@ -17,6 +18,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -130,8 +132,10 @@ const metaKey = ref(true);
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>TreeTable provides <i>nodeSelect</i> and <i>nodeUnselect</i> events to listen selection events.</p> <p>TreeTable provides <i>nodeSelect</i> and <i>nodeUnselect</i> events to listen selection events.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable v-model:selectionKeys="selectedKey" :value="nodes" selectionMode="single" @nodeSelect="onNodeSelect" @nodeUnselect="onNodeUnselect" :metaKeySelection="false"> <TreeTable v-model:selectionKeys="selectedKey" :value="nodes" selectionMode="single" @nodeSelect="onNodeSelect" @nodeUnselect="onNodeUnselect" :metaKeySelection="false">
<Column field="name" header="Name" expander></Column> <Column field="name" header="Name" expander></Column>
@ -9,6 +10,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -130,10 +132,10 @@ const onNodeUnselect = (node) => {
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
}, },
methods: {
onNodeSelect(node) { onNodeSelect(node) {
this.$toast.add({ severity: 'success', summary: 'Node Selected', detail: node.data.name, life: 3000 }); this.$toast.add({ severity: 'success', summary: 'Node Selected', detail: node.data.name, life: 3000 });
}, },

View File

@ -6,6 +6,7 @@
setting it to false. setting it to false.
</p> </p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<div class="flex justify-content-center align-items-center mb-4 gap-2"> <div class="flex justify-content-center align-items-center mb-4 gap-2">
<InputSwitch v-model="metaKey" inputId="input-metakey" /> <InputSwitch v-model="metaKey" inputId="input-metakey" />
@ -17,6 +18,7 @@
<Column field="type" header="Type"></Column> <Column field="type" header="Type"></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -130,8 +132,10 @@ const metaKey = ref(true);
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Multiple columns can be sorted by defining <i>sortMode</i> as <i>multiple</i>. This mode requires metaKey (e.g. <i></i>) to be pressed when clicking a header.</p> <p>Multiple columns can be sorted by defining <i>sortMode</i> as <i>multiple</i>. This mode requires metaKey (e.g. <i></i>) to be pressed when clicking a header.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes" sortMode="multiple"> <TreeTable :value="nodes" sortMode="multiple">
<Column field="name" header="Name" sortable expander></Column> <Column field="name" header="Name" sortable expander></Column>
@ -9,6 +10,7 @@
<Column field="type" header="Type" sortable></Column> <Column field="type" header="Type" sortable></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -106,8 +108,10 @@ const nodes = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>When <i>removableSort</i> is present, the third click removes the sorting from the column.</p> <p>When <i>removableSort</i> is present, the third click removes the sorting from the column.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes" sortMode="multiple" removableSort> <TreeTable :value="nodes" sortMode="multiple" removableSort>
<Column field="name" header="Name" sortable expander></Column> <Column field="name" header="Name" sortable expander></Column>
@ -9,6 +10,7 @@
<Column field="type" header="Type" sortable></Column> <Column field="type" header="Type" sortable></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -106,8 +108,10 @@ const nodes = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -2,6 +2,7 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>Sorting on a column is enabled by adding the <i>sortable</i> property.</p> <p>Sorting on a column is enabled by adding the <i>sortable</i> property.</p>
</DocSectionText> </DocSectionText>
<DeferredDemo @load="loadDemoData">
<div class="card"> <div class="card">
<TreeTable :value="nodes"> <TreeTable :value="nodes">
<Column field="name" header="Name" sortable expander></Column> <Column field="name" header="Name" sortable expander></Column>
@ -9,6 +10,7 @@
<Column field="type" header="Type" sortable></Column> <Column field="type" header="Type" sortable></Column>
</TreeTable> </TreeTable>
</div> </div>
</DeferredDemo>
<DocSectionCode :code="code" :service="['NodeService']" /> <DocSectionCode :code="code" :service="['NodeService']" />
</template> </template>
@ -106,8 +108,10 @@ const nodes = ref();
} }
}; };
}, },
mounted() { methods: {
loadDemoData() {
NodeService.getTreeTableNodes().then((data) => (this.nodes = data)); NodeService.getTreeTableNodes().then((data) => (this.nodes = data));
} }
}
}; };
</script> </script>

View File

@ -377,7 +377,7 @@ export const NodeService = {
{ {
key: '7-1', key: '7-1',
data: { data: {
name: 'primeng.png', name: 'primevue.png',
size: '30kb', size: '30kb',
type: 'Picture' type: 'Picture'
} }