Refactor #3797 - DeferredContent updates
parent
02307960ec
commit
f5f92807c5
|
@ -1,3 +1,12 @@
|
|||
const DeferredContentProps = [
|
||||
{
|
||||
name: 'pt',
|
||||
type: 'any',
|
||||
default: 'null',
|
||||
description: 'Uses to pass attributes to DOM elements inside the component.'
|
||||
}
|
||||
];
|
||||
|
||||
const DeferredContentEvents = [
|
||||
{
|
||||
name: 'load',
|
||||
|
@ -16,6 +25,7 @@ module.exports = {
|
|||
deferredcontent: {
|
||||
name: 'DeferredContent',
|
||||
description: 'DeferredContent postpones the loading the content that is initially not in the viewport until it becomes visible on scroll.',
|
||||
props: DeferredContentProps,
|
||||
events: DeferredContentEvents
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,7 +10,55 @@
|
|||
import { VNode } from 'vue';
|
||||
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
||||
|
||||
export interface DeferredContentProps {}
|
||||
export declare type DeferredContentPassThroughOptionType = DeferredContentPassThroughAttributes | ((options: DeferredContentPassThroughMethodOptions) => DeferredContentPassThroughAttributes) | null | undefined;
|
||||
|
||||
/**
|
||||
* Custom passthrough(pt) option method.
|
||||
*/
|
||||
export interface DeferredContentPassThroughMethodOptions {
|
||||
props: DeferredContentProps;
|
||||
state: DeferredContentState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom passthrough(pt) options.
|
||||
* @see {@link DeferredContentProps.pt}
|
||||
*/
|
||||
export interface DeferredContentPassThroughOptions {
|
||||
/**
|
||||
* Uses to pass attributes to the root's DOM element.
|
||||
*/
|
||||
root?: DeferredContentPassThroughOptionType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom passthrough attributes for each DOM elements
|
||||
*/
|
||||
export interface DeferredContentPassThroughAttributes {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines current inline state in DeferredContent component.
|
||||
*/
|
||||
export interface DeferredContentState {
|
||||
/**
|
||||
* Current loaded state as a boolean.
|
||||
* @defaultValue false
|
||||
*/
|
||||
loaded?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines valid props in DeferredContent component.
|
||||
*/
|
||||
export interface DeferredContentProps {
|
||||
/**
|
||||
* Uses to pass attributes to DOM elements inside the component.
|
||||
* @type {DeferredContentPassThroughOptions}
|
||||
*/
|
||||
pt?: DeferredContentPassThroughOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines valid slots in DeferredContent component.
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
<template>
|
||||
<div ref="container">
|
||||
<div ref="container" v-bind="ptm('root')">
|
||||
<slot v-if="loaded"></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ComponentBase from 'primevue/base';
|
||||
|
||||
export default {
|
||||
name: 'DeferredContent',
|
||||
extends: ComponentBase,
|
||||
emits: ['load'],
|
||||
data() {
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue