Merge branch 'v4' of https://github.com/primefaces/primevue into v4
commit
c926bbe82a
|
@ -342,12 +342,6 @@ const DataTableProps = [
|
||||||
default: 'null',
|
default: 'null',
|
||||||
description: 'Items of the frozen part in scrollable DataTable.'
|
description: 'Items of the frozen part in scrollable DataTable.'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'responsiveLayout',
|
|
||||||
type: 'string',
|
|
||||||
default: 'stack',
|
|
||||||
description: 'Defines the responsive mode, valid options are "stack" and "scroll".'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'breakpoint',
|
name: 'breakpoint',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|
|
@ -216,12 +216,6 @@ const TreeTableProps = [
|
||||||
default: 'null',
|
default: 'null',
|
||||||
description: 'Height of the scroll viewport in fixed units or the "flex" keyword for a dynamic size.'
|
description: 'Height of the scroll viewport in fixed units or the "flex" keyword for a dynamic size.'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'responsiveLayout',
|
|
||||||
type: 'string',
|
|
||||||
default: 'null',
|
|
||||||
description: 'Defines the responsive mode, currently only option is scroll.'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'size',
|
name: 'size',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|
|
@ -234,10 +234,6 @@ export default {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
responsiveLayout: {
|
|
||||||
type: String,
|
|
||||||
default: 'scroll'
|
|
||||||
},
|
|
||||||
breakpoint: {
|
breakpoint: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '960px'
|
default: '960px'
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
:data-p-cell-editing="d_editing"
|
:data-p-cell-editing="d_editing"
|
||||||
:data-p-frozen-column="columnProp('frozen')"
|
:data-p-frozen-column="columnProp('frozen')"
|
||||||
>
|
>
|
||||||
<span v-if="responsiveLayout === 'stack'" :class="cx('columnTitle')" v-bind="getColumnPT('columnTitle')">{{ columnProp('header') }}</span>
|
|
||||||
<component
|
<component
|
||||||
v-if="column.children && column.children.body && !d_editing"
|
v-if="column.children && column.children.body && !d_editing"
|
||||||
:is="column.children.body"
|
:is="column.children.body"
|
||||||
|
@ -189,10 +188,6 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
responsiveLayout: {
|
|
||||||
type: String,
|
|
||||||
default: 'stack'
|
|
||||||
},
|
|
||||||
virtualScrollerContentProps: {
|
virtualScrollerContentProps: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
|
|
|
@ -52,7 +52,6 @@
|
||||||
:editMode="editMode"
|
:editMode="editMode"
|
||||||
:editing="editMode === 'row' && isRowEditing"
|
:editing="editMode === 'row' && isRowEditing"
|
||||||
:editingMeta="editingMeta"
|
:editingMeta="editingMeta"
|
||||||
:responsiveLayout="responsiveLayout"
|
|
||||||
:virtualScrollerContentProps="virtualScrollerContentProps"
|
:virtualScrollerContentProps="virtualScrollerContentProps"
|
||||||
:ariaControls="expandedRowId + '_' + rowIndex + '_expansion'"
|
:ariaControls="expandedRowId + '_' + rowIndex + '_expansion'"
|
||||||
:name="nameAttributeSelector"
|
:name="nameAttributeSelector"
|
||||||
|
@ -250,10 +249,6 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
responsiveLayout: {
|
|
||||||
type: String,
|
|
||||||
default: 'stack'
|
|
||||||
},
|
|
||||||
editButtonProps: {
|
editButtonProps: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
|
|
|
@ -186,7 +186,7 @@ describe('DataTable.vue', () => {
|
||||||
Column
|
Column
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
<DataTable :value="sales" responsiveLayout="scroll">
|
<DataTable :value="sales">
|
||||||
<ColumnGroup type="header">
|
<ColumnGroup type="header">
|
||||||
<Row>
|
<Row>
|
||||||
<Column header="Product" :rowspan="3" />
|
<Column header="Product" :rowspan="3" />
|
||||||
|
@ -1257,8 +1257,7 @@ describe('DataTable.vue', () => {
|
||||||
sortOrder: 1,
|
sortOrder: 1,
|
||||||
scrollable: true,
|
scrollable: true,
|
||||||
expandableRowGroups: true,
|
expandableRowGroups: true,
|
||||||
expandedRowGroups: null,
|
expandedRowGroups: null
|
||||||
responsiveLayout: 'scroll'
|
|
||||||
},
|
},
|
||||||
slots: {
|
slots: {
|
||||||
default: `
|
default: `
|
||||||
|
@ -1333,8 +1332,7 @@ describe('DataTable.vue', () => {
|
||||||
sortMode: 'single',
|
sortMode: 'single',
|
||||||
sortField: 'name',
|
sortField: 'name',
|
||||||
sortOrder: 1,
|
sortOrder: 1,
|
||||||
scrollable: true,
|
scrollable: true
|
||||||
responsiveLayout: 'scroll'
|
|
||||||
},
|
},
|
||||||
slots: {
|
slots: {
|
||||||
default: `
|
default: `
|
||||||
|
@ -1397,16 +1395,5 @@ describe('DataTable.vue', () => {
|
||||||
|
|
||||||
// contextmenu
|
// contextmenu
|
||||||
|
|
||||||
// responsive
|
|
||||||
it('should have stack layout', async () => {
|
|
||||||
await wrapper.setProps({ responsiveLayout: 'stack' });
|
|
||||||
|
|
||||||
expect(wrapper.find('.p-datatable').classes()).toContain('p-datatable-responsive-stack');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have scroll layout', () => {
|
|
||||||
expect(wrapper.find('.p-datatable').classes()).toContain('p-datatable-responsive-scroll');
|
|
||||||
});
|
|
||||||
|
|
||||||
// row styling
|
// row styling
|
||||||
});
|
});
|
||||||
|
|
|
@ -130,7 +130,6 @@
|
||||||
:editingRows="editingRows"
|
:editingRows="editingRows"
|
||||||
:editingRowKeys="d_editingRowKeys"
|
:editingRowKeys="d_editingRowKeys"
|
||||||
:templates="$slots"
|
:templates="$slots"
|
||||||
:responsiveLayout="responsiveLayout"
|
|
||||||
:editButtonProps="rowEditButtonProps"
|
:editButtonProps="rowEditButtonProps"
|
||||||
:isVirtualScrollerDisabled="true"
|
:isVirtualScrollerDisabled="true"
|
||||||
@rowgroup-toggle="toggleRowGroup"
|
@rowgroup-toggle="toggleRowGroup"
|
||||||
|
@ -187,7 +186,6 @@
|
||||||
:editingRows="editingRows"
|
:editingRows="editingRows"
|
||||||
:editingRowKeys="d_editingRowKeys"
|
:editingRowKeys="d_editingRowKeys"
|
||||||
:templates="$slots"
|
:templates="$slots"
|
||||||
:responsiveLayout="responsiveLayout"
|
|
||||||
:editButtonProps="rowEditButtonProps"
|
:editButtonProps="rowEditButtonProps"
|
||||||
:virtualScrollerContentProps="slotProps"
|
:virtualScrollerContentProps="slotProps"
|
||||||
:isVirtualScrollerDisabled="virtualScrollerDisabled"
|
:isVirtualScrollerDisabled="virtualScrollerDisabled"
|
||||||
|
@ -425,10 +423,6 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$el.setAttribute(this.attributeSelector, '');
|
this.$el.setAttribute(this.attributeSelector, '');
|
||||||
|
|
||||||
if (this.responsiveLayout === 'stack' && !this.scrollable && !this.unstyled) {
|
|
||||||
this.createResponsiveStyle();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isStateful()) {
|
if (this.isStateful()) {
|
||||||
this.restoreState();
|
this.restoreState();
|
||||||
|
|
||||||
|
@ -442,7 +436,6 @@ export default {
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
this.unbindColumnResizeEvents();
|
this.unbindColumnResizeEvents();
|
||||||
this.destroyStyleElement();
|
this.destroyStyleElement();
|
||||||
this.destroyResponsiveStyle();
|
|
||||||
|
|
||||||
this.d_columns.clear();
|
this.d_columns.clear();
|
||||||
this.d_columnGroups.clear();
|
this.d_columnGroups.clear();
|
||||||
|
@ -1911,55 +1904,6 @@ export default {
|
||||||
DomHandler.setAttribute(this.styleElement, 'nonce', this.$primevue?.config?.csp?.nonce);
|
DomHandler.setAttribute(this.styleElement, 'nonce', this.$primevue?.config?.csp?.nonce);
|
||||||
document.head.appendChild(this.styleElement);
|
document.head.appendChild(this.styleElement);
|
||||||
},
|
},
|
||||||
createResponsiveStyle() {
|
|
||||||
if (!this.responsiveStyleElement) {
|
|
||||||
this.responsiveStyleElement = document.createElement('style');
|
|
||||||
this.responsiveStyleElement.type = 'text/css';
|
|
||||||
DomHandler.setAttribute(this.responsiveStyleElement, 'nonce', this.$primevue?.config?.csp?.nonce);
|
|
||||||
document.head.appendChild(this.responsiveStyleElement);
|
|
||||||
|
|
||||||
let tableSelector = `.p-datatable-table-container ${this.virtualScrollerDisabled ? '' : '> .p-virtualscroller'} > .p-datatable-table`;
|
|
||||||
let selector = `.p-datatable[${this.attributeSelector}] > ${tableSelector}`;
|
|
||||||
let gridLinesSelector = `.p-datatable[${this.attributeSelector}].p-datatable-gridlines > ${tableSelector}`;
|
|
||||||
let innerHTML = `
|
|
||||||
@media screen and (max-width: ${this.breakpoint}) {
|
|
||||||
${selector} > .p-datatable-thead > tr > th,
|
|
||||||
${selector} > .p-datatable-tfoot > tr > td {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
${selector} > .p-datatable-tbody > tr > td {
|
|
||||||
display: flex;
|
|
||||||
width: 100%;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
${selector} > .p-datatable-tbody > tr > td:not(:last-child) {
|
|
||||||
border: 0 none;
|
|
||||||
}
|
|
||||||
|
|
||||||
${gridLinesSelector} > .p-datatable-tbody > tr > td:last-child {
|
|
||||||
border-top: 0;
|
|
||||||
border-right: 0;
|
|
||||||
border-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
${selector} > .p-datatable-tbody > tr > td > .p-column-title {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
this.responsiveStyleElement.innerHTML = innerHTML;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
destroyResponsiveStyle() {
|
|
||||||
if (this.responsiveStyleElement) {
|
|
||||||
document.head.removeChild(this.responsiveStyleElement);
|
|
||||||
this.responsiveStyleElement = null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
destroyStyleElement() {
|
destroyStyleElement() {
|
||||||
if (this.styleElement) {
|
if (this.styleElement) {
|
||||||
document.head.removeChild(this.styleElement);
|
document.head.removeChild(this.styleElement);
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
:editingRowKeys="editingRowKeys"
|
:editingRowKeys="editingRowKeys"
|
||||||
:templates="templates"
|
:templates="templates"
|
||||||
:editButtonProps="editButtonProps"
|
:editButtonProps="editButtonProps"
|
||||||
:responsiveLayout="responsiveLayout"
|
|
||||||
:virtualScrollerContentProps="virtualScrollerContentProps"
|
:virtualScrollerContentProps="virtualScrollerContentProps"
|
||||||
:isVirtualScrollerDisabled="isVirtualScrollerDisabled"
|
:isVirtualScrollerDisabled="isVirtualScrollerDisabled"
|
||||||
:editingMeta="editingMeta"
|
:editingMeta="editingMeta"
|
||||||
|
@ -216,10 +215,6 @@ export default {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
responsiveLayout: {
|
|
||||||
type: String,
|
|
||||||
default: 'stack'
|
|
||||||
},
|
|
||||||
virtualScrollerContentProps: {
|
virtualScrollerContentProps: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: null
|
default: null
|
||||||
|
|
|
@ -154,10 +154,6 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: null
|
default: null
|
||||||
},
|
},
|
||||||
responsiveLayout: {
|
|
||||||
type: String,
|
|
||||||
default: 'scroll'
|
|
||||||
},
|
|
||||||
size: {
|
size: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null
|
default: null
|
||||||
|
|
|
@ -445,8 +445,7 @@ p-treetable-gridlines .p-treetable-tbody > tr:last-child>td {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.p-treetable .p-treetable-row-checkbox {
|
.p-treetable .p-treetable-node-checkbox {
|
||||||
vertical-align: middle;
|
|
||||||
margin-right: 0.5rem;
|
margin-right: 0.5rem;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
Loading…
Reference in New Issue