react-cosmos-ui 7.2.0 → 7.2.1-canary.07c46c9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ValueInputTree/ValueInputTree.js +2 -3
- package/dist/components/ValueInputTree/valueTreeExpansion.js +7 -7
- package/dist/playground.bundle.js +275 -275
- package/dist/playground.bundle.js.map +1 -1
- package/dist/plugins/ClassStatePanel/ClassStatePanel/ComponentClassState.js +1 -2
- package/dist/plugins/Core/index.js +1 -2
- package/dist/plugins/FixtureBookmark/FixtureBookmarks.js +7 -3
- package/dist/plugins/FixtureBookmark/index.js +1 -1
- package/dist/plugins/FixtureSearch/FixtureSearchOverlay.js +1 -2
- package/dist/plugins/InputsPanel/InputsPanel.js +1 -1
- package/dist/plugins/PropsPanel/PropsPanel/ComponentProps.js +1 -2
- package/dist/plugins/RendererCore/receiveResponse/fixtureStateChange.js +1 -1
- package/dist/plugins/RendererCore/receiveResponse/rendererReady.js +1 -1
- package/dist/plugins/ResponsivePreview/ResponsivePreview/ResponsivePreview.js +1 -1
- package/dist/plugins/Root/RendererHeader.js +1 -1
- package/dist/plugins/Router/index.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { clone, setWith } from 'lodash-es';
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import { setByPath, } from 'react-cosmos-core';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { grey248, grey32 } from '../../style/colors.js';
|
|
5
5
|
import { TreeView } from '../TreeView.js';
|
|
@@ -30,8 +30,7 @@ function getValuePath(valueKey, parentKeys) {
|
|
|
30
30
|
return [...parentKeys.map(p => `${p}.values`), valueKey].join('.');
|
|
31
31
|
}
|
|
32
32
|
function setValueAtPath(values, newValue, valuePath) {
|
|
33
|
-
|
|
34
|
-
return setWith(clone(values), valuePath, newValue, clone);
|
|
33
|
+
return setByPath(values, valuePath, newValue);
|
|
35
34
|
}
|
|
36
35
|
function getChildrenText(childKeys, isArray) {
|
|
37
36
|
if (childKeys.length > 0) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { clone, setWith } from 'lodash-es';
|
|
2
1
|
import { stringifyFixtureId, } from 'react-cosmos-core';
|
|
3
2
|
import { stringifyElementId } from './shared.js';
|
|
4
3
|
const DEFAULT_EXPANSION = {};
|
|
@@ -6,12 +5,13 @@ export function getFixtureExpansion(groupExpansion, fixtureId) {
|
|
|
6
5
|
return groupExpansion[stringifyFixtureId(fixtureId)] || DEFAULT_EXPANSION;
|
|
7
6
|
}
|
|
8
7
|
export function updateElementExpansion(groupExpansion, fixtureId, elementId, treeExpansion) {
|
|
9
|
-
const valuePath = createElementExpansionPath(fixtureId, elementId);
|
|
10
|
-
// Inspired by https://github.com/lodash/lodash/issues/1696#issuecomment-328335502
|
|
11
|
-
return setWith(clone(groupExpansion), valuePath, treeExpansion, clone);
|
|
12
|
-
}
|
|
13
|
-
function createElementExpansionPath(fixtureId, elementId) {
|
|
14
8
|
const strFixtureId = stringifyFixtureId(fixtureId);
|
|
15
9
|
const strElementId = stringifyElementId(elementId);
|
|
16
|
-
return
|
|
10
|
+
return {
|
|
11
|
+
...groupExpansion,
|
|
12
|
+
[strFixtureId]: {
|
|
13
|
+
...groupExpansion[strFixtureId],
|
|
14
|
+
[strElementId]: treeExpansion,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
17
|
}
|