Refactor #3911 - For InlineMessage
parent
a1f4595686
commit
ca5201e973
|
@ -10,6 +10,12 @@ const InlineMessageProps = [
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: 'undefined',
|
default: 'undefined',
|
||||||
description: 'Display a custom icon for the message.'
|
description: 'Display a custom icon for the message.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'pt',
|
||||||
|
type: 'any',
|
||||||
|
default: 'null',
|
||||||
|
description: 'Uses to pass attributes to DOM elements inside the component.'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,53 @@
|
||||||
import { VNode } from 'vue';
|
import { VNode } from 'vue';
|
||||||
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
||||||
|
|
||||||
|
export declare type InlineMessagePassThroughOptionType = InlineMessagePassThroughAttributes | ((options: InlineMessagePassThroughMethodOptions) => InlineMessagePassThroughAttributes) | null | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom passthrough(pt) option method.
|
||||||
|
*/
|
||||||
|
export interface InlineMessagePassThroughMethodOptions {
|
||||||
|
props: InlineMessageProps;
|
||||||
|
state: InlineMessageState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom passthrough(pt) options.
|
||||||
|
* @see {@link InlineMessageProps.pt}
|
||||||
|
*/
|
||||||
|
export interface InlineMessagePassThroughOptions {
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to the root's DOM element.
|
||||||
|
*/
|
||||||
|
root?: InlineMessagePassThroughOptionType;
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to the icon's DOM element.
|
||||||
|
*/
|
||||||
|
icon?: InlineMessagePassThroughOptionType;
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to the text's DOM element.
|
||||||
|
*/
|
||||||
|
text?: InlineMessagePassThroughOptionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom passthrough attributes for each DOM elements
|
||||||
|
*/
|
||||||
|
export interface InlineMessagePassThroughAttributes {
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines current inline state in InlineMessage component.
|
||||||
|
*/
|
||||||
|
export interface InlineMessageState {
|
||||||
|
/**
|
||||||
|
* Current visible state as a boolean.
|
||||||
|
* @defaultValue false
|
||||||
|
*/
|
||||||
|
visible: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines valid properties in InlineMessage component.
|
* Defines valid properties in InlineMessage component.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<div aria-live="polite" :class="containerClass">
|
<div aria-live="polite" :class="containerClass" v-bind="ptm('root')">
|
||||||
<slot name="icon">
|
<slot name="icon">
|
||||||
<component :is="icon ? 'span' : iconComponent" :class="['p-inline-message-icon', icon]"></component>
|
<component :is="icon ? 'span' : iconComponent" :class="['p-inline-message-icon', icon]" v-bind="ptm('icon')"></component>
|
||||||
</slot>
|
</slot>
|
||||||
<span class="p-inline-message-text"><slot> </slot></span>
|
<span class="p-inline-message-text" v-bind="ptm('text')">
|
||||||
|
<slot> </slot>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import BaseComponent from 'primevue/basecomponent';
|
||||||
import CheckIcon from 'primevue/icons/check';
|
import CheckIcon from 'primevue/icons/check';
|
||||||
import ExclamationTriangleIcon from 'primevue/icons/exclamationtriangle';
|
import ExclamationTriangleIcon from 'primevue/icons/exclamationtriangle';
|
||||||
import InfoCircleIcon from 'primevue/icons/infocircle';
|
import InfoCircleIcon from 'primevue/icons/infocircle';
|
||||||
|
@ -15,6 +18,7 @@ import TimesCircleIcon from 'primevue/icons/timescircle';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'InlineMessage',
|
name: 'InlineMessage',
|
||||||
|
extends: BaseComponent,
|
||||||
props: {
|
props: {
|
||||||
severity: {
|
severity: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
Loading…
Reference in New Issue