ydb-ui-components 1.2.0 → 2.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.0](https://github.com/ydb-platform/ydb-ui-components/compare/v1.2.3...v2.0.0) (2022-05-25)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * major version update of peer dependency @yandex-cloud/uikit, see changelog here: https://github.com/yandex-cloud/uikit/blob/main/CHANGELOG_V2.md
9
+
10
+ ### chore
11
+
12
+ * update @yandex-cloud/uikit to v2.3.1 ([ba67dd6](https://github.com/ydb-platform/ydb-ui-components/commit/ba67dd6f8f01b2a58ed67bd064ad8962f2f8a244))
13
+ * update @yandex-cloud/i18n to v0.6.0 ([237c2cd](https://github.com/ydb-platform/ydb-ui-components/commit/237c2cdd5064565da2cf62fbebb0fc0ae1195d0e))
14
+
15
+ ### [1.2.3](https://github.com/ydb-platform/ydb-ui-components/compare/v1.2.2...v1.2.3) (2022-05-23)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **NavigationTree:** expand tree to initial active path ([6a84dfb](https://github.com/ydb-platform/ydb-ui-components/commit/6a84dfb8b89f8411bd5b11f7b18582ed547c6d0d))
21
+
22
+ ### [1.2.2](https://github.com/ydb-platform/ydb-ui-components/compare/v1.2.1...v1.2.2) (2022-05-23)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * add missing index file for TreeView ([7496d9b](https://github.com/ydb-platform/ydb-ui-components/commit/7496d9b7074d6ee5c2f280030ca38cc9373b0f34))
28
+
29
+ ### [1.2.1](https://github.com/ydb-platform/ydb-ui-components/compare/v1.2.0...v1.2.1) (2022-05-23)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * add missing component export ([9b71eb7](https://github.com/ydb-platform/ydb-ui-components/commit/9b71eb78f8c2adfd773e45edddc41ea97c64aa35))
35
+
3
36
  ## [1.2.0](https://github.com/ydb-platform/ydb-ui-components/compare/v1.1.3...v1.2.0) (2022-05-23)
4
37
 
5
38
 
@@ -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
  })));
@@ -0,0 +1 @@
1
+ export * from './TreeView';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _TreeView = require("./TreeView");
8
+
9
+ Object.keys(_TreeView).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _TreeView[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _TreeView[key];
16
+ }
17
+ });
18
+ });
package/build/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from './components/NavigationTree';
2
+ export * from './components/TreeView';
package/build/index.js CHANGED
@@ -15,4 +15,17 @@ Object.keys(_NavigationTree).forEach(function (key) {
15
15
  return _NavigationTree[key];
16
16
  }
17
17
  });
18
+ });
19
+
20
+ var _TreeView = require("./components/TreeView");
21
+
22
+ Object.keys(_TreeView).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _TreeView[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _TreeView[key];
29
+ }
30
+ });
18
31
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-ui-components",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
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.3.1",
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.3.1",
71
71
  "react": "^16.0.0",
72
72
  "react-dom": "^16.0.0"
73
73
  },