@neovici/cosmoz-omnitable 8.0.0-beta.6 → 8.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.
- package/README.md +0 -25
- package/cosmoz-omnitable-column-amount.js +3 -3
- package/cosmoz-omnitable-column-autocomplete.js +3 -1
- package/cosmoz-omnitable-column-date.js +3 -3
- package/cosmoz-omnitable-column-datetime.js +3 -3
- package/cosmoz-omnitable-column-list-mixin.js +3 -1
- package/cosmoz-omnitable-column-number.js +3 -3
- package/cosmoz-omnitable-column-time.js +3 -3
- package/lib/normalize-settings.js +2 -5
- package/lib/use-dom-columns.js +29 -24
- package/lib/use-fast-layout.js +2 -16
- package/lib/use-omnitable.js +61 -14
- package/lib/use-processed-items.js +1 -1
- package/lib/use-resizable-columns.js +1 -2
- package/lib/utils-data.js +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,28 +5,3 @@ cosmoz-omnitable
|
|
|
5
5
|
[](https://codeclimate.com/github/Neovici/cosmoz-omnitable/maintainability)
|
|
6
6
|
[](https://codecov.io/gh/Neovici/cosmoz-omnitable)
|
|
7
7
|
[](https://github.com/semantic-release/semantic-release)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
migration TODO:
|
|
11
|
-
|
|
12
|
-
* check if dropping the visibility code has any adverse effect (might be related to hash-params)
|
|
13
|
-
x add legacy ots compatibility layer: dispatch filter-changed and other similar events from the columns
|
|
14
|
-
* verify each custom render function in FE
|
|
15
|
-
x convert DOM columns to config
|
|
16
|
-
x empty columns of all state
|
|
17
|
-
x hash params
|
|
18
|
-
x xlsx + csv export
|
|
19
|
-
* test for source
|
|
20
|
-
|
|
21
|
-
FE editable columns in:
|
|
22
|
-
views/administration/accounting-model/dimension-values.html.js
|
|
23
|
-
views/administration/periods/list.js
|
|
24
|
-
|
|
25
|
-
FE column-item-changed in:
|
|
26
|
-
views/administration/periods/list.js
|
|
27
|
-
|
|
28
|
-
BUGS:
|
|
29
|
-
* when navigating the queue, filters are not reset when view-core is reused
|
|
30
|
-
* autocomplete columns without valueProperty might not work
|
|
31
|
-
* treenode cells have show-max-nodes="undefined"
|
|
32
|
-
* treenode source has empty texts
|
|
@@ -7,7 +7,7 @@ import { PolymerElement } from '@polymer/polymer/polymer-element';
|
|
|
7
7
|
import { html } from 'lit-html';
|
|
8
8
|
|
|
9
9
|
import { columnMixin } from './cosmoz-omnitable-column-mixin';
|
|
10
|
-
import {
|
|
10
|
+
import { defaultComputeSource } from './lib/utils-data';
|
|
11
11
|
import './lib/cosmoz-omnitable-amount-range-input';
|
|
12
12
|
import { getComparableValue, getCurrency, applySingleFilter, getString, getInputString, toAmount, toHashString, fromHashString } from './lib/utils-amount';
|
|
13
13
|
import { get } from '@polymer/polymer/lib/utils/path';
|
|
@@ -134,8 +134,8 @@ class OmnitableColumnAmount extends columnMixin(PolymerElement) {
|
|
|
134
134
|
></cosmoz-omnitable-amount-range-input>`;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
computeSource(
|
|
138
|
-
return
|
|
137
|
+
computeSource(column, data) {
|
|
138
|
+
return defaultComputeSource(column, data);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -68,7 +68,9 @@ class OmnitableColumnAutocomplete extends listColumnMixin(columnMixin(PolymerEle
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
computeSource(column, data) {
|
|
71
|
-
return
|
|
71
|
+
return column.externalValues || typeof column.values === 'function'
|
|
72
|
+
? column.values
|
|
73
|
+
: computeSource(column, data);
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
}
|
|
@@ -9,7 +9,7 @@ import { html } from 'lit-html';
|
|
|
9
9
|
|
|
10
10
|
import { columnMixin } from './cosmoz-omnitable-column-mixin';
|
|
11
11
|
import './lib/cosmoz-omnitable-date-range-input';
|
|
12
|
-
import {
|
|
12
|
+
import { defaultComputeSource } from './lib/utils-data';
|
|
13
13
|
import { getString, getComparableValue, toDate, toHashString, toXlsxValue, applySingleFilter, getInputString, fromInputString } from './lib/utils-date';
|
|
14
14
|
|
|
15
15
|
class OmnitableColumnDate extends columnMixin(PolymerElement) {
|
|
@@ -117,8 +117,8 @@ class OmnitableColumnDate extends columnMixin(PolymerElement) {
|
|
|
117
117
|
></cosmoz-omnitable-date-range-input>`;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
computeSource(
|
|
121
|
-
return
|
|
120
|
+
computeSource(column, data) {
|
|
121
|
+
return defaultComputeSource(column, data);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
customElements.define('cosmoz-omnitable-column-date', OmnitableColumnDate);
|
|
@@ -8,7 +8,7 @@ import { PolymerElement } from '@polymer/polymer/polymer-element';
|
|
|
8
8
|
import { html } from 'lit-html';
|
|
9
9
|
import { fromHashString, getString, toHashString, toXlsxValue } from './lib/utils-datetime';
|
|
10
10
|
import { applySingleFilter, fromInputString, getComparableValue, toDate } from './lib/utils-date';
|
|
11
|
-
import {
|
|
11
|
+
import { defaultComputeSource } from './lib/utils-data';
|
|
12
12
|
import './lib/cosmoz-omnitable-datetime-range-input';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -123,8 +123,8 @@ class OmnitableColumnDatetime extends columnMixin(PolymerElement) {
|
|
|
123
123
|
></cosmoz-omnitable-datetime-range-input>`;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
computeSource(
|
|
127
|
-
return
|
|
126
|
+
computeSource(column, data) {
|
|
127
|
+
return defaultComputeSource(column, data);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -8,7 +8,7 @@ import { html } from 'lit-html';
|
|
|
8
8
|
import { columnMixin } from './cosmoz-omnitable-column-mixin';
|
|
9
9
|
|
|
10
10
|
import './lib/cosmoz-omnitable-number-range-input';
|
|
11
|
-
import {
|
|
11
|
+
import { defaultComputeSource } from './lib/utils-data';
|
|
12
12
|
import { applySingleFilter, getComparableValue, getInputString, getString, toHashString, toNumber } from './lib/utils-number';
|
|
13
13
|
import { get } from '@polymer/polymer/lib/utils/path';
|
|
14
14
|
|
|
@@ -127,8 +127,8 @@ class OmnitableColumnNumber extends columnMixin(PolymerElement) {
|
|
|
127
127
|
></cosmoz-omnitable-number-range-input>`;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
computeSource(
|
|
131
|
-
return
|
|
130
|
+
computeSource(column, data) {
|
|
131
|
+
return defaultComputeSource(column, data);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
customElements.define('cosmoz-omnitable-column-number', OmnitableColumnNumber);
|
|
@@ -10,7 +10,7 @@ import { html } from 'lit-html';
|
|
|
10
10
|
import { columnMixin } from './cosmoz-omnitable-column-mixin';
|
|
11
11
|
import { getComparableValue, getString, toXlsxValue, applySingleFilter, toDate, toHashString, fromHashString } from './lib/utils-time';
|
|
12
12
|
import './lib/cosmoz-omnitable-time-range-input';
|
|
13
|
-
import {
|
|
13
|
+
import { defaultComputeSource } from './lib/utils-data';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @polymer
|
|
@@ -124,8 +124,8 @@ class OmnitableColumnTime extends columnMixin(PolymerElement) {
|
|
|
124
124
|
></cosmoz-omnitable-time-range-input>`;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
computeSource(
|
|
128
|
-
return
|
|
127
|
+
computeSource(column, data) {
|
|
128
|
+
return defaultComputeSource(column, data);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
customElements.define('cosmoz-omnitable-column-time', OmnitableColumnTime);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const byName = name => item => item.name === name;
|
|
2
2
|
|
|
3
3
|
export const
|
|
4
|
-
columnSymbol = Symbol('column'),
|
|
5
4
|
normalizeSettings = (columns = [], settings = [], savedSettings = []) => {
|
|
6
5
|
const
|
|
7
6
|
cols = columns.filter(column => !settings.some(byName(column.name)) && !savedSettings.some(byName(column.name))),
|
|
@@ -20,8 +19,7 @@ export const
|
|
|
20
19
|
return {
|
|
21
20
|
...setting,
|
|
22
21
|
title: column.title,
|
|
23
|
-
minWidth: parseInt(column.minWidth, 10)
|
|
24
|
-
[columnSymbol]: column
|
|
22
|
+
minWidth: parseInt(column.minWidth, 10)
|
|
25
23
|
};
|
|
26
24
|
}),
|
|
27
25
|
...cols.map(column => {
|
|
@@ -32,8 +30,7 @@ export const
|
|
|
32
30
|
priority,
|
|
33
31
|
minWidth: parseInt(minWidth, 10),
|
|
34
32
|
width: parseInt(width, 10),
|
|
35
|
-
flex: parseInt(flex, 10)
|
|
36
|
-
[columnSymbol]: column
|
|
33
|
+
flex: parseInt(flex, 10)
|
|
37
34
|
};
|
|
38
35
|
})
|
|
39
36
|
];
|
package/lib/use-dom-columns.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useEffect, useState } from 'haunted';
|
|
2
2
|
import { memooize } from './memoize';
|
|
3
|
-
import { columnSymbol } from './normalize-settings';
|
|
4
3
|
|
|
5
4
|
const
|
|
5
|
+
columnSymbol = Symbol('column'),
|
|
6
6
|
verifyColumnSetup = columns => {
|
|
7
7
|
let ok = true;
|
|
8
8
|
const columnNames = columns.map(c => c.name);
|
|
@@ -17,7 +17,7 @@ const
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
columns.forEach(column => {
|
|
20
|
-
if (columnNames.indexOf(name) === columnNames.lastIndexOf(name)) {
|
|
20
|
+
if (columnNames.indexOf(column.name) === columnNames.lastIndexOf(column.name)) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
ok = false;
|
|
@@ -41,6 +41,7 @@ const
|
|
|
41
41
|
? domColumns.filter(column => enabledColumns.includes(column.name))
|
|
42
42
|
: domColumns.filter(column => !column.disabled);
|
|
43
43
|
|
|
44
|
+
// eslint-disable-next-line max-lines-per-function
|
|
44
45
|
return columns.map(column => ({
|
|
45
46
|
name: column.name,
|
|
46
47
|
title: column.title,
|
|
@@ -66,14 +67,13 @@ const
|
|
|
66
67
|
renderGroup: column.renderGroup,
|
|
67
68
|
cellTitleFn: column.cellTitleFn,
|
|
68
69
|
getFilterFn: column.getFilterFn,
|
|
70
|
+
headerCellClass: column.headerCellClass,
|
|
69
71
|
cellClass: column.cellClass,
|
|
70
72
|
|
|
71
73
|
editable: column.editable,
|
|
72
74
|
|
|
73
75
|
values: column.values,
|
|
74
|
-
source: memooize(
|
|
75
|
-
? column.values
|
|
76
|
-
: column.computeSource(column, data)),
|
|
76
|
+
source: memooize(column.computeSource),
|
|
77
77
|
|
|
78
78
|
// @deprecated
|
|
79
79
|
loading: column.loading,
|
|
@@ -107,32 +107,37 @@ const
|
|
|
107
107
|
|
|
108
108
|
// treenode columns
|
|
109
109
|
ownerTree: column.ownerTree,
|
|
110
|
-
showMaxNodes: column.showMaxNodes,
|
|
111
110
|
keyProperty: column.keyProperty,
|
|
112
111
|
|
|
113
112
|
[columnSymbol]: column
|
|
114
113
|
}));
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export const useDOMColumns = (host, { enabledColumns }) => {
|
|
118
|
-
const
|
|
119
|
-
[columns, setColumns] = useState(() => domColumnsToConfig(host, { enabledColumns }));
|
|
114
|
+
},
|
|
120
115
|
|
|
121
|
-
|
|
116
|
+
useDOMColumns = (host, { enabledColumns }) => {
|
|
122
117
|
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
[columns, setColumns] = useState(() => domColumnsToConfig(host, { enabledColumns }));
|
|
119
|
+
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
const
|
|
122
|
+
slot = host.shadowRoot.querySelector('#columnsSlot'),
|
|
123
|
+
handler = () => {
|
|
124
|
+
host.suppressNextScrollReset();
|
|
125
|
+
setColumns(domColumnsToConfig(host, { enabledColumns }));
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
slot.addEventListener('slotchange', handler);
|
|
129
|
+
host.addEventListener('cosmoz-column-prop-changed', handler);
|
|
130
|
+
return () => {
|
|
131
|
+
slot.removeEventListener('slotchange', handler);
|
|
132
|
+
host.removeEventListener('cosmoz-column-prop-changed', handler);
|
|
127
133
|
};
|
|
134
|
+
}, []);
|
|
135
|
+
|
|
136
|
+
return columns;
|
|
137
|
+
};
|
|
128
138
|
|
|
129
|
-
slot.addEventListener('slotchange', handler);
|
|
130
|
-
host.addEventListener('cosmoz-column-prop-changed', handler);
|
|
131
|
-
return () => {
|
|
132
|
-
slot.removeEventListener('slotchange', handler);
|
|
133
|
-
host.removeEventListener('cosmoz-column-prop-changed', handler);
|
|
134
|
-
};
|
|
135
|
-
}, []);
|
|
136
139
|
|
|
137
|
-
|
|
140
|
+
export {
|
|
141
|
+
columnSymbol,
|
|
142
|
+
useDOMColumns
|
|
138
143
|
};
|
package/lib/use-fast-layout.js
CHANGED
|
@@ -4,7 +4,6 @@ import { useResizableColumns } from './use-resizable-columns';
|
|
|
4
4
|
import { useCanvasWidth } from './use-canvas-width';
|
|
5
5
|
import { useTweenArray } from './use-tween-array';
|
|
6
6
|
import { useLayout } from './use-layout';
|
|
7
|
-
import { columnSymbol } from './normalize-settings';
|
|
8
7
|
import { render } from 'lit-html';
|
|
9
8
|
|
|
10
9
|
export const useFastLayout = ({ host, settings, setSettings, groupOnColumn, resizeSpeedFactor }) => {
|
|
@@ -12,18 +11,7 @@ export const useFastLayout = ({ host, settings, setSettings, groupOnColumn, resi
|
|
|
12
11
|
canvasWidth = useCanvasWidth(host),
|
|
13
12
|
layout = useLayout({ canvasWidth, groupOnColumn, config: settings }),
|
|
14
13
|
tweenedlayout = useTweenArray(layout, resizeSpeedFactor),
|
|
15
|
-
layoutCss = useMemo(() => toCss(tweenedlayout, settings), [tweenedlayout])
|
|
16
|
-
|
|
17
|
-
collapsedColumns = useMemo(() => Array.isArray(settings)
|
|
18
|
-
? settings.reduce((acc, column, index) =>
|
|
19
|
-
layout[index] != null
|
|
20
|
-
|| column.name === groupOnColumn?.name
|
|
21
|
-
|| column.disabled
|
|
22
|
-
? acc
|
|
23
|
-
: [...acc, column[columnSymbol]],
|
|
24
|
-
[])
|
|
25
|
-
: []
|
|
26
|
-
, [settings, layout]);
|
|
14
|
+
layoutCss = useMemo(() => toCss(tweenedlayout, settings), [tweenedlayout]);
|
|
27
15
|
|
|
28
16
|
useResizableColumns({ host, canvasWidth, layout, setSettings: update => setSettings(update(settings)) });
|
|
29
17
|
|
|
@@ -46,7 +34,5 @@ export const useFastLayout = ({ host, settings, setSettings, groupOnColumn, resi
|
|
|
46
34
|
return () => observer.unobserve(host);
|
|
47
35
|
}, []);
|
|
48
36
|
|
|
49
|
-
return
|
|
50
|
-
collapsedColumns
|
|
51
|
-
};
|
|
37
|
+
return layout;
|
|
52
38
|
};
|
package/lib/use-omnitable.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useMemo, useState } from 'haunted';
|
|
2
|
-
import {
|
|
2
|
+
import { normalizeSettings } from './normalize-settings';
|
|
3
3
|
import { useProcessedItems } from './use-processed-items';
|
|
4
4
|
import { useFastLayout } from './use-fast-layout';
|
|
5
5
|
import { useSavedSettings } from './use-saved-settings';
|
|
@@ -9,23 +9,68 @@ import { onItemChange } from './utils-data';
|
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line max-lines-per-function
|
|
11
11
|
export const useOmnitable = host => {
|
|
12
|
-
const
|
|
13
|
-
{ enabledColumns, hashParam } = host,
|
|
12
|
+
const { enabledColumns, hashParam } = host,
|
|
14
13
|
columns = useDOMColumns(host, { enabledColumns }),
|
|
15
|
-
sortAndGroupOptions = useSortAndGroupOptions(
|
|
14
|
+
sortAndGroupOptions = useSortAndGroupOptions(
|
|
15
|
+
columns,
|
|
16
|
+
hashParam,
|
|
17
|
+
host.sortOn,
|
|
18
|
+
host.groupOn
|
|
19
|
+
),
|
|
16
20
|
{ groupOnColumn, groupOnDescending, sortOnColumn, descending } = sortAndGroupOptions,
|
|
17
21
|
{ data, resizeSpeedFactor, settingsId } = host,
|
|
18
22
|
// TODO: drop filterFunctions
|
|
19
|
-
{
|
|
20
|
-
|
|
23
|
+
{
|
|
24
|
+
processedItems,
|
|
25
|
+
filters,
|
|
26
|
+
setFilterState,
|
|
27
|
+
numProcessedItems,
|
|
28
|
+
filterFunctions,
|
|
29
|
+
groupsCount
|
|
30
|
+
} = useProcessedItems({
|
|
31
|
+
data,
|
|
32
|
+
columns,
|
|
33
|
+
groupOnColumn,
|
|
34
|
+
groupOnDescending,
|
|
35
|
+
sortOnColumn,
|
|
36
|
+
descending,
|
|
37
|
+
hashParam
|
|
38
|
+
}),
|
|
21
39
|
[settings, setSettings] = useState([]),
|
|
22
|
-
{ savedSettings, onSettingsSave, onSettingsReset, hasChangedSettings } =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
40
|
+
{ savedSettings, onSettingsSave, onSettingsReset, hasChangedSettings } =
|
|
41
|
+
useSavedSettings(settingsId, settings, setSettings),
|
|
42
|
+
normalizedSettings = useMemo(
|
|
43
|
+
() => normalizeSettings(columns, settings, savedSettings),
|
|
44
|
+
[columns, settings, savedSettings]
|
|
45
|
+
),
|
|
46
|
+
normalizedColumns = useMemo(
|
|
47
|
+
() => normalizedSettings.map(s => columns.find(c => c.name === s.name)),
|
|
48
|
+
[columns, ...normalizedSettings.map(s => s.name)]
|
|
49
|
+
),
|
|
50
|
+
layout = useFastLayout({
|
|
51
|
+
host,
|
|
52
|
+
settings: normalizedSettings,
|
|
53
|
+
setSettings,
|
|
54
|
+
groupOnColumn,
|
|
55
|
+
resizeSpeedFactor
|
|
56
|
+
}),
|
|
57
|
+
collapsedColumns = useMemo(
|
|
58
|
+
() => normalizedSettings.reduce((acc, column, index) =>
|
|
59
|
+
layout[index] != null ||
|
|
60
|
+
column.name === groupOnColumn?.name ||
|
|
61
|
+
column.disabled
|
|
62
|
+
? acc
|
|
63
|
+
: [...acc, columns.find(c => c.name === column.name)],
|
|
64
|
+
[]),
|
|
65
|
+
[columns, normalizedSettings, layout]
|
|
66
|
+
),
|
|
26
67
|
hasHiddenFilter = useMemo(
|
|
27
|
-
() =>
|
|
28
|
-
|
|
68
|
+
() =>
|
|
69
|
+
[
|
|
70
|
+
groupOnColumn,
|
|
71
|
+
...collapsedColumns,
|
|
72
|
+
...normalizedSettings.filter(s => s.disabled)
|
|
73
|
+
].some(column => column && Object.keys(filterFunctions).includes(column.name)),
|
|
29
74
|
[filterFunctions, normalizedSettings, collapsedColumns]
|
|
30
75
|
);
|
|
31
76
|
|
|
@@ -34,7 +79,6 @@ export const useOmnitable = host => {
|
|
|
34
79
|
|
|
35
80
|
...sortAndGroupOptions,
|
|
36
81
|
|
|
37
|
-
layoutCss,
|
|
38
82
|
setSettings,
|
|
39
83
|
normalizedSettings,
|
|
40
84
|
normalizedColumns,
|
|
@@ -45,7 +89,10 @@ export const useOmnitable = host => {
|
|
|
45
89
|
hasChangedSettings,
|
|
46
90
|
filters,
|
|
47
91
|
setFilterState,
|
|
48
|
-
onItemChange: useCallback(
|
|
92
|
+
onItemChange: useCallback(
|
|
93
|
+
(column, item) => value => onItemChange(host, column, item, value),
|
|
94
|
+
[]
|
|
95
|
+
),
|
|
49
96
|
numProcessedItems,
|
|
50
97
|
groupsCount,
|
|
51
98
|
sortedFilteredGroupedItems: processedItems
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useMemo } from 'haunted';
|
|
2
2
|
import { genericSorter } from './generic-sorter';
|
|
3
3
|
import { invoke } from './invoke';
|
|
4
|
-
import { columnSymbol } from './
|
|
4
|
+
import { columnSymbol } from './use-dom-columns';
|
|
5
5
|
import { useHashState } from './use-hash-state';
|
|
6
6
|
|
|
7
7
|
const
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'haunted';
|
|
2
|
-
import { columnSymbol } from './normalize-settings';
|
|
3
2
|
|
|
4
3
|
export const useResizableColumns = ({ host, canvasWidth, layout, setSettings }) => {
|
|
5
4
|
const onColumnResizeRef = useRef();
|
|
@@ -7,7 +6,7 @@ export const useResizableColumns = ({ host, canvasWidth, layout, setSettings })
|
|
|
7
6
|
onColumnResizeRef.current = ev => setSettings(config => {
|
|
8
7
|
const
|
|
9
8
|
{ detail: { newWidth, column }} = ev,
|
|
10
|
-
columnIndex = config.findIndex(c => c
|
|
9
|
+
columnIndex = config.findIndex(c => c.name === column.name),
|
|
11
10
|
newConfig = [],
|
|
12
11
|
maxPriority = config.reduce((p, c) => Math.max(p, c.priority), -Infinity);
|
|
13
12
|
|
package/lib/utils-data.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { get, set } from '@polymer/polymer/lib/utils/path';
|
|
2
|
-
import { columnSymbol } from './
|
|
2
|
+
import { columnSymbol } from './use-dom-columns';
|
|
3
3
|
|
|
4
4
|
export const
|
|
5
5
|
valuesFrom = (data, valuePath) => data
|
|
@@ -8,6 +8,11 @@ export const
|
|
|
8
8
|
value != null && self.indexOf(value) === index
|
|
9
9
|
),
|
|
10
10
|
|
|
11
|
+
defaultComputeSource = ({ externalValues, values, valuePath }, data) =>
|
|
12
|
+
externalValues || typeof values === 'function'
|
|
13
|
+
? values
|
|
14
|
+
: valuesFrom(data, valuePath),
|
|
15
|
+
|
|
11
16
|
onItemChange = (host, column, item, value) => {
|
|
12
17
|
const
|
|
13
18
|
{ valuePath } = column,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neovici/cosmoz-omnitable",
|
|
3
|
-
"version": "8.0.0
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "[](https://travis-ci.org/Neovici/cosmoz-omnitable)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components"
|