@neovici/cosmoz-omnitable 8.1.0 → 8.2.2

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.
@@ -85,6 +85,13 @@ export const
85
85
  }
86
86
 
87
87
  deserializeFilter(column, filter) {
88
+ if (filter == null) {
89
+ return null;
90
+ }
91
+
92
+ if (typeof filter === 'string') {
93
+ return window.decodeURIComponent(filter);
94
+ }
88
95
  return filter;
89
96
  }
90
97
 
@@ -28,7 +28,7 @@ const
28
28
  setState(state => ({ ...state, headerFocused: event.detail.value })),
29
29
 
30
30
  resetFilter = setState => () =>
31
- setState(state => ({ ...state, filter: undefined, inputValue: undefined })),
31
+ setState(state => ({ ...state, filter: null, inputValue: null })),
32
32
 
33
33
  hasFilter = filter => filter != null && filter !== '';
34
34
 
@@ -30,7 +30,7 @@ const placement = ['bottom-right', ...defaultPlacement],
30
30
  pointer-events: none;
31
31
  }
32
32
  .item.dragover {
33
- box-shadow: 0 -2px 0 0 black;
33
+ box-shadow: 0 -2px 0 0 currentColor;
34
34
  }
35
35
  .sort {
36
36
  border: none;
@@ -49,15 +49,32 @@ const placement = ['bottom-right', ...defaultPlacement],
49
49
  font-weight: bold;
50
50
  }
51
51
  ${ checkbox }
