Skip to content

Commit

Permalink
Merge branch 'v4' of https://github.com/primefaces/primevue into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Mar 26, 2024
2 parents e0865bf + 636c89e commit 6ddb850
Show file tree
Hide file tree
Showing 37 changed files with 191 additions and 431 deletions.
35 changes: 0 additions & 35 deletions api-generator/components/dataviewlayoutoptions.js

This file was deleted.

2 changes: 0 additions & 2 deletions components/doc/codeeditor/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ import ConfirmationService from 'primevue/confirmationservice';
import ContextMenu from 'primevue/contextmenu';
import DataTable from 'primevue/datatable';
import DataView from 'primevue/dataview';
import DataViewLayoutOptions from 'primevue/dataviewlayoutoptions';
import DeferredContent from 'primevue/deferredcontent';
import Dialog from 'primevue/dialog';
import DialogService from 'primevue/dialogservice'
Expand Down Expand Up @@ -294,7 +293,6 @@ app.component('ConfirmPopup', ConfirmPopup);
app.component('ContextMenu', ContextMenu);
app.component('DataTable', DataTable);
app.component('DataView', DataView);
app.component('DataViewLayoutOptions', DataViewLayoutOptions);
app.component('DeferredContent', DeferredContent);
app.component('Dialog', Dialog);
app.component('Divider', Divider);
Expand Down
2 changes: 0 additions & 2 deletions components/lib/config/PrimeVue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { ConfirmPopupPassThroughOptions } from '../confirmpopup';
import { ContextMenuPassThroughOptions } from '../contextmenu';
import { DataTablePassThroughOptions } from '../datatable';
import { DataViewPassThroughOptions } from '../dataview';
import { DataViewLayoutOptionsPassThroughOptions } from '../dataviewlayoutoptions';
import { DeferredContentPassThroughOptions } from '../deferredcontent';
import { DialogPassThroughOptions } from '../dialog';
import { DividerPassThroughOptions } from '../divider';
Expand Down Expand Up @@ -148,7 +147,6 @@ export interface PrimeVuePTOptions {
contextmenu?: DefaultPassThrough<ContextMenuPassThroughOptions>;
datatable?: DefaultPassThrough<DataTablePassThroughOptions>;
dataview?: DefaultPassThrough<DataViewPassThroughOptions>;
dataviewlayoutoptions?: DefaultPassThrough<DataViewLayoutOptionsPassThroughOptions>;
deferredcontent?: DefaultPassThrough<DeferredContentPassThroughOptions>;
divider?: DefaultPassThrough<DividerPassThroughOptions>;
dialog?: DefaultPassThrough<DialogPassThroughOptions>;
Expand Down
11 changes: 11 additions & 0 deletions components/lib/datatable/BaseDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,17 @@ export default {
filterInputProps: {
type: null,
default: null
},
filterButtonProps: {
type: Object,
default() {
return {
addRule: { severity: 'info', text: true, size: 'small' },
removeRule: { severity: 'danger', text: true, size: 'small' },
apply: { size: 'small' },
clear: { outlined: true, size: 'small' }
};
}
}
},
style: DataTableStyle,
Expand Down
26 changes: 17 additions & 9 deletions components/lib/datatable/ColumnFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@
@click="removeConstraint(i)"
:label="removeRuleButtonLabel"
:unstyled="unstyled"
text
severity="danger"
size="small"
v-bind="filterButtonProps.removeRule"
:pt="getColumnPT('filterRemoveButton')"
>
<template #icon="iconProps">
Expand All @@ -114,9 +112,7 @@
:class="cx('filterAddRuleButton')"
@click="addConstraint()"
:unstyled="unstyled"
text
severity="info"
size="small"
v-bind="filterButtonProps.addRule"
:pt="getColumnPT('filterAddRuleButton')"
>
<template #icon="iconProps">
Expand All @@ -132,13 +128,21 @@
:label="clearButtonLabel"
@click="clearFilter"
:unstyled="unstyled"
size="small"
outlined
v-bind="filterButtonProps.clear"
:pt="getColumnPT('filterClearButton')"
></CFButton>
<component v-else :is="filterClearTemplate" :field="field" :filterModel="filters[field]" :filterCallback="clearFilter" />
<template v-if="showApplyButton">
<CFButton v-if="!filterApplyTemplate" type="button" :class="cx('filterApplyButton')" :label="applyButtonLabel" @click="applyFilter()" :unstyled="unstyled" size="small" :pt="getColumnPT('filterApplyButton')"></CFButton>
<CFButton
v-if="!filterApplyTemplate"
type="button"
:class="cx('filterApplyButton')"
:label="applyButtonLabel"
@click="applyFilter()"
:unstyled="unstyled"
v-bind="filterButtonProps.apply"
:pt="getColumnPT('filterApplyButton')"
></CFButton>
<component v-else :is="filterApplyTemplate" :field="field" :filterModel="filters[field]" :filterCallback="applyFilter" />
</template>
</div>
Expand Down Expand Up @@ -275,6 +279,10 @@ export default {
type: null,
default: null
},
filterButtonProps: {
type: null,
default: null
},
column: null
},
data() {
Expand Down
33 changes: 33 additions & 0 deletions components/lib/datatable/DataTable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
import { InputHTMLAttributes, TableHTMLAttributes, TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { ButtonProps } from '../button';
import { ColumnPassThroughOptionType } from '../column';
import { ColumnGroupPassThroughOptionType } from '../columngroup';
import { PaginatorPassThroughOptionType } from '../paginator';
Expand Down Expand Up @@ -159,6 +160,28 @@ export interface DataTableExportCSVOptions {
selectionOnly: boolean;
}

/**
* Custom datatable filter button props options.
*/
export interface DataTableFilterButtonPropsOptions {
/**
* Add rule button props
*/
addRule: ButtonProps | undefined;
/**
* Remove rule button props
*/
removeRule: ButtonProps | undefined;
/**
* Apply button props
*/
apply: ButtonProps | undefined;
/**
* Apply button props
*/
clear: ButtonProps | undefined;
}

/**
* Custom sort event.
* @see {@link DataTableEmits.sort}
Expand Down Expand Up @@ -1130,6 +1153,16 @@ export interface DataTableProps {
* Used to pass all properties of the HTMLInputElement to the focusable filter input element inside the component.
*/
filterInputProps?: InputHTMLAttributes | undefined;
/**
* Used to pass all filter button property object
* @defaultValue {
addRule: { severity: 'info', text: true, size: 'small' },
removeRule: { severity: 'danger', text: true, size: 'small' },
apply: { size: 'small' },
clear: { outlined: true, size: 'small' }
}
*/
filterButtonProps?: DataTableFilterButtonPropsOptions | undefined;
/**
* Used to pass attributes to DOM elements inside the component.
* @type {DataTablePassThroughOptions}
Expand Down
12 changes: 12 additions & 0 deletions components/lib/datatable/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
:filters="d_filters"
:filtersStore="filters"
:filterDisplay="filterDisplay"
:filterButtonProps="headerFilterButtonProps"
:filterInputProps="filterInputProps"
:first="d_first"
@column-click="onColumnHeaderClick($event)"
Expand Down Expand Up @@ -2069,6 +2070,17 @@ export default {
groupRowSortField() {
return this.sortMode === 'single' ? this.sortField : this.d_groupRowsSortMeta ? this.d_groupRowsSortMeta.field : null;
},
headerFilterButtonProps() {
return {
...{
addRule: { severity: 'info', text: true, size: 'small' },
removeRule: { severity: 'danger', text: true, size: 'small' },
apply: { size: 'small' },
clear: { outlined: true, size: 'small' }
},
...this.filterButtonProps
};
},
virtualScrollerDisabled() {
return ObjectUtils.isEmpty(this.virtualScrollerOptions) || !this.scrollable;
}
Expand Down
5 changes: 5 additions & 0 deletions components/lib/datatable/HeaderCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
:filters="filters"
:filtersStore="filtersStore"
:filterInputProps="filterInputProps"
:filterButtonProps="filterButtonProps"
@filter-change="$emit('filter-change', $event)"
@filter-apply="$emit('filter-apply')"
:filterMenuStyle="columnProp('filterMenuStyle')"
Expand Down Expand Up @@ -182,6 +183,10 @@ export default {
filterInputProps: {
type: null,
default: null
},
filterButtonProps: {
type: null,
default: null
}
},
data() {
Expand Down
6 changes: 6 additions & 0 deletions components/lib/datatable/TableHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
:filterDisplay="filterDisplay"
:filtersStore="filtersStore"
:filterInputProps="filterInputProps"
:filterButtonProps="filterButtonProps"
:first="first"
@filter-change="$emit('filter-change', $event)"
@filter-apply="$emit('filter-apply')"
Expand Down Expand Up @@ -69,6 +70,7 @@
:filters="filters"
:filtersStore="filtersStore"
:filterInputProps="filterInputProps"
:filterButtonProps="filterButtonProps"
@filter-change="$emit('filter-change', $event)"
@filter-apply="$emit('filter-apply')"
:filterMenuStyle="columnProp(col, 'filterMenuStyle')"
Expand Down Expand Up @@ -231,6 +233,10 @@ export default {
filterInputProps: {
type: null,
default: null
},
filterButtonProps: {
type: null,
default: null
}
},
provide() {
Expand Down
2 changes: 1 addition & 1 deletion components/lib/dataview/DataView.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export interface DataViewEmits {
}

/**
* **PrimeVue - DataViewLayoutOptions**
* **PrimeVue - DataView**
*
* _DataView displays data in grid or list layout with pagination and sorting features._
*
Expand Down
18 changes: 0 additions & 18 deletions components/lib/dataviewlayoutoptions/BaseDataViewLayoutOptions.vue

This file was deleted.

Loading

0 comments on commit 6ddb850

Please sign in to comment.