@neovici/cosmoz-omnitable 14.5.0 → 14.6.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.
@@ -0,0 +1,70 @@
1
+ import { html, css, component } from '@pionjs/pion';
2
+
3
+ const styles = css`
4
+ :host {
5
+ max-width: 100%;
6
+ overflow-x: hidden;
7
+ padding: 0 12px;
8
+ }
9
+ .skeleton {
10
+ width: 100%;
11
+ }
12
+ .skeleton > div {
13
+ height: 17.5px;
14
+ display: flex;
15
+ padding: 11px 12px 11px 0;
16
+ }
17
+ .skeleton > div div:not(.handle) {
18
+ background-image: linear-gradient(90deg, #e0e0e0, #f5f5f5, #e0e0e0);
19
+ background-size: 1000%;
20
+ background-position: right;
21
+ border-radius: 4px;
22
+ animation: sweep 1.5s cubic-bezier(0.3, 1, 0.3, 1) infinite;
23
+ }
24
+ .skeleton > div div:not(.checkbox):not(:last-of-type) {
25
+ margin-right: 7px;
26
+ }
27
+ .skeleton > div div.checkbox {
28
+ min-width: 18px;
29
+ margin-left: 0;
30
+ margin-right: 12px;
31
+ }
32
+ @keyframes sweep {
33
+ 0% {
34
+ background-position: right;
35
+ }
36
+ 100% {
37
+ background-position: left;
38
+ }
39
+ }
40
+ `;
41
+
42
+ const Skeleton = ({ settingsConfig }) => {
43
+ const { columns, collapsed } = settingsConfig,
44
+ showingColumns = columns.filter(
45
+ (column) => !collapsed.some((hidden) => hidden.name === column.name),
46
+ );
47
+
48
+ return html`<div class="skeleton">
49
+ ${Array.from(
50
+ { length: 5 },
51
+ () =>
52
+ html`<div>
53
+ <div class="checkbox"></div>
54
+ ${showingColumns.map(
55
+ (col) =>
56
+ html`<div
57
+ class="cell"
58
+ part=${`cell-${col.name}`}
59
+ name=${col.name}
60
+ ></div>`,
61
+ )}
62
+ </div>`,
63
+ )}
64
+ </div>`;
65
+ };
66
+
67
+ customElements.define(
68
+ 'cosmoz-omnitable-skeleton',
69
+ component(Skeleton, { styleSheets: [styles] }),
70
+ );
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable max-lines */
2
2
  import { tagged as css } from '@neovici/cosmoz-utils';
3
- const checkbox = css`
3
+
4
+ export const checkbox = css`
4
5
  .checkbox {
5
6
  box-sizing: border-box;
6
7
  width: 18px;
@@ -80,8 +81,6 @@ const checkbox = css`
80
81
  }
81
82
  `;
82
83
 
83
- export { checkbox };
84
-
85
84
  export default css`
86
85
  :host {
87
86
  display: flex;
@@ -101,6 +100,7 @@ export default css`
101
100
  );
102
101
  color: var(--primary-link-color-hover, var(--primary-link-color));
103
102
  }
103
+
104
104
  /* The wrapping div that contains the header, the table content and the footer */
105
105
  .mainContainer {
106
106
  background-color: var(--cosmoz-omnitable-bg-color, rgb(255, 255, 255));
@@ -237,7 +237,6 @@ export default css`
237
237
  }
238
238
 
239
239
  /* Empty data set styling */
240
-
241
240
  .tableContent-empty {
242
241
  position: absolute;
243
242
  top: 0;
@@ -249,13 +248,11 @@ export default css`
249
248
  justify-content: center;
250
249
  color: #ccc;
251
250
  }
252
-
253
251
  .tableContent-empty.overlay {
254
252
  background-color: rgba(255, 255, 255, 0.8);
255
253
  color: #333;
256
254
  z-index: 1;
257
255
  }
258
-
259
256
  .tableContent-empty iron-icon {
260
257
  height: 96px;
261
258
  min-height: 96px;
@@ -263,34 +260,23 @@ export default css`
263
260
  min-width: 96px;
264
261
  margin-right: 24px;
265
262
  }
266
-
267
- .tableContent-empty.overlay paper-spinner-lite {
268
- height: 48px;
269
- min-height: 48px;
270
- width: 48px;
271
- min-width: 48px;
272
- margin-right: 24px;
273
- --paper-spinner-color: #333;
274
- --paper-spinner-stroke-width: 6px;
275
- }
276
-
277
263
  .tableContent-empty > div {
278
264
  display: flex;
279
265
  flex-direction: column;
280
266
  justify-content: center;
281
267
  padding-bottom: 24px;
282
268
  }
283
-
284
269
  .tableContent-empty.overlay > div {
285
270
  padding-bottom: 0;
286
271
  }
287
-
272
+ .tableContent-empty.overlay:has(cosmoz-omnitable-skeleton) {
273
+ align-items: flex-start;
274
+ }
288
275
  .tableContent-empty div.tableContent-empty-message {
289
276
  @apply --layout-vertical;
290
277
  @apply --layout-center-justified;
291
278
  padding-bottom: 24px;
292
279
  }
293
-
294
280
  .tableContent-empty.overlay div.tableContent-empty-message {
295
281
  padding-bottom: 0;
296
282
  }
@@ -299,7 +285,6 @@ export default css`
299
285
  color: #ddd;
300
286
  margin: 0;
301
287
  }
