@rokkit/core 1.0.0-next.108 → 1.0.0-next.109

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.
@@ -41,9 +41,7 @@ export class FieldMapper {
41
41
  getValue(value: any): any;
42
42
  getFormattedText(value: any, formatter: any): any;
43
43
  hasChildren(item: any): item is never;
44
- isHidden(item: any): unknown;
45
44
  isNested(items: any): boolean;
46
- toggleVisibility(items: any, visible: any): void;
47
45
  getChildren(item: any): never[];
48
46
  /**
49
47
  * Finds children by an index path
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/core",
3
- "version": "1.0.0-next.108",
3
+ "version": "1.0.0-next.109",
4
4
  "description": "Contains core utility functions and classes that can be used in various components.",
5
5
  "author": "Jerry Thomas <me@jerrythomas.name>",
6
6
  "license": "MIT",
@@ -104,23 +104,10 @@ export class FieldMapper {
104
104
  )
105
105
  }
106
106
 
107
- isHidden(item) {
108
- return has(this.fields.isHidden, item) && item[this.fields.isHidden]
109
- }
110
-
111
107
  isNested(items) {
112
108
  return Array.isArray(items) && items.some((item) => this.hasChildren(item))
113
109
  }
114
110
 
115
- toggleVisibility(items, visible) {
116
- items.forEach((item) => {
117
- item[this.fields.isHidden] = !visible
118
- if (this.hasChildren(item)) {
119
- this.toggleVisibility(item[this.fields.children], visible && item[this.fields.isOpen])
120
- }
121
- })
122
- }
123
-
124
111
  getChildren(item) {
125
112
  return this.hasChildren(item) ? item[this.fields.children] : []
126
113
  }
@@ -150,10 +137,9 @@ export class FieldMapper {
150
137
  * @returns {Object|null}
151
138
  */
152
139
  getItemByPath(items, path = []) {
153
- // skipcq: JS-W1042 default undefined is needed
154
140
  const result = path.reduce(
155
141
  (item, index, i) => (i === 0 ? items?.[index] : item?.[this.fields.children]?.[index]),
156
- undefined
142
+ /* skipcq: JS-W1042 default undefined is needed */ undefined
157
143
  )
158
144
 
159
145
  if (result === undefined) throw new Error('Invalid path')