@neovici/cosmoz-treenode-navigator 5.4.2 → 5.6.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.4.2",
3
+ "version": "5.6.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,10 @@
20
20
  "directories": {
21
21
  "test": "test"
22
22
  },
23
+ "files": [
24
+ "cosmoz-*.js",
25
+ "helpers.js"
26
+ ],
23
27
  "scripts": {
24
28
  "lint": "eslint --cache --ext .js .",
25
29
  "start": "wds",
@@ -54,7 +58,8 @@
54
58
  }
55
59
  },
56
60
  "dependencies": {
57
- "@lit-labs/virtualizer": "^0.7.1",
61
+ "@lit-labs/virtualizer": "^2.0.0",
62
+ "@neovici/cfg": "^1.33.0",
58
63
  "@neovici/cosmoz-dialog": "^3.0.0",
59
64
  "@neovici/cosmoz-i18next": "^3.2.0",
60
65
  "@neovici/cosmoz-input": "^3.0.0",
@@ -71,7 +76,6 @@
71
76
  "devDependencies": {
72
77
  "@commitlint/cli": "^17.0.0",
73
78
  "@commitlint/config-conventional": "^17.0.0",
74
- "@neovici/cfg": "^1.15.2",
75
79
  "@open-wc/testing": "^3.0.0",
76
80
  "@polymer/iron-ajax": "^3.0.0",
77
81
  "@polymer/iron-component-page": "^4.0.0",
@@ -80,10 +84,8 @@
80
84
  "@polymer/test-fixture": "^4.0.2",
81
85
  "@semantic-release/changelog": "^6.0.0",
82
86
  "@semantic-release/git": "^10.0.0",
83
- "@web/dev-server": "^0.1.25",
84
- "@web/test-runner": "^0.13.19",
85
87
  "@webcomponents/webcomponentsjs": "^2.0.0",
86
88
  "husky": "^8.0.0",
87
- "semantic-release": "^19.0.3"
89
+ "semantic-release": "^21.0.1"
88
90
  }
89
91
  }
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,61 +0,0 @@
1
- ---
2
- name: Github CI
3
- on:
4
- pull_request:
5
- branches:
6
- - master
7
- push:
8
- branches:
9
- - master
10
- jobs:
11
- test:
12
- runs-on: ubuntu-latest
13
- steps:
14
- - name: Checkout
15
- uses: actions/checkout@v2
16
- with:
17
- fetch-depth: 0
18
-
19
- - name: Use Node.js
20
- uses: actions/setup-node@v2
21
- with:
22
- node-version: 16.x
23
- cache: 'npm'
24
-
25
- - name: Install
26
- run: npm ci
27
-
28
- - name: Lint commit messages
29
- uses: wagoid/commitlint-github-action@v3
30
-
31
- - name: ESLint
32
- run: npm run lint
33
-
34
- - name: Test and report
35
- env:
36
- CC_TEST_REPORTER_ID: 36a0219f9323e138cae8767b9b4a34a34ab33ec39027888c1c7c4d7da9c4ac44
37
- GIT_BRANCH: ${{ github.ref == 'refs/heads/master' && 'master' || github.ref }}
38
- GIT_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
39
- NEO_CC_URL: https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
40
- NEO_CC: ./cc-test-reporter
41
- SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
42
- SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
43
- run: |
44
- ([[ -e $NEO_CC ]] || curl -L $NEO_CC_URL > $NEO_CC) && chmod +x $NEO_CC
45
- $NEO_CC before-build
46
- echo "::add-matcher::.github/karma-problem-matcher.json"
47
- npm test
48
- $NEO_CC after-build --exit-code $?
49
-
50
- - name: Upload coverage to Codecov
51
- uses: codecov/codecov-action@v1
52
- with:
53
- token: ${{ secrets.CODECOV_TOKEN }}
54
-
55
- - name: Semantic release
56
- run: npx semantic-release
57
- if: success()
58
- env:
59
- HUSKY: 0
60
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
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,144 +0,0 @@
1
- ## [5.4.2](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.4.1...v5.4.2) (2022-12-01)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * handle missing tree ([8a45a18](https://github.com/neovici/cosmoz-treenode-navigator/commit/8a45a1828ff0304b760bbafb94e21fc8eac4af52))
7
-
8
- ## [5.4.1](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.4.0...v5.4.1) (2022-11-08)
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * **button-view:** update safari rule ([c98f7fc](https://github.com/neovici/cosmoz-treenode-navigator/commit/c98f7fc63328724fbd0e19ca06a9dc2b7acd8633))
14
-
15
- # [5.4.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.3.0...v5.4.0) (2022-11-03)
16
-
17
-
18
- ### Features
19
-
20
- * **select:** close dialog manually ([3abb0d0](https://github.com/neovici/cosmoz-treenode-navigator/commit/3abb0d0d75c11ad3e77001ba401f4fe998ad66a7))
21
-
22
- # [5.3.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.2.0...v5.3.0) (2022-08-01)
23
-
24
-
25
- ### Bug Fixes
26
-
27
- * close on enter ([e7cd4d1](https://github.com/neovici/cosmoz-treenode-navigator/commit/e7cd4d191abdf1b9486a5d097154f530130d4a96))
28
- * **cosmoz-treenode-button-view:** pass opened to treenode ([4f43ade](https://github.com/neovici/cosmoz-treenode-navigator/commit/4f43ade0844fe5168cf84f6f7833dc61a608e176))
29
- * **renderLevel:** handle leaf nodes ([760f6bf](https://github.com/neovici/cosmoz-treenode-navigator/commit/760f6bf4888ccbec0184ca72ea21ab4781e66f46))
30
-
31
-
32
- ### Features
33
-
34
- * **treenode-navigator:** autoscroll to highlighed node ([5c55a38](https://github.com/neovici/cosmoz-treenode-navigator/commit/5c55a38ad406b3d711405b8173c388fb26d5eb6c))
35
-
36
- # [5.2.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.1.0...v5.2.0) (2022-08-01)
37
-
38
-
39
- ### Features
40
-
41
- * **cosmoz-treenode-navigator:** improve performance ([ac12d74](https://github.com/neovici/cosmoz-treenode-navigator/commit/ac12d74345501e34cdccde6962563a24d6efed4f))
42
-
43
- # [5.1.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.0.1...v5.1.0) (2022-07-28)
44
-
45
-
46
- ### Bug Fixes
47
-
48
- * **ci:** worflow typo ([17b92aa](https://github.com/neovici/cosmoz-treenode-navigator/commit/17b92aa332f0411b6548729002fd9cf62a99d223))
49
-
50
-
51
- ### Features
52
-
53
- * **cosmoz-treenode-navigator:** add keyboard navigation ([26b6d42](https://github.com/neovici/cosmoz-treenode-navigator/commit/26b6d42d99737d0b48a7fbc21a8677117b1d8a9e))
54
- * refactor with lit-virtualizer instead of listbox ([7b69ab4](https://github.com/neovici/cosmoz-treenode-navigator/commit/7b69ab4e0e049c9c7f8e03c3b781f02fab83eb18))
55
- * support `Right` key ([28a4df6](https://github.com/neovici/cosmoz-treenode-navigator/commit/28a4df6d35bc62ac49aba81135891ce8fcacfa05))
56
-
57
- ## [5.0.1](https://github.com/neovici/cosmoz-treenode-navigator/compare/v5.0.0...v5.0.1) (2022-07-27)
58
-
59
-
60
- ### Bug Fixes
61
-
62
- * **search:** remove label ([950ed7c](https://github.com/neovici/cosmoz-treenode-navigator/commit/950ed7cef3ab282f5fea8925dae121c771723eab))
63
-
64
- # [5.0.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v4.0.0...v5.0.0) (2022-07-19)
65
-
66
-
67
- ### Features
68
-
69
- * upgrade to cosmoz-utils@5 ([8c70d76](https://github.com/neovici/cosmoz-treenode-navigator/commit/8c70d76d8157e0793f10566a7f75e98f44d0a67f))
70
-
71
-
72
- ### BREAKING CHANGES
73
-
74
- * Upgrade to cosmoz-utils@5
75
-
76
- # [4.0.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.1.1...v4.0.0) (2022-07-05)
77
-
78
-
79
- ### Code Refactoring
80
-
81
- * **migration:** index.html - Remove formatting changes ([c12af88](https://github.com/neovici/cosmoz-treenode-navigator/commit/c12af889c5b4f5f3b191538e2280c4b29b185b3e))
82
-
83
-
84
- ### BREAKING CHANGES
85
-
86
- * **migration:** migration to haunted.js and Lit
87
-
88
- ## [3.1.1](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.1.0...v3.1.1) (2022-06-02)
89
-
90
-
91
- ### Bug Fixes
92
-
93
- * **chips:** scrollbar for many chips ([dc68de6](https://github.com/neovici/cosmoz-treenode-navigator/commit/dc68de694ebedc8a78b4df8ecdf13d108a82f1f8))
94
-
95
- # [3.1.0](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.8...v3.1.0) (2021-12-07)
96
-
97
-
98
- ### Features
99
-
100
- * add button and icon slots ([d7ea96d](https://github.com/neovici/cosmoz-treenode-navigator/commit/d7ea96dc06bf01e3dc33cbf76fa523524d67ba2c))
101
-
102
- ## [3.0.8](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.7...v3.0.8) (2021-10-17)
103
-
104
-
105
- ### Bug Fixes
106
-
107
- * css comments ([f9d97f3](https://github.com/neovici/cosmoz-treenode-navigator/commit/f9d97f3e257044e6ebd78f69f3571c8663a741a9))
108
-
109
- ## [3.0.7](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.6...v3.0.7) (2021-10-17)
110
-
111
-
112
- ### Bug Fixes
113
-
114
- * **cosmoz-treenode-button-view:** ios rtl overflow ([80725a7](https://github.com/neovici/cosmoz-treenode-navigator/commit/80725a763f29171cb6af20af81a02a82d1304369))
115
-
116
- ## [3.0.6](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.5...v3.0.6) (2021-10-16)
117
-
118
-
119
- ### Bug Fixes
120
-
121
- * **cosmoz-treenode-button-view:** rtl fixes ([43e70a3](https://github.com/neovici/cosmoz-treenode-navigator/commit/43e70a3684ce2187d0afbb0666613d62067ef02a))
122
-
123
- ## [3.0.5](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.4...v3.0.5) (2021-10-16)
124
-
125
-
126
- ### Bug Fixes
127
-
128
- * **cosmoz-treenode-button-view:** mobile tweaks ([d9444c4](https://github.com/neovici/cosmoz-treenode-navigator/commit/d9444c47f1bf587579fade958efab47dd9687e3c))
129
- * **cosmoz-treenode-navigator:** remove iron-flex-layout ([6cc69b6](https://github.com/neovici/cosmoz-treenode-navigator/commit/6cc69b67e75e92f2c0953f95061b0199e41fa5e3))
130
- * replace tap with click ([505d103](https://github.com/neovici/cosmoz-treenode-navigator/commit/505d103f6f84ccdcbdcf5571bdb53abed0703386))
131
-
132
- ## [3.0.4](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.3...v3.0.4) (2020-01-06)
133
-
134
-
135
- ### Bug Fixes
136
-
137
- * sections were incorrectly created ([dfb4919](https://github.com/neovici/cosmoz-treenode-navigator/commit/dfb4919943379464a676a55e06348413a1d9c550))
138
-
139
- ## [3.0.3](https://github.com/neovici/cosmoz-treenode-navigator/compare/v3.0.2...v3.0.3) (2019-10-10)
140
-
141
-
142
- ### Bug Fixes
143
-
144
- * **ci:** adopt semantic release ([c3ea8c0](https://github.com/neovici/cosmoz-treenode-navigator/commit/c3ea8c08f68d86942b9aef1319a0ee60390dadd7))