Docs for Image
parent
35438385b3
commit
945880e99a
|
@ -1,9 +1,14 @@
|
||||||
|
import { VNode } from 'vue';
|
||||||
|
|
||||||
interface ImageProps {
|
interface ImageProps {
|
||||||
preview?: boolean;
|
preview?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare class Image {
|
declare class Image {
|
||||||
$props: ImageProps;
|
$props: ImageProps;
|
||||||
|
$slots: {
|
||||||
|
indicator: VNode[];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Image;
|
export default Image;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<Image src="demo/images/galleria/galleria1.jpg" alt="Image" width="250" />
|
<Image src="demo/images/galleria/galleria1.jpg" alt="Image" width="250" />
|
||||||
|
|
||||||
<h5>Preview</h5>
|
<h5>Preview</h5>
|
||||||
<Image src="demo/images/galleria/galleria11.jpg" alt="Image" width="250" preview/>
|
<Image src="demo/images/galleria/galleria11.jpg" alt="Image" width="250" preview />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -7,81 +7,28 @@ import Image from 'primevue/image';
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<h5>Getting Started</h5>
|
<h5>Getting Started</h5>
|
||||||
<p>A model can be bound using the standard v-model directive.</p>
|
<p>Image is used as the native <i>img</i> element and supports all properties that the native element has.</p>
|
||||||
<pre v-code><code>
|
<pre v-code><code>
|
||||||
<InputText type="text" v-model="value" />
|
<Image src="image1.png" alt="Image Text" />
|
||||||
|
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<h5>Float Label</h5>
|
<h5>Preview</h5>
|
||||||
<p>A floating label is implemented by wrapping the input and the label inside a container having <i>.p-float-label</i> style class.</p>
|
<p>Preview mode displays a modal layer when the image is clicked that provides transformation options such as rotating and zooming.</p>
|
||||||
|
|
||||||
|
<h5>Indicator Templating</h5>
|
||||||
|
<p>An eye icon is displayed by default when the image is hovered in preview mode. Use the <i>indicator</i> template for custom content.</p>
|
||||||
<pre v-code><code>
|
<pre v-code><code>
|
||||||
<span class="p-float-label">
|
<Image src="image1.png" alt="Image Text">
|
||||||
<InputText id="username" type="text" v-model="value" />
|
<template #indicator>
|
||||||
<label for="username">Username</label>
|
Preview Content
|
||||||
</span>
|
</template>
|
||||||
|
</Image>
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<h5>Icons</h5>
|
|
||||||
<p>An icon can be integrated within an input field by wrapping the input and the icon with an element having <i>p-input-icon-right</i>
|
|
||||||
and <i>p-input-icon-left</i> classes depending on the icon location.</p>
|
|
||||||
<pre v-code><code>
|
|
||||||
<span class="p-input-icon-left">
|
|
||||||
<i class="pi pi-search" />
|
|
||||||
<InputText type="text" v-model="value1" placeholder="Search" />
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span class="p-input-icon-right">
|
|
||||||
<InputText type="text" v-model="value2" />
|
|
||||||
<i class="pi pi-spin pi-spinner" />
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span class="p-input-icon-left p-input-icon-right">
|
|
||||||
<i class="pi pi-search" />
|
|
||||||
<InputText type="text" v-model="value3" />
|
|
||||||
<i class="pi pi-spin pi-spinner" />
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<h5>Sizes</h5>
|
|
||||||
<p>2 more sizes are available in addition to a regular input, for a smaller input add <i>p-inputtext-sm</i> and for a larger one, use <i>p-inputtext-lg</i>.
|
|
||||||
Note that these classes are mainly be used to change the size of a particular field, for global scaling see the <router-link to="/theming">theming</router-link> page.</p>
|
|
||||||
<pre v-code><code>
|
|
||||||
<InputText type="text" class="p-inputtext-sm" placeholder="Small" />
|
|
||||||
<InputText type="text" placeholder="Normal" />
|
|
||||||
<InputText type="text" class="p-inputtext-lg" placeholder="Large" />
|
|
||||||
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<p>Instead of repeating the scale classes for each input, sizing can also be applied to a group by adding the
|
|
||||||
class to a container element so that descendant inputs share the same style easier.</p>
|
|
||||||
<pre v-code><code>
|
|
||||||
<div class="p-inputtext-sm">
|
|
||||||
<InputText />
|
|
||||||
<InputNumber />
|
|
||||||
<InputMask />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</code></pre>
|
|
||||||
|
|
||||||
<h5>Outlined vs Filled</h5>
|
|
||||||
<p>Input fields come in two styles, default is <i>outlined</i> with borders around the field whereas <i>filled</i> alternative adds a background color
|
|
||||||
to the field. Applying <i>p-input-filled</i> to an ancestor of an input enables the filled style. If you prefer
|
|
||||||
to use filled inputs in the entire application, use a global container such as document body or the application element to apply the style class.</p>
|
|
||||||
|
|
||||||
<pre v-code><code>
|
|
||||||
<div class="p-input-filled">
|
|
||||||
<InputText type="text" />
|
|
||||||
<InputText type="text" />
|
|
||||||
<InputText type="text" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<h5>Properties</h5>
|
<h5>Properties</h5>
|
||||||
<p>InputText passes any valid attribute to the underlying input element, additional attribute is the following.</p>
|
<p>Image passes any valid attribute to the underlying img element, additional attribute is the following.</p>
|
||||||
<div class="doc-tablewrapper">
|
<div class="doc-tablewrapper">
|
||||||
<table class="doc-table">
|
<table class="doc-table">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -94,17 +41,58 @@ import Image from 'primevue/image';
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>modelValue</td>
|
<td>preview</td>
|
||||||
<td>any</td>
|
<td>boolean</td>
|
||||||
<td>null</td>
|
<td>false</td>
|
||||||
<td>Value of the component.</td>
|
<td>Controls the preview functionality.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h5>Events</h5>
|
<h5>Events</h5>
|
||||||
<p>Any valid event such as focus, blur and input are passed to the underlying input element.</p>
|
<p>Any valid event like click and mouseover are passed to the underlying input element. Events below are the additional ones related to the preview functionality.</p>
|
||||||
|
<div class="doc-tablewrapper">
|
||||||
|
<table class="doc-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Parameters</th>
|
||||||
|
<th>Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>show</td>
|
||||||
|
<td>-</td>
|
||||||
|
<td>Triggered when the preview overlay is shown.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>hide</td>
|
||||||
|
<td>-</td>
|
||||||
|
<td>Triggered when the preview overlay is hidden.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h5>Slots</h5>
|
||||||
|
<div class="doc-tablewrapper">
|
||||||
|
<table class="doc-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Parameters</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>indicator</td>
|
||||||
|
<td>-</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h5>Styling</h5>
|
<h5>Styling</h5>
|
||||||
<p>Following is the list of structural style classes, for theming classes visit <router-link to="/theming">theming</router-link> page.</p>
|
<p>Following is the list of structural style classes, for theming classes visit <router-link to="/theming">theming</router-link> page.</p>
|
||||||
|
@ -118,20 +106,36 @@ import Image from 'primevue/image';
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>p-inputtext</td>
|
<td>p-image</td>
|
||||||
<td>Input element</td>
|
<td>Container element</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>p-inputtext-sm</td>
|
<td>p-image-preview-container</td>
|
||||||
<td>Smaller input element</td>
|
<td>Container element with preview enabled</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>p-inputtext-lg</td>
|
<td>p-image-preview-indicator</td>
|
||||||
<td>Larger input element</td>
|
<td>Mask layer over the image when hovered</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>p-inputtext-filled</td>
|
<td>p-image-preview-icon</td>
|
||||||
<td>Filled input style.</td>
|
<td>Icon of the preview indicator</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>p-image-mask</td>
|
||||||
|
<td>Preview overlay container</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>p-image-toolbar</td>
|
||||||
|
<td>Transformation options container</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>p-image-action</td>
|
||||||
|
<td>An element inside the toolbar</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>p-image-preview</td>
|
||||||
|
<td>Image element inside the preview overlay</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -154,83 +158,18 @@ export default {
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<h5>Basic</h5>
|
<h5>Basic</h5>
|
||||||
<InputText type="text" v-model="value1" />
|
<Image src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" alt="Image" width="250" />
|
||||||
<span :style="{marginLeft: '.5em'}">{{value1}}</span>
|
|
||||||
|
|
||||||
<h5>Floating Label</h5>
|
<h5>Preview</h5>
|
||||||
<span class="p-float-label">
|
<Image src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" alt="Image" width="250" preview />
|
||||||
<InputText id="username" type="text" v-model="value2" />
|
|
||||||
<label for="username">Username</label>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<h5>Left Icon</h5>
|
|
||||||
<span class="p-input-icon-left">
|
|
||||||
<i class="pi pi-search" />
|
|
||||||
<InputText type="text" v-model="value3" placeholder="Search" />
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<h5>Right Icon</h5>
|
|
||||||
<span class="p-input-icon-right">
|
|
||||||
<i class="pi pi-spin pi-spinner" />
|
|
||||||
<InputText type="text" v-model="value4" />
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<h5>Help Text</h5>
|
|
||||||
<div class="p-field">
|
|
||||||
<label for="username1">Username</label>
|
|
||||||
<InputText id="username1" type="username" aria-describedby="username1-help" />
|
|
||||||
<small id="username1-help">Enter your username to reset your password.</small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h5>Invalid</h5>
|
|
||||||
<div class="p-field">
|
|
||||||
<label for="username2">Username</label>
|
|
||||||
<InputText id="username2" type="username" aria-describedby="username2-help" class="p-invalid" />
|
|
||||||
<small id="username2-help" class="p-error">Username is not available.</small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h5>Disabled</h5>
|
|
||||||
<InputText type="text" v-model="value5" disabled />
|
|
||||||
|
|
||||||
<h5>Sizes</h5>
|
|
||||||
<div class="sizes">
|
|
||||||
<InputText type="text" class="p-inputtext-sm" placeholder="Small" />
|
|
||||||
<InputText type="text" placeholder="Normal" />
|
|
||||||
<InputText type="text" class="p-inputtext-lg" placeholder="Large" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
value1: null,
|
|
||||||
value2: null,
|
|
||||||
value3: null,
|
|
||||||
value4: null,
|
|
||||||
value5: 'PrimeVue'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
<\\/script>
|
<\\/script>
|
||||||
|
`
|
||||||
<style lang="scss" scoped>
|
|
||||||
.sizes {
|
|
||||||
.p-inputtext {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: .5rem;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.p-field * {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
</style>`
|
|
||||||
},
|
},
|
||||||
'composition-api': {
|
'composition-api': {
|
||||||
tabName: 'Composition API Source',
|
tabName: 'Composition API Source',
|
||||||
|
@ -238,85 +177,17 @@ export default {
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<h5>Basic</h5>
|
<h5>Basic</h5>
|
||||||
<InputText type="text" v-model="value1" />
|
<Image src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" alt="Image" width="250" />
|
||||||
<span :style="{marginLeft: '.5em'}">{{value1}}</span>
|
|
||||||
|
|
||||||
<h5>Floating Label</h5>
|
<h5>Preview</h5>
|
||||||
<span class="p-float-label">
|
<Image src="https://www.primefaces.org/wp-content/uploads/2020/05/placeholder.png" alt="Image" width="250" preview />
|
||||||
<InputText id="username" type="text" v-model="value2" />
|
|
||||||
<label for="username">Username</label>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<h5>Left Icon</h5>
|
|
||||||
<span class="p-input-icon-left">
|
|
||||||
<i class="pi pi-search" />
|
|
||||||
<InputText type="text" v-model="value3" placeholder="Search" />
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<h5>Right Icon</h5>
|
|
||||||
<span class="p-input-icon-right">
|
|
||||||
<i class="pi pi-spin pi-spinner" />
|
|
||||||
<InputText type="text" v-model="value4" />
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<h5>Help Text</h5>
|
|
||||||
<div class="p-field">
|
|
||||||
<label for="username1">Username</label>
|
|
||||||
<InputText id="username1" type="username" aria-describedby="username1-help" />
|
|
||||||
<small id="username1-help">Enter your username to reset your password.</small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h5>Invalid</h5>
|
|
||||||
<div class="p-field">
|
|
||||||
<label for="username2">Username</label>
|
|
||||||
<InputText id="username2" type="username" aria-describedby="username2-help" class="p-invalid" />
|
|
||||||
<small id="username2-help" class="p-error">Username is not available.</small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h5>Disabled</h5>
|
|
||||||
<InputText type="text" v-model="value5" disabled />
|
|
||||||
|
|
||||||
<h5>Sizes</h5>
|
|
||||||
<div class="sizes">
|
|
||||||
<InputText type="text" class="p-inputtext-sm" placeholder="Small" />
|
|
||||||
<InputText type="text" placeholder="Normal" />
|
|
||||||
<InputText type="text" class="p-inputtext-lg" placeholder="Large" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
|
||||||
const value1 = ref();
|
|
||||||
const value2 = ref();
|
|
||||||
const value3 = ref();
|
|
||||||
const value4 = ref();
|
|
||||||
const value5 = ref('PrimeVue');
|
|
||||||
|
|
||||||
return { value1, value2, value3, value4, value5 }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
<\\/script>
|
<\\/script>`
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.sizes {
|
|
||||||
.p-inputtext {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: .5rem;
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.p-field * {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
</style>`
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue