@neovici/cosmoz-omnitable 12.21.0 → 12.23.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.
|
@@ -7,12 +7,10 @@ import { when } from 'lit-html/directives/when.js';
|
|
|
7
7
|
|
|
8
8
|
import { columnMixin, getString } from './cosmoz-omnitable-column-mixin.js';
|
|
9
9
|
import {
|
|
10
|
-
computeSource,
|
|
11
10
|
listColumnMixin,
|
|
12
11
|
onChange,
|
|
13
12
|
onFocus,
|
|
14
13
|
onText,
|
|
15
|
-
toAutocompleteSource,
|
|
16
14
|
} from './cosmoz-omnitable-column-list-mixin';
|
|
17
15
|
import { prop, strProp } from '@neovici/cosmoz-utils/object';
|
|
18
16
|
import { array } from '@neovici/cosmoz-utils/array';
|
|
@@ -42,7 +40,8 @@ class OmnitableColumnAutocomplete extends listColumnMixin(
|
|
|
42
40
|
headerCellClass: { type: String, value: 'autocomplete-header-cell' },
|
|
43
41
|
minWidth: { type: String, value: '55px' },
|
|
44
42
|
editMinWidth: { type: String, value: '55px' },
|
|
45
|
-
keepOpened: { type: Boolean },
|
|
43
|
+
keepOpened: { type: Boolean, value: true },
|
|
44
|
+
keepQuery: { type: Boolean },
|
|
46
45
|
textual: { type: Function },
|
|
47
46
|
};
|
|
48
47
|
}
|
|
@@ -51,6 +50,7 @@ class OmnitableColumnAutocomplete extends listColumnMixin(
|
|
|
51
50
|
return {
|
|
52
51
|
...super.getConfig?.(column),
|
|
53
52
|
keepOpened: column.keepOpened,
|
|
53
|
+
keepQuery: column.keepQuery,
|
|
54
54
|
textual: column.textual,
|
|
55
55
|
};
|
|
56
56
|
}
|
|
@@ -75,13 +75,10 @@ class OmnitableColumnAutocomplete extends listColumnMixin(
|
|
|
75
75
|
return html`<cosmoz-autocomplete-ui
|
|
76
76
|
class="external-values-${column.externalValues}"
|
|
77
77
|
?keep-opened=${column.keepOpened}
|
|
78
|
+
?keep-query=${column.keepQuery}
|
|
78
79
|
.textual=${column.textual}
|
|
79
80
|
.label=${column.title}
|
|
80
|
-
.source=${
|
|
81
|
-
source,
|
|
82
|
-
column.valueProperty,
|
|
83
|
-
column.textProperty
|
|
84
|
-
)}
|
|
81
|
+
.source=${source}
|
|
85
82
|
.textProperty=${column.textProperty}
|
|
86
83
|
.valueProperty=${column.valueProperty}
|
|
87
84
|
.itemRenderer=${column[columnSymbol]?.itemRenderer}
|
|
@@ -105,12 +102,6 @@ class OmnitableColumnAutocomplete extends listColumnMixin(
|
|
|
105
102
|
getComparableValue(column, item) {
|
|
106
103
|
return getComparableValue(column, item);
|
|
107
104
|
}
|
|
108
|
-
|
|
109
|
-
computeSource(column, data) {
|
|
110
|
-
return column.externalValues || typeof column.values === 'function'
|
|
111
|
-
? column.values
|
|
112
|
-
: computeSource(column, data);
|
|
113
|
-
}
|
|
114
105
|
}
|
|
115
106
|
customElements.define(
|
|
116
107
|
'cosmoz-omnitable-column-autocomplete',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { prop } from '@neovici/cosmoz-utils/object';
|
|
2
2
|
import { array } from '@neovici/cosmoz-utils/array';
|
|
3
|
+
import { invoke } from '@neovici/cosmoz-utils/function';
|
|
3
4
|
import { get } from '@polymer/polymer/lib/utils/path';
|
|
4
5
|
import { valuesFrom } from './lib/utils-data';
|
|
5
6
|
|
|
@@ -89,26 +90,17 @@ const unique = (values, valueProperty) => {
|
|
|
89
90
|
setState((state) => ({ ...state, headerFocused: focused })),
|
|
90
91
|
onText = (setState) => (text) =>
|
|
91
92
|
setState((state) => ({ ...state, query: text })),
|
|
92
|
-
|
|
93
|
-
{
|
|
94
|
-
|
|
95
|
-
valueProperty,
|
|
96
|
-
textProperty,
|
|
97
|
-
emptyLabel,
|
|
98
|
-
emptyValue,
|
|
99
|
-
emptyProperty,
|
|
100
|
-
},
|
|
101
|
-
data
|
|
93
|
+
computeValues = (
|
|
94
|
+
{ emptyValue, emptyLabel, emptyProperty, textProperty, valueProperty },
|
|
95
|
+
rawSource
|
|
102
96
|
) => {
|
|
103
|
-
const
|
|
104
|
-
source = toAutocompleteSource(values, valueProperty, textProperty);
|
|
105
|
-
|
|
97
|
+
const source = toAutocompleteSource(rawSource, valueProperty, textProperty);
|
|
106
98
|
if (
|
|
107
99
|
!emptyLabel ||
|
|
108
100
|
emptyValue === undefined ||
|
|
109
101
|
!textProperty ||
|
|
110
102
|
!(emptyProperty || valueProperty) ||
|
|
111
|
-
source
|
|
103
|
+
!source
|
|
112
104
|
) {
|
|
113
105
|
return source;
|
|
114
106
|
}
|
|
@@ -120,6 +112,8 @@ const unique = (values, valueProperty) => {
|
|
|
120
112
|
...source,
|
|
121
113
|
];
|
|
122
114
|
},
|
|
115
|
+
computeSource = (column, data) =>
|
|
116
|
+
computeValues(column, valuesFrom(data, column.valuePath)),
|
|
123
117
|
listColumnMixin = (base) =>
|
|
124
118
|
class extends base {
|
|
125
119
|
static get properties() {
|
|
@@ -180,7 +174,7 @@ const unique = (values, valueProperty) => {
|
|
|
180
174
|
|
|
181
175
|
computeSource(column, data) {
|
|
182
176
|
return column.externalValues || typeof column.values === 'function'
|
|
183
|
-
? column.values
|
|
177
|
+
? (...args) => computeValues(column, invoke(column.values, ...args))
|
|
184
178
|
: computeSource(column, data);
|
|
185
179
|
}
|
|
186
180
|
};
|
|
@@ -26,7 +26,8 @@ import { columnSymbol } from './lib/use-dom-columns';
|
|
|
26
26
|
class OmnitableColumnList extends listColumnMixin(columnMixin(PolymerElement)) {
|
|
27
27
|
static get properties() {
|
|
28
28
|
return {
|
|
29
|
-
keepOpened: { type: Boolean },
|
|
29
|
+
keepOpened: { type: Boolean, value: true },
|
|
30
|
+
keepQuery: { type: Boolean },
|
|
30
31
|
textual: { type: Function },
|
|
31
32
|
};
|
|
32
33
|
}
|
|
@@ -35,6 +36,7 @@ class OmnitableColumnList extends listColumnMixin(columnMixin(PolymerElement)) {
|
|
|
35
36
|
return {
|
|
36
37
|
...super.getConfig?.(column),
|
|
37
38
|
keepOpened: column.keepOpened,
|
|
39
|
+
keepQuery: column.keepQuery,
|
|
38
40
|
textual: column.textual,
|
|
39
41
|
};
|
|
40
42
|
}
|
|
@@ -62,6 +64,7 @@ class OmnitableColumnList extends listColumnMixin(columnMixin(PolymerElement)) {
|
|
|
62
64
|
return html`<cosmoz-autocomplete-ui
|
|
63
65
|
class="external-values-${column.externalValues}"
|
|
64
66
|
?keep-opened=${column.keepOpened}
|
|
67
|
+
?keep-query=${column.keepQuery}
|
|
65
68
|
.textual=${column.textual}
|
|
66
69
|
.column=${column}
|
|
67
70
|
.label=${column.title}
|
package/lib/use-hash-state.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useCallback, useState } from 'haunted';
|
|
2
2
|
import { navigate } from '@neovici/cosmoz-router';
|
|
3
|
-
import { identity } from '@neovici/cosmoz-utils/function';
|
|
4
|
-
import { invoke } from './invoke';
|
|
3
|
+
import { identity, invoke } from '@neovici/cosmoz-utils/function';
|
|
5
4
|
|
|
6
5
|
const
|
|
7
6
|
hashUrl = () => new URL(location.hash.replace(/^#!?/iu, '').replace('%23', '#'), location.origin),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo } from 'haunted';
|
|
2
|
+
import { invoke } from '@neovici/cosmoz-utils/function';
|
|
2
3
|
import { genericSorter } from './generic-sorter';
|
|
3
|
-
import { invoke } from './invoke';
|
|
4
4
|
import { columnSymbol } from './use-dom-columns';
|
|
5
5
|
import { useHashState } from './use-hash-state';
|
|
6
6
|
import { indexSymbol } from './utils';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neovici/cosmoz-omnitable",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.23.0",
|
|
4
4
|
"description": "[](https://travis-ci.org/Neovici/cosmoz-omnitable)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components"
|
package/lib/invoke.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const invoke = (fn, ...args) => typeof fn === 'function' ? fn(...args) : fn;
|