Skip to content

Commit

Permalink
refactor(material-experimental/mdc-list): account for mdc-list handle…
Browse files Browse the repository at this point in the history
…Click signature change (angular#24076)

Accounts for the mdc-list handleClick signature/semantics change as
with:
material-components/material-components-web#7443.
  • Loading branch information
devversion committed Dec 10, 2021
1 parent 723b77a commit 97ec228
Show file tree
Hide file tree
Showing 4 changed files with 674 additions and 656 deletions.
96 changes: 48 additions & 48 deletions package.json
Expand Up @@ -60,7 +60,7 @@
"@types/google.maps": "^3.45.6",
"@types/youtube": "^0.0.42",
"core-js-bundle": "^3.8.2",
"material-components-web": "14.0.0-canary.1af7c1c4a.0",
"material-components-web": "14.0.0-canary.7d8ea4624.0",
"rxjs": "^6.6.7",
"rxjs-tslint-rules": "^4.33.1",
"tslib": "^2.3.0",
Expand Down Expand Up @@ -92,53 +92,53 @@
"@bazel/terser": "4.4.5",
"@bazel/typescript": "4.4.5",
"@firebase/app-types": "^0.6.1",
"@material/animation": "14.0.0-canary.1af7c1c4a.0",
"@material/auto-init": "14.0.0-canary.1af7c1c4a.0",
"@material/banner": "14.0.0-canary.1af7c1c4a.0",
"@material/base": "14.0.0-canary.1af7c1c4a.0",
"@material/button": "14.0.0-canary.1af7c1c4a.0",
"@material/card": "14.0.0-canary.1af7c1c4a.0",
"@material/checkbox": "14.0.0-canary.1af7c1c4a.0",
"@material/chips": "14.0.0-canary.1af7c1c4a.0",
"@material/circular-progress": "14.0.0-canary.1af7c1c4a.0",
"@material/data-table": "14.0.0-canary.1af7c1c4a.0",
"@material/density": "14.0.0-canary.1af7c1c4a.0",
"@material/dialog": "14.0.0-canary.1af7c1c4a.0",
"@material/dom": "14.0.0-canary.1af7c1c4a.0",
"@material/drawer": "14.0.0-canary.1af7c1c4a.0",
"@material/elevation": "14.0.0-canary.1af7c1c4a.0",
"@material/fab": "14.0.0-canary.1af7c1c4a.0",
"@material/feature-targeting": "14.0.0-canary.1af7c1c4a.0",
"@material/floating-label": "14.0.0-canary.1af7c1c4a.0",
"@material/form-field": "14.0.0-canary.1af7c1c4a.0",
"@material/icon-button": "14.0.0-canary.1af7c1c4a.0",
"@material/image-list": "14.0.0-canary.1af7c1c4a.0",
"@material/layout-grid": "14.0.0-canary.1af7c1c4a.0",
"@material/line-ripple": "14.0.0-canary.1af7c1c4a.0",
"@material/linear-progress": "14.0.0-canary.1af7c1c4a.0",
"@material/list": "14.0.0-canary.1af7c1c4a.0",
"@material/menu": "14.0.0-canary.1af7c1c4a.0",
"@material/menu-surface": "14.0.0-canary.1af7c1c4a.0",
"@material/notched-outline": "14.0.0-canary.1af7c1c4a.0",
"@material/radio": "14.0.0-canary.1af7c1c4a.0",
"@material/ripple": "14.0.0-canary.1af7c1c4a.0",
"@material/rtl": "14.0.0-canary.1af7c1c4a.0",
"@material/segmented-button": "14.0.0-canary.1af7c1c4a.0",
"@material/select": "14.0.0-canary.1af7c1c4a.0",
"@material/shape": "14.0.0-canary.1af7c1c4a.0",
"@material/slider": "14.0.0-canary.1af7c1c4a.0",
"@material/snackbar": "14.0.0-canary.1af7c1c4a.0",
"@material/switch": "14.0.0-canary.1af7c1c4a.0",
"@material/tab": "14.0.0-canary.1af7c1c4a.0",
"@material/tab-bar": "14.0.0-canary.1af7c1c4a.0",
"@material/tab-indicator": "14.0.0-canary.1af7c1c4a.0",
"@material/tab-scroller": "14.0.0-canary.1af7c1c4a.0",
"@material/textfield": "14.0.0-canary.1af7c1c4a.0",
"@material/theme": "14.0.0-canary.1af7c1c4a.0",
"@material/tooltip": "14.0.0-canary.1af7c1c4a.0",
"@material/top-app-bar": "14.0.0-canary.1af7c1c4a.0",
"@material/touch-target": "14.0.0-canary.1af7c1c4a.0",
"@material/typography": "14.0.0-canary.1af7c1c4a.0",
"@material/animation": "14.0.0-canary.7d8ea4624.0",
"@material/auto-init": "14.0.0-canary.7d8ea4624.0",
"@material/banner": "14.0.0-canary.7d8ea4624.0",
"@material/base": "14.0.0-canary.7d8ea4624.0",
"@material/button": "14.0.0-canary.7d8ea4624.0",
"@material/card": "14.0.0-canary.7d8ea4624.0",
"@material/checkbox": "14.0.0-canary.7d8ea4624.0",
"@material/chips": "14.0.0-canary.7d8ea4624.0",
"@material/circular-progress": "14.0.0-canary.7d8ea4624.0",
"@material/data-table": "14.0.0-canary.7d8ea4624.0",
"@material/density": "14.0.0-canary.7d8ea4624.0",
"@material/dialog": "14.0.0-canary.7d8ea4624.0",
"@material/dom": "14.0.0-canary.7d8ea4624.0",
"@material/drawer": "14.0.0-canary.7d8ea4624.0",
"@material/elevation": "14.0.0-canary.7d8ea4624.0",
"@material/fab": "14.0.0-canary.7d8ea4624.0",
"@material/feature-targeting": "14.0.0-canary.7d8ea4624.0",
"@material/floating-label": "14.0.0-canary.7d8ea4624.0",
"@material/form-field": "14.0.0-canary.7d8ea4624.0",
"@material/icon-button": "14.0.0-canary.7d8ea4624.0",
"@material/image-list": "14.0.0-canary.7d8ea4624.0",
"@material/layout-grid": "14.0.0-canary.7d8ea4624.0",
"@material/line-ripple": "14.0.0-canary.7d8ea4624.0",
"@material/linear-progress": "14.0.0-canary.7d8ea4624.0",
"@material/list": "14.0.0-canary.7d8ea4624.0",
"@material/menu": "14.0.0-canary.7d8ea4624.0",
"@material/menu-surface": "14.0.0-canary.7d8ea4624.0",
"@material/notched-outline": "14.0.0-canary.7d8ea4624.0",
"@material/radio": "14.0.0-canary.7d8ea4624.0",
"@material/ripple": "14.0.0-canary.7d8ea4624.0",
"@material/rtl": "14.0.0-canary.7d8ea4624.0",
"@material/segmented-button": "14.0.0-canary.7d8ea4624.0",
"@material/select": "14.0.0-canary.7d8ea4624.0",
"@material/shape": "14.0.0-canary.7d8ea4624.0",
"@material/slider": "14.0.0-canary.7d8ea4624.0",
"@material/snackbar": "14.0.0-canary.7d8ea4624.0",
"@material/switch": "14.0.0-canary.7d8ea4624.0",
"@material/tab": "14.0.0-canary.7d8ea4624.0",
"@material/tab-bar": "14.0.0-canary.7d8ea4624.0",
"@material/tab-indicator": "14.0.0-canary.7d8ea4624.0",
"@material/tab-scroller": "14.0.0-canary.7d8ea4624.0",
"@material/textfield": "14.0.0-canary.7d8ea4624.0",
"@material/theme": "14.0.0-canary.7d8ea4624.0",
"@material/tooltip": "14.0.0-canary.7d8ea4624.0",
"@material/top-app-bar": "14.0.0-canary.7d8ea4624.0",
"@material/touch-target": "14.0.0-canary.7d8ea4624.0",
"@material/typography": "14.0.0-canary.7d8ea4624.0",
"@octokit/rest": "18.3.5",
"@rollup/plugin-commonjs": "^21.0.0",
"@rollup/plugin-node-resolve": "^13.0.5",
Expand Down
2 changes: 1 addition & 1 deletion packages.bzl
Expand Up @@ -2,7 +2,7 @@
# all in-sync. This map is passed to each ng_package rule to stamp out the appropriate
# version for the placeholders.
ANGULAR_PACKAGE_VERSION = "^13.0.0 || ^14.0.0-0"
MDC_PACKAGE_VERSION = "14.0.0-canary.1af7c1c4a.0"
MDC_PACKAGE_VERSION = "14.0.0-canary.7d8ea4624.0"
TSLIB_PACKAGE_VERSION = "^2.3.0"
RXJS_PACKAGE_VERSION = "^6.5.3 || ^7.4.0"

Expand Down
14 changes: 8 additions & 6 deletions src/material-experimental/mdc-list/interactive-list-base.ts
Expand Up @@ -32,15 +32,16 @@ export abstract class MatInteractiveListBase<T extends MatListItemBase>
}

