@sankhyalabs/sankhyablocks 5.9.2 → 5.10.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/dist/cjs/{ConfigStorage-91adf3fe.js → ConfigStorage-f68c3607.js} +5 -71
- package/dist/cjs/{SnkFormConfigManager-e1a10283.js → SnkFormConfigManager-69df3f74.js} +2 -2
- package/dist/cjs/{SnkMessageBuilder-1760d2c9.js → SnkMessageBuilder-cf80308c.js} +6 -1
- package/dist/cjs/filter-bar-config-fetcher-a14536bf.js +115 -0
- package/dist/cjs/{form-config-fetcher-fa19680a.js → form-config-fetcher-92bc8fe7.js} +2 -65
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/resource-fetcher-2979b54b.js +68 -0
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-application.cjs.entry.js +7 -4
- package/dist/cjs/snk-data-exporter.cjs.entry.js +2 -2
- package/dist/cjs/{snk-data-unit-f27603c9.js → snk-data-unit-bd271acd.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +2 -2
- package/dist/cjs/snk-detail-view.cjs.entry.js +8 -5
- package/dist/cjs/snk-entity-list.cjs.entry.js +111 -0
- package/dist/cjs/snk-filter-bar.cjs.entry.js +4 -2
- package/dist/cjs/snk-filter-detail.cjs.entry.js +44 -3
- package/dist/cjs/snk-filter-item.cjs.entry.js +9 -4
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +30 -2
- package/dist/cjs/snk-filter-modal.cjs.entry.js +26 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +2 -1
- package/dist/cjs/snk-form.cjs.entry.js +6 -3
- package/dist/cjs/snk-grid-config.cjs.entry.js +5 -2
- package/dist/cjs/snk-grid.cjs.entry.js +5 -2
- package/dist/cjs/{snk-guides-viewer-5f2eb52b.js → snk-guides-viewer-b2d40bc4.js} +1 -1
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -4
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/snk-entity-list/snk-entity-list.css +35 -0
- package/dist/collection/components/snk-entity-list/snk-entity-list.js +250 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +45 -4
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +9 -4
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +26 -3
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +28 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.js +48 -5
- package/dist/collection/lib/message/SnkMessageBuilder.js +3 -1
- package/dist/collection/lib/message/resources/snk-entity-list.msg.js +3 -0
- package/dist/components/ConfigStorage.js +3 -69
- package/dist/components/SnkMessageBuilder.js +6 -1
- package/dist/components/filter-bar-config-fetcher.js +113 -0
- package/dist/components/form-config-fetcher.js +2 -64
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/resource-fetcher.js +66 -0
- package/dist/components/snk-application2.js +1 -1
- package/dist/components/snk-entity-list.d.ts +11 -0
- package/dist/components/snk-entity-list.js +131 -0
- package/dist/components/snk-filter-detail2.js +42 -4
- package/dist/components/snk-filter-item2.js +9 -4
- package/dist/components/snk-filter-modal-item2.js +28 -3
- package/dist/components/snk-filter-modal.js +26 -3
- package/dist/esm/{ConfigStorage-ac77ff39.js → ConfigStorage-e6c17998.js} +3 -69
- package/dist/esm/{SnkFormConfigManager-40609500.js → SnkFormConfigManager-e60367a0.js} +2 -2
- package/dist/esm/{SnkMessageBuilder-4caf8b4f.js → SnkMessageBuilder-1a169545.js} +6 -1
- package/dist/esm/filter-bar-config-fetcher-edc48f4b.js +113 -0
- package/dist/esm/{form-config-fetcher-018e7e73.js → form-config-fetcher-cac8cd96.js} +2 -64
- package/dist/esm/loader.js +1 -1
- package/dist/esm/resource-fetcher-02642924.js +66 -0
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-application.entry.js +6 -3
- package/dist/esm/snk-data-exporter.entry.js +2 -2
- package/dist/esm/{snk-data-unit-640399b3.js → snk-data-unit-476024e9.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +2 -2
- package/dist/esm/snk-detail-view.entry.js +8 -5
- package/dist/esm/snk-entity-list.entry.js +107 -0
- package/dist/esm/snk-filter-bar.entry.js +4 -2
- package/dist/esm/snk-filter-detail.entry.js +45 -4
- package/dist/esm/snk-filter-item.entry.js +9 -4
- package/dist/esm/snk-filter-modal-item.entry.js +31 -3
- package/dist/esm/snk-filter-modal.entry.js +26 -3
- package/dist/esm/snk-form-config.entry.js +2 -1
- package/dist/esm/snk-form.entry.js +6 -3
- package/dist/esm/snk-grid-config.entry.js +5 -2
- package/dist/esm/snk-grid.entry.js +5 -2
- package/dist/esm/{snk-guides-viewer-11ca46dc.js → snk-guides-viewer-11a02781.js} +1 -1
- package/dist/esm/snk-guides-viewer.entry.js +7 -4
- package/dist/sankhyablocks/p-0409d41b.entry.js +1 -0
- package/dist/sankhyablocks/p-1c5d5e5c.entry.js +1 -0
- package/dist/sankhyablocks/p-1c836fad.entry.js +1 -0
- package/dist/sankhyablocks/p-1e6a95f5.entry.js +1 -0
- package/dist/sankhyablocks/p-2ea933b2.js +17 -0
- package/dist/sankhyablocks/{p-6981c03e.js → p-3e17b147.js} +1 -1
- package/dist/sankhyablocks/p-471568c7.entry.js +1 -0
- package/dist/sankhyablocks/p-4eae2812.entry.js +1 -0
- package/dist/sankhyablocks/p-554e2f83.entry.js +1 -0
- package/dist/sankhyablocks/p-587bd851.entry.js +1 -0
- package/dist/sankhyablocks/p-656eab86.entry.js +1 -0
- package/dist/sankhyablocks/p-6c2c71ca.js +1 -0
- package/dist/sankhyablocks/p-79f78e10.js +10 -0
- package/dist/sankhyablocks/{p-7f2e267a.js → p-7f0afee1.js} +1 -1
- package/dist/sankhyablocks/p-b1c02726.js +1 -0
- package/dist/sankhyablocks/{p-e0aa5838.js → p-b25450ab.js} +1 -1
- package/dist/sankhyablocks/p-c20dd153.entry.js +1 -0
- package/dist/sankhyablocks/{p-29c1889f.js → p-c74fca58.js} +1 -1
- package/dist/sankhyablocks/p-c842c6f1.entry.js +1 -0
- package/dist/sankhyablocks/{p-4181c36d.entry.js → p-c93aab6a.entry.js} +1 -1
- package/dist/sankhyablocks/p-d66bfdef.entry.js +1 -0
- package/dist/sankhyablocks/p-e642bf7a.entry.js +1 -0
- package/dist/sankhyablocks/{p-57b74971.entry.js → p-f5e607e7.entry.js} +3 -3
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-entity-list/snk-entity-list.d.ts +48 -0
- package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +2 -0
- package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.d.ts +6 -0
- package/dist/types/components.d.ts +54 -2
- package/dist/types/lib/http/data-fetcher/fetchers/filter-bar-config-fetcher.d.ts +1 -0
- package/dist/types/lib/message/resources/snk-entity-list.msg.d.ts +1 -0
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/sankhyablocks/p-08779202.entry.js +0 -1
- package/dist/sankhyablocks/p-0bb49e4a.entry.js +0 -1
- package/dist/sankhyablocks/p-0d81236c.js +0 -26
- package/dist/sankhyablocks/p-355e7ab0.entry.js +0 -1
- package/dist/sankhyablocks/p-3794686e.entry.js +0 -1
- package/dist/sankhyablocks/p-52ed2a18.js +0 -1
- package/dist/sankhyablocks/p-59705471.entry.js +0 -1
- package/dist/sankhyablocks/p-6f0b3cc0.entry.js +0 -1
- package/dist/sankhyablocks/p-747ea2c3.entry.js +0 -1
- package/dist/sankhyablocks/p-7621806d.entry.js +0 -1
- package/dist/sankhyablocks/p-86f75e7a.entry.js +0 -1
- package/dist/sankhyablocks/p-9043c45f.entry.js +0 -1
- package/dist/sankhyablocks/p-b9fb86fe.entry.js +0 -1
- package/dist/sankhyablocks/p-c7ee03cd.entry.js +0 -1
@@ -1,5 +1,7 @@
|
|
1
1
|
import { ApplicationContext } from '@sankhyalabs/core';
|
2
|
-
import {
|
2
|
+
import { F as FormConfigFetcher } from './form-config-fetcher.js';
|
3
|
+
import { R as ResourceFetcher } from './resource-fetcher.js';
|
4
|
+
import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher.js';
|
3
5
|
|
4
6
|
class GridConfigFetcher extends ResourceFetcher {
|
5
7
|
constructor() {
|
@@ -41,74 +43,6 @@ class GridConfigFetcher extends ResourceFetcher {
|
|
41
43
|
}
|
42
44
|
}
|
43
45
|
|
44
|
-
function normalizeValue(value) {
|
45
|
-
if (value == undefined) {
|
46
|
-
return value;
|
47
|
-
}
|
48
|
-
if (value instanceof Date) {
|
49
|
-
return value.toISOString();
|
50
|
-
}
|
51
|
-
if (typeof value === "object") {
|
52
|
-
if (value instanceof Array) {
|
53
|
-
return value.map(item => normalizeValue(item));
|
54
|
-
}
|
55
|
-
else {
|
56
|
-
const normalized = Object.assign({}, value);
|
57
|
-
Object.keys(value).forEach(prop => {
|
58
|
-
if (value[prop]) {
|
59
|
-
normalized[prop] = normalizeValue(value[prop]);
|
60
|
-
}
|
61
|
-
else {
|
62
|
-
delete normalized[prop];
|
63
|
-
}
|
64
|
-
});
|
65
|
-
return normalized;
|
66
|
-
}
|
67
|
-
}
|
68
|
-
return value;
|
69
|
-
}
|
70
|
-
class FilterBarConfigFetcher extends ResourceFetcher {
|
71
|
-
saveConfig(items, resourceID, configName) {
|
72
|
-
const state = items.map(item => {
|
73
|
-
const { id, value, fixed, visible } = item;
|
74
|
-
const stateItem = { id };
|
75
|
-
if (value) {
|
76
|
-
stateItem["value"] = normalizeValue(value);
|
77
|
-
}
|
78
|
-
if (fixed) {
|
79
|
-
stateItem["fixed"] = fixed;
|
80
|
-
}
|
81
|
-
if (visible) {
|
82
|
-
stateItem["visible"] = true;
|
83
|
-
}
|
84
|
-
return stateItem;
|
85
|
-
});
|
86
|
-
return this.saveResource(state, this.getPath(resourceID, configName));
|
87
|
-
}
|
88
|
-
getConfig(resourceID, configName) {
|
89
|
-
return new Promise((accept, reject) => {
|
90
|
-
this.loadResource(this.getPath(resourceID, configName))
|
91
|
-
.then((configAsString) => {
|
92
|
-
let fieldsList;
|
93
|
-
if (configAsString) {
|
94
|
-
const filterBarConfig = JSON.parse(configAsString);
|
95
|
-
fieldsList = filterBarConfig.items;
|
96
|
-
}
|
97
|
-
accept(fieldsList || []);
|
98
|
-
})
|
99
|
-
.catch((error) => {
|
100
|
-
reject(error);
|
101
|
-
});
|
102
|
-
});
|
103
|
-
}
|
104
|
-
getPath(resourceID, name) {
|
105
|
-
if (name) {
|
106
|
-
return `cfg://filter/FilterBarState:${resourceID}/${name}`;
|
107
|
-
}
|
108
|
-
return `cfg://filter/FilterBarState:${resourceID}`;
|
109
|
-
}
|
110
|
-
}
|
111
|
-
|
112
46
|
const CONFIG_SOURCE = {
|
113
47
|
form: "form",
|
114
48
|
grid: "grid",
|
@@ -338,6 +338,10 @@ const snkPersonalizedFilterMessages = {
|
|
338
338
|
}
|
339
339
|
};
|
340
340
|
|
341
|
+
const snkEntityListMessages = {
|
342
|
+
selected: "Selecionados:"
|
343
|
+
};
|
344
|
+
|
341
345
|
class SnkMessageBuilder {
|
342
346
|
constructor(domainName) {
|
343
347
|
this._defaults = {
|
@@ -360,7 +364,8 @@ class SnkMessageBuilder {
|
|
360
364
|
snkFilterFieldSearch: snkFilterFieldSearchMessages,
|
361
365
|
snkSimpleBar: snkSimpleBarMessages,
|
362
366
|
snkAttach: snkAttachMessages,
|
363
|
-
snkPersonalizedFilter: snkPersonalizedFilterMessages
|
367
|
+
snkPersonalizedFilter: snkPersonalizedFilterMessages,
|
368
|
+
snkEntityList: snkEntityListMessages
|
364
369
|
};
|
365
370
|
this._currentOperation = OperationMap.CLEAN;
|
366
371
|
this._domainName = domainName;
|
@@ -0,0 +1,113 @@
|
|
1
|
+
import { F as FilterItemType } from './filter-item-type.enum.js';
|
2
|
+
import { R as ResourceFetcher } from './resource-fetcher.js';
|
3
|
+
|
4
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
5
|
+
var t = {};
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
7
|
+
t[p] = s[p];
|
8
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
9
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
10
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
11
|
+
t[p[i]] = s[p[i]];
|
12
|
+
}
|
13
|
+
return t;
|
14
|
+
};
|
15
|
+
function normalizeValue(value, type) {
|
16
|
+
if (value == undefined) {
|
17
|
+
return value;
|
18
|
+
}
|
19
|
+
if (value instanceof Date) {
|
20
|
+
return value.toISOString();
|
21
|
+
}
|
22
|
+
if (typeof value === "object") {
|
23
|
+
if (value instanceof Array) {
|
24
|
+
return value.map(item => {
|
25
|
+
if (FilterItemType.MULTI_LIST === type) {
|
26
|
+
const values = __rest(item, ["label"]);
|
27
|
+
return normalizeValue(values);
|
28
|
+
}
|
29
|
+
return normalizeValue(item);
|
30
|
+
});
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
const normalized = Object.assign({}, value);
|
34
|
+
Object.keys(value).forEach(prop => {
|
35
|
+
if (value[prop]) {
|
36
|
+
normalized[prop] = normalizeValue(value[prop], type);
|
37
|
+
}
|
38
|
+
else {
|
39
|
+
delete normalized[prop];
|
40
|
+
}
|
41
|
+
});
|
42
|
+
return normalized;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
return value;
|
46
|
+
}
|
47
|
+
class FilterBarConfigFetcher extends ResourceFetcher {
|
48
|
+
saveConfig(items, resourceID, configName) {
|
49
|
+
const state = items.map(item => {
|
50
|
+
const { id, value, fixed, visible, type } = item;
|
51
|
+
const stateItem = { id };
|
52
|
+
if (value) {
|
53
|
+
stateItem["value"] = normalizeValue(value, type);
|
54
|
+
}
|
55
|
+
if (fixed) {
|
56
|
+
stateItem["fixed"] = fixed;
|
57
|
+
}
|
58
|
+
if (visible) {
|
59
|
+
stateItem["visible"] = true;
|
60
|
+
}
|
61
|
+
return stateItem;
|
62
|
+
});
|
63
|
+
return this.saveResource(state, this.getPath(resourceID, configName));
|
64
|
+
}
|
65
|
+
getConfig(resourceID, configName) {
|
66
|
+
return new Promise((accept, reject) => {
|
67
|
+
this.loadResource(this.getPath(resourceID, configName))
|
68
|
+
.then((configAsString) => {
|
69
|
+
let fieldsList;
|
70
|
+
if (configAsString) {
|
71
|
+
const filterBarConfig = JSON.parse(configAsString);
|
72
|
+
fieldsList = filterBarConfig.items;
|
73
|
+
}
|
74
|
+
accept(fieldsList || []);
|
75
|
+
})
|
76
|
+
.catch((error) => {
|
77
|
+
reject(error);
|
78
|
+
});
|
79
|
+
});
|
80
|
+
}
|
81
|
+
saveEntityListConfig(item, resourceID, configName) {
|
82
|
+
return new Promise((accept, reject) => {
|
83
|
+
this.getConfig(resourceID, configName).then(config => {
|
84
|
+
const state = config.map(({ id, value, fixed, visible, type }) => {
|
85
|
+
return Object.assign(Object.assign(Object.assign({ id }, (value && { value: normalizeValue(value, type) })), (fixed && { fixed })), (visible && { visible: true }));
|
86
|
+
});
|
87
|
+
const index = state.findIndex(({ id }) => id === item.id);
|
88
|
+
const newItem = { id: item.id, value: normalizeValue(item.value, item.type), fixed: item.fixed, visible: true };
|
89
|
+
if (index > -1) {
|
90
|
+
state[index] = newItem;
|
91
|
+
}
|
92
|
+
else {
|
93
|
+
state.push(newItem);
|
94
|
+
}
|
95
|
+
this.saveResource(state, this.getPath(resourceID, configName)).then(resp => {
|
96
|
+
accept(resp);
|
97
|
+
}).catch(exception => {
|
98
|
+
reject(exception);
|
99
|
+
});
|
100
|
+
}).catch(exception => {
|
101
|
+
reject(exception);
|
102
|
+
});
|
103
|
+
});
|
104
|
+
}
|
105
|
+
getPath(resourceID, name) {
|
106
|
+
if (name) {
|
107
|
+
return `cfg://filter/FilterBarState:${resourceID}/${name}`;
|
108
|
+
}
|
109
|
+
return `cfg://filter/FilterBarState:${resourceID}`;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
export { FilterBarConfigFetcher as F };
|
@@ -1,68 +1,6 @@
|
|
1
1
|
import { d as dist, D as DataFetcher } from './DataFetcher.js';
|
2
2
|
import { ObjectUtils } from '@sankhyalabs/core';
|
3
|
-
|
4
|
-
class ResourceFetcher {
|
5
|
-
constructor() {
|
6
|
-
this.templateByQuery = new Map();
|
7
|
-
this.buldTemplates();
|
8
|
-
}
|
9
|
-
buldTemplates() {
|
10
|
-
this.templateByQuery.set("fetchResource", dist.gql `query($name: String!) {
|
11
|
-
$queryAlias$: fetchResource(name: $name){
|
12
|
-
resource
|
13
|
-
}
|
14
|
-
}`);
|
15
|
-
this.templateByQuery.set("saveResource", dist.gql `mutation($resource: InputResource!) {
|
16
|
-
$queryAlias$: saveResource(resource: $resource){
|
17
|
-
name
|
18
|
-
resource
|
19
|
-
}
|
20
|
-
}`);
|
21
|
-
}
|
22
|
-
loadResource(name) {
|
23
|
-
if (ResourceFetcher._loadingResource.has(name)) {
|
24
|
-
return ResourceFetcher._loadingResource.get(name);
|
25
|
-
}
|
26
|
-
const promiseLoadResource = new Promise((resolve, reject) => {
|
27
|
-
DataFetcher.get()
|
28
|
-
.callGraphQL({
|
29
|
-
values: { name },
|
30
|
-
query: this.templateByQuery.get("fetchResource"),
|
31
|
-
})
|
32
|
-
.then((result) => {
|
33
|
-
resolve(result === null || result === void 0 ? void 0 : result.resource);
|
34
|
-
ResourceFetcher._loadingResource.delete(name);
|
35
|
-
})
|
36
|
-
.catch((error) => {
|
37
|
-
reject(error);
|
38
|
-
ResourceFetcher._loadingResource.delete(name);
|
39
|
-
});
|
40
|
-
});
|
41
|
-
ResourceFetcher._loadingResource.set(name, promiseLoadResource);
|
42
|
-
return promiseLoadResource;
|
43
|
-
}
|
44
|
-
saveResource(resource, name) {
|
45
|
-
return new Promise((resolve, reject) => {
|
46
|
-
DataFetcher.get()
|
47
|
-
.callGraphQL({
|
48
|
-
values: {
|
49
|
-
resource: {
|
50
|
-
name: name,
|
51
|
-
resource: JSON.stringify(resource)
|
52
|
-
}
|
53
|
-
},
|
54
|
-
query: this.templateByQuery.get("saveResource")
|
55
|
-
})
|
56
|
-
.then((resp) => {
|
57
|
-
resolve(resp);
|
58
|
-
})
|
59
|
-
.catch((error) => {
|
60
|
-
reject(error);
|
61
|
-
});
|
62
|
-
});
|
63
|
-
}
|
64
|
-
}
|
65
|
-
ResourceFetcher._loadingResource = new Map();
|
3
|
+
import { R as ResourceFetcher } from './resource-fetcher.js';
|
66
4
|
|
67
5
|
class FormConfigFetcher extends ResourceFetcher {
|
68
6
|
constructor() {
|
@@ -238,4 +176,4 @@ var UserConfigType;
|
|
238
176
|
UserConfigType["SHARED"] = "SHARED";
|
239
177
|
})(UserConfigType || (UserConfigType = {}));
|
240
178
|
|
241
|
-
export { FormConfigFetcher as F,
|
179
|
+
export { FormConfigFetcher as F, UserConfigType as U };
|
@@ -7,6 +7,7 @@ export { SnkCrud as SnkCrud } from '../types/components/snk-crud/snk-crud';
|
|
7
7
|
export { SnkDataExporter as SnkDataExporter } from '../types/components/snk-data-exporter/snk-data-exporter';
|
8
8
|
export { SnkDataUnit as SnkDataUnit } from '../types/components/snk-data-unit/snk-data-unit';
|
9
9
|
export { SnkDetailView as SnkDetailView } from '../types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view';
|
10
|
+
export { SnkEntityList as SnkEntityList } from '../types/components/snk-entity-list/snk-entity-list';
|
10
11
|
export { SnkExporterEmailSender as SnkExporterEmailSender } from '../types/components/snk-data-exporter/exporter-email-sender/snk-exporter-email-sender';
|
11
12
|
export { SnkExpressionItem as SnkExpressionItem } from '../types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item';
|
12
13
|
export { SnkFieldConfig as SnkFieldConfig } from '../types/components/snk-form/subcomponents/snk-field-config/snk-field-config';
|
package/dist/components/index.js
CHANGED
@@ -7,6 +7,7 @@ export { SnkCrud, defineCustomElement as defineCustomElementSnkCrud } from './sn
|
|
7
7
|
export { SnkDataExporter, defineCustomElement as defineCustomElementSnkDataExporter } from './snk-data-exporter.js';
|
8
8
|
export { SnkDataUnit, defineCustomElement as defineCustomElementSnkDataUnit } from './snk-data-unit.js';
|
9
9
|
export { SnkDetailView, defineCustomElement as defineCustomElementSnkDetailView } from './snk-detail-view.js';
|
10
|
+
export { SnkEntityList, defineCustomElement as defineCustomElementSnkEntityList } from './snk-entity-list.js';
|
10
11
|
export { SnkExporterEmailSender, defineCustomElement as defineCustomElementSnkExporterEmailSender } from './snk-exporter-email-sender.js';
|
11
12
|
export { SnkExpressionItem, defineCustomElement as defineCustomElementSnkExpressionItem } from './snk-expression-item.js';
|
12
13
|
export { SnkFieldConfig, defineCustomElement as defineCustomElementSnkFieldConfig } from './snk-field-config.js';
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { d as dist, D as DataFetcher } from './DataFetcher.js';
|
2
|
+
|
3
|
+
class ResourceFetcher {
|
4
|
+
constructor() {
|
5
|
+
this.templateByQuery = new Map();
|
6
|
+
this.buldTemplates();
|
7
|
+
}
|
8
|
+
buldTemplates() {
|
9
|
+
this.templateByQuery.set("fetchResource", dist.gql `query($name: String!) {
|
10
|
+
$queryAlias$: fetchResource(name: $name){
|
11
|
+
resource
|
12
|
+
}
|
13
|
+
}`);
|
14
|
+
this.templateByQuery.set("saveResource", dist.gql `mutation($resource: InputResource!) {
|
15
|
+
$queryAlias$: saveResource(resource: $resource){
|
16
|
+
name
|
17
|
+
resource
|
18
|
+
}
|
19
|
+
}`);
|
20
|
+
}
|
21
|
+
loadResource(name) {
|
22
|
+
if (ResourceFetcher._loadingResource.has(name)) {
|
23
|
+
return ResourceFetcher._loadingResource.get(name);
|
24
|
+
}
|
25
|
+
const promiseLoadResource = new Promise((resolve, reject) => {
|
26
|
+
DataFetcher.get()
|
27
|
+
.callGraphQL({
|
28
|
+
values: { name },
|
29
|
+
query: this.templateByQuery.get("fetchResource"),
|
30
|
+
})
|
31
|
+
.then((result) => {
|
32
|
+
resolve(result === null || result === void 0 ? void 0 : result.resource);
|
33
|
+
ResourceFetcher._loadingResource.delete(name);
|
34
|
+
})
|
35
|
+
.catch((error) => {
|
36
|
+
reject(error);
|
37
|
+
ResourceFetcher._loadingResource.delete(name);
|
38
|
+
});
|
39
|
+
});
|
40
|
+
ResourceFetcher._loadingResource.set(name, promiseLoadResource);
|
41
|
+
return promiseLoadResource;
|
42
|
+
}
|
43
|
+
saveResource(resource, name) {
|
44
|
+
return new Promise((resolve, reject) => {
|
45
|
+
DataFetcher.get()
|
46
|
+
.callGraphQL({
|
47
|
+
values: {
|
48
|
+
resource: {
|
49
|
+
name: name,
|
50
|
+
resource: JSON.stringify(resource)
|
51
|
+
}
|
52
|
+
},
|
53
|
+
query: this.templateByQuery.get("saveResource")
|
54
|
+
})
|
55
|
+
.then((resp) => {
|
56
|
+
resolve(resp);
|
57
|
+
})
|
58
|
+
.catch((error) => {
|
59
|
+
reject(error);
|
60
|
+
});
|
61
|
+
});
|
62
|
+
}
|
63
|
+
}
|
64
|
+
ResourceFetcher._loadingResource = new Map();
|
65
|
+
|
66
|
+
export { ResourceFetcher as R };
|
@@ -5,7 +5,7 @@ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
|
5
5
|
import { P as PesquisaFetcher } from './pesquisa-fetcher.js';
|
6
6
|
import { G as GridConfigFetcher, C as ConfigStorage } from './ConfigStorage.js';
|
7
7
|
import { D as DataUnitFetcher } from './dataunit-fetcher.js';
|
8
|
-
import { R as ResourceFetcher } from './
|
8
|
+
import { R as ResourceFetcher } from './resource-fetcher.js';
|
9
9
|
import { S as SnkMessageBuilder } from './SnkMessageBuilder.js';
|
10
10
|
import { d as defineCustomElement$1 } from './snk-pesquisa2.js';
|
11
11
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
2
|
+
|
3
|
+
interface SnkEntityList extends Components.SnkEntityList, HTMLElement {}
|
4
|
+
export const SnkEntityList: {
|
5
|
+
prototype: SnkEntityList;
|
6
|
+
new (): SnkEntityList;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* Used to define this component and all nested components recursively.
|
10
|
+
*/
|
11
|
+
export const defineCustomElement: () => void;
|
@@ -0,0 +1,131 @@
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
2
|
+
import { ApplicationContext } from '@sankhyalabs/core';
|
3
|
+
|
4
|
+
const snkEntityListCss = ".sc-snk-entity-list-h{--snk-entity-list--label--font-size:var(--text--medium, 14px);--snk-entity-list--label--font-family:var(--font-pattern, Arial);--snk-entity-list--label--color:var(--title--primary, #000);--snk-entity-list--label--disabled--color:var(--text--disable, #AFB6C0)}.label.sc-snk-entity-list{flex-shrink:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--snk-entity-list--label--color);font-size:var(--snk-entity-list--label--font-size);font-family:var(--snk-entity-list--label--font-family);cursor:default;padding-left:var(--space--small);padding-bottom:var(--space--extra-small)}.snk-entity-list--overflow.sc-snk-entity-list{overflow:auto}.snk-entity-list--overflow.sc-snk-entity-list::-webkit-scrollbar{width:var(--space--small);min-width:var(--space--small);max-width:var(--space--small)}";
|
5
|
+
|
6
|
+
const SnkEntityList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
7
|
+
constructor() {
|
8
|
+
super();
|
9
|
+
this.__registerHost();
|
10
|
+
this.valueChanged = createEvent(this, "valueChanged", 7);
|
11
|
+
this.saveConfig = createEvent(this, "saveConfig", 7);
|
12
|
+
this._searchValue = undefined;
|
13
|
+
this._ezListSource = [];
|
14
|
+
this.config = undefined;
|
15
|
+
this.rightListSlotBuilder = undefined;
|
16
|
+
this.maxHeightList = "";
|
17
|
+
}
|
18
|
+
async reloadList() {
|
19
|
+
this.loadListSource();
|
20
|
+
this.saveConfig.emit(this.config);
|
21
|
+
}
|
22
|
+
observeConfig() {
|
23
|
+
var _a, _b;
|
24
|
+
(_b = (_a = this._searchElement) === null || _a === void 0 ? void 0 : _a['clearValue']) === null || _b === void 0 ? void 0 : _b.call(_a);
|
25
|
+
}
|
26
|
+
ezListChangeListener(evt) {
|
27
|
+
var _a, _b, _c, _d;
|
28
|
+
(_c = ((_a = this.config.value) !== null && _a !== void 0 ? _a : (_b = this.config.value) === null || _b === void 0 ? void 0 : _b.elements)) === null || _c === void 0 ? void 0 : _c.forEach(value => {
|
29
|
+
var _a, _b;
|
30
|
+
if (value && value.id === ((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.id)) {
|
31
|
+
value.check = (_b = evt.detail) === null || _b === void 0 ? void 0 : _b.check;
|
32
|
+
}
|
33
|
+
});
|
34
|
+
this.saveConfig.emit(this.config);
|
35
|
+
this.valueChanged.emit((_d = this.config) === null || _d === void 0 ? void 0 : _d.value);
|
36
|
+
}
|
37
|
+
loadListSource() {
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
39
|
+
this._ezListSource = [];
|
40
|
+
(_h = ((_e = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : (_d = (_c = this.config) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.elements) !== null && _e !== void 0 ? _e : (_g = (_f = this.config) === null || _f === void 0 ? void 0 : _f.value) === null || _g === void 0 ? void 0 : _g.members)) === null || _h === void 0 ? void 0 : _h.forEach(value => {
|
41
|
+
if (value) {
|
42
|
+
this._ezListSource.push({
|
43
|
+
label: `${value.id} - ${value.label}`,
|
44
|
+
check: value.check,
|
45
|
+
id: value.id
|
46
|
+
});
|
47
|
+
}
|
48
|
+
});
|
49
|
+
}
|
50
|
+
componentDidLoad() {
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
52
|
+
let configValue = (_f = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.elements) !== null && _c !== void 0 ? _c : (_e = (_d = this.config) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.members) !== null && _f !== void 0 ? _f : (_g = this.config) === null || _g === void 0 ? void 0 : _g.value;
|
53
|
+
let configValueArray = [];
|
54
|
+
if (Array.isArray(configValue)) {
|
55
|
+
configValueArray = configValue;
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
configValueArray.push((_j = (_h = this.config) === null || _h === void 0 ? void 0 : _h.value) === null || _j === void 0 ? void 0 : _j.members);
|
59
|
+
}
|
60
|
+
this.config.value = configValueArray;
|
61
|
+
this._entityName = (_m = (_l = (_k = this.config) === null || _k === void 0 ? void 0 : _k.props) === null || _l === void 0 ? void 0 : _l.searchContext) === null || _m === void 0 ? void 0 : _m.entity;
|
62
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
63
|
+
this.loadListSource();
|
64
|
+
}
|
65
|
+
optionLoader({ mode, argument }) {
|
66
|
+
var _a, _b, _c, _d;
|
67
|
+
if (this._application === undefined) {
|
68
|
+
return;
|
69
|
+
}
|
70
|
+
const searchOptions = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.searchContext) === null || _c === void 0 ? void 0 : _c.searchOptions;
|
71
|
+
const options = {
|
72
|
+
entityDescription: (_d = this.config) === null || _d === void 0 ? void 0 : _d.label,
|
73
|
+
entity: this._entityName,
|
74
|
+
searchOptions: searchOptions
|
75
|
+
};
|
76
|
+
return this._application.executePreparedSearch(mode, argument, options);
|
77
|
+
}
|
78
|
+
onEzSearchChange(evt) {
|
79
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
80
|
+
if (evt.detail != undefined && ((_e = ((_c = (_a = this.config.value) !== null && _a !== void 0 ? _a : (_b = this.config.value) === null || _b === void 0 ? void 0 : _b.elements) !== null && _c !== void 0 ? _c : (_d = this.config.value) === null || _d === void 0 ? void 0 : _d.members)) === null || _e === void 0 ? void 0 : _e.find(i => { var _a; return (i === null || i === void 0 ? void 0 : i.id) == ((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.value); })) === undefined) {
|
81
|
+
this.config = Object.assign(Object.assign({}, this.config), { value: [
|
82
|
+
...((_g = (_f = this.config) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : []),
|
83
|
+
{
|
84
|
+
id: evt.detail.value,
|
85
|
+
check: true,
|
86
|
+
label: evt.detail.label
|
87
|
+
}
|
88
|
+
] });
|
89
|
+
this.loadListSource();
|
90
|
+
this.saveConfig.emit(this.config);
|
91
|
+
this.valueChanged.emit((_h = this.config) === null || _h === void 0 ? void 0 : _h.value);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
getMessage(key, params) {
|
95
|
+
var _a;
|
96
|
+
return (_a = this._application) === null || _a === void 0 ? void 0 : _a.messagesBuilder.getMessage(key, params);
|
97
|
+
}
|
98
|
+
render() {
|
99
|
+
var _a;
|
100
|
+
return (h(Host, null, h("ez-search", { ref: elem => this._searchElement = elem, optionLoader: argument => this.optionLoader(argument), value: this._searchValue, label: (_a = this.config) === null || _a === void 0 ? void 0 : _a.label, onEzChange: evt => this.onEzSearchChange(evt) }), h("label", { class: "label" }, this.getMessage("snkEntityList.selected")), h("div", { style: this.maxHeightList ? { 'max-height': this.maxHeightList } : {}, class: { "snk-entity-list--overflow": !!this.maxHeightList } }, h("ez-list", { ref: (el) => this._ezList = el, id: "snkEntityList", listMode: "check", dataSource: this._ezListSource, hoverFeedback: true, itemSlotBuilder: this.rightListSlotBuilder, onEzCheckChange: evt => this.ezListChangeListener(evt) }))));
|
101
|
+
}
|
102
|
+
static get watchers() { return {
|
103
|
+
"config": ["observeConfig"]
|
104
|
+
}; }
|
105
|
+
static get style() { return snkEntityListCss; }
|
106
|
+
}, [2, "snk-entity-list", {
|
107
|
+
"config": [1040],
|
108
|
+
"rightListSlotBuilder": [1040],
|
109
|
+
"maxHeightList": [1, "max-height-list"],
|
110
|
+
"_searchValue": [32],
|
111
|
+
"_ezListSource": [32],
|
112
|
+
"reloadList": [64]
|
113
|
+
}]);
|
114
|
+
function defineCustomElement$1() {
|
115
|
+
if (typeof customElements === "undefined") {
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
const components = ["snk-entity-list"];
|
119
|
+
components.forEach(tagName => { switch (tagName) {
|
120
|
+
case "snk-entity-list":
|
121
|
+
if (!customElements.get(tagName)) {
|
122
|
+
customElements.define(tagName, SnkEntityList$1);
|
123
|
+
}
|
124
|
+
break;
|
125
|
+
} });
|
126
|
+
}
|
127
|
+
|
128
|
+
const SnkEntityList = SnkEntityList$1;
|
129
|
+
const defineCustomElement = defineCustomElement$1;
|
130
|
+
|
131
|
+
export { SnkEntityList, defineCustomElement };
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, Host } from '@stencil/core/internal/client';
|
2
2
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
3
3
|
import { F as FilterItemType } from './filter-item-type.enum.js';
|
4
|
-
import { ElementIDUtils, DataType } from '@sankhyalabs/core';
|
4
|
+
import { ApplicationContext, ElementIDUtils, DataType } from '@sankhyalabs/core';
|
5
|
+
import { F as FilterBarConfigFetcher } from './filter-bar-config-fetcher.js';
|
5
6
|
|
6
7
|
const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
7
8
|
constructor() {
|
@@ -16,10 +17,15 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
16
17
|
*/
|
17
18
|
async show() {
|
18
19
|
var _a, _b;
|
19
|
-
(_b = (_a = this._editor)["show"]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
20
|
+
(_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a["show"]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
21
|
+
}
|
22
|
+
observeConfig() {
|
23
|
+
var _a, _b;
|
24
|
+
(_b = (_a = this._editor) === null || _a === void 0 ? void 0 : _a["reloadList"]) === null || _b === void 0 ? void 0 : _b.call(_a);
|
20
25
|
}
|
21
26
|
componentDidLoad() {
|
22
27
|
if (this._element) {
|
28
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
23
29
|
ElementIDUtils.addIDInfo(this._element);
|
24
30
|
const dataElementIdDoFilterItem = this._element.getAttribute(ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME);
|
25
31
|
this._idContentEditor = `${dataElementIdDoFilterItem}_${this.config.id}`;
|
@@ -42,6 +48,8 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
42
48
|
return "snk-filter-number";
|
43
49
|
case FilterItemType.PERSONALIZED:
|
44
50
|
return "snk-filter-personalized";
|
51
|
+
case FilterItemType.MULTI_LIST:
|
52
|
+
return "snk-entity-list";
|
45
53
|
}
|
46
54
|
return "snk-filter-text";
|
47
55
|
}
|
@@ -112,18 +120,48 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
112
120
|
}
|
113
121
|
/* WARNING: Temporário.*/
|
114
122
|
clear() {
|
115
|
-
|
123
|
+
var _a, _b;
|
124
|
+
if (FilterItemType.MULTI_LIST === this.config.type) {
|
125
|
+
(_a = this.config.value) === null || _a === void 0 ? void 0 : _a.forEach(value => {
|
126
|
+
if (!!value)
|
127
|
+
value.check = false;
|
128
|
+
});
|
129
|
+
(_b = this._editor) === null || _b === void 0 ? void 0 : _b['reloadList']();
|
130
|
+
}
|
131
|
+
else {
|
132
|
+
this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
|
133
|
+
}
|
116
134
|
}
|
117
135
|
onKeyDonwListener(event) {
|
118
136
|
if (event.key === "Enter") {
|
119
137
|
this._applyButton.setFocus().then(() => this.apply());
|
120
138
|
}
|
121
139
|
}
|
140
|
+
buildRightSlot(item) {
|
141
|
+
return h("ez-icon", { iconName: "delete", onClick: () => this.removeValueFromConfig(item) });
|
142
|
+
}
|
143
|
+
removeValueFromConfig(item) {
|
144
|
+
var _a, _b, _c, _d, _e, _f;
|
145
|
+
const index = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.findIndex(i => (i === null || i === void 0 ? void 0 : i.id) === item.id);
|
146
|
+
(_d = (_c = this.config) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.splice(index, 1);
|
147
|
+
(_f = (_e = this._editor) === null || _e === void 0 ? void 0 : _e["reloadList"]) === null || _f === void 0 ? void 0 : _f.call(_e);
|
148
|
+
}
|
149
|
+
saveConfig(newConfig) {
|
150
|
+
var _a;
|
151
|
+
(_a = this._application) === null || _a === void 0 ? void 0 : _a.getResourceID().then(resourceId => {
|
152
|
+
const fetcher = new FilterBarConfigFetcher();
|
153
|
+
fetcher.saveEntityListConfig(newConfig, resourceId, this._application.configName);
|
154
|
+
this.config = newConfig;
|
155
|
+
});
|
156
|
+
}
|
122
157
|
render() {
|
123
158
|
const ContentEditor = this.getContentEditor();
|
124
|
-
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
|
159
|
+
return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { maxHeightList: '240px', ref: ref => this._editor = ref, value: this.config.value, config: this.config, onKeyDown: evt => this.onKeyDonwListener(evt), "data-element-id": this._idContentEditor, getMessage: this.getMessage, onSaveConfig: evt => this.saveConfig(evt.detail), rightListSlotBuilder: item => this.buildRightSlot(item) }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { ref: ref => this._applyButton = ref, label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
|
125
160
|
}
|
126
161
|
get _element() { return this; }
|
162
|
+
static get watchers() { return {
|
163
|
+
"config": ["observeConfig"]
|
164
|
+
}; }
|
127
165
|
}, [0, "snk-filter-detail", {
|
128
166
|
"config": [1040],
|
129
167
|
"getMessage": [16],
|
@@ -117,6 +117,7 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
117
117
|
}
|
118
118
|
}
|
119
119
|
getLabel(isTooltipLabel = false) {
|
120
|
+
var _a;
|
120
121
|
const { type, value, label, props } = this.config;
|
121
122
|
if (value) {
|
122
123
|
if (type === FilterItemType.BINARY_SELECT) {
|
@@ -173,16 +174,19 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
173
174
|
return label;
|
174
175
|
}
|
175
176
|
if (type === FilterItemType.MULTI_LIST) {
|
176
|
-
const selectedOptions = value.filter(item => item.check);
|
177
|
+
const selectedOptions = ((_a = value.elements) !== null && _a !== void 0 ? _a : value).filter(item => item === null || item === void 0 ? void 0 : item.check);
|
177
178
|
const checkedAmount = selectedOptions.length;
|
179
|
+
if (checkedAmount === 0) {
|
180
|
+
return `${label}`;
|
181
|
+
}
|
178
182
|
if (checkedAmount > 1) {
|
179
183
|
if (isTooltipLabel) {
|
180
|
-
const selectedOptionsDescrptions = selectedOptions.map(item => item.
|
184
|
+
const selectedOptionsDescrptions = selectedOptions.map(item => item.label);
|
181
185
|
return `${label}: ${selectedOptionsDescrptions.join(',')}`;
|
182
186
|
}
|
183
187
|
return `${label}: ${checkedAmount} ${this.getMessage('snkFilterBar.multiListToltip')}`;
|
184
188
|
}
|
185
|
-
return `${label}: ${
|
189
|
+
return `${label}: ${selectedOptions[0].label}`;
|
186
190
|
}
|
187
191
|
return `${label}: ${value}`;
|
188
192
|
}
|
@@ -232,8 +236,9 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
232
236
|
return undefined;
|
233
237
|
}
|
234
238
|
render() {
|
239
|
+
var _a, _b, _c, _d;
|
235
240
|
const leftIcon = this.getLeftIconName();
|
236
|
-
return (h(Host, Object.assign({}, this.applyTooltip()), h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
|
241
|
+
return (h(Host, Object.assign({}, this.applyTooltip()), h("ez-chip", { id: this.config.id, ref: ref => this._chipElement = ref, label: this.getLabel(), value: (FilterItemType.MULTI_LIST != this.config.type && this.config.value != undefined) || (((_d = (_c = ((_b = (_a = this.config.value) === null || _a === void 0 ? void 0 : _a.elements) !== null && _b !== void 0 ? _b : this.config.value)) === null || _c === void 0 ? void 0 : _c.filter(value => value === null || value === void 0 ? void 0 : value.check)) === null || _d === void 0 ? void 0 : _d.length) > 0) }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon", id: "removeFilter" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id, "data-element-id": this._idSnkFilterDetail }))));
|
237
242
|
}
|
238
243
|
get _filterItemElement() { return this; }
|
239
244
|
static get watchers() { return {
|