Refactor #3797 - ScrollPanel updates
parent
f5f92807c5
commit
094245e2d3
|
@ -4,6 +4,12 @@ const ScrollPanelProps = [
|
||||||
type: 'number',
|
type: 'number',
|
||||||
default: '5',
|
default: '5',
|
||||||
description: 'Step factor to scroll the content while pressing the arrow keys.'
|
description: 'Step factor to scroll the content while pressing the arrow keys.'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'pt',
|
||||||
|
type: 'any',
|
||||||
|
default: 'null',
|
||||||
|
description: 'Uses to pass attributes to DOM elements inside the component.'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,75 @@
|
||||||
import { VNode } from 'vue';
|
import { VNode } from 'vue';
|
||||||
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers';
|
||||||
|
|
||||||
|
export declare type ScrollPanelPassThroughOptionType = ScrollPanelPassThroughAttributes | ((options: ScrollPanelPassThroughMethodOptions) => ScrollPanelPassThroughAttributes) | null | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom passthrough(pt) option method.
|
||||||
|
*/
|
||||||
|
export interface ScrollPanelPassThroughMethodOptions {
|
||||||
|
props: ScrollPanelProps;
|
||||||
|
state: ScrollPanelState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom passthrough(pt) options.
|
||||||
|
* @see {@link ScrollPanelProps.pt}
|
||||||
|
*/
|
||||||
|
export interface ScrollPanelPassThroughOptions {
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to the root's DOM element.
|
||||||
|
*/
|
||||||
|
root?: ScrollPanelPassThroughOptionType;
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to the wrapper's DOM element.
|
||||||
|
*/
|
||||||
|
wrapper?: ScrollPanelPassThroughOptionType;
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to the content's DOM element.
|
||||||
|
*/
|
||||||
|
content?: ScrollPanelPassThroughOptionType;
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to the horizontal panel's DOM element.
|
||||||
|
*/
|
||||||
|
barx?: ScrollPanelPassThroughOptionType;
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to the vertical panel's DOM element.
|
||||||
|
*/
|
||||||
|
bary?: ScrollPanelPassThroughOptionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom passthrough attributes for each DOM elements
|
||||||
|
*/
|
||||||
|
export interface ScrollPanelPassThroughAttributes {
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines current inline state in Panel component.
|
||||||
|
*/
|
||||||
|
export interface ScrollPanelState {
|
||||||
|
/**
|
||||||
|
* Current id state as a string.
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* Current scrollpanel orientation.
|
||||||
|
* @defaultValue vertical
|
||||||
|
*/
|
||||||
|
orientation: string;
|
||||||
|
/**
|
||||||
|
* Latest scroll top position.
|
||||||
|
* @defaultValue 0
|
||||||
|
*/
|
||||||
|
lastScrollTop: number;
|
||||||
|
/**
|
||||||
|
* Latest scroll left position.
|
||||||
|
* @defaultValue 0
|
||||||
|
*/
|
||||||
|
lastScrollLeft: number;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines valid properties in ScrollPanel component.
|
* Defines valid properties in ScrollPanel component.
|
||||||
*/
|
*/
|
||||||
|
@ -19,6 +88,11 @@ export interface ScrollPanelProps {
|
||||||
* @defaultValue 5
|
* @defaultValue 5
|
||||||
*/
|
*/
|
||||||
step?: number | undefined;
|
step?: number | undefined;
|
||||||
|
/**
|
||||||
|
* Uses to pass attributes to DOM elements inside the component.
|
||||||
|
* @type {ScrollPanelPassThroughOptions}
|
||||||
|
*/
|
||||||
|
pt?: ScrollPanelPassThroughOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="p-scrollpanel p-component">
|
<div class="p-scrollpanel p-component" v-bind="ptm('root')">
|
||||||
<div class="p-scrollpanel-wrapper">
|
<div class="p-scrollpanel-wrapper" v-bind="ptm('wrapper')">
|
||||||
<div ref="content" class="p-scrollpanel-content" @scroll="onScroll" @mouseenter="moveBar">
|
<div ref="content" class="p-scrollpanel-content" @scroll="onScroll" @mouseenter="moveBar" v-bind="ptm('content')">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,6 +17,7 @@
|
||||||
@keyup="onKeyUp"
|
@keyup="onKeyUp"
|
||||||
@focus="onFocus"
|
@focus="onFocus"
|
||||||
@blur="onBlur"
|
@blur="onBlur"
|
||||||
|
v-bind="ptm('barx')"
|
||||||
></div>
|
></div>
|
||||||
<div
|
<div
|
||||||
ref="yBar"
|
ref="yBar"
|
||||||
|
@ -29,15 +30,18 @@
|
||||||
@keydown="onKeyDown($event)"
|
@keydown="onKeyDown($event)"
|
||||||
@keyup="onKeyUp"
|
@keyup="onKeyUp"
|
||||||
@focus="onFocus"
|
@focus="onFocus"
|
||||||
|
v-bind="ptm('bary')"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import ComponentBase from 'primevue/base';
|
||||||
import { DomHandler, UniqueComponentId } from 'primevue/utils';
|
import { DomHandler, UniqueComponentId } from 'primevue/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ScrollPanel',
|
name: 'ScrollPanel',
|
||||||
|
extends: ComponentBase,
|
||||||
props: {
|
props: {
|
||||||
step: {
|
step: {
|
||||||
type: Number,
|
type: Number,
|
||||||
|
|
Loading…
Reference in New Issue