_handleClick(event: MouseEvent) {
// The `toggleCheckbox` parameter can always be `true` as it only has an effect if the list
// is recognized as checkbox selection list. For such lists, we would always want to toggle
// the checkbox on list item click. MDC added this parameter so that they can avoid dispatching
// a fake `change` event when the checkbox is directly clicked for the list item. We don't
// need this as we require such list item checkboxes to stop propagation of the change event.
// The `isCheckboxAlreadyUpdatedInAdapter` parameter can always be `false` as it only has an
// effect if the list is recognized as checkbox selection list. For such lists, we would
// always want to toggle the checkbox on list item click. MDC added this parameter so that
// they can avoid dispatching a fake `change` event when the checkbox is directly clicked
// for the list item. We don't need this as we do not have an underlying native checkbox
// that is reachable by users through interaction.
// https://github.com/material-components/material-components-web/blob/08ca4d0ec5f359bc3a20bd2a302fa6b733b5e135/packages/mdc-list/component.ts#L308-L310
this._foundation.handleClick(
this._indexForElement(event.target as HTMLElement),
/* toggleCheckbox */ true,
/* isCheckboxAlreadyUpdatedInAdapter */ false,
);
}

Expand Down Expand Up @@ -217,6 +218,7 @@ export function getInteractiveListAdapter(
isCheckboxCheckedAtIndex(index: number) {
return false;
},
notifySelectionChange() {},
notifyAction() {},
};
}

0 comments on commit 97ec228

Please sign in to comment.