Merge branch 'master' into fix/2243

This commit is contained in:
Ron Rennick 2019-08-20 10:04:10 -03:00
commit 17c66a79a5
20 changed files with 136 additions and 72 deletions

View File

@ -11,7 +11,7 @@ $package = json_decode( $package_json );
function replace_version( $filename, $package_json ) {
$lines = array();
$file = file( $filename );
foreach ( $file as $line ) {
if ( stripos( $line, ' * Version: ' ) !== false ) {
$line = " * Version: {$package_json->version}\n";

View File

@ -61,13 +61,14 @@ export default class ReportFilters extends Component {
}
render() {
const { query, path, filters, advancedFilters } = this.props;
const { advancedFilters, filters, path, query, showDatePicker } = this.props;
return (
<Filters
query={ query }
path={ path }
filters={ filters }
advancedFilters={ advancedFilters }
showDatePicker={ showDatePicker }
onDateSelect={ this.trackDateSelect }
onFilterSelect={ this.trackFilterSelect }
onAdvancedFilterAction={ this.trackAdvancedFilterAction }

View File

@ -108,14 +108,19 @@ class ReportTable extends Component {
}
filterShownHeaders( headers, hiddenKeys ) {
if ( ! hiddenKeys || ! hiddenKeys.length ) {
return headers;
// If no user preferences, set visibilty based on column default.
if ( ! hiddenKeys ) {
return headers.map( header => ( {
...header,
visible: header.required || ! header.hiddenByDefault,
} ) );
}
return headers.map( header => {
const hidden = hiddenKeys.includes( header.key ) && ! header.required;
return { ...header, hiddenByDefault: hidden };
} );
// Set visibilty based on user preferences.
return headers.map( header => ( {
...header,
visible: header.required || ! hiddenKeys.includes( header.key ),
} ) );
}
render() {

View File

@ -20,10 +20,7 @@ const subTasks = [
),
before: <i className="material-icons-outlined">add_box</i>,
after: <i className="material-icons-outlined">chevron_right</i>,
onClick: () =>
( window.location.href = getAdminLink(
'post-new.php?post_type=product&wc_onboarding_active_task=products'
) ),
href: getAdminLink( 'post-new.php?post_type=product&wc_onboarding_active_task=products' ),
},
{
title: __( 'Import', 'woocommerce-admin' ),
@ -33,10 +30,9 @@ const subTasks = [
),
before: <i className="material-icons-outlined">import_export</i>,
after: <i className="material-icons-outlined">chevron_right</i>,
onClick: () =>
( window.location.href = getAdminLink(
'edit.php?post_type=product&page=product_importer&wc_onboarding_active_task=products'
) ),
href: getAdminLink(
'edit.php?post_type=product&page=product_importer&wc_onboarding_active_task=products'
),
},
{
title: __( 'Migrate', 'woocommerce-admin' ),
@ -47,7 +43,8 @@ const subTasks = [
before: <i className="material-icons-outlined">cloud_download</i>,
after: <i className="material-icons-outlined">chevron_right</i>,
// @todo This should be replaced with the in-app purchase iframe when ready.
onClick: () => window.open( 'https://woocommerce.com/products/cart2cart/', '_blank' ),
href: 'https://woocommerce.com/products/cart2cart/',
target: '_blank',
},
];

View File

@ -82,3 +82,4 @@ $muriel-box-shadow-1dp: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0
0 1px 3px 0 rgba(0, 0, 0, 0.12);
$muriel-box-shadow-8dp: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14),
0 3px 14px 2px rgba(0, 0, 0, 0.12);
$muriel-primary-500: #005fb7;

View File

@ -1,6 +1,6 @@
# unreleased
# 3.2.0
- AdvancedFilters component: fire `onAdvancedFilterAction` for match changes.
- TableCard component: add `onSearch` an `onSort` function props.
- TableCard component: add `onSearch` and `onSort` function props.
- Add new component `<List />` for displaying interactive list items.
- Fix z-index issue in `<Chart />` empty message.
- Added a new `<SimpleSelectControl />` component.

View File

@ -1,6 +1,6 @@
{
"name": "@woocommerce/components",
"version": "3.1.0",
"version": "3.2.0",
"description": "UI components for WooCommerce.",
"author": "Automattic",
"license": "GPL-3.0-or-later",

View File

@ -7,59 +7,74 @@ import { Component } from '@wordpress/element';
import { ENTER } from '@wordpress/keycodes';
import PropTypes from 'prop-types';
/**
* WooCommerce dependencies
*/
import Link from '../link';
/**
* List component to display a list of items.
*/
class List extends Component {
handleKeyDown( event, onClick ) {
handleKeyDown( event, onClick ) {
if ( 'function' === typeof onClick && event.keyCode === ENTER ) {
onClick();
}
}
}
render() {
const { className, items } = this.props;
const listClassName = classnames( 'woocommerce-list', className );
return (
<ul className={ listClassName }>
<ul className={ listClassName } role="menu">
{ items.map( ( item, i ) => {
const { after, before, className: itemClasses, description, onClick, title } = item;
const hasAction = 'function' === typeof onClick;
const { after, before, className: itemClasses, description, href, onClick, target, title } = item;
const hasAction = 'function' === typeof onClick || href;
const itemClassName = classnames( 'woocommerce-list__item', itemClasses, {
'has-action': hasAction,
} );
const InnerTag = href ? Link : 'div';
const innerTagProps = {
className: 'woocommerce-list__item-inner',
onClick: 'function' === typeof onClick ? onClick : null,
'aria-disabled': hasAction ? 'false' : null,
tabIndex: hasAction ? '0' : null,
role: hasAction ? 'menuitem' : null,
onKeyDown: ( e ) => hasAction ? this.handleKeyDown( e, onClick ) : null,
target: href ? target : null,
type: href ? 'external' : null,
href: href,
};
return (
<li
className={ itemClassName }
key={ i }
onClick={ hasAction ? onClick : null }
onKeyDown={ ( e ) => hasAction ? this.handleKeyDown( e, onClick ) : null }
role="menuitem"
aria-disabled="false"
tabIndex="0"
>
{ before &&
<div className="woocommerce-list__item-before">
{ before }
</div>
}
<div className="woocommerce-list__item-text">
<span className="woocommerce-list__item-title">
{ title }
</span>
{ description &&
<span className="woocommerce-list__item-description">
{ description }
</span>
}
</div>
{ after &&
<div className="woocommerce-list__item-after">
{ after }
</div>
}
<InnerTag { ...innerTagProps }>
{ before &&
<div className="woocommerce-list__item-before">
{ before }
</div>
}
<div className="woocommerce-list__item-text">
<span className="woocommerce-list__item-title">
{ title }
</span>
{ description &&
<span className="woocommerce-list__item-description">
{ description }
</span>
}
</div>
{ after &&
<div className="woocommerce-list__item-after">
{ after }
</div>
}
</InnerTag>
</li>
);
} ) }
@ -79,29 +94,37 @@ List.propTypes = {
items: PropTypes.arrayOf(
PropTypes.shape( {
/**
* Title displayed for the list item.
* Content displayed after the list item text.
*/
title: PropTypes.string.isRequired,
/**
* Description displayed beneath the list item title.
*/
description: PropTypes.string,
after: PropTypes.node,
/**
* Content displayed before the list item text.
*/
before: PropTypes.node,
/**
* Content displayed after the list item text.
* Additional class name to style the list item.
*/
after: PropTypes.node,
className: PropTypes.string,
/**
* Description displayed beneath the list item title.
*/
description: PropTypes.string,
/**
* Href attribute used in a Link wrapped around the item.
*/
href: PropTypes.string,
/**
* Content displayed after the list item text.
*/
onClick: PropTypes.func,
/**
* Additional class name to style the list item.
* Target attribute used for Link wrapper.
*/
className: PropTypes.string,
target: PropTypes.string,
/**
* Title displayed for the list item.
*/
title: PropTypes.string.isRequired,
} )
).isRequired,
};

View File

@ -1,5 +1,4 @@
.woocommerce-list__item {
padding: $gap;
display: flex;
align-items: center;
margin-bottom: 0;
@ -8,6 +7,18 @@
cursor: pointer;
}
> .woocommerce-list__item-inner {
text-decoration: none;
width: 100%;
display: flex;
align-items: center;
padding: $gap;
&:focus {
box-shadow: inset 0 0 0 1px $muriel-primary-500, inset 0 0 0 2px #fff;
}
}
.woocommerce-list__item-title {
display: block;
font-size: 16px;

View File

@ -93,7 +93,15 @@ class TableCard extends Component {
}
getShowCols( headers ) {
return headers.map( ( { key, hiddenByDefault } ) => ! hiddenByDefault && key ).filter( Boolean );
return headers.map( ( { key, visible } ) => {
if (
'undefined' === typeof visible ||
visible
) {
return key;
}
return false;
} ).filter( Boolean );
}
getVisibleHeaders() {

View File

@ -1,6 +1,10 @@
# 1.1.2
- Update dependencies.
# 1.1.1
- Update license to GPL-3.0-or-later
- Update license to GPL-3.0-or-later.
# 1.1.0

View File

@ -1,6 +1,6 @@
{
"name": "@woocommerce/csv-export",
"version": "1.1.1",
"version": "1.1.2",
"description": "WooCommerce utility library to convert data to CSV files.",
"author": "Automattic",
"license": "GPL-3.0-or-later",

View File

@ -1,6 +1,10 @@
# 1.1.3
- Update dependencies.
# 1.1.2
- Update license to GPL-3.0-or-later
- Update license to GPL-3.0-or-later.
# 1.1.1

View File

@ -1,6 +1,6 @@
{
"name": "@woocommerce/currency",
"version": "1.1.2",
"version": "1.1.3",
"description": "WooCommerce currency utilities.",
"author": "Automattic",
"license": "GPL-3.0-or-later",

View File

@ -1,7 +1,11 @@
# 1.2.1
- Update dependencies.
# 1.2.0
- Enhancement: gather default date settings from `wcSettings.wcAdminSettings.woocommerce_default_date_range` if they exist.
- Update license to GPL-3.0-or-later
- Update license to GPL-3.0-or-later.
# 1.0.7

View File

@ -1,6 +1,6 @@
{
"name": "@woocommerce/date",
"version": "1.2.0",
"version": "1.2.1",
"description": "WooCommerce date utilities.",
"author": "Automattic",
"license": "GPL-3.0-or-later",

View File

@ -1,8 +1,10 @@
# 3.0.0 (unreleased)
# 3.0.0
- `getHistory` updated to reflect path parameters in url query.
- `getNewPath` also updated to reflect path parameters in url query.
- `stringifyQuery` method is no longer available, instead use `addQueryArgs` from `@wordpress/url` package.
- Added a new `<Form />` component.
- Stepper component: Add new `content` and `description` props.
# 2.1.1

View File

@ -1,6 +1,6 @@
{
"name": "@woocommerce/navigation",
"version": "2.1.1",
"version": "3.0.0",
"description": "WooCommerce navigation utilities.",
"author": "Automattic",
"license": "GPL-3.0-or-later",

View File

@ -1,6 +1,10 @@
# 1.0.4
- Update dependencies.
# 1.0.3
- Update license to GPL-3.0-or-later
- Update license to GPL-3.0-or-later.
# 1.0.2

View File

@ -1,6 +1,6 @@
{
"name": "@woocommerce/number",
"version": "1.0.3",
"version": "1.0.4",
"description": "Number formatting utilities for WooCommerce.",
"author": "Automattic",
"license": "GPL-3.0-or-later",