@neovici/cosmoz-omnitable 11.1.0 → 12.0.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.
@@ -285,52 +285,6 @@ export default `<style>
285
285
  left: 0;
286
286
  }
287
287
 
288
- .footer {
289
- display: flex;
290
- align-items: center;
291
- background-color: var(--cosmoz-omnitable-footer-bg-color, #f5f5f5);
292
- height: 64px;
293
- padding: 0 24px;
294
- }
295
-
296
- .footer-controls {
297
- display: flex;
298
- align-items: center;
299
- flex: auto;
300
- isolation: isolate;
301
- }
302
-
303
- .footer-control {
304
- display: flex;
305
- align-items: center;
306
- }
307
- .footer-control + .footer-control {
308
- margin-left: 16px;
309
- }
310
- .footer-control::part(input-label) {
311
- opacity: 0.7;
312
- }
313
- .footer-control::part(input-line) {
314
- margin-top: 1px;
315
- }
316
- .footer-control::part(chip) {
317
- background-color: #CBCFDB;
318
- }
319
- .footer-control::part(chip-clear) {
320
- background-color: #81899B;
321
- fill: #CBCFDB;
322
- }
323
-
324
- .footer-tableStats {
325
- display: flex;
326
- flex-direction: column;
327
- align-items: flex-end;
328
- white-space: nowrap;
329
- }
330
-
331
- .footer-tableStats :first-child {
332
- margin-bottom: 5px;
333
- }
334
288
 
335
289
  .item-row-wrapper {
336
290
  display: block;
@@ -428,7 +382,6 @@ export default `<style>
428
382
  cosmoz-bottom-bar {
429
383
  background-color: var(--cosmoz-omnitable-bottom-bar-color, #5f5a92);
430
384
  overflow: hidden;
431
- position: absolute;
432
385
  }
433
386
  cosmoz-bottom-bar::part(bar) {
434
387
  padding: 0 24px;
@@ -26,7 +26,6 @@ import { useOmnitable } from './lib/use-omnitable';
26
26
  import { saveAsCsvAction } from './lib/save-as-csv-action';
27
27
  import { saveAsXlsxAction } from './lib/save-as-xlsx-action';
28
28
  import { defaultPlacement } from '@neovici/cosmoz-dropdown';
29
- import { without } from '@neovici/cosmoz-utils/array';
30
29
  import { indexSymbol } from './lib/utils';
31
30
 
32
31
  /**
@@ -108,117 +107,48 @@ class Omnitable extends hauntedPolymer(useOmnitable)(
108
107
  ></cosmoz-grouped-list>
109
108
  </div>
110
109
  </div>
111
- <div class="footer">
112
- <div class="footer-controls" part="footer-controls">
113
- <cosmoz-autocomplete
114
- label="[[ _('Group on', t) ]] [[ _computeSortDirection(groupOnDescending, t) ]]"
115
- placeholder="[[ _('No grouping', t) ]]"
116
- source="[[ _onCompleteValues(columns, 'groupOn', groupOnColumn) ]]"
117
- value="[[ groupOnColumn ]]"
118
- limit="1"
119
- text-property="title"
120
- always-float-label
121
- item-height="48"
122
- item-limit="8"
123
- class="footer-control"
124
- on-change="[[ _onCompleteChange('groupOn') ]]"
125
- on-select="[[ _onCompleteSelect ]]"
126
- default-index="-1"
127
- show-single
128
- >
129
- <svg
130
- slot="suffix"
131
- viewBox="0 0 24 24"
132
- preserveAspectRatio="xMidYMid meet"
133
- focusable="false"
134
- width="24"
135
- fill="currentColor"
136
- >
137
- <path d="M7 10l5 5 5-5z"></path>
138
- </svg>
139
- </cosmoz-autocomplete>
140
- <cosmoz-autocomplete
141
- label="[[ _('Sort on', t) ]] [[ _computeSortDirection(descending, t) ]]"
142
- placeholder="[[ _('No sorting', t) ]]"
143
- source="[[ _onCompleteValues(columns, 'sortOn', sortOnColumn) ]]"
144
- value="[[ sortOnColumn ]]"
145
- limit="1"
146
- text-property="title"
147
- always-float-label
148
- item-height="48"
149
- item-limit="8"
150
- class="footer-control"
151
- on-change="[[ _onCompleteChange('sortOn') ]]"
152
- on-select="[[ _onCompleteSelect ]]"
153
- default-index="-1"
154
- show-single
155
- >
156
- <svg
157
- slot="suffix"
158
- viewBox="0 0 24 24"
159
- preserveAspectRatio="xMidYMid meet"
160
- focusable="false"
161
- width="24"
162
- fill="currentColor"
163
- >
164
- <path d="M7 10l5 5 5-5z"></path>
165
- </svg>
166
- </cosmoz-autocomplete>
167
- <slot id="controlsSlot" name="controls"></slot>
168
- </div>
169
- <div class="footer-tableStats">
170
- <span
171
- >[[ ngettext('{0} group', '{0} groups', groupsCount, t) ]]</span
172
- >
173
- <span
174
- >[[ _renderRowStats(numProcessedItems, totalAvailable, t) ]]</span
175
- >
176
- </div>
177
- <cosmoz-bottom-bar
178
- id="bottomBar"
179
- class="footer-actionBar"
180
- match-parent
181
- on-action="_onAction"
182
- active$="[[ !isEmpty(selectedItems.length) ]]"
110
+ <cosmoz-bottom-bar
111
+ id="bottomBar"
112
+ on-action="_onAction"
113
+ active$="[[ !isEmpty(selectedItems.length) ]]"
114
+ >
115
+ <slot name="info" slot="info"
116
+ >[[ ngettext('{0} selected item', '{0} selected items',
117
+ selectedItems.length, t) ]]</slot
183
118
  >
184
- <slot name="info" slot="info"
185
- >[[ ngettext('{0} selected item', '{0} selected items',
186
- selectedItems.length, t) ]]</slot
119
+ <slot name="actions" id="actions"></slot>
120
+ <!-- These slots are needed by cosmoz-bottom-bar
121
+ as it might change the slot of the actions to distribute them in the menu -->
122
+ <slot name="bottom-bar-toolbar" slot="bottom-bar-toolbar"></slot>
123
+ <slot name="bottom-bar-menu" slot="bottom-bar-menu"></slot>
124
+ <cosmoz-dropdown-menu slot="extra" placement="[[ topPlacement ]]">
125
+ <svg
126
+ slot="button"
127
+ width="14"
128
+ height="18"
129
+ viewBox="0 0 14 18"
130
+ fill="none"
131
+ stroke="currentColor"
132
+ xmlns="http://www.w3.org/2000/svg"
187
133
  >
188
- <slot name="actions" id="actions"></slot>
189
- <!-- These slots are needed by cosmoz-bottom-bar
190
- as it might change the slot of the actions to distribute them in the menu -->
191
- <slot name="bottom-bar-toolbar" slot="bottom-bar-toolbar"></slot>
192
- <slot name="bottom-bar-menu" slot="bottom-bar-menu"></slot>
193
- <cosmoz-dropdown-menu slot="extra" placement="[[ topPlacement ]]">
194
- <svg
195
- slot="button"
196
- width="14"
197
- height="18"
198
- viewBox="0 0 14 18"
199
- fill="none"
200
- stroke="currentColor"
201
- xmlns="http://www.w3.org/2000/svg"
202
- >
203
- <path
204
- d="M1 8.5L7.00024 14.5L13 8.5"
205
- stroke-width="2"
206
- stroke-linecap="round"
207
- stroke-linejoin="round"
208
- />
209
- <path d="M13 17L1 17" stroke-width="2" stroke-linecap="round" />
210
- <path d="M7 1V13" stroke-width="2" stroke-linecap="round" />
211
- </svg>
212
- <button on-click="_saveAsCsvAction">
213
- [[ _('Save as CSV', t) ]]
214
- </button>
215
- <button on-click="_saveAsXlsxAction">
216
- [[ _('Save as XLSX', t) ]]
217
- </button>
218
- <slot name="download-menu"></slot>
219
- </cosmoz-dropdown-menu>
220
- </cosmoz-bottom-bar>
221
- </div>
134
+ <path
135
+ d="M1 8.5L7.00024 14.5L13 8.5"
136
+ stroke-width="2"
137
+ stroke-linecap="round"
138
+ stroke-linejoin="round"
139
+ />
140
+ <path d="M13 17L1 17" stroke-width="2" stroke-linecap="round" />
141
+ <path d="M7 1V13" stroke-width="2" stroke-linecap="round" />
142
+ </svg>
143
+ <button on-click="_saveAsCsvAction">
144
+ [[ _('Save as CSV', t) ]]
145
+ </button>
146
+ <button on-click="_saveAsXlsxAction">
147
+ [[ _('Save as XLSX', t) ]]
148
+ </button>
149
+ <slot name="download-menu"></slot>
150
+ </cosmoz-dropdown-menu>
151
+ </cosmoz-bottom-bar>
222
152
  </div>
223
153
 
224
154
  <div id="columns">
@@ -440,11 +370,6 @@ class Omnitable extends hauntedPolymer(useOmnitable)(
440
370
  return dataIsValid && visibleItemsLength < 1;
441
371
  }
442
372
 
443
- _computeSortDirection(descending) {
444
- const direction = descending ? this._('Descending') : this._('Ascending');
445
- return `(${direction})`;
446
- }
447
-
448
373
  _onKey(e) {
449
374
  this._shiftKey = e.shiftKey;
450
375
  this._ctrlKey = e.ctrlKey;
@@ -608,54 +533,6 @@ class Omnitable extends hauntedPolymer(useOmnitable)(
608
533
  return this.$.groupedList.isItemSelected(item);
609
534
  }
610
535
 
611
- _renderRowStats(numRows, totalAvailable) {
612
- if (Number.isInteger(totalAvailable) && totalAvailable > numRows) {
613
- return this.ngettext(
614
- '{1} / {0} row',
615
- '{1} / {0} rows',
616
- totalAvailable,
617
- numRows
618
- );
619
- }
620
- return this.ngettext('{0} row', '{0} rows', numRows);
621
- }
622
-
623
- _onCompleteValues(columns, type, value) {
624
- return (
625
- columns
626
- ?.filter?.((c) => c[type])
627
- /* eslint-disable-next-line no-bitwise */
628
- .sort((a, b) => ((b === value) >> 0) - ((a === value) >> 0))
629
- );
630
- }
631
-
632
- _onCompleteSelect(newVal, { value, onChange, onText, limit }) {
633
- onText('');
634
- onChange([...without(newVal)(value), newVal].slice(-limit));
635
- }
636
-
637
- _onCompleteChange(type) {
638
- return (val, close) => {
639
- const value = (val[0] ?? val)?.name ?? '',
640
- setter = type === 'groupOn' ? this.setGroupOn : this.setSortOn,
641
- directionSetter =
642
- type === 'groupOn' ? this.setGroupOnDescending : this.setDescending;
643
-
644
- setter((oldValue) => {
645
- if (value) {
646
- directionSetter((oldDirection) =>
647
- value === oldValue ? !oldDirection : false
648
- );
649
- } else {
650
- directionSetter(null);
651
- }
652
- return value;
653
- });
654
-
655
- value && close(); /* eslint-disable-line no-unused-expressions */
656
- };
657
- }
658
-
659
536
  onItemClick(e) {
660
537
  const composedPath = e.composedPath(),
661
538
  path = composedPath.slice(0, composedPath.indexOf(e.currentTarget));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-omnitable",
3
- "version": "11.1.0",
3
+ "version": "12.0.0",
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"