@neovici/cosmoz-omnitable 12.3.0 → 12.4.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.
@@ -2,6 +2,7 @@ import { html, component } from 'haunted';
2
2
  import { repeat } from 'lit-html/directives/repeat.js';
3
3
  import './lib/cosmoz-omnitable-resize-nub';
4
4
  import { render } from './lib/settings/cosmoz-omnitable-sort-group';
5
+ import { when } from 'lit-html/directives/when.js';
5
6
 
6
7
  const /* eslint-disable-next-line max-lines-per-function */
7
8
  renderHeaderRow = ({
@@ -53,15 +54,16 @@ const /* eslint-disable-next-line max-lines-per-function */
53
54
  ></cosmoz-omnitable-resize-nub>`,
54
55
  ]
55
56
  ),
56
- HeaderRow = ({ columns, settingsConfig, ...thru }) => [
57
+ HeaderRow = ({ columns, settingsConfig, hideSelectAll, ...thru }) => [
57
58
  columns &&
58
59
  renderHeaderRow({
59
60
  columns,
60
61
  ...thru,
61
62
  }),
62
- html`<cosmoz-omnitable-settings
63
- .config=${settingsConfig}
64
- ></cosmoz-omnitable-settings>`,
63
+ html`${when(!hideSelectAll, () => html`
64
+ <cosmoz-omnitable-settings
65
+ .config=${settingsConfig}>
66
+ </cosmoz-omnitable-settings>`)}`,
65
67
  ];
66
68
 
67
69
  customElements.define(
@@ -106,18 +106,6 @@ export default `
106
106
  align-items: flex-end;
107
107
  }
108
108
 
109
- .headerDots {
110
- align-items: center;
111
- cursor: default;
112
- display: flex;
113
- font-size: 20px;
114
- height: 30px;
115
- justify-content: center;
116
- min-width: 42px;
117
- padding-bottom: 12px;
118
- transform: rotate(90deg);
119
- }
120
-
121
109
  [hidden] {
122
110
  display: none;
123
111
  }
@@ -24,6 +24,7 @@ import { component } from 'haunted';
24
24
  import { renderHeader } from './lib/render-header';
25
25
  import { renderFooter } from './lib/render-footer';
26
26
  import { renderList } from './lib/render-list';
27
+ import { notifyProperty } from '@neovici/cosmoz-utils/hooks/use-notify-property';
27
28
 
28
29
  const Omnitable = (host) => {
29
30
  const { header, list, footer } = useOmnitable(host);
@@ -48,9 +49,23 @@ const Omnitable = (host) => {
48
49
 
49
50
  customElements.define(
50
51
  'cosmoz-omnitable',
51
- component(Omnitable, {
52
- observedAttributes: ['hash-param', 'sort-on', 'group-on', 'hide-select-all'],
53
- })
52
+ class extends component(Omnitable, {
53
+ observedAttributes: [
54
+ 'hash-param',
55
+ 'sort-on',
56
+ 'group-on',
57
+ 'hide-select-all',
58
+ ],
59
+ }) {
60
+ connectedCallback() {
61
+ super.connectedCallback();
62
+ notifyProperty(this, 'selectedItems', []);
63
+ notifyProperty(this, 'visibleData', []);
64
+ notifyProperty(this, 'sortedFilteredGroupedItems', []);
65
+ notifyProperty(this, 'sortOn', '');
66
+ notifyProperty(this, 'descending', false);
67
+ }
68
+ }
54
69
  );
55
70
 
56
71
  const tmplt = `
@@ -12,7 +12,7 @@ export const renderHeader = ({
12
12
  groupOnColumn,
13
13
  setFilterState,
14
14
  settingsConfig,
15
- hideSelectAll
15
+ hideSelectAll
16
16
  }) => {
17
17
  return html` <sort-and-group-provider .value=${sortAndGroup}>
18
18
  <div class="header" id="header">
@@ -28,7 +28,11 @@ export const renderHeader = ({
28
28
  )}
29
29
  ${when(
30
30
  hideSelectAll,
31
- () => html`<div class="headerDots"><span>...</span></div>`
31
+ () => html`
32
+ <cosmoz-omnitable-settings
33
+ .newLayout="${true}"
34
+ .config=${settingsConfig}
35
+ ></cosmoz-omnitable-settings>`
32
36
  )}
33
37
 
34
38
  <cosmoz-omnitable-header-row
@@ -38,6 +42,7 @@ export const renderHeader = ({
38
42
  .groupOnColumn=${groupOnColumn}
39
43
  .setFilterState=${setFilterState}
40
44
  .settingsConfig=${settingsConfig}
45
+ .hideSelectAll=${hideSelectAll}
41
46
  ></cosmoz-omnitable-header-row>
42
47
  </div>
43
48
  </sort-and-group-provider>`;
@@ -1,5 +1,4 @@
1
1
  import { html, component } from 'haunted';
2
- import { nothing } from 'lit-html';
3
2
  import { _ } from '@neovici/cosmoz-i18next';
4
3
  import { isEmpty } from '@neovici/cosmoz-utils/template';
5
4
  import { defaultPlacement } from '@neovici/cosmoz-dropdown';
@@ -8,6 +7,7 @@ import { sort, group } from './cosmoz-omnitable-sort-group';
8
7
  import style, { dropdown as dropdownStyle } from './style.css';
9
8
  import useSettingsUi from './use-settings-ui';
10
9
  import { close, pull, arrow } from '../icons';
10
+ import { when } from 'lit-html/directives/when.js';
11
11
 
12
12
  /* eslint-disable max-lines-per-function */
13
13
  const placement = ['bottom-right', ...defaultPlacement],
@@ -130,7 +130,7 @@ const placement = ['bottom-right', ...defaultPlacement],
130
130
  </div>`,
131
131
  ].filter(Boolean);
132
132
  },
133
- Settings = ({ config }) => html`
133
+ Settings = ({ config, newLayout }) => html`
134
134
  <style>
135
135
  ${dropdownStyle}
136
136
  </style>
@@ -138,12 +138,17 @@ const placement = ['bottom-right', ...defaultPlacement],
138
138
  .render=${() => html`<cosmoz-omnitable-settings-ui
139
139
  .config=${config}
140
140
  ></cosmoz-omnitable-settings-ui>`}
141
- .placement=${placement}
141
+ .placement=${newLayout ? ['bottom-left', ...defaultPlacement] : placement}
142
142
  >
143
- <svg viewBox="0 0 24 24" width="24" slot="button" fill="currentColor">
144
- <path d="M10 18h5V5h-5v13zm-6 0h5V5H4v13zM16 5v13h5V5h-5z"></path>
145
- </svg>
146
- ${config?.badge ? html`<div class="badge" slot="button"></div>` : nothing}
143
+ ${newLayout ?
144
+ html`<div class="headerDots" slot="button">...</div>` :
145
+ html`
146
+ <svg viewBox="0 0 24 24" width="24" slot="button" fill="currentColor">
147
+ <path d="M10 18h5V5h-5v13zm-6 0h5V5H4v13zM16 5v13h5V5h-5z"></path>
148
+ </svg>`
149
+ }
150
+
151
+ ${when(config?.badge, () => html`<div class="badge" slot="button"></div>`)}
147
152
  </cosmoz-dropdown>
148
153
  `;
149
154
  customElements.define('cosmoz-omnitable-settings', component(Settings));
@@ -196,7 +196,6 @@ export const dropdown = css`
196
196
  outline: none;
197
197
  }
198
198
  cosmoz-dropdown::part(button) {
199
- --cosmoz-dropdown-button-size: 24px;
200
199
  padding: 0;
201
200
  background: transparent;
202
201
  color: inherit;
@@ -216,4 +215,15 @@ export const dropdown = css`
216
215
  height: 8px;
217
216
  border-radius: 100%;
218
217
  }
218
+ .headerDots {
219
+ align-items: center;
220
+ color: var(--cosmoz-input-color);
221
+ display: flex;
222
+ font-size: 20px;
223
+ height: 42px;
224
+ justify-content: center;
225
+ margin-left: 12px;
226
+ min-width: 30px;
227
+ transform: rotate(90deg);
228
+ }
219
229
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-omnitable",
3
- "version": "12.3.0",
3
+ "version": "12.4.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"