@neovici/cosmoz-omnitable 14.12.2 → 14.12.4
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.
- package/cosmoz-omnitable-column-amount.js +1 -5
- package/cosmoz-omnitable-column-boolean.js +1 -1
- package/cosmoz-omnitable-column-date.js +1 -5
- package/cosmoz-omnitable-column-datetime.js +1 -6
- package/cosmoz-omnitable-column-mixin.js +0 -1
- package/cosmoz-omnitable-column-time.js +1 -5
- package/cosmoz-omnitable-column.js +0 -1
- package/cosmoz-omnitable-header-row.js +38 -49
- package/grouped-list/use-cosmoz-grouped-list.js +3 -17
- package/grouped-list/use-selected-items.js +0 -1
- package/lib/cosmoz-omnitable-amount-range-input.js +2 -10
- package/lib/cosmoz-omnitable-date-input-mixin.js +5 -16
- package/lib/cosmoz-omnitable-date-range-input.js +0 -2
- package/lib/cosmoz-omnitable-datetime-range-input.js +0 -1
- package/lib/cosmoz-omnitable-number-range-input.js +1 -5
- package/lib/cosmoz-omnitable-range-input-mixin.js +12 -48
- package/lib/cosmoz-omnitable-time-range-input.js +0 -1
- package/lib/icons.js +0 -1
- package/lib/layout.js +1 -2
- package/lib/settings/cosmoz-omnitable-settings.js +0 -1
- package/lib/settings/normalize.js +0 -1
- package/lib/settings/style.css.js +3 -2
- package/lib/settings/use-saved-settings.js +0 -1
- package/lib/settings/use-settings-ui.js +1 -6
- package/lib/use-dom-columns.js +0 -1
- package/lib/use-processed-items.js +3 -14
- package/lib/use-public-interface.js +0 -1
- package/lib/use-sort-and-group-options.js +2 -11
- package/lib/use-tween-array.js +0 -1
- package/lib/utils-amount.js +2 -9
- package/lib/utils-date.js +0 -1
- package/package.json +2 -2
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-return-assign */
|
|
2
1
|
import '@neovici/cosmoz-input';
|
|
3
2
|
import '@polymer/paper-dropdown-menu/paper-dropdown-menu';
|
|
4
3
|
import './ui-helpers/cosmoz-clear-button';
|
|
@@ -96,10 +95,7 @@ class OmnitableColumnAmount extends columnMixin(PolymerElement) {
|
|
|
96
95
|
return null;
|
|
97
96
|
}
|
|
98
97
|
|
|
99
|
-
return {
|
|
100
|
-
min: fromHashString(matches[1]),
|
|
101
|
-
max: fromHashString(matches[2]),
|
|
102
|
-
};
|
|
98
|
+
return { min: fromHashString(matches[1]), max: fromHashString(matches[2]) };
|
|
103
99
|
}
|
|
104
100
|
|
|
105
101
|
renderCell(column, { item }) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-return-assign */
|
|
2
1
|
import { html } from 'lit-html';
|
|
3
2
|
import { PolymerElement } from '@polymer/polymer/polymer-element';
|
|
4
3
|
import '@polymer/paper-dropdown-menu/paper-dropdown-menu';
|
|
@@ -86,10 +85,7 @@ class OmnitableColumnDate extends columnMixin(PolymerElement) {
|
|
|
86
85
|
return null;
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
return {
|
|
90
|
-
min: toDate(matches[1]),
|
|
91
|
-
max: toDate(matches[2]),
|
|
92
|
-
};
|
|
88
|
+
return { min: toDate(matches[1]), max: toDate(matches[2]) };
|
|
93
89
|
}
|
|
94
90
|
|
|
95
91
|
renderCell(column, { item }) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-return-assign */
|
|
2
1
|
import '@polymer/paper-dropdown-menu/paper-dropdown-menu';
|
|
3
2
|
import '@neovici/cosmoz-datetime-input';
|
|
4
3
|
import './ui-helpers/cosmoz-clear-button';
|
|
@@ -98,10 +97,7 @@ class OmnitableColumnDatetime extends columnMixin(PolymerElement) {
|
|
|
98
97
|
return null;
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
return {
|
|
102
|
-
min: fromHashString(matches[1]),
|
|
103
|
-
max: fromHashString(matches[2]),
|
|
104
|
-
};
|
|
100
|
+
return { min: fromHashString(matches[1]), max: fromHashString(matches[2]) };
|
|
105
101
|
}
|
|
106
102
|
|
|
107
103
|
renderCell(column, { item }) {
|
|
@@ -119,7 +115,6 @@ class OmnitableColumnDatetime extends columnMixin(PolymerElement) {
|
|
|
119
115
|
></cosmoz-input>`;
|
|
120
116
|
}
|
|
121
117
|
|
|
122
|
-
// eslint-disable-next-line max-lines-per-function
|
|
123
118
|
renderHeader(
|
|
124
119
|
{ title, min, max, limits, locale, filterStep },
|
|
125
120
|
{ filter },
|
|
@@ -18,7 +18,6 @@ export const getString = ({ valuePath }, item) => get(item, valuePath),
|
|
|
18
18
|
},
|
|
19
19
|
serializeFilter = (column, filter) =>
|
|
20
20
|
filter === '' || filter == null ? null : filter,
|
|
21
|
-
// eslint-disable-next-line max-lines-per-function
|
|
22
21
|
columnMixin = (base) =>
|
|
23
22
|
class extends base {
|
|
24
23
|
static get properties() {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-return-assign */
|
|
2
1
|
import '@polymer/paper-dropdown-menu/paper-dropdown-menu';
|
|
3
2
|
import '@neovici/cosmoz-input';
|
|
4
3
|
|
|
@@ -93,10 +92,7 @@ class OmnitableColumnTime extends columnMixin(PolymerElement) {
|
|
|
93
92
|
return null;
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
return {
|
|
97
|
-
min: fromHashString(matches[1]),
|
|
98
|
-
max: fromHashString(matches[2]),
|
|
99
|
-
};
|
|
95
|
+
return { min: fromHashString(matches[1]), max: fromHashString(matches[2]) };
|
|
100
96
|
}
|
|
101
97
|
|
|
102
98
|
renderCell(column, { item }) {
|
|
@@ -5,61 +5,50 @@ import { render } from './lib/settings/cosmoz-omnitable-sort-group';
|
|
|
5
5
|
import { when } from 'lit-html/directives/when.js';
|
|
6
6
|
import { SortAndGroupContext } from './lib/use-sort-and-group-options';
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const renderHeaderRow = ({
|
|
9
|
+
data,
|
|
10
|
+
columns,
|
|
11
|
+
groupOnColumn,
|
|
12
|
+
filters,
|
|
13
|
+
setFilterState,
|
|
14
|
+
sortAndGroup: {
|
|
15
|
+
sortOn: on,
|
|
16
|
+
setSortOn: setOn,
|
|
17
|
+
descending,
|
|
18
|
+
setDescending,
|
|
19
|
+
} = {},
|
|
20
|
+
}) =>
|
|
21
|
+
repeat(
|
|
11
22
|
columns,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
filters[column.name] ?? {},
|
|
36
|
-
(state) => setFilterState(column.name, state),
|
|
37
|
-
column.source(column, data),
|
|
38
|
-
)}
|
|
39
|
-
${render({
|
|
40
|
-
on,
|
|
41
|
-
setOn,
|
|
42
|
-
descending,
|
|
43
|
-
setDescending,
|
|
44
|
-
column,
|
|
45
|
-
})}
|
|
46
|
-
</div>`,
|
|
47
|
-
html`<cosmoz-omnitable-resize-nub
|
|
48
|
-
.column="${column}"
|
|
49
|
-
name="${column.name}"
|
|
50
|
-
></cosmoz-omnitable-resize-nub>`,
|
|
51
|
-
],
|
|
52
|
-
);
|
|
23
|
+
(column) => column.name,
|
|
24
|
+
(column) => [
|
|
25
|
+
html`<div
|
|
26
|
+
class="cell ${column.headerCellClass} header-cell"
|
|
27
|
+
part="cell header-cell cell-${column.name} header-cell-${column.name}"
|
|
28
|
+
?hidden="${column === groupOnColumn}"
|
|
29
|
+
title="${column.title}"
|
|
30
|
+
name="${column.name}"
|
|
31
|
+
>
|
|
32
|
+
${column.renderHeader(
|
|
33
|
+
column,
|
|
34
|
+
filters[column.name] ?? {},
|
|
35
|
+
(state) => setFilterState(column.name, state),
|
|
36
|
+
column.source(column, data),
|
|
37
|
+
)}
|
|
38
|
+
${render({ on, setOn, descending, setDescending, column })}
|
|
39
|
+
</div>`,
|
|
40
|
+
html`<cosmoz-omnitable-resize-nub
|
|
41
|
+
.column="${column}"
|
|
42
|
+
name="${column.name}"
|
|
43
|
+
></cosmoz-omnitable-resize-nub>`,
|
|
44
|
+
],
|
|
45
|
+
);
|
|
53
46
|
|
|
54
47
|
const HeaderRow = ({ columns, settingsConfig, hideSelectAll, ...thru }) => {
|
|
55
48
|
const sortAndGroup = useContext(SortAndGroupContext);
|
|
56
49
|
return html`
|
|
57
50
|
${when(columns, (columns) =>
|
|
58
|
-
renderHeaderRow({
|
|
59
|
-
columns,
|
|
60
|
-
sortAndGroup,
|
|
61
|
-
...thru,
|
|
62
|
-
}),
|
|
51
|
+
renderHeaderRow({ columns, sortAndGroup, ...thru }),
|
|
63
52
|
)}
|
|
64
53
|
${when(
|
|
65
54
|
!hideSelectAll,
|
|
@@ -9,13 +9,8 @@ import { byReference, isExpanded, isFolded, prepareData } from './utils';
|
|
|
9
9
|
import { virtualize } from '@lit-labs/virtualizer/virtualize.js';
|
|
10
10
|
|
|
11
11
|
const styles = {
|
|
12
|
-
host: {
|
|
13
|
-
position: 'relative',
|
|
14
|
-
display: 'flex',
|
|
15
|
-
flexDirection: 'column',
|
|
16
|
-
},
|
|
12
|
+
host: { position: 'relative', display: 'flex', flexDirection: 'column' },
|
|
17
13
|
},
|
|
18
|
-
// eslint-disable-next-line max-lines-per-function
|
|
19
14
|
useCosmozGroupedList = (host) => {
|
|
20
15
|
const {
|
|
21
16
|
data,
|
|
@@ -44,15 +39,9 @@ const styles = {
|
|
|
44
39
|
deselectAll,
|
|
45
40
|
toggleSelect,
|
|
46
41
|
toggleSelectTo,
|
|
47
|
-
} = useSelectedItems({
|
|
48
|
-
initial: [],
|
|
49
|
-
compareItemsFn,
|
|
50
|
-
data,
|
|
51
|
-
flatData,
|
|
52
|
-
}),
|
|
42
|
+
} = useSelectedItems({ initial: [], compareItemsFn, data, flatData }),
|
|
53
43
|
renderRow = useCallback(
|
|
54
44
|
(item, index) =>
|
|
55
|
-
// eslint-disable-next-line no-nested-ternary
|
|
56
45
|
Array.isArray(item.items)
|
|
57
46
|
? renderGroup(item, index, {
|
|
58
47
|
selected: isGroupSelected(item, selectedItems),
|
|
@@ -97,10 +86,7 @@ const styles = {
|
|
|
97
86
|
|
|
98
87
|
useImperativeApi(api, Object.values(api));
|
|
99
88
|
|
|
100
|
-
return {
|
|
101
|
-
renderRow,
|
|
102
|
-
flatData,
|
|
103
|
-
};
|
|
89
|
+
return { renderRow, flatData };
|
|
104
90
|
},
|
|
105
91
|
renderCosmozGroupedList = ({ renderRow, flatData }) =>
|
|
106
92
|
virtualize({
|
|
@@ -39,7 +39,6 @@ class AmountRangeInput extends rangeInputMixin(
|
|
|
39
39
|
return ['_valuesChanged(autodetect, currency, values)'];
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
// eslint-disable-next-line max-lines-per-function
|
|
43
42
|
render() {
|
|
44
43
|
const onOpenedChanged = (event) => {
|
|
45
44
|
this.headerFocused = event.detail.value;
|
|
@@ -191,7 +190,6 @@ class AmountRangeInput extends rangeInputMixin(
|
|
|
191
190
|
* @returns {Object|void} Value converted to Number or void
|
|
192
191
|
*/
|
|
193
192
|
toAmount(value, limit, limitFunc) {
|
|
194
|
-
// eslint-disable-line max-statements
|
|
195
193
|
if (value == null || value === '') {
|
|
196
194
|
return;
|
|
197
195
|
}
|
|
@@ -208,10 +206,7 @@ class AmountRangeInput extends rangeInputMixin(
|
|
|
208
206
|
if (number == null || Number.isNaN(number)) {
|
|
209
207
|
return null;
|
|
210
208
|
}
|
|
211
|
-
const amount = {
|
|
212
|
-
currency: value.currency,
|
|
213
|
-
amount: number,
|
|
214
|
-
};
|
|
209
|
+
const amount = { currency: value.currency, amount: number };
|
|
215
210
|
|
|
216
211
|
if (limitFunc == null || limit == null) {
|
|
217
212
|
return amount;
|
|
@@ -307,10 +302,7 @@ class AmountRangeInput extends rangeInputMixin(
|
|
|
307
302
|
item = event.model.item,
|
|
308
303
|
originalValue = this.get(this.valuePath, item),
|
|
309
304
|
amountValue = Number(value),
|
|
310
|
-
newValue = {
|
|
311
|
-
amount: amountValue,
|
|
312
|
-
currency: originalValue.currency,
|
|
313
|
-
};
|
|
305
|
+
newValue = { amount: amountValue, currency: originalValue.currency };
|
|
314
306
|
|
|
315
307
|
this.set(this.valuePath, newValue, item);
|
|
316
308
|
this._fireItemChangeEvent(
|
|
@@ -8,9 +8,7 @@ import { rangeInputMixin } from './cosmoz-omnitable-range-input-mixin';
|
|
|
8
8
|
* @param {class} base The base class
|
|
9
9
|
* @returns {class} The base class with the mixin applied
|
|
10
10
|
*/
|
|
11
|
-
export const dateInputMixin = (
|
|
12
|
-
base, // eslint-disable-line max-lines-per-function
|
|
13
|
-
) =>
|
|
11
|
+
export const dateInputMixin = (base) =>
|
|
14
12
|
/**
|
|
15
13
|
* @polymer
|
|
16
14
|
* @mixinClass
|
|
@@ -18,25 +16,16 @@ export const dateInputMixin = (
|
|
|
18
16
|
class extends rangeInputMixin(base) {
|
|
19
17
|
static get properties() {
|
|
20
18
|
return {
|
|
21
|
-
max: {
|
|
22
|
-
type: Date,
|
|
23
|
-
value: null,
|
|
24
|
-
},
|
|
19
|
+
max: { type: Date, value: null },
|
|
25
20
|
|
|
26
|
-
min: {
|
|
27
|
-
type: Date,
|
|
28
|
-
value: null,
|
|
29
|
-
},
|
|
21
|
+
min: { type: Date, value: null },
|
|
30
22
|
|
|
31
23
|
_filterText: {
|
|
32
24
|
type: String,
|
|
33
25
|
computed: '_computeFilterText(filter.*, formatter)',
|
|
34
26
|
},
|
|
35
27
|
|
|
36
|
-
formatter: {
|
|
37
|
-
type: Object,
|
|
38
|
-
computed: '_computeFormatter(locale)',
|
|
39
|
-
},
|
|
28
|
+
formatter: { type: Object, computed: '_computeFormatter(locale)' },
|
|
40
29
|
};
|
|
41
30
|
}
|
|
42
31
|
|
|
@@ -48,8 +37,8 @@ export const dateInputMixin = (
|
|
|
48
37
|
* @param {Function} limitFunc Function used to limit the date (Math.min|Math.max)
|
|
49
38
|
* @returns {Date|void} Value converted to date optionaly limitated
|
|
50
39
|
*/
|
|
40
|
+
// eslint-disable-next-line max-statements
|
|
51
41
|
toDate(value, limit, limitFunc) {
|
|
52
|
-
// eslint-disable-line max-statements
|
|
53
42
|
if (value == null || value === '') {
|
|
54
43
|
return;
|
|
55
44
|
}
|
|
@@ -9,14 +9,12 @@ import { polymerHauntedRender } from './polymer-haunted-render-mixin';
|
|
|
9
9
|
class DateRangeInput extends dateInputMixin(
|
|
10
10
|
polymerHauntedRender(PolymerElement),
|
|
11
11
|
) {
|
|
12
|
-
// eslint-disable-next-line max-lines-per-function
|
|
13
12
|
render() {
|
|
14
13
|
return html`
|
|
15
14
|
<style>
|
|
16
15
|
paper-dropdown-menu {
|
|
17
16
|
--iron-icon-width: 0;
|
|
18
17
|
display: block;
|
|
19
|
-
text-align: right;
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
.dropdown-content h3 {
|
|
@@ -19,10 +19,7 @@ class NumberRangeInput extends rangeInputMixin(
|
|
|
19
19
|
'_computeFormatter(locale, minimumFractionDigits, maximumFractionDigits)',
|
|
20
20
|
},
|
|
21
21
|
// trigger filter updates manually
|
|
22
|
-
autoupdate: {
|
|
23
|
-
type: String,
|
|
24
|
-
value: false,
|
|
25
|
-
},
|
|
22
|
+
autoupdate: { type: String, value: false },
|
|
26
23
|
_filterText: {
|
|
27
24
|
type: String,
|
|
28
25
|
computed: '_computeFilterText(filter.*, formatter)',
|
|
@@ -30,7 +27,6 @@ class NumberRangeInput extends rangeInputMixin(
|
|
|
30
27
|
};
|
|
31
28
|
}
|
|
32
29
|
|
|
33
|
-
// eslint-disable-next-line max-lines-per-function
|
|
34
30
|
render() {
|
|
35
31
|
const onOpenedChanged = (event) => {
|
|
36
32
|
this.headerFocused = event.detail.value;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable max-lines */
|
|
2
1
|
import { Debouncer } from '@polymer/polymer/lib/utils/debounce.js';
|
|
3
2
|
import { timeOut } from '@polymer/polymer/lib/utils/async.js';
|
|
4
3
|
import { enqueueDebouncer } from '@polymer/polymer/lib/utils/flush.js';
|
|
@@ -13,21 +12,15 @@ const getCloseableParent = (el) =>
|
|
|
13
12
|
* @param {class} base The base class
|
|
14
13
|
* @returns {class} The base class with the mixin applied
|
|
15
14
|
*/
|
|
16
|
-
export const rangeInputMixin = (
|
|
17
|
-
base, // eslint-disable-line max-lines-per-function
|
|
18
|
-
) =>
|
|
15
|
+
export const rangeInputMixin = (base) =>
|
|
19
16
|
/**
|
|
20
17
|
* @polymer
|
|
21
18
|
* @mixinClass
|
|
22
19
|
*/
|
|
23
20
|
class extends base {
|
|
24
21
|
static get properties() {
|
|
25
|
-
// eslint-disable-line max-lines-per-function
|
|
26
22
|
return {
|
|
27
|
-
filter: {
|
|
28
|
-
type: Object,
|
|
29
|
-
notify: true,
|
|
30
|
-
},
|
|
23
|
+
filter: { type: Object, notify: true },
|
|
31
24
|
|
|
32
25
|
values: {
|
|
33
26
|
type: Array,
|
|
@@ -36,52 +29,29 @@ export const rangeInputMixin = (
|
|
|
36
29
|
},
|
|
37
30
|
},
|
|
38
31
|
|
|
39
|
-
headerFocused: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
notify: true,
|
|
42
|
-
},
|
|
32
|
+
headerFocused: { type: Boolean, notify: true },
|
|
43
33
|
|
|
44
|
-
min: {
|
|
45
|
-
type: Number,
|
|
46
|
-
value: null,
|
|
47
|
-
},
|
|
34
|
+
min: { type: Number, value: null },
|
|
48
35
|
|
|
49
|
-
max: {
|
|
50
|
-
type: Number,
|
|
51
|
-
value: null,
|
|
52
|
-
},
|
|
36
|
+
max: { type: Number, value: null },
|
|
53
37
|
|
|
54
|
-
limits: {
|
|
55
|
-
type: Function,
|
|
56
|
-
},
|
|
38
|
+
limits: { type: Function },
|
|
57
39
|
|
|
58
40
|
/**
|
|
59
41
|
* If true, _limitInput and _updateFilter will be called after each value change
|
|
60
42
|
*/
|
|
61
|
-
autoupdate: {
|
|
62
|
-
type: String,
|
|
63
|
-
value: true,
|
|
64
|
-
},
|
|
43
|
+
autoupdate: { type: String, value: true },
|
|
65
44
|
|
|
66
|
-
locale: {
|
|
67
|
-
type: String,
|
|
68
|
-
value: null,
|
|
69
|
-
},
|
|
45
|
+
locale: { type: String, value: null },
|
|
70
46
|
|
|
71
47
|
_filterInput: {
|
|
72
48
|
type: Object,
|
|
73
49
|
value() {
|
|
74
|
-
return {
|
|
75
|
-
min: null,
|
|
76
|
-
max: null,
|
|
77
|
-
};
|
|
50
|
+
return { min: null, max: null };
|
|
78
51
|
},
|
|
79
52
|
},
|
|
80
53
|
|
|
81
|
-
_range: {
|
|
82
|
-
type: Object,
|
|
83
|
-
computed: '_computeRange(values.*)',
|
|
84
|
-
},
|
|
54
|
+
_range: { type: Object, computed: '_computeRange(values.*)' },
|
|
85
55
|
|
|
86
56
|
_limit: {
|
|
87
57
|
type: Object,
|
|
@@ -197,10 +167,7 @@ export const rangeInputMixin = (
|
|
|
197
167
|
allValues.map((v) => this.toValue(v)).filter((n) => n != null);
|
|
198
168
|
|
|
199
169
|
if (!values || values.length < 1) {
|
|
200
|
-
return {
|
|
201
|
-
min: null,
|
|
202
|
-
max: null,
|
|
203
|
-
};
|
|
170
|
+
return { min: null, max: null };
|
|
204
171
|
}
|
|
205
172
|
return values.reduce((p, n) => {
|
|
206
173
|
return {
|
|
@@ -275,10 +242,7 @@ export const rangeInputMixin = (
|
|
|
275
242
|
}
|
|
276
243
|
|
|
277
244
|
_getDefaultFilter() {
|
|
278
|
-
return {
|
|
279
|
-
min: null,
|
|
280
|
-
max: null,
|
|
281
|
-
};
|
|
245
|
+
return { min: null, max: null };
|
|
282
246
|
}
|
|
283
247
|
|
|
284
248
|
/**
|
package/lib/icons.js
CHANGED
package/lib/layout.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
const finite = (num) => (Number.isFinite(num) ? num : 0);
|
|
2
|
-
export const // eslint-disable-next-line max-
|
|
2
|
+
export const // eslint-disable-next-line max-statements
|
|
3
3
|
layout = (columns, container) => {
|
|
4
4
|
const result = [];
|
|
5
5
|
|
|
6
|
-
// eslint-disable-next-line one-var
|
|
7
6
|
let [widthSum, lots] = columns.reduce(
|
|
8
7
|
([widthSum, lots], { width, flex }) => [widthSum + width, lots + flex],
|
|
9
8
|
[0, 0],
|
|
@@ -217,8 +217,9 @@ export const dropdown = css`
|
|
|
217
217
|
--cosmoz-omnitable-settings-color,
|
|
218
218
|
var(--cz-text-color, #101010)
|
|
219
219
|
);
|
|
220
|
-
--cosmoz-dropdown-box-shadow:
|
|
221
|
-
0
|
|
220
|
+
--cosmoz-dropdown-box-shadow:
|
|
221
|
+
0 3px 4px 0 rgb(0 0 0 / 14%), 0 1px 8px 0 rgb(0 0 0 / 12%),
|
|
222
|
+
0 3px 3px -2px rgb(0 0 0 / 40%);
|
|
222
223
|
}
|
|
223
224
|
cosmoz-dropdown {
|
|
224
225
|
outline: none;
|
|
@@ -2,7 +2,6 @@ import { useCallback, useEffect, useState } from '@pionjs/pion';
|
|
|
2
2
|
import { normalizeStore } from './normalize';
|
|
3
3
|
import { useDriver } from './drivers';
|
|
4
4
|
|
|
5
|
-
// eslint-disable-next-line max-lines-per-function
|
|
6
5
|
export default (settingsId, settings, setSettings, onReset) => {
|
|
7
6
|
const [savedSettings, setSavedSettings] = useState(),
|
|
8
7
|
{ read, write } = useDriver();
|
|
@@ -6,7 +6,6 @@ const parseIndex = (str) => {
|
|
|
6
6
|
return isFinite(idx) ? idx : undefined;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
// eslint-disable-next-line max-lines-per-function
|
|
10
9
|
export default (host) => {
|
|
11
10
|
const { config } = host,
|
|
12
11
|
{ settings, setSettings, collapsed } = config,
|
|
@@ -14,11 +13,7 @@ export default (host) => {
|
|
|
14
13
|
collapsed,
|
|
15
14
|
settings: settings.columns,
|
|
16
15
|
setSettings: useCallback(
|
|
17
|
-
(columns) =>
|
|
18
|
-
setSettings((cfg) => ({
|
|
19
|
-
...cfg,
|
|
20
|
-
columns,
|
|
21
|
-
})),
|
|
16
|
+
(columns) => setSettings((cfg) => ({ ...cfg, columns })),
|
|
22
17
|
[setSettings],
|
|
23
18
|
),
|
|
24
19
|
});
|
package/lib/use-dom-columns.js
CHANGED
|
@@ -29,7 +29,6 @@ const sortBy = (valueFn, descending) => (a, b) =>
|
|
|
29
29
|
assignIndex = (item, index) => Object.assign(item, { [indexSymbol]: index }),
|
|
30
30
|
unparsed = Symbol('unparsed');
|
|
31
31
|
|
|
32
|
-
// eslint-disable-next-line max-lines-per-function
|
|
33
32
|
export const useProcessedItems = ({
|
|
34
33
|
data,
|
|
35
34
|
columns,
|
|
@@ -83,13 +82,7 @@ export const useProcessedItems = ({
|
|
|
83
82
|
newState,
|
|
84
83
|
);
|
|
85
84
|
|
|
86
|
-
return {
|
|
87
|
-
...filters,
|
|
88
|
-
[name]: {
|
|
89
|
-
...filters[name],
|
|
90
|
-
...newState,
|
|
91
|
-
},
|
|
92
|
-
};
|
|
85
|
+
return { ...filters, [name]: { ...filters[name], ...newState } };
|
|
93
86
|
}),
|
|
94
87
|
[columns, setFilters],
|
|
95
88
|
),
|
|
@@ -122,7 +115,7 @@ export const useProcessedItems = ({
|
|
|
122
115
|
);
|
|
123
116
|
}, [data, filterFunctions, noLocalFilter]),
|
|
124
117
|
// todo: extract function
|
|
125
|
-
|
|
118
|
+
|
|
126
119
|
processedItems = useMemo(() => {
|
|
127
120
|
if (
|
|
128
121
|
!noLocalSort &&
|
|
@@ -158,11 +151,7 @@ export const useProcessedItems = ({
|
|
|
158
151
|
let group = acc.find((g) => g.id === gval);
|
|
159
152
|
|
|
160
153
|
if (!group) {
|
|
161
|
-
group = {
|
|
162
|
-
id: gval,
|
|
163
|
-
name: gval,
|
|
164
|
-
items: [item],
|
|
165
|
-
};
|
|
154
|
+
group = { id: gval, name: gval, items: [item] };
|
|
166
155
|
return [...acc, group];
|
|
167
156
|
}
|
|
168
157
|
|
|
@@ -19,7 +19,6 @@ const parseBool = (bool) => [true, 'true', 1, 'yes', 'on'].includes(bool),
|
|
|
19
19
|
[setter, name, setSettings],
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
// eslint-disable-next-line max-lines-per-function
|
|
23
22
|
export const useSortAndGroupOptions = (
|
|
24
23
|
columns,
|
|
25
24
|
hashParam,
|
|
@@ -33,10 +32,7 @@ export const useSortAndGroupOptions = (
|
|
|
33
32
|
[descending, setDescending] = useHashState(
|
|
34
33
|
boolParam(settings.descending),
|
|
35
34
|
hashParam,
|
|
36
|
-
{
|
|
37
|
-
suffix: '-descending',
|
|
38
|
-
read: boolParam,
|
|
39
|
-
},
|
|
35
|
+
{ suffix: '-descending', read: boolParam },
|
|
40
36
|
),
|
|
41
37
|
[groupOn, setGroupOn] = useHashState(settings.groupOn, hashParam, {
|
|
42
38
|
suffix: '-groupOn',
|
|
@@ -86,12 +82,7 @@ export const useSortAndGroupOptions = (
|
|
|
86
82
|
// eslint-disable-next-line no-void
|
|
87
83
|
useEffect(() => void (resetRef.current = setSG), []);
|
|
88
84
|
|
|
89
|
-
return {
|
|
90
|
-
...sortAndGroup,
|
|
91
|
-
sortAndGroup,
|
|
92
|
-
groupOnColumn,
|
|
93
|
-
sortOnColumn,
|
|
94
|
-
};
|
|
85
|
+
return { ...sortAndGroup, sortAndGroup, groupOnColumn, sortOnColumn };
|
|
95
86
|
},
|
|
96
87
|
SortAndGroupContext = createContext();
|
|
97
88
|
|
package/lib/use-tween-array.js
CHANGED
|
@@ -35,7 +35,6 @@ const useAnimationLoop = (animate, trigger) => {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
export const isCloseEnough = (a = 0, b = 0) => Math.abs(a - b) < 0.1,
|
|
38
|
-
// eslint-disable-next-line max-lines-per-function
|
|
39
38
|
useTweenArray = (target, speedFactor = 1.9, callback = noop) => {
|
|
40
39
|
const state = useMeta({ target }),
|
|
41
40
|
// [tween, setTween] = useState(target),
|
package/lib/utils-amount.js
CHANGED
|
@@ -11,7 +11,6 @@ export const /**
|
|
|
11
11
|
* @returns {Object|void} Value converted to Number or void
|
|
12
12
|
*/
|
|
13
13
|
toAmount = (rates = {}, value, limit, limitFunc) => {
|
|
14
|
-
// eslint-disable-line max-statements
|
|
15
14
|
if (value == null || value === '') {
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
@@ -28,10 +27,7 @@ export const /**
|
|
|
28
27
|
if (number == null || Number.isNaN(number)) {
|
|
29
28
|
return null;
|
|
30
29
|
}
|
|
31
|
-
const amount = {
|
|
32
|
-
currency: value.currency,
|
|
33
|
-
amount: number,
|
|
34
|
-
};
|
|
30
|
+
const amount = { currency: value.currency, amount: number };
|
|
35
31
|
|
|
36
32
|
if (limitFunc == null || limit == null) {
|
|
37
33
|
return amount;
|
|
@@ -129,10 +125,7 @@ export const /**
|
|
|
129
125
|
if (!Array.isArray(params) || params.length < 0) {
|
|
130
126
|
return null;
|
|
131
127
|
}
|
|
132
|
-
return {
|
|
133
|
-
amount: params[1],
|
|
134
|
-
currency: params[2],
|
|
135
|
-
};
|
|
128
|
+
return { amount: params[1], currency: params[2] };
|
|
136
129
|
},
|
|
137
130
|
getCurrency = ({ valuePath }, item) => get(item, valuePath)?.currency,
|
|
138
131
|
getInputString = ({ valuePath }, item) => get(item, valuePath)?.amount;
|
package/lib/utils-date.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neovici/cosmoz-omnitable",
|
|
3
|
-
"version": "14.12.
|
|
3
|
+
"version": "14.12.4",
|
|
4
4
|
"description": "[](https://travis-ci.org/Neovici/cosmoz-omnitable)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components"
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@commitlint/cli": "^19.0.0",
|
|
88
88
|
"@commitlint/config-conventional": "^19.0.0",
|
|
89
|
-
"@neovici/cfg": "^
|
|
89
|
+
"@neovici/cfg": "^2.5.1",
|
|
90
90
|
"@neovici/cosmoz-viewinfo": "^4.0.0",
|
|
91
91
|
"@open-wc/testing": "^4.0.0",
|
|
92
92
|
"@polymer/iron-test-helpers": "^3.0.0",
|