302
-
303
288
  .tableContent-empty h3 {
304
289
  white-space: nowrap;
305
290
  margin: 0px 0px 8px 0px;
@@ -368,10 +353,6 @@ export default css`
368
353
  border-bottom: 1px solid var(--cosmoz-omnitable-border-color, #e1e2e5);
369
354
  }
370
355
 
371
- .groupRow.groupRow-folded {
372
- /* Add here style rules for folded group rows */
373
- }
374
-
375
356
  .groupRow-label {
376
357
  display: flex;
377
358
  flex: auto;
@@ -1,29 +1,27 @@
1
- /* eslint-disable max-lines-per-function */
2
- /* eslint-disable max-lines */
3
- import '@polymer/iron-icons/iron-icons';
1
+ import '@neovici/cosmoz-bottom-bar';
4
2
  import '@polymer/iron-icon/iron-icon';
3
+ import '@polymer/iron-icons/iron-icons';
5
4
  import '@polymer/paper-spinner/paper-spinner-lite';
6
5
 
7
- import '@neovici/cosmoz-bottom-bar';
8
-
9
6
  import './cosmoz-omnitable-column';
7
+ import './cosmoz-omnitable-columns';
8
+ import './cosmoz-omnitable-group-row';
10
9
  import './cosmoz-omnitable-header-row';
11
- import './cosmoz-omnitable-item-row';
12
10
  import './cosmoz-omnitable-item-expand';
13
- import './cosmoz-omnitable-group-row';
14
- import './cosmoz-omnitable-columns';
15
- import styles from './cosmoz-omnitable-styles';
11
+ import './cosmoz-omnitable-item-row';
16
12
 
13
+ import { notifyProperty } from '@neovici/cosmoz-utils/hooks/use-notify-property';
14
+ import { component } from '@pionjs/pion';
17
15
  import { html as polymerHtml } from '@polymer/polymer/lib/utils/html-tag';
18
16
  import { html } from 'lit-html';
19
17
  import { guard } from 'lit-html/directives/guard.js';
20
- import { notifyProperty } from '@neovici/cosmoz-utils/hooks/use-notify-property';
21
18
 
22
- import { useOmnitable } from './lib/use-omnitable';
23
- import { component } from '@pionjs/pion';
24
- import { renderHeader } from './lib/render-header';
19
+ import styles from './cosmoz-omnitable-styles';
25
20
  import { renderFooter } from './lib/render-footer';
21
+ import { renderHeader } from './lib/render-header';
26
22
  import { renderList } from './lib/render-list';
23
+ import { useOmnitable } from './lib/use-omnitable';
24
+
27
25
  import './grouped-list/index.js';
28
26
 
29
27
  const shimCSS = (s) => window.ShadyCSS?.ApplyShim?.transformCssText?.(s) || s;
@@ -38,7 +36,9 @@ const Omnitable = (host) => {
38
36
 
39
37
  <div class="mainContainer">
40
38
  ${renderHeader(header)}
41
- <div class="tableContent" id="tableContent">${renderList(list)}</div>
39
+ <div class="tableContent" id="tableContent">
40
+ ${renderList(header, list)}
41
+ </div>
42
42
  ${renderFooter(footer)}
43
43
  </div>
44
44
 
@@ -2,29 +2,36 @@ import { layout } from './layout';
2
2
 
3
3
  const _toCss = (layout, config) => {
4
4
  const lastVisibleIndex = layout.findLastIndex(
5
- (width) => width != null && width > 0,
6
- );
5
+ (width) => width != null && width > 0,
6
+ ),
7
+ generateCellCSS = (itemName, width) =>
8
+ `.cell[name="${itemName}"], cosmoz-omnitable-skeleton::part(cell-${itemName}){width: ${Math.floor(
9
+ width,
10
+ )}px;padding: 0 min(3px, ${width / 2}px)}`,
11
+ hideResizeNub = (itemName) =>
12
+ `cosmoz-omnitable-resize-nub[name="${itemName}"]{display:none}`,
13
+ hideColumn = (itemName) =>
14
+ `cosmoz-omnitable-resize-nub[name="${itemName}"], .cell[name="${itemName}"]{display:none}`;
7
15
 
8
16
  return config
9
17
  .map((item, index) => {
10
18
  const width = layout[index];
19
+
11
20
  // Hidden columns
12
21
  if (width == null || width === 0) {
13
- return `cosmoz-omnitable-resize-nub[name="${item.name}"], .cell[name="${item.name}"]{display:none}`;
22
+ return hideColumn(item.name);
14
23
  }
15
24
 
16
- // Last visible column, show the cell but hide its resize nub
25
+ // All visible columns
26
+ const cellCSS = generateCellCSS(item.name, width);
27
+
28
+ // Last visible column, show cell but hide its resize nub
17
29
  if (index === lastVisibleIndex) {
18
- return `.cell[name="${item.name}"]{width: ${Math.floor(
19
- width,
20
- )}px;padding: 0 min(3px, ${width / 2}px)}
21
- cosmoz-omnitable-resize-nub[name="${item.name}"]{display:none}`;
30
+ return `${cellCSS}\n${hideResizeNub(item.name)}`;
22
31
  }
23
32
 
24
- // Other visible columns
25
- return `.cell[name="${item.name}"]{width: ${Math.floor(
26
- width,
27
- )}px;padding: 0 min(3px, ${width / 2}px)}`;
33
+ // Other visible columns just show the cell
34
+ return cellCSS;
28
35
  })
29
36
  .join('\n');
30
37
  };
@@ -46,69 +46,103 @@ class AmountRangeInput extends rangeInputMixin(
46
46
  this._onDropdownOpenedChanged(event);
47
47
  };
48
48
 
49
- return html`
50
- <style>
51
- paper-dropdown-menu {
52
- --iron-icon-width: 0;
53
- display: block;
54
- }
55
- </style>
56
- <cosmoz-clear-button
57
- @click=${() => this.resetFilter()}
58
- ?visible=${this.hasFilter()}
59
- ></cosmoz-clear-button>
60
- <paper-dropdown-menu
61
- label=${this.title}
62
- placeholder=${ifDefined(this._filterText)}
63
- class="external-values-${this.externalValues}"
64
- title=${this._tooltip}
65
- horizontal-align="right"
66
- ?opened=${this.headerFocused}
67
- @opened-changed=${onOpenedChanged}
68
- >
69
- <div
70
- class="dropdown-content"
71
- slot="dropdown-content"
72
- style="padding: 15px; min-width: 150px;"
73
- >
74
- <h3 style="margin: 0;">${this.title}</h3>
75
- <cosmoz-input
76
- class=${this._fromClasses}
77
- type="number"
78
- title=${_('Minimum amount')}
79
- label=${_('Min amount')}
80
- .value=${this._filterInput?.min}
81
- @value-changed=${(event) => {
82
- this.set('_filterInput.min', event.detail.value);
83
- }}
84
- @blur=${(event) => this._onBlur(event)}
85
- @keydown=${(event) => this._onKeyDown(event)}
86
- min=${this._toInputStringAmount(this._limit.fromMin)}
87
- max=${this._toInputStringAmount(this._limit.fromMax)}
88
- ><div slot="suffix" suffix>
89
- ${this.filter?.min?.currency}
90
- </div></cosmoz-input
91
- >
92
- <cosmoz-input
93
- class=${this._toClasses}
94
- type="number"
95
- title=${_('Maximum amount')}
96
- label=${_('Max amount')}
97
- .value=${this._filterInput?.max}
98
- @value-changed=${(event) => {
99
- this.set('_filterInput.max', event.detail.value);
100
- }}
101
- @blur=${(event) => this._onBlur(event)}
102
- @keydown=${(event) => this._onKeyDown(event)}
103
- min=${this._toInputStringAmount(this._limit.toMin)}
104
- max=${this._toInputStringAmount(this._limit.toMax)}
105
- ><div slot="suffix" suffix>
106
- ${this.filter?.max?.currency}
107
- </div></cosmoz-input
108
- >
109
- </div>
110
- </paper-dropdown-menu>
111
- `;
49
+ return html`
50
+ <style>
51
+ paper-dropdown-menu {
52
+ --iron-icon-width: 0;
53
+ display: block;
54
+ text-align: right;
55
+ }
56
+
57
+ .dropdown-content h3 {
58
+ font-weight: 500;
59
+ font-size: 13px;
60
+ margin: 0;
61
+ font-family: var(--cosmoz-input-font-family, var(--paper-font-subhead_-_font-family, 'Inter', sans-serif));
62
+ }
63
+
64
+ .dropdown-content {
65
+ padding: 10px 10px 10px 10px;
66
+ min-width: 150px;
67
+ text-align: left;
68
+ background: var(--cosmoz-omnitable-amount-input-background, #ffffff);
69
+ border-radius: 6px;
70
+ backdrop-filter: blur(16px) saturate(180%);
71
+ -webkit-backdrop-filter: blur(16px) saturate(180%);
72
+ box-shadow: 0 4px 24px 0 rgba(0,0,0,0.18), 0 1.5px 6px 0 rgba(0,0,0,0.1);
73
+ }
74
+
75
+ cosmoz-input[type="number"] {
76
+ background: var(--cosmoz-omnitable-amount-input-background, #ffffff);
77
+ border-radius: 6px;
78
+ border: 1px solid #d1d1d6;
79
+ box-shadow: 0 1px 2px 0 rgba(60,60,60,0.04);
80
+ padding: 2px 8px;
81
+ margin-bottom: 6px;
82
+ min-height: 28px;
83
+ transition: border-color 0.2s, box-shadow 0.2s;
84
+ }
85
+
86
+ cosmoz-input[type="number"]:focus-within {
87
+ border-color: var(--cz-accent-color, #007aff);
88
+ box-shadow: 0 0 0 1px rgba(0,122,255,0.15);
89
+ background: var(--cosmoz-omnitable-amount-input-background, #ffffff);
90
+ }
91
+ </style>
92
+ <cosmoz-clear-button
93
+ @click=${() => this.resetFilter()}
94
+ ?visible=${this.hasFilter()}
95
+ ></cosmoz-clear-button>
96
+ <paper-dropdown-menu
97
+ label=${this.title}
98
+ placeholder=${ifDefined(this._filterText)}
99
+ class="external-values-${this.externalValues}"
100
+ title=${this._tooltip}
101
+ horizontal-align="right"
102
+ ?opened=${this.headerFocused}
103
+ @opened-changed=${onOpenedChanged}
104
+ >
105
+ <div class="dropdown-content" slot="dropdown-content">
106
+ <h3 style="margin: 0;">${this.title}</h3>
107
+ <cosmoz-input
108
+ class=${this._fromClasses}
109
+ type="number"
110
+ title=${_('Minimum amount')}
111
+ label=${_('Min amount')}
112
+ .value=${this._filterInput?.min}
113
+ @value-changed=${(event) => {
114
+ this.set('_filterInput.min', event.detail.value);
115
+ }}
116
+ @blur=${(event) => this._onBlur(event)}
117
+ @keydown=${(event) => this._onKeyDown(event)}
118
+ min=${this._toInputStringAmount(this._limit.fromMin)}
119
+ max=${this._toInputStringAmount(this._limit.fromMax)}
120
+ >
121
+ <div slot="suffix" suffix>
122
+ ${this.filter?.min?.currency}
123
+ </div>
124
+ </cosmoz-input>
125
+ <cosmoz-input
126
+ class=${this._toClasses}
127
+ type="number"
128
+ title=${_('Maximum amount')}
129
+ label=${_('Max amount')}
130
+ .value=${this._filterInput?.max}
131
+ @value-changed=${(event) => {
132
+ this.set('_filterInput.max', event.detail.value);
133
+ }}
134
+ @blur=${(event) => this._onBlur(event)}
135
+ @keydown=${(event) => this._onKeyDown(event)}
136
+ min=${this._toInputStringAmount(this._limit.toMin)}
137
+ max=${this._toInputStringAmount(this._limit.toMax)}
138
+ >
139
+ <div slot="suffix" suffix>
140
+ ${this.filter?.max?.currency}
141
+ </div>
142
+ </cosmoz-input>
143
+ </div>
144
+ </paper-dropdown-menu>
145
+ `;
112
146
  }
113
147
 
114
148
  /**
@@ -11,60 +11,88 @@ class DateRangeInput extends dateInputMixin(
11
11
  ) {
12
12
  // eslint-disable-next-line max-lines-per-function
13
13
  render() {
14
- return html`
15
- <style>
16
- paper-dropdown-menu {
17
- --iron-icon-width: 0;
18
- display: block;
19
- }
20
- cosmoz-input {
21
- --paper-font-subhead_-_font-size: 16px;
22
- margin-bottom: 6px;
23
- }
24
- </style>
25
- <cosmoz-clear-button
26
- @click=${() => this.resetFilter()}
27
- ?visible=${this.hasFilter()}
28
- ></cosmoz-clear-button>
29
- <paper-dropdown-menu
30
- label=${this.title}
31
- placeholder=${ifDefined(this._filterText)}
32
- class="external-values-${this.externalValues}"
33
- title=${this._tooltip}
34
- horizontal-align="right"
35
- ?opened=${this.headerFocused}
36
- @opened-changed=${(event) => {
37
- // TODO: check ots integration
38
- this.headerFocused = event.detail.value;
39
- }}
40
- >
41
- <div
42
- class="dropdown-content"
43
- slot="dropdown-content"
44
- style="padding: 15px; min-width: 100px;"
45
- >
46
- <h3 style="margin: 0;">${this.title}</h3>
47
- <cosmoz-input
48
- type="date"
49
- label=${_('From date')}
50
- min=${this._toInputString(this._limit.fromMin)}
51
- max=${this._toInputString(this._limit.fromMax)}
52
- .value=${this._filterInput?.min}
53
- @value-changed=${(event) =>
54
- this.set('_filterInput.min', event.detail.value)}
55
- ></cosmoz-input>
56
- <cosmoz-input
57
- type="date"
58
- label=${_('Until date')}
59
- min=${this._toInputString(this._limit.toMin)}
60
- max=${this._toInputString(this._limit.toMax)}
61
- .value=${this._filterInput?.max}
62
- @value-changed=${(event) =>
63
- this.set('_filterInput.max', event.detail.value)}
64
- ></cosmoz-input>
65
- </div>
66
- </paper-dropdown-menu>
67
- `;
14
+ return html`
15
+ <style>
16
+ paper-dropdown-menu {
17
+ --iron-icon-width: 0;
18
+ display: block;
19
+ text-align: right;
20
+ }
21
+
22
+ .dropdown-content h3 {
23
+ font-weight: 500;
24
+ font-size: 13px;
25
+ margin: 0;
26
+ font-family: var(--cosmoz-input-font-family, var(--paper-font-subhead_-_font-family, 'Inter', sans-serif));
27
+ }
28
+
29
+ .dropdown-content {
30
+ padding: 10px 10px 10px 10px;
31
+ min-width: 120px;
32
+ text-align: left;
33
+ background: var(--cosmoz-omnitable-amount-input-background, #ffffff);
34
+ border-radius: 6px;
35
+ backdrop-filter: blur(16px) saturate(180%);
36
+ -webkit-backdrop-filter: blur(16px) saturate(180%);
37
+ box-shadow: 0 4px 24px 0 rgba(0,0,0,0.18), 0 1.5px 6px 0 rgba(0,0,0,0.1);
38
+ }
39
+
40
+ cosmoz-input[type="date"] {
41
+ background: var(--cosmoz-omnitable-amount-input-background, #ffffff);
42
+ border-radius: 6px;
43
+ border: 1px solid #d1d1d6;
44
+ box-shadow: 0 1px 2px 0 rgba(60,60,60,0.04);
45
+ padding: 2px 8px;
46
+ margin-bottom: 6px;
47
+ min-height: 28px;
48
+ transition: border-color 0.2s, box-shadow 0.2s;
49
+ }
50
+
51
+ cosmoz-input[type="date"]:focus-within {
52
+ border-color: var(--cz-accent-color, #007aff);
53
+ box-shadow: 0 0 0 1px rgba(0,122,255,0.15);
54
+ background: var(--cosmoz-omnitable-amount-input-background, #ffffff);
55
+ }
56
+ </style>
57
+ <cosmoz-clear-button
58
+ @click=${() => this.resetFilter()}
59
+ ?visible=${this.hasFilter()}
60
+ ></cosmoz-clear-button>
61
+ <paper-dropdown-menu
62
+ label=${this.title}
63
+ placeholder=${ifDefined(this._filterText)}
64
+ class="external-values-${this.externalValues}"
65
+ title=${this._tooltip}
66
+ horizontal-align="right"
67
+ ?opened=${this.headerFocused}
68
+ @opened-changed=${(event) => {
69
+ // TODO: check ots integration
70
+ this.headerFocused = event.detail.value;
71
+ }}
72
+ >
73
+ <div class="dropdown-content" slot="dropdown-content">
74
+ <h3 style="margin: 0;">${this.title}</h3>
75
+ <cosmoz-input
76
+ type="date"
77
+ label=${_('From date')}
78
+ min=${this._toInputString(this._limit.fromMin)}
79
+ max=${this._toInputString(this._limit.fromMax)}
80
+ .value=${this._filterInput?.min}
81
+ @value-changed=${(event) =>
82
+ this.set('_filterInput.min', event.detail.value)}
83
+ ></cosmoz-input>
84
+ <cosmoz-input
85
+ type="date"
86
+ label=${_('Until date')}
87
+ min=${this._toInputString(this._limit.toMin)}
88
+ max=${this._toInputString(this._limit.toMax)}
89
+ .value=${this._filterInput?.max}
90
+ @value-changed=${(event) =>
91
+ this.set('_filterInput.max', event.detail.value)}
92
+ ></cosmoz-input>
93
+ </div>
94
+ </paper-dropdown-menu>
95
+ `;
68
96
  }
69
97
 
70
98
  _fromInputString(value, property) {
@@ -10,61 +10,89 @@ class DatetimeRangeInput extends dateInputMixin(
10
10
  ) {
11
11
  // eslint-disable-next-line max-lines-per-function
12
12
  render() {
13
- return html`
14
- <style>
15
- paper-dropdown-menu {
16
- --iron-icon-width: 0;
17
- display: block;
18
- }
19
- cosmoz-input {
20
- --paper-font-subhead_-_font-size: 16px;
21
- margin-bottom: 6px;
22
- }
23
- </style>
13
+ return html`
14
+ <style>
15
+ paper-dropdown-menu {
16
+ --iron-icon-width: 0;
17
+ display: block;
18
+ text-align: right;
19
+ }
24
20
 
25
- <cosmoz-clear-button
26
- @click=${() => this.resetFilter()}
27
- ?visible=${this.hasFilter()}
28
- ></cosmoz-clear-button>
29
- <paper-dropdown-menu
30
- label=${this.title}
31
- placeholder=${ifDefined(this._filterText)}
32
- class="external-values-${this.externalValues}"
33
- title=${this._tooltip}
34
- horizontal-align="right"
35
- ?opened=${this.headerFocused}
36
- @opened-changed=${(event) =>
37
- this.set('headerFocused', event.detail.value)}
38
- >
39
- <div
40
- class="dropdown-content"
41
- slot="dropdown-content"
42
- style="padding: 15px; min-width: 100px;"
43
- >
44
- <h3 style="margin: 0;">${this.title}</h3>
45
- <cosmoz-datetime-input
46
- date-label=${_('From date')}
47
- time-label=${_('From time')}
48
- min=${this._toInputString(this._limit.fromMin)}
49
- max=${this._toInputString(this._limit.fromMax)}
50
- step=${this.filterStep}
51
- .value=${this._filterInput?.min}
52
- @value-changed=${(event) =>
53
- this.set('_filterInput.min', event.detail.value)}
54
- ></cosmoz-datetime-input>
55
- <cosmoz-datetime-input
56
- date-label=${_('To date')}
57
- time-label=${_('To time')}
58
- min=${this._toInputString(this._limit.toMin)}
59
- max=${this._toInputString(this._limit.toMax)}
60
- step=${this.filterStep}
61
- .value=${this._filterInput?.max}
62
- @value-changed=${(event) =>
63
- this.set('_filterInput.max', event.detail.value)}
64
- ></cosmoz-datetime-input>
65
- </div>
66
- </paper-dropdown-menu>
67
- `;
21
+ .dropdown-content h3 {
22
+ font-weight: 500;
23
+ font-size: 13px;
24
+ margin: 0;
25
+ font-family: var(--cosmoz-input-font-family, var(--paper-font-subhead_-_font-family, 'Inter', sans-serif));
26
+ }
27
+
28
+ .dropdown-content {
29
+ padding: 10px 10px 10px 10px;
30
+ min-width: 120px;
31
+ text-align: left;
32
+ background: var(--cosmoz-omnitable-amount-input-background, #ffffff);
33
+ border-radius: 6px;
34
+ backdrop-filter: blur(16px) saturate(180%);
35
+ -webkit-backdrop-filter: blur(16px) saturate(180%);
36
+ box-shadow: 0 4px 24px 0 rgba(0,0,0,0.18), 0 1.5px 6px 0 rgba(0,0,0,0.1);
37
+ }
38
+
39
+ cosmoz-datetime-input {
40
+ background: var(--cosmoz-omnitable-amount-input-background, #ffffff);
41
+ border-radius: 6px;
42
+ border: 1px solid #d1d1d6;
43
+ box-shadow: 0 1px 2px 0 rgba(60,60,60,0.04);
44
+ padding: 2px 8px;
45
+ margin-bottom: 6px;
46
+ min-height: 28px;
47
+ transition: border-color 0.2s, box-shadow 0.2s;
48
+ }
49
+
50
+ cosmoz-datetime-input:focus-within {
51
+ border-color: var(--cz-accent-color, #007aff);
52
+ box-shadow: 0 0 0 1px rgba(0,122,255,0.15);
53
+ background: var(--cosmoz-omnitable-amount-input-background, #ffffff);
54
+ }
55
+ </style>
56
+
57
+ <cosmoz-clear-button
58
+ @click=${() => this.resetFilter()}
59
+ ?visible=${this.hasFilter()}
60
+ ></cosmoz-clear-button>
61
+ <paper-dropdown-menu
62
+ label=${this.title}
63
+ placeholder=${ifDefined(this._filterText)}
64
+ class="external-values-${this.externalValues}"
65
+ title=${this._tooltip}
66
+ horizontal-align="right"
67
+ ?opened=${this.headerFocused}
68
+ @opened-changed=${(event) =>
69
+ this.set('headerFocused', event.detail.value)}
70
+ >
71
+ <div class="dropdown-content" slot="dropdown-content">
72
+ <h3 style="margin: 0;">${this.title}</h3>
73
+ <cosmoz-datetime-input
74
+ date-label=${_('From date')}
75
+ time-label=${_('From time')}
76
+ min=${this._toInputString(this._limit.fromMin)}
77
+ max=${this._toInputString(this._limit.fromMax)}
78
+ step=${this.filterStep}
79
+ .value=${this._filterInput?.min}
80
+ @value-changed=${(event) =>
81
+ this.set('_filterInput.min', event.detail.value)}
82
+ ></cosmoz-datetime-input>
83
+ <cosmoz-datetime-input
84
+ date-label=${_('To date')}
85
+ time-label=${_('To time')}
86
+ min=${this._toInputString(this._limit.toMin)}
87
+ max=${this._toInputString(this._limit.toMax)}
88
+ step=${this.filterStep}
89
+ .value=${this._filterInput?.max}
90
+ @value-changed=${(event) =>
91
+ this.set('_filterInput.max', event.detail.value)}
92
+ ></cosmoz-datetime-input>
93
+ </div>
94
+ </paper-dropdown-menu>
95
+ `;
68
96
  }
69
97
 
70
98
  _toInputString(value) {
@@ -44,11 +44,41 @@ class NumberRangeInput extends rangeInputMixin(
44
44
  display: block;
45
45
  text-align: right;
46
46
  }
47
- .dropdown-content {
48
- padding: 15px;
49
- min-width: 100px;
50
- text-align: left;
47
+
48
+ .dropdown-content h3 {
49
+ font-weight: 500;
50
+ font-size: 13px;
51
+ margin: 0;
52
+ font-family: var(--cosmoz-input-font-family, var(--paper-font-subhead_-_font-family, 'Inter', sans-serif));
51
53
  }
54
+
55
+ .dropdown-content {
56
+ padding: 10px 10px 10px 10px;
57
+ min-width: 120px;
58
+ text-align: left;
59
+ background: var(--cosmoz-omnitable-amount-input-background, #ffffff);
60
+ border-radius: 6px;
61
+ backdrop-filter: blur(16px) saturate(180%);
62
+ -webkit-backdrop-filter: blur(16px) saturate(180%);
63
+ box-shadow: 0 4px 24px 0 rgba(0,0,0,0.18), 0 1.5px 6px 0 rgba(0,0,0,0.1);
64
+ }
65
+
66
+ cosmoz-input[type="number"] {
67
+ background: var(--cosmoz-omnitable-amount-input-background, #ffffff);
68
+ border-radius: 6px;
69
+ border: 1px solid #d1d1d6;
70
+ box-shadow: 0 1px 2px 0 rgba(60,60,60,0.04);
71
+ padding: 2px 8px;
72
+ margin-bottom: 6px;
73
+ min-height: 28px;
74
+ transition: border-color 0.2s, box-shadow 0.2s;
75
+ }
76
+
77
+ cosmoz-input[type="number"]:focus-within {
78
+ border-color: var(--cz-accent-color, #007aff);
79
+ box-shadow: 0 0 0 1px rgba(0,122,255,0.15);
80
+ background: var(--cosmoz-omnitable-amount-input-background, #ffffff);
81
+ }
52
82
  </style>
53
83
 
54
84
  <cosmoz-clear-button
@@ -2,8 +2,8 @@ import { html } from 'lit-html';
2
2
  import { when } from 'lit-html/directives/when.js';
3
3
 
4
4
  export const renderHeader = ({
5
- allSelected,
6
- onAllCheckboxChange,
5
+ allSelected,
6
+ onAllCheckboxChange,
7
7
  sortAndGroup,
8
8
  dataIsValid,
9
9
  data,
@@ -12,28 +12,29 @@ export const renderHeader = ({
12
12
  groupOnColumn,
13
13
  setFilterState,
14
14
  settingsConfig,
15
- hideSelectAll
16
- }) => {
17
- return html` <sort-and-group-provider .value=${sortAndGroup}>
15
+ hideSelectAll,
16
+ }) =>
17
+ html`<sort-and-group-provider .value=${sortAndGroup}>
18
18
  <div class="header" id="header">
19
19
  ${when(
20
20
  !hideSelectAll,
21
- () => html`<input
22
- class="checkbox all"
23
- type="checkbox"
24
- .checked=${allSelected}
25
- @input=${onAllCheckboxChange}
26
- ?disabled=${!dataIsValid}
27
- part="all"
28
- />`
21
+ () =>
22
+ html`<input
23
+ class="checkbox all"
24
+ type="checkbox"
25
+ .checked=${allSelected}
26
+ @input=${onAllCheckboxChange}
27
+ ?disabled=${!dataIsValid}
28
+ part="all"
29
+ />`,
29
30
  )}
30
31
  ${when(
31
32
  hideSelectAll,
32
- () => html`
33
- <cosmoz-omnitable-settings
33
+ () =>
34
+ html` <cosmoz-omnitable-settings
34
35
  .newLayout="${true}"
35
36
  .config=${settingsConfig}
36
- ></cosmoz-omnitable-settings>`
37
+ ></cosmoz-omnitable-settings>`,
37
38
  )}
38
39
 
39
40
  <cosmoz-omnitable-header-row
@@ -47,4 +48,3 @@ export const renderHeader = ({
47
48
  ></cosmoz-omnitable-header-row>
48
49
  </div>
49
50
  </sort-and-group-provider>`;
50
- };
@@ -1,24 +1,28 @@
1
- /* eslint-disable max-lines-per-function */
1
+ import '../cosmoz-omnitable-skeleton.js';
2
+
2
3
  import { _ } from '@neovici/cosmoz-i18next';
3
4
  import { html } from 'lit-html';
4
5
  import { when } from 'lit-html/directives/when.js';
5
6
 
6
- export const renderList = ({
7
- processedItems,
8
- dataIsValid,
9
- filterIsTooStrict,
10
- loading,
11
- displayEmptyGroups,
12
- compareItemsFn,
13
- setSelectedItems,
14
- renderItem,
15
- renderGroup,
16
- error,
17
- }) => {
18
- return html` ${when(
19
- !dataIsValid && !error,
7
+ export const renderList = (header, list) => {
8
+ const { settingsConfig } = header,
9
+ {
10
+ processedItems,
11
+ dataIsValid,
12
+ filterIsTooStrict,
13
+ loading,
14
+ displayEmptyGroups,
15
+ compareItemsFn,
16
+ setSelectedItems,
17
+ renderItem,
18
+ renderGroup,
19
+ error,
20
+ } = list;
21
+
22
+ return html`${when(
23
+ !loading && !dataIsValid && !error,
20
24
  () =>
21
- html` <div class="tableContent-empty">
25
+ html`<div class="tableContent-empty">
22
26
  <slot name="empty-set-message">
23
27
  <iron-icon icon="icons:announcement"></iron-icon>
24
28
  <div class="tableContent-empty-message">
@@ -31,7 +35,7 @@ export const renderList = ({
31
35
  ${when(
32
36
  filterIsTooStrict,
33
37
  () =>
34
- html` <div class="tableContent-empty">
38
+ html`<div class="tableContent-empty">
35
39
  <iron-icon icon="icons:announcement"></iron-icon>
36
40
  <div>
37
41
  <h3>${_('Filter too strict')}</h3>
@@ -42,17 +46,16 @@ export const renderList = ({
42
46
  ${when(
43
47
  loading,
44
48
  () =>
45
- html` <div class="tableContent-empty overlay">
46
- <paper-spinner-lite active></paper-spinner-lite>
47
- <div>
48
- <h3>${_('Data set is updating')}</h3>
49
- </div>
49
+ html`<div class="tableContent-empty overlay">
50
+ <cosmoz-omnitable-skeleton
51
+ .settingsConfig=${settingsConfig}
52
+ ></cosmoz-omnitable-skeleton>
50
53
  </div>`,
51
54
  )}
52
55
  ${when(
53
56
  error,
54
57
  () =>
55
- html` <div class="tableContent-empty overlay">
58
+ html`<div class="tableContent-empty overlay">
56
59
  <iron-icon icon="icons:error"></iron-icon>
57
60
  <div class="tableContent-empty-message">
58
61
  <h3>${_('Error loading data')}</h3>
@@ -63,15 +66,15 @@ export const renderList = ({
63
66
  <div class="tableContent-scroller" id="scroller" part="scroller">
64
67
  <cosmoz-grouped-list
65
68
  id="groupedList"
66
- .data="${processedItems}"
67
- @selected-items-changed="${(event) =>
68
- setSelectedItems(event.detail.value)}"
69
- .displayEmptyGroups="${
69
+ .data=${processedItems}
70
+ @selected-items-changed=${(event) =>
71
+ setSelectedItems(event.detail.value)}
72
+ .displayEmptyGroups=${
70
73
  displayEmptyGroups /* TODO: check if still works */
71
- }"
72
- .compareItemsFn="${compareItemsFn}"
73
- .renderItem="${renderItem}"
74
- .renderGroup="${renderGroup}"
74
+ }
75
+ .compareItemsFn=${compareItemsFn}
76
+ .renderItem=${renderItem}
77
+ .renderGroup=${renderGroup}
75
78
  ></cosmoz-grouped-list>
76
79
  <slot name="extraContent"></slot>
77
80
  </div>`;
@@ -12,11 +12,10 @@ export default css`
12
12
  }
13
13
 
14
14
  .headline {
15
- box-shadow:
16
- inset 0px -1px 0px rgba(0, 0, 0, 0.15),
17
- inset 0px 1px 0px rgba(0, 0, 0, 0.15);
18
15
  font-weight: 500;
19
- font-size: 16px;
16
+ font-size: 13px;
17
+ color: var(--cosmoz-omnitable-settings-color, #101010);
18
+ text-transform: uppercase;
20
19
  line-height: 0.95;
21
20
  padding: 10px 14px;
22
21
  display: flex;
@@ -34,6 +33,9 @@ export default css`
34
33
  overflow-y: auto;
35
34
  scrollbar-width: 2px;
36
35
  scrollbar-gutter: stable;
36
+ text-transform: uppercase;
37
+ font-size: 12px;
38
+ color: var(--cosmoz-omnitable-settings-color, #101010);
37
39
  }
38
40
  .contents::-webkit-scrollbar {
39
41
  width: 2px;
@@ -48,8 +50,9 @@ export default css`
48
50
 
49
51
  .heading {
50
52
  box-shadow: inset 0px -1px 0px rgba(0, 0, 0, 0.15);
51
- font-weight: 500;
52
- font-size: 14px;
53
+ font-weight: 400;
54
+ font-size: 13px;
55
+ color: var(--cosmoz-omnitable-settings-color, #101010);
53
56
  line-height: 0.95;
54
57
  padding: 14px;
55
58
  display: flex;
@@ -77,7 +80,7 @@ export default css`
77
80
  .item {
78
81
  display: flex;
79
82
  align-items: center;
80
- background: white;
83
+ background: var(--cosmoz-omnitable-settings-item-bg-color, #fff);
81
84
  }
82
85
  .item.drag {
83
86
  opacity: 0.6;
@@ -139,7 +142,6 @@ export default css`
139
142
  .reset {
140
143
  background: transparent;
141
144
  color: inherit;
142
- text-decoration: underline;
143
145
  }
144
146
  /* sortgroups */
145
147
  .sgs {
@@ -153,16 +155,17 @@ export default css`
153
155
  .sg {
154
156
  color: inherit;
155
157
  border: 1px solid rgba(0, 0, 0, 0.2);
156
- border-radius: 2px;
157
- font-size: 13px;
158
+ border-radius: 6px;
159
+ font-size: 12px;
160
+ text-transform: uppercase;
158
161
  line-height: 1;
159
- text-align: center;
162
+ text-align: left;
160
163
  padding: 6px 12px;
161
164
  background: transparent;
162
165
  cursor: pointer;
163
166
  display: flex;
164
- align-items: center;
165
- justify-content: center;
167
+ align-items: left;
168
+ justify-content: auto;
166
169
  }
167
170
  .sg span {
168
171
  overflow: hidden;
package/lib/use-header.js CHANGED
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-lines-per-function */
2
1
  import { useEffect, useMemo } from '@pionjs/pion';
3
2
 
4
3
  export const useHeader = ({
@@ -31,9 +30,9 @@ export const useHeader = ({
31
30
  ...settings.columns.filter((s) => s.disabled),
32
31
  ].some(
33
32
  (column) =>
34
- column && Object.keys(filterFunctions).includes(column.name)
33
+ column && Object.keys(filterFunctions).includes(column.name),
35
34
  ),
36
- [filterFunctions, settings, collapsedColumns]
35
+ [filterFunctions, settings, collapsedColumns],
37
36
  ),
38
37
  settingsConfig = useMemo(
39
38
  () => ({
@@ -42,7 +41,7 @@ export const useHeader = ({
42
41
  badge: hasHiddenFilter,
43
42
  filters,
44
43
  }),
45
- [settingS, collapsedColumns, hasHiddenFilter, filters]
44
+ [settingS, collapsedColumns, hasHiddenFilter, filters],
46
45
  );
47
46
 
48
47
  useEffect(() => {
@@ -51,9 +50,9 @@ export const useHeader = ({
51
50
  requestAnimationFrame(() => {
52
51
  host.style.setProperty(
53
52
  '--ot-height',
54
- entries[0]?.contentRect.height + 'px'
53
+ entries[0]?.contentRect.height + 'px',
55
54
  );
56
- })
55
+ }),
57
56
  );
58
57
  observer.observe(el);
59
58
  return () => observer.unobserve(el);
package/lib/use-list.js CHANGED
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-lines-per-function */
2
1
  import { html, useCallback, useEffect, useMemo, useRef } from '@pionjs/pion';
3
2
  import { when } from 'lit-html/directives/when.js';
4
3
  import { isEmpty } from '@neovici/cosmoz-utils/template';
@@ -1,12 +1,12 @@
1
1
  import { useState } from '@pionjs/pion';
2
- import { useProcessedItems } from './use-processed-items';
3
- import { useFastLayout } from './use-fast-layout';
4
2
  import { useSettings } from './settings';
5
- import { useSortAndGroupOptions } from './use-sort-and-group-options';
6
- import { usePublicInterface } from './use-public-interface';
3
+ import { useFastLayout } from './use-fast-layout';
4
+ import { useFooter } from './use-footer';
7
5
  import { useHeader } from './use-header';
8
6
  import { useList } from './use-list';
9
- import { useFooter } from './use-footer';
7
+ import { useProcessedItems } from './use-processed-items';
8
+ import { usePublicInterface } from './use-public-interface';
9
+ import { useSortAndGroupOptions } from './use-sort-and-group-options';
10
10
 
11
11
  export const useOmnitable = (host) => {
12
12
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-omnitable",
3
- "version": "14.5.0",
3
+ "version": "14.6.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"