ydb-ui-components 1.2.2 → 2.0.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ### [2.0.1](https://github.com/ydb-platform/ydb-ui-components/compare/v2.0.0...v2.0.1) (2022-05-26)
4
+
5
+
6
+ ### chore
7
+
8
+ * update @yandex-cloud/uikit to 2.4.0 ([663c8d2](https://github.com/ydb-platform/ydb-ui-components/commit/663c8d26c704bd83be97c81f4fd4080a7cfbb3d0))
9
+
10
+ ## [2.0.0](https://github.com/ydb-platform/ydb-ui-components/compare/v1.2.3...v2.0.0) (2022-05-25)
11
+
12
+
13
+ ### ⚠ BREAKING CHANGES
14
+
15
+ * major version update of peer dependency @yandex-cloud/uikit, see changelog here: https://github.com/yandex-cloud/uikit/blob/main/CHANGELOG_V2.md
16
+
17
+ ### chore
18
+
19
+ * update @yandex-cloud/uikit to v2.3.1 ([ba67dd6](https://github.com/ydb-platform/ydb-ui-components/commit/ba67dd6f8f01b2a58ed67bd064ad8962f2f8a244))
20
+ * update @yandex-cloud/i18n to v0.6.0 ([237c2cd](https://github.com/ydb-platform/ydb-ui-components/commit/237c2cdd5064565da2cf62fbebb0fc0ae1195d0e))
21
+
22
+ ### [1.2.3](https://github.com/ydb-platform/ydb-ui-components/compare/v1.2.2...v1.2.3) (2022-05-23)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **NavigationTree:** expand tree to initial active path ([6a84dfb](https://github.com/ydb-platform/ydb-ui-components/commit/6a84dfb8b89f8411bd5b11f7b18582ed547c6d0d))
28
+
3
29
  ### [1.2.2](https://github.com/ydb-platform/ydb-ui-components/compare/v1.2.1...v1.2.2) (2022-05-23)
4
30
 
5
31
 
@@ -28,7 +28,7 @@ function NavigationTree(_ref) {
28
28
  getActions,
29
29
  activePath,
30
30
  onActivePathUpdate,
31
- cache
31
+ cache = true
32
32
  } = _ref;
33
33
 
34
34
  const [state, dispatch] = _react.default.useReducer(_state.reducer, {
@@ -28,7 +28,7 @@ function NavigationTreeDirectory(_ref) {
28
28
  activePath,
29
29
  onItemActivate,
30
30
  getActions,
31
- cache = true
31
+ cache
32
32
  } = _ref;
33
33
  const nodeState = state[path];
34
34
 
@@ -48,6 +48,7 @@ function NavigationTreeDirectory(_ref) {
48
48
  type: _state.NavigationTreeActionType.FinishLoading,
49
49
  payload: {
50
50
  path,
51
+ activePath,
51
52
  data
52
53
  }
53
54
  });
@@ -15,9 +15,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
15
15
 
16
16
  const COMPONENT = 'ydb-navigation-tree';
17
17
 
18
- _i18n.i18n.registerKeyset(_i18n.I18N.LANGS.en, COMPONENT, _en.default);
18
+ _i18n.i18n.registerKeyset('en', COMPONENT, _en.default);
19
19
 
20
- _i18n.i18n.registerKeyset(_i18n.I18N.LANGS.ru, COMPONENT, _ru.default);
20
+ _i18n.i18n.registerKeyset('ru', COMPONENT, _ru.default);
21
21
 
22
22
  var _default = _i18n.i18n.keyset(COMPONENT);
23
23
 
@@ -73,10 +73,19 @@ function reducer() {
73
73
  });
74
74
 
75
75
  for (const item of action.payload.data) {
76
+ var _state$path$collapsed, _state$path;
77
+
76
78
  const path = `${action.payload.path}/${item.name}`;
77
79
  const name = item.name;
78
- const type = item.type;
80
+ const type = item.type; // expand the tree according to the active path
81
+ // prioritize the existing state to expand the tree only on first load
82
+
83
+ const {
84
+ activePath = ''
85
+ } = action.payload;
86
+ const collapsed = (_state$path$collapsed = (_state$path = state[path]) === null || _state$path === void 0 ? void 0 : _state$path.collapsed) !== null && _state$path$collapsed !== void 0 ? _state$path$collapsed : !activePath.startsWith(`${path}/`);
79
87
  newState[path] = _objectSpread(_objectSpread({}, getDefaultNodeState()), {}, {
88
+ collapsed,
80
89
  path,
81
90
  name,
82
91
  type
@@ -46,8 +46,9 @@ function TreeView(_ref) {
46
46
  className: b('actions')
47
47
  }, /*#__PURE__*/_react.default.createElement(_uikit.DropdownMenu, {
48
48
  defaultSwitcherProps: {
49
- view: 'clear',
50
- size: 's'
49
+ view: 'flat-secondary',
50
+ size: 's',
51
+ pin: 'brick-brick'
51
52
  },
52
53
  items: actions
53
54
  })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-ui-components",
3
- "version": "1.2.2",
3
+ "version": "2.0.1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "build/index.js",
@@ -39,11 +39,11 @@
39
39
  "@types/react-treeview": "^0.4.3",
40
40
  "@yandex-cloud/browserslist-config": "^1.0.1",
41
41
  "@yandex-cloud/eslint-config": "^1.0.0",
42
- "@yandex-cloud/i18n": "^0.4.0",
42
+ "@yandex-cloud/i18n": "^0.6.0",
43
43
  "@yandex-cloud/prettier-config": "^1.0.0",
44
44
  "@yandex-cloud/stylelint-config": "^1.1.0",
45
45
  "@yandex-cloud/tsconfig": "^1.0.0",
46
- "@yandex-cloud/uikit": "^1.8.0",
46
+ "@yandex-cloud/uikit": "^2.4.0",
47
47
  "css-loader": "^5.2.7",
48
48
  "eslint": "^8.11.0",
49
49
  "gulp": "^4.0.2",
@@ -66,8 +66,8 @@
66
66
  },
67
67
  "peerDependencies": {
68
68
  "@yandex-cloud/browserslist-config": "^1.0.1",
69
- "@yandex-cloud/i18n": "^0.4.0",
70
- "@yandex-cloud/uikit": "^1.8.0",
69
+ "@yandex-cloud/i18n": "^0.6.0",
70
+ "@yandex-cloud/uikit": "^2.4.0",
71
71
  "react": "^16.0.0",
72
72
  "react-dom": "^16.0.0"
73
73
  },