@sankhyalabs/sankhyablocks 8.9.4 → 8.10.0-dev.1
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-90552fe8.js → ConfigStorage-0d507a8f.js} +3 -3
- package/dist/cjs/{DataFetcher-1b1e9ff0.js → DataFetcher-ba94ed5b.js} +22 -18
- package/dist/cjs/{PersonalizedFilterUtils-2f7823fc.js → PersonalizedFilterUtils-0184ffbb.js} +1 -1
- package/dist/cjs/{SnkFormConfigManager-0561602d.js → SnkFormConfigManager-906ee5f7.js} +2 -2
- package/dist/cjs/{auth-fetcher-eee6ec18.js → auth-fetcher-c8467c07.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-38233d72.js → dataunit-fetcher-529a3866.js} +1 -1
- package/dist/cjs/{filter-item-type.enum-aa823a00.js → filter-item-type.enum-a7ffdaa6.js} +1 -0
- package/dist/cjs/{form-config-fetcher-00372ac0.js → form-config-fetcher-df043d3d.js} +1 -1
- package/dist/cjs/index-f9e81701.js +4 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-8bc6d0a5.js → pesquisa-fetcher-ef050a47.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button.cjs.entry.js +5 -5
- package/dist/cjs/snk-application.cjs.entry.js +43 -8
- package/dist/cjs/snk-attach.cjs.entry.js +3 -3
- package/dist/cjs/snk-crud.cjs.entry.js +77 -13
- package/dist/cjs/snk-data-exporter.cjs.entry.js +3 -3
- package/dist/cjs/{snk-data-unit-b949160d.js → snk-data-unit-04d76538.js} +1 -1
- package/dist/cjs/snk-data-unit.cjs.entry.js +1 -1
- package/dist/cjs/snk-detail-view.cjs.entry.js +8 -8
- package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-bar.cjs.entry.js +30 -7
- package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +52 -0
- package/dist/cjs/snk-filter-detail.cjs.entry.js +9 -2
- package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +2 -2
- package/dist/cjs/snk-filter-item.cjs.entry.js +25 -14
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +8 -6
- package/dist/cjs/snk-filter-modal.cjs.entry.js +16 -5
- package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-search.cjs.entry.js +1 -1
- package/dist/cjs/snk-form-config.cjs.entry.js +3 -3
- package/dist/cjs/snk-form.cjs.entry.js +6 -6
- package/dist/cjs/snk-grid-config.cjs.entry.js +5 -5
- package/dist/cjs/snk-grid.cjs.entry.js +4 -4
- package/dist/cjs/{snk-guides-viewer-676dd526.js → snk-guides-viewer-5b82abc4.js} +6 -6
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +9 -9
- package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +6 -6
- package/dist/cjs/snk-simple-crud.cjs.entry.js +5 -5
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/snk-application/snk-application.js +47 -1
- package/dist/collection/components/snk-crud/snk-crud.js +71 -7
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +1 -1
- package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +19 -0
- package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.js +95 -0
- package/dist/collection/components/snk-filter-bar/filter-item/filter-item-type.enum.js +1 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +7 -0
- package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +24 -13
- package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +14 -3
- package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-filter-modal-item.js +3 -1
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +5 -1
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +9 -5
- package/dist/collection/lib/workspace/workspace.js +12 -0
- package/dist/components/DataFetcher.js +22 -18
- package/dist/components/filter-item-type.enum.js +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/snk-application2.js +37 -1
- package/dist/components/snk-crud.js +71 -7
- package/dist/components/snk-data-unit2.js +1 -1
- package/dist/components/snk-filter-bar2.js +24 -1
- package/dist/components/snk-filter-checkbox-list.d.ts +11 -0
- package/dist/components/snk-filter-checkbox-list.js +68 -0
- package/dist/components/snk-filter-detail2.js +7 -0
- package/dist/components/snk-filter-item2.js +24 -13
- package/dist/components/snk-filter-modal-item2.js +3 -1
- package/dist/components/snk-filter-modal.js +14 -3
- package/dist/esm/{ConfigStorage-84abda58.js → ConfigStorage-379a9cba.js} +3 -3
- package/dist/esm/{DataFetcher-7814568f.js → DataFetcher-aa159c5a.js} +22 -18
- package/dist/esm/{PersonalizedFilterUtils-49a5dcb7.js → PersonalizedFilterUtils-e2b38ef7.js} +1 -1
- package/dist/esm/{SnkFormConfigManager-655943d0.js → SnkFormConfigManager-8aedc650.js} +2 -2
- package/dist/esm/{auth-fetcher-06354710.js → auth-fetcher-c05dc474.js} +1 -1
- package/dist/esm/{dataunit-fetcher-aa70ea72.js → dataunit-fetcher-fd329839.js} +1 -1
- package/dist/esm/{filter-item-type.enum-5028ed3f.js → filter-item-type.enum-d45e026f.js} +1 -0
- package/dist/esm/{form-config-fetcher-24f43afd.js → form-config-fetcher-36219cd3.js} +1 -1
- package/dist/esm/index-a7d3d3f1.js +4 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-f7aaf727.js → pesquisa-fetcher-dd3ca0a5.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button.entry.js +5 -5
- package/dist/esm/snk-application.entry.js +44 -9
- package/dist/esm/snk-attach.entry.js +3 -3
- package/dist/esm/snk-crud.entry.js +77 -13
- package/dist/esm/snk-data-exporter.entry.js +3 -3
- package/dist/esm/{snk-data-unit-ca945bf5.js → snk-data-unit-ad5cf70c.js} +1 -1
- package/dist/esm/snk-data-unit.entry.js +1 -1
- package/dist/esm/snk-detail-view.entry.js +8 -8
- package/dist/esm/snk-filter-advanced-mode_2.entry.js +2 -2
- package/dist/esm/snk-filter-bar.entry.js +30 -7
- package/dist/esm/snk-filter-binary-select.entry.js +1 -1
- package/dist/esm/snk-filter-checkbox-list.entry.js +48 -0
- package/dist/esm/snk-filter-detail.entry.js +9 -2
- package/dist/esm/snk-filter-field-search_2.entry.js +2 -2
- package/dist/esm/snk-filter-item.entry.js +25 -14
- package/dist/esm/snk-filter-modal-item.entry.js +8 -6
- package/dist/esm/snk-filter-modal.entry.js +16 -5
- package/dist/esm/snk-filter-multi-select.entry.js +1 -1
- package/dist/esm/snk-filter-number.entry.js +1 -1
- package/dist/esm/snk-filter-period.entry.js +1 -1
- package/dist/esm/snk-filter-search.entry.js +1 -1
- package/dist/esm/snk-form-config.entry.js +3 -3
- package/dist/esm/snk-form.entry.js +6 -6
- package/dist/esm/snk-grid-config.entry.js +5 -5
- package/dist/esm/snk-grid.entry.js +4 -4
- package/dist/esm/{snk-guides-viewer-746e2547.js → snk-guides-viewer-f68589c4.js} +6 -6
- package/dist/esm/snk-guides-viewer.entry.js +9 -9
- package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
- package/dist/esm/snk-personalized-filter.entry.js +6 -6
- package/dist/esm/snk-simple-crud.entry.js +5 -5
- package/dist/sankhyablocks/{p-29529c8f.entry.js → p-01ba23cd.entry.js} +1 -1
- package/dist/sankhyablocks/{p-43b2aad5.js → p-057fad05.js} +1 -1
- package/dist/sankhyablocks/{p-e47d966c.js → p-0d7863ed.js} +1 -1
- package/dist/sankhyablocks/p-152f0949.entry.js +1 -0
- package/dist/sankhyablocks/{p-c6800fd4.entry.js → p-16eaa54b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-cb37982f.entry.js → p-20726710.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c78a80ae.entry.js → p-3ab6df3d.entry.js} +1 -1
- package/dist/sankhyablocks/{p-ee49df44.js → p-3af0a81e.js} +1 -1
- package/dist/sankhyablocks/{p-eb636e15.entry.js → p-41f8bfa3.entry.js} +1 -1
- package/dist/sankhyablocks/{p-a9b6acf1.js → p-4396d1a6.js} +1 -1
- package/dist/sankhyablocks/p-4b0ea83f.entry.js +1 -0
- package/dist/sankhyablocks/{p-d7665a57.entry.js → p-5de077f3.entry.js} +1 -1
- package/dist/sankhyablocks/p-6977a26c.entry.js +1 -0
- package/dist/sankhyablocks/{p-b54e06ca.js → p-74545be0.js} +1 -1
- package/dist/sankhyablocks/p-787edf13.entry.js +1 -0
- package/dist/sankhyablocks/{p-fc257290.entry.js → p-7e2ded86.entry.js} +1 -1
- package/dist/sankhyablocks/{p-c0931902.entry.js → p-8002dcd0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-809a09ac.entry.js → p-86b9846a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-88039a7f.js → p-9695f78b.js} +1 -1
- package/dist/sankhyablocks/p-9be1dfd5.entry.js +1 -0
- package/dist/sankhyablocks/p-a037f5b4.entry.js +1 -0
- package/dist/sankhyablocks/{p-718ecd01.entry.js → p-a2bd1825.entry.js} +1 -1
- package/dist/sankhyablocks/{p-8f307ef2.entry.js → p-aaa1438e.entry.js} +1 -1
- package/dist/sankhyablocks/p-aaa3ee68.entry.js +1 -0
- package/dist/sankhyablocks/{p-6e32de4b.entry.js → p-b542061a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-5eb3ac18.js → p-bceed094.js} +1 -1
- package/dist/sankhyablocks/{p-a3fbded7.entry.js → p-c259545b.entry.js} +1 -1
- package/dist/sankhyablocks/{p-26ad62b9.entry.js → p-c758265f.entry.js} +1 -1
- package/dist/sankhyablocks/{p-fe49067d.entry.js → p-c8622597.entry.js} +1 -1
- package/dist/sankhyablocks/p-c8b1ebf1.entry.js +11 -0
- package/dist/sankhyablocks/{p-a3868fbc.entry.js → p-cb7419e0.entry.js} +1 -1
- package/dist/sankhyablocks/{p-210b4794.js → p-cd2a285d.js} +1 -1
- package/dist/sankhyablocks/{p-0d5e8a37.entry.js → p-cea081b7.entry.js} +1 -1
- package/dist/sankhyablocks/p-d1677df0.entry.js +1 -0
- package/dist/sankhyablocks/p-d6317851.entry.js +1 -0
- package/dist/sankhyablocks/{p-e38f28ae.js → p-d9bb09b3.js} +2 -2
- package/dist/sankhyablocks/{p-1a991d41.entry.js → p-dc7412bf.entry.js} +1 -1
- package/dist/sankhyablocks/{p-3f0fe056.js → p-e6380c60.js} +1 -1
- package/dist/sankhyablocks/{p-584d7212.js → p-ff1990ad.js} +1 -1
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +10 -1
- package/dist/types/components/snk-crud/snk-crud.d.ts +6 -0
- package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list.d.ts +27 -0
- package/dist/types/components/snk-filter-bar/filter-item/filter-item-type.enum.d.ts +2 -1
- package/dist/types/components/snk-filter-bar/filter-item/snk-filter-item.d.ts +2 -0
- package/dist/types/components.d.ts +35 -1
- package/dist/types/lib/workspace/workspace.d.ts +3 -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-1ae31937.entry.js +0 -1
- package/dist/sankhyablocks/p-25df73bf.entry.js +0 -1
- package/dist/sankhyablocks/p-2640ba03.entry.js +0 -1
- package/dist/sankhyablocks/p-993e27ad.entry.js +0 -1
- package/dist/sankhyablocks/p-a4401f5f.entry.js +0 -1
- package/dist/sankhyablocks/p-c606c748.entry.js +0 -1
- package/dist/sankhyablocks/p-cd024328.entry.js +0 -1
- package/dist/sankhyablocks/p-d4c72815.entry.js +0 -1
- package/dist/sankhyablocks/p-f3479d53.entry.js +0 -11
@@ -31,6 +31,8 @@ export class SnkFilterModalItem {
|
|
31
31
|
return { tag: "snk-filter-number", props };
|
32
32
|
case FilterItemType.PERSONALIZED:
|
33
33
|
return this.buildSnkFilterPersonalizedProps();
|
34
|
+
case FilterItemType.CHECK_BOX_LIST:
|
35
|
+
return { tag: "snk-filter-checkbox-list", props };
|
34
36
|
case FilterItemType.MULTI_LIST:
|
35
37
|
return { tag: "snk-entity-list", props: { maxHeightList: "640px", rightListSlotBuilder: item => this.buildRightSlot(item) } };
|
36
38
|
}
|
@@ -54,7 +56,7 @@ export class SnkFilterModalItem {
|
|
54
56
|
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { visible: newValue > 0, value: newValue, groupedItems: data.items });
|
55
57
|
}
|
56
58
|
else {
|
57
|
-
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === FilterItemType.SEARCH ? data : newValue, visible: this.isVisible(newValue) });
|
59
|
+
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === (FilterItemType.SEARCH || FilterItemType.CHECK_BOX_LIST) ? data : newValue, visible: this.isVisible(newValue) });
|
58
60
|
}
|
59
61
|
}
|
60
62
|
handleDeleteFilter(filter, filterItemType) {
|
@@ -311,8 +311,12 @@ export class SnkFilterBar {
|
|
311
311
|
const callbackOnApplyFilter = (filters) => {
|
312
312
|
this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
|
313
313
|
};
|
314
|
+
let filtersConfigCopy = ObjectUtils.copy(this.filterConfig);
|
315
|
+
filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
|
316
|
+
return itemA.originOrder - itemB.originOrder;
|
317
|
+
});
|
314
318
|
const factoryParams = {
|
315
|
-
filterConfig:
|
319
|
+
filterConfig: filtersConfigCopy,
|
316
320
|
configName: this.configName,
|
317
321
|
onComplete: callbackOnApplyFilter,
|
318
322
|
getMessage: (key, props) => this.getMessage(key, props),
|
@@ -6,12 +6,12 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
6
6
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
7
7
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
8
8
|
};
|
9
|
-
import { ApplicationContext, ErrorException, ObjectUtils,
|
9
|
+
import { ApplicationContext, ErrorException, ObjectUtils, StringUtils, WarningException } from '@sankhyalabs/core';
|
10
10
|
import { batchRequests } from 'graphql-request';
|
11
11
|
import UrlUtils from "../../../lib/utils/urlutils";
|
12
|
-
import { ServiceBrokerRecaller } from './recaller/ServiceBrokerRecaller';
|
13
|
-
import { GraphQLRecaller } from './recaller/GraphQLRecaller';
|
14
12
|
import { PrintUtils } from '../../utils/PrintUtils';
|
13
|
+
import { GraphQLRecaller } from './recaller/GraphQLRecaller';
|
14
|
+
import { ServiceBrokerRecaller } from './recaller/ServiceBrokerRecaller';
|
15
15
|
export class DataFetcher {
|
16
16
|
constructor() {
|
17
17
|
this.ready = true;
|
@@ -361,9 +361,13 @@ export class DataFetcher {
|
|
361
361
|
const { data: dataResponse, errors: errorsResponse, extensions } = response;
|
362
362
|
//Reject promises with errors from query
|
363
363
|
errorsResponse.forEach((errorResponse) => {
|
364
|
-
Object.entries(errorResponse).forEach(([
|
364
|
+
Object.entries(errorResponse).forEach(async ([key, val]) => {
|
365
365
|
var _a;
|
366
|
-
|
366
|
+
const waitingRequest = watingRequestsById.get(val.request.variables[val.index].queryID);
|
367
|
+
const hasClientEvent = await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
|
368
|
+
if (!hasClientEvent) {
|
369
|
+
(((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
|
370
|
+
}
|
367
371
|
});
|
368
372
|
});
|
369
373
|
//Resolve promises with data from query
|
@@ -23,6 +23,18 @@ export default class Workspace {
|
|
23
23
|
var _a;
|
24
24
|
(_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.setScreenToUseOldLayout();
|
25
25
|
}
|
26
|
+
static showDesktop() {
|
27
|
+
var _a, _b;
|
28
|
+
(_b = (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.showDesktop) === null || _b === void 0 ? void 0 : _b.call(_a);
|
29
|
+
}
|
30
|
+
static searchApp() {
|
31
|
+
var _a, _b;
|
32
|
+
(_b = (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.searchApp) === null || _b === void 0 ? void 0 : _b.call(_a);
|
33
|
+
}
|
34
|
+
static openHelp() {
|
35
|
+
var _a, _b;
|
36
|
+
(_b = (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.openHelp) === null || _b === void 0 ? void 0 : _b.call(_a);
|
37
|
+
}
|
26
38
|
static applicationClick() {
|
27
39
|
var _a, _b;
|
28
40
|
if (!((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.applicationClick)) {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { DataType, ApplicationContext, StringUtils, ErrorException, WarningException, ObjectUtils } from '@sankhyalabs/core';
|
2
|
-
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
3
2
|
import { P as PrintUtils } from './PrintUtils.js';
|
3
|
+
import { DataUnitTransient } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
|
4
4
|
|
5
5
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
6
6
|
|
@@ -6487,21 +6487,6 @@ class UrlUtils {
|
|
6487
6487
|
}
|
6488
6488
|
}
|
6489
6489
|
|
6490
|
-
class ServiceBrokerRecaller {
|
6491
|
-
constructor(serviceName, requestBody, successCallback, errorCallback) {
|
6492
|
-
this.serviceName = serviceName;
|
6493
|
-
this.requestBody = requestBody;
|
6494
|
-
this.successCallback = successCallback;
|
6495
|
-
this.errorCallback = errorCallback;
|
6496
|
-
}
|
6497
|
-
reCall(requestBody) {
|
6498
|
-
if (requestBody) {
|
6499
|
-
this.requestBody = requestBody;
|
6500
|
-
}
|
6501
|
-
return DataFetcher.get().callServiceBroker(this.serviceName, this.requestBody).then(this.successCallback, this.errorCallback);
|
6502
|
-
}
|
6503
|
-
}
|
6504
|
-
|
6505
6490
|
class GraphQLRecaller {
|
6506
6491
|
constructor(req, resolve, reject) {
|
6507
6492
|
this.req = req;
|
@@ -6528,6 +6513,21 @@ class GraphQLRecaller {
|
|
6528
6513
|
}
|
6529
6514
|
}
|
6530
6515
|
|
6516
|
+
class ServiceBrokerRecaller {
|
6517
|
+
constructor(serviceName, requestBody, successCallback, errorCallback) {
|
6518
|
+
this.serviceName = serviceName;
|
6519
|
+
this.requestBody = requestBody;
|
6520
|
+
this.successCallback = successCallback;
|
6521
|
+
this.errorCallback = errorCallback;
|
6522
|
+
}
|
6523
|
+
reCall(requestBody) {
|
6524
|
+
if (requestBody) {
|
6525
|
+
this.requestBody = requestBody;
|
6526
|
+
}
|
6527
|
+
return DataFetcher.get().callServiceBroker(this.serviceName, this.requestBody).then(this.successCallback, this.errorCallback);
|
6528
|
+
}
|
6529
|
+
}
|
6530
|
+
|
6531
6531
|
var __asyncValues = (undefined && undefined.__asyncValues) || function (o) {
|
6532
6532
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
6533
6533
|
var m = o[Symbol.asyncIterator], i;
|
@@ -6872,9 +6872,13 @@ class DataFetcher {
|
|
6872
6872
|
const { data: dataResponse, errors: errorsResponse, extensions } = response;
|
6873
6873
|
//Reject promises with errors from query
|
6874
6874
|
errorsResponse.forEach((errorResponse) => {
|
6875
|
-
Object.entries(errorResponse).forEach(([
|
6875
|
+
Object.entries(errorResponse).forEach(async ([key, val]) => {
|
6876
6876
|
var _a;
|
6877
|
-
|
6877
|
+
const waitingRequest = watingRequestsById.get(val.request.variables[val.index].queryID);
|
6878
|
+
const hasClientEvent = await this.proccesGraphQLClientEvents(extensions, waitingRequest.request, waitingRequest.resolve, waitingRequest.reject);
|
6879
|
+
if (!hasClientEvent) {
|
6880
|
+
(((_a = watingRequestsById.get(val.request.variables[val.index].queryID)) === null || _a === void 0 ? void 0 : _a.reject) || Promise.reject)(new ErrorException("Falha detectada", val.message));
|
6881
|
+
}
|
6878
6882
|
});
|
6879
6883
|
});
|
6880
6884
|
//Resolve promises with data from query
|
@@ -9,6 +9,7 @@ var FilterItemType;
|
|
9
9
|
FilterItemType["DEFAULT_FILTER"] = "DEFAULT_FILTER";
|
10
10
|
FilterItemType["PERSONALIZED"] = "PERSONALIZED";
|
11
11
|
FilterItemType["MULTI_LIST"] = "MULTI_LIST";
|
12
|
+
FilterItemType["CHECK_BOX_LIST"] = "CHECK_BOX_LIST";
|
12
13
|
})(FilterItemType || (FilterItemType = {}));
|
13
14
|
const FilterItemType$1 = FilterItemType;
|
14
15
|
|
@@ -20,6 +20,7 @@ export { SnkFilterAdvancedMode as SnkFilterAdvancedMode } from '../types/compone
|
|
20
20
|
export { SnkFilterAssistentMode as SnkFilterAssistentMode } from '../types/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode';
|
21
21
|
export { SnkFilterBar as SnkFilterBar } from '../types/components/snk-filter-bar/snk-filter-bar';
|
22
22
|
export { SnkFilterBinarySelect as SnkFilterBinarySelect } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-binary-select';
|
23
|
+
export { SnkFilterCheckboxList as SnkFilterCheckboxList } from '../types/components/snk-filter-bar/filter-item/editors/snk-filter-checkbox-list';
|
23
24
|
export { SnkFilterDetail as SnkFilterDetail } from '../types/components/snk-filter-bar/filter-item/snk-filter-detail';
|
24
25
|
export { SnkFilterFieldSearch as SnkFilterFieldSearch } from '../types/components/snk-filter-field-search/snk-filter-field-search';
|
25
26
|
export { SnkFilterItem as SnkFilterItem } from '../types/components/snk-filter-bar/filter-item/snk-filter-item';
|
package/dist/components/index.js
CHANGED
@@ -20,6 +20,7 @@ export { SnkFilterAdvancedMode, defineCustomElement as defineCustomElementSnkFil
|
|
20
20
|
export { SnkFilterAssistentMode, defineCustomElement as defineCustomElementSnkFilterAssistentMode } from './snk-filter-assistent-mode.js';
|
21
21
|
export { SnkFilterBar, defineCustomElement as defineCustomElementSnkFilterBar } from './snk-filter-bar.js';
|
22
22
|
export { SnkFilterBinarySelect, defineCustomElement as defineCustomElementSnkFilterBinarySelect } from './snk-filter-binary-select.js';
|
23
|
+
export { SnkFilterCheckboxList, defineCustomElement as defineCustomElementSnkFilterCheckboxList } from './snk-filter-checkbox-list.js';
|
23
24
|
export { SnkFilterDetail, defineCustomElement as defineCustomElementSnkFilterDetail } from './snk-filter-detail.js';
|
24
25
|
export { SnkFilterFieldSearch, defineCustomElement as defineCustomElementSnkFilterFieldSearch } from './snk-filter-field-search.js';
|
25
26
|
export { SnkFilterItem, defineCustomElement as defineCustomElementSnkFilterItem } from './snk-filter-item.js';
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
2
|
-
import { DateUtils, StringUtils, ObjectUtils, WaitingChangeException, WarningException, ErrorException, OnboardingUtils, DependencyType, ElementIDUtils, DataType, ApplicationContext, ErrorTracking } from '@sankhyalabs/core';
|
2
|
+
import { DateUtils, StringUtils, ObjectUtils, WaitingChangeException, WarningException, ErrorException, KeyboardManager, OnboardingUtils, DependencyType, ElementIDUtils, DataType, ApplicationContext, ErrorTracking } from '@sankhyalabs/core';
|
3
3
|
import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
|
4
4
|
import { C as ConfigStorage } from './ConfigStorage.js';
|
5
5
|
import { d as dist, D as DataFetcher, U as UrlUtils } from './DataFetcher.js';
|
@@ -170,6 +170,18 @@ class Workspace {
|
|
170
170
|
var _a;
|
171
171
|
(_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.setScreenToUseOldLayout();
|
172
172
|
}
|
173
|
+
static showDesktop() {
|
174
|
+
var _a, _b;
|
175
|
+
(_b = (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.showDesktop) === null || _b === void 0 ? void 0 : _b.call(_a);
|
176
|
+
}
|
177
|
+
static searchApp() {
|
178
|
+
var _a, _b;
|
179
|
+
(_b = (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.searchApp) === null || _b === void 0 ? void 0 : _b.call(_a);
|
180
|
+
}
|
181
|
+
static openHelp() {
|
182
|
+
var _a, _b;
|
183
|
+
(_b = (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.openHelp) === null || _b === void 0 ? void 0 : _b.call(_a);
|
184
|
+
}
|
173
185
|
static applicationClick() {
|
174
186
|
var _a, _b;
|
175
187
|
if (!((_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.applicationClick)) {
|
@@ -250,6 +262,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
250
262
|
this.applicationLoading = createEvent(this, "applicationLoading", 7);
|
251
263
|
this.NEW_VERSION_POPUP_LOCKER = "NEW_VERSION_POPUP_LOCKER";
|
252
264
|
this._authPromises = [];
|
265
|
+
this._keyboardManager = new KeyboardManager();
|
253
266
|
this._duCache = new Map();
|
254
267
|
this._duPromises = new Map();
|
255
268
|
this._requestListener = new RequestListenerLoadingBar();
|
@@ -309,6 +322,14 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
309
322
|
});
|
310
323
|
}
|
311
324
|
}
|
325
|
+
/**
|
326
|
+
* Obtém o controlador de teclado.
|
327
|
+
*
|
328
|
+
* @return {KeyboardManager} the keyboard manager
|
329
|
+
*/
|
330
|
+
async getKeyboardManager() {
|
331
|
+
return Promise.resolve(this._keyboardManager);
|
332
|
+
}
|
312
333
|
/**
|
313
334
|
* Obtém `true` caso o usuário logado seja o SUP.
|
314
335
|
*/
|
@@ -1082,6 +1103,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
1082
1103
|
}
|
1083
1104
|
disconnectedCallback() {
|
1084
1105
|
DataFetcher.removeRequestListener(this._requestListener);
|
1106
|
+
this.removeShortcuts();
|
1085
1107
|
}
|
1086
1108
|
async componentDidLoad() {
|
1087
1109
|
this.applicationLoading.emit(true);
|
@@ -1092,6 +1114,19 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
1092
1114
|
});
|
1093
1115
|
ElementIDUtils.addIDInfo(this._element, `resource_${this.applicationResourceID}`);
|
1094
1116
|
await this.handleShowNewVersionPopup();
|
1117
|
+
this.initKeyboardManager();
|
1118
|
+
}
|
1119
|
+
initKeyboardManager() {
|
1120
|
+
this._keyboardManager
|
1121
|
+
.bind("ctrl + g", Workspace.searchApp.bind(this), { description: "Pesquisar por telas" })
|
1122
|
+
.bind("ctrl + d", Workspace.showDesktop.bind(this), { description: "Mostrar o desktop" })
|
1123
|
+
.bind("F1", Workspace.openHelp.bind(this), { description: "Abrir ajuda" });
|
1124
|
+
}
|
1125
|
+
removeShortcuts() {
|
1126
|
+
this._keyboardManager
|
1127
|
+
.unbind("ctrl + g")
|
1128
|
+
.unbind("ctrl + d")
|
1129
|
+
.unbind("F1");
|
1095
1130
|
}
|
1096
1131
|
render() {
|
1097
1132
|
return (h("div", null, h("ez-loading-bar", { ref: (ref) => this._requestListener.loadingBar = ref }), h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() }), h("ez-modal", { opened: false, ref: (ref) => this._rightModal = ref, "modal-size": "small", closeOutsideClick: true, closeEsc: true })));
|
@@ -1102,6 +1137,7 @@ const SnkApplication = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
1102
1137
|
"messagesBuilder": [1040],
|
1103
1138
|
"configName": [1, "config-name"],
|
1104
1139
|
"loadByPK": [16],
|
1140
|
+
"getKeyboardManager": [64],
|
1105
1141
|
"isUserSup": [64],
|
1106
1142
|
"addPendingAction": [64],
|
1107
1143
|
"callServiceBroker": [64],
|
@@ -156,9 +156,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
156
156
|
return joinedPrimaryKeys;
|
157
157
|
}
|
158
158
|
componentWillLoad() {
|
159
|
-
|
160
|
-
application.hasAccess(AutorizationType.UPDATE, this._resourceID).then(canEdit => this._canEdit = canEdit);
|
159
|
+
this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
|
161
160
|
let parent = this._element.parentElement;
|
161
|
+
this._application
|
162
|
+
.hasAccess(AutorizationType.UPDATE, this._resourceID)
|
163
|
+
.then(canEdit => this._canEdit = canEdit);
|
162
164
|
while (parent) {
|
163
165
|
if (parent.tagName.toUpperCase() === "SNK-DATA-UNIT") {
|
164
166
|
this._snkDataUnit = parent;
|
@@ -169,11 +171,11 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
169
171
|
if (!this._dataUnit) {
|
170
172
|
this._snkDataUnit.addEventListener("dataUnitReady", (evt) => {
|
171
173
|
this._dataUnit = evt.detail;
|
172
|
-
this.initDataUnit(
|
174
|
+
this.initDataUnit();
|
173
175
|
});
|
174
176
|
}
|
175
177
|
else {
|
176
|
-
this.initDataUnit(
|
178
|
+
this.initDataUnit();
|
177
179
|
}
|
178
180
|
this._snkDataUnit.addEventListener("dataStateChange", async ({ detail: dataState }) => {
|
179
181
|
this._dataState = dataState;
|
@@ -186,10 +188,72 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
186
188
|
parent = parent.parentElement;
|
187
189
|
}
|
188
190
|
if (!this.configName) {
|
189
|
-
this.configName =
|
191
|
+
this.configName = this._application.configName;
|
190
192
|
}
|
191
193
|
}
|
192
|
-
|
194
|
+
componentDidLoad() {
|
195
|
+
this.initKeyboardManager();
|
196
|
+
}
|
197
|
+
disconnectedCallback() {
|
198
|
+
this.removeShortcuts();
|
199
|
+
}
|
200
|
+
async initKeyboardManager() {
|
201
|
+
const keyboardManager = await this._application.getKeyboardManager();
|
202
|
+
if (keyboardManager) {
|
203
|
+
const dataUnit = this._dataUnit || await this._snkDataUnit.getDataUnit();
|
204
|
+
keyboardManager
|
205
|
+
.bind("F6", this.toggleView.bind(this), { description: "Alterna entre modo formulário e grade." })
|
206
|
+
.bind("F7", dataUnit.saveData.bind(dataUnit), { description: "Salva os dados." })
|
207
|
+
.bind("ctrl + \\", dataUnit.saveData.bind(dataUnit), { description: "Salva os dados." })
|
208
|
+
.bind("F8", dataUnit.addRecord.bind(dataUnit), { description: "Adiciona um novo registro." })
|
209
|
+
.bind("F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado." })
|
210
|
+
.bind("ctrl + F9", dataUnit.removeSelectedRecords.bind(dataUnit), { description: "Remove o registro selecionado." })
|
211
|
+
.bind("ctrl + .", () => {
|
212
|
+
if (dataUnit.getSelectionInfo().records.length === 0) {
|
213
|
+
return dataUnit.selectFirst();
|
214
|
+
}
|
215
|
+
return dataUnit.nextRecord();
|
216
|
+
}, {
|
217
|
+
description: "Avança para o próximo registro."
|
218
|
+
})
|
219
|
+
.bind("ctrl + ,", dataUnit.previousRecord.bind(dataUnit), { description: "Retorna ao registro anterior." })
|
220
|
+
.bind("F5", async () => {
|
221
|
+
const currentView = await this._viewStack.getSelectedIndex();
|
222
|
+
if (VIEW_MODE.GRID === currentView) {
|
223
|
+
dataUnit.loadData();
|
224
|
+
}
|
225
|
+
}, { description: "Atualiza os dados." })
|
226
|
+
.bind("Escape", () => {
|
227
|
+
if (dataUnit.isDirty()) {
|
228
|
+
dataUnit.cancelEdition();
|
229
|
+
}
|
230
|
+
}, {
|
231
|
+
debounceTime: 1000,
|
232
|
+
description: "Cancela uma ação."
|
233
|
+
});
|
234
|
+
}
|
235
|
+
}
|
236
|
+
async removeShortcuts() {
|
237
|
+
const keyboardManager = await this._application.getKeyboardManager();
|
238
|
+
if (keyboardManager) {
|
239
|
+
keyboardManager
|
240
|
+
.unbind("F6")
|
241
|
+
.unbind("F7")
|
242
|
+
.unbind("ctrl + \\")
|
243
|
+
.unbind("F8")
|
244
|
+
.unbind("F9")
|
245
|
+
.unbind("ctrl + F9")
|
246
|
+
.unbind("ctrl + .")
|
247
|
+
.unbind("ctrl + ,")
|
248
|
+
.unbind("F5")
|
249
|
+
.unbind("Escape");
|
250
|
+
}
|
251
|
+
}
|
252
|
+
async toggleView() {
|
253
|
+
const currentView = await this._viewStack.getSelectedIndex();
|
254
|
+
this.setViewMode(VIEW_MODE.GRID === currentView ? VIEW_MODE.FORM : VIEW_MODE.GRID);
|
255
|
+
}
|
256
|
+
async initDataUnit() {
|
193
257
|
this.addDataElementID();
|
194
258
|
if (!this.messagesBuilder) {
|
195
259
|
this.messagesBuilder = this._snkDataUnit.messagesBuilder;
|
@@ -198,7 +262,7 @@ const SnkCrud$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
198
262
|
//Tenta pegar o resourceID do snkDataUnit;
|
199
263
|
this._resourceID = this._snkDataUnit.resourceID;
|
200
264
|
if (this._resourceID == undefined) {
|
201
|
-
this._resourceID = await
|
265
|
+
this._resourceID = await this._application.getResourceID();
|
202
266
|
}
|
203
267
|
}
|
204
268
|
}
|
@@ -265,7 +265,7 @@ const SnkDataUnit = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
265
265
|
removeConfirmation = this.getMessage("snkDataUnit.removeAllConfirmation", { size: selection.length });
|
266
266
|
multipleSelection = true;
|
267
267
|
}
|
268
|
-
if (removeConfirmation
|
268
|
+
if (!removeConfirmation) {
|
269
269
|
resolve(action);
|
270
270
|
}
|
271
271
|
else {
|
@@ -38,6 +38,8 @@ const buildFilter = (item) => {
|
|
38
38
|
return buildNumber(item);
|
39
39
|
case FilterItemType.PERSONALIZED:
|
40
40
|
return buildPersonalized(item);
|
41
|
+
case FilterItemType.CHECK_BOX_LIST:
|
42
|
+
return buildCheckboxList(item);
|
41
43
|
default:
|
42
44
|
return undefined;
|
43
45
|
}
|
@@ -70,6 +72,23 @@ function buildMultiList(item) {
|
|
70
72
|
};
|
71
73
|
}
|
72
74
|
}
|
75
|
+
function buildCheckboxList(item) {
|
76
|
+
var _a;
|
77
|
+
const { id, value, props } = item;
|
78
|
+
const selectedOptionNames = Object.entries(value !== null && value !== void 0 ? value : {})
|
79
|
+
.filter(([_, valueChecked]) => valueChecked === true)
|
80
|
+
.map(([key, _]) => key);
|
81
|
+
const selectedOptionsObject = (_a = props.options) === null || _a === void 0 ? void 0 : _a.filter(option => selectedOptionNames.includes(option.name));
|
82
|
+
return { name: id, expression: buildCheckboxListExpression(selectedOptionsObject), params: [] };
|
83
|
+
}
|
84
|
+
function buildCheckboxListExpression(options) {
|
85
|
+
let expression = "";
|
86
|
+
options.forEach((option, index) => {
|
87
|
+
var _a;
|
88
|
+
expression += ` ${index > 0 ? ((_a = option.operand) !== null && _a !== void 0 ? _a : 'OR') : ''} ${option.expression}`;
|
89
|
+
});
|
90
|
+
return expression.trim();
|
91
|
+
}
|
73
92
|
function parseMultiListValues(multiListValue) {
|
74
93
|
var _a, _b;
|
75
94
|
const value = (_b = (_a = multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.elements) !== null && _a !== void 0 ? _a : multiListValue === null || multiListValue === void 0 ? void 0 : multiListValue.members) !== null && _b !== void 0 ? _b : multiListValue;
|
@@ -540,8 +559,12 @@ const SnkFilterBar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
540
559
|
const callbackOnApplyFilter = (filters) => {
|
541
560
|
this.filterConfig = filters.map(this.normalizeItem).sort((a, b) => this._filtersComparator(a, b));
|
542
561
|
};
|
562
|
+
let filtersConfigCopy = ObjectUtils.copy(this.filterConfig);
|
563
|
+
filtersConfigCopy = filtersConfigCopy.sort((itemA, itemB) => {
|
564
|
+
return itemA.originOrder - itemB.originOrder;
|
565
|
+
});
|
543
566
|
const factoryParams = {
|
544
|
-
filterConfig:
|
567
|
+
filterConfig: filtersConfigCopy,
|
545
568
|
configName: this.configName,
|
546
569
|
onComplete: callbackOnApplyFilter,
|
547
570
|
getMessage: (key, props) => this.getMessage(key, props),
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
2
|
+
|
3
|
+
interface SnkFilterCheckboxList extends Components.SnkFilterCheckboxList, HTMLElement {}
|
4
|
+
export const SnkFilterCheckboxList: {
|
5
|
+
prototype: SnkFilterCheckboxList;
|
6
|
+
new (): SnkFilterCheckboxList;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* Used to define this component and all nested components recursively.
|
10
|
+
*/
|
11
|
+
export const defineCustomElement: () => void;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
2
|
+
import { ElementIDUtils } from '@sankhyalabs/core';
|
3
|
+
import { F as FilterItemType } from './filter-item-type.enum.js';
|
4
|
+
|
5
|
+
const SnkFilterCheckboxList$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
6
|
+
constructor() {
|
7
|
+
super();
|
8
|
+
this.__registerHost();
|
9
|
+
this.valueChanged = createEvent(this, "valueChanged", 7);
|
10
|
+
this.config = undefined;
|
11
|
+
this.optionsList = [];
|
12
|
+
}
|
13
|
+
componentDidLoad() {
|
14
|
+
if (this._element) {
|
15
|
+
ElementIDUtils.addIDInfo(this._element, 'filterContentEditor');
|
16
|
+
}
|
17
|
+
}
|
18
|
+
handleToggleCheck(itemChanged, checked) {
|
19
|
+
var _a, _b;
|
20
|
+
let configValueMap = (_a = this.config.value) !== null && _a !== void 0 ? _a : {};
|
21
|
+
configValueMap[itemChanged.name] = checked;
|
22
|
+
this.config = Object.assign(Object.assign({}, this.config), { value: configValueMap });
|
23
|
+
this.valueChanged.emit((_b = this.config) === null || _b === void 0 ? void 0 : _b.value);
|
24
|
+
}
|
25
|
+
renderOptions() {
|
26
|
+
return this.optionsList.map(option => (h("ez-check", { label: option.label, compact: true, onEzChange: (event) => this.handleToggleCheck(option, event.detail), value: !!this.isChecked(option.name) })));
|
27
|
+
}
|
28
|
+
isChecked(itemName) {
|
29
|
+
var _a;
|
30
|
+
return (_a = this.config.value) === null || _a === void 0 ? void 0 : _a[itemName];
|
31
|
+
}
|
32
|
+
buidOptions() {
|
33
|
+
var _a, _b, _c;
|
34
|
+
const propsOptions = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.options) !== null && _c !== void 0 ? _c : [];
|
35
|
+
this.optionsList = [...propsOptions];
|
36
|
+
}
|
37
|
+
componentWillRender() {
|
38
|
+
this.buidOptions();
|
39
|
+
}
|
40
|
+
render() {
|
41
|
+
if (!this.config || this.config.type !== FilterItemType.CHECK_BOX_LIST) {
|
42
|
+
return undefined;
|
43
|
+
}
|
44
|
+
return (h("div", { class: 'ez-flex ez-flex--column' }, this.renderOptions()));
|
45
|
+
}
|
46
|
+
get _element() { return this; }
|
47
|
+
}, [0, "snk-filter-checkbox-list", {
|
48
|
+
"config": [1040],
|
49
|
+
"optionsList": [32]
|
50
|
+
}]);
|
51
|
+
function defineCustomElement$1() {
|
52
|
+
if (typeof customElements === "undefined") {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
const components = ["snk-filter-checkbox-list"];
|
56
|
+
components.forEach(tagName => { switch (tagName) {
|
57
|
+
case "snk-filter-checkbox-list":
|
58
|
+
if (!customElements.get(tagName)) {
|
59
|
+
customElements.define(tagName, SnkFilterCheckboxList$1);
|
60
|
+
}
|
61
|
+
break;
|
62
|
+
} });
|
63
|
+
}
|
64
|
+
|
65
|
+
const SnkFilterCheckboxList = SnkFilterCheckboxList$1;
|
66
|
+
const defineCustomElement = defineCustomElement$1;
|
67
|
+
|
68
|
+
export { SnkFilterCheckboxList, defineCustomElement };
|
@@ -55,6 +55,13 @@ const SnkFilterDetail = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
55
55
|
}
|
56
56
|
};
|
57
57
|
return snkFilterPersonalizedProps;
|
58
|
+
case FilterItemType.CHECK_BOX_LIST:
|
59
|
+
return {
|
60
|
+
tag: "snk-filter-checkbox-list",
|
61
|
+
props: {
|
62
|
+
onValueChanged: evt => this.config = Object.assign(Object.assign({}, this.config), { value: evt.detail })
|
63
|
+
}
|
64
|
+
};
|
58
65
|
case FilterItemType.MULTI_LIST:
|
59
66
|
return {
|
60
67
|
tag: "snk-entity-list",
|
@@ -130,7 +130,7 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
130
130
|
}
|
131
131
|
}
|
132
132
|
getLabel(isTooltipLabel = false) {
|
133
|
-
var _a;
|
133
|
+
var _a, _b;
|
134
134
|
const { type, value, label, props, groupedItems = [] } = this.config;
|
135
135
|
if (value || groupedItems.length) {
|
136
136
|
if (type === FilterItemType.BINARY_SELECT) {
|
@@ -191,18 +191,15 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
191
191
|
}
|
192
192
|
if (type === FilterItemType.MULTI_LIST) {
|
193
193
|
const selectedOptions = ((_a = value.elements) !== null && _a !== void 0 ? _a : value).filter(item => item === null || item === void 0 ? void 0 : item.check);
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
}
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
return `${label}: ${checkedAmount} ${this.getMessage('snkFilterBar.multiListToltip')}`;
|
204
|
-
}
|
205
|
-
return `${label}: ${selectedOptions[0].label}`;
|
194
|
+
return this.getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel);
|
195
|
+
}
|
196
|
+
if (type === FilterItemType.CHECK_BOX_LIST) {
|
197
|
+
const selectedValues = Object.entries(value !== null && value !== void 0 ? value : {})
|
198
|
+
.filter(([_, value]) => value === true)
|
199
|
+
.map(([key, _]) => key);
|
200
|
+
const options = (_b = props.options) !== null && _b !== void 0 ? _b : [];
|
201
|
+
const selectedOptions = options.filter(option => selectedValues.includes(option.name));
|
202
|
+
return this.getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel);
|
206
203
|
}
|
207
204
|
if (type === FilterItemType.NUMBER && props.variation === FilterNumberVariation.INTERVAL) {
|
208
205
|
const { start, end } = value;
|
@@ -220,6 +217,20 @@ const SnkFilterItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
220
217
|
}
|
221
218
|
return label;
|
222
219
|
}
|
220
|
+
getLabelFromCheckedOptions(selectedOptions, label, isTooltipLabel) {
|
221
|
+
const checkedAmount = selectedOptions.length;
|
222
|
+
if (checkedAmount === 0) {
|
223
|
+
return `${label}`;
|
224
|
+
}
|
225
|
+
if (checkedAmount > 1) {
|
226
|
+
if (isTooltipLabel) {
|
227
|
+
const selectedOptionsDescrptions = selectedOptions.map(item => item.label);
|
228
|
+
return `${label}: ${selectedOptionsDescrptions.join(',')}`;
|
229
|
+
}
|
230
|
+
return `${label}: ${checkedAmount} ${this.getMessage('snkFilterBar.multiListToltip')}`;
|
231
|
+
}
|
232
|
+
return `${label}: ${selectedOptions[0].label}`;
|
233
|
+
}
|
223
234
|
calculateActiveCount(groupedItems) {
|
224
235
|
return groupedItems.reduce((total, item) => {
|
225
236
|
if (!!item.visible)
|
@@ -46,6 +46,8 @@ const SnkFilterModalItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
46
46
|
return { tag: "snk-filter-number", props };
|
47
47
|
case FilterItemType.PERSONALIZED:
|
48
48
|
return this.buildSnkFilterPersonalizedProps();
|
49
|
+
case FilterItemType.CHECK_BOX_LIST:
|
50
|
+
return { tag: "snk-filter-checkbox-list", props };
|
49
51
|
case FilterItemType.MULTI_LIST:
|
50
52
|
return { tag: "snk-entity-list", props: { maxHeightList: "640px", rightListSlotBuilder: item => this.buildRightSlot(item) } };
|
51
53
|
}
|
@@ -69,7 +71,7 @@ const SnkFilterModalItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
69
71
|
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { visible: newValue > 0, value: newValue, groupedItems: data.items });
|
70
72
|
}
|
71
73
|
else {
|
72
|
-
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === FilterItemType.SEARCH ? data : newValue, visible: this.isVisible(newValue) });
|
74
|
+
this.filterItem = Object.assign(Object.assign({}, this.filterItem), { value: this.filterItem.type === (FilterItemType.SEARCH || FilterItemType.CHECK_BOX_LIST) ? data : newValue, visible: this.isVisible(newValue) });
|
73
75
|
}
|
74
76
|
}
|
75
77
|
handleDeleteFilter(filter, filterItemType) {
|
@@ -124,10 +124,15 @@ const SnkFilterModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
124
124
|
const index = filterListCopy.findIndex(item => item.id === filterItem.id);
|
125
125
|
filterListCopy.splice(index, 1, filterItemCopy);
|
126
126
|
this.filters = ObjectUtils.copy(filterListCopy);
|
127
|
+
return;
|
127
128
|
}
|
128
|
-
|
129
|
-
|
129
|
+
if (FilterItemType.CHECK_BOX_LIST === filterItem.type) {
|
130
|
+
const filterListCopy = ObjectUtils.copy(this.filters);
|
131
|
+
filterListCopy.find(filter => filter.id === filterItem.id).value = undefined;
|
132
|
+
this.filters = ObjectUtils.copy(filterListCopy);
|
133
|
+
return;
|
130
134
|
}
|
135
|
+
this.filters.find(filter => filter.id === filterItem.id).value = undefined;
|
131
136
|
}
|
132
137
|
uncheckFilterValues(valueList) {
|
133
138
|
valueList.forEach(value => {
|
@@ -176,11 +181,17 @@ const SnkFilterModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
176
181
|
getIformedFiltersCount(listItems) {
|
177
182
|
let countInformedItens = 0;
|
178
183
|
listItems.forEach(item => {
|
179
|
-
var _a, _b, _c, _d, _e;
|
184
|
+
var _a, _b, _c, _d, _e, _f;
|
180
185
|
if (FilterItemType.MULTI_LIST === item.type) {
|
181
186
|
countInformedItens += (_e = (_d = (_c = ((_b = (_a = item.value) === null || _a === void 0 ? void 0 : _a.elements) !== null && _b !== void 0 ? _b : item.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) !== null && _e !== void 0 ? _e : 0;
|
182
187
|
return;
|
183
188
|
}
|
189
|
+
if (FilterItemType.CHECK_BOX_LIST === item.type) {
|
190
|
+
countInformedItens += Object.entries((_f = item.value) !== null && _f !== void 0 ? _f : {})
|
191
|
+
.filter(([_, value]) => value === true)
|
192
|
+
.map(([key, _]) => key).length;
|
193
|
+
return;
|
194
|
+
}
|
184
195
|
if (item.groupedItems != undefined) {
|
185
196
|
countInformedItens = item.groupedItems.filter(item => item.visible).length;
|
186
197
|
return;
|