@neovici/cosmoz-omnitable 12.17.0 → 12.19.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,104 @@ 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
- html, nothing
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
- prop, strProp, array
13
- } from '@neovici/cosmoz-autocomplete/lib/utils';
10
+ computeSource,
11
+ listColumnMixin,
12
+ onChange,
13
+ onFocus,
14
+ onText,
15
+ toAutocompleteSource,
16
+ } from './cosmoz-omnitable-column-list-mixin';
17
+ import { prop, strProp } from '@neovici/cosmoz-utils/object';
18
+ import { array } from '@neovici/cosmoz-utils/array';
19
+
14
20
  import { columnSymbol } from './lib/use-dom-columns';
15
21
  import { get } from '@polymer/polymer/lib/utils/path';
16
22
 
17
- export const
18
- getComparableValue = ({ valuePath, textProperty, valueProperty }, item) => {
19
- const property = textProperty ? strProp(textProperty) : prop(valueProperty),
20
- values = array(valuePath && get(item, valuePath)).map(property);
21
- return values.length > 1 ? values.filter(Boolean).join(',') : values[0];
22
- };
23
+ export const getComparableValue = (
24
+ { valuePath, textProperty, valueProperty },
25
+ item
26
+ ) => {
27
+ const property = textProperty ? strProp(textProperty) : prop(valueProperty),
28
+ values = array(valuePath && get(item, valuePath)).map(property);
29
+ return values.length > 1 ? values.filter(Boolean).join(',') : values[0];
30
+ };
23
31
 
24
32
  /**
25
33
  * @polymer
26
34
  * @customElement
27
35
  * @appliesMixin columnMixin
28
36
  */
29
- class OmnitableColumnAutocomplete extends listColumnMixin(columnMixin(PolymerElement)) {
37
+ class OmnitableColumnAutocomplete extends listColumnMixin(
38
+ columnMixin(PolymerElement)
39
+ ) {
30
40
  static get properties() {
31
41
  return {
32
42
  headerCellClass: { type: String, value: 'autocomplete-header-cell' },
33
43
  minWidth: { type: String, value: '55px' },
34
- editMinWidth: { type: String, value: '55px' }
44
+ editMinWidth: { type: String, value: '55px' },
45
+ keepOpened: { type: Boolean },
46
+ textual: { type: Function },
47
+ };
48
+ }
49
+
50
+ getConfig(column) {
51
+ return {
52
+ ...super.getConfig?.(column),
53
+ keepOpened: column.keepOpened,
54
+ textual: column.textual,
35
55
  };
36
56
  }
37
57
 
38
58
  renderCell(column, { item }) {
39
- return html`<span class="default-column">${ column.getString(column, item) }</span>`;
59
+ return html`<span class="default-column"
60
+ >${column.getString(column, item)}</span
61
+ >`;
40
62
  }
41
63
 
42
64
  renderEditCell(column, { item }, onItemChange) {
43
- const onChange = event => onItemChange(event.target.value);
44
- return html`<paper-input no-label-float type="text" @change=${ onChange } .value=${ getString(column, item) }></paper-input>`;
65
+ const onChange = (event) => onItemChange(event.target.value);
66
+ return html`<paper-input
67
+ no-label-float
68
+ type="text"
69
+ @change=${onChange}
70
+ .value=${getString(column, item)}
71
+ ></paper-input>`;
45
72
  }
46
73
 
47
74
  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
75
  return html`<cosmoz-autocomplete-ui
54
- class="external-values-${ column.externalValues }"
55
- .label=${ column.title }
56
- .source=${ toAutocompleteSource(source, column.valueProperty, column.textProperty) }
57
- .textProperty=${ column.textProperty }
58
- .valueProperty=${ column.valueProperty }
76
+ class="external-values-${column.externalValues}"
77
+ ?keep-opened=${column.keepOpened}
78
+ .textual=${column.textual}
79
+ .label=${column.title}
80
+ .source=${toAutocompleteSource(
81
+ source,
82
+ column.valueProperty,
83
+ column.textProperty
84
+ )}
85
+ .textProperty=${column.textProperty}
86
+ .valueProperty=${column.valueProperty}
59
87
  .itemRenderer=${column[columnSymbol]?.itemRenderer}
60
- .value=${ filter }
61
- .text=${ query }
62
- .onChange=${ onChange(setState) }
63
- .onFocus=${ onFocus(setState) }
64
- .onText=${ onText(setState) }
65
- >${ spinner }</cosmoz-autocomplete-ui>`;
88
+ .value=${filter}
89
+ .text=${query}
90
+ .onChange=${onChange(setState)}
91
+ .onFocus=${onFocus(setState)}
92
+ .onText=${onText(setState)}
93
+ >${when(
94
+ column.loading,
95
+ () => html`<paper-spinner-lite
96
+ style="width: 20px; height: 20px; flex:none;"
97
+ suffix
98
+ slot="suffix"
99
+ active
100
+ ></paper-spinner-lite>`
101
+ )}</cosmoz-autocomplete-ui
102
+ >`;
66
103
  }
67
104
 
68
105
  getComparableValue(column, item) {
@@ -74,6 +111,8 @@ class OmnitableColumnAutocomplete extends listColumnMixin(columnMixin(PolymerEle
74
111
  ? column.values
75
112
  : computeSource(column, data);
76
113
  }
77
-
78
114
  }
79
- customElements.define('cosmoz-omnitable-column-autocomplete', OmnitableColumnAutocomplete);
115
+ customElements.define(
116
+ 'cosmoz-omnitable-column-autocomplete',
117
+ OmnitableColumnAutocomplete
118
+ );
@@ -1,4 +1,5 @@
1
- import { prop, array } from '@neovici/cosmoz-autocomplete/lib/utils';
1
+ import { prop } from '@neovici/cosmoz-utils/object';
2
+ import { array } from '@neovici/cosmoz-utils/array';
2
3
  import { get } from '@polymer/polymer/lib/utils/path';
3
4
  import { valuesFrom } from './lib/utils-data';
4
5
 
@@ -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 { keepOpened: { type: Boolean } };
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-omnitable",
3
- "version": "12.17.0",
3
+ "version": "12.19.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"
@@ -59,7 +59,7 @@
59
59
  }
60
60
  },
61
61
  "dependencies": {
62
- "@neovici/cosmoz-autocomplete": "^5.0.0",
62
+ "@neovici/cosmoz-autocomplete": "^5.0.0 || ^6.0.0",
63
63
  "@neovici/cosmoz-bottom-bar": "^6.0.0",
64
64
  "@neovici/cosmoz-collapse": "^1.1.0",
65
65
  "@neovici/cosmoz-datetime-input": "^3.0.3",
@@ -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": "^20.0.0",
98
+ "semantic-release": "^21.0.0",
100
99
  "sinon": "^15.0.0",
101
100
  "web-animations-js": "^2.3.0"
102
101
  }