@neovici/cosmoz-omnitable 12.16.0 → 12.18.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.
|
@@ -2,67 +2,102 @@ import '@polymer/paper-spinner/paper-spinner-lite.js';
|
|
|
2
2
|
import '@neovici/cosmoz-autocomplete';
|
|
3
3
|
|
|
4
4
|
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
} from 'lit-html';
|
|
5
|
+
import { html } from 'lit-html';
|
|
6
|
+
import { when } from 'lit-html/directives/when.js';
|
|
8
7
|
|
|
9
8
|
import { columnMixin, getString } from './cosmoz-omnitable-column-mixin.js';
|
|
10
|
-
import { computeSource, listColumnMixin, onChange, onFocus, onText, toAutocompleteSource } from './cosmoz-omnitable-column-list-mixin';
|
|
11
9
|
import {
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
computeSource,
|
|
11
|
+
listColumnMixin,
|
|
12
|
+
onChange,
|
|
13
|
+
onFocus,
|
|
14
|
+
onText,
|
|
15
|
+
toAutocompleteSource,
|
|
16
|
+
} from './cosmoz-omnitable-column-list-mixin';
|
|
17
|
+
import { prop, strProp, array } from '@neovici/cosmoz-autocomplete/lib/utils';
|
|
14
18
|
import { columnSymbol } from './lib/use-dom-columns';
|
|
15
19
|
import { get } from '@polymer/polymer/lib/utils/path';
|
|
16
20
|
|
|
17
|
-
export const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
export const getComparableValue = (
|
|
22
|
+
{ valuePath, textProperty, valueProperty },
|
|
23
|
+
item
|
|
24
|
+
) => {
|
|
25
|
+
const property = textProperty ? strProp(textProperty) : prop(valueProperty),
|
|
26
|
+
values = array(valuePath && get(item, valuePath)).map(property);
|
|
27
|
+
return values.length > 1 ? values.filter(Boolean).join(',') : values[0];
|
|
28
|
+
};
|
|
23
29
|
|
|
24
30
|
/**
|
|
25
31
|
* @polymer
|
|
26
32
|
* @customElement
|
|
27
33
|
* @appliesMixin columnMixin
|
|
28
34
|
*/
|
|
29
|
-
class OmnitableColumnAutocomplete extends listColumnMixin(
|
|
35
|
+
class OmnitableColumnAutocomplete extends listColumnMixin(
|
|
36
|
+
columnMixin(PolymerElement)
|
|
37
|
+
) {
|
|
30
38
|
static get properties() {
|
|
31
39
|
return {
|
|
32
40
|
headerCellClass: { type: String, value: 'autocomplete-header-cell' },
|
|
33
41
|
minWidth: { type: String, value: '55px' },
|
|
34
|
-
editMinWidth: { type: String, value: '55px' }
|
|
42
|
+
editMinWidth: { type: String, value: '55px' },
|
|
43
|
+
keepOpened: { type: Boolean },
|
|
44
|
+
textual: { type: Function },
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getConfig(column) {
|
|
49
|
+
return {
|
|
50
|
+
...super.getConfig?.(column),
|
|
51
|
+
keepOpened: column.keepOpened,
|
|
52
|
+
textual: column.textual,
|
|
35
53
|
};
|
|
36
54
|
}
|
|
37
55
|
|
|
38
56
|
renderCell(column, { item }) {
|
|
39
|
-
return html`<span class="default-column"
|
|
57
|
+
return html`<span class="default-column"
|
|
58
|
+
>${column.getString(column, item)}</span
|
|
59
|
+
>`;
|
|
40
60
|
}
|
|
41
61
|
|
|
42
62
|
renderEditCell(column, { item }, onItemChange) {
|
|
43
|
-
const onChange = event => onItemChange(event.target.value);
|
|
44
|
-
return html`<paper-input
|
|
63
|
+
const onChange = (event) => onItemChange(event.target.value);
|
|
64
|
+
return html`<paper-input
|
|
65
|
+
no-label-float
|
|
66
|
+
type="text"
|
|
67
|
+
@change=${onChange}
|
|
68
|
+
.value=${getString(column, item)}
|
|
69
|
+
></paper-input>`;
|
|
45
70
|
}
|
|
46
71
|
|
|
47
72
|
renderHeader(column, { filter, query }, setState, source) {
|
|
48
|
-
const
|
|
49
|
-
spinner = column.loading
|
|
50
|
-
? html`<paper-spinner-lite style="width: 20px; height: 20px; flex: none;" suffix slot="suffix" active></paper-spinner-lite>`
|
|
51
|
-
: nothing;
|
|
52
|
-
|
|
53
73
|
return html`<cosmoz-autocomplete-ui
|
|
54
|
-
class="external-values-${
|
|
55
|
-
|
|
56
|
-
.
|
|
57
|
-
.
|
|
58
|
-
.
|
|
74
|
+
class="external-values-${column.externalValues}"
|
|
75
|
+
?keep-opened=${column.keepOpened}
|
|
76
|
+
.textual=${column.textual}
|
|
77
|
+
.label=${column.title}
|
|
78
|
+
.source=${toAutocompleteSource(
|
|
79
|
+
source,
|
|
80
|
+
column.valueProperty,
|
|
81
|
+
column.textProperty
|
|
82
|
+
)}
|
|
83
|
+
.textProperty=${column.textProperty}
|
|
84
|
+
.valueProperty=${column.valueProperty}
|
|
59
85
|
.itemRenderer=${column[columnSymbol]?.itemRenderer}
|
|
60
|
-
.value=${
|
|
61
|
-
.text=${
|
|
62
|
-
.onChange=${
|
|
63
|
-
.onFocus=${
|
|
64
|
-
.onText=${
|
|
65
|
-
|
|
86
|
+
.value=${filter}
|
|
87
|
+
.text=${query}
|
|
88
|
+
.onChange=${onChange(setState)}
|
|
89
|
+
.onFocus=${onFocus(setState)}
|
|
90
|
+
.onText=${onText(setState)}
|
|
91
|
+
>${when(
|
|
92
|
+
column.loading,
|
|
93
|
+
() => html`<paper-spinner-lite
|
|
94
|
+
style="width: 20px; height: 20px; flex:none;"
|
|
95
|
+
suffix
|
|
96
|
+
slot="suffix"
|
|
97
|
+
active
|
|
98
|
+
></paper-spinner-lite>`
|
|
99
|
+
)}</cosmoz-autocomplete-ui
|
|
100
|
+
>`;
|
|
66
101
|
}
|
|
67
102
|
|
|
68
103
|
getComparableValue(column, item) {
|
|
@@ -74,6 +109,8 @@ class OmnitableColumnAutocomplete extends listColumnMixin(columnMixin(PolymerEle
|
|
|
74
109
|
? column.values
|
|
75
110
|
: computeSource(column, data);
|
|
76
111
|
}
|
|
77
|
-
|
|
78
112
|
}
|
|
79
|
-
customElements.define(
|
|
113
|
+
customElements.define(
|
|
114
|
+
'cosmoz-omnitable-column-autocomplete',
|
|
115
|
+
OmnitableColumnAutocomplete
|
|
116
|
+
);
|
|
@@ -133,11 +133,7 @@ const unique = (values, valueProperty) => {
|
|
|
133
133
|
|
|
134
134
|
getConfig(column) {
|
|
135
135
|
return {
|
|
136
|
-
|
|
137
|
-
textProperty: column.textProperty,
|
|
138
|
-
emptyLabel: column.emptyLabel,
|
|
139
|
-
emptyValue: column.emptyValue,
|
|
140
|
-
emptyProperty: { type: String },
|
|
136
|
+
emptyProperty: column.emptyProperty,
|
|
141
137
|
};
|
|
142
138
|
}
|
|
143
139
|
|
|
@@ -25,8 +25,20 @@ import { columnSymbol } from './lib/use-dom-columns';
|
|
|
25
25
|
*/
|
|
26
26
|
class OmnitableColumnList extends listColumnMixin(columnMixin(PolymerElement)) {
|
|
27
27
|
static get properties() {
|
|
28
|
-
return {
|
|
28
|
+
return {
|
|
29
|
+
keepOpened: { type: Boolean },
|
|
30
|
+
textual: { type: Function },
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
getConfig(column) {
|
|
35
|
+
return {
|
|
36
|
+
...super.getConfig?.(column),
|
|
37
|
+
keepOpened: column.keepOpened,
|
|
38
|
+
textual: column.textual,
|
|
39
|
+
};
|
|
29
40
|
}
|
|
41
|
+
|
|
30
42
|
renderCell({ valuePath, textProperty }, { item, index }) {
|
|
31
43
|
return html`<cosmoz-omnitable-column-list-data
|
|
32
44
|
.items=${getTexts(item, valuePath, textProperty)}
|
|
@@ -46,18 +58,12 @@ class OmnitableColumnList extends listColumnMixin(columnMixin(PolymerElement)) {
|
|
|
46
58
|
></paper-input>`;
|
|
47
59
|
}
|
|
48
60
|
|
|
49
|
-
getConfig(column) {
|
|
50
|
-
return {
|
|
51
|
-
...super.getConfig?.(column),
|
|
52
|
-
keepOpened: column.keepOpened,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
61
|
renderHeader(column, { filter, query }, setState, source) {
|
|
57
62
|
return html`<cosmoz-autocomplete-ui
|
|
58
63
|
class="external-values-${column.externalValues}"
|
|
59
|
-
.column=${column}
|
|
60
64
|
?keep-opened=${column.keepOpened}
|
|
65
|
+
.textual=${column.textual}
|
|
66
|
+
.column=${column}
|
|
61
67
|
.label=${column.title}
|
|
62
68
|
.source=${source}
|
|
63
69
|
.textProperty=${column.textProperty}
|
package/lib/use-dom-columns.js
CHANGED
|
@@ -94,6 +94,12 @@ const columnSymbol = Symbol('column'),
|
|
|
94
94
|
trueLabel: column.trueLabel,
|
|
95
95
|
falseLabel: column.falseLabel,
|
|
96
96
|
|
|
97
|
+
// list columns
|
|
98
|
+
valueProperty: column.valueProperty,
|
|
99
|
+
textProperty: column.textProperty,
|
|
100
|
+
emptyLabel: column.emptyLabel,
|
|
101
|
+
emptyValue: column.emptyValue,
|
|
102
|
+
|
|
97
103
|
// range columns
|
|
98
104
|
min: column.min,
|
|
99
105
|
max: column.max,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neovici/cosmoz-omnitable",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.18.0",
|
|
4
4
|
"description": "[](https://travis-ci.org/Neovici/cosmoz-omnitable)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components"
|
|
@@ -94,9 +94,8 @@
|
|
|
94
94
|
"@polymer/paper-toggle-button": "^3.0.0",
|
|
95
95
|
"@semantic-release/changelog": "^6.0.0",
|
|
96
96
|
"@semantic-release/git": "^10.0.0",
|
|
97
|
-
"@web/dev-server": "^0.1.10",
|
|
98
97
|
"husky": "^8.0.0",
|
|
99
|
-
"semantic-release": "^
|
|
98
|
+
"semantic-release": "^21.0.0",
|
|
100
99
|
"sinon": "^15.0.0",
|
|
101
100
|
"web-animations-js": "^2.3.0"
|
|
102
101
|
}
|