Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dataviews package version to latest #93503

Merged
merged 102 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
64d7ab3
Update dataviews package version.
allilevine Aug 13, 2024
265c222
Revert renovate lock.
allilevine Aug 13, 2024
00837ee
Small style fixes
youknowriad Aug 15, 2024
9b5f39e
Update API and types
youknowriad Aug 15, 2024
7fa3b56
Import root dataviews styles
youknowriad Aug 15, 2024
7c4f5df
Update types and dataviews in a4a project
youknowriad Aug 15, 2024
3c4732e
Fix preview
youknowriad Aug 15, 2024
47a9bff
Fix lock
youknowriad Aug 15, 2024
d724339
Fix more type errors
youknowriad Aug 16, 2024
7b7873d
Remove status
youknowriad Aug 16, 2024
f94b890
More style fixes
youknowriad Aug 16, 2024
da2e38e
Remove patch
youknowriad Aug 16, 2024
38b288c
Fix column widths
youknowriad Aug 16, 2024
5b61986
Better styles
youknowriad Aug 16, 2024
8e19870
Fix empty properties section
youknowriad Aug 16, 2024
2b15db7
Fix scrolling and pagination
youknowriad Aug 16, 2024
21e1730
Hide overflow and align padding to improve mobile view.
allilevine Aug 16, 2024
ad59940
Override launch nag and site url link styles.
allilevine Aug 16, 2024
ff750f5
Override styles for the plan renew reminder.
allilevine Aug 16, 2024
6c987fd
Fix type error.
allilevine Aug 16, 2024
cbc04ba
Style search input.
allilevine Aug 16, 2024
86f3680
Remove dotcom-specific search styles.
allilevine Aug 19, 2024
59c05aa
Update the view fields based on useBreakpoint.
allilevine Aug 19, 2024
bf4bf43
Consider list layout as well
oandregal Aug 20, 2024
2859c38
Update header to label in a4a fields
oandregal Aug 20, 2024
06dda8c
Make status filter primary
oandregal Aug 22, 2024
0a4e785
Fix color for disabled dataviews buttons
oandregal Aug 22, 2024
6af0b84
Fix code style issue.
allilevine Aug 22, 2024
f78f694
Make status filter primary in a4a
oandregal Aug 23, 2024
495d6dc
Update list of fields for a4a dataviews
oandregal Aug 23, 2024
7a9c97f
Remove spacing that affect filter toggel
oandregal Aug 23, 2024
063739c
Extract defaultLayouts to ItemsData
oandregal Aug 23, 2024
c24f9a8
Remove field list
oandregal Aug 23, 2024
4339080
Do not modify global constant.
oandregal Aug 23, 2024
dde58ee
Only have table enabled for users
oandregal Aug 23, 2024
61c7698
Rename header to labels
oandregal Aug 23, 2024
678d794
Hide filter toggle
oandregal Aug 23, 2024
ce3a01a
Remove search control width to prevent new line.
allilevine Aug 23, 2024
b475361
Only have table enabled for hosting/sites
oandregal Aug 26, 2024
274d3ce
TeamList: only have table enabled
oandregal Aug 26, 2024
fbf38fb
TeamList: hide filter toggle
oandregal Aug 26, 2024
a55433f
TeamList: switch header to label
oandregal Aug 26, 2024
48df603
TeamList: move field.width to layout.styles.fieldId.width
oandregal Aug 26, 2024
03d37fe
A4A: Remove the .is-hiding-navigation style, the navigation bar is no…
cleacos Aug 26, 2024
fda3edd
A4A-Referrals: Hide the DataViews toolbar for Referrals tables
cleacos Aug 26, 2024
c627fab
A4A-Team: Hide the DataViews toolbar for Team list table
cleacos Aug 26, 2024
2d1edd0
A4A-Referrals: Hide the DataViews toolbar for ReferralDetails table
cleacos Aug 26, 2024
5c5e5c7
A4A-Referrals: Set the defaultLayouts to table
cleacos Aug 26, 2024
5470013
A4A-Referrals: Use label instead of header in fields definition.
cleacos Aug 26, 2024
c36a5d8
A4A-Referrals: Use the Field type for fields definition
cleacos Aug 26, 2024
1277798
Revert "A4A-Team: Hide the DataViews toolbar for Team list table"
oandregal Aug 27, 2024
4569363
Revert "A4A-Referrals: Hide the DataViews toolbar for ReferralDetails…
oandregal Aug 27, 2024
b4b6f4a
Revert "A4A-Referrals: Hide the DataViews toolbar for Referrals tables"
oandregal Aug 27, 2024
2419fe7
Centralize hotfixes into components/dataviews so they are straigtforw…
oandregal Aug 27, 2024
c836b87
Referrals: hotfix for hiding filter toggle
oandregal Aug 27, 2024
159aefd
A4A Referrals: hotfix for hiding sort direction control
oandregal Aug 27, 2024
fdd8056
A4A team: hotfix for hiding sort direction control
oandregal Aug 27, 2024
0776744
A4A Sites: hotfix for hiding sort direction control
oandregal Aug 27, 2024
47f83ed
Add comment explaining hotfix
oandregal Aug 27, 2024
5dec45e
A4A Team: add pagination
oandregal Aug 27, 2024
88c537e
A4A Referrals: add pagination
oandregal Aug 27, 2024
13b360b
A4A Referrals details: add pagination
oandregal Aug 27, 2024
d4c10a6
A4A Sites Modal: add pagination
oandregal Aug 28, 2024
5cb568e
Update @wordpress/dataviews to latest version
oandregal Aug 28, 2024
7ab980e
Update yarn.lock
oandregal Aug 28, 2024
580983f
Remove hotfix to hide filter toggle that is part of dataviews 4.2
oandregal Aug 28, 2024
3c3c0dc
Dotcom Sites: remove custom sort
oandregal Aug 28, 2024
f5f0395
Hotfix for filter count
oandregal Aug 28, 2024
ea03403
A4A Sites: remove custom sort
oandregal Aug 28, 2024
f987d42
A4A sites: add actions label
oandregal Aug 28, 2024
655c0ac
A4A Sites: remove background color for actions
oandregal Aug 28, 2024
481214c
A4A Referrals: remove background style for actions
oandregal Aug 28, 2024
9a0f37c
A4A Referrals Details: hotfix for media placeholder to fill the whole…
oandregal Aug 28, 2024
d728fb4
A4A Referrals Details: hotfix for media field
oandregal Aug 28, 2024
5fb3ab8
A4A Referrals Details: remove custom spacing
oandregal Aug 28, 2024
bd2c4bf
ItemsDataViews: add missing props
oandregal Aug 28, 2024
6f3bc17
A4A Referral Details: adapt selection (string) to openSitePreviewPane…
oandregal Aug 28, 2024
dbebe65
A4A Sites: fix favorite behaviour by making sure the queryKey is the …
oandregal Aug 29, 2024
e82ca74
Hotfix for filter chip summary: font-size
oandregal Aug 30, 2024
ddc0bae
Add reference to upstream ticket
oandregal Aug 30, 2024
d9dbde9
Hotfix for filter chip summary (font-size): consider filter with no s…
oandregal Aug 30, 2024
7d32d94
Do not override the filter toggle pressed status
oandregal Aug 30, 2024
02f182d
A4A Referrals clients: hide sort control
oandregal Aug 30, 2024
6cd7fa3
A4A Referrals Client: configure dataviews
oandregal Aug 30, 2024
9801fa2
A4A: remove left margin in columns that makes them off center
oandregal Aug 30, 2024
a778d02
A4A Referrals Client: stop infinite loop
oandregal Aug 30, 2024
3c0dd09
Fix errors in TeamList component.
allilevine Aug 30, 2024
3e5ec38
Fix type errors.
allilevine Aug 30, 2024
a0b547c
Fix type error in jetpack-sites-dataviews.
allilevine Aug 30, 2024
74ddd8a
Update DataViews to 4.2.0
allilevine Aug 30, 2024
877b765
Warning/Error row style fixes: padding styles
cleacos Sep 3, 2024
32f0dbf
Set again the enable field to true for the useQuery of useFetchClient…
cleacos Sep 3, 2024
16c0067
Pass false useFetchClientProducts( false ) in CancelSubscriptionConfi…
cleacos Sep 3, 2024
7d12881
Show A4A fields based on breakpoint.
allilevine Sep 3, 2024
2641c52
Show column headers for Dotcom.
allilevine Sep 3, 2024
ede0092
Update fields & layout width on breakpoint changes
oandregal Sep 4, 2024
7600812
A4A Sites: update fields on breakpoint change
oandregal Sep 4, 2024
7fa6ed9
A4A Sites: hotfix for site notice
oandregal Sep 4, 2024
0256fcf
A4A Sites: improve spacing by removing custom styles
oandregal Sep 4, 2024
0024bbe
A4A Sites: improve actions padding in small viewports
oandregal Sep 4, 2024
3f33899
A4A Sites: improve actions padding in large viewports
oandregal Sep 4, 2024
85aa769
A4A Sites: add back shadow for action columns
oandregal Sep 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 0 additions & 87 deletions .yarn/patches/@wordpress-dataviews-npm-0.4.1-2c01fa0792.patch

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ export default function useManagedSitesMap( { size = 100 }: Props ) {
isPartnerOAuthTokenLoaded: false,
searchQuery: '',
currentPage: 1,
sort: {
field: '',
direction: '',
},
perPage: size,
agencyId,
filter: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
import { useState, useEffect } from 'react';
import { filterSortAndPaginate } from '@wordpress/dataviews';
import { useMemo, useState, useEffect } from 'react';
import { initialDataViewsState } from 'calypso/a8c-for-agencies/components/items-dashboard/constants';
import ItemsDataViews from 'calypso/a8c-for-agencies/components/items-dashboard/items-dataviews';
import { SiteItem } from './wpcom-sites-table';
import type { DataViewsColumn } from '../../items-dashboard/items-dataviews/interfaces';
import type { Field } from '@wordpress/dataviews';

interface Props {
items: SiteItem[];
fields: DataViewsColumn[];
fields: Field< any >[];
}

export default function WPCOMSitesTableContent( { items, fields }: Props ) {
const [ dataViewsState, setDataViewsState ] = useState( initialDataViewsState );

const { data, paginationInfo } = useMemo( () => {
return filterSortAndPaginate( items, dataViewsState, fields );
}, [ items, dataViewsState, fields ] );

useEffect( () => {
if ( items.length ) {
if ( data.length ) {
const handleRowClick = ( event: Event ) => {
const target = event.target as HTMLElement;

Expand Down Expand Up @@ -51,22 +56,20 @@ export default function WPCOMSitesTableContent( { items, fields }: Props ) {
}
};
}
}, [ dataViewsState, items ] );
}, [ dataViewsState, data ] );

return (
<ItemsDataViews
data={ {
items,
items: data,
fields,
getItemId: ( item ) => `${ item.id }`,
pagination: {
totalItems: 1,
totalPages: 1,
},
pagination: paginationInfo,
enableSearch: false,
actions: [],
dataViewsState: dataViewsState,
setDataViewsState: setDataViewsState,
defaultLayouts: { table: {} },
} }
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ export default function WPCOMSitesTable( {
isPartnerOAuthTokenLoaded: false,
searchQuery: '',
currentPage: 1,
sort: {
field: '',
direction: '',
},
perPage: 1,
agencyId,
filter: {
Expand Down Expand Up @@ -120,7 +116,7 @@ export default function WPCOMSitesTable( {
? [
{
id: 'site',
header: (
label: (
<div>
<CheckboxControl
label={ translate( 'Site' ).toUpperCase() }
Expand All @@ -146,15 +142,14 @@ export default function WPCOMSitesTable( {
<span>{ item.site }</span>
</div>
),
width: '100%',
enableHiding: false,
enableSorting: false,
},
]
: [
{
id: 'site',
header: (
label: (
<div>
<CheckboxControl
label={ translate( 'Site' ).toUpperCase() }
Expand All @@ -175,26 +170,23 @@ export default function WPCOMSitesTable( {
disabled={ false }
/>
),
width: '100%',
enableHiding: false,
enableSorting: false,
},
{
id: 'date',
header: translate( 'Date' ).toUpperCase(),
label: translate( 'Date' ).toUpperCase(),
getValue: () => '-',
render: ( { item }: { item: SiteItem } ) =>
new Date( item.date ).toLocaleDateString(),
width: '100%',
enableHiding: false,
enableSorting: false,
},
{
id: 'type',
header: translate( 'Type' ).toUpperCase(),
label: translate( 'Type' ).toUpperCase(),
getValue: () => '-',
render: ( { item }: { item: SiteItem } ) => <TypeIcon siteId={ item.id } />,
width: '100%',
enableHiding: false,
enableSorting: false,
},
Expand All @@ -207,6 +199,8 @@ export default function WPCOMSitesTable( {
{ isPending ? (
<WPCOMSitesTablePlaceholder />
) : (
// @ts-expect-error the error is because field.label types do not admit JSX.Elements.
// To remove when this is using [email protected]
<WPCOMSitesTableContent items={ items } fields={ fields } />
) }
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ export const initialDataViewsState: DataViewsState = {
perPage: 50,
page: 1,
search: '',
hiddenFields: [],
layout: {},
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { useTranslate } from 'i18n-calypso';
import { ReactNode, useRef, useLayoutEffect } from 'react';
import ReactDOM from 'react-dom';
import { DataViews } from 'calypso/components/dataviews';
import { ItemsDataViewsType, DataViewsColumn } from './interfaces';
import { ItemsDataViewsType } from './interfaces';
import type { Field } from '@wordpress/dataviews';

import './style.scss';

Expand All @@ -23,26 +24,27 @@ const getIdByPath = ( item: object, path: string ) => {
/**
* Create an item column for the DataViews component
* @param id
* @param header
* @param label
* @param displayField
* @param getValue
* @param isSortable
* @param canHide
*/
export const createItemColumn = (
id: string,
header: ReactNode,
label: ReactNode,
displayField: () => ReactNode,
getValue: () => undefined,
isSortable: boolean = false,
canHide: boolean = false
): DataViewsColumn => {
): Field< any > => {
return {
id,
enableSorting: isSortable,
enableHiding: canHide,
getValue,
header,
// @ts-expect-error -- Need to fix the label type upstream in @wordpress/dataviews to support React elements.
oandregal marked this conversation as resolved.
Show resolved Hide resolved
label,
render: displayField,
};
};
Expand All @@ -64,9 +66,7 @@ const ItemsDataViews = ( { data, isLoading = false, className }: ItemsDataViewsP
! scrollContainerRef.current ||
previousDataViewsState?.type !== data.dataViewsState.type
) {
scrollContainerRef.current = document.querySelector(
'.dataviews-view-list, .dataviews-view-table-wrapper'
) as HTMLElement;
scrollContainerRef.current = document.querySelector( '.dataviews-view-list' ) as HTMLElement;
}

if ( ! previousDataViewsState?.selectedItem && data.dataViewsState.selectedItem ) {
Expand All @@ -85,12 +85,13 @@ const ItemsDataViews = ( { data, isLoading = false, className }: ItemsDataViewsP
return (
<div className={ className }>
<DataViews
data={ data.items }
paginationInfo={ data.pagination }
fields={ data.fields }
data={ data.items ?? [] }
view={ data.dataViewsState }
onChangeView={ ( newView ) => data.setDataViewsState( () => newView ) }
fields={ data.fields }
search={ data?.enableSearch ?? true }
searchLabel={ data.searchLabel ?? translate( 'Search' ) }
actions={ data.actions }
getItemId={
data.getItemId ??
( ( item: any ) => {
Expand All @@ -99,11 +100,12 @@ const ItemsDataViews = ( { data, isLoading = false, className }: ItemsDataViewsP
return item.id;
} )
}
onSelectionChange={ data.onSelectionChange }
onChangeView={ data.setDataViewsState }
supportedLayouts={ [ 'table' ] }
actions={ data.actions }
isLoading={ isLoading }
paginationInfo={ data.pagination }
defaultLayouts={ data.defaultLayouts }
selection={ data.selection }
onChangeSelection={ data.onSelectionChange }
header={ data.header }
/>
{ dataviewsWrapper &&
ReactDOM.createPortal(
Expand Down
Loading
Loading