52
- .footer {
52
+
53
+ .buttons {
53
54
  display: flex;
54
55
  margin-top: 10px;
56
+ gap: 7px;
55
57
  }
56
- .footer > button {
58
+ .button {
59
+ border: none;
60
+ cursor: pointer;
61
+ background: var(--cosmoz-button-bg-color, #101010);
62
+ color: var(--cosmoz-button-color, #fff);
63
+ font-family: inherit;
64
+ font-size: 13px;
65
+ font-weight: 500;
66
+ line-height: 26px;
67
+ height: 26px;
68
+ border-radius: 4px;
69
+ padding: 0 8px;
57
70
  flex: 1;
58
71
  }
59
- .footer > button:first-child {
60
- margin-right: 5px;
72
+ .button:hover {
73
+ background: var(--cosmoz-button-hover-bg-color, #3A3F44);
74
+ }
75
+ .button[disabled] {
76
+ opacity: 0.7;
77
+ pointer-events: none;
61
78
  }
62
79
  `,
63
80
 
@@ -185,9 +202,9 @@ const placement = ['bottom-right', ...defaultPlacement],
185
202
  <div class="list">${ settings?.map(renderItem(thru)) }</div>
186
203
  `,
187
204
  settingsId
188
- ? html`<div class="footer">
189
- <button @click=${ onSave } ?disabled=${ !hasChanges }>Save</button>
190
- <button @click=${ onReset } ?disabled=${ !hasChanges }>Reset</button>
205
+ ? html`<div class="buttons">
206
+ <button class="button" @click=${ onSave } ?disabled=${ !hasChanges }>Save</button>
207
+ <button class="button" @click=${ onReset } ?disabled=${ !hasChanges }>Reset</button>
191
208
  </div>`
192
209
  : nothing
193
210
  ];
@@ -197,6 +214,7 @@ const placement = ['bottom-right', ...defaultPlacement],
197
214
  <style>
198
215
  :host {
199
216
  display: contents;
217
+ color: var(--cosmoz-omnitable-settings-color, #101010);
200
218
  --cosmoz-dropdown-box-shadow: 0 3px 4px 0 rgb(0 0 0 / 14%), 0 1px 8px 0 rgb(0 0 0 / 12%), 0 3px 3px -2px rgb(0 0 0 / 40%);
201
219
  }
202
220
  cosmoz-dropdown::part(button) {
@@ -204,6 +222,7 @@ const placement = ['bottom-right', ...defaultPlacement],
204
222
  margin-bottom: 10px;
205
223
  padding: 0;
206
224
  background: transparent;
225
+ color: inherit;
207
226
  }
208
227
  cosmoz-dropdown::part(anchor) {
209
228
  display: inline-block;
@@ -222,7 +241,7 @@ const placement = ['bottom-right', ...defaultPlacement],
222
241
  .anchor=${ anchor } .settings=${ settings } .onSettings=${ onSettings } .collapsed=${ collapsed }
223
242
  .settingsId=${ settingsId } .hasChanges=${ hasChanges } .onSave=${ onSave } .onReset=${ onReset }
224
243
  .filters=${ filters }></cosmoz-omnitable-settings-ui>` } .placement=${ placement }>
225
- <svg viewBox="0 0 24 24" width="24" slot="button"><path d="M10 18h5V5h-5v13zm-6 0h5V5H4v13zM16 5v13h5V5h-5z"></path></svg>
244
+ <svg viewBox="0 0 24 24" width="24" slot="button" fill="currentColor"><path d="M10 18h5V5h-5v13zm-6 0h5V5H4v13zM16 5v13h5V5h-5z"></path></svg>
226
245
  ${ badge ? html`<div class="badge" slot="button"></div>` : nothing }
227
246
  </cosmoz-dropdown>
228
247
  `;
@@ -21,6 +21,7 @@ const
21
21
  url = hashUrl(),
22
22
  searchParams = new URLSearchParams(url.hash.replace('#', ''));
23
23
 
24
+ // TODO: make parameterize pure
24
25
  parameterize(hashParam, value, codec, searchParams);
25
26
 
26
27
  return '#!' + Object.assign(url, { hash: searchParams }).href.replace(location.origin, '');
@@ -34,7 +34,7 @@ export const useProcessedItems = ({ data, columns, groupOnColumn, groupOnDescend
34
34
  if (column == null) {
35
35
  return [filter, undefined];
36
36
  }
37
- // TODO: add try-catch
37
+
38
38
  const state = { filter: column.deserializeFilter(column, value) };
39
39
  notifyChanges(column, state);
40
40
  return [filter, state];
package/lib/utils-data.js CHANGED
@@ -2,11 +2,12 @@ import { get, set } from '@polymer/polymer/lib/utils/path';
2
2
  import { columnSymbol } from './use-dom-columns';
3
3
 
4
4
  export const
5
- valuesFrom = (data, valuePath) => data
6
- ?.map(item => get(item, valuePath))
7
- .filter((value, index, self) =>
8
- value != null && self.indexOf(value) === index
9
- ),
5
+ valuesFrom = (data, valuePath) => Array.isArray(data) ?
6
+ data.map(item => get(item, valuePath))
7
+ .filter((value, index, self) =>
8
+ value != null && self.indexOf(value) === index
9
+ )
10
+ : undefined,
10
11
 
11
12
  defaultComputeSource = ({ externalValues, values, valuePath }, data) =>
12
13
  externalValues || typeof values === 'function'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-omnitable",
3
- "version": "8.1.0",
3
+ "version": "8.2.2",
4
4
  "description": "[![Build Status](https://travis-ci.org/Neovici/cosmoz-omnitable.svg?branch=master)](https://travis-ci.org/Neovici/cosmoz-omnitable)",
5
5
  "keywords": [
6
6
  "web-components"
@@ -74,8 +74,8 @@
74
74
  "lit-html": "^1.3.0"
75
75
  },
76
76
  "devDependencies": {
77
- "@commitlint/cli": "^15.0.0",
78
- "@commitlint/config-conventional": "^15.0.0",
77
+ "@commitlint/cli": "^16.0.0",
78
+ "@commitlint/config-conventional": "^16.0.0",
79
79
  "@neovici/cosmoz-viewinfo": "^3.1.3",
80
80
  "@neovici/eslint-config": "^1.3.3",
81
81
  "@open-wc/testing": "^2.5.28",