Refactor #3965 - For Toolbar
parent
3ce238b07f
commit
a21c83e927
|
@ -0,0 +1,57 @@
|
|||
<script>
|
||||
import BaseComponent from 'primevue/basecomponent';
|
||||
import { useStyle } from 'primevue/usestyle';
|
||||
|
||||
const styles = `
|
||||
.p-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.p-toolbar-group-start,
|
||||
.p-toolbar-group-center,
|
||||
.p-toolbar-group-end {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.p-toolbar-group-left,
|
||||
.p-toolbar-group-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
`;
|
||||
|
||||
const classes = {
|
||||
root: 'p-toolbar p-component',
|
||||
start: 'p-toolbar-group-start p-toolbar-group-left',
|
||||
center: 'p-toolbar-group-center',
|
||||
end: 'p-toolbar-group-end p-toolbar-group-right'
|
||||
};
|
||||
|
||||
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_toolbar_style', manual: true });
|
||||
|
||||
export default {
|
||||
name: 'BaseToolbar',
|
||||
extends: BaseComponent,
|
||||
props: {
|
||||
'aria-labelledby': {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
css: {
|
||||
classes
|
||||
},
|
||||
watch: {
|
||||
isUnstyled: {
|
||||
immediate: true,
|
||||
handler(newValue) {
|
||||
!newValue && loadStyle();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -62,6 +62,11 @@ export interface ToolbarProps {
|
|||
* @type {ToolbarPassThroughOptions}
|
||||
*/
|
||||
pt?: ToolbarPassThroughOptions;
|
||||
/**
|
||||
* When enabled, it removes component related styles in the core.
|
||||
* @defaultValue false
|
||||
*/
|
||||
unstyled?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,49 +1,22 @@
|
|||
<template>
|
||||
<div class="p-toolbar p-component" role="toolbar" :aria-labelledby="ariaLabelledby" v-bind="ptm('root')">
|
||||
<div class="p-toolbar-group-start p-toolbar-group-left" v-bind="ptm('start')">
|
||||
<div :class="cx('root')" role="toolbar" :aria-labelledby="ariaLabelledby" data-pc-name="toolbar" data-pc-section="root" v-bind="ptm('root')">
|
||||
<div :class="cx('start')" data-pc-section="start" v-bind="ptm('start')">
|
||||
<slot name="start"></slot>
|
||||
</div>
|
||||
<div class="p-toolbar-group-center" v-bind="ptm('center')">
|
||||
<div :class="cx('center')" data-pc-section="center" v-bind="ptm('center')">
|
||||
<slot name="center"></slot>
|
||||
</div>
|
||||
<div class="p-toolbar-group-end p-toolbar-group-right" v-bind="ptm('end')">
|
||||
<div :class="cx('end')" data-pc-section="end" v-bind="ptm('end')">
|
||||
<slot name="end"></slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseComponent from 'primevue/basecomponent';
|
||||
import BaseToolbar from './BaseToolbar.vue';
|
||||
|
||||
export default {
|
||||
name: 'Toolbar',
|
||||
extends: BaseComponent,
|
||||
props: {
|
||||
'aria-labelledby': {
|
||||
type: String,
|
||||
default: null
|
||||
}
|
||||
}
|
||||
extends: BaseToolbar
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.p-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.p-toolbar-group-start,
|
||||
.p-toolbar-group-center,
|
||||
.p-toolbar-group-end {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.p-toolbar-group-left,
|
||||
.p-toolbar-group-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue