@neovici/cosmoz-treenode-navigator 5.5.0 → 5.7.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.
@@ -6,7 +6,7 @@ import {
6
6
  useCallback,
7
7
  useRef,
8
8
  } from 'haunted';
9
- import { html } from 'lit-html';
9
+ import { html, nothing } from 'lit-html';
10
10
  import { when } from 'lit-html/directives/when.js';
11
11
  import { guard } from 'lit-html/directives/guard.js';
12
12
  import { ref } from 'lit-html/directives/ref.js';
@@ -61,14 +61,14 @@ const TreenodeNavigator = (host) => {
61
61
  [searchValue, setSearchValue] = useState(''),
62
62
  search = useMemo(
63
63
  () => (searchValue?.length > searchMinLength && searchValue) || undefined,
64
- [searchValue, searchMinLength]
64
+ [searchValue, searchMinLength],
65
65
  ),
66
66
  /**
67
67
  * The currently displayed node list
68
68
  */
69
69
  dataPlane = useMemo(
70
70
  () => computeDataPlane(tree, search, openNodePath),
71
- [tree, search, openNodePath]
71
+ [tree, search, openNodePath],
72
72
  ),
73
73
  /**
74
74
  * Opens a node (renderLevel) based on a given path
@@ -81,7 +81,7 @@ const TreenodeNavigator = (host) => {
81
81
  setSearchValue('');
82
82
  setHighlightedNode();
83
83
  },
84
- [tree]
84
+ [tree],
85
85
  ),
86
86
  listRef = useRef();
87
87
 
@@ -102,7 +102,7 @@ const TreenodeNavigator = (host) => {
102
102
  notifyProperty(
103
103
  host,
104
104
  'highlightedNodePath',
105
- highlightedNode?.pathLocator || ''
105
+ highlightedNode?.pathLocator || '',
106
106
  );
107
107
  }, [highlightedNode]);
108
108
 
@@ -191,46 +191,48 @@ const TreenodeNavigator = (host) => {
191
191
  return () => document.removeEventListener('keydown', handler, true);
192
192
  }, [opened, meta]);
193
193
 
194
- const renderItem = (node, index) => html` <div class="item">
195
- ${((parentPath) =>
196
- when(
197
- search &&
198
- (index === 0 ||
199
- parentPath !== getParentPath(tree, dataPlane[index - 1])),
200
- () =>
201
- html`
202
- <div class="section">
203
- ${tree.getPathString(parentPath, tree.searchProperty)}
204
- </div>
205
- `
206
- ))(getParentPath(tree, node))}
207
- <div
208
- class=${computeRowClass('node', node, highlightedNode)}
209
- @click=${() => setHighlightedNode(node)}
210
- @dblclick=${(e) => onNodeDblClicked(e, host)}
211
- >
212
- <div class="name">${node[tree.searchProperty]}</div>
213
- ${when(
214
- tree.hasChildren(node),
215
- () => html`
216
- <span class="icon" @click=${() => openNode(node)}>
217
- <svg
218
- viewBox="0 0 24 24"
219
- preserveAspectRatio="xMidYMid meet"
220
- focusable="false"
221
- style="pointer-events: none; display: block; width: 100%; height: 100%;"
222
- >
223
- <g>
224
- <path
225
- d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
226
- ></path>
227
- </g>
228
- </svg>
229
- </span>
230
- `
231
- )}
232
- </div>
233
- </div>`;
194
+ const renderItem = (node, index) =>
195
+ node
196
+ ? html` <div class="item">
197
+ ${((parentPath) =>
198
+ when(
199
+ search &&
200
+ (index === 0 ||
201
+ parentPath !== getParentPath(tree, dataPlane[index - 1])),
202
+ () => html`
203
+ <div class="section">
204
+ ${tree.getPathString(parentPath, tree.searchProperty)}
205
+ </div>
206
+ `,
207
+ ))(getParentPath(tree, node))}
208
+ <div
209
+ class=${computeRowClass('node', node, highlightedNode)}
210
+ @click=${() => setHighlightedNode(node)}
211
+ @dblclick=${(e) => onNodeDblClicked(e, host)}
212
+ >
213
+ <div class="name">${node[tree.searchProperty]}</div>
214
+ ${when(
215
+ tree.hasChildren(node),
216
+ () => html`
217
+ <span class="icon" @click=${() => openNode(node)}>
218
+ <svg
219
+ viewBox="0 0 24 24"
220
+ preserveAspectRatio="xMidYMid meet"
221
+ focusable="false"
222
+ style="pointer-events: none; display: block; width: 100%; height: 100%;"
223
+ >
224
+ <g>
225
+ <path
226
+ d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
227
+ ></path>
228
+ </g>
229
+ </svg>
230
+ </span>
231
+ `,
232
+ )}
233
+ </div>
234
+ </div>`
235
+ : nothing;
234
236
 
235
237
  return html`
236
238
  <style>
@@ -255,8 +257,8 @@ const TreenodeNavigator = (host) => {
255
257
  <span class="pointer" tabindex="0" @click=${() => openNode(node)}
256
258
  >${node[tree.searchProperty]}</span
257
259
  >
258
- `
259
- )
260
+ `,
261
+ ),
260
262
  )}
261
263
  </h3>
262
264
  <cosmoz-input
@@ -268,14 +270,15 @@ const TreenodeNavigator = (host) => {
268
270
  </div>
269
271
  ${when(
270
272
  tree,
271
- () => html` <div class="items" ${ref((el) => (listRef.current = el))}>
272
- <div virtualizer-sizer></div>
273
- ${virtualize({
274
- items: dataPlane,
275
- renderItem,
276
- scroller: true,
277
- })}
278
- </div>`
273
+ () =>
274
+ html` <div class="items" ${ref((el) => (listRef.current = el))}>
275
+ <div virtualizer-sizer></div>
276
+ ${virtualize({
277
+ items: dataPlane,
278
+ renderItem,
279
+ scroller: true,
280
+ })}
281
+ </div>`,
279
282
  )}
280
283
  ${when(
281
284
  search && openNodePath,
@@ -283,12 +286,12 @@ const TreenodeNavigator = (host) => {
283
286
  <button class="btn-ghost" @click=${() => setOpenNodePath('')}>
284
287
  ${searchGlobalPlaceholder}
285
288
  </button>
286
- `
289
+ `,
287
290
  )}
288
291
  `;
289
292
  };
290
293
 
291
294
  customElements.define(
292
295
  'cosmoz-treenode-navigator',
293
- component(TreenodeNavigator)
296
+ component(TreenodeNavigator),
294
297
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-treenode-navigator",
3
- "version": "5.5.0",
3
+ "version": "5.7.0",
4
4
  "description": "A Polymer component that lets you navigate and search through hierarchically structured data-nodes and select one of them.",
5
5
  "keywords": [
6
6
  "polymer",
@@ -20,6 +20,11 @@
20
20
  "directories": {
21
21
  "test": "test"
22
22
  },
23
+ "files": [
24
+ "cosmoz-*.js",
25
+ "helpers.js",
26
+ "test/data"
27
+ ],
23
28
  "scripts": {
24
29
  "lint": "eslint --cache --ext .js .",
25
30
  "start": "wds",
package/.codeclimate.yml DELETED
@@ -1,28 +0,0 @@
1
- ---
2
- engines:
3
- eslint:
4
- enabled: true
5
- checks:
6
- complexity:
7
- enabled: false
8
- config:
9
- sanitize_batch: false
10
- extensions:
11
- - .js
12
- - .html
13
-
14
- duplication:
15
- enabled: true
16
- config:
17
- languages:
18
- - javascript
19
-
20
- fixme:
21
- enabled: true
22
- exclude_paths:
23
- - "analysis.json"
24
-
25
- ratings:
26
- paths:
27
- - "**.js"
28
- - "**.html"
package/.editorconfig DELETED
@@ -1,16 +0,0 @@
1
- # EditorConfig helps developers define and maintain consistent
2
- # coding styles between different editors and IDEs
3
- # editorconfig.org
4
-
5
- root = true
6
-
7
- [*]
8
- indent_style = tab
9
- trim_trailing_whitespace = true
10
- insert_final_newline = true
11
-
12
- [*.yml]
13
- indent_style = space
14
-
15
- [*.md]
16
- trim_trailing_whitespace = false
package/.eslintignore DELETED
@@ -1 +0,0 @@
1
- /coverage/
package/.eslintrc DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./node_modules/@neovici/cfg/eslint",
3
- "rules": {
4
- "max-lines-per-function": 0,
5
- "import/group-exports": 0
6
- }
7
- }
@@ -1,30 +0,0 @@
1
- {
2
- "problemMatcher": [{
3
- "owner": "karma-eval",
4
- "pattern": [{
5
- "regexp": "^\\w+\\s\\d+\\.\\d+\\.\\d+\\s\\(\\w+\\s\\d+\\.\\d+\\.\\d+\\)\\sERROR$"
6
- }, {
7
- "regexp": "^\\s{2}(.*)$",
8
- "message": 1
9
- }, {
10
- "regexp": "^\\s{2}at\\s([^:]*):(\\d+):(\\d+)$",
11
- "file": 1,
12
- "line": 2,
13
- "column": 3
14
- }]
15
- }, {
16
- "owner": "karma-test-error",
17
- "pattern": [{
18
- "regexp": "^\\w+\\s\\d+\\.\\d+\\.\\d+\\s\\(\\w+\\s\\d+\\.\\d+\\.\\d+\\)\\s(.*)FAILED$",
19
- "code": 1
20
- }, {
21
- "regexp": "^\\t(.*)$",
22
- "message": 1
23
- }, {
24
- "regexp": "^\\t {4}at\\s[^\\s]*\\s\\(([^:]*):(\\d+):(\\d+)\\)$",
25
- "file": 1,
26
- "line": 2,
27
- "column": 3
28
- }]
29
- }]
30
- }
@@ -1,13 +0,0 @@
1
- name: CI
2
- on:
3
- pull_request:
4
- branches:
5
- - master
6
- push:
7
- branches:
8
- - beta
9
- - master
10
- jobs:
11
- build:
12
- uses: Neovici/cfg/.github/workflows/forge.yml@master
13
- secrets: inherit
package/.husky/commit-msg DELETED
@@ -1,4 +0,0 @@
1
- #!/bin/sh
2
- . "$(dirname "$0")/_/husky.sh"
3
-
4
- npx --no-install commitlint --edit $1
package/.prettierrc DELETED
@@ -1 +0,0 @@
1
- "@neovici/cfg/prettier"
package/CHANGELOG.md DELETED
@@ -1,151 +0,0 @@
1
- # [5.5.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.4.2...v5.5.0) (2023-04-25)
2
-
3
-
4
- ### Features
5
-
6
- * update virtualizer ([5112227](https://github.com/neovici/cosmoz-treenode-navigator/commit/51122278c26cbe01b90d1bc155b0dcb5c3a5e0b0))
7
-
8
- ## [5.4.2](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.4.1...v5.4.2) (2022-12-01)
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * handle missing tree ([8a45a18](https://github.com/neovici/cosmoz-treenode-navigator/commit/8a45a1828ff0304b760bbafb94e21fc8eac4af52))
14
-
15
- ## [5.4.1](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.4.0...v5.4.1) (2022-11-08)
16
-
17
-
18
- ### Bug Fixes
19
-
20
- * **button-view:** update safari rule ([c98f7fc](https://github.com/neovici/cosmoz-treenode-navigator/commit/c98f7fc63328724fbd0e19ca06a9dc2b7acd8633))
21
-
22
- # [5.4.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.3.0...v5.4.0) (2022-11-03)
23
-
24
-
25
- ### Features
26
-
27
- * **select:** close dialog manually ([3abb0d0](https://github.com/neovici/cosmoz-treenode-navigator/commit/3abb0d0d75c11ad3e77001ba401f4fe998ad66a7))
28
-
29
- # [5.3.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.2.0...v5.3.0) (2022-08-01)
30
-
31
-
32
- ### Bug Fixes
33
-
34
- * close on enter ([e7cd4d1](https://github.com/neovici/cosmoz-treenode-navigator/commit/e7cd4d191abdf1b9486a5d097154f530130d4a96))
35
- * **cosmoz-treenode-button-view:** pass opened to treenode ([4f43ade](https://github.com/neovici/cosmoz-treenode-navigator/commit/4f43ade0844fe5168cf84f6f7833dc61a608e176))
36
- * **renderLevel:** handle leaf nodes ([760f6bf](https://github.com/neovici/cosmoz-treenode-navigator/commit/760f6bf4888ccbec0184ca72ea21ab4781e66f46))
37
-
38
-
39
- ### Features
40
-
41
- * **treenode-navigator:** autoscroll to highlighed node ([5c55a38](https://github.com/neovici/cosmoz-treenode-navigator/commit/5c55a38ad406b3d711405b8173c388fb26d5eb6c))
42
-
43
- # [5.2.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.1.0...v5.2.0) (2022-08-01)
44
-
45
-
46
- ### Features
47
-
48
- * **cosmoz-treenode-navigator:** improve performance ([ac12d74](https://github.com/neovici/cosmoz-treenode-navigator/commit/ac12d74345501e34cdccde6962563a24d6efed4f))
49
-
50
- # [5.1.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.0.1...v5.1.0) (2022-07-28)
51
-
52
-
53
- ### Bug Fixes
54
-
55
- * **ci:** worflow typo ([17b92aa](https://github.com/neovici/cosmoz-treenode-navigator/commit/17b92aa332f0411b6548729002fd9cf62a99d223))
56
-
57
-
58
- ### Features
59
-
60
- * **cosmoz-treenode-navigator:** add keyboard navigation ([26b6d42](https://github.com/neovici/cosmoz-treenode-navigator/commit/26b6d42d99737d0b48a7fbc21a8677117b1d8a9e))
61
- * refactor with lit-virtualizer instead of listbox ([7b69ab4](https://github.com/neovici/cosmoz-treenode-navigator/commit/7b69ab4e0e049c9c7f8e03c3b781f02fab83eb18))
62
- * support `Right` key ([28a4df6](https://github.com/neovici/cosmoz-treenode-navigator/commit/28a4df6d35bc62ac49aba81135891ce8fcacfa05))
63
-
64
- ## [5.0.1](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.0.0...v5.0.1) (2022-07-27)
65
-
66
-
67
- ### Bug Fixes
68
-
69
- * **search:** remove label ([950ed7c](https://github.com/neovici/cosmoz-treenode-navigator/commit/950ed7cef3ab282f5fea8925dae121c771723eab))
70
-
71
- # [5.0.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v4.0.0...v5.0.0) (2022-07-19)
72
-
73
-
74
- ### Features
75
-
76
- * upgrade to cosmoz-utils@5 ([8c70d76](https://github.com/neovici/cosmoz-treenode-navigator/commit/8c70d76d8157e0793f10566a7f75e98f44d0a67f))
77
-
78
-
79
- ### BREAKING CHANGES
80
-
81
- * Upgrade to cosmoz-utils@5
82
-
83
- # [4.0.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.1.1...v4.0.0) (2022-07-05)
84
-
85
-
86
- ### Code Refactoring
87
-
88
- * **migration:** index.html - Remove formatting changes ([c12af88](https://github.com/neovici/cosmoz-treenode-navigator/commit/c12af889c5b4f5f3b191538e2280c4b29b185b3e))
89
-
90
-
91
- ### BREAKING CHANGES
92
-
93
- * **migration:** migration to haunted.js and Lit
94
-
95
- ## [3.1.1](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.1.0...v3.1.1) (2022-06-02)
96
-
97
-
98
- ### Bug Fixes
99
-
100
- * **chips:** scrollbar for many chips ([dc68de6](https://github.com/neovici/cosmoz-treenode-navigator/commit/dc68de694ebedc8a78b4df8ecdf13d108a82f1f8))
101
-
102
- # [3.1.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.8...v3.1.0) (2021-12-07)
103
-
104
-
105
- ### Features
106
-
107
- * add button and icon slots ([d7ea96d](https://github.com/neovici/cosmoz-treenode-navigator/commit/d7ea96dc06bf01e3dc33cbf76fa523524d67ba2c))
108
-
109
- ## [3.0.8](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.7...v3.0.8) (2021-10-17)
110
-
111
-
112
- ### Bug Fixes
113
-
114
- * css comments ([f9d97f3](https://github.com/neovici/cosmoz-treenode-navigator/commit/f9d97f3e257044e6ebd78f69f3571c8663a741a9))
115
-
116
- ## [3.0.7](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.6...v3.0.7) (2021-10-17)
117
-
118
-
119
- ### Bug Fixes
120
-
121
- * **cosmoz-treenode-button-view:** ios rtl overflow ([80725a7](https://github.com/neovici/cosmoz-treenode-navigator/commit/80725a763f29171cb6af20af81a02a82d1304369))
122
-
123
- ## [3.0.6](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.5...v3.0.6) (2021-10-16)
124
-
125
-
126
- ### Bug Fixes
127
-
128
- * **cosmoz-treenode-button-view:** rtl fixes ([43e70a3](https://github.com/neovici/cosmoz-treenode-navigator/commit/43e70a3684ce2187d0afbb0666613d62067ef02a))
129
-
130
- ## [3.0.5](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.4...v3.0.5) (2021-10-16)
131
-
132
-
133
- ### Bug Fixes
134
-
135
- * **cosmoz-treenode-button-view:** mobile tweaks ([d9444c4](https://github.com/neovici/cosmoz-treenode-navigator/commit/d9444c47f1bf587579fade958efab47dd9687e3c))
136
- * **cosmoz-treenode-navigator:** remove iron-flex-layout ([6cc69b6](https://github.com/neovici/cosmoz-treenode-navigator/commit/6cc69b67e75e92f2c0953f95061b0199e41fa5e3))
137
- * replace tap with click ([505d103](https://github.com/neovici/cosmoz-treenode-navigator/commit/505d103f6f84ccdcbdcf5571bdb53abed0703386))
138
-
139
- ## [3.0.4](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.3...v3.0.4) (2020-01-06)
140
-
141
-
142
- ### Bug Fixes
143
-
144
- * sections were incorrectly created ([dfb4919](https://github.com/neovici/cosmoz-treenode-navigator/commit/dfb4919943379464a676a55e06348413a1d9c550))
145
-
146
- ## [3.0.3](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.2...v3.0.3) (2019-10-10)
147
-
148
-
149
- ### Bug Fixes
150
-
151
- * **ci:** adopt semantic release ([c3ea8c0](https://github.com/neovici/cosmoz-treenode-navigator/commit/c3ea8c08f68d86942b9aef1319a0ee60390dadd7))