mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-01 18:58:11 +08:00
Animate list items on name change (#1008)
* animate list items * fix comment
This commit is contained in:
Generated
+13
@@ -10746,6 +10746,14 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-2.0.4.tgz",
|
||||||
"integrity": "sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw=="
|
"integrity": "sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw=="
|
||||||
},
|
},
|
||||||
|
"react-flip-toolkit": {
|
||||||
|
"version": "7.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-flip-toolkit/-/react-flip-toolkit-7.0.6.tgz",
|
||||||
|
"integrity": "sha512-zZpwNfAGS8/WRrHKOA224NP2aVG4ryVx9vkTkxFsU7tkGUpM5AvjsICYmOVDJhEl5wmR36SjMSmWFicloJVibA==",
|
||||||
|
"requires": {
|
||||||
|
"rematrix": "0.2.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"react-helmet": {
|
"react-helmet": {
|
||||||
"version": "5.2.1",
|
"version": "5.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-helmet/-/react-helmet-5.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-helmet/-/react-helmet-5.2.1.tgz",
|
||||||
@@ -11059,6 +11067,11 @@
|
|||||||
"integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=",
|
"integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"rematrix": {
|
||||||
|
"version": "0.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/rematrix/-/rematrix-0.2.2.tgz",
|
||||||
|
"integrity": "sha512-agFFS3RzrLXJl5LY5xg/xYyXvUuVAnkhgKO7RaO9J1Ssth6yvbO+PIiV67V59MB5NCdAK2flvGvNT4mdKVniFA=="
|
||||||
|
},
|
||||||
"remove-trailing-separator": {
|
"remove-trailing-separator": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz",
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
"react": "^16.9.0",
|
"react": "^16.9.0",
|
||||||
"react-autocomplete": "^1.7.2",
|
"react-autocomplete": "^1.7.2",
|
||||||
"react-dom": "^16.9.0",
|
"react-dom": "^16.9.0",
|
||||||
|
"react-flip-toolkit": "7.0.6",
|
||||||
"react-helmet": "^5.2.1",
|
"react-helmet": "^5.2.1",
|
||||||
"react-icons": "^3.7.0",
|
"react-icons": "^3.7.0",
|
||||||
"react-redux": "^7.1.1",
|
"react-redux": "^7.1.1",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import React from "react";
|
|||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { FaChevronRight, FaChevronDown } from "react-icons/fa";
|
import { FaChevronRight, FaChevronDown } from "react-icons/fa";
|
||||||
|
import { Flipper, Flipped, Spring } from "react-flip-toolkit";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
@@ -172,21 +173,26 @@ class Category extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderCategoryItems() {
|
renderCategoryItems(optTuples) {
|
||||||
const { categoricalSelection, metadataField, isUserAnno } = this.props;
|
const { metadataField, isUserAnno } = this.props;
|
||||||
|
|
||||||
const cat = categoricalSelection[metadataField];
|
return _.map(optTuples, (tuple, i) => {
|
||||||
const optTuples = sortedCategoryValues([...cat.categoryValueIndices]);
|
return (
|
||||||
return _.map(optTuples, (tuple, i) => (
|
<Flipped key={tuple[1]} flipId={tuple[1]}>
|
||||||
<Value
|
{flippedProps => (
|
||||||
isUserAnno={isUserAnno}
|
<Value
|
||||||
optTuples={optTuples}
|
isUserAnno={isUserAnno}
|
||||||
key={tuple[1]}
|
optTuples={optTuples}
|
||||||
metadataField={metadataField}
|
key={tuple[1]}
|
||||||
categoryIndex={tuple[1]}
|
metadataField={metadataField}
|
||||||
i={i}
|
categoryIndex={tuple[1]}
|
||||||
/>
|
i={i}
|
||||||
));
|
flippedProps={flippedProps}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Flipped>
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -201,6 +207,10 @@ class Category extends React.Component {
|
|||||||
} = this.props;
|
} = this.props;
|
||||||
const { isTruncated } = categoricalSelection[metadataField];
|
const { isTruncated } = categoricalSelection[metadataField];
|
||||||
|
|
||||||
|
const cat = categoricalSelection[metadataField];
|
||||||
|
const optTuples = sortedCategoryValues([...cat.categoryValueIndices]);
|
||||||
|
const optTuplesAsKey = _.map(optTuples, t => t[0]).join(""); // animation
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@@ -423,7 +433,9 @@ class Category extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ marginLeft: 26 }}>
|
<div style={{ marginLeft: 26 }}>
|
||||||
{isExpanded ? this.renderCategoryItems() : null}
|
<Flipper spring="veryGentle" flipKey={optTuplesAsKey}>
|
||||||
|
{isExpanded ? this.renderCategoryItems(optTuples) : null}
|
||||||
|
</Flipper>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{isExpanded && isTruncated ? (
|
{isExpanded && isTruncated ? (
|
||||||
|
|||||||
@@ -183,7 +183,10 @@ class CategoryValue extends React.Component {
|
|||||||
i,
|
i,
|
||||||
schema,
|
schema,
|
||||||
isUserAnno,
|
isUserAnno,
|
||||||
annotations
|
annotations,
|
||||||
|
// flippedProps is potentially brittle, their docs want {...flippedProps} on our div,
|
||||||
|
// our lint doesn't like jsx spread, we are version pinned to prevent api change on their part
|
||||||
|
flippedProps
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (!categoricalSelection) return null;
|
if (!categoricalSelection) return null;
|
||||||
@@ -231,6 +234,9 @@ class CategoryValue extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={i}
|
key={i}
|
||||||
|
data-flip-config={flippedProps["data-flip-config"]}
|
||||||
|
data-flip-id={flippedProps["data-flip-id"]}
|
||||||
|
data-portal-key={flippedProps["data-portal-key"]}
|
||||||
className={styles.value}
|
className={styles.value}
|
||||||
data-testclass="categorical-row"
|
data-testclass="categorical-row"
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
Reference in New Issue
Block a user