@atlaskit/table-tree 12.0.0 → 12.1.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,13 @@
1
1
  # @atlaskit/table-tree
2
2
 
3
+ ## 12.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#136750](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/136750)
8
+ [`cf5c5703b96c5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/cf5c5703b96c5) -
9
+ We are removing the feature flag around removing lodash import.
10
+
3
11
  ## 12.0.0
4
12
 
5
13
  ### Major Changes
@@ -62,7 +62,7 @@ function Row(_ref) {
62
62
  actionSubject: 'tableTree',
63
63
  componentName: 'row',
64
64
  packageName: "@atlaskit/table-tree",
65
- packageVersion: "12.0.0"
65
+ packageVersion: "12.1.0"
66
66
  });
67
67
  var onCollapse = (0, _analyticsNext.usePlatformLeafEventHandler)({
68
68
  fn: function fn(value) {
@@ -72,7 +72,7 @@ function Row(_ref) {
72
72
  actionSubject: 'tableTree',
73
73
  componentName: 'row',
74
74
  packageName: "@atlaskit/table-tree",
75
- packageVersion: "12.0.0"
75
+ packageVersion: "12.1.0"
76
76
  });
77
77
 
78
78
  /**
@@ -4,56 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.internalSet = exports.internalGet = exports.default = void 0;
7
+ exports.default = void 0;
8
8
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
12
  var _get = _interopRequireDefault(require("lodash/get"));
13
13
  var _set = _interopRequireDefault(require("lodash/set"));
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
15
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
- // https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore?tab=readme-ov-file#_get
18
- // https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13126
19
- var internalGet = exports.internalGet = function internalGet(obj, path) {
20
- var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
21
- var travel = function travel(regexp) {
22
- return String.prototype.split.call(path, regexp).filter(Boolean).reduce(function (res, key) {
23
- return res !== null && res !== undefined ? res[key] : res;
24
- }, obj);
25
- };
26
- var result = travel(/[,[\]]+?/) || travel(/[,[\].]+?/);
27
- return result === undefined || result === obj ? defaultValue : result;
28
- };
29
-
30
- // https://stackoverflow.com/a/54733755/14857724
31
- // https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13673
32
- var internalSet = exports.internalSet = function internalSet(obj, providedPath, value) {
33
- // When obj is not an object, fail gracefully
34
- if (Object(obj) !== obj) {
35
- return obj;
36
- }
37
-
38
- // If not yet an array, get the keys from the string-path
39
- var path = !Array.isArray(providedPath) ? providedPath.toString().match(/[^.[\]]+/g) || [] : providedPath;
40
-
41
- // Iterate all of them except the last one
42
- var result = path.slice(0, -1).reduce(function (acc, c, index) {
43
- // Does the key exist and is its value an object?
44
- return Object(acc[c]) === acc[c] ? acc[c] // Yes: then follow that path
45
- :
46
- // No: create the key. Is the next key a potential array-index?
47
- acc[c] = Math.abs(parseInt(path[index + 1])) >> 0 === +path[index + 1] ? [] // Yes: assign a new array object
48
- : {}; // No: assign a new plain object
49
- }, obj);
50
-
51
- // Finally assign the value to the last key
52
- result[path[path.length - 1]] = value;
53
-
54
- // Return the top-level object to allow chaining
55
- return obj;
56
- };
57
16
  function updateRootItems(rootItems) {
58
17
  var allItems = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
59
18
  var _ref = arguments.length > 2 ? arguments[2] : undefined,
@@ -81,10 +40,6 @@ function updateChildItems(newitems, allTableItems, itemParent, _ref2) {
81
40
  var key = _ref2.key,
82
41
  keysCache = _ref2.keysCache,
83
42
  operation = _ref2.operation;
84
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
85
- var get = (0, _platformFeatureFlags.fg)('dst-a11y-remove-lodash-from-table-tree') ? internalGet : _get.default;
86
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
87
- var set = (0, _platformFeatureFlags.fg)('dst-a11y-remove-lodash-from-table-tree') ? internalSet : _set.default;
88
43
  var newKeysCache = _objectSpread({}, keysCache);
89
44
  var parentCacheKey = itemParent[key];
90
45
  if (parentCacheKey === undefined) {
@@ -92,8 +47,8 @@ function updateChildItems(newitems, allTableItems, itemParent, _ref2) {
92
47
  }
93
48
  var parentLocation = newKeysCache[parentCacheKey];
94
49
  var allItemsCopy = (0, _toConsumableArray2.default)(allTableItems);
95
- var objectToChange = get(allItemsCopy, parentLocation);
96
- var baseChildrenOfObjectToChange = operation === 'UPDATE' ? [] : get(objectToChange, 'children', []);
50
+ var objectToChange = (0, _get.default)(allItemsCopy, parentLocation);
51
+ var baseChildrenOfObjectToChange = operation === 'UPDATE' ? [] : (0, _get.default)(objectToChange, 'children', []);
97
52
  objectToChange.children = baseChildrenOfObjectToChange.concat(newitems);
98
53
 
99
54
  // Update cache
@@ -102,7 +57,7 @@ function updateChildItems(newitems, allTableItems, itemParent, _ref2) {
102
57
  });
103
58
  return {
104
59
  keysCache: newKeysCache,
105
- items: set(allItemsCopy, parentLocation, objectToChange)
60
+ items: (0, _set.default)(allItemsCopy, parentLocation, objectToChange)
106
61
  };
107
62
  }
108
63
 
@@ -47,7 +47,7 @@ function Row({
47
47
  actionSubject: 'tableTree',
48
48
  componentName: 'row',
49
49
  packageName: "@atlaskit/table-tree",
50
- packageVersion: "12.0.0"
50
+ packageVersion: "12.1.0"
51
51
  });
52
52
  const onCollapse = usePlatformLeafEventHandler({
53
53
  fn: value => providedOnCollapse && providedOnCollapse(value),
@@ -55,7 +55,7 @@ function Row({
55
55
  actionSubject: 'tableTree',
56
56
  componentName: 'row',
57
57
  packageName: "@atlaskit/table-tree",
58
- packageVersion: "12.0.0"
58
+ packageVersion: "12.1.0"
59
59
  });
60
60
 
61
61
  /**
@@ -1,41 +1,5 @@
1
- import lodashGet from 'lodash/get';
2
- import lodashSet from 'lodash/set';
3
- import { fg } from '@atlaskit/platform-feature-flags';
4
- // https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore?tab=readme-ov-file#_get
5
- // https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13126
6
- export const internalGet = (obj, path, defaultValue = undefined) => {
7
- const travel = regexp => String.prototype.split.call(path, regexp).filter(Boolean).reduce((res, key) => res !== null && res !== undefined ? res[key] : res, obj);
8
- const result = travel(/[,[\]]+?/) || travel(/[,[\].]+?/);
9
- return result === undefined || result === obj ? defaultValue : result;
10
- };
11
-
12
- // https://stackoverflow.com/a/54733755/14857724
13
- // https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13673
14
- export const internalSet = (obj, providedPath, value) => {
15
- // When obj is not an object, fail gracefully
16
- if (Object(obj) !== obj) {
17
- return obj;
18
- }
19
-
20
- // If not yet an array, get the keys from the string-path
21
- const path = !Array.isArray(providedPath) ? providedPath.toString().match(/[^.[\]]+/g) || [] : providedPath;
22
-
23
- // Iterate all of them except the last one
24
- const result = path.slice(0, -1).reduce((acc, c, index) => {
25
- // Does the key exist and is its value an object?
26
- return Object(acc[c]) === acc[c] ? acc[c] // Yes: then follow that path
27
- :
28
- // No: create the key. Is the next key a potential array-index?
29
- acc[c] = Math.abs(parseInt(path[index + 1])) >> 0 === +path[index + 1] ? [] // Yes: assign a new array object
30
- : {}; // No: assign a new plain object
31
- }, obj);
32
-
33
- // Finally assign the value to the last key
34
- result[path[path.length - 1]] = value;
35
-
36
- // Return the top-level object to allow chaining
37
- return obj;
38
- };
1
+ import get from 'lodash/get';
2
+ import set from 'lodash/set';
39
3
  function updateRootItems(rootItems, allItems = [], {
40
4
  key,
41
5
  keysCache,
@@ -65,10 +29,6 @@ function updateChildItems(newitems, allTableItems, itemParent, {
65
29
  keysCache,
66
30
  operation
67
31
  }) {
68
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
69
- const get = fg('dst-a11y-remove-lodash-from-table-tree') ? internalGet : lodashGet;
70
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
71
- const set = fg('dst-a11y-remove-lodash-from-table-tree') ? internalSet : lodashSet;
72
32
  const newKeysCache = {
73
33
  ...keysCache
74
34
  };
@@ -52,7 +52,7 @@ function Row(_ref) {
52
52
  actionSubject: 'tableTree',
53
53
  componentName: 'row',
54
54
  packageName: "@atlaskit/table-tree",
55
- packageVersion: "12.0.0"
55
+ packageVersion: "12.1.0"
56
56
  });
57
57
  var onCollapse = usePlatformLeafEventHandler({
58
58
  fn: function fn(value) {
@@ -62,7 +62,7 @@ function Row(_ref) {
62
62
  actionSubject: 'tableTree',
63
63
  componentName: 'row',
64
64
  packageName: "@atlaskit/table-tree",
65
- packageVersion: "12.0.0"
65
+ packageVersion: "12.1.0"
66
66
  });
67
67
 
68
68
  /**
@@ -4,49 +4,8 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
- import lodashGet from 'lodash/get';
8
- import lodashSet from 'lodash/set';
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
- // https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore?tab=readme-ov-file#_get
11
- // https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13126
12
- export var internalGet = function internalGet(obj, path) {
13
- var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
14
- var travel = function travel(regexp) {
15
- return String.prototype.split.call(path, regexp).filter(Boolean).reduce(function (res, key) {
16
- return res !== null && res !== undefined ? res[key] : res;
17
- }, obj);
18
- };
19
- var result = travel(/[,[\]]+?/) || travel(/[,[\].]+?/);
20
- return result === undefined || result === obj ? defaultValue : result;
21
- };
22
-
23
- // https://stackoverflow.com/a/54733755/14857724
24
- // https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L13673
25
- export var internalSet = function internalSet(obj, providedPath, value) {
26
- // When obj is not an object, fail gracefully
27
- if (Object(obj) !== obj) {
28
- return obj;
29
- }
30
-
31
- // If not yet an array, get the keys from the string-path
32
- var path = !Array.isArray(providedPath) ? providedPath.toString().match(/[^.[\]]+/g) || [] : providedPath;
33
-
34
- // Iterate all of them except the last one
35
- var result = path.slice(0, -1).reduce(function (acc, c, index) {
36
- // Does the key exist and is its value an object?
37
- return Object(acc[c]) === acc[c] ? acc[c] // Yes: then follow that path
38
- :
39
- // No: create the key. Is the next key a potential array-index?
40
- acc[c] = Math.abs(parseInt(path[index + 1])) >> 0 === +path[index + 1] ? [] // Yes: assign a new array object
41
- : {}; // No: assign a new plain object
42
- }, obj);
43
-
44
- // Finally assign the value to the last key
45
- result[path[path.length - 1]] = value;
46
-
47
- // Return the top-level object to allow chaining
48
- return obj;
49
- };
7
+ import get from 'lodash/get';
8
+ import set from 'lodash/set';
50
9
  function updateRootItems(rootItems) {
51
10
  var allItems = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
52
11
  var _ref = arguments.length > 2 ? arguments[2] : undefined,
@@ -74,10 +33,6 @@ function updateChildItems(newitems, allTableItems, itemParent, _ref2) {
74
33
  var key = _ref2.key,
75
34
  keysCache = _ref2.keysCache,
76
35
  operation = _ref2.operation;
77
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
78
- var get = fg('dst-a11y-remove-lodash-from-table-tree') ? internalGet : lodashGet;
79
- // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
80
- var set = fg('dst-a11y-remove-lodash-from-table-tree') ? internalSet : lodashSet;
81
36
  var newKeysCache = _objectSpread({}, keysCache);
82
37
  var parentCacheKey = itemParent[key];
83
38
  if (parentCacheKey === undefined) {
@@ -1,5 +1,3 @@
1
- export declare const internalGet: (obj: Object, path: Array<any> | string, defaultValue?: any) => any;
2
- export declare const internalSet: (obj: Object, providedPath: Array<any> | string, value: any) => any;
3
1
  /**
4
2
  * This helper class will create a cache of all the id's in the items object and
5
3
  * path to the object.
@@ -22,6 +20,6 @@ export default class TableTreeDataHelper<T extends any = any> {
22
20
  constructor({ key }?: {
23
21
  key?: keyof T | undefined;
24
22
  });
25
- updateItems(items: T[], allItems?: T[], parentItem?: T | null): any;
26
- appendItems(items: T[], allItems?: T[], parentItem?: T | null): any;
23
+ updateItems(items: T[], allItems?: T[], parentItem?: T | null): T[];
24
+ appendItems(items: T[], allItems?: T[], parentItem?: T | null): T[];
27
25
  }
@@ -1,5 +1,3 @@
1
- export declare const internalGet: (obj: Object, path: Array<any> | string, defaultValue?: any) => any;
2
- export declare const internalSet: (obj: Object, providedPath: Array<any> | string, value: any) => any;
3
1
  /**
4
2
  * This helper class will create a cache of all the id's in the items object and
5
3
  * path to the object.
@@ -22,6 +20,6 @@ export default class TableTreeDataHelper<T extends any = any> {
22
20
  constructor({ key }?: {
23
21
  key?: keyof T | undefined;
24
22
  });
25
- updateItems(items: T[], allItems?: T[], parentItem?: T | null): any;
26
- appendItems(items: T[], allItems?: T[], parentItem?: T | null): any;
23
+ updateItems(items: T[], allItems?: T[], parentItem?: T | null): T[];
24
+ appendItems(items: T[], allItems?: T[], parentItem?: T | null): T[];
27
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/table-tree",
3
- "version": "12.0.0",
3
+ "version": "12.1.0",
4
4
  "description": "A table tree is an expandable table for showing nested hierarchies of information.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,8 +28,7 @@
28
28
  "@atlaskit/analytics-next": "^11.0.0",
29
29
  "@atlaskit/button": "^23.0.0",
30
30
  "@atlaskit/ds-lib": "^4.0.0",
31
- "@atlaskit/icon": "^25.4.0",
32
- "@atlaskit/platform-feature-flags": "^1.1.0",
31
+ "@atlaskit/icon": "^25.5.0",
33
32
  "@atlaskit/spinner": "^18.0.0",
34
33
  "@atlaskit/theme": "^18.0.0",
35
34
  "@atlaskit/tokens": "^4.6.0",
@@ -50,7 +49,7 @@
50
49
  "@atlaskit/link": "^3.1.0",
51
50
  "@atlaskit/primitives": "^14.3.0",
52
51
  "@atlaskit/section-message": "^8.2.0",
53
- "@atlaskit/select": "^20.0.0",
52
+ "@atlaskit/select": "^20.1.0",
54
53
  "@atlaskit/ssr": "^0.4.0",
55
54
  "@atlaskit/visually-hidden": "^3.0.0",
56
55
  "@atlassian/ssr-tests": "^0.2.0",