@neovici/cosmoz-omnitable 8.8.0 → 8.8.1

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.
@@ -4,13 +4,15 @@ import { without } from '@neovici/cosmoz-utils/lib/array';
4
4
 
5
5
  const direction = (descending) =>
6
6
  `(${descending ? _('Descending') : _('Ascending')})`,
7
- values = (columns, type, value) => {
8
- return (
7
+ values = (columns, groupOn) => {
8
+ const value = columns.find((column) => column.name === groupOn);
9
+ return [
10
+ value,
9
11
  columns
10
- ?.filter?.((c) => c[type])
12
+ ?.filter?.((c) => c['groupOn'])
11
13
  /* eslint-disable-next-line no-bitwise */
12
- .sort((a, b) => ((b === value) >> 0) - ((a === value) >> 0))
13
- );
14
+ .sort((a, b) => ((b.name === value) >> 0) - ((a.name === value) >> 0)),
15
+ ];
14
16
  },
15
17
  onSelect = (newVal, { value, onChange, onText, limit }) => {
16
18
  onText('');
@@ -43,37 +45,40 @@ export default () => html`
43
45
  .render=${({
44
46
  columns,
45
47
  groupOnDescending,
46
- groupOnColumn,
48
+ groupOn,
47
49
  setGroupOn,
48
50
  setGroupOnDescending,
49
- } = {}) => html` <div class="group">
50
- <cosmoz-autocomplete
51
- .label="${_('Group on')} ${direction(groupOnDescending)}"
52
- .placeholder=${_('No grouping')}
53
- .source=${values(columns, 'groupOn', groupOnColumn)}
54
- .value=${groupOnColumn}
55
- limit="1"
56
- text-property="title"
57
- always-float-label
58
- .itemHeight=${48}
59
- .itemLimit=${8}
60
- .onChange=${onChange({ setGroupOn, setGroupOnDescending })}
61
- .onSelect=${onSelect}
62
- default-index="-1"
63
- show-single
64
- >
65
- <svg
66
- slot="suffix"
67
- viewBox="0 0 24 24"
68
- preserveAspectRatio="xMidYMid meet"
69
- focusable="false"
70
- width="24"
71
- fill="currentColor"
51
+ } = {}) => {
52
+ const [groupOnColumn, source] = values(columns, groupOn);
53
+ return html` <div class="group">
54
+ <cosmoz-autocomplete
55
+ .label="${_('Group on')} ${direction(groupOnDescending)}"
56
+ .placeholder=${_('No grouping')}
57
+ .source=${source}
58
+ .value=${groupOnColumn}
59
+ limit="1"
60
+ text-property="title"
61
+ always-float-label
62
+ .itemHeight=${48}
63
+ .itemLimit=${8}
64
+ .onChange=${onChange({ setGroupOn, setGroupOnDescending })}
65
+ .onSelect=${onSelect}
66
+ default-index="-1"
67
+ show-single
72
68
  >
73
- <path d="M7 10l5 5 5-5z"></path>
74
- </svg>
75
- </cosmoz-autocomplete>
76
- </div>`}
69
+ <svg
70
+ slot="suffix"
71
+ viewBox="0 0 24 24"
72
+ preserveAspectRatio="xMidYMid meet"
73
+ focusable="false"
74
+ width="24"
75
+ fill="currentColor"
76
+ >
77
+ <path d="M7 10l5 5 5-5z"></path>
78
+ </svg>
79
+ </cosmoz-autocomplete>
80
+ </div>`;
81
+ }}
77
82
  >
78
83
  </sort-and-group-consumer>
79
84
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-omnitable",
3
- "version": "8.8.0",
3
+ "version": "8.8.1",
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"