@neovici/cosmoz-omnitable 8.0.0-beta.6 → 8.0.0-beta.7

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.
@@ -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 { valuesFrom } from './lib/utils-data';
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({ valuePath }, data) {
138
- return valuesFrom(data, valuePath);
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 computeSource(column, data);
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 { valuesFrom } from './lib/utils-data';
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({ valuePath }, data) {
121
- return valuesFrom(data, valuePath);
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 { valuesFrom } from './lib/utils-data';
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({ valuePath }, data) {
127
- return valuesFrom(data, valuePath);
126
+ computeSource(column, data) {
127
+ return defaultComputeSource(column, data);
128
128
  }
129
129
  }
130
130
 
@@ -160,7 +160,9 @@ const
160
160
  }
161
161
 
162
162
  computeSource(column, data) {
163
- return computeSource(column, data);
163
+ return column.externalValues || typeof column.values === 'function'
164
+ ? column.values
165
+ : computeSource(column, data);
164
166
  }
165
167
  };
166
168
 
@@ -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 { valuesFrom } from './lib/utils-data';
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({ valuePath }, data) {
131
- return valuesFrom(data, valuePath);
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 { valuesFrom } from './lib/utils-data';
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({ valuePath }, data) {
128
- return valuesFrom(data, valuePath);
127
+ computeSource(column, data) {
128
+ return defaultComputeSource(column, data);
129
129
  }
130
130
  }
131
131
  customElements.define('cosmoz-omnitable-column-time', OmnitableColumnTime);
@@ -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((column, data) => column.externalValues || typeof column.values === 'function'
75
- ? column.values
76
- : column.computeSource(column, data)),
76
+ source: memooize(column.computeSource),
77
77
 
78
78
  // @deprecated
79
79
  loading: column.loading,
@@ -107,7 +107,6 @@ 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
package/lib/utils-data.js CHANGED
@@ -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-beta.6",
3
+ "version": "8.0.0-beta.7",
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"